/* Matomo Javascript - cb=a14788798e1a9299dc3471ff5946556d*/

(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["TagManager"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["TagManager"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},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 a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},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/TagManager/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,"ImportVersion",(function(){return p})),n.d(t,"VariableSelect",(function(){return G})),n.d(t,"VariableSelectType",(function(){return ne})),n.d(t,"FieldTextareaVariable",(function(){return ue})),n.d(t,"FieldVariableTemplate",(function(){return Te})),n.d(t,"FieldVariableTypeTemplate",(function(){return Ne})),n.d(t,"VariableEdit",(function(){return St})),n.d(t,"VariableList",(function(){return yn})),n.d(t,"VariableManage",(function(){return wn})),n.d(t,"TriggerEdit",(function(){return Sa})),n.d(t,"TriggerList",(function(){return mi})),n.d(t,"TriggerManage",(function(){return vi})),n.d(t,"TagEdit",(function(){return wo})),n.d(t,"TagList",(function(){return Cl})),n.d(t,"TagManage",(function(){return Ml})),n.d(t,"VersionEdit",(function(){return Gc})),n.d(t,"VersionList",(function(){return Ls})),n.d(t,"VersionManage",(function(){return Gs})),n.d(t,"ContainerEdit",(function(){return pd})),n.d(t,"ContainerList",(function(){return Zd})),n.d(t,"ContainerManage",(function(){return nu})),n.d(t,"ContainerDashboard",(function(){return Ju})),n.d(t,"ContainerSelector",(function(){return sg})),n.d(t,"ManageInstallTagCode",(function(){return Kg})),n.d(t,"TrackingCodeCommon",(function(){return Nb})),n.d(t,"TrackingCodePage",(function(){return _b})),n.d(t,"TrackingSPAPage",(function(){return im})),n.d(t,"Debugging",(function(){return Vp})),n.d(t,"CopyDialog",(function(){return kp})),"undefined"!==typeof window){var a=window.document.currentScript,i=a&&a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var r=n("8bbf"),o={class:"tagManagerImportVersion"},l={class:"ui-confirm",id:"confirmImportContainerVersion",ref:"confirmImportContainerVersion"},c=["value"],s=["value"];function d(e,t,n,a,i,d){var u=Object(r["resolveComponent"])("ActivityIndicator"),g=Object(r["resolveComponent"])("Field"),b=Object(r["resolveComponent"])("SaveButton"),m=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",o,[Object(r["createVNode"])(m,{"content-title":e.translate("TagManager_ImportVersion")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionImportInfo")),1),Object(r["createVNode"])(u,{loading:e.isUpdating,"loading-message":e.translate("TagManager_UpdatingData")},null,8,["loading","loading-message"]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(g,{uicontrol:"text",modelValue:e.backupName,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.backupName=t}),name:"backupName",placeholder:" ",title:e.backupNameTitle,"inline-help":e.translate("TagManager_BackupVersionNameHelp")},null,8,["modelValue","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(g,{uicontrol:"textarea",modelValue:e.importContent,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.importContent=t}),name:"importContent",placeholder:" ","full-width":!0,title:e.translate("TagManager_VersionImportContentTitle")},null,8,["modelValue","title"])]),Object(r["createVNode"])(b,{class:"importVersion",disabled:!e.importContent,onConfirm:t[2]||(t[2]=function(t){return e.importVersion(e.backupName,e.importContent)}),value:e.translate("TagManager_VersionImportOverwriteContent")},null,8,["disabled","value"])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",l,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfirmImportContainerVersion")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,c),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,s)],512)])}var u=n("19dc"),g=n("a5a2"),b="importContainerVersion",m=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0}},components:{ContentBlock:u["ContentBlock"],ActivityIndicator:u["ActivityIndicator"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){return{isUpdating:!1,backupName:"",importContent:""}},methods:{showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,type:"toast",id:b});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)},importVersion:function(e,t){var n=this;if(t){var a;try{a=JSON.parse(t)}catch(i){return void this.showNotification(Object(u["translate"])("TagManager_ErrorInvalidContainerImportFormat"),"error")}"tags"in a&&"triggers"in a&&"variables"in a&&"idcontainer"in a&&"context"in a?u["Matomo"].helper.modalConfirm(this.$refs.confirmImportContainerVersion,{yes:function(){n.isUpdating=!0;var e={exportedContainerVersion:t};u["AjaxHelper"].post({method:"TagManager.importContainerVersion",idContainer:n.idContainer,backupName:n.backupName},e).then((function(){n.showNotification(Object(u["translate"])("TagManager_VersionImportSuccess"),"success"),n.isUpdating=!1,window.location.reload()})).catch((function(){n.isUpdating=!1}))}}):this.showNotification(Object(u["translate"])("TagManager_ErrorContainerVersionImportIncomplete"),"error")}}},computed:{backupNameTitle:function(){return"".concat(Object(u["translate"])("TagManager_BackupVersionName")," (").concat(Object(u["translate"])("General_Recommended"),")")}}});m.render=d;var p=m,h={class:"tagManagerManageSelect tagManagerVariableSelect"},f={class:"tableActionBar"},v=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),j={class:"collection with-header"},O={class:"collection-header"},T=["onClick"],y={class:"title"},V={class:"secondary-content"},C=["onClick","title"],N={class:"collection-header"},E=["onClick"],S={class:"title"},w={class:"secondary-content"},k=["title"],M={class:"tableActionBar"},_=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function D(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ActivityIndicator");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",h,[Object(r["createVNode"])(l,{loading:e.isLoading},null,8,["loading"]),Object(r["createElementVNode"])("div",f,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVariable",onClick:t[0]||(t[0]=function(t){return e.createVariable()})},[v,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],512),[[r["vShow"],!e.isLoading]])]),Object(r["createElementVNode"])("ul",j,[Object(r["createElementVNode"])("li",O,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.translate("TagManager_CustomVariables")),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containerVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",onClick:function(n){return e.selectVariable(t)},key:n},[Object(r["createElementVNode"])("span",y,Object(r["toDisplayString"])(t.name)+" ("+Object(r["toDisplayString"])(e.translate("TagManager_Type"))+": "+Object(r["toDisplayString"])(t.type)+") ",1),Object(r["createElementVNode"])("span",V,[Object(r["createElementVNode"])("i",{class:"icon-edit",onClick:Object(r["withModifiers"])((function(n){return e.editVariable(t)}),["stop"]),title:e.translate("General_Edit")},null,8,C)])],8,T)})),128))]),Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PreconfiguredVariables")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.preconfiguredVariables,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t.name},[Object(r["createElementVNode"])("li",N,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:n,onClick:function(n){return e.selectVariable(t)}},[Object(r["createElementVNode"])("span",S,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",w,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.description},null,8,k)],512),[[r["vShow"],!!t.description]])],8,E)),[[r["vShow"],t.is_pre_configured]])})),128))])})),128)),Object(r["createElementVNode"])("div",M,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVariable",onClick:t[1]||(t[1]=function(t){return e.createVariable()})},[_,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable",e.translate("TagManager_Variable"))),1)],512),[[r["vShow"],!e.isLoading]])])])}function A(e){return U(e)||L(e)||B(e)||x()}function x(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function B(e,t){if(e){if("string"===typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}function L(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function U(e){if(Array.isArray(e))return P(e)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var I=window,F=I.tagManagerHelper,H=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0},idContainerVersion:Number},components:{ActivityIndicator:u["ActivityIndicator"]},data:function(){return{preconfiguredVariables:[],containerVariables:[],isLoading:!1,actualIdContainerVersion:this.idContainerVersion}},emits:["selectVariable"],created:function(){this.fetchAvailableVariables()},watch:{idContainerVersion:function(e){this.actualIdContainerVersion=e}},methods:{fetchAvailableVariables:function(){var e=this;this.preconfiguredVariables=[],this.containerVariables=[],this.fetchContainer().then((function(t){return e.isLoading=!0,e.actualIdContainerVersion=t.draft.idcontainerversion,u["AjaxHelper"].fetch({method:"TagManager.getAvailableContainerVariables",filter_limit:"-1",idContainer:e.idContainer,idContainerVersion:e.actualIdContainerVersion}).then((function(t){e.preconfiguredVariables=[],e.containerVariables=[],e.isLoading=!1,t.forEach((function(t){var n,a=Object.assign(Object.assign({},t),{},{types:t.types.filter((function(e){return e.is_pre_configured}))});(n=e.containerVariables).push.apply(n,A(t.types.filter((function(e){return!e.is_pre_configured})))),a.types.length&&e.preconfiguredVariables.push(a)}))})).catch((function(){e.isLoading=!1}))}))},editVariable:function(e){var t=this;this.actualIdContainerVersion&&F.editVariable(this.idContainer,this.actualIdContainerVersion,e.idvariable,(function(){t.fetchAvailableVariables()}))},createVariable:function(){var e=this;this.actualIdContainerVersion&&F.editVariable(this.idContainer,this.actualIdContainerVersion,0,(function(){e.fetchAvailableVariables()}))},selectVariable:function(e){this.$emit("selectVariable",{variable:e})},fetchContainer:function(){return this.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainer",filter_limit:"-1",idContainer:this.idContainer})}}});H.render=D;var G=H,R={class:"tagManagerManageSelect tagManagerVariableSelectType"},q=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function z(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",R,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"select",name:"variableType".concat(e.variableType),class:"selectVariableType","model-value":e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.onChange(t)}),"full-width":!0,options:e.containerVariables},null,8,["name","model-value","options"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVariable",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.createVariable()}),["prevent"]))},[q,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],512),[[r["vShow"],!e.isLoading]])])}function W(e){return Y(e)||J(e)||K(e)||X()}function X(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(e,t){if(e){if("string"===typeof e)return Z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}function J(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Y(e){if(Array.isArray(e))return Z(e)}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Q=window,ee=Q.tagManagerHelper,te=Object(r["defineComponent"])({props:{variableTypeName:{type:String,required:!0},modelValue:String,variableType:String},components:{Field:g["Field"]},emits:["update:modelValue"],data:function(){return{containerVariables:[],isLoading:!1,idContainerVersion:null}},created:function(){this.fetchAvailableVariables()},methods:{fetchAvailableVariables:function(){var e=this;this.containerVariables=[],this.fetchContainer().then((function(t){return e.isLoading=!0,e.idContainerVersion=t.draft.idcontainerversion,u["AjaxHelper"].fetch({method:"TagManager.getAvailableContainerVariables",filter_limit:"-1",idContainer:u["MatomoUrl"].parsed.value.idContainer,idContainerVersion:e.idContainerVersion}).then((function(t){e.containerVariables=[],e.isLoading=!1,t.forEach((function(t){var n,a=t.types.filter((function(t){return t.type===e.variableType})).map((function(e){return{key:"{{".concat(e.id,"}}"),value:e.name}}));(n=e.containerVariables).push.apply(n,W(a))})),e.modelValue||1!==e.containerVariables.length||e.onChange(e.containerVariables[0].key)})).catch((function(){e.isLoading=!1}))}))},onChange:function(e){this.$emit("update:modelValue",e)},createVariable:function(){var e=this;this.idContainerVersion&&ee.editVariable(u["MatomoUrl"].parsed.value.idContainer,this.idContainerVersion,0,(function(t){e.fetchAvailableVariables(),t&&e.onChange("{{".concat(t.name,"}}"))}),this.variableType)},fetchContainer:function(){return this.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainer",filter_limit:"-1",idContainer:u["MatomoUrl"].parsed.value.idContainer})}}});te.render=z;var ne=te,ae={class:"fieldVariableTemplate"},ie=["type","id","name","value"],re=["title"],oe=["for","innerHTML"];function le(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ae,[Object(r["createElementVNode"])("textarea",Object(r["mergeProps"])({class:"control_".concat(e.uiControl," materialize-textarea"),type:e.uiControl,id:e.name,name:e.name,value:e.modelValue,onKeydown:t[0]||(t[0]=function(t){return e.onKeydown(t)}),onChange:t[1]||(t[1]=function(t){return e.onKeydown(t)}),placeholder:"",style:{width:"calc(100% - 40px)"}},e.uiControlAttributes,{ref:"textarea"}),null,16,ie),Object(r["createElementVNode"])("span",{class:"icon-code",style:{"margin-top":"14px",position:"absolute"},title:e.translate("TagManager_ChooseVariable"),onClick:t[2]||(t[2]=function(t){return e.selectVariable()})},null,8,re),Object(r["createElementVNode"])("label",{for:e.name,innerHTML:e.$sanitize(e.title)},null,8,oe)])}var ce=window,se=ce.tagManagerHelper,de=Object(r["defineComponent"])({props:{name:String,uiControlAttributes:Object,modelValue:String,title:String,uiControl:{type:String,required:!0}},inheritAttrs:!1,emits:["update:modelValue"],created:function(){this.onKeydown=Object(u["debounce"])(this.onKeydown.bind(this),50)},methods:{onKeydown:function(e){this.$emit("update:modelValue",e.target.value)},selectVariable:function(){var e=this;se.selectVariable((function(t){se.insertTextSnippetAtElement(e.$refs.textarea,"{{".concat(t.id,"}}"))}))}},watch:{modelValue:function(){var e=this,t=window,n=t.Materialize;setTimeout((function(){n.textareaAutoResize(e.$refs.textarea),n.updateTextFields()}))}},mounted:function(){var e=this,t=window,n=t.Materialize;setTimeout((function(){n.textareaAutoResize(e.$refs.textarea),n.updateTextFields()}))}});de.render=le;var ue=de,ge={class:"fieldVariableTemplate"},be=["type","id","name","value"],me=["title"],pe=Object(r["createElementVNode"])("br",null,null,-1),he=["for","innerHTML"];function fe(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ge,[Object(r["createElementVNode"])("input",Object(r["mergeProps"])({class:"control_".concat(e.uiControl),type:e.uiControl,id:e.name,name:e.name,value:e.modelValueText,onKeydown:t[0]||(t[0]=function(t){return e.onKeydown(t)}),onChange:t[1]||(t[1]=function(t){return e.onKeydown(t)}),placeholder:"",style:{width:"calc(100% - 40px)"}},e.uiControlAttributes,{ref:"input"}),null,16,be),Object(r["createElementVNode"])("span",{class:"icon-code",title:e.translate("TagManager_ChooseVariable"),onClick:t[2]||(t[2]=function(t){return e.selectVariable()})},null,8,me),pe,Object(r["createElementVNode"])("label",{for:e.name,innerHTML:e.$sanitize(e.title)},null,8,he)])}var ve=window,je=ve.tagManagerHelper,Oe=Object(r["defineComponent"])({props:{uiControl:{type:String,required:!0},uiControlAttributes:Object,name:String,title:String,modelValue:null},inheritAttrs:!1,emits:["update:modelValue"],computed:{modelValueText:function(){return"undefined"===typeof this.modelValue||null===this.modelValue?"":this.modelValue.toString()}},created:function(){this.onKeydown=Object(u["debounce"])(this.onKeydown.bind(this),50)},mounted:function(){setTimeout((function(){window.Materialize.updateTextFields()}))},watch:{modelValue:function(){setTimeout((function(){window.Materialize.updateTextFields()}))}},methods:{onKeydown:function(e){this.$emit("update:modelValue",e.target.value)},selectVariable:function(){var e=this;je.selectVariable((function(t){je.insertTextSnippetAtElement(e.$refs.input,"{{".concat(t.id,"}}"))}))}}});Oe.render=fe;var Te=Oe,ye=["for","innerHTML"];function Ve(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VariableSelectType");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createVNode"])(l,{"model-value":e.modelValue,id:e.name,name:e.name,"variable-type-name":e.title,"variable-type":e.uiControlAttributes.variableType,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("update:modelValue",t)})},null,8,["model-value","id","name","variable-type-name","variable-type"]),Object(r["createElementVNode"])("label",{for:e.name,style:{"font-size":"0.8rem"},innerHTML:e.$sanitize(e.title)},null,8,ye)])}var Ce=Object(r["defineComponent"])({props:{uiControlAttributes:{type:Object,required:!0},name:String,title:String,modelValue:String},components:{VariableSelectType:ne},emits:["update:modelValue"]});Ce.render=Ve;var Ne=Ce;function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Se={class:"editVariable tagManagerManageEdit",ref:"root"},we={class:"loadingPiwik"},ke=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Me={class:"loadingPiwik"},_e=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),De={key:0,class:"form-group row"},Ae={class:"col s12"},xe={key:1},Be={class:"form-group row"},Le={class:"col s12"},Ue={key:2},Pe={class:"innerFormField"},Ie={class:"form-group row"},Fe={class:"col s12 m12"},He={for:"lookup_table"},Ge={class:"innerFormField comparisonField"},$e={class:"innerFormField"},Re={class:"innerFormField"},qe=["onClick","title"],ze={class:"entityCancel"},We={id:"confirmSelectVariableType"},Xe={class:"collection-header"},Ke=["onClick","title"],Je=["src"],Ye={class:"title"},Ze={class:"secondary-content"},Qe=["title"],et={class:"entityCancel"};function tt(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("GroupedSettings"),d=Object(r["resolveComponent"])("SaveButton"),u=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Se,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,u,g,b;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",we,[ke,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Me,[_e,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[9]||(t[9]=function(t){return e.edit?e.updateVariable():e.createVariable()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isVariableDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{uicontrol:"text",name:"name","model-value":e.variable.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.variable.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_VariableNameHelp"),placeholder:e.translate("TagManager_VariableNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{uicontrol:"textarea",name:"description","model-value":e.variable.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.variable.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_VariableDescriptionHelp"),placeholder:e.translate("TagManager_VariableDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),null!==(n=e.variable.typeMetadata)&&void 0!==n&&null!==(a=n.parameters)&&void 0!==a&&a.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",De,[Object(r["createElementVNode"])("div",Ae,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureThisVariable")),1)])])):Object(r["createCommentVNode"])("",!0),e.variable?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",xe,[Object(r["createVNode"])(s,{settings:(null===(i=e.variable.typeMetadata)||void 0===i?void 0:i.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){return e.parameterValues[t.name]=t.value})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Be,[Object(r["createElementVNode"])("div",Le,[Object(r["createElementVNode"])("h3",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"showAdvancedSettings",onClick:t[3]||(t[3]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!0}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_ShowAdvancedSettings")),513),[[r["vShow"],!e.showAdvanced]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"hideAdvancedSettings",onClick:t[4]||(t[4]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!1}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_HideAdvancedSettings")),513),[[r["vShow"],e.showAdvanced]])])])],512),[[r["vShow"],null===(o=e.variable.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),e.variable&&e.variable.typeMetadata&&"MatomoConfiguration"===e.variable.typeMetadata.id?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ue,[Object(r["createVNode"])(s,{settings:(null===(u=e.variable.typeMetadata)||void 0===u?void 0:u.advancedParameters)||[],"all-setting-values":e.parameterValues,onChange:t[5]||(t[5]=function(t){return e.parameterValues[t.name]=t.value})},null,8,["settings","all-setting-values"])],512)),[[r["vShow"],e.showAdvanced&&(null===(g=e.variable.typeMetadata)||void 0===g?void 0:g.hasAdvancedSettings)]]):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Pe,[Object(r["createVNode"])(c,{uicontrol:"text",name:"default_value","model-value":e.variable.default_value,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.variable.default_value=t,e.setValueHasChanged()}),title:e.translate("TagManager_DefaultValue"),"inline-help":e.translate("TagManager_DefaultValueHelp"),placeholder:e.translate("TagManager_DefaultValuePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",Ie,[Object(r["createElementVNode"])("div",Fe,[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("label",He,Object(r["toDisplayString"])(e.translate("TagManager_LookupTableTitle")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.variable.lookup_table,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])("lookupTable lookupTable".concat(n," multiple valign-wrapper"))},[Object(r["createElementVNode"])("div",Ge,[Object(r["createVNode"])(c,{uicontrol:"select",name:"lookup_table_comparison","model-value":t.comparison,"onUpdate:modelValue":function(n){t.comparison=n,e.setValueHasChanged()},"full-width":!0,options:e.availableLookUpComparisons},null,8,["model-value","onUpdate:modelValue","options"])]),Object(r["createElementVNode"])("div",$e,[Object(r["createVNode"])(c,{uicontrol:"text",name:"lookup_table_matchvalue","model-value":t.match_value,"onUpdate:modelValue":function(n){t.match_value=n,e.setValueHasChanged()},"full-width":!0,placeholder:e.translate("TagManager_LookupTableMatchValue")},null,8,["model-value","onUpdate:modelValue","placeholder"])]),Object(r["createElementVNode"])("div",Re,[Object(r["createVNode"])(c,{uicontrol:"text",name:"lookup_table_outvalue","model-value":t.out_value,"onUpdate:modelValue":function(n){t.out_value=n,e.setValueHasChanged()},"full-width":!0,placeholder:e.translate("TagManager_LookupTableOutValue")},null,8,["model-value","onUpdate:modelValue","placeholder"])]),n+1!==e.variable.lookup_table.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:0,class:"icon-minus valign",onClick:function(t){return e.removeLookUpEntry(n)},title:e.translate("General_Remove")},null,8,qe)):Object(r["createCommentVNode"])("",!0)],2)})),128))])])])],512),[[r["vShow"],e.showAdvanced&&(null===(b=e.variable.typeMetadata)||void 0===b?void 0:b.hasAdvancedSettings)&&e.variable&&e.variable.typeMetadata&&"MatomoConfiguration"!==e.variable.typeMetadata.id]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isVariableDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(d,{class:"createButton",onConfirm:t[7]||(t[7]=function(t){return e.edit?e.updateVariable():e.createVariable()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewVariable")},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isVariableDisabled]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ze,[Object(r["createElementVNode"])("a",{onClick:t[8]||(t[8]=Object(r["withModifiers"])((function(t){return e.cancel()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],544),[[r["vShow"],!e.chooseVariableType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",We,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:n},[Object(r["createElementVNode"])("li",Xe,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:n,class:Object(r["normalizeClass"])(["collection-item avatar",Ee({disabledTemplate:l.isVariableTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createVariableType(t)},title:l.isVariableTemplateDisabled[t.id]?e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates")):""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,Je)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",Ye,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Ze,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,Qe)],512),[[r["vShow"],!!t.help]])],10,Ke)})),128))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",et,[Object(r["createElementVNode"])("a",{onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.cancel()}),["prevent"]))},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])],512),[[r["vShow"],e.chooseVariableType]])]})),_:1},8,["content-title"])],512)}function nt(e,t){return rt(e)||it(e,t)||st(e,t)||at()}function at(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function it(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function rt(e){if(Array.isArray(e))return e}function ot(e){return ot="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function lt(e){return ut(e)||dt(e)||st(e)||ct()}function ct(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function st(e,t){if(e){if("string"===typeof e)return gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(e,t):void 0}}function dt(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ut(e){if(Array.isArray(e))return gt(e)}function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function bt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function pt(e,t,n){return t&&mt(e.prototype,t),n&&mt(e,n),e}function ht(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var ft=function(){function e(){var t=this;bt(this,e),ht(this,"privateState",Object(r["reactive"])({variables:[],isLoadingVars:!1,isLoadingSingle:!1,isUpdating:!1})),ht(this,"state",Object(r["computed"])((function(){return t.privateState}))),ht(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingVars||e.isLoadingSingle}))),ht(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),ht(this,"variables",Object(r["computed"])((function(){return t.state.value.variables}))),ht(this,"fetchPromise",null),ht(this,"availableVariablesPromises",{})}return pt(e,[{key:"fetchVariablesIfNotLoaded",value:function(e,t){this.fetchPromise||this.fetchVariables(e,t)}},{key:"findVariable",value:function(e,t,n,a){var i=this,r=this.variables.value.find((function(e){return e.idvariable===n}));return r&&!a?Promise.resolve(r):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idVariable:n,idContainer:e,idContainerVersion:t,method:"TagManager.getContainerVariable",filter_limit:"-1"}).then((function(e){return i.privateState.variables=[].concat(lt(i.privateState.variables),[e]),e})).finally((function(){i.privateState.isLoadingSingle=!1})))}},{key:"fetchVariables",value:function(e,t){var n=this;return this.privateState.isLoadingVars=!0,this.privateState.variables=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainerVariables",idContainer:e,idContainerVersion:t,filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(e){return n.privateState.variables=e,n.privateState.isLoadingVars=!1,n.variables.value})).finally((function(){n.privateState.isLoadingVars=!1}))}},{key:"fetchAvailableVariables",value:function(e){return this.availableVariablesPromises[e]||(this.availableVariablesPromises[e]=u["AjaxHelper"].fetch({method:"TagManager.getAvailableVariableTypesInContext",idContext:e,filter_limit:"-1"}).then((function(e){return e}))),Promise.resolve(this.availableVariablesPromises[e])}},{key:"suggestNameForType",value:function(e){for(var t=this,n=function(n){var a=e;n&&(a="".concat(a," (").concat(n,")"));var i=!t.variables.value.some((function(e){return e.name===a}));if(i)return{v:a}},a=0;a<100;a+=1){var i=n(a);if("object"===ot(i))return i.v}}},{key:"createOrUpdateVariable",value:function(e,t,n,a,i){var r=this;this.privateState.isUpdating=!0;var o=Object.entries(i).map((function(e){var t=nt(e,2),n=t[0],a=t[1],i=a;return"boolean"===typeof a&&(i=(+a).toString()),[n,i]})),l=Object.fromEntries(o),c=e.lookup_table.filter((function(e){return e&&e.out_value&&e.comparison}));return u["AjaxHelper"].post({idVariable:e.idvariable,method:t,idContainer:n,idContainerVersion:a,type:e.type,name:e.name,description:e.description,defaultValue:e.default_value},{parameters:l,lookupTable:c},{withTokenInUrl:!0}).finally((function(){r.privateState.isUpdating=!1}))}},{key:"reload",value:function(e,t){return this.privateState.variables=[],this.fetchPromise=null,this.availableVariablesPromises={},this.fetchVariables(e,t)}},{key:"deleteVariable",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,this.privateState.variables=[],u["AjaxHelper"].fetch({idVariable:n,idContainerVersion:t,idContainer:e,method:"TagManager.deleteContainerVariable"},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}}]),e}(),vt=new ft;function jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ot(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Tt(e,t,n){return t&&Ot(e.prototype,t),n&&Ot(e,n),e}function yt(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var Vt=function(){function e(){var t=this;jt(this,e),yt(this,"privateState",Object(r["reactive"])({comparisons:[],isLoading:!1})),yt(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),yt(this,"isLoading",Object(r["computed"])((function(){return t.state.value.isLoading}))),yt(this,"comparisons",Object(r["computed"])((function(){return t.state.value.comparisons}))),yt(this,"comparisonOptions",Object(r["computed"])((function(){return t.comparisons.value.map((function(e){var t=e.id,n=e.name;return{key:t,value:n}}))}))),yt(this,"initializePromise",null)}return Tt(e,[{key:"init",value:function(){return this.initializePromise||(this.initializePromise=this.fetchAvailableComparisons()),this.initializePromise}},{key:"fetchAvailableComparisons",value:function(){var e=this;return this.privateState.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getAvailableComparisons",filter_limit:"-1"}).then((function(t){e.privateState.comparisons=t})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),Ct=new Vt,Nt="tagvariablemanagement",Et=Object(r["defineComponent"])({props:{idVariable:Number,idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},variableType:String,isEmbedded:{type:Boolean,default:!1}},components:{GroupedSettings:g["GroupedSettings"],ContentBlock:u["ContentBlock"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){return{isDirty:!1,showAdvanced:!1,chooseVariableType:!1,canUseCustomTemplates:u["Matomo"].hasUserCapability("tagmanager_use_custom_templates"),availableVariables:[],editTitle:"",variable:{},parameterValues:{},advancedParameters:{},isUpdatingVar:!1}},emits:["changeVariable"],created:function(){Ct.init(),vt.fetchVariablesIfNotLoaded(this.idContainer,this.idContainerVersion),this.initIdVariable()},watch:{idVariable:function(e){null!==e&&this.initIdVariable()},variableParameterValues:{handler:function(e,t){e&&t&&(this.isDirty=!0)},deep:!0},variableLookupTable:{handler:function(){var e=(this.variable.lookup_table||[]).every((function(e){return!(null===e||void 0===e||!e.out_value)}));e&&this.addLookUpEntry()},deep:!0}},methods:{removeAnyVariableNotification:function(){u["NotificationsStore"].remove(Nt),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=u["NotificationsStore"].show({message:e,context:t,id:Nt,type:null!==n?n:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(a)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdVariable:function(){var e=this;u["Matomo"].helper.lazyScrollToContent(),this.availableVariables=[],u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer,filter_limit:"-1"}).then((function(e){return vt.fetchAvailableVariables(e.context)})).then((function(t){e.availableVariables=t})).then((function(){if(e.edit&&e.idVariable)return e.editTitle=Object(u["translate"])("TagManager_EditVariable"),void vt.findVariable(e.idContainer,e.idContainerVersion,e.idVariable,e.isEmbedded).then((function(t){var n;t&&(e.variable=Object(u["clone"])(t),e.variable.typeMetadata.parameters=t.typeMetadata.parameters.filter((function(e){return!Object.prototype.hasOwnProperty.call(e,"uiControlAttributes")||!Object.prototype.hasOwnProperty.call(e.uiControlAttributes,"showAdvancedSettings")})),e.variable.typeMetadata.advancedParameters=t.typeMetadata.parameters.filter((function(e){return Object.prototype.hasOwnProperty.call(e,"uiControlAttributes")&&Object.prototype.hasOwnProperty.call(e.uiControlAttributes,"showAdvancedSettings")})),e.parameterValues=Object.fromEntries(t.typeMetadata.parameters.map((function(e){return[e.name,e.value]}))),(e.variable.lookup_table&&e.variable.lookup_table.length||e.variable.default_value)&&(e.showAdvanced=!0),e.addLookUpEntryIfNoneExists(),e.isDirty=!1,null!==(n=e.variable.typeMetadata)&&void 0!==n&&n.name&&(e.editTitle+=": ".concat(e.variable.typeMetadata.name)))}));if(e.create){var t=!1;e.variableType&&e.availableVariables.forEach((function(n){if(!t){var a=n.types.find((function(t){return(null===t||void 0===t?void 0:t.id)===e.variableType}));a&&(t=!0,e.createVariableType(a))}})),t||(e.editTitle=Object(u["translate"])("TagManager_ChooseVariableToContinue"),e.chooseVariableType=!0)}}))},addLookUpEntryIfNoneExists:function(){this.variable.lookup_table&&Array.isArray(this.variable.lookup_table)||(this.variable.lookup_table=[]),this.variable.lookup_table.length||this.variable.lookup_table.push({comparison:"equals",match_value:"",out_value:""})},addLookUpEntry:function(){this.variable.lookup_table.push({comparison:"equals",match_value:"",out_value:""}),this.isDirty=!0},removeLookUpEntry:function(e){e>-1&&(this.variable.lookup_table.splice(e,1),this.isDirty=!0)},createVariableType:function(e){var t,n=this;if(!e||!this.isVariableTemplateDisabled[e.id]){this.chooseVariableType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewVariable"),this.variable={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:vt.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainer:this.idContainer,idcontainerversion:this.idContainerVersion,default_value:"",lookup_table:[],typeMetadata:e},this.variable.typeMetadata.advancedParameters=[];var a=e.parameters.filter((function(e){return Object.prototype.hasOwnProperty.call(e,"uiControlAttributes")&&Object.prototype.hasOwnProperty.call(e.uiControlAttributes,"showAdvancedSettings")})),i=e.parameters.filter((function(e){return!Object.prototype.hasOwnProperty.call(e,"uiControlAttributes")||!Object.prototype.hasOwnProperty.call(e.uiControlAttributes,"showAdvancedSettings")}));this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.variable.typeMetadata.advancedParameters=a,this.variable.typeMetadata.parameters=i,null!==(t=this.variable.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.variable.typeMetadata.name)),this.addLookUpEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}}))}},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idVariable,u["MatomoUrl"].updateHash(e)},createVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,vt.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.addContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){e.isDirty=!1;var n=t.value;vt.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.variable.idvariable=n,void e.$emit("changeVariable",{variable:e.variable});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Variable"));if(e.hasPublishCapability()){var n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(t," ").concat(n),"success","transient")}else e.showNotification(t,"success")}),200)}))}})).finally((function(){e.isUpdatingVar=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,vt.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.updateContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t)if(e.isEmbedded)e.$emit("changeVariable",{variable:e.variable});else{e.isDirty=!1,vt.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdVariable()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Variable"));if(e.hasPublishCapability()){var a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(n," ").concat(a),"success","transient")}else e.showNotification(n,"success")}})).finally((function(){e.isUpdatingVar=!1})))},checkRequiredFieldsAreSet:function(){return!!this.variable.name||(this.showErrorFieldNotProvidedNotification(Object(u["translate"])("General_Name")),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{typeInlineHelp:function(){var e,t,n=(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.description)||"",a=(null===(t=this.variable.typeMetadata)||void 0===t?void 0:t.help)||"";return"".concat(n," ").concat(a)},create:function(){return 0===this.idVariable},edit:function(){return!this.create},isLoading:function(){return vt.isLoading.value||Ct.isLoading.value},isUpdating:function(){return vt.isUpdating.value||this.isUpdatingVar},availableLookUpComparisons:function(){return Ct.comparisonOptions.value},isVariableTemplateDisabled:function(){var e=this,t={};return this.availableVariables.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},isVariableDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},variableParameterValues:function(){var e;return null!==(e=this.variable.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null},variableLookupTable:function(){return this.variable.lookup_table}}});Et.render=tt;var St=Et,wt={class:"tagManagerManageList tagManagerVariableList"},kt={class:"variableSearchFilter"},Mt=["title"],_t=["title"],Dt=["title"],At=["title"],xt=["title"],Bt=["title"],Lt={colspan:"7"},Ut={class:"loadingPiwik"},Pt=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),It={colspan:"7"},Ft=["id"],Ht=["title"],Gt=["title"],$t=["title"],Rt={class:"lookupTable"},qt={class:"icon-ok"},zt=["title"],Wt=["onClick","title"],Xt=["onClick","title"],Kt=["onClick","title"],Jt={class:"tableActionBar"},Yt=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Zt=["title"],Qt=Object(r["createElementVNode"])("span",{class:"icon-help preconfiguredVariablesHelp"},null,-1),en={class:"collection-header"},tn={class:"title"},nn=["textContent"],an={class:"secondary-content"},rn=["title"],on={class:"ui-confirm",id:"confirmDeleteVariable",ref:"confirmDeleteVariable"},ln=["value"],cn=["value"],sn={class:"ui-confirm",id:"confirmDeleteVariableNotPossible",ref:"confirmDeleteVariableNotPossible"},dn={class:"collection"},un=["value"];function gn(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wt,[Object(r["createVNode"])(c,{feature:"Tag Manager",class:"tagManagerCustomVariablesList","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableUsageBenefits")),1),Object(r["createElementVNode"])("div",kt,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"variableSearch",title:e.translate("General_Search"),modelValue:e.variableSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.variableSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.variables.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,Mt),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,_t),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,Dt),Object(r["createElementVNode"])("th",{class:"lookupTable",title:e.lookupTableTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LookupTable")),9,At),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,xt),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Bt),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Lt,[Object(r["createElementVNode"])("span",Ut,[Pt,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",It,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVariablesFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVariableNow",onClick:t[1]||(t[1]=function(t){return e.createVariable()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariableNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&!e.variables.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"variable".concat(t.idvariable),class:"variables",key:t.idvariable},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ht),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Gt),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,$t),Object(r["createElementVNode"])("td",Rt,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",qt,null,512),[[r["vShow"],t.lookup_table.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,zt),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVariable(t.idvariable,t.type)},title:e.translate("TagManager_EditVariable")},null,8,Wt),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVariable(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Variable"))},null,8,Xt),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Variable"))},null,8,Kt),[[r["vShow"],e.hasPublishCapability()]])],2),[[r["vShow"],e.hasWriteAccess]])],8,Ft)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Jt,[Object(r["createElementVNode"])("a",{class:"createNewVariable",value:"",onClick:t[2]||(t[2]=function(t){return e.createVariable()})},[Yt,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("h2",{title:e.translate("TagManager_PreConfiguredInfoTitle")},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_PreconfiguredVariables"))+" ",1),Qt],8,Zt),Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containerVariables,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t},[Object(r["createElementVNode"])("li",en,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.types,(function(e){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.id},[Object(r["createElementVNode"])("span",tn,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.name)+" ",1),Object(r["createElementVNode"])("span",{class:"variableId",textContent:Object(r["toDisplayString"])("{{".concat(e.id,"}}"))},null,8,nn)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",an,[Object(r["createElementVNode"])("i",{class:"icon-help",title:e.description},null,8,rn)],512),[[r["vShow"],!!e.description]])],512)),[[r["vShow"],e.is_pre_configured]])})),128))])})),128))]),Object(r["createElementVNode"])("div",on,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVariableConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ln),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,cn)],512),Object(r["createElementVNode"])("div",sn,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedBy")),1),Object(r["createElementVNode"])("ul",dn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.variableReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:"".concat(e.referenceType,".").concat(e.referenceId)},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,un)],512)])}function bn(e){return fn(e)||hn(e)||pn(e)||mn()}function mn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pn(e,t){if(e){if("string"===typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vn(e,t):void 0}}function hn(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function fn(e){if(Array.isArray(e))return vn(e)}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var jn=window,On=jn.tagManagerHelper,Tn=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},variablesHelpText:String},components:{Field:g["Field"],ContentBlock:u["ContentBlock"]},directives:{ContentTable:u["ContentTable"]},data:function(){return{hasWriteAccess:u["Matomo"].hasUserCapability("tagmanager_write"),variableReferences:[],containerVariables:[],variableSearch:""}},created:function(){var e=this;vt.fetchVariables(this.idContainer,this.idContainerVersion),u["AjaxHelper"].fetch({method:"TagManager.getAvailableContainerVariables",idContainer:this.idContainer,idContainerVersion:this.idContainerVersion,filter_limit:"-1"}).then((function(t){e.containerVariables=t}))},methods:{createVariable:function(){this.editVariable(0)},editVariable:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idVariable:e}))},deleteVariable:function(e){var t=this;u["AjaxHelper"].fetch({method:"TagManager.getContainerVariableReferences",idContainer:this.idContainer,idContainerVersion:this.idContainerVersion,idVariable:e.idvariable}).then((function(n){n&&n.length?(t.variableReferences=n,u["Matomo"].helper.modalConfirm(t.$refs.confirmDeleteVariableNotPossible,{})):(t.variableReferences=[],u["Matomo"].helper.modalConfirm(t.$refs.confirmDeleteVariable,{yes:function(){vt.deleteVariable(t.idContainer,t.idContainerVersion,e.idvariable).then((function(){vt.reload(t.idContainer,t.idContainerVersion),u["NotificationsStore"].remove("CopyDialogResultNotification")}))}}))}))},truncateText:function(e,t){return On.truncateText(e,t)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyVariableDialog",idSite:e.idsite,idContainer:this.idContainer,idVariable:e.idvariable,idContainerVersion:this.idContainerVersion});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyVariable")}},computed:{isLoading:function(){return vt.isLoading.value},isUpdating:function(){return vt.isUpdating.value},variables:function(){return vt.variables.value},sortedVariables:function(){var e=this.variableSearch.toLowerCase(),t=bn(this.variables).filter((function(t){return Object.keys(t).some((function(n){var a=t,i="";if("string"===typeof a[n])i=a[n];else if("typeMetadata"===n){var r=a.typeMetadata;i=r.name}else if("parameters"===n&&"CustomJsFunction"===a.type){var o=a.parameters;i=o.jsFunction}return-1!==i.toLowerCase().indexOf(e)}))}));return t.sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_VariablesNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VariablesDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_VariablesTypeDescription")},lookupTableTranslatedText:function(){return this.translate("TagManager_VariablesLookupTableDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_VariablesLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VariablesActionDescription")},getActionClasses:function(){var e=this.hasPublishCapability()?" hasCopyAction":"";return"action".concat(e)}}});Tn.render=gn;var yn=Tn,Vn={class:"manageVariable"},Cn={key:0},Nn={key:1};function En(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VariableList"),c=Object(r["resolveComponent"])("VariableEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vn,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cn,[Object(r["createVNode"])(l,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"variables-help-text":e.variablesHelpText},null,8,["id-container-version","id-container","variables-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Nn,[Object(r["createVNode"])(c,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"id-variable":e.idVariable},null,8,["id-container-version","id-container","id-variable"])])):Object(r["createCommentVNode"])("",!0)])}var Sn=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,variablesHelpText:String},components:{VariableList:yn,VariableEdit:St},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idVariable}),(function(t){e.onIdVariableParamChange(t)})),u["NotificationsStore"].remove("variablevariablemanagement"),this.onIdVariableParamChange(u["MatomoUrl"].hashParsed.value.idVariable)},methods:{onIdVariableParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVariable",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idVariable:function(){var e=u["MatomoUrl"].hashParsed.value.idVariable;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idVariable}}});Sn.render=En;var wn=Sn;function kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mn={class:"editTrigger tagManagerManageEdit",ref:"root"},_n={class:"loadingPiwik"},Dn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),An={class:"loadingPiwik"},xn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Bn={class:"form-group row"},Ln={class:"col s12"},Un={key:0},Pn={class:"form-group row"},In={class:"col s12"},Fn={class:"form-group row multiple"},Hn={class:"col s12 input-field m6"},Gn={class:"col s12 input-field m6"},$n={class:"form-help"},Rn=["innerHTML"],qn={class:"col s12 m12"},zn={class:"innerFormField"},Wn={class:"innerFormField comparisonField"},Xn={class:"innerFormField"},Kn=["onClick","title"],Jn={class:"triggerConditionNode"},Yn={class:"entityCancel"},Zn={id:"confirmSelectTriggerType"},Qn={class:"collection-header"},ea=["onClick","title"],ta=["src"],na={class:"title"},aa={class:"secondary-content"},ia=["title"],ra={class:"entityCancel"};function oa(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("SaveButton"),d=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Mn,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,d;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",_n,[Dn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",An,[xn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[5]||(t[5]=function(t){return e.edit?e.updateTrigger():e.createTrigger()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.trigger.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.trigger.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_TriggerNameHelp"),placeholder:e.translate("TagManager_TriggerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.trigger.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.trigger.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_TriggerDescriptionHelp"),placeholder:e.translate("TagManager_TriggerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Bn,[Object(r["createElementVNode"])("div",Ln,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureThisTrigger")),1)])],512),[[r["vShow"],null===(n=e.trigger.typeMetadata)||void 0===n||null===(a=n.parameters)||void 0===a?void 0:a.length]]),e.trigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Un,[Object(r["createVNode"])(c,{settings:(null===(i=e.trigger.typeMetadata)||void 0===i?void 0:i.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){return e.parameterValues[t.name]=t.value})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Pn,[Object(r["createElementVNode"])("div",In,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_OnlyTriggerWhen"))+" "+Object(r["toDisplayString"])(e.translate("Goals_Optional")),1)])],512),[[r["vShow"],null===(o=e.trigger.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Fn,[Object(r["createElementVNode"])("div",Hn,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionsHelp")),1)]),Object(r["createElementVNode"])("div",Gn,[Object(r["createElementVNode"])("div",$n,[Object(r["createElementVNode"])("span",{class:"inline-help",innerHTML:e.$sanitize(e.triggerInlineHelpText)},null,8,Rn)])]),Object(r["createElementVNode"])("div",qn,[Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.trigger.conditions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])(["condition multiple valign-wrapper","condition".concat(n)])},[Object(r["createElementVNode"])("div",zn,[Object(r["createVNode"])(l,{uicontrol:"expandable-select",name:"condition_actual","model-value":t.actual,"onUpdate:modelValue":function(n){t.actual=n,e.setValueHasChanged()},"full-width":!0,options:e.availableVariables,title:e.variableIdToName[t.actual]||t.actual},null,8,["model-value","onUpdate:modelValue","options","title"])]),Object(r["createElementVNode"])("div",Wn,[Object(r["createVNode"])(l,{uicontrol:"select",name:"condition_comparison","model-value":t.comparison,"onUpdate:modelValue":function(n){t.comparison=n,e.setValueHasChanged()},"full-width":!0,options:e.availableComparisons},null,8,["model-value","onUpdate:modelValue","options"])]),Object(r["createElementVNode"])("div",Xn,[Object(r["createVNode"])(l,{uicontrol:"text",name:"condition_expected","model-value":t.expected,"onUpdate:modelValue":function(n){t.expected=n,e.setValueHasChanged(),e.onConditionChange()},"full-width":!0},null,8,["model-value","onUpdate:modelValue"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeConditionEntry(n)},title:e.translate("General_Remove")},null,8,Kn),[[r["vShow"],!(n+1===e.trigger.conditions.length)]])],2)})),128))]),Object(r["createElementVNode"])("p",Jn,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionNode")),1)])])],512),[[r["vShow"],null===(d=e.trigger.typeMetadata)||void 0===d?void 0:d.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(s,{class:"createButton",onConfirm:t[3]||(t[3]=function(t){return e.edit?e.updateTrigger():e.createTrigger()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Yn,[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],544),[[r["vShow"],!e.chooseTriggerType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Zn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:n},[Object(r["createElementVNode"])("li",Qn,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["collection-item avatar",kn({disabledTemplate:e.isTriggerTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTriggerType(t)},key:n,title:e.isTriggerTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,ta)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",na,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",aa,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,ia)],512),[[r["vShow"],!!t.help]])],10,ea)})),128))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ra,[Object(r["createElementVNode"])("a",{onClick:t[6]||(t[6]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])],512),[[r["vShow"],e.chooseTriggerType]])]})),_:1},8,["content-title"])],512)}function la(e,t){return da(e)||sa(e,t)||ma(e,t)||ca()}function ca(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function sa(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function da(e){if(Array.isArray(e))return e}function ua(e){return ua="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ua(e)}function ga(e){return ha(e)||pa(e)||ma(e)||ba()}function ba(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ma(e,t){if(e){if("string"===typeof e)return fa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fa(e,t):void 0}}function pa(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ha(e){if(Array.isArray(e))return fa(e)}function fa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function va(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ja(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Oa(e,t,n){return t&&ja(e.prototype,t),n&&ja(e,n),e}function Ta(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var ya=function(){function e(){var t=this;va(this,e),Ta(this,"privateState",Object(r["reactive"])({triggers:[],isLoadingTriggers:!1,isLoadingSingle:!1,isUpdating:!1})),Ta(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),Ta(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),Ta(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingTriggers||e.isLoadingSingle}))),Ta(this,"triggers",Object(r["computed"])((function(){return t.state.value.triggers}))),Ta(this,"fetchPromise",null),Ta(this,"availableTriggersPromises",{})}return Oa(e,[{key:"fetchTriggers",value:function(e,t){var n=this;return this.privateState.triggers=[],this.privateState.isLoadingTriggers=!0,this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainerTriggers",idContainer:e,idContainerVersion:t,filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(e){return n.privateState.triggers=e,n.triggers.value})).finally((function(){n.privateState.isLoadingTriggers=!1}))}},{key:"fetchTriggersIfNotLoaded",value:function(e,t){this.fetchPromise||this.fetchTriggers(e,t)}},{key:"fetchAvailableTriggers",value:function(e){return this.availableTriggersPromises[e]||(this.availableTriggersPromises[e]=u["AjaxHelper"].fetch({method:"TagManager.getAvailableTriggerTypesInContext",idContext:e,filter_limit:"-1"})),Promise.resolve(this.availableTriggersPromises[e])}},{key:"findTrigger",value:function(e,t,n){var a=this,i=this.triggers.value.find((function(e){return e.idtrigger===n}));return i?Promise.resolve(i):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idTrigger:n,idContainer:e,idContainerVersion:t,method:"TagManager.getContainerTrigger",filter_limit:"-1"}).then((function(e){return a.privateState.triggers=[].concat(ga(a.privateState.triggers),[e]),Object(r["readonly"])(e)})).finally((function(){a.privateState.isLoadingSingle=!1})))}},{key:"suggestNameForType",value:function(e){for(var t=this,n=function(n){var a=e;n&&(a="".concat(a," (").concat(n,")"));var i=!t.triggers.value.some((function(e){return e.name===a}));if(i)return{v:a}},a=0;a<100;a+=1){var i=n(a);if("object"===ua(i))return i.v}}},{key:"createOrUpdateTrigger",value:function(e,t,n,a,i){var r=this,o=Object.entries(i).map((function(e){var t=la(e,2),n=t[0],a=t[1],i=a;return"boolean"===typeof a&&(i=(+a).toString()),[n,i]})),l=Object.fromEntries(o),c=e.conditions.filter((function(e){return e&&e.actual&&e.comparison&&e.expected}));return this.privateState.isUpdating=!0,u["AjaxHelper"].post({idTrigger:e.idtrigger,method:t,idContainer:n,idContainerVersion:a,type:e.type,name:e.name,description:e.description},{parameters:l,conditions:c},{withTokenInUrl:!0}).finally((function(){r.privateState.isUpdating=!1}))}},{key:"reload",value:function(e,t){return this.privateState.triggers=[],this.fetchPromise=null,this.availableTriggersPromises={},this.fetchTriggers(e,t)}},{key:"deleteTrigger",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,this.privateState.triggers=[],u["AjaxHelper"].fetch({idTrigger:n,idContainerVersion:t,idContainer:e,method:"TagManager.deleteContainerTrigger"},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}}]),e}(),Va=new ya,Ca="tagvariablemanagement",Na={AllElementsClick:"ClickId",AllLinksClick:"ClickId",DownloadClick:"ClickId",ElementVisibility:"VisibleElementClasses",FormSubmit:"FormId",JavaScriptError:"ErrorMessage"},Ea=Object(r["defineComponent"])({props:{idTrigger:Number,idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},newTriggerType:String,isEmbedded:{type:Boolean,default:!1}},components:{ContentBlock:u["ContentBlock"],Field:g["Field"],GroupedSettings:g["GroupedSettings"],SaveButton:g["SaveButton"]},data:function(){return{isDirty:!1,chooseTriggerType:!1,availableTriggers:[],availableVariables:[],variableIdToName:{},editTitle:"",trigger:{},parameterValues:{},isUpdatingTrigger:!1}},emits:["changeTrigger"],created:function(){var e=this;Ct.init(),u["AjaxHelper"].fetch({method:"TagManager.getAvailableContainerVariables",filter_limit:"-1",idContainer:this.idContainer,idContainerVersion:this.idContainerVersion}).then((function(t){t.forEach((function(t){t.types.forEach((function(n){e.variableIdToName[n.id]=n.name,e.availableVariables.push({key:n.id,value:n.name,group:t.name,tooltip:n.description})}))}))})),Va.fetchTriggersIfNotLoaded(this.idContainer,this.idContainerVersion),this.initIdTrigger()},watch:{idTrigger:function(e){null!==e&&this.initIdTrigger()},triggerParameterValues:{handler:function(e,t){e&&t&&(this.isDirty=!0)},deep:!0}},methods:{checkRequiredFieldsAreSet:function(){return!!this.trigger.name||(this.showErrorFieldNotProvidedNotification(Object(u["translate"])("General_Name")),!1)},removeAnyTriggerNotification:function(){u["NotificationsStore"].remove(Ca),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=u["NotificationsStore"].show({message:e,context:t,id:Ca,type:null!==n?n:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(a)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdTrigger:function(){var e=this;this.trigger={},this.chooseTriggerType=!1,this.editTitle="",u["Matomo"].helper.lazyScrollToContent(),this.availableTriggers=[],u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer,filter_limit:"-1"}).then((function(e){return Va.fetchAvailableTriggers(e.context)})).then((function(t){e.availableTriggers=t})).then((function(){if(e.edit&&e.idTrigger)return e.editTitle=Object(u["translate"])("TagManager_EditTrigger"),void Va.findTrigger(e.idContainer,e.idContainerVersion,e.idTrigger).then((function(t){var n;t&&(e.trigger=Object(u["clone"])(t),e.parameterValues=Object.fromEntries(t.typeMetadata.parameters.map((function(e){return[e.name,e.value]}))),e.addConditionEntryIfNoneExists(),e.onConditionChange(),e.isDirty=!1,null!==(n=e.trigger.typeMetadata)&&void 0!==n&&n.name&&(e.editTitle+=": ".concat(e.trigger.typeMetadata.name)))}));e.create&&(e.editTitle=Object(u["translate"])("TagManager_ChooseTriggerToContinue"),e.chooseTriggerType=!0)}))},onConditionChange:function(){var e=(this.trigger.conditions||[]).every((function(e){return!(null===e||void 0===e||!e.expected)}));e&&this.addConditionEntry()},addConditionEntryIfNoneExists:function(){this.trigger.conditions&&Array.isArray(this.trigger.conditions)||(this.trigger.conditions=[]),this.trigger.conditions.length||this.trigger.conditions.push(this.makeDefaultCondition())},addConditionEntry:function(){this.trigger.conditions.push(this.makeDefaultCondition()),this.isDirty=!0},removeConditionEntry:function(e){if(e>-1){var t=this.trigger.conditions.length-1;t===e?this.trigger.conditions[e]=this.makeDefaultCondition():this.trigger.conditions.splice(e,1),this.isDirty=!0}},createTriggerType:function(e){var t,n=this;e&&this.isTriggerTemplateDisabled[e.id]||(this.chooseTriggerType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewTrigger"),this.trigger={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:Va.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainerversion:this.idContainerVersion,conditions:[],typeMetadata:e},null!==(t=this.trigger.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.trigger.typeMetadata.name)),this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.addConditionEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}})))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTrigger,u["MatomoUrl"].updateHash(e)},createTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,Va.createOrUpdateTrigger(this.trigger,"TagManager.addContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){var n=t.value;e.isDirty=!1,Va.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.trigger.idtrigger=n,void e.$emit("changeTrigger",{trigger:e.trigger});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Trigger"));if(e.hasPublishCapability()){var n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(t," ").concat(n),"success","transient")}else e.showNotification(t,"success")}),200)}))})).finally((function(){e.isUpdatingTrigger=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,Va.createOrUpdateTrigger(this.trigger,"TagManager.updateContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){if(e.isEmbedded)return e.$emit("changeTrigger",{trigger:e.trigger}),void Va.reload(e.idContainer,e.idContainerVersion);e.isDirty=!1,Va.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTrigger()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Trigger"));if(e.hasPublishCapability()){var a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(n," ").concat(a),"success","transient")}else e.showNotification(n,"success")}})).finally((function(){e.isUpdatingTrigger=!1})))},makeDefaultCondition:function(){var e,t="PageUrl";if(null!==(e=this.trigger)&&void 0!==e&&e.typeMetadata){var n=this.trigger.typeMetadata.id;Na[n]&&(t=Na[n])}return{comparison:"equals",actual:t,expected:""}},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{isLoading:function(){return Va.isLoading.value||Ct.isLoading.value},isUpdating:function(){return Va.isUpdating.value||this.isUpdatingTrigger},create:function(){return 0===this.idTrigger},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTriggerDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.trigger.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},saveButtonText:function(){return this.edit?Object(u["translate"])("CoreUpdater_UpdateTitle"):Object(u["translate"])("TagManager_CreateNewTrigger")},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},triggerInlineHelpText:function(){return Object(u["translate"])("TagManager_TriggerConditionsHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/create-a-trigger-to-track-interactions-on-all-nested-elements/"),"</a>")},availableComparisons:function(){return Ct.comparisonOptions.value},isTriggerTemplateDisabled:function(){var e=this,t={};return this.availableTriggers.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},triggerParameterValues:function(){var e;return null!==(e=this.trigger.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null}}});Ea.render=oa;var Sa=Ea,wa={class:"tagManagerManageList tagManagerTriggerList"},ka={class:"triggerSearchFilter"},Ma=["title"],_a=["title"],Da=["title"],Aa=["title"],xa=["title"],Ba=["title"],La={colspan:"7"},Ua={class:"loadingPiwik"},Pa=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ia={colspan:"7"},Fa=["id"],Ha=["title"],Ga=["title"],$a=["title"],Ra={class:"conditions"},qa={class:"icon-ok"},za=["title"],Wa=["onClick","title"],Xa=["onClick","title"],Ka=["onClick","title"],Ja={class:"tableActionBar"},Ya=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Za={class:"ui-confirm",id:"confirmDeleteTrigger",ref:"confirmDeleteTrigger"},Qa=["value"],ei=["value"],ti={class:"ui-confirm",id:"confirmDeleteTriggerNotPossible",ref:"confirmDeleteTriggerNotPossible"},ni={class:"collection"},ai=["value"];function ii(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wa,[Object(r["createVNode"])(c,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerUsageBenefits")),1),Object(r["createElementVNode"])("div",ka,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"triggerSearch",title:e.translate("General_Search"),modelValue:e.triggerSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.triggerSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.triggers.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,Ma),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,_a),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,Da),Object(r["createElementVNode"])("th",{class:"conditions",title:e.filterTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Filter")),9,Aa),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,xa),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Ba),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",La,[Object(r["createElementVNode"])("span",Ua,[Pa,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ia,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTriggersFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTriggerNow",onClick:t[1]||(t[1]=function(t){return e.createTrigger()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTriggerNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.triggers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t){var n;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"trigger".concat(t.idtrigger),class:"triggers",key:t.idtrigger},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ha),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Ga),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,$a),Object(r["createElementVNode"])("td",Ra,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",qa,null,512),[[r["vShow"],null===(n=t.conditions)||void 0===n?void 0:n.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,za),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTrigger(t.idtrigger,t.type)},title:e.translate("TagManager_EditTrigger")},null,8,Wa),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTrigger(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Trigger"))},null,8,Xa),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Trigger"))},null,8,Ka),[[r["vShow"],e.hasPublishCapability()]])],2),[[r["vShow"],e.hasWriteAccess]])],8,Fa)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ja,[Object(r["createElementVNode"])("a",{class:"createNewTrigger",value:"",onClick:t[2]||(t[2]=function(t){return e.createTrigger()})},[Ya,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",Za,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTriggerConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Qa),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ei)],512),Object(r["createElementVNode"])("div",ti,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedBy")),1),Object(r["createElementVNode"])("ul",ni,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.triggerReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.referenceId},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,ai)],512)])}function ri(e){return si(e)||ci(e)||li(e)||oi()}function oi(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function li(e,t){if(e){if("string"===typeof e)return di(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?di(e,t):void 0}}function ci(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function si(e){if(Array.isArray(e))return di(e)}function di(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var ui=window,gi=ui.tagManagerHelper,bi=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},triggersHelpText:String},components:{Field:g["Field"],ContentBlock:u["ContentBlock"]},directives:{ContentTable:u["ContentTable"]},data:function(){return{hasWriteAccess:u["Matomo"].hasUserCapability("tagmanager_write"),triggerReferences:[],triggerSearch:""}},created:function(){Va.fetchTriggers(this.idContainer,this.idContainerVersion)},methods:{createTrigger:function(){this.editTrigger(0)},editTrigger:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idTrigger:e}))},deleteTrigger:function(e){var t=this;u["AjaxHelper"].fetch({method:"TagManager.getContainerTriggerReferences",idContainer:this.idContainer,idContainerVersion:this.idContainerVersion,idTrigger:e.idtrigger}).then((function(n){if(n&&n.length)t.triggerReferences=n,u["Matomo"].helper.modalConfirm(t.$refs.confirmDeleteTriggerNotPossible,{});else{t.triggerReferences=[];var a=function(){Va.deleteTrigger(t.idContainer,t.idContainerVersion,e.idtrigger).then((function(){Va.reload(t.idContainer,t.idContainerVersion),u["NotificationsStore"].remove("CopyDialogResultNotification")}))};u["Matomo"].helper.modalConfirm(t.$refs.confirmDeleteTrigger,{yes:a})}}))},truncateText:function(e,t){return gi.truncateText(e,t)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyTriggerDialog",idSite:e.idsite,idContainer:this.idContainer,idTrigger:e.idtrigger,idContainerVersion:this.idContainerVersion});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyTrigger")}},computed:{isLoading:function(){return Va.isLoading.value},isUpdating:function(){return Va.isUpdating.value},triggers:function(){return Va.triggers.value},sortedTriggers:function(){var e=this.triggerSearch.toLowerCase(),t=ri(this.triggers).filter((function(t){return Object.keys(t).some((function(n){var a=t,i="";if("string"===typeof a[n])i=a[n];else if("typeMetadata"===n){var r=a.typeMetadata;i=r.name}else if("parameters"===n&&"CustomEvent"===a.type){var o=a.parameters;i=o.eventName}return-1!==i.toLowerCase().indexOf(e)}))}));return t.sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_TriggersNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TriggersDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TriggersTypeDescription")},filterTranslatedText:function(){return this.translate("TagManager_TriggersFilterDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TriggersLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TriggersActionDescription")},getActionClasses:function(){var e=this.hasPublishCapability()?" hasCopyAction":"";return"action".concat(e)}}});bi.render=ii;var mi=bi,pi={class:"manageTrigger"};function hi(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TriggerList"),c=Object(r["resolveComponent"])("TriggerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",pi,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"triggers-help-text":e.triggersHelpText},null,8,["id-container","id-container-version","triggers-help-text"])])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-trigger":e.idTrigger},null,8,["id-container","id-container-version","id-trigger"])])],512),[[r["vShow"],e.editMode]])])}var fi=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,triggersHelpText:String},components:{TriggerList:mi,TriggerEdit:Sa},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTrigger}),(function(t){e.onIdTriggerParamChange(t)})),u["NotificationsStore"].remove("triggertriggermanagement"),this.onIdTriggerParamChange(u["MatomoUrl"].hashParsed.value.idTrigger)},methods:{onIdTriggerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTrigger",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTrigger:function(){var e=u["MatomoUrl"].hashParsed.value.idTrigger;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTrigger}}});fi.render=hi;var vi=fi;function ji(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Oi={class:"editTag tagManagerManageEdit",ref:"root"},Ti={class:"loadingPiwik"},yi=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Vi={class:"loadingPiwik"},Ci=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ni={class:"form-group row"},Ei={class:"col s12"},Si={key:0},wi={class:"form-group row"},ki={class:"col s12"},Mi={class:"form-group row"},_i={class:"col s12"},Di={class:"form-group row tagStartDate"},Ai={class:"col s12 m6"},xi={class:"row"},Bi={class:"col s12"},Li={for:"start_date_date",class:"active"},Ui={class:"tagStartDate"},Pi={class:"col s12 m6 "},Ii={class:"form-help"},Fi={class:"inline-help"},Hi=["innerHTML"],Gi=Object(r["createElementVNode"])("br",null,null,-1),$i=["innerHTML"],Ri={class:"form-group row tagEndDate"},qi={class:"col s12 m6"},zi={class:"row"},Wi={class:"col s12"},Xi={for:"end_date_date",class:"active"},Ki={class:"tagEndDate"},Ji={class:"col s12 m6"},Yi={class:"form-help"},Zi={class:"inline-help"},Qi=["innerHTML"],er=Object(r["createElementVNode"])("br",null,null,-1),tr=["innerHTML"],nr={class:"entityCancel"},ar={id:"confirmSelectTagType"},ir={class:"collection-header"},rr=["onClick","title"],or=["src"],lr={class:"title"},cr={class:"secondary-content"},sr=["title"],dr={class:"entityCancel"};function ur(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("TagTriggerArray"),d=Object(r["resolveComponent"])("TagDateInput"),u=Object(r["resolveComponent"])("SaveButton"),g=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Oi,[Object(r["createVNode"])(g,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,g;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Ti,[yi,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Vi,[Ci,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[18]||(t[18]=function(t){return e.edit?e.updateTag():e.createTag()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.tag.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.tag.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.tagNameHelpText,placeholder:e.translate("TagManager_TagNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.tag.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.tag.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),placeholder:e.translate("TagManager_TagDescriptionPlaceholder")},null,8,["model-value","title","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ni,[Object(r["createElementVNode"])("div",Ei,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhatTagDoes")),1)])],512),[[r["vShow"],null===(n=e.tag.typeMetadata)||void 0===n?void 0:n.parameters.length]]),e.tag?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Si,[Object(r["createVNode"])(c,{settings:(null===(a=e.tag.typeMetadata)||void 0===a?void 0:a.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){e.parameterValues[t.name]=t.value,e.setValueHasChanged()})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",wi,[Object(r["createElementVNode"])("div",ki,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhenTagDoes")),1)])],512),[[r["vShow"],null===(i=e.tag.typeMetadata)||void 0===i?void 0:i.parameters.length]]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"fire",title:e.translate("TagManager_FireTriggerTitle"),help:e.translate("TagManager_FireTriggerHelp",e.translate("TagManager_FireLimit")),"model-value":e.fireTriggers,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.fireTriggers=t,e.setValueHasChanged(),e.onFireTriggerChange()}),onCreate:t[4]||(t[4]=function(t){return e.onCreateNewFireTrigger()}),onEdit:t[5]||(t[5]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"block",title:e.translate("TagManager_BlockTriggerTitle"),help:e.translate("TagManager_BlockTriggerHelp"),"model-value":e.blockTriggers,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.blockTriggers=t,e.setValueHasChanged(),e.onBlockTriggerChange()}),onCreate:t[7]||(t[7]=function(t){return e.onCreateNewBlockTrigger()}),onEdit:t[8]||(t[8]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Mi,[Object(r["createElementVNode"])("div",_i,[Object(r["createElementVNode"])("h3",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"showAdvancedSettings",onClick:t[9]||(t[9]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!0}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_ShowAdvancedSettings")),513),[[r["vShow"],!e.showAdvanced]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"hideAdvancedSettings",onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!1}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_HideAdvancedSettings")),513),[[r["vShow"],e.showAdvanced]])])])],512),[[r["vShow"],null===(o=e.tag.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"radio",name:"fire_limit","model-value":e.tag.fire_limit,"onUpdate:modelValue":t[11]||(t[11]=function(t){e.tag.fire_limit=t,e.setValueHasChanged()}),options:e.availableFireLimits,title:e.translate("TagManager_FireLimit"),"inline-help":e.fireLimitHelp},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"fire_delay","model-value":e.tag.fire_delay,"onUpdate:modelValue":t[12]||(t[12]=function(t){e.tag.fire_delay=t,e.setValueHasChanged()}),maxlength:8,title:e.translate("TagManager_FireDelay"),"inline-help":e.translate("TagManager_FireDelayHelp"),placeholder:e.translate("TagManager_PlaceholderZero")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"priority","model-value":e.tag.priority,"onUpdate:modelValue":t[13]||(t[13]=function(t){e.tag.priority=t,e.setValueHasChanged()}),maxlength:4,title:e.translate("TagManager_Priority"),"inline-help":e.translate("TagManager_PriorityHelp"),placeholder:e.translate("TagManager_PriorityPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",Di,[Object(r["createElementVNode"])("div",Ai,[Object(r["createElementVNode"])("div",xi,[Object(r["createElementVNode"])("div",Bi,[Object(r["createElementVNode"])("label",Li,Object(r["toDisplayString"])(e.translate("TagManager_StartDate"))+":",1)]),Object(r["createElementVNode"])("div",Ui,[Object(r["createVNode"])(d,{name:"start_date","model-value":e.tag.start_date,"onUpdate:modelValue":t[14]||(t[14]=function(t){e.tag.start_date=t,e.setValueHasChanged()}),"default-time":"00:00:00"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Pi,[Object(r["createElementVNode"])("div",Ii,[Object(r["createElementVNode"])("span",Fi,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagStartDateHelp","<strong>","</strong>"))},null,8,Hi),Gi,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","<strong>",e.currentTime,"</strong>"))},null,8,$i)])])])])]),Object(r["createElementVNode"])("div",Ri,[Object(r["createElementVNode"])("div",qi,[Object(r["createElementVNode"])("div",zi,[Object(r["createElementVNode"])("div",Wi,[Object(r["createElementVNode"])("label",Xi,Object(r["toDisplayString"])(e.translate("TagManager_EndDate"))+":",1)]),Object(r["createElementVNode"])("div",Ki,[Object(r["createVNode"])(d,{name:"end_date","model-value":e.tag.end_date,"onUpdate:modelValue":t[15]||(t[15]=function(t){e.tag.end_date=t,e.setValueHasChanged()}),"default-time":"23:59:59"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Ji,[Object(r["createElementVNode"])("div",Yi,[Object(r["createElementVNode"])("span",Zi,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagEndDateHelp","<strong>","</strong>"))},null,8,Qi),er,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","<strong>",e.currentTime,"</strong>"))},null,8,tr)])])])])])],512),[[r["vShow"],e.showAdvanced&&(null===(g=e.tag.typeMetadata)||void 0===g?void 0:g.hasAdvancedSettings)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(u,{class:"createButton",onConfirm:t[16]||(t[16]=function(t){return e.edit?e.updateTag():e.createTag()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewTag")},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTagDisabled]]),Object(r["createElementVNode"])("div",nr,[Object(r["createElementVNode"])("a",{onClick:t[17]||(t[17]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],544),[[r["vShow"],!e.chooseTagType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ar,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t.name},[Object(r["createElementVNode"])("li",ir,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:n,class:Object(r["normalizeClass"])(["collection-item avatar",ji({disabledTemplate:e.isTagTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTagType(t)},title:e.isTagTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,or)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",lr,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",cr,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,sr)],512),[[r["vShow"],!!t.help]])],10,rr)),[[r["vShow"],e.isTagVisible(t.id)]])})),128))])})),128)),Object(r["createElementVNode"])("div",dr,[Object(r["createElementVNode"])("a",{onClick:t[19]||(t[19]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])],512),[[r["vShow"],e.chooseTagType]])]})),_:1},8,["content-title"])],512)}function gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function br(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function mr(e,t,n){return t&&br(e.prototype,t),n&&br(e,n),e}function pr(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var hr=function(){function e(){var t=this;gr(this,e),pr(this,"privateState",Object(r["reactive"])({fireLimits:[],isLoading:!1})),pr(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),pr(this,"isLoading",Object(r["computed"])((function(){return t.state.value.isLoading}))),pr(this,"fireLimits",Object(r["computed"])((function(){return t.state.value.fireLimits}))),pr(this,"fireLimitsOptions",Object(r["computed"])((function(){return t.fireLimits.value.map((function(e){var t=e.id,n=e.name;return{key:t,value:n}}))}))),pr(this,"initializePromise",null)}return mr(e,[{key:"init",value:function(){return this.initializePromise||(this.initializePromise=this.fetchAvailableFireLimits()),this.initializePromise}},{key:"fetchAvailableFireLimits",value:function(){var e=this;return this.privateState.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getAvailableTagFireLimits",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.privateState.fireLimits=n})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),fr=new hr,vr={class:"col s12 m6"},jr=["for"],Or=Object(r["createElementVNode"])("br",null,null,-1),Tr=["name"],yr=["onClick","title"],Vr=["onClick","title"],Cr={class:"col s12 m6"},Nr={class:"form-help"},Er={class:"inline-help"},Sr=Object(r["createElementVNode"])("br",null,null,-1),wr=Object(r["createElementVNode"])("br",null,null,-1);function kr(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["form-group row","".concat(e.type,"Triggers")])},[Object(r["createElementVNode"])("div",vr,[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("label",{for:"".concat(e.type,"_triggers")},Object(r["toDisplayString"])(e.title),9,jr),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Or,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_NoTriggersFound"))+". ",1),Object(r["createElementVNode"])("a",{class:"createNewTrigger",onClick:t[0]||(t[0]=function(t){return e.$emit("create")})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTriggerNow")),1)],512),[[r["vShow"],0===e.containerTriggers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.modelValue,(function(t,n){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["multiple valign-wrapper","".concat(e.type,"Trigger ").concat(e.type,"Trigger").concat(n)]),key:n},[Object(r["createElementVNode"])("div",{class:"innerFormField",name:"".concat(e.type,"_triggers")},[Object(r["createVNode"])(l,{uicontrol:"select",name:"".concat(e.type,"_triggers"),"model-value":t,"onUpdate:modelValue":function(t){return e.onChangeTrigger(t,n)},"full-width":!0,options:e.containerTriggers},null,8,["name","model-value","onUpdate:modelValue","options"])],8,Tr),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-edit valign",onClick:function(n){return e.$emit("edit",t)},title:e.translate("General_Edit")},null,8,yr),[[r["vShow"],t]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeTrigger(n)},title:e.translate("General_Remove")},null,8,Vr),[[r["vShow"],n+1!==e.modelValue.length]])],2)),[[r["vShow"],e.containerTriggers.length]])})),128))])]),Object(r["createElementVNode"])("div",Cr,[Object(r["createElementVNode"])("div",Nr,[Object(r["createElementVNode"])("span",Er,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.help)+" ",1),Sr,wr,Object(r["createElementVNode"])("a",{class:"createTriggerInHelp",onClick:t[1]||(t[1]=function(t){return e.$emit("create")})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTriggerNow")),1)])])])],2)}function Mr(e){return xr(e)||Ar(e)||Dr(e)||_r()}function _r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Dr(e,t){if(e){if("string"===typeof e)return Br(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Br(e,t):void 0}}function Ar(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function xr(e){if(Array.isArray(e))return Br(e)}function Br(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Lr=Object(r["defineComponent"])({props:{type:{type:String,required:!0},help:{type:String,required:!0},title:{type:String,required:!0},containerTriggers:{type:Array,required:!0},modelValue:{type:Array,required:!0}},components:{Field:g["Field"]},emits:["update:modelValue","create","edit"],methods:{onChangeTrigger:function(e,t){var n=Mr(this.modelValue);n[t]=parseInt(e,10),this.$emit("update:modelValue",n)},removeTrigger:function(e){var t=Mr(this.modelValue);t.splice(e,1),this.$emit("update:modelValue",t)}}});Lr.render=kr;var Ur=Lr,Pr={class:"col s12 m6 input-field"},Ir=["name","id","value"],Fr={class:"col s12 m6 input-field"},Hr=["name","id","value"];function Gr(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],null,[Object(r["createElementVNode"])("div",Pr,[Object(r["createElementVNode"])("input",{ref:"dateInput",type:"text",name:"".concat(e.name,"_date"),id:"".concat(e.name,"_date"),class:"dateInput",value:e.dateText,onKeydown:t[0]||(t[0]=function(t){return e.onDateKeydown(t)}),onChange:t[1]||(t[1]=function(t){return e.onDateKeydown(t)})},null,40,Ir)]),Object(r["createElementVNode"])("div",Fr,[Object(r["createElementVNode"])("input",{ref:"timeInput",type:"text",name:"".concat(e.name,"_time"),id:"".concat(e.name,"_time"),class:"timeInput",value:e.timeText,onKeydown:t[2]||(t[2]=function(t){return e.onTimeKeydown(t)})},null,40,Hr)])],64)}function $r(e){var t=String(e);return 1===t.length&&(t="0".concat(t)),t}function Rr(e){if(e){var t=e;if(t){t="".concat(t).replace(/-/g,"/");try{return new Date("".concat(t," UTC"))}catch(c){try{return new Date(Date.parse("".concat(t," UTC")))}catch(s){var n=t.substr(0,10),a=t.substr(11),i=n.split("/"),r=a.split(":");if(3===i.length&&3===r.length){var o=new Date(parseInt(i[0],10),parseInt(i[1],10)-1,parseInt(i[2],10),parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)),l=o.getTime()+6e4*o.getTimezoneOffset();return new Date(l)}}}}}}function qr(e){var t=Rr(e);if(t){var n=$r(t.getMonth()+1),a=$r(t.getDate());return"".concat(t.getFullYear(),"-").concat(n,"-").concat(a)}var i=e.split(" ");return i[0]}function zr(e){var t=Rr(e);if(t){var n=$r(t.getHours()),a=$r(t.getMinutes()),i=$r(t.getSeconds());return"".concat(n,":").concat(a,":").concat(i)}var r=e.split(" ");return r[1]}function Wr(e){var t=e;t&&(t=t.replace(/-/g,"/"));try{var n=new Date(t),a=$r(n.getUTCMonth()+1),i=$r(n.getUTCDate()),r=$r(n.getUTCHours()),o=$r(n.getUTCMinutes()),l=$r(n.getUTCSeconds()),c="";return c+="".concat(n.getUTCFullYear(),"-").concat(a,"-").concat(i),c+=" ",c+="".concat(r,":").concat(o,":").concat(l),c}catch(s){return t}}var Xr=window,Kr=Xr.$,Jr=Object(r["defineComponent"])({props:{name:{type:String,required:!0},defaultTime:{type:String,required:!0},modelValue:String},mounted:function(){var e=this,t=Object.assign(Object.assign({},u["Matomo"].getBaseDatePickerOptions(null)),{},{minDate:new Date});delete t.maxDate,Kr(this.$refs.dateInput).datepicker(Object.assign({},t)),Kr(this.$refs.timeInput).timepicker({timeFormat:"H:i:s"}).on("change",(function(t){e.onTimeKeydown(t)}))},computed:{dateText:function(){return this.modelValue?qr(this.modelValue):""},timeText:function(){return this.modelValue?zr(this.modelValue):""}},methods:{onDateKeydown:function(e){var t=this;setTimeout((function(){var n=e.target.value;t.dateText!==n&&t.onChange(n,t.timeText)}))},onTimeKeydown:function(e){var t=this;setTimeout((function(){var n=e.target.value;t.timeText!==n&&t.onChange(t.dateText,n)}))},onChange:function(e,t){if(e){var n=t||this.defaultTime,a=Wr("".concat(e," ").concat(n));this.$emit("update:model-value",a)}else this.$emit("update:model-value",null)}}});Jr.render=Gr;var Yr=Jr;function Zr(e){return Zr="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zr(e)}function Qr(e,t){return no(e)||to(e,t)||ro(e,t)||eo()}function eo(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function to(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function no(e){if(Array.isArray(e))return e}function ao(e){return lo(e)||oo(e)||ro(e)||io()}function io(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ro(e,t){if(e){if("string"===typeof e)return co(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?co(e,t):void 0}}function oo(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function lo(e){if(Array.isArray(e))return co(e)}function co(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function so(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uo(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function go(e,t,n){return t&&uo(e.prototype,t),n&&uo(e,n),e}function bo(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var mo=function(){function e(){var t=this;so(this,e),bo(this,"privateState",Object(r["reactive"])({tags:[],isLoadingTags:!1,isLoadingSingle:!1,isUpdating:!1})),bo(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),bo(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingTags||e.isLoadingSingle}))),bo(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),bo(this,"tags",Object(r["computed"])((function(){return t.state.value.tags}))),bo(this,"fetchPromise",null),bo(this,"availableTagsPromises",{})}return go(e,[{key:"fetchTags",value:function(e,t){var n=this;return this.privateState.isLoadingTags=!0,this.privateState.tags=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainerTags",idContainer:e,idContainerVersion:t,filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(e){return n.privateState.tags=e,n.privateState.isLoadingTags=!1,n.tags.value})).finally((function(){n.privateState.isLoadingTags=!1}))}},{key:"reload",value:function(e,t){return this.privateState.tags=[],this.fetchPromise=null,this.availableTagsPromises={},this.fetchTags(e,t)}},{key:"findTag",value:function(e,t,n){var a=this,i=this.tags.value.find((function(e){return e.idtag===n}));return i?Promise.resolve(i):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idTag:n,idContainer:e,idContainerVersion:t,method:"TagManager.getContainerTag",filter_limit:"-1"}).then((function(e){return a.privateState.tags=[].concat(ao(a.privateState.tags),[e]),Object(r["readonly"])(e)})).finally((function(){a.privateState.isLoadingSingle=!1})))}},{key:"fetchAvailableTags",value:function(e){return this.availableTagsPromises[e]||(this.availableTagsPromises[e]=u["AjaxHelper"].fetch({method:"TagManager.getAvailableTagTypesInContext",idContext:e,filter_limit:"-1"}).then((function(e){return Object(r["readonly"])(e)}))),Promise.resolve(this.availableTagsPromises[e])}},{key:"createOrUpdateTag",value:function(e,t,n,a,i,r,o){var l=this;this.privateState.isUpdating=!0;var c=Object.entries(i).map((function(e){var t=Qr(e,2),n=t[0],a=t[1],i=a;return"boolean"===typeof a&&(i=(+a).toString()),[n,i]})),s=Object.fromEntries(c);return u["AjaxHelper"].post({idTag:e.idtag,method:t,idContainer:n,idContainerVersion:a,type:e.type,name:e.name,description:e.description,startDate:e.start_date,endDate:e.end_date,fireLimit:e.fire_limit,fireDelay:e.fire_delay,priority:e.priority},{parameters:s,fireTriggerIds:r,blockTriggerIds:o},{withTokenInUrl:!0}).finally((function(){l.privateState.isUpdating=!1}))}},{key:"deleteTag",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,this.privateState.tags=[],u["AjaxHelper"].fetch({idTag:n,idContainerVersion:t,idContainer:e,method:"TagManager.deleteContainerTag"},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}},{key:"pauseTag",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,this.privateState.tags=[],u["AjaxHelper"].fetch({idTag:n,idContainerVersion:t,idContainer:e,method:"TagManager.pauseContainerTag"},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}},{key:"resumeTag",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,this.privateState.tags=[],u["AjaxHelper"].fetch({idTag:n,idContainerVersion:t,idContainer:e,method:"TagManager.resumeContainerTag"},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}},{key:"suggestNameForType",value:function(e){for(var t=this,n=function(n){var a=e;n&&(a="".concat(a," (").concat(n,")"));var i=!t.tags.value.some((function(e){return e.name===a}));if(i)return{v:a}},a=0;a<100;a+=1){var i=n(a);if("object"===Zr(i))return i.v}}}]),e}(),po=new mo;function ho(e){return Oo(e)||jo(e)||vo(e)||fo()}function fo(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vo(e,t){if(e){if("string"===typeof e)return To(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?To(e,t):void 0}}function jo(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Oo(e){if(Array.isArray(e))return To(e)}function To(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function yo(){var e=new Date;return e&&e.toString?e.toString():null}var Vo=window,Co=Vo.$,No=Vo.tagManagerHelper,Eo="tagtagmanagement",So=Object(r["defineComponent"])({props:{idTag:Number,idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},newTagType:null},components:{TagDateInput:Yr,ContentBlock:u["ContentBlock"],Field:g["Field"],SaveButton:g["SaveButton"],GroupedSettings:g["GroupedSettings"],TagTriggerArray:Ur},data:function(){return{isDirty:!1,showAdvanced:!1,chooseTagType:!1,availableTags:[],containerTriggers:[],currentTime:null,tag:{},editTitle:"",parameterValues:{},isUpdatingTag:!1,fireTriggers:[],blockTriggers:[],currentTimeTimeout:null}},created:function(){var e=this;fr.init(),this.updateAvailableTriggers(),this.setCurrentTime(),po.reload(this.idContainer,this.idContainerVersion).then((function(){e.initIdTag()}))},unmounted:function(){this.currentTimeTimeout&&clearTimeout(this.currentTimeTimeout)},watch:{idTag:function(e){null!==e&&this.initIdTag()}},methods:{setCurrentTime:function(){this.currentTime=yo(),this.currentTimeTimeout=setTimeout(this.setCurrentTime.bind(this),1e4)},updateAvailableTriggers:function(){var e=this;u["AjaxHelper"].fetch({method:"TagManager.getContainerTriggers",idContainer:this.idContainer,idContainerVersion:this.idContainerVersion,filter_limit:"-1"}).then((function(t){e.containerTriggers=t.map((function(e){return{key:e.idtrigger,value:e.name}}))}))},removeAnyTagNotification:function(){u["NotificationsStore"].remove(Eo),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=u["NotificationsStore"].show({message:e,context:t,id:Eo,type:null!==n?n:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(a)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdTag:function(){var e=this;this.tag={},this.chooseTagType=!1,this.editTitle="",u["Matomo"].helper.lazyScrollToContent(),this.availableTags=[],u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer,filter_limit:"-1"}).then((function(e){return po.fetchAvailableTags(e.context)})).then((function(t){e.availableTags=t})).then((function(){if(e.edit&&e.idTag)return e.editTitle=Object(u["translate"])("TagManager_EditTag"),void po.findTag(e.idContainer,e.idContainerVersion,e.idTag).then((function(t){var n;t&&(e.tag=Object(u["clone"])(t),e.parameterValues=Object.fromEntries(t.typeMetadata.parameters.map((function(e){return[e.name,e.value]}))),e.blockTriggers=ho(e.tag.block_trigger_ids||[]),e.blockTriggers.length||e.blockTriggers.push(null),e.fireTriggers=ho(e.tag.fire_trigger_ids||[]),e.fireTriggers.length||e.fireTriggers.push(null),e.onFireTriggerChange(),e.onBlockTriggerChange(),e.isDirty=!1,e.editTitle=Object(u["translate"])("TagManager_EditTag"),null!==(n=e.tag.typeMetadata)&&void 0!==n&&n.name&&(e.editTitle+=": ".concat(e.tag.typeMetadata.name)))}));e.create&&(e.editTitle=Object(u["translate"])("TagManager_ChooseTagToContinue"),e.chooseTagType=!0)}))},onCreateNewBlockTrigger:function(){var e=this;this.openEditTrigger((function(t){var n=e.blockTriggers.length-1;e.blockTriggers[n]?e.blockTriggers.push(t.idtrigger):e.blockTriggers[n]=t.idtrigger,e.onBlockTriggerChange()}),0)},onCreateNewFireTrigger:function(){var e=this;this.openEditTrigger((function(t){var n=e.fireTriggers.length-1;e.fireTriggers[n]?e.fireTriggers.push(t.idtrigger):e.fireTriggers[n]=t.idtrigger,e.onFireTriggerChange()}),0)},editTrigger:function(e){this.openEditTrigger((function(){return null}),e)},openEditTrigger:function(e,t){var n=this;No.editTrigger(this.idContainer,this.idContainerVersion,t,(function(t){n.updateAvailableTriggers(),e(t)}))},onBlockTriggerChange:function(){var e=this.blockTriggers.every((function(e){return!!e}));e&&this.addBlockTrigger()},addBlockTrigger:function(){this.blockTriggers.push(null),this.isDirty=!0},removeBlockTrigger:function(e){if(e>-1){var t=this.blockTriggers.length-1;t===e?this.blockTriggers[e]=null:this.blockTriggers.splice(e,1),this.isDirty=!0}},onFireTriggerChange:function(){var e=this.fireTriggers.every((function(e){return!!e}));e&&this.addFireTrigger()},addFireTrigger:function(){this.fireTriggers.push(null),this.isDirty=!0},removeFireTrigger:function(e){if(e>-1){var t=this.fireTriggers.length-1;t===e?this.fireTriggers[e]=null:this.fireTriggers.splice(e,1),this.isDirty=!0}},createTagType:function(e){var t,n=this;e&&this.isTagTemplateDisabled[e.id]||(this.chooseTagType=!1,this.tag={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:po.suggestNameForType(e.name)||"",type:e.id,fire_limit:"unlimited",priority:"GoogleTag"===e.id||"GoogleAnalytics4"===e.id?1:999,fire_delay:0,typeMetadata:e},this.editTitle=Object(u["translate"])("TagManager_CreateNewTag"),null!==(t=this.tag.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.tag.typeMetadata.name)),this.blockTriggers=[null],this.fireTriggers=[null],this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.isDirty=!1,setTimeout((function(){var e=Co(n.$refs.root);e.length&&e[0]&&e[0].scrollIntoView(),e.find("#name").focus()}),1))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTag,u["MatomoUrl"].updateHash(e)},createTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,po.createOrUpdateTag(this.tag,"TagManager.addContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){t&&(e.isDirty=!1,po.reload(e.idContainer,e.idContainerVersion).then((function(){e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Tag"));if(e.hasPublishCapability()){var n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(t," ").concat(n),"success","transient")}else e.showNotification(t,"success")}),200)})))})).finally((function(){e.isUpdatingTag=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,po.createOrUpdateTag(this.tag,"TagManager.updateContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){if(t){e.isDirty=!1,po.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTag()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Tag"));if(e.hasPublishCapability()){var a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(n," ").concat(a),"success","transient")}else e.showNotification(n,"success")}})).finally((function(){e.isUpdatingTag=!1})))},checkRequiredFieldsAreSet:function(){if(!this.tag.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!(!this.fireTriggers||!this.fireTriggers.length)||(this.showNotification(Object(u["translate"])("TagManager_TagFireTriggerRequirement"),"error"),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTagVisible:function(e){return!this.create||"GoogleAnalytics4"!==e}},computed:{availableFireLimits:function(){return fr.fireLimitsOptions.value},isLoading:function(){return Va.isLoading.value||fr.isLoading.value},isUpdating:function(){return Va.isUpdating.value||this.isUpdatingTag},create:function(){return 0===this.idTag},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTagDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.tag.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},isTagTemplateDisabled:function(){var e=this,t={};return this.availableTags.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},fireLimitHelp:function(){return Object(u["translate"])("TagManager_FireLimitHelp",Object(u["translate"])("TagManager_Unlimited"),Object(u["translate"])("TagManager_OncePage"),Object(u["translate"])("TagManager_Once24Hours"),Object(u["translate"])("TagManager_OnceLifetime"))},tagNameHelpText:function(){var e="";return console.log(this.tag),"CustomHtml"===this.tag.type&&(e=Object(u["translate"])("TagManager_CustomHTMLTagNameInlineHelpText","<br><br><strong>","</strong>",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-to-add-google-ads-remarketing-tags-in-matomo-tag-manager/"),"</a>")),Object(u["translate"])("TagManager_TagNameHelpV2")+e}}});So.render=ur;var wo=So,ko={class:"tagManagerManageList tagManagerTagList"},Mo={class:"tagSearchFilter"},_o=["title"],Do=["title"],Ao=["title"],xo=["title"],Bo=["title"],Lo=["title"],Uo={colspan:"6"},Po={class:"loadingPiwik"},Io=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Fo={colspan:"6"},Ho=["id"],Go=["title"],$o=["title"],Ro=["title"],qo={class:"triggers"},zo=["onClick","title"],Wo=["title"],Xo=["onClick","title"],Ko=["title"],Jo=["title"],Yo=["onClick","title"],Zo=["onClick","title"],Qo=["onClick","title"],el=["onClick","title"],tl=["onClick","title"],nl={class:"tableActionBar"},al=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),il={class:"ui-confirm",id:"confirmDeleteTag",ref:"confirmDeleteTag"},rl=["value"],ol=["value"],ll={class:"ui-confirm",id:"confirmPauseTag",ref:"confirmPauseTag"},cl=["value"],sl=["value"],dl={class:"ui-confirm",id:"confirmResumeTag",ref:"confirmResumeTag"},ul=["value"],gl=["value"];function bl(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ko,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TagUsageBenefits")),1),Object(r["createElementVNode"])("div",Mo,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"tagSearch",title:e.translate("General_Search"),modelValue:e.tagSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.tagSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.tags.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,_o),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Do),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,Ao),Object(r["createElementVNode"])("th",{class:"triggers",title:e.triggersTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Triggers")),9,xo),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,Bo),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Lo),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Uo,[Object(r["createElementVNode"])("span",Po,[Io,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Fo,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTagsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTagNow",onClick:t[1]||(t[1]=function(t){return e.createTag()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTagNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.tags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{class:"tags",key:t.idtag,id:"tag".concat(t.idtag)},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Go),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,$o),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,Ro),Object(r["createElementVNode"])("td",qo,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.fire_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[e.hasWriteAccess?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,style:{display:"inline-block","vertical-align":"top !important"},class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,zo)):Object(r["createCommentVNode"])("",!0),e.hasWriteAccess?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Wo))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Except"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.block_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Xo),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Ko),[[r["vShow"],!e.hasWriteAccess]])])})),128))],512),[[r["vShow"],t.block_trigger_ids.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,Jo),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-pause",onClick:function(n){return e.pauseTag(t)},title:e.translate("TagManager_PauseX",e.translate("TagManager_Tag"))},null,8,Yo),[[r["vShow"],"active"===t.status]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-play",onClick:function(n){return e.resumeTag(t)},title:e.translate("TagManager_ResumeX",e.translate("TagManager_Tag"))},null,8,Zo),[[r["vShow"],"paused"===t.status]]),Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTag(t.idtag,t.type)},title:e.translate("TagManager_EditTag")},null,8,Qo),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTag(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Tag"))},null,8,el),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Tag"))},null,8,tl),[[r["vShow"],e.hasPublishCapability()]])],2),[[r["vShow"],e.hasWriteAccess]])],8,Ho)})),128))])],512),[[d]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",nl,[Object(r["createElementVNode"])("a",{class:"createNewTag",value:"",onClick:t[2]||(t[2]=function(t){return e.createTag()})},[al,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",il,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,rl),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ol)],512),Object(r["createElementVNode"])("div",ll,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PauseTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,cl),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,sl)],512),Object(r["createElementVNode"])("div",dl,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ResumeTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ul),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,gl)],512)])}function ml(e){return vl(e)||fl(e)||hl(e)||pl()}function pl(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function hl(e,t){if(e){if("string"===typeof e)return jl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jl(e,t):void 0}}function fl(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function vl(e){if(Array.isArray(e))return jl(e)}function jl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Ol=window,Tl=Ol.tagManagerHelper,yl="tagtagmanagementlist",Vl=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0},idContainerVersion:{type:Number,required:!0},tagsHelpText:String},components:{ContentBlock:u["ContentBlock"],Field:g["Field"]},directives:{ContentTable:u["ContentTable"]},data:function(){return{hasWriteAccess:u["Matomo"].hasUserCapability("tagmanager_write"),triggerTruncateLength:40,tagSearch:""}},created:function(){var e=this;Object(r["watch"])((function(){return po.tags.value}),(function(){e.reloadTriggers()})),this.reloadTriggers(),po.fetchTags(this.idContainer,this.idContainerVersion)},methods:{reloadTriggers:function(){Va.reload(this.idContainer,this.idContainerVersion)},createTag:function(){this.editTag(0)},editTrigger:function(e){var t=this;Tl.editTrigger(this.idContainer,this.idContainerVersion,e,(function(){t.reloadTriggers()}))},editTag:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idTag:e}))},pauseTag:function(e){var t=this,n=function(){po.pauseTag(t.idContainer,t.idContainerVersion,e.idtag).then((function(){po.reload(t.idContainer,t.idContainerVersion).then((function(){setTimeout((function(){t.showDeployNotification("pause")}),200)}))}))};u["Matomo"].helper.modalConfirm("#confirmPauseTag",{yes:n})},resumeTag:function(e){var t=this,n=function(){po.resumeTag(t.idContainer,t.idContainerVersion,e.idtag).then((function(){po.reload(t.idContainer,t.idContainerVersion).then((function(){setTimeout((function(){t.showDeployNotification("resume")}),200)}))}))};u["Matomo"].helper.modalConfirm("#confirmResumeTag",{yes:n})},deleteTag:function(e){var t=this,n=function(){po.deleteTag(t.idContainer,t.idContainerVersion,e.idtag).then((function(){po.reload(t.idContainer,t.idContainerVersion),u["NotificationsStore"].remove("CopyDialogResultNotification")}))};u["Matomo"].helper.modalConfirm("#confirmDeleteTag",{yes:n})},truncateText:function(e,t){return Tl.truncateText(e,t)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},showDeployNotification:function(e){var t="pause"===e?"TagManager_PausedTag":"TagManager_ResumedTag",n=Object(u["translate"])(t,Object(u["translate"])("TagManager_Tag"));if(this.hasPublishCapability()){var a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");this.showNotification("".concat(n," ").concat(a),"success","transient")}else this.showNotification(n,"success")},showNotification:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=u["NotificationsStore"].show({message:e,context:t,id:yl,type:null!==n?n:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(a)}),200)},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyTagDialog",idSite:e.idsite,idContainer:this.idContainer,idTag:e.idtag,idContainerVersion:this.idContainerVersion});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyTag")}},computed:{triggers:function(){var e={};return Va.triggers.value.forEach((function(t){e["".concat(t.idtrigger)]=t.name})),e},isLoading:function(){return po.isLoading.value},isUpdating:function(){return po.isUpdating.value},tags:function(){return po.tags.value},sortedTags:function(){var e=this,t=this.tagSearch.toLowerCase(),n=ml(this.tags).filter((function(n){return Object.keys(n).some((function(a){var i=n,r="";if("string"===typeof i[a])r=i[a];else if("typeMetadata"===a){var o=i.typeMetadata;r=o.name}else if("fire_trigger_ids"===a)e.triggers&&i.fire_trigger_ids&&Object.values(i.fire_trigger_ids).forEach((function(t){e.triggers[t]&&(r+="".concat(e.triggers[t]," "))}));else if("parameters"===a&&"CustomHtml"===i.type){var l=i.parameters;r=l.customHtml}return-1!==r.toLowerCase().indexOf(t)}))}));return n.sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0})),n},nameTranslatedText:function(){return this.translate("TagManager_TagsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TagsDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TagsTypeDescription")},triggersTranslatedText:function(){return this.translate("TagManager_TagsTriggersDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TagsLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TagsActionDescription")},getActionClasses:function(){var e=this.hasPublishCapability()?" hasCopyAction":"";return"action".concat(e)}}});Vl.render=bl;var Cl=Vl,Nl={class:"manageTag"},El={key:0},Sl={key:1};function wl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TagList"),c=Object(r["resolveComponent"])("TagEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Nl,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",El,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"tags-help-text":e.tagsHelpText},null,8,["id-container","id-container-version","tags-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Sl,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-tag":e.idTag},null,8,["id-container","id-container-version","id-tag"])])):Object(r["createCommentVNode"])("",!0)])}var kl=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,tagsHelpText:String},components:{TagList:Cl,TagEdit:wo},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTag}),(function(t){e.onIdTagParamChange(t)})),u["NotificationsStore"].remove("tagtagmanagement"),this.onIdTagParamChange(u["MatomoUrl"].hashParsed.value.idTag)},methods:{onIdTagParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTag",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTag:function(){var e=u["MatomoUrl"].hashParsed.value.idTag;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTag}}});kl.render=wl;var Ml=kl,_l={class:"editVersion tagManagerManageEdit"},Dl={class:"loadingPiwik"},Al=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),xl={class:"loadingPiwik"},Bl=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ll={key:0},Ul={key:0},Pl={key:1},Il=["innerHTML"],Fl={key:2,class:"versionChanges"},Hl={key:0},Gl={colspan:"4"},$l={key:1},Rl={colspan:"4"},ql={class:"lastUpdated"},zl={class:"entityCancel"};function Wl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("ContentBlock"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",_l,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Dl,[Al,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",xl,[Bl,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[6]||(t[6]=function(t){return e.edit?e.updateVersion():e.createVersion()})},[Object(r["createElementVNode"])("div",null,[e.hasPublishCapability()||e.hasWriteCapability()&&e.hasPublishToLiveCapability()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ll,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","inline-help":e.versionNameHelpText,"inline-help-bind":{lastVersion:e.lastVersion},"model-value":e.version.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.version.name=t,e.setValueHasChanged()}),maxlength:50,title:e.translate("TagManager_VersionName"),placeholder:e.translate("TagManager_VersionNamePlaceholder")},null,8,["inline-help","inline-help-bind","model-value","title","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.version.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.version.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_VersionDescriptionOptional"),"inline-help":e.translate("TagManager_VersionDescriptionHelp"),placeholder:e.translate("TagManager_VersionDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createVNode"])(c,{class:"createButton no-publish",onConfirm:t[2]||(t[2]=function(t){return e.edit?e.updateVersion():e.createVersion()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateVersionWithoutPublishing")},null,8,["disabled","saving","value"]),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ul,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","inline-help":e.selectTagManagerEnvironmentHelp,"inline-help-bind":{canPublishToLive:e.canPublishToLive},"model-value":null===(n=e.version.environments)||void 0===n?void 0:n[0],"onUpdate:modelValue":t[3]||(t[3]=function(t){e.version.environments[0]=t,e.setValueHasChanged()}),options:e.environments,introduction:e.translate("TagManager_OrCreateAndPublishVersion"),title:e.translate("TagManager_Environment")},null,8,["inline-help","inline-help-bind","model-value","options","introduction","title"])])):Object(r["createCommentVNode"])("",!0),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:1,class:"publishButton",onConfirm:t[4]||(t[4]=function(t){return e.createVersionAndPublish()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.translate("TagManager_CreateVersionAndPublishRelease")},null,8,["disabled","saving","value"])):Object(r["createCommentVNode"])("",!0)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Pl,[Object(r["createElementVNode"])("div",{class:"alert alert-warning",innerHTML:e.$sanitize(e.showNoAccessErrorMessage)},null,8,Il)])),e.lastVersion?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Fl,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ChangesSinceLastVersion"))+":",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SitesManager_Type")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_Change")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoadingVersionChanges?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Hl,[Object(r["createElementVNode"])("td",Gl,[Object(r["createVNode"])(s,{"loading-message":e.translate("TagManager_DetectingChanges"),loading:!0},null,8,["loading-message"])])])):Object(r["createCommentVNode"])("",!0),e.versionChanges.length||e.isLoadingVersionChanges?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",$l,[Object(r["createElementVNode"])("td",Rl,Object(r["toDisplayString"])(e.translate("UserCountryMap_None")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.versionChanges,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.entityType)),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.type)),1),Object(r["createElementVNode"])("td",ql,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.lastChanged),1)])])})),128))])],512),[[u]])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",zl,[Object(r["createElementVNode"])("a",{onClick:t[5]||(t[5]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],32)]})),_:1},8,["content-title"])])}function Xl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kl(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Jl(e,t,n){return t&&Kl(e.prototype,t),n&&Kl(e,n),e}function Yl(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var Zl=function(){function e(){var t=this;Xl(this,e),Yl(this,"privateState",Object(r["reactive"])({environmentsWithPublish:[],isLoading:!1})),Yl(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),Yl(this,"isLoading",Object(r["computed"])((function(){return t.state.value.isLoading}))),Yl(this,"environmentsWithPublish",Object(r["computed"])((function(){return t.state.value.environmentsWithPublish}))),Yl(this,"environmentsWithPublishOptions",Object(r["computed"])((function(){return t.environmentsWithPublish.value.map((function(e){var t=e.id,n=e.name;e.disabled;return{key:t,value:n,disabled:!1}}))}))),Yl(this,"initializePromise",null)}return Jl(e,[{key:"init",value:function(){return this.initializePromise||(this.initializePromise=this.fetchEnvironments()),this.initializePromise}},{key:"fetchEnvironments",value:function(){var e=this;return this.privateState.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getAvailableEnvironmentsWithPublishCapability",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.privateState.environmentsWithPublish=n})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),Ql=new Zl;function ec(e){return ac(e)||nc(e)||oc(e)||tc()}function tc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function nc(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ac(e){if(Array.isArray(e))return lc(e)}function ic(e,t){return sc(e)||cc(e,t)||oc(e,t)||rc()}function rc(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oc(e,t){if(e){if("string"===typeof e)return lc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lc(e,t):void 0}}function lc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function cc(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function sc(e){if(Array.isArray(e))return e}
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */function dc(e,t,n){function a(e,t){return e.find((function(e){return e.name===t}))}function i(e,t,n,i){var r=[];return t.forEach((function(t){var o=a(n,t.name);o?i.some((function(n){return JSON.stringify(t[n])!==JSON.stringify(o[n])&&(r.push({entityType:e,type:"status"===n&&"paused"===t[n]?"TagManager_DiffPaused":"TagManager_DiffModified",name:t.name,lastChanged:t.updated_date_pretty}),!0)})):"paused"===t.status?r.push({entityType:e,type:"TagManager_DiffAddedPaused",name:t.name,lastChanged:t.updated_date_pretty}):r.push({entityType:e,type:"TagManager_DiffAdded",name:t.name,lastChanged:t.updated_date_pretty})})),n.forEach((function(n){a(t,n.name)||r.push({entityType:e,type:"TagManager_DiffDeleted",name:n.name,lastChanged:n.updated_date_pretty})})),r}function r(e,t){e.forEach((function(e){e.fire_triggers=[],e.block_triggers=[],e.fire_trigger_ids.forEach((function(n){var a=t.find((function(e){return e.idtrigger===n}));a&&e.fire_triggers.push(a.name)})),e.block_trigger_ids.forEach((function(n){var a=t.find((function(e){return e.idtrigger===n}));a&&e.block_triggers.push(a.name)}))}))}var o={module:"API",method:"TagManager.exportContainerVersion",format:"json",idContainer:e,filter_limit:-1};t&&(o.idContainerVersion=t);var l={module:"API",method:"TagManager.exportContainerVersion",format:"json",idContainer:e,idContainerVersion:n,filter_limit:-1};return u["AjaxHelper"].fetch([o,l]).then((function(e){var t=ic(e,2),n=t[0],a=t[1];r(n.tags,n.triggers),r(a.tags,a.triggers);var o=i("TagManager_Tag",n.tags,a.tags,["name","type","fire_limit","priority","fire_delay","fire_triggers","block_triggers","parameters","status"]),l=i("TagManager_Trigger",n.triggers,a.triggers,["name","type","conditions","parameters"]),c=i("TagManager_Variable",n.variables,a.variables,["name","type","lookup_table","default_value","parameters"]);return[].concat(ec(o),ec(l),ec(c))}))}function uc(e){return pc(e)||mc(e)||bc(e)||gc()}function gc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bc(e,t){if(e){if("string"===typeof e)return hc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hc(e,t):void 0}}function mc(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function pc(e){if(Array.isArray(e))return hc(e)}function hc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function fc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vc(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function jc(e,t,n){return t&&vc(e.prototype,t),n&&vc(e,n),e}function Oc(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var Tc=function(){function e(){var t=this;fc(this,e),Oc(this,"privateState",Object(r["reactive"])({versions:[],isLoadingVersions:!1,isLoadingSingle:!1,isUpdating:!1})),Oc(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),Oc(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingVersions||e.isLoadingSingle}))),Oc(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),Oc(this,"versions",Object(r["computed"])((function(){return t.state.value.versions}))),Oc(this,"fetchPromise",null)}return jc(e,[{key:"reload",value:function(e){return this.privateState.versions=[],this.fetchPromise=null,this.fetchVersions(e)}},{key:"fetchVersions",value:function(e){var t=this;return this.privateState.isLoadingVersions=!0,this.privateState.versions=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainerVersions",idContainer:e,filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(e){return t.privateState.versions=e,t.privateState.isLoadingVersions=!1,t.versions.value})).finally((function(){t.privateState.isLoadingVersions=!1}))}},{key:"findVersion",value:function(e,t){var n=this,a=this.versions.value.find((function(e){return e.idcontainerversion===t}));return a?Promise.resolve(a):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idContainerVersion:t,idContainer:e,method:"TagManager.getContainerVersion",filter_limit:"-1"}).then((function(e){return n.privateState.versions=[].concat(uc(n.privateState.versions),[e]),Object(r["readonly"])(e)})).finally((function(){n.privateState.isLoadingSingle=!1})))}},{key:"deleteVersion",value:function(e,t){var n=this;return this.privateState.isUpdating=!0,this.privateState.versions=[],u["AjaxHelper"].fetch({idContainerVersion:t,idContainer:e,method:"TagManager.deleteContainerVersion"},{withTokenInUrl:!0}).finally((function(){n.privateState.isUpdating=!1}))}},{key:"publishVersion",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].fetch({idContainer:e,idContainerVersion:t,environment:n,method:"TagManager.publishContainerVersion"}).finally((function(){a.privateState.isUpdating=!1}))}},{key:"createOrUpdateVersion",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].post({method:t,idContainer:n,idContainerVersion:e.idcontainerversion},{name:e.name,description:e.description},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}}]),e}(),yc=new Tc,Vc={id:"versionNameHelpText",class:"inline-help-node"},Cc=Object(r["createElementVNode"])("br",null,null,-1),Nc=Object(r["createElementVNode"])("br",null,null,-1),Ec=["innerHTML"];function Sc(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vc,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_VersionNameHelp"))+" ",1),Cc,Nc,Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_NameOfLatestVersion","<strong>".concat(e.lastVersion,"</strong>")))},null,8,Ec),[[r["vShow"],e.lastVersion]])])}var wc=Object(r["defineComponent"])({props:{lastVersion:String}});wc.render=Sc;var kc=wc,Mc={id:"selectTagManagerEnvironmentHelp",class:"inline-help-node"};function _c(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Mc,[Object(r["createElementVNode"])("div",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionEnvironmentHelp")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-info",style:{"margin-bottom":"0","padding-bottom":"0"}},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])])}var Dc=Object(r["defineComponent"])({props:{canPublishToLive:Boolean}});Dc.render=_c;var Ac=Dc;function xc(e){return Pc(e)||Uc(e)||Lc(e)||Bc()}function Bc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Lc(e,t){if(e){if("string"===typeof e)return Ic(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ic(e,t):void 0}}function Uc(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Pc(e){if(Array.isArray(e))return Ic(e)}function Ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Fc="versiontagmanagement",Hc=Object(r["defineComponent"])({props:{idContainerVersion:{type:Number,required:!0},idContainer:{type:String,required:!0},isEmbedded:{type:Boolean,default:!1}},components:{ContentBlock:u["ContentBlock"],Field:g["Field"],SaveButton:g["SaveButton"],ActivityIndicator:u["ActivityIndicator"]},directives:{ContentTable:u["ContentTable"]},data:function(){return{isDirty:!1,lastVersion:null,versionChanges:[],isLoadingVersionChanges:!1,isUpdatingVersion:!1,version:{}}},emits:["changeVersion"],created:function(){Ct.init(),Ql.init(),this.initIdContainerVersion()},watch:{idContainerVersion:function(e){null!==e&&this.initIdContainerVersion()}},methods:{removeAnyVersionNotification:function(){u["NotificationsStore"].remove(Fc),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=u["NotificationsStore"].show({message:e,context:t,id:Fc,type:null!==n?n:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(a)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdContainerVersion:function(){var e=this;if(this.version={},this.lastVersion=null,this.versionChanges=[],this.isLoadingVersionChanges=!0,yc.fetchVersions(this.idContainer).then((function(){var t;e.isLoadingVersionChanges=!1,e.lastVersion=null;var n=xc(yc.versions.value);if(null!==n&&void 0!==n&&n.length){n.sort((function(e,t){return e.revision<t.revision?1:0}));var a=null;e.create&&null!==(t=n[0])&&void 0!==t&&t.name?(e.lastVersion=u["Matomo"].helper.htmlEntities(n[0].name),a=n[0].idcontainerversion):e.edit&&n.forEach((function(t,i){i>=n.length-1||t.idcontainerversion===e.idContainerVersion&&n[i+1]&&(e.lastVersion=u["Matomo"].helper.htmlEntities(n[i+1].name),a=n[i+1].idcontainerversion)})),e.lastVersion&&(e.isLoadingVersionChanges=!0,dc(e.idContainer,e.idContainerVersion,a).then((function(t){t.sort((function(e,t){return new Date(t.lastChanged).valueOf()-new Date(e.lastChanged).valueOf()})),e.versionChanges=t,e.isLoadingVersionChanges=!1})),e.create&&!e.version.name&&/^\d+$/.test(e.lastVersion)&&(e.version.name="".concat(parseInt(e.lastVersion,10)+1),e.isDirty=!0))}})),u["Matomo"].helper.lazyScrollToContent(),this.edit&&this.idContainerVersion)yc.findVersion(this.idContainer,this.idContainerVersion).then((function(t){t&&(e.version=Object(u["clone"])(t),e.isDirty=!1)}));else if(this.create){if(this.version={idSite:u["Matomo"].idSite,idcontainer:this.idContainer,name:"",description:""},this.canPublishToLive)this.version.environments=["live"];else{var t=this.environments.find((function(e){return"live"!==e.key}));this.version.environments=t?[t.key]:[]}this.isDirty=!1}},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idContainerVersion,u["MatomoUrl"].updateHash(e)},createVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,yc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(t){e.isDirty=!1;var n=t.value;if(e.isEmbedded)return e.version.idcontainerversion=n,void e.$emit("changeVersion",{version:e.version});yc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Version"));if(e.hasPublishCapability()){var n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'<a class="createNewVersionLink">',"</a>");e.showNotification("".concat(t," ").concat(n),"success","transient")}else e.showNotification(t,"success")}),200)}))}})).finally((function(){e.isUpdatingVersion=!1})))},createVersionAndPublish:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,yc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(!t)return null;var n=t.value;return e.version.idcontainerversion=n,yc.publishVersion(e.idContainer,n,e.version.environments[0]).then((function(){e.isDirty=!1,e.isEmbedded?e.$emit("changeVersion",{version:e.version}):yc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){e.showNotification(Object(u["translate"])("TagManager_VersionPublishSuccess"),"success")}),200)}))}))})).finally((function(){e.isUpdatingVersion=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,yc.createOrUpdateVersion(this.version,"TagManager.updateContainerVersion",this.idContainer).then((function(t){t&&(e.isEmbedded?e.$emit("changeVersion",{version:e.version}):(e.isDirty=!1,e.version={},yc.reload(e.idContainer).then((function(){e.initIdContainerVersion()})),e.showNotification(Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Version")),"success")))})).finally((function(){e.isUpdatingVersion=!1})))},checkRequiredFieldsAreSet:function(){if(!this.version.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!0},hasPublishCapability:function(){return this.hasWriteCapability()&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},hasWriteCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasPublishToLiveCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")}},computed:{create:function(){return 0===this.idContainerVersion},edit:function(){return!this.create},isLoading:function(){return vt.isLoading.value||Ct.isLoading.value},isUpdating:function(){return vt.isUpdating.value||this.isUpdatingVersion},environments:function(){var e=Ql.environmentsWithPublishOptions.value;if(!this.canPublishToLive){var t=e.findIndex((function(e){return"live"===e.key}));t>-1&&(e[t].disabled=!0)}return e},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},versionNameHelpText:function(){return Object(r["markRaw"])(kc)},selectTagManagerEnvironmentHelp:function(){return Object(r["markRaw"])(Ac)},editTitle:function(){return this.create?Object(u["translate"])("TagManager_CreateNewVersion"):Object(u["translate"])("TagManager_EditVersion")},showNoAccessErrorMessage:function(){return Object(u["translate"])("TagManager_VersionEditWithNoAccessMessage",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/faq_26547/"),"</a>")}}});Hc.render=Wl;var Gc=Hc,$c={class:"tagManagerManageList tagManagerVersionList"},Rc={class:"versionSearchFilter"},qc=["title"],zc=["title"],Wc=["title"],Xc=["title"],Kc=["title"],Jc=["title"],Yc={colspan:"7"},Zc={class:"loadingPiwik"},Qc=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),es={colspan:"7"},ts=["id"],ns={class:"index"},as=["title"],is=["title"],rs={class:"environments"},os=["title"],ls={class:"created"},cs={class:"action"},ss=["onClick","title"],ds=["onClick","title"],us=["onClick","href","title"],gs=["onClick","title"],bs=["onClick","title"],ms={class:"tableActionBar"},ps=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),hs=["href"],fs=Object(r["createElementVNode"])("span",{class:"icon-export"}," ",-1),vs=Object(r["createElementVNode"])("span",{class:"icon-upload"}," ",-1),js={class:"ui-confirm",id:"confirmDeleteVersion",ref:"confirmDeleteVersion"},Os=["value"],Ts=["value"],ys={class:"ui-confirm",id:"confirmPublishVersion",ref:"confirmPublishVersion"},Vs={key:0,class:"alert alert-info",style:{"margin-top":"16px"}},Cs=["value"],Ns=["value"];function Es(e,t,n,a,i,o){var l,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",$c,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionUsageBenefits"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("div",Rc,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"versionSearch",title:e.translate("General_Search"),modelValue:e.versionSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.versionSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.versions.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"index",title:e.revisionTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Revision")),9,qc),Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,zc),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Wc),Object(r["createElementVNode"])("th",{class:"environments",title:e.environmentTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Environments")),9,Xc),Object(r["createElementVNode"])("th",{class:"created",title:e.createdTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Created")),9,Kc),Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Jc)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Yc,[Object(r["createElementVNode"])("span",Zc,[Qc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",es,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVersionsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVersionNow",onClick:t[1]||(t[1]=function(t){return e.createVersion()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersionNow")),513),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],512),[[r["vShow"],!e.isLoading&&0===e.versions.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVersions,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"version".concat(t.idcontainerversion),class:"versions",key:t.revision},[Object(r["createElementVNode"])("td",ns,Object(r["toDisplayString"])(t.revision),1),Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,as),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,is),Object(r["createElementVNode"])("td",rs,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.releases,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:a,title:e.translate("TagManager_ReleaseInfo",n.release_login,n.release_date_pretty)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(n.environment)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],a!==t.releases.length-1]])],8,os)})),128))]),Object(r["createElementVNode"])("td",ls,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.created_date_pretty),1)]),Object(r["createElementVNode"])("td",cs,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-rocket",onClick:function(n){return e.publishVersion(t)},title:e.translate("TagManager_PublishVersion",t.name)},null,8,ss),[[r["vShow"],e.hasWriteAccess&&(e.hasCustomTemplatesCapability||e.canPublishToLive)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-bug",onClick:function(n){return e.enableDebugMode(t.idcontainerversion)},title:e.translate("TagManager_EnablePreviewDebug")},null,8,ds),[[r["vShow"],e.hasWriteAccess]]),Object(r["createElementVNode"])("a",{target:"_blank",class:"table-action icon-export",onClick:Object(r["withModifiers"])((function(n){e.exportVersion(t.idcontainerversion,t.name)}),["prevent"]),href:e.getExportUrl(t),title:e.translate("TagManager_ExportX",e.translate("TagManager_Version"))},null,8,us),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVersion(t.idcontainerversion)},title:e.translate("TagManager_EditX",e.translate("TagManager_Version"))},null,8,gs),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVersion(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Version"))},null,8,bs),[[r["vShow"],0===t.releases.length&&e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],8,ts)})),128))])],512),[[d]]),Object(r["createElementVNode"])("div",ms,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVersion",onClick:t[2]||(t[2]=function(t){return e.createVersion()})},[ps,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]]),Object(r["createElementVNode"])("a",{class:"exportDraft",target:"_blank",onClick:t[3]||(t[3]=function(t){e.exportVersion(null,"draft"),t.preventDefault()}),href:e.getExportDraftUrl()},[fs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ExportDraft")),1)],8,hs),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"importVersion",onClick:t[4]||(t[4]=function(t){return e.importVersion()})},[vs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Import")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",js,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVersionConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Os),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Ts)],512),Object(r["createElementVNode"])("div",ys,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersion",null===(l=e.versionToBePublished)||void 0===l?void 0:l.name)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{uicontrol:"select",name:"environment",modelValue:e.availableEnvironmentsToPublish.deployEnvironment,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.availableEnvironmentsToPublish.deployEnvironment=t}),options:e.availableEnvironmentsToPublish.environnments,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["modelValue","options","title"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{style:{"margin-bottom":"0"},class:"alert alert-info"},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])],512),[[r["vShow"],e.availableEnvironmentsToPublish.environnments.length]]),e.availableEnvironmentsToPublish.environnments.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vs,Object(r["toDisplayString"])(e.translate("TagManager_VersionAlreadyPublishedToAllEnvironments")),1)),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("TagManager_PublishRelease")},null,8,Cs),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,Ns)],512)])}function Ss(e){return _s(e)||Ms(e)||ks(e)||ws()}function ws(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ks(e,t){if(e){if("string"===typeof e)return Ds(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ds(e,t):void 0}}function Ms(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _s(e){if(Array.isArray(e))return Ds(e)}function Ds(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var As=window,xs=As.tagManagerHelper,Bs=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0},versionsHelpText:String},components:{ContentBlock:u["ContentBlock"],Field:g["Field"]},directives:{ContentTable:u["ContentTable"]},data:function(){return{versionToBePublished:null,versionSearch:""}},created:function(){Ql.init(),yc.fetchVersions(this.idContainer)},methods:{createVersion:function(){this.editVersion(0)},truncateText:function(e,t){return xs.truncateText(e,t)},publishVersion:function(e){var t=this;this.versionToBePublished=e,u["Matomo"].helper.modalConfirm(this.$refs.confirmPublishVersion,{yes:function(){var n=t.availableEnvironmentsToPublish.deployEnvironment;n&&yc.publishVersion(e.idcontainer,e.idcontainerversion,n).then((function(){yc.reload(t.idContainer)}))}})},enableDebugMode:function(e){xs.enablePreviewMode(this.idContainer,e)},exportVersion:function(e,t){var n={module:"API",method:"TagManager.exportContainerVersion",format:"json",idContainer:this.idContainer,filter_limit:-1};e&&(n.idContainerVersion=e);var a="container_".concat(this.idContainer);t&&(a+="_".concat(t)),u["AjaxHelper"].fetch(n).then((function(e){u["Matomo"].helper.sendContentAsDownload("".concat(a,".json"),JSON.stringify(e))}))},editVersion:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:e}))},importVersion:function(){xs.importVersion(this.idContainer)},deleteVersion:function(e){var t=this,n=function(){yc.deleteVersion(t.idContainer,e.idcontainerversion).then((function(){yc.reload(t.idContainer)}))};u["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteVersion,{yes:n})},ucfirst:function(e){return"".concat(e.substring(0,1).toUpperCase()).concat(e.substring(1))},getExportUrl:function(e){return"?module=TagManager&action=exportContainerVersion&idContainer=".concat(this.idContainer)+"&idContainerVersion=".concat(e.idcontainerversion,"&idSite=").concat(e.idsite)+"&period=day&date=yesterday"},getExportDraftUrl:function(){return"?module=TagManager&action=exportContainerVersion&idContainer=".concat(this.idContainer)+"&idSite=".concat(this.idSite,"&period=day&date=yesterday")}},computed:{environments:function(){return Ql.environmentsWithPublishOptions.value},availableEnvironmentsToPublish:function(){var e=this,t="",n=this.environments.filter((function(n){var a,i;if(null===(a=e.versionToBePublished)||void 0===a||!a.releases)return!0;var r=null===(i=e.versionToBePublished)||void 0===i?void 0:i.releases.some((function(e){return e.environment===(null===n||void 0===n?void 0:n.key)}));return r||t||(t=n.key),!r}));return{deployEnvironment:t,environnments:n}},idSite:function(){return u["Matomo"].idSite},isLoading:function(){return yc.isLoading.value},isUpdating:function(){return yc.isUpdating.value},versions:function(){return yc.versions.value},sortedVersions:function(){var e=this.versionSearch.toLowerCase(),t=Ss(this.versions).filter((function(t){return Object.keys(t).some((function(n){var a=t,i="";return"string"===typeof a[n]?i=a[n]:"releases"===n&&Object.values(a.releases).forEach((function(e){e.environment&&(i+="".concat(e.environment," "))})),-1!==i.toLowerCase().indexOf(e)}))}));return t.sort((function(e,t){return e.revision<t.revision?1:e.revision>t.revision?0:1})),t},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasCustomTemplatesCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},revisionTranslatedText:function(){return this.translate("TagManager_VersionsRevisionDescription")},nameTranslatedText:function(){return this.translate("TagManager_VersionsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VersionsDescriptionDescription")},environmentTranslatedText:function(){return this.translate("TagManager_VersionsEnvironmentsDescription")},createdTranslatedText:function(){return this.translate("TagManager_VersionsCreatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VersionsActionDescription")}}});Bs.render=Es;var Ls=Bs,Us={class:"manageVersion"},Ps={key:0},Is={key:1};function Fs(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VersionList"),c=Object(r["resolveComponent"])("VersionEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Us,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ps,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"versions-help-text":e.versionsHelpText},null,8,["id-container","versions-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Is,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion},null,8,["id-container","id-container-version"])])):Object(r["createCommentVNode"])("",!0)])}var Hs=Object(r["defineComponent"])({props:{idContainer:String,versionsHelpText:String},components:{VersionList:Ls,VersionEdit:Gc},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainerVersion}),(function(t){e.onIdContainerVersionParamChange(t)})),u["NotificationsStore"].remove("versiontagmanagement"),this.onIdContainerVersionParamChange(u["MatomoUrl"].hashParsed.value.idContainerVersion)},methods:{onIdContainerVersionParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idContainerVersion:function(){var e=u["MatomoUrl"].hashParsed.value.idContainerVersion;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idContainerVersion}}});Hs.render=Fs;var Gs=Hs,$s={class:"loadingPiwik"},Rs=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),qs={class:"loadingPiwik"},zs=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ws={class:"entityCancel"};function Xs(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"editContainer tagManagerManageEdit",feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",$s,[Rs,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",qs,[zs,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[8]||(t[8]=function(t){return e.edit?e.updateContainer():e.createContainer()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"idcontainer","model-value":e.container.idcontainer,disabled:!0,title:e.translate("General_Id")},null,8,["model-value","title"]),[[r["vShow"],e.edit]])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"select",name:"context","model-value":e.container.context,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.container.context=t,e.setValueHasChanged()}),disabled:!0,options:e.contexts,title:e.translate("TagManager_Context"),"inline-help":e.translate("TagManager_ContainerContextHelp")},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.container.name,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.container.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_ContainerNameHelp"),placeholder:e.translate("TagManager_ContainerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.container.description,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.container.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_ContainerDescriptionHelp"),placeholder:e.translate("TagManager_ContainerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"ignoreGtmDataLayer","model-value":e.container.ignoreGtmDataLayer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.container.ignoreGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_IgnoreGtmDataLaterTitle"),"inline-help":e.translate("TagManager_IgnoreGtmDataLaterDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"activelySyncGtmDataLayer","model-value":e.container.activelySyncGtmDataLayer,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.container.activelySyncGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_ActivelySyncGtmDataLayerTitle"),"inline-help":e.translate("TagManager_ActivelySyncGtmDataLayerDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"isTagFireLimitAllowedInPreviewMode","model-value":e.container.isTagFireLimitAllowedInPreviewMode,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.container.isTagFireLimitAllowedInPreviewMode=t,e.setValueHasChanged()}),title:e.translate("TagManager_TagFireLimitAllowedInPreviewModeTitle"),"inline-help":e.translate("TagManager_TagFireLimitAllowedInPreviewModeDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createVNode"])(c,{class:"createButton",onConfirm:t[6]||(t[6]=function(t){return e.edit?e.updateContainer():e.createContainer()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewContainer")},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",Ws,[Object(r["createElementVNode"])("a",{onClick:t[7]||(t[7]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function Ks(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Js(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Ys(e,t,n){return t&&Js(e.prototype,t),n&&Js(e,n),e}function Zs(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var Qs=function(){function e(){var t=this;Ks(this,e),Zs(this,"privateState",Object(r["reactive"])({contexts:[],isLoading:!1})),Zs(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),Zs(this,"isLoading",Object(r["computed"])((function(){return t.state.value.isLoading}))),Zs(this,"contexts",Object(r["computed"])((function(){return t.state.value.contexts}))),Zs(this,"contextsOptions",Object(r["computed"])((function(){return t.contexts.value.map((function(e){var t=e.id,n=e.name;return{key:t,value:n}}))}))),Zs(this,"initializePromise",null)}return Ys(e,[{key:"init",value:function(){return this.initializePromise||(this.initializePromise=this.fetchAvailableContexts()),this.initializePromise}},{key:"fetchAvailableContexts",value:function(){var e=this;return this.privateState.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getAvailableContexts",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.privateState.contexts=n})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),ed=new Qs;function td(e){return rd(e)||id(e)||ad(e)||nd()}function nd(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ad(e,t){if(e){if("string"===typeof e)return od(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?od(e,t):void 0}}function id(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function rd(e){if(Array.isArray(e))return od(e)}function od(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cd(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function sd(e,t,n){return t&&cd(e.prototype,t),n&&cd(e,n),e}function dd(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var ud=function(){function e(){var t=this;ld(this,e),dd(this,"privateState",Object(r["reactive"])({containers:[],isLoadingContainers:!1,isLoadingSingle:!1,isUpdating:!1})),dd(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),dd(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingContainers||e.isLoadingSingle}))),dd(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),dd(this,"containers",Object(r["computed"])((function(){return t.state.value.containers}))),dd(this,"fetchPromise",null)}return sd(e,[{key:"reload",value:function(){return this.privateState.containers=[],this.fetchPromise=null,this.fetchContainers()}},{key:"fetchContainers",value:function(){var e=this;return this.privateState.isLoadingContainers=!0,this.privateState.containers=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(t){return e.privateState.containers=t,e.privateState.isLoadingContainers=!1,e.containers.value})).finally((function(){e.privateState.isLoadingContainers=!1}))}},{key:"findContainer",value:function(e){var t=this,n=this.containers.value.find((function(t){return t.idcontainer===e}));return n?Promise.resolve(n):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idContainer:e,method:"TagManager.getContainer",filter_limit:"-1"}).then((function(e){return t.privateState.containers=[].concat(td(t.privateState.containers),[e]),Object(r["readonly"])(e)})).finally((function(){t.privateState.isLoadingSingle=!1})))}},{key:"deleteContainer",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.containers=[],u["AjaxHelper"].fetch({idContainer:e,method:"TagManager.deleteContainer"},{withTokenInUrl:!0}).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createOrUpdateContainer",value:function(e,t){var n=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].post({method:t,idContainer:e.idcontainer},{name:e.name,description:e.description,ignoreGtmDataLayer:e.ignoreGtmDataLayer,activelySyncGtmDataLayer:e.activelySyncGtmDataLayer,isTagFireLimitAllowedInPreviewMode:e.isTagFireLimitAllowedInPreviewMode,context:e.context},{withTokenInUrl:!0}).finally((function(){n.privateState.isUpdating=!1}))}}]),e}(),gd=new ud,bd="containertagmanagement",md=Object(r["defineComponent"])({props:{idContainer:String},components:{ContentBlock:u["ContentBlock"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){return{isDirty:!1,editTitle:"",isUpdatingVersion:!1,container:{}}},created:function(){ed.init(),Ct.init(),this.initIdContainer()},watch:{idContainer:function(e){null!==e&&this.initIdContainer()}},methods:{removeAnyContainerNotification:function(){u["NotificationsStore"].remove(bd),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,id:bd,type:"toast"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdContainer:function(){var e=this;this.container={},u["Matomo"].helper.lazyScrollToContent(),this.edit&&this.idContainer?(this.editTitle=Object(u["translate"])("TagManager_EditContainer"),gd.findContainer(this.idContainer).then((function(t){t&&(e.container=Object(u["clone"])(t),e.isDirty=!1)}))):this.create&&(this.editTitle=Object(u["translate"])("TagManager_CreateNewContainer"),this.container={idSite:u["Matomo"].idSite,name:"",context:"web",description:"",activelySyncGtmDataLayer:!0},this.isDirty=!1)},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idContainer,u["MatomoUrl"].updateHash(e)},createContainer:function(){var e=this;this.removeAnyContainerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,gd.createOrUpdateContainer(this.container,"TagManager.addContainer").then((function(t){if(e.isUpdatingVersion=!1,t){e.isDirty=!1;var n=t.value;e.showNotification(Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Container")),"success"),u["MatomoUrl"].updateUrl(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:"dashboard",idContainer:n}))}})).finally((function(){e.isUpdatingVersion=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateContainer:function(){var e=this;this.removeAnyContainerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdating=!0,gd.createOrUpdateContainer(this.container,"TagManager.updateContainer").then((function(t){t&&(e.isDirty=!1,e.container={},gd.reload().then((function(){e.initIdContainer()})),e.showNotification(Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Container")),"success"))})))},checkRequiredFieldsAreSet:function(){if(!this.container.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!0}},computed:{contexts:function(){return ed.contextsOptions.value},create:function(){return"0"===this.idContainer},edit:function(){return!this.create},isLoading:function(){return vt.isLoading.value||Ct.isLoading.value},isUpdating:function(){return vt.isUpdating.value||this.isUpdatingVersion}}});md.render=Xs;var pd=md,hd={class:"tagManagerManageList tagManagerContainerList"},fd=["innerHTML"],vd={class:"index"},jd={class:"name"},Od={class:"description"},Td={class:"created"},yd={class:"action"},Vd={colspan:"5"},Cd={class:"loadingPiwik"},Nd=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ed={colspan:"5"},Sd=["id"],wd=["title"],kd=["title"],Md=["title"],_d={class:"created"},Dd=["href","title"],Ad=["onClick","title"],xd=["onClick","title"],Bd=["onClick","title"],Ld=["onClick","title"],Ud={class:"tableActionBar"},Pd=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Id={class:"ui-confirm",id:"confirmDeleteContainer",ref:"confirmDeleteContainer"},Fd=["value"],Hd=["value"];function Gd(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",hd,[Object(r["createVNode"])(l,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Containers"))},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getManageContainersIntro)},null,8,fd),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",vd,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",jd,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",Od,Object(r["toDisplayString"])(e.translate("General_Description")),1),Object(r["createElementVNode"])("th",Td,Object(r["toDisplayString"])(e.translate("TagManager_CreatedDate")),1),Object(r["createElementVNode"])("th",yd,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Vd,[Object(r["createElementVNode"])("span",Cd,[Nd,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ed,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoContainersFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerNow",onClick:t[0]||(t[0]=function(t){return e.createContainer()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewContainerNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.containers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedContainers,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"container".concat(t.idcontainer),class:"containers",key:t.idcontainer},[Object(r["createElementVNode"])("td",{class:"index",title:"".concat(e.translate("TagManager_Context"),": ")+e.contexts[t.context]},Object(r["toDisplayString"])(t.idcontainer),9,wd),Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,kd),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Md),Object(r["createElementVNode"])("td",_d,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.created_date_pretty),1)]),Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["createElementVNode"])("a",{class:"table-action icon-configure",href:"?module=TagManager&action="+e.containerDefaultAction+"&idContainer="+t.idcontainer+"&idSite="+t.idsite+"&period=day&date=yesterday",title:e.translate("TagManager_ConfigureX",e.translate("TagManager_Container"))},null,8,Dd),Object(r["createElementVNode"])("a",{class:"table-action installCode icon-embed",onClick:function(n){return e.installCode(t.idcontainer)},title:e.translate("TagManager_InstallCode")},null,8,Ad),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editContainer(t.idcontainer)},title:e.translate("TagManager_EditX",e.translate("TagManager_Container"))},null,8,xd),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteContainer(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Container"))},null,8,Bd),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Container"))},null,8,Ld),[[r["vShow"],e.canCopyContainer]])],2)],8,Sd)})),128))])],512),[[c]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ud,[Object(r["createElementVNode"])("a",{class:"createNewContainer",value:"",onClick:t[1]||(t[1]=function(t){return e.createContainer()})},[Pd,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewContainer")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",Id,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteContainerConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Fd),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Hd)],512)])}function $d(e){return Wd(e)||zd(e)||qd(e)||Rd()}function Rd(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qd(e,t){if(e){if("string"===typeof e)return Xd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xd(e,t):void 0}}function zd(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Wd(e){if(Array.isArray(e))return Xd(e)}function Xd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Kd=window,Jd=Kd.tagManagerHelper,Yd=Object(r["defineComponent"])({props:{isSuperUser:{type:Boolean,required:!0}},components:{ContentBlock:u["ContentBlock"]},directives:{ContentTable:u["ContentTable"]},created:function(){ed.init(),gd.fetchContainers()},computed:{contexts:function(){var e={};return ed.contexts.value.forEach((function(t){var n=t.id,a=t.name;e[n]=a})),e},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},containerDefaultAction:function(){return this.hasWriteAccess?"dashboard":"manageTags"},isLoading:function(){return yc.isLoading.value},isUpdating:function(){return yc.isUpdating.value},containers:function(){return gd.containers.value},sortedContainers:function(){var e=$d(this.containers);return e.sort((function(e,t){return e.created_date<t.created_date?1:e.created_date>t.created_date?-1:0})),e},getManageContainersIntro:function(){var e=Object(u["externalLink"])("https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/");return Object(u["translate"])("TagManager_ManageContainersIntro",e,"</a>")},canCopyContainer:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},getActionClasses:function(){var e=this.canCopyContainer?" hasCopyAction":"";return"action".concat(e)}},methods:{createContainer:function(){this.editContainer("0")},editContainer:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainer:e}))},installCode:function(e){Jd.showInstallCode(e)},deleteContainer:function(e){function t(){gd.deleteContainer(e.idcontainer).then((function(){gd.reload(),u["NotificationsStore"].remove("CopyDialogResultNotification")}))}u["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteContainer,{yes:t})},truncateText:function(e,t){return e.length>t?"".concat(e.substr(0,t-3),"..."):e},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyContainerDialog",idSite:e.idsite,idContainer:e.idcontainer});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyContainer")}}});Yd.render=Gd;var Zd=Yd,Qd={class:"manageContainer"};function eu(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ContainerList"),c=Object(r["resolveComponent"])("ContainerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Qd,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"is-super-user":e.isSuperUser},null,8,["is-super-user"])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer},null,8,["id-container"])],512),[[r["vShow"],e.editMode]])])}var tu=Object(r["defineComponent"])({props:{isSuperUser:{type:Boolean,required:!0}},components:{ContainerList:Zd,ContainerEdit:pd},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainer}),(function(t){e.onIdContainerParamChange(t)})),u["NotificationsStore"].remove("containertagmanagement"),this.onIdContainerParamChange(u["MatomoUrl"].hashParsed.value.idContainer)},computed:{idContainer:function(){var e=u["MatomoUrl"].hashParsed.value.idContainer;return this.isAddAllowed||""!==e?e:null},editMode:function(){return!!this.idContainer}},methods:{onIdContainerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}}});tu.render=eu;var nu=tu,au={class:"containerDashboard"},iu={key:0},ru={class:"dashboardCreationDate"},ou={key:0},lu=Object(r["createElementVNode"])("br",null,null,-1),cu=["innerHTML"],su={class:"row",style:{"margin-left":"-0.75rem"}},du={class:"col m6 s12"},uu={key:0},gu=["href","title"],bu={key:0},mu=Object(r["createElementVNode"])("hr",null,null,-1),pu=["href"],hu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),fu=["href"],vu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),ju={class:"col m6 s12"},Ou={key:0},Tu=["href","title"],yu=Object(r["createElementVNode"])("hr",null,null,-1),Vu=["href"],Cu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Nu=["href"],Eu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Su={class:"row",style:{"margin-left":"-0.75rem"}},wu={class:"col m6 s12"},ku=["href","title"],Mu={key:0},_u=Object(r["createElementVNode"])("hr",null,null,-1),Du=["href"],Au=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),xu=["href"],Bu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Lu={class:"col m6 s12"},Uu=["title","href"],Pu={key:0},Iu=Object(r["createElementVNode"])("br",null,null,-1),Fu=["title"],Hu={key:0},Gu=Object(r["createElementVNode"])("hr",null,null,-1),$u=["href"],Ru=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),qu=["href"],zu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function Wu(e,t,n,a,i,o){var l,c,s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("EnrichedHeadline"),u=Object(r["resolveComponent"])("ContentBlock"),g=Object(r["resolveDirective"])("content-intro");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",au,[Object(r["createVNode"])(s,{loading:e.isLoading},null,8,["loading"]),e.isLoading?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",iu,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("h2",null,[Object(r["createVNode"])(d,{"feature-name":"Tag Manager","inline-help":e.dashboardHelpText},{default:Object(r["withCtx"])((function(){var t;return[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ContainerX",null===(t=e.container)||void 0===t?void 0:t.name)),1)]})),_:1},8,["inline-help"])]),Object(r["createElementVNode"])("p",ru,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.containerMetaInformation)+" ",1),null!==(l=e.containerVersion)&&void 0!==l&&l.description?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ou,[lu,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_Description"))+": "+Object(r["toDisplayString"])(null===(c=e.containerVersion)||void 0===c?void 0:c.description),1)])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.containerDashboardDescription)},null,8,cu)],512),[[g]]),Object(r["createElementVNode"])("div",su,[Object(r["createElementVNode"])("div",du,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.tagCount," ").concat(e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.tagCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",uu,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedContainerVersionTags,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTags",{idTag:t.idtag}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,gu),n!==e.sortedContainerVersionTags.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",bu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))])):Object(r["createCommentVNode"])("",!0)]),mu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags")},[hu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTags")),1)],8,pu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags",{idTag:0})},[vu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)],8,fu)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",ju,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.triggerCount," ").concat(e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.triggerCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Ou,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTriggers",{idTrigger:t.idtrigger}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,Tu),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],n!==e.sortedTriggers.length-1]])])})),128))])):Object(r["createCommentVNode"])("",!0)]),yu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers")},[Cu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTriggers")),1)],8,Vu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers",{idTrigger:0})},[Eu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)],8,Nu)]})),_:1},8,["content-title","help-text"])])]),Object(r["createElementVNode"])("div",Su,[Object(r["createElementVNode"])("div",wu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.variableCount," ").concat(e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageVariables",{idVariable:t.idvariable}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,ku),n!==e.sortedVariables.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Mu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.variableCount]])]),_u,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables")},[Au,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVariables")),1)],8,Du),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables",{idVariable:0})},[Bu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],8,xu)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",Lu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.versionCount," ").concat(e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_LastVersions"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.lastVersions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{title:e.lastVersionLinkTitle(t),href:e.linkTo("manageVersions",{idContainerVersion:t.idcontainerversion})},Object(r["toDisplayString"])(t.name),9,Uu),n!==e.lastVersions.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Pu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.lastVersions.length]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Iu,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_Environments"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.container.releases,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("span",{title:e.releaseTooltip(t)},Object(r["toDisplayString"])(e.ucfirst(t.environment)),9,Fu),n!==e.container.releases.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Hu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.container.releases.length]])]),Gu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions")},[Ru,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVersions")),1)],8,$u),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions",{idContainerVersion:0})},[zu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],8,qu)]})),_:1},8,["content-title","help-text"])])])]))])}function Xu(e){e.sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}))}var Ku=Object(r["defineComponent"])({props:{idContainer:String,dashboardHelpText:String,tagsHelpText:String,triggersHelpText:String,variablesHelpText:String,versionsHelpText:String},components:{ActivityIndicator:u["ActivityIndicator"],EnrichedHeadline:u["EnrichedHeadline"],ContentBlock:u["ContentBlock"]},directives:{ContentIntro:u["ContentIntro"]},data:function(){return{container:null,containerVersion:null,isLoading:!1}},created:function(){var e=this;ed.init(),this.isLoading=!0;var t=u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer}).then((function(t){e.container=t})),n=u["AjaxHelper"].fetch({method:"TagManager.exportContainerVersion",idContainer:this.idContainer}).then((function(t){e.containerVersion=t}));Promise.all([t,n]).finally((function(){e.isLoading=!1}))},methods:{linkTo:function(e,t){var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e}));return t&&(n+="#?".concat(u["MatomoUrl"].stringify(t))),"?".concat(n)},lastVersionLinkTitle:function(e){return"Created on ".concat(e.created_date_pretty)+", description: '".concat(e.description,"'")},releaseTooltip:function(e){var t=Object(u["translate"])("TagManager_ReleaseInfo",e.release_login,e.release_date_pretty),n=Object(u["translate"])("TagManager_ReleaseVersionInfo",e.version_name);return"".concat(t," ").concat(n)},ucfirst:function(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}},computed:{lastVersions:function(){var e,t;return null!==(e=this.container)&&void 0!==e&&null!==(t=e.versions)&&void 0!==t&&t.length?this.container.versions.slice(0,5):[]},contexts:function(){var e={};return ed.contexts.value.forEach((function(t){var n=t.id,a=t.name;e[n]=a})),e},containerMetaInformation:function(){var e;return Object(u["translate"])("TagManager_ContainerIdInformation",(null===(e=this.containerVersion)||void 0===e?void 0:e.idcontainer)||"")},containerDashboardDescription:function(){var e=Object(u["externalLink"])("https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/");return Object(u["translate"])("TagManager_ContainerDashboardDescription",e,"</a>")},sortedContainerVersionTags:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.tags)||[];return Xu(t),t},sortedTriggers:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.triggers)||[];return Xu(t),t},sortedVariables:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.variables)||[];return Xu(t),t},tagCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.tags.length},triggerCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.triggers.length},versionCount:function(){var e;return null===(e=this.container)||void 0===e?void 0:e.versions.length},variableCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.variables.length}}});Ku.render=Wu;var Ju=Ku,Yu=["title"],Zu={class:"title"},Qu=Object(r["createElementVNode"])("span",{class:"icon icon-chevron-down"}," ",-1),eg={class:"dropdown positionInViewport"},tg={class:"custom_select_container"},ng={class:"custom_select_ul_list"},ag=["title"],ig=["href"];function rg(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ActivityIndicator"),c=Object(r["resolveDirective"])("focus-anywhere-but-here");return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["tagContainerSelector piwikSelector borderedControl",{expanded:e.showContainerList}]),onClick:t[1]||(t[1]=function(t){e.fetchContainers(),e.showContainerList=!e.showContainerList}),title:e.translate("TagManager_ChooseContainer")},[Object(r["createElementVNode"])("a",Zu,[Qu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.truncateText(e.actualContainerName,50)),1)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",eg,[Object(r["createVNode"])(l,{loading:e.isLoading},null,8,["loading"]),Object(r["createElementVNode"])("div",tg,[Object(r["createElementVNode"])("ul",ng,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("a",{tabindex:"-1",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(){}),["prevent","stop"]))},Object(r["toDisplayString"])(e.translate("TagManager_NoContainersFound")),1)],512),[[r["vShow"],!e.isLoading&&0===e.containers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containers,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{title:"".concat(t.name," (").concat(t.idcontainer,")"),key:t.idcontainer},[Object(r["createElementVNode"])("a",{href:e.linkTo(t.idcontainer)},Object(r["toDisplayString"])(t.name)+" ("+Object(r["toDisplayString"])(t.idcontainer)+") ",9,ig)],8,ag)})),128))])])],512),[[r["vShow"],e.showContainerList]])],10,Yu)),[[c,{blur:e.onBlur}]])}var og=window,lg=og.tagManagerHelper,cg=Object(r["defineComponent"])({props:{containerName:String},components:{ActivityIndicator:u["ActivityIndicator"]},directives:{FocusAnywhereButHere:u["FocusAnywhereButHere"]},data:function(){return{containers:[],isLoading:!1,showContainerList:!1}},created:function(){setTimeout((function(){window.initTopControls()}))},methods:{fetchContainers:function(){var e=this;this.isLoading=!0,this.containers=[],u["AjaxHelper"].fetch({method:"TagManager.getContainers"}).then((function(t){e.containers=t})).finally((function(){e.isLoading=!1}))},linkTo:function(e){var t=u["MatomoUrl"].urlParsed.value.action;t&&"manageContainers"!==t||(t=this.hasWriteAccess?"dashboard":"manageTags");var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{idContainer:e,action:t}));return"".concat(window.location.pathname,"?").concat(n)},onBlur:function(){this.showContainerList=!1},truncateText:function(e,t){return lg.truncateText(e,t)}},computed:{actualContainerName:function(){return this.containerName?Object(u["translate"])("TagManager_ContainerX",this.containerName):Object(u["translate"])("TagManager_ChooseContainer")},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")}}});cg.render=rg;var sg=cg,dg={style:{"margin-left":"-0.75rem"}},ug=Object(r["createElementVNode"])("br",null,null,-1),gg=["href"],bg=["textContent"],mg={style:{"margin-top":"1rem"}},pg=["innerHTML"],hg=Object(r["createElementVNode"])("br",null,null,-1),fg=["href"],vg={class:"environment"},jg={class:"name"},Og={class:"name"},Tg={class:"released_by"},yg={class:"released_on"},Vg={key:0},Cg={colspan:"7"},Ng={class:"loadingPiwik"},Eg=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Sg={key:1},wg={colspan:"7"},kg={class:"environment"},Mg={class:"name"},_g={class:"revision"},Dg={class:"released_by"},Ag={class:"released_on"},xg={class:"date"};function Bg(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("copy-to-clipboard"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"manageInstallTagCode",feature:"Tag Manager","content-title":"Install Code"},{default:Object(r["withCtx"])((function(){var n,a;return[Object(r["createElementVNode"])("div",dg,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.environment=t,e.fetchInstallInstructions(e.environment)}),options:e.environments,title:e.translate("TagManager_Environment")},null,8,["model-value","options","title"])]),Object(r["createVNode"])(c,{loading:e.isLoading},null,8,["loading"]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n},[Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),ug,t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,gg)):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",null,[t.embedCode?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("pre",{key:0,textContent:Object(r["toDisplayString"])(t.embedCode)},null,8,bg)),[[d,{}]]):Object(r["createCommentVNode"])("",!0)])])})),128)),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_InstallCodePublishEnvironmentNote","preview"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("p",mg,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_InstallCodeDataLayerNote","<strong>","</strong>"))},null,8,pg),hg,Object(r["createElementVNode"])("a",{target:"_blank",href:e.externalRawLink("https://matomo.org/faq/tag-manager/data-layer-in-matomo-tag-manager/")},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,fg)]),Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ReleasesOverview")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",vg,Object(r["toDisplayString"])(e.translate("TagManager_Environment")),1),Object(r["createElementVNode"])("th",jg,Object(r["toDisplayString"])(e.translate("TagManager_VersionName")),1),Object(r["createElementVNode"])("th",Og,Object(r["toDisplayString"])(e.translate("TagManager_VersionRevision")),1),Object(r["createElementVNode"])("th",Tg,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedBy")),1),Object(r["createElementVNode"])("th",yg,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedOn")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoading?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Vg,[Object(r["createElementVNode"])("td",Cg,[Object(r["createElementVNode"])("span",Ng,[Eg,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])])):Object(r["createCommentVNode"])("",!0),e.isLoading||0!==(null===(n=e.container)||void 0===n||null===(a=n.releases)||void 0===a?void 0:a.length)?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Sg,[Object(r["createElementVNode"])("td",wg,Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFound")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedReleases,(function(t){var n,a;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t.idcontainerrelease},[Object(r["createElementVNode"])("td",kg,Object(r["toDisplayString"])(e.ucfirst(t.environment)),1),Object(r["createElementVNode"])("td",Mg,Object(r["toDisplayString"])(null===(n=e.releaseVersions[t.idcontainerrelease])||void 0===n?void 0:n.name),1),Object(r["createElementVNode"])("td",_g,Object(r["toDisplayString"])(null===(a=e.releaseVersions[t.idcontainerrelease])||void 0===a?void 0:a.revision),1),Object(r["createElementVNode"])("td",Dg,Object(r["toDisplayString"])(t.release_login),1),Object(r["createElementVNode"])("td",Ag,[Object(r["createElementVNode"])("span",xg,Object(r["toDisplayString"])(t.release_date_pretty),1)])])})),128))])],512),[[u]])]})),_:1})}function Lg(e){return Ig(e)||Pg(e)||Gg(e)||Ug()}function Ug(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Pg(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ig(e){if(Array.isArray(e))return $g(e)}function Fg(e,t){return qg(e)||Rg(e,t)||Gg(e,t)||Hg()}function Hg(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Gg(e,t){if(e){if("string"===typeof e)return $g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$g(e,t):void 0}}function $g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Rg(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function qg(e){if(Array.isArray(e))return e}var zg=window,Wg=zg.$,Xg=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0}},components:{ContentBlock:u["ContentBlock"],Field:g["Field"],ActivityIndicator:u["ActivityIndicator"]},directives:{SelectOnFocus:u["SelectOnFocus"],ContentTable:u["ContentTable"],CopyToClipboard:u["CopyToClipboard"]},data:function(){return{container:null,environments:[],environment:"live",installInstructions:[],isLoading:!1,isLoadingInstructions:!1}},created:function(){var e=this;this.isLoading=!0,this.fetchReleases().finally((function(){e.isLoading=!1}))},methods:{fetchInstallInstructions:function(e){var t=this;return this.installInstructions=[],this.isLoadingInstructions=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:this.idContainer,environment:e}).then((function(e){t.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(t.$refs.codeblock)?t.$refs.codeblock:[t.$refs.codeblock];e.forEach((function(e){Wg(e).effect("highlight",{},1500)}))}))})).finally((function(){t.isLoadingInstructions=!1}))},fetchReleases:function(){var e=this;return u["AjaxHelper"].fetch([{method:"TagManager.getAvailableEnvironments",filter_limit:"-1"},{method:"TagManager.getContainer",idContainer:this.idContainer,filter_limit:"-1"}]).then((function(t){var n,a,i=Fg(t,2),r=i[0],o=i[1];e.environments=r.map((function(e){return{key:e.id,value:e.name}})),e.container=o;var l=o.releases.some((function(e){return"live"===e.environment}));if(!l&&null!==(n=e.environments)&&void 0!==n&&null!==(a=n[0])&&void 0!==a&&a.key?e.environment=e.environments[0].key:l||(e.environment=""),e.environment)return e.fetchInstallInstructions(e.environment)}))},ucfirst:function(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}},computed:{releaseVersions:function(){var e,t=this,n={};return((null===(e=this.container)||void 0===e?void 0:e.releases)||[]).forEach((function(e){n[e.idcontainerrelease]=t.container.versions.find((function(t){return t.idcontainerversion===e.idcontainerversion}))})),n},sortedReleases:function(){var e,t=Lg(((null===(e=this.container)||void 0===e?void 0:e.releases)||[]).map((function(e,t){return Object.assign(Object.assign({},e),{},{index:t})})));return t.sort((function(e,t){return e.release_date<t.release_date?1:e.release_date>t.release_date?-1:t.index-e.index})),t}}});Xg.render=Bg;var Kg=Xg,Jg={class:"tagManagerTrackingCode"},Yg={key:0},Zg={class:"trackingCodeAdvancedOptions"},Qg={class:"advance-option"},eb=Object(r["createElementVNode"])("span",{class:"icon-chevron-down"},null,-1),tb=Object(r["createElementVNode"])("span",{class:"icon-chevron-up"},null,-1),nb={id:"mtm-advanced-options"},ab=["innerHTML"],ib={key:1,class:"row"},rb={class:"col s12 m4 "},ob={class:"form-group row"},lb={class:"col s12 input-field"},cb={for:"tagManagerTrackingCodeSite",class:"siteSelectorLabel"},sb={class:"sites_autocomplete"},db={class:"col s12 m4"},ub={class:"col s12 m4"},gb=["innerHTML"],bb={key:1,class:"alert alert-info"},mb={href:""},pb={key:0},hb=["href"],fb=Object(r["createTextVNode"])(". "),vb=["innerHTML"],jb=["textContent"],Ob=["innerHTML"],Tb={key:1};function yb(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("SiteSelector"),d=Object(r["resolveComponent"])("Field"),u=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Jg,[e.showContainerRow?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Yg,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_OptionallyCustomiseContainer"))+" ",1),Object(r["createElementVNode"])("div",Zg,[Object(r["createElementVNode"])("div",Qg,[Object(r["createElementVNode"])("span",null,[e.isAdvancedDisplayed?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,href:"javascript:;",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!0}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_ShowAdvancedOptions"))+" ",1),eb])),e.isAdvancedDisplayed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:1,href:"javascript:;",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!1}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_HideAdvancedOptions"))+" ",1),tb])):Object(r["createCommentVNode"])("",!0)])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",nb,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.getAdvancedStepText)},null,8,ab),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:0,loading:!0},null,512)),[[r["vShow"],e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ib,[Object(r["createElementVNode"])("div",rb,[Object(r["createElementVNode"])("div",ob,[Object(r["createElementVNode"])("div",lb,[Object(r["createElementVNode"])("label",cb,Object(r["toDisplayString"])(e.translate("General_Website")),1),Object(r["createElementVNode"])("div",sb,[Object(r["createVNode"])(s,{id:"tagManagerTrackingCodeSite",modelValue:e.site,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.site=t}),"show-all-sites-item":!1,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["modelValue"])])])])]),Object(r["createElementVNode"])("div",db,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"containers","model-value":e.idContainer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.idContainer=t,e.onContainerChange()}),options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container")},null,8,["model-value","options","disabled","title"])])]),Object(r["createElementVNode"])("div",ub,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.environment=t,l.$emit("fetchInstallInstructions")}),options:e.environments,disabled:e.environments.length<=1,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["model-value","options","disabled","title"])])])],512)),[[r["vShow"],!e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:2,innerHTML:e.$sanitize(e.getAdvancedStepInfo)},null,8,gb)):Object(r["createCommentVNode"])("",!0)])],512),[[r["vShow"],e.isAdvancedDisplayed]])])])):Object(r["createCommentVNode"])("",!0),e.idContainer&&e.noReleaseFound?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",bb,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFoundForContainer"))+" ",1),Object(r["createElementVNode"])("a",mb,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersionToEnvironmentToViewEmbedCode")),1)])):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:n},[e.showDescription?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",pb,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,hb)):Object(r["createCommentVNode"])("",!0),fb])):Object(r["createCommentVNode"])("",!0),e.showPlainMtmSteps?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:1,innerHTML:e.$sanitize(e.getMtmStep3)},null,8,vb)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(t.embedCode),ref:"codeblock"},null,8,jb),[[u,{}]])])],64)})),128)),e.showBottom&&!e.noReleaseFound&&e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:2},[e.showTestSection?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Tb,[(Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])(e.testComponent),{site:e.site},null,8,["site"]))])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:0,innerHTML:e.$sanitize(e.getCongratulationsText)},null,8,Ob))],64)):Object(r["createCommentVNode"])("",!0)])}function Vb(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}var Cb=Object(r["defineComponent"])({props:{showContainerRow:Boolean,showBottom:Boolean,showDescription:Boolean,showPlainMtmSteps:Boolean,showTestSection:Boolean,showAdvancedOptions:{required:!1,type:Boolean,default:!1}},components:{ActivityIndicator:u["ActivityIndicator"],SiteSelector:u["SiteSelector"],Field:g["Field"]},emits:["fetchInstallInstructions"],directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{containerVariables:[],isLoading:!1,idContainer:"",environment:"",environments:[],environmentNameMap:{},containerMap:{},containerOptions:[],site:{id:u["Matomo"].idSite,name:u["Matomo"].helper.htmlDecode(u["Matomo"].siteName)},matomoConfigs:[],releases:[],installInstructions:[],noReleaseFound:!1,isAdvancedDisplayed:!1}},created:function(){var e=this;u["AjaxHelper"].fetch({method:"TagManager.getAvailableEnvironments",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.environmentNameMap=Object.fromEntries(n.map((function(e){var t=e.id,n=e.name;return[t,n]})))})),this.onSiteChange(),this.isAdvancedDisplayed=this.showAdvancedOptions},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;this.installInstructions=[],this.containerOptions=[],this.containerMap={},this.environments=[],this.matomoConfigs=[],this.idContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&(this.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idContainer="",t.isAdvancedDisplayed=!0,void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idContainer||(t.idContainer=e.idcontainer),t.containerMap[e.idcontainer]=e,t.containerOptions.push({key:e.idcontainer,value:e.name})})),t.onContainerChange()})).finally((function(){t.isLoading=!1})))},onContainerChange:function(){var e=this;if(this.noReleaseFound=!1,this.idContainer){this.installInstructions=[];var t=this.containerMap[this.idContainer],n=t.draft.idcontainerversion;this.environment="",this.environments=[];var a=t.releases||[];a.find((function(e){return"live"===e.environment}))&&(this.environment="live"),a.forEach((function(t){if("preview"!==t.environment){e.environment||(e.environment=t.environment);var n=Vb(t.environment);t.environment in e.environmentNameMap&&(n=e.environmentNameMap[t.environment]),e.environments.push({key:t.environment,value:n})}})),this.environments.length||(this.noReleaseFound=!0,this.environments.push({key:"",value:this.translate("TagManager_NoReleasesFound")})),this.$emit("fetchInstallInstructions"),this.fetchVariables(n)}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n})),r="".concat(window.location.pathname,"?").concat(i);return a&&(r+="#?".concat(u["MatomoUrl"].stringify(a))),r},fetchVariables:function(e){var t,n=this;this.matomoConfigs=[],this.idContainer&&null!==(t=this.site)&&void 0!==t&&t.id&&e&&u["AjaxHelper"].fetch({method:"TagManager.getContainerVariables",filter_limit:"-1",idContainer:this.idContainer,idContainerVersion:e,idSite:this.site.id}).then((function(e){n.matomoConfigs=e.filter((function(e){return"MatomoConfiguration"===e.type}))})).finally((function(){n.isLoading=!1}))}},computed:{getLearnMoreLink:function(){return Object(u["translate"])("TagManager_CustomHtmlTagHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"</a>")},getMtmStep3:function(){return Object(u["translate"])("TagManager_CopyCodePasteInHeader","&lt;/head&gt;")},getCongratulationsText:function(){return Object(u["translate"])("TagManager_SiteWithoutDataReactFollowStepCompleted","<strong>","</strong>")},testComponent:function(){return this.showTestSection?Object(u["useExternalPluginComponent"])("JsTrackerInstallCheck","JsTrackerInstallCheck"):""},getAdvancedStepText:function(){var e,t=Object(u["translate"])("TagManager_SelectContainerForWebsite","<strong>","</strong>");if(this.idContainer)return t;var n=this.linkTo("manageContainers",String(null===(e=this.site)||void 0===e?void 0:e.id),""),a=Object(u["translate"])("TagManager_ManageContainersLink",'<a href="'.concat(n,'" target="_blank" rel="noreferrer noopener">'),"</a>");return"".concat(t," ").concat(a)},getAdvancedStepInfo:function(){var e=this.site&&this.site.id?this.site.id:"",t=this.linkTo("dashboard",e,this.idContainer,[]);return Object(u["translate"])("TagManager_CustomiseContainer",'<a href="'.concat(t,'">'),"</a>",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"</a>")}}});Cb.render=yb;var Nb=Cb,Eb=Object(r["createElementVNode"])("br",null,null,-1),Sb={class:"followStepsHeading"},wb={style:{"list-style":"inside decimal"}};function kb(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon");return Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])("getTrackingMethodsForSite"===e.currentAction?"div":"ContentBlock"),{anchor:"tagmanager","content-title":e.translate("TagManager_MatomoTagManager")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_MtmTrackingCodeIntro")),1),Eb,Object(r["createElementVNode"])("p",Sb,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SitesManager_SiteWithoutDataCloudflareFollowStepsIntro")),1)]),Object(r["createElementVNode"])("ol",wb,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!0,showDescription:!1,showPlainMtmSteps:!0,showAdvancedOptions:"trackingCodeGenerator"===e.currentAction,showTestSection:"getTrackingMethodsForSite"===e.currentAction&&e.isJsTrackerInstallCheckAvailable,onFetchInstallInstructions:e.fetchInstallInstructions,ref:"trackingCodeCommon"},null,8,["show-container-row","showAdvancedOptions","showTestSection","onFetchInstallInstructions"])])]})),_:1},8,["content-title"])}var Mb=Object(r["defineComponent"])({props:{currentAction:String,showContainerRow:Boolean,isJsTrackerInstallCheckAvailable:Boolean},components:{ContentBlock:u["ContentBlock"],TrackingCodeCommon:Nb},methods:{fetchInstallInstructions:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;a.installInstructions=[],null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id&&null!==a&&void 0!==a&&a.environment&&(a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id}).then((function(e){a.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1})))}}});Mb.render=kb;var _b=Mb,Db={class:"list-style-decimal"},Ab={ref:"step1"},xb=["innerHTML"],Bb=["innerHTML"],Lb=["textContent"],Ub=["innerHTML"],Pb=["textContent"],Ib=["innerHTML"],Fb=["innerHTML"],Hb=["innerHTML"],Gb=["textContent"],$b={style:{"list-style":"lower-alpha","list-style-position":"inside"}},Rb=["innerHTML"],qb=["innerHTML"],zb=["innerHTML"],Wb=["textContent"],Xb=["textContent"],Kb=["innerHTML"],Jb=["textContent"],Yb=["innerHTML"],Zb=["innerHTML"],Qb=["textContent"];function em(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon"),c=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("ol",Db,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",Ab,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!1,showDescription:!1,onFetchInstallInstructions:e.fetchInstallInstructionsSPA,ref:"trackingCodeCommon"},null,8,["show-container-row","onFetchInstallInstructions"])],512),[[r["vShow"],e.step1HasContent]]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep2)},null,8,xb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep3)},null,8,Bb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Lb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep5)},null,8,Ub),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Pb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep7)},null,8,Ib),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep8)},null,8,Fb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep9)},null,8,Hb),Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("span",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep10)},null,8,Gb),Object(r["createElementVNode"])("ol",$b,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10a)},null,8,Rb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10b)},null,8,qb)])]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep11)},null,8,zb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("General_Update"))},null,8,Wb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep13)},null,8,Xb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep14)},null,8,Kb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep15)},null,8,Jb),Object(r["createElementVNode"])("li",null,["react"===e.jsFramework?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:0,innerHTML:e.$sanitize(e.fetchFollowStep16React)},null,8,Yb)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,innerHTML:e.$sanitize(e.fetchFollowStep16SPA)},null,8,Zb)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:t},[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(e.embedCode),ref:"codeblock"},null,8,Qb),[[c,{}]])])})),128))])])}var tm=Object(r["defineComponent"])({props:{showContainerRow:Boolean,jsFramework:String},components:{TrackingCodeCommon:Nb},directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{setupStep1:"",setupStep2:"",setupStep7:"",installInstructions:[]}},methods:{fetchInstallInstructionsSPA:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;if(this.installInstructions=[],null!==a&&void 0!==a&&a.idContainer&&null!==a&&void 0!==a&&a.environment&&null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id){var i=this.linkTo("manageContainers",a.site.id,a.idContainer);this.setupStep1=Object(u["translate"])("TagManager_SPAFollowStep1","<br><strong>","</strong>",'<a href="'.concat(i,'" target="_blank" rel="noreferrer noopener">'),"</a>");var o=this.linkTo("manageTriggers",a.site.id,a.idContainer);this.setupStep2=Object(u["translate"])("TagManager_SPAFollowStep2",'<a href="'.concat(o,'" target="_blank" rel="noreferrer noopener">'),"</a>");var l=this.linkTo("manageTags",a.site.id,a.idContainer);this.setupStep7=Object(u["translate"])("TagManager_SPAFollowStep7",'<a href="'.concat(l,'" target="_blank" rel="noreferrer noopener">'),"</a>"),a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id,jsFramework:this.jsFramework}).then((function(e){n.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1}))}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n}));return a&&(i+="#?".concat(u["MatomoUrl"].stringify(a))),"?".concat(i)},fetchClickX:function(e){return Object(u["translate"])("General_ClickX",Object(u["translate"])(e))}},computed:{step1HasContent:function(){var e=this.$refs.step1;return e&&""!==e.textContent},fetchFollowStep3:function(){return Object(u["translate"])("TagManager_SPAFollowStep3","<strong>".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),"</strong>"),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-trigger"),"</a>")},fetchFollowStep5:function(){return Object(u["translate"])("TagManager_SPAFollowStep5","<strong>".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),"</strong>"),Object(u["translate"])("TagManager_CategoryUserEngagement"))},fetchFollowStep8:function(){return Object(u["translate"])("TagManager_SPAFollowStep8","<strong>".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),"</strong>"),"<strong>".concat(Object(u["translate"])("TagManager_MatomoTagName"),"</strong>"),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-tag"),"</a>")},fetchFollowStep9:function(){return Object(u["translate"])("TagManager_SPAFollowStep9",Object(u["translate"])("TagManager_ConfigureWhatTagDoes"),Object(u["translate"])("TagManager_CustomTitle"),"<strong>","</strong>")},fetchFollowStep10:function(){return Object(u["translate"])("TagManager_SPAFollowStep10",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10a:function(){return Object(u["translate"])("TagManager_SPAFollowStep10a","<strong>","</strong>",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10b:function(){return Object(u["translate"])("TagManager_SPAFollowStep10b",Object(u["translate"])("TagManager_CustomUrl"),"<strong>","</strong>")},fetchFollowStep11:function(){return Object(u["translate"])("TagManager_SPAFollowStep11",Object(u["translate"])("TagManager_ConfigureWhenTagDoes"),Object(u["translate"])("TagManager_FireTriggerTitle"),"<strong>".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),"</strong>"),"<strong>".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),"</strong>"))},fetchFollowStep13:function(){return Object(u["translate"])("TagManager_SPAFollowStep13",Object(u["translate"])("TagManager_Publish"))},fetchFollowStep14:function(){return Object(u["translate"])("TagManager_SPAFollowStep14",Object(u["translate"])("TagManager_VersionName"),"<strong>","</strong>")},fetchFollowStep15:function(){return Object(u["translate"])("TagManager_SPAFollowStep15",Object(u["translate"])("TagManager_CreateVersionAndPublishRelease"))},fetchFollowStep16SPA:function(){return Object(u["translate"])("TagManager_SPAFollowStep16","&lt;/head&gt;",Object(u["externalLink"])("https://developer.matomo.org/guides/tagmanager/embedding"),"</a>")},fetchFollowStep16React:function(){return Object(u["translate"])("TagManager_ReactFollowStep16","<strong>","</strong>","<strong>App.js</strong>","<strong>React.useEffect</strong>","<strong>Hello World</strong>","<strong>React.js</strong>")}}});tm.render=em;var nm,am,im=tm,rm={class:"nav-wrapper"},om={class:"pull-right"},lm=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-close"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-close"})],-1),cm=[lm],sm={class:"pull-right"},dm=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("defs",null,[Object(r["createElementVNode"])("symbol",{id:"tm-icon-checkmark",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M27 4l-15 15-7-7-5 5 12 12 20-20z"})])])],-1),um=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("symbol",{id:"tm-icon-close",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M31.33 0.67c0.893 0.893 0.893 2.34 0 3.232l-27.427 27.427c-0.893 0.893-2.34\n          0.893-3.232 0s-0.893-2.34 0-3.232l27.427-27.427c0.892-0.893 2.34-0.893 3.232 0z"}),Object(r["createElementVNode"])("path",{d:"M0.67 0.67c0.893-0.893 2.34-0.893 3.232 0l27.427 27.427c0.893 0.892 0.893\n          2.34 0 3.232s-2.34 0.892-3.232 0l-27.427-27.427c-0.893-0.893-0.893-2.34 0-3.232z"})])],-1),gm={class:"page",style:{clear:"both"}},bm={key:0,id:"secondNavBar",class:"Menu--dashboard z-depth-1"},mm={class:"navbar",role:"menu",style:{padding:"0"}},pm={class:"menuTab",role:"menuitem"},hm={class:"item",style:{"font-weight":"normal"}},fm=Object(r["createTextVNode"])(" Events "),vm={key:0},jm=Object(r["createElementVNode"])("br",null,null,-1),Om=Object(r["createElementVNode"])("br",null,null,-1),Tm=Object(r["createElementVNode"])("label",{for:"onlyfiredTags",class:"lbl-onlyfiredTags"},"Only fired tags",-1),ym={key:0,style:{padding:"0 0 1rem 1.2rem"}},Vm=["onClick","title"],Cm={title:"This tag was fired"},Nm=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-checkmark"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-checkmark"})],-1),Em=[Nm],Sm={class:"pageWrap"},wm={class:"home",id:"content"},km=Object(r["createElementVNode"])("h3",null,"Fired Tags",-1),Mm={class:"entityTable"},_m=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Action"),Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Fired count")])],-1),Dm={key:0},Am=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),xm=[Am],Bm=Object(r["createElementVNode"])("h3",{style:{"margin-top":"30px"}},"Not Yet Fired Tags",-1),Lm={class:"entityTable"},Um=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),Pm=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),Im=[Pm],Fm=Object(r["createElementVNode"])("h3",null,"Triggers",-1),Hm={class:"entityTable"},Gm=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),$m={key:0},Rm=Object(r["createElementVNode"])("td",{colspan:"4"},"No trigger",-1),qm=[Rm],zm={key:1},Wm=Object(r["createElementVNode"])("h3",null,"Pushed data by this event",-1),Xm={class:"entityTable"},Km={style:{"word-break":"break-all"}},Jm=Object(r["createElementVNode"])("br",null,null,-1),Ym=Object(r["createElementVNode"])("h3",null,"Content after this event",-1),Zm={class:"entityTable"},Qm={style:{"word-break":"break-all"}},ep={class:"entityTable"},tp=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Value")])],-1),np={key:0},ap=Object(r["createElementVNode"])("td",{colspan:"3"},"No variables",-1),ip=[ap],rp={style:{"word-break":"break-all"}},op={class:"entityTable"},lp=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Time"),Object(r["createElementVNode"])("th",null,"Message")])],-1),cp={style:{"word-break":"break-all"}},sp=Object(r["createElementVNode"])("br",null,null,-1);function dp(e,t,n,a,i,o){var l,c,s,d,u,g,b,m,p,h;return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createElementVNode"])("nav",null,[Object(r["createElementVNode"])("div",rm,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",null,[Object(r["renderSlot"])(e.$slots,"logo")]),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"tags"===e.contentTab||!e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[0]||(t[0]=function(t){return e.contentTab="tags"})},"Tags")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"triggers"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[1]||(t[1]=function(t){return e.contentTab="triggers"})},"Triggers")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"variables"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[2]||(t[2]=function(t){return e.contentTab="variables"})},"Variables")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"dataLayer"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[3]||(t[3]=function(t){return e.contentTab="dataLayer"})},"Data Layer")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"logs"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.contentTab="logs"})},"Logs")],2),Object(r["createElementVNode"])("li",om,[Object(r["createElementVNode"])("a",{id:"mtmCloseDebug",onClick:t[5]||(t[5]=function(t){return e.mtmCloseDebugWindow()})},cm)]),Object(r["createElementVNode"])("li",sm,[Object(r["createElementVNode"])("a",{id:"mtmUpdateDebugPosition",onClick:t[6]||(t[6]=function(t){return e.mtmUpdateDebugPosition()})},Object(r["toDisplayString"])(e.positionText),1)])])])]),dm,um,Object(r["createElementVNode"])("div",gm,["logs"!==e.contentTab?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",bm,[Object(r["createElementVNode"])("ul",mm,[Object(r["createElementVNode"])("li",pm,[Object(r["createElementVNode"])("span",hm,[fm,e.mtmEvents.length>0?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",vm,[jm,Om,Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"checkbox",class:"onlyFiredTags-chk",name:"onlyfiredTags",id:"onlyfiredTags",value:"1","onUpdate:modelValue":t[7]||(t[7]=function(t){return e.onlyfiredTags=t}),style:{"margin-right":"3.5px"}},null,512),[[r["vModelCheckbox"],e.onlyfiredTags]]),Tm])):Object(r["createCommentVNode"])("",!0)])]),0===e.mtmEvents.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",ym,"No event executed")):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmEventsReversed,(function(t,n){var a,i;return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["menuTab",{active:n===e.selectedEventIndex}]),role:"menuitem",key:n},[(t.tags||[]).length||!e.onlyfiredTags?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,class:"item",onClick:function(n){return e.selectEvent(t.index0)},title:"Time: ".concat(t.time,". Trigger: ").concat(null===(a=t.metTrigger)||void 0===a?void 0:a.name)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.index)+": "+Object(r["toDisplayString"])(t.name)+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Cm,Em,512),[[r["vShow"],null===(i=t.tags)||void 0===i?void 0:i.length]])],8,Vm)):Object(r["createCommentVNode"])("",!0)],2)})),128))])])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",Sm,[Object(r["createElementVNode"])("div",wm,[Object(r["withDirectives"])(Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.homeTabTitle),513),[[r["vShow"],"logs"!==e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[km,Object(r["createElementVNode"])("table",Mm,[_m,Object(r["createElementVNode"])("tbody",null,[null!==(l=e.selectedEvent)&&void 0!==l&&null!==(c=l.tags)&&void 0!==c&&c.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Dm,xm)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(s=e.selectedEvent)||void 0===s?void 0:s.tags)||[],(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.action),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.numExecuted),1)])})),128))])]),Bm,Object(r["createElementVNode"])("table",Lm,[Um,Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,Im,512),[[r["vShow"],0===e.notFiredTags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.notFiredTags,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1)])})),128))])])],512),[[r["vShow"],"tags"===e.contentTab||!e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Fm,Object(r["createElementVNode"])("table",Hm,[Gm,Object(r["createElementVNode"])("tbody",null,[null!==(d=e.selectedEvent)&&void 0!==d&&d.metTrigger?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",$m,qm)),null!==(u=e.selectedEvent)&&void 0!==u&&u.metTrigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",zm,[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.type),1)])):Object(r["createCommentVNode"])("",!0)])])],512),[[r["vShow"],"triggers"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Wm,Object(r["createElementVNode"])("table",Xm,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Km,Object(r["toDisplayString"])(e.selectedEventData),1)])])]),Jm,Ym,Object(r["createElementVNode"])("table",Zm,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Qm,Object(r["toDisplayString"])(e.selectedEventContainerDataLayer),1)])])])],512),[[r["vShow"],"dataLayer"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",ep,[tp,Object(r["createElementVNode"])("tbody",null,[null!==(g=e.selectedEvent)&&void 0!==g&&null!==(b=g.container)&&void 0!==b&&null!==(m=b.variables)&&void 0!==m&&m.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",np,ip)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(p=e.selectedEvent)||void 0===p||null===(h=p.container)||void 0===h?void 0:h.variables)||[],(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.type),1),Object(r["createElementVNode"])("td",rp,Object(r["toDisplayString"])(e.stringifySelectedVariable(t)),1)])})),128))])])],512),[[r["vShow"],"variables"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",op,[lp,Object(r["createElementVNode"])("tbody",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmLogs,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.time),1),Object(r["createElementVNode"])("td",cp,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.messages,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:t},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e),1),sp])})),128))])])})),128))])])],512),[[r["vShow"],"logs"===e.contentTab]])])])])])}function up(e){return pp(e)||mp(e)||bp(e)||gp()}function gp(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bp(e,t){if(e){if("string"===typeof e)return hp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hp(e,t):void 0}}function mp(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function pp(e){if(Array.isArray(e))return hp(e)}function hp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function fp(e){return fp="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fp(e)}window.mtmDbgData=Object(r["reactive"])({mtmEvents:(null===(nm=window.mtmDbgData)||void 0===nm?void 0:nm.mtmEvents)||[],mtmLogs:(null===(am=window.mtmDbgData)||void 0===am?void 0:am.mtmLogs)||[]});var vp="mtmPreviewPosition",jp="Stick to Top",Op="Stick to Bottom";function Tp(){var e=new WeakSet;function t(t,n){if("object"===fp(n)&&null!==n){if(e.has(n))return"";e.add(n)}return n}return t}var yp=Object(r["defineComponent"])({data:function(){return{contentTab:"tags",selectedEventIndex:0,onlyfiredTags:!1,positionText:"top"===Object(u["getCookie"])(vp)?Op:jp}},methods:{mtmUpdateDebugPosition:function(){var e=6048e5,t=Object(u["getCookie"])(vp),n="top"===t?"bottom":"top";Object(u["setCookie"])(vp,n,e);var a=window.parent.document.getElementById("mtmDebugFrame");"top"===n?(this.positionText=Op,a.classList.remove("mtmStickyBottom"),a.classList.add("mtmStickyTop")):(this.positionText=jp,a.classList.remove("mtmStickyTop"),a.classList.add("mtmStickyBottom"))},mtmCloseDebugWindow:function(){var e=window.parent.document.getElementById("mtmDebugFrame");e&&(e.style.display="none")},selectEvent:function(e){this.mtmEvents[e]&&(this.selectedEventIndex=e)},stringifySelectedVariable:function(e){return JSON.stringify(e.value,Tp())}},computed:{homeTabTitle:function(){var e;if(null===(e=this.selectedEvent)||void 0===e||!e.container)return"";var t=this.selectedEvent.container.versionName||"Draft version",n=this.selectedEvent.container.id,a=this.selectedEventIndex+1;return"Event ".concat(a,": ").concat(this.selectedEvent.name," (").concat(n," - ").concat(t,")")},notFiredTags:function(){var e;if(null===(e=this.selectedEvent)||void 0===e||!e.container)return[];var t=this.selectedEventIndex,n=[];this.mtmEvents.forEach((function(e,a){a>t||n.push.apply(n,up(e.tags.map((function(e){return e.name}))))}));var a=[];return this.selectedEvent.container.tags.forEach((function(e){-1===n.indexOf(e.name)&&a.push(e)})),a},selectedEvent:function(){return this.mtmEvents[this.selectedEventIndex]},mtmEvents:function(){return window.mtmDbgData.mtmEvents},mtmEventsReversed:function(){var e=up(this.mtmEvents);return e.reverse(),e},mtmLogs:function(){return window.mtmDbgData.mtmLogs},selectedEventData:function(){var e;return(null===(e=this.selectedEvent)||void 0===e?void 0:e.eventData)&&JSON.stringify(this.selectedEvent.eventData,Tp())},selectedEventContainerDataLayer:function(){var e,t;return(null===(e=this.selectedEvent)||void 0===e||null===(t=e.container)||void 0===t?void 0:t.dataLayer)&&JSON.stringify(this.selectedEvent.container.dataLayer,Tp())}}});yp.render=dp;var Vp=yp,Cp={class:"copyMtmObjectDialog"},Np=["innerHTML"],Ep=["innerHTML"];function Sp(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveDirective"])("form");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cp,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.getCopyDialogTitle),1),Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.getCopyDescription)+"  ",1),Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.getLearnMoreLink),class:"learnMore"},null,8,Np)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"site",name:"destinationSite",title:e.translate("TagManager_ChooseWebsite"),modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t})},null,8,["title","modelValue"]),"container"!==e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createBlock"])(l,{key:0,uicontrol:"select",name:"idDestinationContainer",options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container"),modelValue:e.idDestinationContainer,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.idDestinationContainer=t})},null,8,["options","disabled","title","modelValue"])):Object(r["createCommentVNode"])("",!0),"container"===e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:1,class:"copyNote",innerHTML:e.$sanitize(e.getCopyContainerNote)},null,8,Ep)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("button",{class:"btn",onClick:t[2]||(t[2]=function(){return e.performCopy&&e.performCopy.apply(e,arguments)})},Object(r["toDisplayString"])(e.translate("General_Copy")),1)],512),[[c]])])}var wp=Object(r["defineComponent"])({props:{defaultSite:{type:Object,required:!0},copyType:{type:String,required:!0},copyNonce:{type:String,required:!1,default:""},idToCopy:{type:[String,Number],required:!0},idSourceContainer:{type:String,required:!1,default:""},idContainerVersion:{type:Number,required:!1,default:0}},directives:{Form:g["Form"]},components:{Field:g["Field"]},data:function(){return{site:this.defaultSite,idDestinationContainer:"",containerOptions:[]}},created:function(){this.onSiteChange(),this.idDestinationContainer=this.idSourceContainer},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;"container"!==this.copyType.toLowerCase()&&(this.containerOptions=[],this.idDestinationContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idDestinationContainer="",void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idDestinationContainer||(t.idDestinationContainer=e.idcontainer),t.containerOptions.push({key:e.idcontainer,value:e.name})}))})))},performCopy:function(){var e,t=this,n={module:"TagManager",action:"",idSite:this.defaultSite.id,idDestinationSite:null!==(e=this.site)&&void 0!==e&&e.id?this.site.id:0,nonce:this.copyNonce,idDestinationContainer:"",idSourceContainer:"",idContainerVersion:0,idContainer:0,idTag:0,idTrigger:0,idVariable:0};switch(this.copyType.toLowerCase()){case"container":n.action="copyContainer",n.idContainer=this.idToCopy;break;case"tag":n.action="copyTag",n.idTag=this.idToCopy;break;case"trigger":n.action="copyTrigger",n.idTrigger=this.idToCopy;break;case"variable":n.action="copyVariable",n.idVariable=this.idToCopy;break;default:throw Error("Unrecognised copy object type.")}this.idDestinationContainer&&(n.idDestinationContainer=this.idDestinationContainer),this.idSourceContainer&&(n.idSourceContainer=this.idSourceContainer),this.idContainerVersion>0&&(n.idContainerVersion=this.idContainerVersion),u["AjaxHelper"].fetch(n).then((function(e){if(!e||!e.isSuccess||!e.urlToNewCopy){var n=Object(u["translate"])("General_ErrorRequest","",""),a=u["NotificationsStore"].show({message:n,id:"CopyDialogResultNotification",context:"error",type:"transient"});return u["NotificationsStore"].scrollToNotification(a),void window.Piwik_Popover.close()}t.reloadEntityStore(),t.displaySuccessNotification(e.urlToNewCopy),window.Piwik_Popover.close()}))},reloadEntityStore:function(){switch(this.copyType.toLowerCase()){case"container":gd.reload();break;case"tag":po.reload(this.idSourceContainer,this.idContainerVersion);break;case"trigger":Va.reload(this.idSourceContainer,this.idContainerVersion);break;case"variable":vt.reload(this.idSourceContainer,this.idContainerVersion);break;default:throw Error("Unrecognised copy object type.")}},displaySuccessNotification:function(e){var t="TagManager_CopyXSuccess",n="";switch(this.copyType.toLowerCase()){case"container":n="TagManager_ContainerLowercase";break;case"tag":n="TagManager_TagLowercase";break;case"trigger":n="TagManager_TriggerLowercase";break;case"variable":n="TagManager_VariableLowercase";break;default:throw Error("Unrecognised copy object type.")}var a=Object(u["translate"])(t,['<a href="'.concat(e,'">'),Object(u["translate"])(n),"</a>"]),i=u["NotificationsStore"].show({message:a,id:"CopyDialogResultNotification",context:"success",type:"transient"});u["NotificationsStore"].scrollToNotification(i)}},computed:{getCopyDialogTitle:function(){var e="";switch(this.copyType.toLowerCase()){case"container":e=Object(u["translate"])("TagManager_Container");break;case"tag":e=Object(u["translate"])("TagManager_Tag");break;case"trigger":e=Object(u["translate"])("TagManager_Trigger");break;case"variable":e=Object(u["translate"])("TagManager_Variable");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyX",e)},getCopyDescription:function(){if("container"===this.copyType.toLowerCase())return Object(u["translate"])("TagManager_CopyContainerDescription");var e="";switch(this.copyType.toLowerCase()){case"tag":e=Object(u["translate"])("TagManager_TagLowercase");break;case"trigger":e=Object(u["translate"])("TagManager_TriggerLowercase");break;case"variable":e=Object(u["translate"])("TagManager_VariableLowercase");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyXDescription",e)},getCopyContainerNote:function(){return Object(u["translate"])("TagManager_CopyContainerNote","<strong>","</strong>")},getCopyUrl:function(){var e,t={module:"TagManager",action:"",idSite:this.defaultSite.id,idDestinationSite:null!==(e=this.site)&&void 0!==e&&e.id?this.site.id:0,nonce:this.copyNonce,idDestinationContainer:"",idSourceContainer:"",idContainerVersion:0,idContainer:0,idTag:0,idTrigger:0,idVariable:0};switch(this.copyType.toLowerCase()){case"container":t.action="copyContainer",t.idContainer=this.idToCopy;break;case"tag":t.action="copyTag",t.idTag=this.idToCopy;break;case"trigger":t.action="copyTrigger",t.idTrigger=this.idToCopy;break;case"variable":t.action="copyVariable",t.idVariable=this.idToCopy;break;default:throw Error("Unrecognised copy object type.")}return this.idDestinationContainer&&(t.idDestinationContainer=this.idDestinationContainer),this.idSourceContainer&&(t.idSourceContainer=this.idSourceContainer),this.idContainerVersion>0&&(t.idContainerVersion=this.idContainerVersion),"?".concat(u["MatomoUrl"].stringify(t))},getLearnMoreLink:function(){var e="";switch(this.copyType.toLowerCase()){case"container":e="https://matomo.org/faq/tag-manager/how-to-copy-a-matomo-tag-manager-container-and-its-components";break;case"tag":e="https://matomo.org/faq/tag-manager/how-to-copy-a-tag-in-matomo-tag-manager ";break;case"trigger":e="https://matomo.org/faq/tag-manager/how-to-copy-a-trigger-in-matomo-tag-manager";break;case"variable":e="https://matomo.org/faq/tag-manager/how-to-copy-a-variable-in-matomo-tag-manager";break;default:throw Error("Unrecognised copy object type.")}var t=Object(u["externalLink"])(e);return Object(u["translate"])("TagManager_LearnMoreFullStop",t,"</a>")}}});wp.render=Sp;var kp=wp;
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */}})}));
//# 
(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["AbTesting"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["AbTesting"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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/AbTesting/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,"toLocalTime",(function(){return a})),n.d(t,"TargetTest",(function(){return m})),n.d(t,"ExperimentUrlTarget",(function(){return A})),n.d(t,"ExperimentsStore",(function(){return P})),n.d(t,"ExperimentEdit",(function(){return zi})),n.d(t,"ExperimentsList",(function(){return Ca})),n.d(t,"ExperimentsManage",(function(){return Ba})),n.d(t,"checkForActiveExperiments",(function(){return Ha})),n.d(t,"ExperimentPageLink",(function(){return qa})),n.d(t,"Summary",(function(){return mo})),n.d(t,"SummaryPage",(function(){return wo})),"undefined"!==typeof window){var r=window.document.currentScript,i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */
function a(e,t){if(e){var n=e;if(n){n="".concat(n).replace(/-/g,"/");try{var r=new Date("".concat(n," UTC"));return t?r.toLocaleString():r}catch(u){try{var i=new Date(Date.parse("".concat(n," UTC")));return t?i.toLocaleString():i}catch(m){var a=n.substr(0,10),o=n.substr(11),l=a.split("/"),c=o.split(":");if(3===l.length&&3===c.length){var s=new Date(parseInt(l[0],10),parseInt(l[1],10)-1,parseInt(l[2],10),parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)),d=s.getTime()+6e4*s.getTimezoneOffset();return s=new Date(d),t?s.toLocaleString():s}}}}return t?"":void 0}}var o=n("8bbf"),l={class:"form-group targetTest"};function c(e,t,n,r,i,a){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",l,[Object(o["createElementVNode"])("label",null,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_TargetPageTestTitle"))+":",1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TargetPageTestLabel")),1)]),Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",id:"urltargettest",placeholder:"http://www.example.com/","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.url=t}),class:Object(o["normalizeClass"])({invalid:e.url&&!e.matches&&e.isValid})},null,2),[[o["vModelText"],e.url]]),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"testInfo"},Object(o["toDisplayString"])(e.translate("AbTesting_TargetPageTestErrorInvalidUrl")),513),[[o["vShow"],e.url&&!e.isValid]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"testInfo matches"},Object(o["toDisplayString"])(e.translate("AbTesting_TargetPageTestUrlMatches")),513),[[o["vShow"],e.url&&e.matches&&e.isValid]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"testInfo notMatches"},Object(o["toDisplayString"])(e.translate("AbTesting_TargetPageTestUrlNotMatches")),513),[[o["vShow"],e.url&&!e.matches&&e.isValid]])])])}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */function s(e){try{return new URL(e),!0}catch(t){return!1}}function d(e){return(e||[]).filter((function(e){return e&&e.value}))}var u=Object(o["defineComponent"])({props:{includedTargets:Array,excludedTargets:Array},data:function(){return{url:"",matches:!1,isLoadingTestMatchPage:!1}},watch:{isValid:function(e){e||(this.matches=!1)},includedTargets:function(){this.runTest()},excludedTargets:function(){this.runTest()},url:function(){this.runTest()}},methods:{runTest:function(){if(this.isValid){var e=window.piwikAbTestingTarget.location;window.piwikAbTestingTarget.location=new URL(this.targetUrl);var t=d(this.includedTargets),n=d(this.excludedTargets);this.matches=window.piwikAbTestingTarget.matchesTargets(t,n),window.piwikAbTestingTarget.location=e}}},computed:{targetUrl:function(){return(this.url||"").trim()},isValid:function(){return this.targetUrl&&s(this.targetUrl)}}});u.render=c;var m=u,p={style:{width:"100%"}},b={name:"targetAttribute"},f={name:"targetType"},v={name:"targetValue"},g={name:"targetValue2"},O=["title"],j=["title"];function h(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["form-group urltarget valign-wrapper",{disabled:e.disableIfNoValue&&!e.modelValue.value}])},[Object(o["createElementVNode"])("div",p,[Object(o["createElementVNode"])("div",b,[Object(o["createVNode"])(l,{uicontrol:"select",name:"targetAttribute","model-value":e.modelValue.attribute,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{attribute:t}))}),title:e.translate("AbTesting_Rule"),options:e.targetAttributes,"full-width":!0},null,8,["model-value","title","options"])]),Object(o["createElementVNode"])("div",f,[Object(o["createVNode"])(l,{uicontrol:"select",name:"targetType","model-value":e.pattern_type,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.onTypeChange(t)}),options:e.targetOptions[e.modelValue.attribute],"full-width":!0},null,8,["model-value","options"])]),Object(o["createElementVNode"])("div",v,[Object(o["withDirectives"])(Object(o["createVNode"])(l,{uicontrol:"text",name:"targetValue",placeholder:"eg. ".concat(e.targetExamples[e.modelValue.attribute]),"model-value":e.modelValue.value,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value:t.trim()}))}),"full-width":!0},null,8,["placeholder","model-value"]),[[o["vShow"],"any"!==e.pattern_type]])]),Object(o["createElementVNode"])("div",g,[Object(o["withDirectives"])(Object(o["createVNode"])(l,{uicontrol:"text",name:"targetValue2","model-value":e.modelValue.value2,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value2:t.trim()}))}),"full-width":!0,placeholder:e.translate("AbTesting_UrlParameterValueToMatchPlaceholder")},null,8,["model-value","placeholder"]),[[o["vShow"],"urlparam"===e.modelValue.attribute&&e.pattern_type&&"exists"!==e.pattern_type&&"not_exists"!==e.pattern_type]])])]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"icon-plus valign",title:e.translate("General_Add"),onClick:t[4]||(t[4]=function(t){return e.$emit("addUrl")})},null,8,O),[[o["vShow"],e.showAddUrl]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"icon-minus valign",title:e.translate("General_Remove"),onClick:t[5]||(t[5]=function(t){return e.$emit("removeUrl")})},null,8,j),[[o["vShow"],e.canBeRemoved]])],2)}var E=n("19dc"),y=n("a5a2");function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function T(e,t,n){return t&&V(e.prototype,t),n&&V(e,n),e}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var S=function(){function e(){var t=this;x(this,e),N(this,"privateState",Object(o["reactive"])({attributes:[]})),N(this,"state",Object(o["computed"])((function(){return Object(o["readonly"])(t.privateState)}))),N(this,"attributes",Object(o["computed"])((function(){return t.state.value.attributes}))),N(this,"initPromise",null)}return T(e,[{key:"init",value:function(){var e=this;return this.initPromise||(this.initPromise=E["AjaxHelper"].fetch({method:"AbTesting.getAvailableTargetAttributes",filter_limit:"-1"}).then((function(t){return e.privateState.attributes=t,e.attributes.value}))),this.initPromise}}]),e}(),_=new S,w=Object(o["defineComponent"])({props:{modelValue:{type:Object,required:!0},canBeRemoved:Boolean,disableIfNoValue:Boolean,allowAny:Boolean,showAddUrl:Boolean},components:{Field:y["Field"]},created:function(){_.init()},emits:["addUrl","removeUrl","update:modelValue"],watch:{modelValue:function(e){var t=this;if(e.attribute){var n=this.targetOptions[e.attribute],r=n.find((function(e){return e.key===t.pattern_type}));!r&&n[0]&&this.onTypeChange(n[0].key)}}},methods:{onTypeChange:function(e){var t=0,n=e;0===e.indexOf("not_")&&(n=e.substring("not_".length),t=1),this.$emit("update:modelValue",Object.assign(Object.assign({},this.modelValue),{},{type:n,inverted:t}))}},computed:{pattern_type:function(){var e=this.modelValue.type;return this.modelValue.inverted&&"0"!==this.modelValue.inverted&&(e="not_".concat(this.modelValue.type)),e},targetAttributes:function(){return _.attributes.value.map((function(e){return{key:e.value,value:e.name}}))},targetOptions:function(){var e=this,t={};return _.attributes.value.forEach((function(n){t[n.value]=[],e.allowAny&&"url"===n.value&&t[n.value].push({value:Object(E["translate"])("AbTesting_TargetTypeIsAny"),key:"any"}),n.types.forEach((function(e){t[n.value].push({value:e.name,key:e.value}),t[n.value].push({value:Object(E["translate"])("AbTesting_TargetTypeIsNot",e.name),key:"not_".concat(e.value)})}))})),t},targetExamples:function(){var e={};return _.attributes.value.forEach((function(t){e[t.value]=t.example})),e}}});w.render=h;var A=w;function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function C(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),e}function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var M=function(){function e(){var t=this;D(this,e),U(this,"privateState",Object(o["reactive"])({experiments:[],isLoading:!1,isUpdating:!1,filterStatus:""})),U(this,"state",Object(o["computed"])((function(){return Object(o["readonly"])(t.privateState)}))),U(this,"fetchPromise",{})}return C(e,[{key:"reload",value:function(){return this.privateState.experiments=[],this.fetchPromise={},this.fetchExperiments()}},{key:"fetchExperiments",value:function(){var e=this,t=this.privateState.filterStatus?"AbTesting.getExperimentsByStatuses":"AbTesting.getActiveExperiments",n=this.privateState.filterStatus||void 0,r="".concat(t).concat(n||"");return this.fetchPromise[r]||(this.fetchPromise[r]=E["AjaxHelper"].fetch({method:t,filter_limit:"-1",statuses:n})),this.privateState.isLoading=!0,this.privateState.experiments=[],this.fetchPromise[r].then((function(t){return e.privateState.experiments=t,e.state.value.experiments})).finally((function(){e.privateState.isLoading=!1}))}},{key:"fetchAvailableSuccessMetrics",value:function(){return E["AjaxHelper"].fetch({method:"AbTesting.getAvailableSuccessMetrics",filter_limit:"-1"})}},{key:"fetchAvailableStatuses",value:function(){return E["AjaxHelper"].fetch({method:"AbTesting.getAvailableStatuses",filter_limit:"-1"})}},{key:"fetchJsExperimentTemplate",value:function(e){return E["AjaxHelper"].fetch({method:"AbTesting.getJsExperimentTemplate",idExperiment:e})}},{key:"fetchJsIncludeTemplate",value:function(){return E["AjaxHelper"].fetch({method:"AbTesting.getJsIncludeTemplate"})}},{key:"findExperiment",value:function(e){var t=this,n=this.state.value.experiments.find((function(t){return"".concat(t.idexperiment)==="".concat(e)}));return n?Promise.resolve(n):(this.privateState.isLoading=!0,E["AjaxHelper"].fetch({idExperiment:e,method:"AbTesting.getExperiment"}).finally((function(){t.privateState.isLoading=!1})))}},{key:"deleteExperiment",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.experiments=[],E["AjaxHelper"].fetch({idExperiment:e,method:"AbTesting.deleteExperiment"},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"archiveExperiment",value:function(e){var t=this;return this.privateState.isUpdating=!0,E["AjaxHelper"].fetch({idExperiment:e,method:"AbTesting.archiveExperiment"}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createOrUpdateExperiment",value:function(e,t){var n=this,r=(e.variations||[]).filter((function(e){return null===e||void 0===e?void 0:e.name}));return e.original_redirect_url&&r.push({name:"original",redirect_url:e.original_redirect_url}),this.privateState.isUpdating=!0,E["AjaxHelper"].post({method:t,name:e.name.trim(),description:e.description.trim(),hypothesis:e.hypothesis.trim(),idExperiment:e.idexperiment,confidenceThreshold:e.confidence_threshold,startDate:e.start_date,endDate:e.end_date,percentageParticipants:e.percentage_participants,mdeRelative:e.mde_relative,forwardUtmParams:e.forward_utm_params,forwardAllQueryParams:e.forward_all_query_params},{successMetrics:(e.success_metrics||[]).filter((function(e){return null===e||void 0===e?void 0:e.metric})),includedTargets:(e.included_targets||[]).filter((function(e){return e&&(e.value||"any"===e.type)})),excludedTargets:(e.excluded_targets||[]).filter((function(e){return null===e||void 0===e?void 0:e.value})),variations:r},{withTokenInUrl:!0}).then((function(e){return{type:"success",response:e}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){n.privateState.isUpdating=!1}))}},{key:"finishExperiment",value:function(e){var t=this;return this.privateState.isUpdating=!0,E["AjaxHelper"].fetch({idExperiment:e,method:"AbTesting.finishExperiment"},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"setFilterStatus",value:function(e){this.privateState.filterStatus=e}}]),e}(),P=new M,B={class:"loadingPiwik"},I=Object(o["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),F={class:"loadingPiwik"},H=Object(o["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),L={class:"alert alert-warning"},R={class:"alert alert-warning"},$=Object(o["createElementVNode"])("br",null,null,-1),q={class:"optionsUnconfirmedEditExperiment"},z={class:"actionViewReport"},G=["href"],K=Object(o["createElementVNode"])("span",{class:"icon-show"},null,-1),Q={class:"actionFinishExperiment"},J=Object(o["createElementVNode"])("span",{class:"abtestingicon-stop"},null,-1),Y={class:"actionEditAnyway"},W=Object(o["createElementVNode"])("span",{class:"icon-edit"},null,-1),Z={class:"actionCancel"},X=["innerHTML"],ee={class:"alert alert-warning"},te={key:0},ne={class:"row"},re={class:"col m2 entityList"},ie={class:"listCircle"},ae=Object(o["createElementVNode"])("br",null,null,-1),oe=Object(o["createElementVNode"])("br",null,null,-1),le=Object(o["createElementVNode"])("br",null,null,-1),ce=Object(o["createElementVNode"])("br",null,null,-1),se=["disabled","value"],de={class:"entityCancel"},ue=["innerHTML"],me={class:"entityCancel"},pe={class:"row"},be={class:"col-md-12"},fe={class:"ui-confirm",ref:"confirmUpdateStartExperiment"},ve=["value"],ge=["value"],Oe={class:"ui-confirm",ref:"confirmFinishExperiment"},je=["value"],he=["value"],Ee={class:"ui-confirm",ref:"updateExperimentNeededToEmbed"},ye=["value"];function xe(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("Basic"),c=Object(o["resolveComponent"])("Metrics"),s=Object(o["resolveComponent"])("Conditions"),d=Object(o["resolveComponent"])("Traffic"),u=Object(o["resolveComponent"])("Targets"),m=Object(o["resolveComponent"])("Redirects"),p=Object(o["resolveComponent"])("Schedule"),b=Object(o["resolveComponent"])("Embed"),f=Object(o["resolveComponent"])("ContentBlock");return Object(o["openBlock"])(),Object(o["createBlock"])(f,{class:"editExperiment","content-title":e.contentTitle},{default:Object(o["withCtx"])((function(){var n,r,i,a;return[Object(o["withDirectives"])(Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_FormCreateExperimentIntro")),513),[[o["vShow"],e.create]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("p",null,[Object(o["createElementVNode"])("span",B,[I,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[o["vShow"],e.isLoading]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("p",null,[Object(o["createElementVNode"])("span",F,[H,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_UpdatingData")),1)])],512),[[o["vShow"],e.isUpdating]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",L,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentRunningInfo1"))+" "+Object(o["toDisplayString"])(e.experiment.start_date)+" (UTC)",1),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(" ".concat(e.translate("AbTesting_ExperimentRunningInfo2")))+" "+Object(o["toDisplayString"])(e.experiment.end_date)+" (UTC)",513),[[o["vShow"],e.experiment.end_date]]),Object(o["createTextVNode"])(". "+Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentRunningInfo3")),1)],512),[[o["vShow"],e.edit&&"running"===e.experiment.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",R,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentFinishedInfo1"))+" ",1),$,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentFinishedInfo2")),1)],512),[[o["vShow"],e.edit&&"finished"===e.experiment.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"alert alert-warning"},Object(o["toDisplayString"])(e.translate("AbTesting_ErrorExperimentCannotBeUpdatedBecauseArchived")),513),[[o["vShow"],e.edit&&"archived"===e.experiment.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_RelatedActions"))+": ",1),Object(o["createElementVNode"])("ul",q,[Object(o["createElementVNode"])("li",z,[Object(o["createElementVNode"])("a",{target:"_blank",href:e.viewReportLink},[K,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_ActionViewReport")),1)],8,G)]),Object(o["createElementVNode"])("li",Q,[Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{onClick:t[0]||(t[0]=Object(o["withModifiers"])((function(t){return e.finishExperiment()}),["prevent"]))},[J,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_ActionFinishExperiment")),1)],512),[[o["vShow"],"running"===e.experiment.status]])]),Object(o["createElementVNode"])("li",Y,[Object(o["createElementVNode"])("a",{onClick:t[1]||(t[1]=Object(o["withModifiers"])((function(t){return e.confirmedEdit=!0}),["prevent"]))},[W,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_ActionEditExperimentAnyway")),1)])]),Object(o["createElementVNode"])("li",Z,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("General_OrCancel",'<a class="cancelLink">',"</a>")),onClick:t[2]||(t[2]=function(t){return e.onCancel(t)})},null,8,X)])])],512),[[o["vShow"],e.edit&&e.experiment.status&&!e.confirmedEdit]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",ee,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentCreatedInfo1"))+" "+Object(o["toDisplayString"])(e.experiment.start_date),1),e.experiment.end_date?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",te,Object(o["toDisplayString"])(" ".concat(e.translate("AbTesting_ExperimentCreatedInfo2")))+" "+Object(o["toDisplayString"])(e.experiment.end_date),1)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(". "+Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentCreatedInfo3")),1)],512),[[o["vShow"],e.confirmedEdit&&"created"===e.experiment.status&&e.experiment.start_date]]),Object(o["createElementVNode"])("form",{onSubmit:t[22]||(t[22]=Object(o["withModifiers"])((function(t){return e.confirmedEdit?e.updateExperiment():e.createExperiment()}),["prevent"]))},[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",ne,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",re,[Object(o["createElementVNode"])("ul",ie,[Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuDefinition",{active:"basic"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[3]||(t[3]=Object(o["withModifiers"])((function(t){return e.action="basic"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_Definition")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuSuccessMetric",{active:"metrics"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[4]||(t[4]=Object(o["withModifiers"])((function(t){return e.action="metrics"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_SuccessMetrics")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuSuccessConditions",{active:"conditions"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[5]||(t[5]=Object(o["withModifiers"])((function(t){return e.action="conditions"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_SuccessConditions")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuTargets",{active:"targets"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[6]||(t[6]=Object(o["withModifiers"])((function(t){return e.action="targets"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_TargetPages")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuTraffic",{disabled:!(null!==(n=e.experiment.variations)&&void 0!==n&&null!==(r=n[0])&&void 0!==r&&r.name),active:"traffic"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[7]||(t[7]=Object(o["withModifiers"])((function(t){var n,r;return null!==(n=e.experiment.variations)&&void 0!==n&&null!==(r=n[0])&&void 0!==r&&r.name?e.action="traffic":""}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_TrafficAllocation")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuRedirects",{active:"redirects"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[8]||(t[8]=Object(o["withModifiers"])((function(t){return e.action="redirects"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_Redirects")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuSchedule",{active:"schedule"===e.action}])},[Object(o["createElementVNode"])("a",{href:"",onClick:t[9]||(t[9]=Object(o["withModifiers"])((function(t){return e.action="schedule"}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_Schedule")),1)],2),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])(["menuEmbed",{active:"embed"===e.action}])},[Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{href:"",onClick:t[10]||(t[10]=Object(o["withModifiers"])((function(t){return e.showEmbedAction()}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_EmbedCode")),513),[[o["vShow"],"archived"!==e.experiment.status]])],2)]),ae,oe,le,ce,Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("input",{class:"btn update",type:"submit",disabled:e.isUpdating||!e.isDirty,value:e.translate("CoreUpdater_UpdateTitle")},null,8,se),Object(o["createElementVNode"])("div",de,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("General_OrCancel",'<a class="cancelLink">',"</a>")),onClick:t[11]||(t[11]=function(t){return e.onCancel(t)})},null,8,ue)])],512),[[o["vShow"],"archived"!==e.experiment.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("div",me,[Object(o["createElementVNode"])("a",{class:"btn",onClick:t[12]||(t[12]=function(t){return e.cancel()})},Object(o["toDisplayString"])(e.translate("AbTesting_NavigationBack")),1)])],512),[[o["vShow"],"archived"===e.experiment.status]])],512),[[o["vShow"],e.confirmedEdit]]),Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])({"col m10 editExperimentArea":e.confirmedEdit,"col m12 createExperimentArea":e.create})},[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",pe,[Object(o["createElementVNode"])("div",be,["basic"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(l,{key:0,experiment:e.experiment,onUpdateProperty:t[13]||(t[13]=function(t){e.experiment[t.prop]=t.value,e.setValueHasChanged()}),create:e.create,"create-experiment-target-types":e.createExperimentTargetTypes,onCancel:t[14]||(t[14]=function(t){return e.cancel()}),onSave:t[15]||(t[15]=function(t){return e.confirmedEdit?e.updateExperiment():e.createExperiment()})},null,8,["experiment","create","create-experiment-target-types"])):Object(o["createCommentVNode"])("",!0),"metrics"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(c,{key:1,"model-value":e.experiment.success_metrics,"onUpdate:modelValue":t[16]||(t[16]=function(t){e.experiment=Object.assign(Object.assign({},e.experiment),{},{success_metrics:t}),e.setValueHasChanged()}),"experiment-id-site":e.experiment.idsite,"success-metric-options":e.successMetricOptions},null,8,["model-value","experiment-id-site","success-metric-options"])):Object(o["createCommentVNode"])("",!0),"conditions"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(s,{key:2,experiment:e.experiment,onUpdateProperty:t[17]||(t[17]=function(t){e.experiment[t.prop]=t.value,e.setValueHasChanged()}),"confidence-threshold-options":e.confidenceThresholdOptions,"mde-relative-options":e.mdeRelativeOptions},null,8,["experiment","confidence-threshold-options","mde-relative-options"])):Object(o["createCommentVNode"])("",!0),"traffic"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(d,{key:3,experiment:e.experiment,onUpdateProperty:t[18]||(t[18]=function(t){e.experiment[t.prop]=t.value,e.setValueHasChanged()}),"percentage-participants-options":e.percentageParticipantsOptions},null,8,["experiment","percentage-participants-options"])):Object(o["createCommentVNode"])("",!0),Object(o["withDirectives"])(Object(o["createVNode"])(u,{experiment:e.experiment,onUpdateProperty:t[19]||(t[19]=function(t){e.experiment[t.prop]=t.value,e.setValueHasChanged()})},null,8,["experiment"]),[[o["vShow"],"targets"===e.action]]),"redirects"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(m,{key:4,"model-value":e.experiment.variations,"forward-utm-params":1===(null===(i=e.experiment)||void 0===i?void 0:i.forward_utm_params),"forward-all-query-params":1===(null===(a=e.experiment)||void 0===a?void 0:a.forward_all_query_params),"onUpdate:modelValue":t[20]||(t[20]=function(t){e.experiment.variations=t,e.setValueHasChanged()}),"onUpdate:forwardUtmParams":e.setForwardUtmParams,"onUpdate:forwardAllQueryParams":e.setForwardAllQueryParams},null,8,["model-value","forward-utm-params","forward-all-query-params","onUpdate:forwardUtmParams","onUpdate:forwardAllQueryParams"])):Object(o["createCommentVNode"])("",!0),"schedule"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(p,{key:5,experiment:e.experiment,onUpdateProperty:t[21]||(t[21]=function(t){e.experiment[t.prop]=t.value,e.setValueHasChanged()}),"utc-time":e.utcTime},null,8,["experiment","utc-time"])):Object(o["createCommentVNode"])("",!0),"embed"===e.action?(Object(o["openBlock"])(),Object(o["createBlock"])(b,{key:6,experiment:e.experiment,"js-experiment-template-code":e.jsTemplateCode,"js-include-template-code":e.jsIncludeTemplateCode},null,8,["experiment","js-experiment-template-code","js-include-template-code"])):Object(o["createCommentVNode"])("",!0)])],512),[[o["vShow"],!e.isLoading]])],2)],512),[[o["vShow"],!e.isLoading&&e.confirmedEdit||e.create]])],32),Object(o["createElementVNode"])("div",fe,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ConfirmUpdateStartsExperiment")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ve),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ge)],512),Object(o["createElementVNode"])("div",Oe,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ConfirmFinishExperiment")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,je),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,he)],512),Object(o["createElementVNode"])("div",Ee,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentRequiresUpdateBeforeViewEmbedCode")),1),Object(o["createElementVNode"])("input",{role:"ok",type:"button",value:e.translate("General_Ok")},null,8,ye)],512)]})),_:1},8,["content-title"])}function Ve(e){return _e(e)||Se(e)||Ne(e)||Te()}function Te(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ne(e,t){if(e){if("string"===typeof e)return we(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?we(e,t):void 0}}function Se(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _e(e){if(Array.isArray(e))return we(e)}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ae={class:"form-group"},De={name:"name"},ke={class:"form-group"},Ce={name:"hypothesis"},Ue={class:"inline-help-node"},Me=["innerHTML"],Pe={class:"form-group"},Be={name:"description"},Ie={class:"form-group row initalPageUrl"},Fe={class:"col s12 m6"},He={name:"newTargetType"},Le={name:"experimentUrl"},Re={class:"col s12 m6"},$e={class:"form-help"},qe={class:"inline-help"},ze={key:1,class:"entityCancel"},Ge=["innerHTML"];function Ke(e,t,n,r,i,a){var l,c,s,d,u,m,p,b,f,v,g,O,j=Object(o["resolveComponent"])("Field"),h=Object(o["resolveComponent"])("Variations"),E=Object(o["resolveComponent"])("SaveButton");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",Ae,[Object(o["createElementVNode"])("div",De,[Object(o["createVNode"])(j,{uicontrol:"text",name:"name",placeholder:"eg 'BuyNowButtonColor'","model-value":null===(l=e.experiment)||void 0===l?void 0:l.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("updateProperty",{prop:"name",value:t})}),title:e.translate("General_Name"),maxlength:50,"inline-help":e.translate("AbTesting_FieldExperimentNameHelp",50)},null,8,["model-value","title","inline-help"])])]),Object(o["createElementVNode"])("div",ke,[Object(o["createElementVNode"])("div",Ce,[Object(o["createVNode"])(j,{uicontrol:"textarea",name:"hypothesis","model-value":null===(c=e.experiment)||void 0===c?void 0:c.hypothesis,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.$emit("updateProperty",{prop:"hypothesis",value:t})}),title:e.translate("AbTesting_Hypothesis"),maxlength:1e3,rows:3,placeholder:e.translate("AbTesting_FieldHypothesisPlaceholder")},{"inline-help":Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("div",Ue,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.fieldHypothesisHelp)},null,8,Me)])]})),_:1},8,["model-value","title","placeholder"])])]),Object(o["createElementVNode"])("div",Pe,[Object(o["createElementVNode"])("div",Be,[Object(o["createVNode"])(j,{uicontrol:"textarea",name:"description","model-value":null===(s=e.experiment)||void 0===s?void 0:s.description,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.$emit("updateProperty",{prop:"description",value:t})}),title:e.translate("General_Description"),maxlength:1e3,rows:3,placeholder:e.translate("AbTesting_FieldDescriptionPlaceholder"),"inline-help":e.translate("AbTesting_FieldDescriptionHelp")},null,8,["model-value","title","placeholder","inline-help"])])]),Object(o["createVNode"])(h,{"model-value":null===(d=e.experiment)||void 0===d?void 0:d.variations,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.$emit("updateProperty",{prop:"variations",value:t})})},null,8,["model-value"]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",Ie,[Object(o["createElementVNode"])("div",Fe,[Object(o["createElementVNode"])("div",He,[Object(o["createVNode"])(j,{uicontrol:"select",name:"newTargetType",title:e.translate("AbTesting_TargetPages"),"model-value":null===(u=e.experiment)||void 0===u||null===(m=u.included_targets)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.type,"onUpdate:modelValue":t[4]||(t[4]=function(t){var n,r,i;return e.$emit("updateProperty",{prop:"included_targets",value:[Object.assign(Object.assign({},(null===(n=e.experiment)||void 0===n||null===(r=n.included_targets)||void 0===r?void 0:r[0])||{}),{},{type:t})].concat(Ve(((null===(i=e.experiment)||void 0===i?void 0:i.included_targets)||[]).slice(1)))})}),"full-width":!0,options:e.createExperimentTargetTypes},null,8,["title","model-value","options"])]),Object(o["createElementVNode"])("div",Le,["equals_simple"===(null===(b=e.experiment)||void 0===b||null===(f=b.included_targets)||void 0===f||null===(v=f[0])||void 0===v?void 0:v.type)?(Object(o["openBlock"])(),Object(o["createBlock"])(j,{key:0,uicontrol:"text",name:"experimentUrl",placeholder:e.experimentUrlPlaceholder,"model-value":null===(g=e.experiment)||void 0===g||null===(O=g.included_targets[0])||void 0===O?void 0:O.value,"onUpdate:modelValue":t[5]||(t[5]=function(t){var n,r,i;return e.$emit("updateProperty",{prop:"included_targets",value:[Object.assign(Object.assign({},(null===(n=e.experiment)||void 0===n||null===(r=n.included_targets)||void 0===r?void 0:r[0])||{}),{},{value:t})].concat(Ve(((null===(i=e.experiment)||void 0===i?void 0:i.included_targets)||[]).slice(1)))})}),"full-width":!0,maxlength:1e3},null,8,["placeholder","model-value"])):Object(o["createCommentVNode"])("",!0)])]),Object(o["createElementVNode"])("div",Re,[Object(o["createElementVNode"])("div",$e,[Object(o["createElementVNode"])("span",qe,Object(o["toDisplayString"])(e.translate("AbTesting_NewExperimentTargetPageHelp")),1)])])],512),[[o["vShow"],e.create]]),e.create?(Object(o["openBlock"])(),Object(o["createBlock"])(E,{key:0,class:"createButton",onConfirm:t[6]||(t[6]=function(t){return e.$emit("save")}),disabled:e.isUpdating,saving:e.isUpdating,value:e.translate("AbTesting_CreateNewExperiment")},null,8,["disabled","saving","value"])):Object(o["createCommentVNode"])("",!0),e.create?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ze,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("General_OrCancel",'<a class="cancelLink">',"</a>")),onClick:t[7]||(t[7]=function(t){return e.onCancel(t)})},null,8,Ge)])):Object(o["createCommentVNode"])("",!0)])}var Qe={class:"form-group row expVariationsEdit"},Je={class:"col s12 m6"},Ye={for:"variations"},We={class:"variation original"},Ze=["value"],Xe=["value","onKeydown","onChange","title"],et=["title"],tt=["title","onClick"],nt={class:"col s12 m6"},rt={class:"form-help"},it={class:"inline-help"};function at(e,t,n,r,i,a){var l=this;return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Qe,[Object(o["createElementVNode"])("div",Je,[Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("label",Ye,Object(o["toDisplayString"])(e.translate("AbTesting_Variations")),1),Object(o["createElementVNode"])("div",We,[Object(o["createElementVNode"])("input",{type:"text",class:"name disabled",disabled:"",value:e.translate("AbTesting_NameOriginalVariation")},null,8,Ze)]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.modelValue||[],(function(n,r){var i;return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:n.idvariation||l.tempIds.get(n),class:Object(o["normalizeClass"])("variation ".concat(r," multiple"))},[Object(o["createElementVNode"])("input",{type:"text",class:"control_text name",maxlength:"50",value:n.name,onKeydown:function(t){return e.onKeydownName(t,n,r)},onChange:function(t){return e.onKeydownName(t,n,r)},title:n.idvariation?"Variation ID ".concat(n.idvariation):""},null,40,Xe),Object(o["createElementVNode"])("span",{class:"icon-plus",title:e.translate("General_Add"),onClick:t[0]||(t[0]=function(t){return e.addVariation()})},null,8,et),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"icon-minus",title:e.translate("General_Remove"),onClick:function(t){return e.removeVariation(r)}},null,8,tt),[[o["vShow"],(null===(i=e.modelValue)||void 0===i?void 0:i.length)>1]])],2)})),128))])]),Object(o["createElementVNode"])("div",nt,[Object(o["createElementVNode"])("div",rt,[Object(o["createElementVNode"])("span",it,Object(o["toDisplayString"])(e.translate("AbTesting_FieldVariationsHelp")),1)])])])}function ot(e){return dt(e)||st(e)||ct(e)||lt()}function lt(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ct(e,t){if(e){if("string"===typeof e)return ut(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ut(e,t):void 0}}function st(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function dt(e){if(Array.isArray(e))return ut(e)}function ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mt(e,t){return!!e.find((function(e){return e.name===t}))}var pt=0,bt=Object(o["defineComponent"])({props:{modelValue:Array},emits:["update:modelValue"],data:function(){return{tempIds:new Map}},created:function(){this.onKeydownName=Object(E["debounce"])(this.onKeydownName.bind(this),50),null!==this.modelValue&&void 0!==this.modelValue||this.$emit("update:modelValue",[])},methods:{onKeydownName:function(e,t,n){var r=e.target.value;if(t.name!==r){var i=ot(this.modelValue||[]);i[n]=Object.assign(Object.assign({},t),{},{name:r}),this.$emit("update:modelValue",i)}},addVariation:function(){var e="Variation".concat((this.modelValue||[]).length+1);while(mt(this.modelValue||[],e)&&e.length<110)e+="_";var t={name:e,percentage:""};pt+=1,this.tempIds.set(t,"_".concat(pt)),this.$emit("update:modelValue",[].concat(ot(this.modelValue||[]),[t]))},removeVariation:function(e){var t=ot(this.modelValue||[]);t.splice(e,1),this.$emit("update:modelValue",t)}}});bt.render=at;var ft=bt,vt=Object(o["defineComponent"])({props:{experiment:{type:Object,required:!0},create:Boolean,createExperimentTargetTypes:Array},components:{Field:y["Field"],SaveButton:y["SaveButton"],Variations:ft},emits:["updateProperty","save","cancel"],methods:{onCancel:function(e){e.target.classList.contains("cancelLink")&&this.$emit("cancel")}},computed:{fieldHypothesisHelp:function(){return Object(E["translate"])("AbTesting_FieldHypothesisHelp","<strong>","</strong>","<strong>","</strong>","<strong>","</strong>")},experimentUrlPlaceholder:function(){return"eg 'http://www.example.com/".concat(Object(E["translate"])("AbTesting_FilesystemDirectory"),"'")},isUpdating:function(){return P.state.value.isUpdating}}});vt.render=Ke;var gt=vt;function Ot(e){return yt(e)||Et(e)||ht(e)||jt()}function jt(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ht(e,t){if(e){if("string"===typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xt(e,t):void 0}}function Et(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function yt(e){if(Array.isArray(e))return xt(e)}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vt={class:"form-group row"},Tt={class:"col s12 m6"},Nt={for:"variations"},St={class:"innerFormField",name:"metric"},_t=["title"],wt=["title","onClick"],At={class:"col s12 m6"},Dt={class:"form-help"},kt={class:"inline-help"},Ct=Object(o["createElementVNode"])("br",null,null,-1),Ut=Object(o["createElementVNode"])("br",null,null,-1),Mt=Object(o["createElementVNode"])("br",null,null,-1),Pt=Object(o["createElementVNode"])("br",null,null,-1),Bt=["href"];function It(e,t,n,r,i,a){var l=this,c=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",Vt,[Object(o["createElementVNode"])("div",Tt,[Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("label",Nt,Object(o["toDisplayString"])(e.translate("AbTesting_FieldSuccessMetricsLabel")),1),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.modelValue||[],(function(n,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])("successMetric successMetric".concat(r," multiple valign-wrapper")),key:r},[Object(o["createElementVNode"])("div",St,[Object(o["createVNode"])(c,{uicontrol:"select",name:"metric","model-value":n.metric,"onUpdate:modelValue":function(t){return e.setValue(r,t)},"full-width":!0,options:e.successMetricOptions},null,8,["model-value","onUpdate:modelValue","options"])]),Object(o["createElementVNode"])("span",{class:"icon-plus valign",title:e.translate("General_Add"),onClick:t[0]||(t[0]=function(t){return e.$emit("update:modelValue",[].concat(Ot(l.modelValue||[]),[{metric:""}]))})},null,8,_t),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"icon-minus valign",title:e.translate("General_Remove"),onClick:function(t){return e.removeSuccessMetric(r)}},null,8,wt),[[o["vShow"],r>0]])],2)})),128))])]),Object(o["createElementVNode"])("div",At,[Object(o["createElementVNode"])("div",Dt,[Object(o["createElementVNode"])("span",kt,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_FieldSuccessMetricsHelp1"))+" ",1),Ct,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_FieldSuccessMetricsHelp2"))+" ",1),Ut,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_FieldSuccessMetricsHelp3"))+" ",1),Mt,Pt,Object(o["createElementVNode"])("a",{target:"_blank",href:e.goalManageUrl},Object(o["toDisplayString"])(e.translate("AbTesting_ClickToCreateNewGoal")),9,Bt)])])])])])}function Ft(e){return $t(e)||Rt(e)||Lt(e)||Ht()}function Ht(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Lt(e,t){if(e){if("string"===typeof e)return qt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qt(e,t):void 0}}function Rt(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function $t(e){if(Array.isArray(e))return qt(e)}function qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var zt=Object(o["defineComponent"])({props:{modelValue:Array,experimentIdSite:{type:[Number,String],required:!0},successMetricOptions:{type:Object,required:!0}},components:{Field:y["Field"]},emits:["update:modelValue"],computed:{goalManageUrl:function(){var e=this.experimentIdSite;return"?module=Goals&action=manage&idSite=".concat(e,"&period=day&date=yesterday")}},methods:{setValue:function(e,t){var n=Ft(this.modelValue||[]);n[e]={metric:t},this.$emit("update:modelValue",n)},removeSuccessMetric:function(e){var t=Ft(this.modelValue||[]);t.splice(e,1),this.$emit("update:modelValue",t)}}});zt.render=It;var Gt=zt,Kt={name:"mde_relative"},Qt={class:"inline-help-node"},Jt=Object(o["createElementVNode"])("br",null,null,-1),Yt=Object(o["createElementVNode"])("br",null,null,-1),Wt={name:"confidence_threshold"},Zt={class:"alert alert-info"};function Xt(e,t,n,r,i,a){var l,c,s=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",Kt,[Object(o["createVNode"])(s,{uicontrol:"select",name:"mde_relative","model-value":null===(l=e.experiment)||void 0===l?void 0:l.mde_relative,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("updateProperty",{prop:"mde_relative",value:t})}),title:e.translate("AbTesting_MinimumDetectableEffectMDE"),options:e.mdeRelativeOptions},{"inline-help":Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("div",Qt,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_FieldMinimumDetectableEffectHelp1"))+" ",1),Jt,Yt,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_FieldMinimumDetectableEffectHelp2")),1)])]})),_:1},8,["model-value","title","options"])]),Object(o["createElementVNode"])("div",Wt,[Object(o["createVNode"])(s,{uicontrol:"select",name:"confidence_threshold","model-value":null===(c=e.experiment)||void 0===c?void 0:c.confidence_threshold,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.$emit("updateProperty",{prop:"confidence_threshold",value:t})}),title:e.translate("AbTesting_ConfidenceThreshold"),options:e.confidenceThresholdOptions,"inline-help":e.translate("AbTesting_FieldConfidenceThresholdHelp")},null,8,["model-value","title","options","inline-help"])]),Object(o["createElementVNode"])("div",Zt,Object(o["toDisplayString"])(e.translate("AbTesting_FieldSuccessConditionsHelp")),1)])}var en=Object(o["defineComponent"])({props:{experiment:Object,mdeRelativeOptions:{type:Object,required:!0},confidenceThresholdOptions:{type:Object,required:!0}},emits:["updateProperty"],components:{Field:y["Field"]}});en.render=Xt;var tn=en,nn={name:"percentage_participants"},rn=Object(o["createElementVNode"])("br",null,null,-1),an={class:"form-group row"},on={class:"col s12"},ln={class:"form-group row",style:{"margin-top":"0"}},cn={class:"col s12 m6",style:{"padding-left":"0"}},sn={class:"valign-wrapper"},dn={style:{display:"inline-block",width:"calc(100% - 60px)"},class:"control_text percentage",name:"percentage"},un=Object(o["createElementVNode"])("span",null,"%",-1),mn={style:{display:"inline-block",width:"calc(100% - 60px)"},class:"percentage",name:"percentage"},pn=Object(o["createElementVNode"])("span",null,"%",-1),bn={class:"col s12 m6"},fn={class:"form-help"},vn={class:"inline-help"};function gn(e,t,n,r,i,a){var l,c,s=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",nn,[Object(o["createVNode"])(s,{uicontrol:"select",name:"percentage_participants","model-value":null===(l=e.experiment)||void 0===l?void 0:l.percentage_participants,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("updateProperty",{prop:"percentage_participants",value:t})}),title:"".concat(e.translate("AbTesting_FieldPercentageParticipantsLabel"),":"),options:e.percentageParticipantsOptions,"inline-help":e.translate("AbTesting_FieldPercentageParticipantsHelp")},null,8,["model-value","title","options","inline-help"])]),rn,Object(o["createElementVNode"])("div",an,[Object(o["createElementVNode"])("h3",on,Object(o["toDisplayString"])(e.translate("AbTesting_FieldPercentageVariationsLabel"))+":",1)]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"alert alert-danger"},Object(o["toDisplayString"])(e.translate("AbTesting_ErrorVariationAllocatedNot100Traffic")),513),[[o["vShow"],!e.hasAllocated100PercentToVariations]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"alert alert-warning"},Object(o["toDisplayString"])(e.translate("AbTesting_ErrorVariationAllocatedNotEnoughOriginal")),513),[[o["vShow"],e.shouldAllocateMoreTrafficToOriginalVariation&&e.hasAllocated100PercentToVariations]]),Object(o["createElementVNode"])("div",ln,[Object(o["createElementVNode"])("div",cn,[Object(o["createElementVNode"])("div",sn,[Object(o["createElementVNode"])("div",dn,[Object(o["createVNode"])(s,{uicontrol:"text",name:"percentage",title:e.translate("AbTesting_NameOriginalVariation"),disabled:!0,"full-width":!0,placeholder:"".concat(e.defaultVariationPercentage)},null,8,["title","placeholder"])]),un]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])((null===(c=e.experiment)||void 0===c?void 0:c.variations)||[],(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])("valign-wrapper trafficVariation ".concat(n)),key:t.idvariation},[Object(o["createElementVNode"])("div",mn,[Object(o["createVNode"])(s,{uicontrol:"text",name:"percentage","model-value":t.percentage,"onUpdate:modelValue":function(t){return e.changePercent(n,t)},title:"".concat(e.translate("AbTesting_Variation"),' "').concat(t.name,'"'),maxlength:3,"full-width":!0,placeholder:"".concat(e.defaultVariationPercentage)},null,8,["model-value","onUpdate:modelValue","title","placeholder"])]),pn],2)})),128))]),Object(o["createElementVNode"])("div",bn,[Object(o["createElementVNode"])("div",fn,[Object(o["createElementVNode"])("span",vn,Object(o["toDisplayString"])(e.translate("AbTesting_FieldPercentageVariationsHelp")),1)])])])])}function On(e){return yn(e)||En(e)||hn(e)||jn()}function jn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function hn(e,t){if(e){if("string"===typeof e)return xn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xn(e,t):void 0}}function En(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function yn(e){if(Array.isArray(e))return xn(e)}function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vn=Object(o["defineComponent"])({props:{experiment:Object,percentageParticipantsOptions:{type:Object,required:!0}},components:{Field:y["Field"]},emits:["updateProperty"],methods:{changePercent:function(e,t){var n=this.experiment,r=(null===n||void 0===n?void 0:n.variations)||[],i=On(r);i[e]=Object.assign(Object.assign({},i[e]),{},{percentage:t}),this.$emit("updateProperty",{prop:"variations",value:i})}},computed:{hasAllocated100PercentToVariations:function(){var e=this.experiment;if(null===e||void 0===e||!e.variations)return!1;var t=((null===e||void 0===e?void 0:e.variations)||[]).reduce((function(e,t){return null!==t&&void 0!==t&&t.percentage?e+parseInt("".concat(t.percentage),10):e}),0);return t<100},numVariations:function(){var e,t=this.experiment;return(null===(e=t.variations)||void 0===e?void 0:e.length)||0},defaultVariationPercentage:function(){var e=this.experiment;if(!e||!e.variations)return 0;var t=100,n=1,r=this.numVariations+n;if(e.variations.forEach((function(e){e&&e.percentage&&(t-=parseInt("".concat(e.percentage),10),r-=1)})),r>0){var i=Math.round(t/r);return i>100&&(i=100),i<0&&(i=0),i}return 0},shouldAllocateMoreTrafficToOriginalVariation:function(){var e=this.defaultVariationPercentage,t=this.numVariations+1,n=Math.round(100/t),r=Math.floor(n/2);return r>e}}});Vn.render=gn;var Tn=Vn,Nn={class:"row"},Sn={class:"col s12"},_n={class:"form-group row"},wn={class:"col s12"},An={class:"col s12 m6",style:{"padding-left":"0"}},Dn=Object(o["createElementVNode"])("hr",null,null,-1),kn={class:"col s12 m6"},Cn={class:"form-help"},Un={class:"inline-help"},Mn={class:"form-group row"},Pn={class:"col s12"},Bn={class:"col s12 m6",style:{"padding-left":"0"}},In=Object(o["createElementVNode"])("hr",null,null,-1),Fn={class:"col s12 m6"},Hn={class:"form-help"},Ln={class:"inline-help"},Rn={class:"alert alert-info"},$n=Object(o["createElementVNode"])("br",null,null,-1),qn=Object(o["createElementVNode"])("br",null,null,-1);function zn(e,t,n,r,i,a){var l,c,s,d,u=Object(o["resolveComponent"])("TargetTest"),m=Object(o["resolveComponent"])("ExperimentUrlTarget");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",Nn,[Object(o["createElementVNode"])("div",Sn,[Object(o["createVNode"])(u,{"included-targets":null===(l=e.experiment)||void 0===l?void 0:l.included_targets,"excluded-targets":null===(c=e.experiment)||void 0===c?void 0:c.excluded_targets},null,8,["included-targets","excluded-targets"])])]),Object(o["createElementVNode"])("div",_n,[Object(o["createElementVNode"])("div",wn,[Object(o["createElementVNode"])("h3",null,Object(o["toDisplayString"])(e.translate("AbTesting_FieldIncludedTargetsLabel"))+":",1)]),Object(o["createElementVNode"])("div",An,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])((null===(s=e.experiment)||void 0===s?void 0:s.included_targets)||[],(function(n,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:r,class:Object(o["normalizeClass"])("includedTargets ".concat(r," multiple"))},[Object(o["createVNode"])(m,{"model-value":n,"onUpdate:modelValue":function(t){return e.setTarget("included_targets",r,t)},onAddUrl:t[0]||(t[0]=function(t){return e.addTarget("included_targets")}),onRemoveUrl:function(t){return e.removeTarget("included_targets",r)},"allow-any":!0,"disable-if-no-value":r>0,"can-be-removed":r>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"]),Dn],2)})),128))]),Object(o["createElementVNode"])("div",kn,[Object(o["createElementVNode"])("div",Cn,[Object(o["createElementVNode"])("span",Un,Object(o["toDisplayString"])(e.translate("AbTesting_FieldIncludedTargetsHelp2")),1)])])]),Object(o["createElementVNode"])("div",Mn,[Object(o["createElementVNode"])("div",Pn,[Object(o["createElementVNode"])("h3",null,Object(o["toDisplayString"])(e.translate("AbTesting_FieldExcludedTargetsLabel"))+":",1)]),Object(o["createElementVNode"])("div",Bn,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(null===(d=e.experiment)||void 0===d?void 0:d.excluded_targets,(function(n,r){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])("excludedTargets ".concat(r," multiple")),key:r},[Object(o["createVNode"])(m,{"disable-if-no-value":!0,"allow-any":!1,"model-value":n,"onUpdate:modelValue":function(t){return e.setTarget("excluded_targets",r,t)},onAddUrl:t[1]||(t[1]=function(t){return e.addTarget("excluded_targets")}),onRemoveUrl:function(t){return e.removeTarget("excluded_targets",r)},"can-be-removed":r>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","can-be-removed"]),In],2)})),128))]),Object(o["createElementVNode"])("div",Fn,[Object(o["createElementVNode"])("div",Hn,[Object(o["createElementVNode"])("span",Ln,Object(o["toDisplayString"])(e.translate("AbTesting_FieldExcludedTargetsHelp")),1)])])]),Object(o["createElementVNode"])("div",Rn,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_TargetComparisons")),1),Object(o["createElementVNode"])("ul",null,[Object(o["createElementVNode"])("li",null,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeEqualsSimple")),1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeEqualsSimpleInfo")),1)]),Object(o["createElementVNode"])("li",null,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeEqualsExactly")),1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeEqualsExactlyInfo")),1)]),Object(o["createElementVNode"])("li",null,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeRegExp")),1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TargetTypeRegExpInfo")),1)])]),$n,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TargetComparisionsCaseInsensitive")),1),qn])])}function Gn(e){return Yn(e)||Jn(e)||Qn(e)||Kn()}function Kn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qn(e,t){if(e){if("string"===typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}function Jn(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Yn(e){if(Array.isArray(e))return Wn(e)}function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Zn=Object(o["defineComponent"])({props:{experiment:Object},components:{TargetTest:m,ExperimentUrlTarget:A},emits:["updateProperty"],methods:{addTarget:function(e){var t=this.experiment;"excluded_targets"!==e&&"included_targets"!==e||this.$emit("updateProperty",{prop:e,value:[].concat(Gn((null===t||void 0===t?void 0:t[e])||[]),[{attribute:"url",type:"equals_simple",value:"",inverted:0}])})},setTarget:function(e,t,n){var r=this.experiment;if("excluded_targets"===e||"included_targets"===e){var i=Gn((null===r||void 0===r?void 0:r[e])||[]);i[t]=n,this.$emit("updateProperty",{prop:e,value:i})}},removeTarget:function(e,t){var n=this.experiment;if("excluded_targets"===e||"included_targets"===e){var r=Gn((null===n||void 0===n?void 0:n[e])||[]);r.splice(t,1),this.$emit("updateProperty",{prop:e,value:r})}}}});Zn.render=zn;var Xn=Zn,er={class:"form-group row"},tr={class:"col s12 m6",style:{"padding-left":"0"}},nr={class:"redirects",name:"redirects"},rr={class:"col s12 m6"},ir={class:"form-help"},ar={class:"inline-help"},or=Object(o["createElementVNode"])("br",null,null,-1),lr=Object(o["createElementVNode"])("br",null,null,-1),cr=Object(o["createElementVNode"])("br",null,null,-1),sr=Object(o["createElementVNode"])("br",null,null,-1),dr=["innerHTML"];function ur(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("div",er,[Object(o["createElementVNode"])("div",tr,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.modelValue,(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])("redirectsAllocation ".concat(n)),key:t.idvariation},[Object(o["createElementVNode"])("div",nr,[Object(o["createVNode"])(l,{uicontrol:"text",name:"redirects",placeholder:"eg http://www.example.com","model-value":t.redirect_url,"onUpdate:modelValue":function(t){return e.setRedirectUrl(n,t)},title:"".concat(e.translate("AbTesting_Variation"),' "').concat(e.htmlEntities(t.name),'"'),maxlength:1e3,"full-width":!0},null,8,["model-value","onUpdate:modelValue","title"])])],2)})),128))]),Object(o["createElementVNode"])("div",rr,[Object(o["createElementVNode"])("div",ir,[Object(o["createElementVNode"])("span",ar,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_FieldRedirectHelp1"))+" ",1),or,lr,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_FieldRedirectHelp2"))+" ",1),cr,sr,Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.formHelp)},null,8,dr)])])])]),Object(o["createElementVNode"])("div",null,[Object(o["createVNode"])(l,{uicontrol:"checkbox",name:"forwardAllQueryParams","model-value":e.forwardAllParams,title:e.translate("AbTesting_ForwardAllQueryParams"),"onUpdate:modelValue":t[0]||(t[0]=function(t){e.forwardAllParams=t,e.setForwardAllQueryParams()}),"inline-help":e.translate("AbTesting_ForwardAllQueryParamsHelpText")},null,8,["model-value","title","inline-help"])]),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createVNode"])(l,{uicontrol:"checkbox",name:"forwardUtmParams","model-value":e.forwardUtmParams,title:e.translate("AbTesting_ForwardUtmParams"),"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.setForwardUtmParams(t)}),"inline-help":e.getForwardUtmParamsHelpText},null,8,["model-value","title","inline-help"]),[[o["vShow"],!e.forwardAllParams]])])])}function mr(e){return vr(e)||fr(e)||br(e)||pr()}function pr(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function br(e,t){if(e){if("string"===typeof e)return gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(e,t):void 0}}function fr(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function vr(e){if(Array.isArray(e))return gr(e)}function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Or=Object(o["defineComponent"])({data:function(){return{forwardAllParams:this.forwardAllQueryParams}},props:{modelValue:Array,forwardUtmParams:{type:Boolean,required:!1,default:!1},forwardAllQueryParams:{type:Boolean,required:!1,default:!1}},components:{Field:y["Field"]},emits:["update:modelValue","update:forwardUtmParams","update:forwardAllQueryParams"],computed:{formHelp:function(){var e="https://github.com/innocraft/php-experiments";return Object(E["translate"])("AbTesting_FieldRedirectHelp3",'<a target="blank" rel="noreferrer" href="'.concat(e,'">'),"</a>")},getForwardUtmParamsHelpText:function(){var e=Object(E["translate"])("AbTesting_ForwardUtmParamsHelpText"),t="https://developer.matomo.org/guides/ab-tests/browser#can-i-use-redirects-in-ab-tests-to-test-entirely-different-pages-or-layouts",n=Object(E["translate"])("AbTesting_ForwardUtmParamsHelpTextNote","<strong>","</strong>",'<a href="javascript:void(0);" id="viewEmbedCodeTabLink">',"</a>",'<a target="blank" rel="noreferrer" href="'.concat(t,'">'),"</a>");return"".concat(e,"</br></br>").concat(n)}},methods:{setRedirectUrl:function(e,t){var n=this.modelValue||[],r=mr(n);r[e]=Object.assign(Object.assign({},n[e]),{},{redirect_url:t}),this.$emit("update:modelValue",r)},setForwardUtmParams:function(e){this.$emit("update:forwardUtmParams",e)},setForwardAllQueryParams:function(){this.$emit("update:forwardAllQueryParams",this.forwardAllParams)},htmlEntities:function(e){return E["Matomo"].helper.htmlEntities(e)},clickEmbedTab:function(){var e=window.document.querySelectorAll("li.menuEmbed a"),t=e[0];t.click()}},mounted:function(){var e=this.clickEmbedTab,t=window.document.getElementById("viewEmbedCodeTabLink");t&&t.addEventListener("click",(function(){e()}))}});Or.render=ur;var jr=Or,hr={ref:"root"},Er={class:"form-group"},yr={class:"form-group row scheduleExperiment"},xr={class:"col s12 m6"},Vr={class:"row"},Tr={class:"col s12"},Nr={for:"start_date_date",class:"active"},Sr={class:"col s12 m6 input-field"},_r=["value","disabled"],wr={class:"col s12 m6 input-field"},Ar=["value","disabled"],Dr={class:"col s12"},kr=Object(o["createElementVNode"])("br",null,null,-1),Cr={class:"col s12 m6 "},Ur={class:"form-help"},Mr={class:"inline-help"},Pr=["innerHTML"],Br=Object(o["createElementVNode"])("br",null,null,-1),Ir=Object(o["createTextVNode"])(". "),Fr={class:"form-group row scheduleExperiment"},Hr={class:"col s12 m6"},Lr={class:"row"},Rr={class:"col s12"},$r={for:"start_date_date",class:"active"},qr={class:"col s12 m6 input-field"},zr=["value"],Gr={class:"col s12 m6 input-field"},Kr=["value","disabled"],Qr={class:"col s12"},Jr=Object(o["createElementVNode"])("br",null,null,-1),Yr={class:"col s12 m6"},Wr={class:"form-help"},Zr={class:"inline-help"},Xr=["innerHTML"],ei=Object(o["createElementVNode"])("br",null,null,-1),ti=Object(o["createTextVNode"])(". ");function ni(e,t,n,r,i,a){var l,c,s,d,u,m;return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",hr,[Object(o["createElementVNode"])("div",Er,Object(o["toDisplayString"])(e.translate("AbTesting_FormScheduleIntroduction")),1),Object(o["createElementVNode"])("div",yr,[Object(o["createElementVNode"])("div",xr,[Object(o["createElementVNode"])("div",Vr,[Object(o["createElementVNode"])("div",Tr,[Object(o["createElementVNode"])("label",Nr,Object(o["toDisplayString"])(e.translate("AbTesting_FieldScheduleExperimentStartLabel"))+":",1)]),Object(o["createElementVNode"])("div",Sr,[Object(o["createElementVNode"])("input",{type:"text",name:"start_date_date",class:"experimentStartDateInput",value:e.startDateDate,onChange:t[0]||(t[0]=function(t){return e.onKeydown("startDateDate",t)}),onKeydown:t[1]||(t[1]=function(t){return e.onKeydown("startDateDate",t)}),disabled:"created"!==(null===(l=e.experiment)||void 0===l?void 0:l.status)},null,40,_r)]),Object(o["createElementVNode"])("div",wr,[Object(o["createElementVNode"])("input",{type:"text",class:"experimentStartTimeInput",value:e.startDateTime,onChange:t[2]||(t[2]=function(t){return e.onKeydown("startDateTime",t)}),onKeydown:t[3]||(t[3]=function(t){return e.onKeydown("startDateTime",t)}),disabled:"created"!==(null===(c=e.experiment)||void 0===c?void 0:c.status)||!e.startDateDate},null,40,Ar)]),Object(o["createElementVNode"])("div",Dr,[Object(o["withDirectives"])(Object(o["createElementVNode"])("p",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_EqualsDateInYourTimezone"))+" ",1),kr,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.toLocalTime(null===(s=e.experiment)||void 0===s?void 0:s.start_date,!0)),1)],512),[[o["vShow"],e.toLocalTime(null===(d=e.experiment)||void 0===d?void 0:d.start_date,!0)]])])])]),Object(o["createElementVNode"])("div",Cr,[Object(o["createElementVNode"])("div",Ur,[Object(o["createElementVNode"])("span",Mr,[Object(o["createElementVNode"])("span",null,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.experimentStartHelp)},null,8,Pr),Br,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_CurrentTimeInUTC"))+" ",1),Object(o["withDirectives"])(Object(o["createElementVNode"])("strong",{class:"currentDate"},Object(o["toDisplayString"])(e.utcTime),513),[[o["vShow"],e.utcTime]]),Ir])])])])]),Object(o["createElementVNode"])("div",Fr,[Object(o["createElementVNode"])("div",Hr,[Object(o["createElementVNode"])("div",Lr,[Object(o["createElementVNode"])("div",Rr,[Object(o["createElementVNode"])("label",$r,Object(o["toDisplayString"])(e.translate("AbTesting_FieldScheduleExperimentFinishLabel"))+":",1)]),Object(o["createElementVNode"])("div",qr,[Object(o["createElementVNode"])("input",{type:"text",class:"experimentEndDateInput",value:e.endDateDate,onChange:t[4]||(t[4]=function(t){return e.onKeydown("endDateDate",t)}),onKeydown:t[5]||(t[5]=function(t){return e.onKeydown("endDateDate",t)})},null,40,zr)]),Object(o["createElementVNode"])("div",Gr,[Object(o["createElementVNode"])("input",{type:"text",class:"experimentEndTimeInput",value:e.endDateTime,onChange:t[6]||(t[6]=function(t){return e.onKeydown("endDateTime",t)}),onKeydown:t[7]||(t[7]=function(t){return e.onKeydown("endDateTime",t)}),disabled:!e.endDateDate},null,40,Kr)]),Object(o["createElementVNode"])("div",Qr,[Object(o["withDirectives"])(Object(o["createElementVNode"])("p",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_EqualsDateInYourTimezone"))+" ",1),Jr,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.toLocalTime(null===(u=e.experiment)||void 0===u?void 0:u.end_date,!0)),1)],512),[[o["vShow"],e.toLocalTime(null===(m=e.experiment)||void 0===m?void 0:m.end_date,!0)]])])])]),Object(o["createElementVNode"])("div",Yr,[Object(o["createElementVNode"])("div",Wr,[Object(o["createElementVNode"])("span",Zr,[Object(o["createElementVNode"])("span",null,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.experimentFinishHelp)},null,8,Xr),ei,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_CurrentTimeInUTC"))+" ",1),Object(o["withDirectives"])(Object(o["createElementVNode"])("strong",{class:"currentDate"},Object(o["toDisplayString"])(e.utcTime),513),[[o["vShow"],e.utcTime]]),ti])])])])])],512)}function ri(e,t){return ci(e)||li(e,t)||ai(e,t)||ii()}function ii(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ai(e,t){if(e){if("string"===typeof e)return oi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oi(e,t):void 0}}function oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function li(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done);o=!0)if(a.push(r.value),t&&a.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return a}}function ci(e){if(Array.isArray(e))return e}var si=window,di=si.$,ui=Object(o["defineComponent"])({props:{experiment:Object,utcTime:[Date,String]},emits:["updateProperty"],data:function(){return{startDateDate:null,startDateTime:null,endDateDate:null,endDateTime:null}},created:function(){var e=this;this.setDateState(),Object(o["watch"])((function(){var t;return null===(t=e.experiment)||void 0===t?void 0:t.start_date}),(function(){e.setDateState()})),Object(o["watch"])((function(){var t;return null===(t=e.experiment)||void 0===t?void 0:t.end_date}),(function(){e.setDateState()})),Object(o["watch"])((function(){return e.startDateDate}),(function(){e.onStartDateChange()})),Object(o["watch"])((function(){return e.startDateTime}),(function(){e.onStartDateChange()})),Object(o["watch"])((function(){return e.endDateDate}),(function(){e.onEndDateChange()})),Object(o["watch"])((function(){return e.endDateTime}),(function(){e.onEndDateChange()}))},mounted:function(){var e=this,t=E["Matomo"].getBaseDatePickerOptions(null);delete t.maxDate,t.minDate=new Date;var n=E["Matomo"].getBaseDatePickerOptions(null);delete n.maxDate,setTimeout((function(){di(".experimentStartDateInput",e.$refs.root).datepicker(t),di(".experimentEndDateInput",e.$refs.root).datepicker(n),di(".experimentStartTimeInput",e.$refs.root).timepicker({timeFormat:"H:i:s"}).on("change",(function(t){e.onKeydown("startDateTime",t)})),di(".experimentEndTimeInput",e.$refs.root).timepicker({timeFormat:"H:i:s"}).on("change",(function(t){e.onKeydown("endDateTime",t)}))}))},methods:{toLocalTime:a,setDateState:function(){var e=this.experiment;if(null!==e&&void 0!==e&&e.start_date){var t=e.start_date.split(" "),n=ri(t,2);this.startDateDate=n[0],this.startDateTime=n[1],di(".experimentStartDateInput",this.$refs.root).datepicker("setDate",this.startDateDate)}if(null!==e&&void 0!==e&&e.end_date){var r=e.end_date.split(" "),i=ri(r,2);this.endDateDate=i[0],this.endDateTime=i[1],di(".experimentEndDateInput",this.$refs.root).datepicker("setDate",this.endDateDate)}},onStartDateChange:function(){var e=this.experiment,t=null;if(this.startDateDate){var n=this.startDateTime||"00:00:00";t="".concat(this.startDateDate," ").concat(n)}e.start_date!==t&&this.$emit("updateProperty",{prop:"start_date",value:t})},onEndDateChange:function(){var e=this.experiment,t=null;if(this.endDateDate){var n=this.endDateTime||"23:59:59";t="".concat(this.endDateDate," ").concat(n)}e.end_date!==t&&this.$emit("updateProperty",{prop:"end_date",value:t})},onKeydown:function(e,t){var n=this;setTimeout((function(){n[e]=t.target.value}))}},computed:{experimentStartHelp:function(){return Object(E["translate"])("AbTesting_FieldScheduleExperimentStartHelp","<strong>","</strong>")},experimentFinishHelp:function(){return Object(E["translate"])("AbTesting_FieldScheduleExperimentFinishHelp","<strong>","</strong>")}}});ui.render=ni;var mi=ui,pi={class:"alert alert-info"},bi={class:"alert alert-info"},fi={class:"secondary"},vi={class:"alert alert-warning"},gi=Object(o["createElementVNode"])("br",null,null,-1),Oi=Object(o["createElementVNode"])("br",null,null,-1),ji=Object(o["createElementVNode"])("code",null,"chmod 0755 matomo.js",-1),hi=[ji],Ei=Object(o["createElementVNode"])("br",null,null,-1),yi=Object(o["createElementVNode"])("br",null,null,-1),xi=["innerHTML"],Vi={class:"alert alert-info"},Ti=Object(o["createElementVNode"])("br",null,null,-1),Ni=Object(o["createElementVNode"])("br",null,null,-1),Si={class:"secondary"},_i=["innerHTML"],wi={class:"secondary"},Ai=["innerHTML"],Di=Object(o["createTextVNode"])(""),ki=Object(o["createTextVNode"])(""),Ci=["innerHTML"],Ui={class:"secondary"},Mi=["innerHTML"],Pi=Object(o["createTextVNode"])(""),Bi={class:"secondary"},Ii=["innerHTML"],Fi=["innerHTML"];function Hi(e,t,n,r,i,a){var l=Object(o["resolveDirective"])("copy-to-clipboard");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("div",pi,Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentIsFinishedPleaseRemoveCode")),1)],512),[[o["vShow"],"finished"===e.experiment.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("div",bi,Object(o["toDisplayString"])(e.translate("AbTesting_WhereToInsertCodeWarning")),1),Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_ExperimentWillStartFromFirstTrackingRequest")),1),Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("h2",fi,Object(o["toDisplayString"])(e.translate("AbTesting_RunExperimentWithJsClient")),1),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",vi,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_CustomJsNotAllowedWarning"))+" ",1),gi,Oi,Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,hi,512),[[l,{}]])]),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_IncludeAbTestingTrackerCode"))+" ",1),Ei,yi,Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",null,Object(o["toDisplayString"])(e.jsIncludeTemplateCode),1)],512),[[l,{}]])])],512),[[o["vShow"],e.jsIncludeTemplateCode]]),Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getRunExperimentsInJsTracker)},null,8,xi),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",null,Object(o["toDisplayString"])(e.jsExperimentTemplateCode),1)],512),[[l,{}]])]),Object(o["createElementVNode"])("div",Vi,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_UpdateExperimentWarning"))+" ",1),Ti,Ni,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_TestVariationViaUrl")),1)])]),Object(o["createElementVNode"])("h2",Si,Object(o["toDisplayString"])(e.translate("AbTesting_RunExperimentWithJsTracker")),1),Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getRunningTestOnServer)},null,8,_i),Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_HowToRunTestOnServer")),1),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",null,"var _paq = _paq || [];\n_paq.push(['AbTesting::enter', {experiment: '"+Object(o["toDisplayString"])(e.name)+"', 'variation': 'myVariationName'}]);\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseOriginal"))+"\n_paq.push(['AbTesting::enter', {experiment: '"+Object(o["toDisplayString"])(e.name)+"', 'variation': 'original'}]);\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseExperimentId"))+"\n_paq.push(['AbTesting::enter', {experiment: '"+Object(o["toDisplayString"])(e.idExperiment)+"', 'variation': 'original'}]);\n            ",1)],512),[[l,{}]])])]),Object(o["createElementVNode"])("h2",wi,Object(o["toDisplayString"])(e.translate("AbTesting_RunExperimentWithOtherSDK")),1),Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getAppTrackingDescription)},null,8,Ai),Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_HeadingAppTrackingExample")),1),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Di,Object(o["createElementVNode"])("code",null,"_paq.push(['trackEvent', 'abtesting', '"+Object(o["toDisplayString"])(e.experiment.name)+"', 'name of variation']);\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseOriginal"))+"\n_paq.push(['trackEvent', 'abtesting', '"+Object(o["toDisplayString"])(e.experiment.name)+"', 'original']);",1)],512),[[l,{}]])]),Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_HeadingPhpTracker")),1),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[ki,Object(o["createElementVNode"])("code",null,"$tracker->doTrackEvent('abtesting', '"+Object(o["toDisplayString"])(e.experiment.name)+"', 'name of variation');\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseOriginal"))+"\n$tracker->doTrackEvent('abtesting', '"+Object(o["toDisplayString"])(e.experiment.name)+"', 'original');",1)],512),[[l,{}]])]),Object(o["createElementVNode"])("div",{class:"alert alert-info",innerHTML:e.$sanitize(e.getAppTrackingAlertText)},null,8,Ci)]),Object(o["createElementVNode"])("h2",Ui,Object(o["toDisplayString"])(e.translate("AbTesting_RunExperimentWithEmailCampaign")),1),Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getRunningInCampaignDescription)},null,8,Mi),Object(o["createElementVNode"])("div",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Pi,Object(o["createElementVNode"])("code",null,"&pk_abe="+Object(o["toDisplayString"])(e.experiment.name)+"&pk_abv=myVariationName\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseOriginal"))+"\n&pk_abe="+Object(o["toDisplayString"])(e.experiment.name)+"&pk_abv=original\n\n// "+Object(o["toDisplayString"])(e.translate("AbTesting_CodeCommentUseExperimentIdUrl"))+"\n&pk_abe="+Object(o["toDisplayString"])(e.experiment.idexperiment)+"&pk_abv=myVariationName",1)],512),[[l,{}]])]),Object(o["createElementVNode"])("h2",Bi,Object(o["toDisplayString"])(e.translate("AbTesting_NeedHelp")),1),Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getNeedHelpDevZone)},null,8,Ii),Object(o["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getNeedHelpGetInTouch)},null,8,Fi)])])],512),[[o["vShow"],"running"===e.experiment.status||"created"===e.experiment.status]])])}var Li=Object(o["defineComponent"])({props:{experiment:{type:Object,required:!0},jsIncludeTemplateCode:{type:String,required:!0},jsExperimentTemplateCode:{type:String,required:!0}},directives:{CopyToClipboard:E["CopyToClipboard"]},computed:{name:function(){return this.experiment.name},idExperiment:function(){return this.experiment.idexperiment},getRunExperimentsInJsTracker:function(){return Object(E["translate"])("AbTesting_RunExperimentsInJsTracker",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/guides/ab-tests/browser">',"</a>")},getRunningTestOnServer:function(){return Object(E["translate"])("AbTesting_RunningTestOnServer",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/guides/ab-tests/server">',"</a>")},getAppTrackingDescription:function(){return Object(E["translate"])("AbTesting_AppTrackingDescription",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/guides/ab-tests/apps">',"</a>",'<a target="blank" rel="noreferrer" href="https://github.com/innocraft/php-experiments">',"</a>")},getAppTrackingAlertText:function(){return Object(E["translate"])("AbTesting_AppTrackingAlertText",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/guides/tracking-api-clients">',"</a>",'<a target="blank" rel="noreferrer" href="https://matomo.org/integrate/">',"</a>",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/api-reference/tracking-api">',"</a>","<code>","</code>")},getRunningInCampaignDescription:function(){return Object(E["translate"])("AbTesting_RunningInCampaignDescription",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/guides/ab-tests/campaign">',"</a>")},getNeedHelpDevZone:function(){return Object(E["translate"])("AbTesting_NeedHelpDevZone",'<a target="blank" rel="noreferrer" href="https://developer.matomo.org/integration">',"</a>")},getNeedHelpGetInTouch:function(){return Object(E["translate"])("AbTesting_NeedHelpGetInTouch",'<a target="blank" rel="noreferrer" href="https://matomo.org/contact/">',"</a>")}}});Li.render=Hi;var Ri=Li,$i="experimentsmanagement",qi=Object(o["defineComponent"])({props:{idExperiment:[Number,String]},components:{ContentBlock:E["ContentBlock"],Basic:gt,Metrics:Gt,Conditions:tn,Traffic:Tn,Targets:Xn,Redirects:jr,Schedule:mi,Embed:Ri},data:function(){return{isDirty:!1,jsTemplateCode:"",jsIncludeTemplateCode:"",successMetricOptions:[],confirmedEdit:!1,action:"",experiment:{},utcTime:void 0}},created:function(){var e=this;P.fetchJsIncludeTemplate().then((function(t){e.jsIncludeTemplateCode=t.value})),this.setUtcTime(),P.fetchAvailableSuccessMetrics().then((function(t){e.successMetricOptions=(t||[]).map((function(e){return{key:e.value,value:e.name}}))})),this.init()},watch:{idExperiment:function(e){null!==e&&this.init()}},methods:{setUtcTime:function(){var e=this;this.utcTime=this.getUtcTime(),setTimeout((function(){return e.setUtcTime()}),1e4)},getUtcTime:function(){var e=new Date;if(e.toUTCString)return e.toUTCString()},removeAnyExperimentNotification:function(){E["NotificationsStore"].remove("experimentsmanagement"),E["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=E["NotificationsStore"].show({message:e,context:t,id:$i,type:"transient"});setTimeout((function(){E["NotificationsStore"].scrollToNotification(n)}),100)},showErrorFieldNotProvidedNotification:function(e){var t=Object(E["translate"])("AbTesting_ErrorXNotProvided",[e]);this.showNotification(t,"error")},hasSuccessMetric:function(e){return(this.successMetricOptions||[]).some((function(t){return t.key===e}))},init:function(){var e=this;this.confirmedEdit=!1,this.action="basic",this.experiment={},this.jsTemplateCode="",this.edit&&this.idExperiment?P.findExperiment(this.idExperiment).then((function(t){var n;t&&(e.experiment=Object(E["clone"])(t),e.confirmedEdit="running"!==e.experiment.status&&"finished"!==e.experiment.status,null!==(n=e.experiment.variations)&&void 0!==n&&n.length||(e.experiment.variations=[{name:"Variation1",percentage:""}]),e.addDefaultTargetIfNeeded(),e.addDefaultSuccessMetricIfNeeded(),P.fetchJsExperimentTemplate(e.idExperiment).then((function(t){e.jsTemplateCode=t.value})),e.isDirty=!1)})):this.create&&(this.experiment={idSite:E["Matomo"].idSite,name:"",description:"",hypothesis:"",variations:[{name:"Variation1",percentage:""}],confidence_threshold:"95.0"},this.addDefaultTargetIfNeeded(),this.isDirty=!1)},addDefaultTargetIfNeeded:function(){var e,t;!this.experiment||null!==(e=this.experiment.included_targets)&&void 0!==e&&e.length||(this.experiment.included_targets=[{attribute:"url",type:"any",value:"",inverted:0}]),!this.experiment||null!==(t=this.experiment.excluded_targets)&&void 0!==t&&t.length||(this.experiment.excluded_targets=[{attribute:"url",type:"equals_exactly",value:"",inverted:0}])},addDefaultSuccessMetricIfNeeded:function(){var e;if(this.experiment&&(null===(e=this.experiment.success_metrics)||void 0===e||!e.length)){this.experiment.success_metrics=[];var t="nb_conversions";this.hasSuccessMetric(t)||(t="nb_pageviews"),this.experiment.success_metrics.push({metric:t}),this.hasSuccessMetric("nb_orders")&&this.experiment.success_metrics.push({metric:"nb_orders"}),this.hasSuccessMetric("nb_orders_revenue")&&this.experiment.success_metrics.push({metric:"nb_orders_revenue"})}},finishExperiment:function(){var e=this;E["Matomo"].helper.modalConfirm(this.$refs.confirmFinishExperiment,{yes:function(){P.finishExperiment(e.idExperiment).then((function(t){"error"!==t.type&&(P.reload().then((function(){e.init()})),e.showNotification(Object(E["translate"])("AbTesting_ExperimentFinished"),t.type))}))}})},cancel:function(){var e=Object.assign({},E["MatomoUrl"].hashParsed.value);delete e.idExperiment,E["MatomoUrl"].updateHash(e)},createExperiment:function(){var e,t=this,n="AbTesting.addExperiment";if(this.removeAnyExperimentNotification(),this.checkRequiredFieldsAreSet()){if("equals_simple"===(null===(e=this.experiment.included_targets[0])||void 0===e?void 0:e.type)){if(!this.experiment.included_targets[0].value)return void this.showNotification(Object(E["translate"])("AbTesting_ErrorCreateNoUrlDefined"),"error");this.experiment.included_targets=[{attribute:"url",inverted:"0",type:"equals_simple",value:this.experiment.included_targets[0].value}]}else this.experiment.included_targets=[{attribute:"url",inverted:"0",type:"any",value:""}];this.addDefaultSuccessMetricIfNeeded(),P.createOrUpdateExperiment(this.experiment,n).then((function(e){if("error"!==e.type){t.isDirty=!1;var n=e.response.value;P.reload().then((function(){E["Matomo"].helper.isReportingPage()&&E["Matomo"].postEvent("updateReportingMenu"),E["MatomoUrl"].updateHash(Object.assign(Object.assign({},E["MatomoUrl"].hashParsed.value),{},{idExperiment:n})),setTimeout((function(){t.showNotification(Object(E["translate"])("AbTesting_ExperimentCreated"),e.type)}),200)}))}}))}},showEmbedAction:function(){this.isDirty?E["Matomo"].helper.modalConfirm(this.$refs.updateExperimentNeededToEmbed,{yes:function(){return null}}):this.action="embed"},updateExperiment:function(){var e=this;if(this.removeAnyExperimentNotification(),this.checkRequiredFieldsAreSet()){var t="AbTesting.updateExperiment",n=!1;if(this.experiment.start_date){var r=a(this.experiment.start_date,!1),i=new Date;r&&r<=i&&"created"===this.experiment.status&&(n=!0)}var o=function(){P.createOrUpdateExperiment(e.experiment,t).then((function(t){"error"!==t.type&&(e.isDirty=!1,P.reload().then((function(){e.init()})),e.showNotification(Object(E["translate"])("AbTesting_ExperimentUpdated"),t.type))}))};n?E["Matomo"].helper.modalConfirm(this.$refs.confirmUpdateStartExperiment,{yes:o}):o()}},checkRequiredFieldsAreSet:function(){if(!this.experiment.name){var e=Object(E["translate"])("AbTesting_ExperimentName");return this.showErrorFieldNotProvidedNotification(e),!1}if(!this.experiment.hypothesis){var t=Object(E["translate"])("AbTesting_Hypothesis");return this.showErrorFieldNotProvidedNotification(t),!1}if(!this.experiment.description){var n=Object(E["translate"])("General_Description");return this.showErrorFieldNotProvidedNotification(n),!1}return!0},onCancel:function(e){e.target.classList.contains("cancelLink")&&this.cancel()},setValueHasChanged:function(){this.isDirty=!0},setForwardUtmParams:function(e){this.experiment.forward_utm_params=e,this.setValueHasChanged()},setForwardAllQueryParams:function(e){this.experiment.forward_all_query_params=e,e&&this.experiment.forward_utm_params&&(this.experiment.forward_utm_params=!1),this.setValueHasChanged()}},computed:{percentageParticipantsOptions:function(){var e=[1,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100];return e.map((function(e){return{key:"".concat(e),value:"".concat(e,"%")}}))},mdeRelativeOptions:function(){var e=[1,2,3,4,5,8,10,15,20,25,30,40,50,60,70,75,80,90,100,125,150,200,300];return e.map((function(e){return{key:"".concat(e),value:"".concat(e,"%")}}))},trafficAllocationOptions:function(){for(var e=[],t=0;t<101;t+=1)e.push({key:"".concat(t),value:"".concat(t,"%")});return e},confidenceThresholdOptions:function(){var e=["90.0","95.0","98.0","99.0","99.5"];return e.map((function(e){return{key:e,value:"".concat(e,"%")}}))},createExperimentTargetTypes:function(){return[{key:"any",value:Object(E["translate"])("AbTesting_ActivateExperimentOnAllPages")},{key:"equals_simple",value:Object(E["translate"])("AbTesting_ActiveExperimentOnSomePages")}]},create:function(){return!this.idExperiment||"0"===this.idExperiment},edit:function(){return!this.create},editTitle:function(){return this.create?"AbTesting_CreateNewExperiment":"AbTesting_EditExperiment"},contentTitle:function(){return Object(E["translate"])(this.editTitle,this.experiment.name?'"'.concat(this.experiment.name,'"'):"")},isLoading:function(){return P.state.value.isLoading},isUpdating:function(){return P.state.value.isUpdating},viewReportLink:function(){return"?".concat(E["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:this.experiment.idsite,period:"range",date:this.experiment.date_range_string}),"#?").concat(E["MatomoUrl"].stringify({category:"AbTesting_Experiments",idSite:this.experiment.idsite,period:"range",date:this.experiment.date_range_string,subcategory:this.experiment.idexperiment}))}}});qi.render=xe;var zi=qi,Gi={class:"experimentStatusFilter",id:"filterStatus",name:"filterStatus"},Ki={style:{"margin-left":"3.5px"},class:"experimentSearchFilter",name:"experimentSearch"},Qi={class:"index"},Ji={class:"name"},Yi={class:"description"},Wi={class:"status"},Zi={class:"startDate"},Xi={class:"endDate"},ea={class:"action"},ta={colspan:"7"},na={class:"loadingPiwik"},ra=Object(o["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ia={colspan:"7"},aa=["id"],oa={class:"index"},la={class:"name"},ca={class:"description"},sa={class:"status"},da=["title"],ua=["title"],ma={class:"action"},pa=["title","onClick"],ba=["title","onClick"],fa=["title","href"],va=["title","onClick"],ga={class:"tableActionBar"},Oa=Object(o["createElementVNode"])("span",{class:"icon-add"},null,-1),ja={class:"ui-confirm",ref:"confirmArchiveExperiment"},ha=["value"],Ea=["value"],ya={class:"ui-confirm",ref:"confirmDeleteExperiment"},xa=["value"],Va=["value"];function Ta(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("Field"),c=Object(o["resolveComponent"])("ContentBlock"),s=Object(o["resolveDirective"])("content-table");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createVNode"])(c,{"content-title":e.translate("AbTesting_ManageExperiments"),feature:e.translate("AbTesting_ManageExperiments")},{default:Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("p",null,Object(o["toDisplayString"])(e.translate("AbTesting_ManageExperimentsIntroduction")),1),Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("div",Gi,[Object(o["createVNode"])(l,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t),e.onFilterStatusChange()}),title:e.translate("AbTesting_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(o["createElementVNode"])("div",Ki,[Object(o["withDirectives"])(Object(o["createVNode"])(l,{uicontrol:"text",name:"experimentSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[o["vShow"],e.experiments.length>0]])])]),Object(o["withDirectives"])(Object(o["createElementVNode"])("table",null,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",Qi,Object(o["toDisplayString"])(e.translate("General_Id")),1),Object(o["createElementVNode"])("th",Ji,Object(o["toDisplayString"])(e.translate("General_Name")),1),Object(o["createElementVNode"])("th",Yi,Object(o["toDisplayString"])(e.translate("General_Description")),1),Object(o["createElementVNode"])("th",Wi,Object(o["toDisplayString"])(e.translate("AbTesting_Status")),1),Object(o["createElementVNode"])("th",Zi,Object(o["toDisplayString"])(e.translate("AbTesting_StartDate"))+" (UTC)",1),Object(o["createElementVNode"])("th",Xi,Object(o["toDisplayString"])(e.translate("AbTesting_FinishDate"))+" (UTC)",1),Object(o["createElementVNode"])("th",ea,Object(o["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(o["createElementVNode"])("tbody",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",ta,[Object(o["createElementVNode"])("span",na,[ra,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[o["vShow"],e.isLoading||e.isUpdating]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",ia,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.translate("AbTesting_NoExperimentsFound")),513),[[o["vShow"],e.filterStatus]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("AbTesting_NoActiveExperimentConfigured"))+" ",1),Object(o["createElementVNode"])("a",{onClick:t[2]||(t[2]=function(t){return e.createExperiment()})},Object(o["toDisplayString"])(e.translate("AbTesting_CreateNewExperimentNow")),1)],512),[[o["vShow"],!e.filterStatus]])])],512),[[o["vShow"],!e.isLoading&&0===e.experiments.length]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sortedExperiments,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",{id:"experiment".concat(t.idexperiment),class:"experiments",key:t.idexperiment},[Object(o["createElementVNode"])("td",oa,Object(o["toDisplayString"])(t.idexperiment),1),Object(o["createElementVNode"])("td",la,Object(o["toDisplayString"])(t.name),1),Object(o["createElementVNode"])("td",ca,Object(o["toDisplayString"])(e.truncateString(t.description.trim(),60)),1),Object(o["createElementVNode"])("td",sa,Object(o["toDisplayString"])(e.readableExperimentStatus(t.status,e.statusOptions)),1),Object(o["createElementVNode"])("td",{class:"startDate",title:e.dateInYourTimezoneText(t,t.start_date)},Object(o["toDisplayString"])(t.start_date),9,da),Object(o["createElementVNode"])("td",{class:"endDate",title:e.dateInYourTimezoneText(t,t.end_date)},Object(o["toDisplayString"])(t.end_date),9,ua),Object(o["createElementVNode"])("td",ma,[Object(o["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("AbTesting_EditThisExperiment"),onClick:function(n){return e.editExperiment(t.idexperiment)}},null,8,pa),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("AbTesting_DeleteExperimentInfo"),onClick:function(n){return e.deleteExperiment(t)}},null,8,ba),[[o["vShow"],"created"===t.status]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("AbTesting_ViewReportInfo"),href:e.getViewReportLink(t)},null,8,fa),[[o["vShow"],e.showViewReportInfo(t)]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{class:"table-action abtestingicon-box-add",title:e.translate("AbTesting_ArchiveReportInfo"),onClick:function(n){return e.archiveExperiment(t)}},null,8,va),[[o["vShow"],"finished"===t.status]])])],8,aa)})),128))])],512),[[s]]),Object(o["createElementVNode"])("div",ga,[Object(o["createElementVNode"])("a",{class:"createNewExperiment",onClick:t[3]||(t[3]=function(t){return e.createExperiment()})},[Oa,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_CreateNewExperiment")),1)])])]})),_:1},8,["content-title","feature"]),Object(o["createElementVNode"])("div",ja,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ArchiveReportConfirm")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ha),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Ea)],512),Object(o["createElementVNode"])("div",ya,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_DeleteExperimentConfirm")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,xa),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Va)],512)])}function Na(e){return Aa(e)||wa(e)||_a(e)||Sa()}function Sa(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _a(e,t){if(e){if("string"===typeof e)return Da(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Da(e,t):void 0}}function wa(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Aa(e){if(Array.isArray(e))return Da(e)}function Da(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ka=Object(o["defineComponent"])({props:{},components:{ContentBlock:E["ContentBlock"],Field:y["Field"]},directives:{ContentTable:E["ContentTable"]},data:function(){return{searchFilter:"",statusOptions:[]}},created:function(){var e=this;P.fetchAvailableStatuses().then((function(t){e.statusOptions=[{key:"",value:Object(E["translate"])("AbTesting_StatusActive")}].concat(Na(t.map((function(e){return{key:e.value,value:e.name}}))))})),this.onFilterStatusChange()},methods:{createExperiment:function(){this.editExperiment(0)},editExperiment:function(e){E["MatomoUrl"].updateHash(Object.assign(Object.assign({},E["MatomoUrl"].hashParsed.value),{},{idExperiment:e}))},deleteExperiment:function(e){E["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteExperiment,{yes:function(){P.deleteExperiment(e.idexperiment).then((function(){P.reload()}))}})},archiveExperiment:function(e){E["Matomo"].helper.modalConfirm(this.$refs.confirmArchiveExperiment,{yes:function(){P.archiveExperiment(e.idexperiment).then((function(){P.reload()}))}})},onFilterStatusChange:function(){P.fetchExperiments()},setFilterStatus:function(e){P.setFilterStatus(e)},truncateString:function(e,t){return e&&e.length>t?"".concat(e.substr(0,t-3),"..."):e},readableExperimentStatus:function(e,t){var n;return t?null===(n=t.find((function(t){return e===t.key})))||void 0===n?void 0:n.value:e},dateInYourTimezoneText:function(e,t){var n=Object(E["translate"])("AbTesting_EqualsDateInYourTimezone");return a(t,!0)?"".concat(n).concat(a(t,!0)):""},showViewReportInfo:function(e){return("running"===e.status||"finished"===e.status)&&e.date_range_string},getViewReportLink:function(e){return"?".concat(E["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:e.idsite,period:"range",date:e.date_range_string}),"#?").concat(E["MatomoUrl"].stringify({category:"AbTesting_Experiments",idSite:e.idsite,period:"range",date:e.date_range_string,subcategory:e.idexperiment}))}},computed:{siteName:function(){return E["Matomo"].siteName},filterStatus:function(){return P.state.value.filterStatus},experiments:function(){return P.state.value.experiments},isLoading:function(){return P.state.value.isLoading},isUpdating:function(){return P.state.value.isUpdating},sortedExperiments:function(){var e=this,t=Na(this.experiments).filter((function(t){return Object.keys(t).some((function(n){var r=t;return"string"===typeof r[n]&&-1!==r[n].indexOf(e.searchFilter)}))}));return t.sort((function(e,t){var n=parseInt("".concat(e.idexperiment),10),r=parseInt("".concat(t.idexperiment),10);return n-r})),t}}});ka.render=Ta;var Ca=ka,Ua={class:"manageExperiments"};function Ma(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("ListExperiments"),c=Object(o["resolveComponent"])("EditExperiments");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Ua,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createVNode"])(l)],512),[[o["vShow"],!e.editMode]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createVNode"])(c,{"id-experiment":e.idExperiment},null,8,["id-experiment"])],512),[[o["vShow"],e.editMode]])])}var Pa=Object(o["defineComponent"])({props:{},components:{EditExperiments:zi,ListExperiments:Ca},data:function(){return{editMode:!1,idExperiment:null}},created:function(){var e=this;Object(o["watch"])((function(){return E["MatomoUrl"].hashParsed.value.idExperiment}),(function(t){e.initState(t)})),this.initState(E["MatomoUrl"].hashParsed.value.idExperiment)},methods:{removeAnyExperimentNotification:function(){E["NotificationsStore"].remove("experimentsmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(E["Matomo"].postEvent("AbTesting.initAddExperiment",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idExperiment=null)}this.editMode=!0,this.idExperiment=parseInt(e,10)}else this.editMode=!1,this.idExperiment=null;this.removeAnyExperimentNotification()}}});Pa.render=Ma;var Ba=Pa;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */function Ia(){var e=window.location.href;return-1!==e.indexOf("category=AbTesting_Experiments&subcategory=AbTesting_GettingStarted")}function Fa(){Ia()&&E["AjaxHelper"].fetch({method:"AbTesting.getActiveExperiments"}).then((function(e){var t;Ia()&&null!==e&&void 0!==e&&e.length&&null!==e&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.idexperiment&&E["MatomoUrl"].updateUrl(Object.assign(Object.assign({},E["MatomoUrl"].urlParsed.value),{},{idSite:E["Matomo"].idSite}),Object.assign(Object.assign({},E["MatomoUrl"].hashParsed.value),{},{category:"AbTesting_Experiments",subcategory:e[0].idexperiment}))})).catch((function(){}))}function Ha(){var e=1e3;setTimeout(Fa,e),setTimeout(Fa,10*e),setTimeout(Fa,60*e),setTimeout(Fa,300*e),setTimeout(Fa,600*e),setTimeout(Fa,3e3*e),setTimeout(Fa,6e3*e)}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var La=window,Ra=La.$,$a={mounted:function(e,t){if(E["Matomo"].helper.isReportingPage()){var n=Ra(e);if("a"!==e.tagName.toLowerCase()){var r=Ra(e).text();Ra(e).html("<a></a>"),n=Ra(e).find("a"),n.text(r)}n.css("margin-right","3.5px").bind("click",(function(e){e.preventDefault(),E["MatomoUrl"].updateHash(Object.assign(Object.assign({},E["MatomoUrl"].hashParsed.value),{},{category:"AbTesting_Experiments",subcategory:t.value.idExperiment}))}))}}},qa=$a;E["Matomo"].on("Matomo.processDynamicHtml",(function(e){e.find("[piwik-experiment-page-link]").each((function(e,t){if(!Ra(t).attr("piwik-experiment-page-link-handled")){var n=Ra(t).attr("piwik-experiment-page-link");n&&$a.mounted(t,{instance:null,value:{idExperiment:n},oldValue:null,modifiers:{},dir:{}}),Ra(t).attr("piwik-experiment-page-link-handled","1")}}))}));var za={class:"experimentSummary"},Ga=Object(o["createElementVNode"])("br",null,null,-1),Ka=Object(o["createElementVNode"])("br",null,null,-1),Qa=Object(o["createElementVNode"])("br",null,null,-1),Ja=Object(o["createElementVNode"])("br",null,null,-1),Ya={key:0,style:{"margin-left":"3.5px"}},Wa=["innerHTML"],Za=Object(o["createTextVNode"])(". "),Xa={key:1,style:{"margin-left":"3.5px"}},eo=["innerHTML"],to=["title"],no=Object(o["createTextVNode"])(". "),ro={key:2},io=Object(o["createElementVNode"])("br",null,null,-1),ao=["innerHTML"],oo={key:3},lo=Object(o["createElementVNode"])("br",null,null,-1),co=Object(o["createElementVNode"])("br",null,null,-1);function so(e,t,n,r,i,a){return Object(o["openBlock"])(),Object(o["createElementBlock"])("p",za,[Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_Hypothesis"))+":",1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.experiment.hypothesis)+" ",1),Ga,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("General_Description"))+":",1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.experiment.description)+" ",1),Ka,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_ExpectedImprovement"))+":",1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.experiment.mde_relative)+"% ",1),Qa,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_ConfidenceThreshold"))+":",1),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.experiment.confidence_threshold)+"% ",1),Ja,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_Status"))+":",1),"running"===e.experiment.status?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",Ya,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.reportStatusRunning),style:{"margin-right":"3.5px"}},null,8,Wa),e.isAdmin?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,class:"finishExperiment",onClick:t[0]||(t[0]=Object(o["withModifiers"])((function(t){return e.finishExperiment()}),["prevent"]))},Object(o["toDisplayString"])(e.translate("AbTesting_ActionFinishExperiment")),1)):Object(o["createCommentVNode"])("",!0),Za])):Object(o["createCommentVNode"])("",!0),"finished"===e.experiment.status?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",Xa,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.reportStatusFinished),style:{"margin-right":"3.5px"}},null,8,eo),e.isAdmin?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,title:e.translate("AbTesting_ArchiveReportInfo"),onClick:t[1]||(t[1]=Object(o["withModifiers"])((function(t){return e.archiveExperiment()}),["prevent"])),class:"archiveExperiment"},Object(o["toDisplayString"])(e.translate("AbTesting_ActionArchiveExperiment")),9,to)):Object(o["createCommentVNode"])("",!0),no])):Object(o["createCommentVNode"])("",!0),e.isEstimatedUniqueVisitorEnabled?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",ro,[io,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("AbTesting_ReportingEfficiency"))+": ",1),Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.reportingEfficiencyDescription)},null,8,ao)])):Object(o["createCommentVNode"])("",!0),"running"===e.experiment.status?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",oo,[lo,co,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("AbTesting_ReportWhenToDeclareWinner")),1)])):Object(o["createCommentVNode"])("",!0)])}var uo=Object(o["defineComponent"])({props:{experiment:{type:Object,required:!0},isAdmin:Boolean,isEstimatedUniqueVisitorEnabled:Boolean,startDateSiteTimezonePretty:String,endDateSiteTimezonePretty:String},computed:{reportStatusRunning:function(){return Object(E["translate"])("AbTesting_ReportStatusRunning",'<span class="reportDuration">'.concat(this.experiment.duration,"</span>"),this.startDateSiteTimezonePretty||"")},reportStatusFinished:function(){return Object(E["translate"])("AbTesting_ReportStatusFinished",'<span class="reportDuration">'.concat(this.experiment.duration,"</span>"),this.startDateSiteTimezonePretty||"",this.endDateSiteTimezonePretty||"")},reportingEfficiencyDescription:function(){return Object(E["translate"])("AbTesting_ReportingEfficiencyDescription",'<a href="https://matomo.org/faq/funnels/what-is-estimated-unique-visitors-in-a-b-testing/" target="_blank" rel="noreferrer noopener">',"</a>")}},methods:{finishExperiment:function(){var e=this;E["Matomo"].helper.modalConfirm("#confirmFinishExperiment",{yes:function(){P.finishExperiment(e.experiment.idexperiment).then((function(e){"error"!==e.type&&E["Matomo"].helper.redirect()}))}})},archiveExperiment:function(){var e=this;E["Matomo"].helper.modalConfirm("#confirmArchiveExperiment",{yes:function(){P.archiveExperiment(e.experiment.idexperiment).then((function(t){"error"!==t.type&&(E["NotificationsStore"].show({message:Object(E["translate"])("AbTesting_ActionArchiveExperimentSuccess"),context:"success",type:"transient"}),E["MatomoUrl"].updateUrl(Object.assign(Object.assign({},E["MatomoUrl"].urlParsed.value),{},{popover:"",idExperiment:e.experiment.idexperiment,segment:""}),Object.assign(Object.assign({},E["MatomoUrl"].hashParsed.value),{},{category:"General_Visitors",subcategory:"General_Overview"})))}))}})}}});uo.render=so;var mo=uo,po={class:"ui-confirm",id:"confirmArchiveExperiment"},bo=["value"],fo=["value"],vo={class:"ui-confirm",id:"confirmFinishExperiment"},go=["value"],Oo=["value"],jo={id:"abtestPeriod",class:"piwikTopControl piwikSelector borderedControl periodSelector"},ho=["title"],Eo=Object(o["createElementVNode"])("span",{class:"icon icon-calendar"},null,-1);function yo(e,t,n,r,i,a){var l=Object(o["resolveComponent"])("Summary"),c=Object(o["resolveDirective"])("content-intro");return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_MenuTitleExperiment",e.experiment.name)),1),Object(o["createVNode"])(l,{"is-admin":e.isAdmin,"is-estimated-unique-visitor-enabled":e.isEstimatedUniqueVisitorEnabled,experiment:e.experiment,"start-date-site-timezone-pretty":e.startDateTimezone,"end-date-site-timezone-pretty":e.endDateTimezone},null,8,["is-admin","is-estimated-unique-visitor-enabled","experiment","start-date-site-timezone-pretty","end-date-site-timezone-pretty"]),Object(o["createElementVNode"])("div",po,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ArchiveReportConfirm")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,bo),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,fo)]),Object(o["createElementVNode"])("div",vo,[Object(o["createElementVNode"])("h2",null,Object(o["toDisplayString"])(e.translate("AbTesting_ConfirmFinishExperiment")),1),Object(o["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,go),Object(o["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Oo)]),Object(o["createElementVNode"])("div",jo,[Object(o["createElementVNode"])("span",{id:"date",class:"title",title:e.translate("AbTesting_ReportDateCannotBeChanged")},[Eo,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.readablePeriod),1)],8,ho)])],512)),[[c]])}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var xo=!1,Vo=window,To=Vo.$,No=Vo.initTopControls;function So(){var e=".top_controls #abtestPeriod",t="#periodString";To(t).hide(),To(e).remove(),To("#abtestPeriod").insertAfter("#periodString"),"undefined"!==typeof No&&No&&No(),xo||(xo=!0,E["Matomo"].on("piwikPageChange",(function(){var n=window.location.href,r=E["MatomoUrl"].hashParsed.value.subcategory,i=!n||-1===n.indexOf("&category=AbTesting_Experiments&subcategory=")||r&&!/^\d+$/.test(String(r));i&&(To(t).show(),To(e).remove(),"undefined"!==typeof No&&No&&No())})))}window.initAbTest=So;var _o=Object(o["defineComponent"])({props:{experiment:{type:Object,required:!0},isAdmin:Boolean,isEstimatedUniqueVisitorEnabled:Boolean,startDateTimezone:String,endDateTimezone:String,readablePeriod:{type:String,required:!0}},directives:{ContentIntro:E["ContentIntro"]},components:{Summary:mo},created:function(){So()}});_o.render=yo;var wo=_o;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin"),require("SegmentEditor")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin","SegmentEditor"],t):"object"===typeof exports?exports["AdvertisingConversionExport"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin"),require("SegmentEditor")):e["AdvertisingConversionExport"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"],e["SegmentEditor"])})("undefined"!==typeof self?self:this,(function(e,t,o,n){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="plugins/AdvertisingConversionExport/vue/dist/",o(o.s="fae3")}({"19dc":function(t,o){t.exports=e},"8bbf":function(e,o){e.exports=t},a5a2:function(e,t){e.exports=o},f06f:function(e,t){e.exports=n},fae3:function(e,t,o){"use strict";if(o.r(t),o.d(t,"ConversionExportEdit",(function(){return $e})),o.d(t,"ConversionExportList",(function(){return _t})),o.d(t,"ConversionExportManage",(function(){return Bt})),"undefined"!==typeof window){var n=window.document.currentScript,r=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(o.p=r[1])}var i=o("8bbf"),a={class:"loadingPiwik"},s=Object(i["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),l={class:"loadingPiwik"},c=Object(i["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),d={name:"name"},p={class:"row accesstokenhead"},u={class:"col s12"},v={key:0,class:"export-url-div form-group row matomo-form-field",id:"exportUrlDiv"},m={class:"col s12 m6"},b={class:"col s12 m6"},E={class:"form-help"},x=["innerHTML"],f={key:1,class:"export-url-div form-group row matomo-form-field",id:"exportUrlDiv"},g={class:"col s12 m6"},h=["textContent"],O={class:"col s12 m6"},j={class:"form-help"},y=["innerHTML"],C={name:"type"},N={name:"description"},A={class:"form-group row",style:{"margin-bottom":"0"}},V={class:"col s12"},k={name:"directAttribution"},S={name:"daysToLookBack"},w={name:"clickIdAttribution"},_={name:"externalAttributedConversion"},T={name:"attributionModel"},D={name:"attributedCredit"},M={class:"form-group row",style:{"margin-bottom":"0"}},G={class:"col s12"},U={class:"form-group row",style:{"margin-bottom":"0"}},B={class:"col s12"},L=["innerHTML"],H={name:"daysToExport"},I={class:"form-group row",style:{"margin-bottom":"0"}},P={class:"col s12"},q=["innerHTML"],R={class:"form-group row",style:{"margin-bottom":"0"}},F={class:"col s12"},$={class:"form-group row",style:{"margin-bottom":"0"}},W={class:"col s12"},z=["innerHTML"],Y={class:"loadingPiwik"},X=Object(i["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),K={key:3},J={class:"form-group row"},Q={class:"col s12 m4"},Z=["name"],ee={class:"col s12 m4"},te=["name"],oe={class:"col s12 m4"},ne={class:"row",style:{"margin-bottom":"0"}},re=["name"],ie=["name"],ae=["title"],se=["title","onClick"],le={class:"entityCancel"},ce={class:"ui-confirm",id:"confirmRegenerateAccessToken",ref:"confirmRegenerateAccessToken"},de=["value"],pe=["value"];function ue(e,t,o,n,r,ue){var ve=Object(i["resolveComponent"])("Field"),me=Object(i["resolveComponent"])("SegmentGenerator"),be=Object(i["resolveComponent"])("Alert"),Ee=Object(i["resolveComponent"])("SaveButton"),xe=Object(i["resolveComponent"])("ContentBlock"),fe=Object(i["resolveDirective"])("copy-to-clipboard");return Object(i["openBlock"])(),Object(i["createBlock"])(xe,{class:"editConversionExport","content-title":e.contentTitle},{default:Object(i["withCtx"])((function(){return[Object(i["withDirectives"])(Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("span",a,[s,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[i["vShow"],e.isLoading]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("span",l,[c,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_UpdatingData")),1)])],512),[[i["vShow"],e.isUpdating]]),Object(i["createElementVNode"])("form",{onSubmit:t[15]||(t[15]=function(t){return e.edit?e.updateExport():e.createExport()})},[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",d,[Object(i["createVNode"])(ve,{uicontrol:"text",name:"name","model-value":e.conversionExport.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.conversionExport.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,tabindex:21,placeholder:e.translate("AdvertisingConversionExport_FieldNamePlaceholder"),"inline-help":e.translate("AdvertisingConversionExport_ExportNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(i["createElementVNode"])("div",p,[Object(i["createElementVNode"])("label",u,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_ExportURL"))+" ",1),Object(i["withDirectives"])(Object(i["createElementVNode"])("a",{onClick:t[1]||(t[1]=function(t){return e.regenerateAccessToken()})},"("+Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_Regenerate"))+")",513),[[i["vShow"],e.conversionExport.idexport]])])]),e.conversionExport.access_token?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",v,[Object(i["createElementVNode"])("div",m,[Object(i["createElementVNode"])("div",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("pre",null,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.showDownloadLink()),1)],512),[[fe,{}]])])]),Object(i["createElementVNode"])("div",b,[Object(i["createElementVNode"])("div",E,[Object(i["createElementVNode"])("span",{class:"inline-help",innerHTML:e.$sanitize(e.accessTokenInlineHelp)},null,8,x)])])])):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",f,[Object(i["createElementVNode"])("div",g,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("pre",{textContent:Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_FieldExportURLPlaceholder"))},null,8,h)])]),Object(i["createElementVNode"])("div",O,[Object(i["createElementVNode"])("div",j,[Object(i["createElementVNode"])("span",{class:"inline-help",innerHTML:e.$sanitize(e.accessTokenInlineHelp)},null,8,y)])])])),Object(i["createElementVNode"])("div",C,[Object(i["createVNode"])(ve,{uicontrol:"radio",name:"type","model-value":e.conversionExport.type,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.conversionExport.type=t,e.setValueHasChanged(),e.showNote()}),title:e.translate("AdvertisingConversionExport_ExportType"),tabindex:22,options:e.exportTypeOptions,"inline-help":e.conversionExportHelp},null,8,["model-value","title","options","inline-help"])]),Object(i["createElementVNode"])("div",N,[Object(i["createVNode"])(ve,{uicontrol:"textarea",name:"description","model-value":e.conversionExport.description,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.conversionExport.description=t,e.setValueHasChanged()}),title:"".concat(e.translate("General_Description")," ").concat(e.translate("Goals_Optional")),maxlength:1e3,rows:3,tabindex:26,placeholder:e.translate("AdvertisingConversionExport_ExportDescriptionPlaceHolder"),"inline-help":e.translate("AdvertisingConversionExport_ExportDescriptionHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(i["createElementVNode"])("div",A,[Object(i["createElementVNode"])("div",V,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_AttributionSettings")),1)])]),Object(i["createElementVNode"])("div",k,[Object(i["createVNode"])(ve,{uicontrol:"checkbox",name:"directAttribution","model-value":e.conversionExport.parameters.onlyDirectAttribution,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.conversionExport.parameters.onlyDirectAttribution=t,e.setValueHasChanged()}),title:e.translate("AdvertisingConversionExport_DirectAttributionOnly"),tabindex:23,"inline-help":e.directAttributionHelp},null,8,["model-value","title","inline-help"])]),Object(i["createElementVNode"])("div",S,[Object(i["withDirectives"])(Object(i["createVNode"])(ve,{uicontrol:"number",name:"daysToLookBack","model-value":e.conversionExport.parameters.daysToLookBack,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.conversionExport.parameters.daysToLookBack=t,e.setValueHasChanged()}),title:e.translate("AdvertisingConversionExport_DaysToLookBack"),min:1,max:365,"default-value":30,tabindex:24,"inline-help":e.translate("AdvertisingConversionExport_DaysToLookBackDescription")},null,8,["model-value","title","inline-help"]),[[i["vShow"],!e.conversionExport.parameters.onlyDirectAttribution||"0"===e.conversionExport.parameters.onlyDirectAttribution]])]),Object(i["createElementVNode"])("div",w,[Object(i["withDirectives"])(Object(i["createVNode"])(ve,{uicontrol:"radio",name:"clickIdAttribution","model-value":e.conversionExport.parameters.clickIdAttribution,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.conversionExport.parameters.clickIdAttribution=t,e.setValueHasChanged()}),title:e.translate("AdvertisingConversionExport_ClickIdAttribution"),tabindex:25,options:e.clickIdAttributionOptions,"inline-help":e.translate("AdvertisingConversionExport_ClickIdAttributionDescription")},null,8,["model-value","title","options","inline-help"]),[[i["vShow"],!e.conversionExport.parameters.onlyDirectAttribution||"0"===e.conversionExport.parameters.onlyDirectAttribution]])]),Object(i["createElementVNode"])("div",_,[Object(i["withDirectives"])(Object(i["createVNode"])(ve,{uicontrol:"checkbox",name:"externalAttributedConversion","model-value":e.conversionExport.parameters.externalAttributedConversion,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.conversionExport.parameters.externalAttributedConversion=t,e.setValueHasChanged()}),title:"External attributed conversion",tabindex:26,"inline-help":e.translate("AdvertisingConversionExport_ExternalAttributedConversionHelp")},null,8,["model-value","inline-help"]),[[i["vShow"],"GoogleAds"===e.conversionExport.type]])]),Object(i["createElementVNode"])("div",T,[Object(i["withDirectives"])(Object(i["createVNode"])(ve,{uicontrol:"select",name:"attributionModel","model-value":e.conversionExport.parameters.attributionModel,"onUpdate:modelValue":t[8]||(t[8]=function(t){e.conversionExport.parameters.attributionModel=t,e.setValueHasChanged()}),title:"Attribution Model",options:e.attributionModelOptions,tabindex:27,"inline-help":e.translate("AdvertisingConversionExport_AttributionModelHelp")},null,8,["model-value","options","inline-help"]),[[i["vShow"],"GoogleAds"===e.conversionExport.type&&e.conversionExport.parameters.externalAttributedConversion&&"0"!==e.conversionExport.parameters.externalAttributedConversion]])]),Object(i["createElementVNode"])("div",D,[Object(i["withDirectives"])(Object(i["createVNode"])(ve,{uicontrol:"number",name:"attributedCredit","model-value":e.conversionExport.parameters.attributedCredit,"onUpdate:modelValue":t[9]||(t[9]=function(t){e.conversionExport.parameters.attributedCredit=t,e.setValueHasChanged()}),title:"Attributed Credit",tabindex:28,min:0,max:1,"inline-help":e.translate("AdvertisingConversionExport_AttributedCreditHelp")},null,8,["model-value","inline-help"]),[[i["vShow"],"GoogleAds"===e.conversionExport.type&&e.conversionExport.parameters.externalAttributedConversion&&"0"!==e.conversionExport.parameters.externalAttributedConversion]])]),Object(i["createElementVNode"])("div",M,[Object(i["createElementVNode"])("div",G,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_VisitorsToExport")),1)])]),Object(i["createElementVNode"])("div",U,[Object(i["createElementVNode"])("div",B,[Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("AdvertisingConversionExport_VisitorsToExportHelp"))},null,8,L)])])]),Object(i["createElementVNode"])("div",H,[Object(i["createVNode"])(ve,{uicontrol:"number",name:"daysToExport","model-value":e.conversionExport.parameters.daysToExport,"onUpdate:modelValue":t[10]||(t[10]=function(t){e.conversionExport.parameters.daysToExport=t,e.setValueHasChanged()}),title:e.translate("AdvertisingConversionExport_DaysToExport"),min:1,max:100,"default-value":7,tabindex:35,"inline-help":e.translate("AdvertisingConversionExport_DaysToExportHelp")},null,8,["model-value","title","inline-help"])]),Object(i["createElementVNode"])("div",I,[Object(i["createElementVNode"])("div",P,[Object(i["createElementVNode"])("label",{innerHTML:e.$sanitize(e.translate("AdvertisingConversionExport_AdditionalSegment"))},null,8,q),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(me,{tabindex:"36","model-value":e.conversionExport.parameters.segment,"onUpdate:modelValue":t[11]||(t[11]=function(t){e.conversionExport.parameters.segment=t,e.setValueHasChanged()}),"visit-segments-only":!0},null,8,["model-value"])])])]),Object(i["createElementVNode"])("div",R,[Object(i["createElementVNode"])("div",F,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_ConversionsToExport")),1)])]),Object(i["createElementVNode"])("div",$,[Object(i["createElementVNode"])("div",W,[Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("AdvertisingConversionExport_ConversionsToExportHelp"))},null,8,z)])])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("span",Y,[X,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[i["vShow"],e.isLoadingGoals]]),e.goals.length||e.isLoadingGoals?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createBlock"])(be,{key:2,severity:"warning"},{default:Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_NoGoalsConfigured")),1)]})),_:1})),e.goals.length&&!e.isLoadingGoals?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",K,[(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.conversionExport.parameters.goals,(function(o,n){var r,a;return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:Object(i["normalizeClass"])("exportGoals ".concat(n," valign-wrapper")),key:n},[Object(i["createElementVNode"])("div",J,[Object(i["createElementVNode"])("div",Q,[Object(i["createElementVNode"])("div",{name:"exportGoalId".concat(n)},[Object(i["createVNode"])(ve,{uicontrol:"select","model-value":o.idgoal,"onUpdate:modelValue":function(t){o.idgoal=t,e.setValueHasChanged()},title:e.translate("General_Goal"),name:"exportGoalId".concat(n),"full-width":!0,options:e.goals,tabindex:37+4*n},null,8,["model-value","onUpdate:modelValue","title","name","options","tabindex"])],8,Z)]),Object(i["createElementVNode"])("div",ee,[Object(i["createElementVNode"])("div",{name:"exportGoalName".concat(n)},[Object(i["createVNode"])(ve,{uicontrol:"text","model-value":o.name,"onUpdate:modelValue":function(t){o.name=t,e.setValueHasChanged()},title:e.translate("AdvertisingConversionExport_GoalAlias"),name:"exportGoalName".concat(n),"full-width":!0,maxlength:50,tabindex:38+4*n},null,8,["model-value","onUpdate:modelValue","title","name","tabindex"])],8,te)]),Object(i["createElementVNode"])("div",oe,[Object(i["createElementVNode"])("div",ne,[Object(i["createElementVNode"])("div",{name:"exportGoalRevenue".concat(n),class:Object(i["normalizeClass"])("col s12 ".concat("custom"===o.revenue?"m6":"m12"))},[Object(i["createVNode"])(ve,{uicontrol:"select","model-value":o.revenue,"onUpdate:modelValue":function(t){o.revenue=t,e.setValueHasChanged()},title:e.translate("General_ColumnRevenue"),name:"exportGoalRevenue".concat(n),class:Object(i["normalizeClass"])({custom:"custom"===o.revenue}),"full-width":!0,options:e.revenueOptions,tabindex:39+4*n},null,8,["model-value","onUpdate:modelValue","title","name","class","options","tabindex"])],10,re),Object(i["createElementVNode"])("div",{name:"exportGoalRevenueCustom".concat(n),class:"col s12 m6"},["custom"===o.revenue?(Object(i["openBlock"])(),Object(i["createBlock"])(ve,{key:0,uicontrol:"number","model-value":o.revenueValue,"onUpdate:modelValue":function(t){o.revenueValue=t,e.setValueHasChanged()},title:e.translate("General_Value"),name:"exportGoalRevenueCustom".concat(n),"full-width":!0,tabindex:40+4*n},null,8,["model-value","onUpdate:modelValue","title","name","tabindex"])):Object(i["createCommentVNode"])("",!0)],8,ie)])])]),Object(i["createElementVNode"])("div",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-plus",title:e.translate("General_Add"),onClick:t[12]||(t[12]=function(t){return e.addExportGoal()})},null,8,ae),[[i["vShow"],(null===(r=e.conversionExport.parameters)||void 0===r?void 0:r.goals.length)<e.goals.length]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{class:"icon-minus",title:e.translate("General_Remove"),onClick:function(t){return e.removeExportGoal(n)}},null,8,se),[[i["vShow"],(null===(a=e.conversionExport.parameters)||void 0===a?void 0:a.goals.length)>1]])])],2)})),128))])):Object(i["createCommentVNode"])("",!0),e.showNoteMessage?(Object(i["openBlock"])(),Object(i["createBlock"])(be,{key:4,severity:"info"},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("strong",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_ExportNote"))+": ",1),Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.noteMessage),1)]})),_:1})):Object(i["createCommentVNode"])("",!0),Object(i["createVNode"])(Ee,{class:"createButton",tabindex:"100",onConfirm:t[13]||(t[13]=function(t){return e.edit?e.updateExport():e.createExport()}),disabled:e.isUpdating||!e.isDirty||!e.goals.length,saving:e.isUpdating,value:e.createButtonText},null,8,["disabled","saving","value"]),Object(i["createElementVNode"])("div",le,[Object(i["createElementVNode"])("a",{onClick:t[14]||(t[14]=function(t){return e.cancel()})},Object(i["toDisplayString"])(e.translate("General_Cancel")),1)])])],32),Object(i["createElementVNode"])("div",ce,[Object(i["createElementVNode"])("h2",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_RegenerateAccessTokenConfirm")),1),Object(i["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,de),Object(i["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,pe)],512)]})),_:1},8,["content-title"])}var ve=o("19dc"),me=o("a5a2"),be=o("f06f");function Ee(e,t){return ge(e)||fe(e,t)||je(e,t)||xe()}function xe(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function fe(e,t){var o=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,r,i=[],a=!0,s=!1;try{for(o=o.call(e);!(a=(n=o.next()).done);a=!0)if(i.push(n.value),t&&i.length===t)break}catch(l){s=!0,r=l}finally{try{a||null==o["return"]||o["return"]()}finally{if(s)throw r}}return i}}function ge(e){if(Array.isArray(e))return e}function he(e){return Ce(e)||ye(e)||je(e)||Oe()}function Oe(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function je(e,t){if(e){if("string"===typeof e)return Ne(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Ne(e,t):void 0}}function ye(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ce(e){if(Array.isArray(e))return Ne(e)}function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function Ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ve(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ke(e,t,o){return t&&Ve(e.prototype,t),o&&Ve(e,o),e}function Se(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var we=function(){function e(){var t=this;Ae(this,e),Se(this,"privateState",Object(i["reactive"])({exports:[],sites:[],goals:[],isLoading:!1,isLoadingGoals:!1,isUpdating:!1})),Se(this,"state",Object(i["computed"])((function(){return Object(i["readonly"])(t.privateState)}))),Se(this,"exports",Object(i["computed"])((function(){return t.state.value.exports}))),Se(this,"isEcommerceSite",Object(i["computed"])((function(){var e=t.state.value.sites.find((function(e){return parseInt(e.idsite,10)===parseInt(ve["Matomo"].idSite,10)})),o=null===e||void 0===e?void 0:e.ecommerce;return 1===o||"1"===o}))),Se(this,"goals",Object(i["computed"])((function(){var e=[];return t.isEcommerceSite.value&&e.push({key:"0",value:Object(ve["translate"])("General_EcommerceOrders")}),Object(i["readonly"])([].concat(e,he(t.state.value.goals)))}))),Se(this,"fetchPromise",null),Se(this,"fetchSitePromise",null)}return ke(e,[{key:"reload",value:function(){return this.privateState.exports=[],this.fetchPromise=null,this.fetchExports()}},{key:"fetchExports",value:function(){var e=this;return this.fetchPromise||(this.fetchPromise=ve["AjaxHelper"].fetch({method:"AdvertisingConversionExport.getConversionExports",idSite:ve["Matomo"].idSite,filter_limit:"-1"})),this.privateState.isLoading=!0,this.privateState.exports=[],Promise.all([this.fetchPromise,this.fetchSites(),this.fetchGoals()]).then((function(t){var o=Ee(t,1),n=o[0];return e.privateState.exports=n,e.exports.value})).finally((function(){e.privateState.isLoading=!1}))}},{key:"fetchGoals",value:function(){var e=this;return this.state.value.goals.length?Promise.resolve(this.state.value.goals):(this.privateState.isLoadingGoals=!0,ve["AjaxHelper"].fetch({module:"API",method:"Goals.getGoals",idSite:ve["Matomo"].idSite,filter_limit:"-1"}).then((function(t){return e.privateState.goals=Object.values(t).map((function(e){return{key:"".concat(e.idgoal),value:e.name}})),e.goals.value})).finally((function(){e.privateState.isLoadingGoals=!1})))}},{key:"fetchSites",value:function(){var e=this;return this.state.value.sites.length?Promise.resolve(this.state.value.sites):(this.fetchSitePromise||(this.fetchSitePromise=ve["AjaxHelper"].fetch({module:"API",method:"SitesManager.getSitesWithAtLeastViewAccess",filter_limit:"-1"})),this.fetchSitePromise.then((function(t){return e.privateState.sites=t||[],e.state.value.sites})))}},{key:"findExport",value:function(e){var t=this,o=this.state.value.exports.find((function(t){return parseInt("".concat(t.idexport),10)===e}));return o?Promise.resolve(o):(this.privateState.isLoading=!0,Promise.all([ve["AjaxHelper"].fetch({idExport:e,method:"AdvertisingConversionExport.getConversionExport"}),this.fetchSites()]).then((function(e){var t=Ee(e,1),o=t[0];return Object(i["readonly"])(o)})).finally((function(){t.privateState.isLoading=!1})))}},{key:"deleteExport",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.exports=[],ve["AjaxHelper"].fetch({idExport:e,method:"AdvertisingConversionExport.deleteConversionExport"},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"regenerateAccessToken",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.exports=[],ve["AjaxHelper"].fetch({idExport:e,method:"AdvertisingConversionExport.regenerateAccessToken"},{withTokenInUrl:!0}).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createExport",value:function(e,t){var o,n,r,i,a,s=this;this.privateState.isUpdating=!0;var l=[!0,"true",1,"1"].includes(null!==(o=null===(n=e.parameters)||void 0===n?void 0:n.onlyDirectAttribution)&&void 0!==o&&o)?1:0,c=[!0,"true",1,"1"].includes(null!==(r=null===(i=e.parameters)||void 0===i?void 0:i.externalAttributedConversion)&&void 0!==r&&r)?1:0;return ve["AjaxHelper"].post({},{idExport:e.idexport,name:e.name.trim(),type:e.type,description:e.description.trim(),method:t,parameters:Object.assign(Object.assign({},e.parameters||{}),{},{onlyDirectAttribution:l,externalAttributedConversion:c,goals:((null===(a=e.parameters)||void 0===a?void 0:a.goals)||[]).filter((function(e){return""!==e.idgoal&&e.idgoal>=0}))})},{withTokenInUrl:!0}).then((function(e){return{type:"success",response:e}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){s.privateState.isUpdating=!1}))}},{key:"updateExport",value:function(e,t){var o,n,r,i,a,s=this;this.privateState.isUpdating=!0;var l=[!0,"true",1,"1"].includes(null!==(o=null===(n=e.parameters)||void 0===n?void 0:n.onlyDirectAttribution)&&void 0!==o&&o)?1:0,c=[!0,"true",1,"1"].includes(null!==(r=null===(i=e.parameters)||void 0===i?void 0:i.externalAttributedConversion)&&void 0!==r&&r)?1:0;return ve["AjaxHelper"].post({},{idExport:e.idexport,name:e.name.trim(),type:e.type,description:e.description.trim(),method:t,parameters:Object.assign(Object.assign({},e.parameters||{}),{},{onlyDirectAttribution:l,externalAttributedConversion:c,goals:((null===(a=e.parameters)||void 0===a?void 0:a.goals)||[]).filter((function(e){return""!==e.idgoal&&e.idgoal>=0}))})},{withTokenInUrl:!0}).then((function(e){return{type:"success",response:e}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){s.privateState.isUpdating=!1}))}}]),e}(),_e=new we;function Te(e){return Ue(e)||Ge(e)||Me(e)||De()}function De(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Me(e,t){if(e){if("string"===typeof e)return Be(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Be(e,t):void 0}}function Ge(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ue(e){if(Array.isArray(e))return Be(e)}function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}var Le=0,He="dataDriven",Ie=1,Pe="conversionexportmanagement",qe={goal:Object(ve["translate"])("AdvertisingConversionExport_UseGoalRevenue"),custom:Object(ve["translate"])("AdvertisingConversionExport_UseCustomRevenue"),null:Object(ve["translate"])("AdvertisingConversionExport_UseEmptyRevenue")},Re={first:Object(ve["translate"])("AdvertisingConversionExport_FirstClickId"),last:Object(ve["translate"])("AdvertisingConversionExport_LastClickId"),all:Object(ve["translate"])("AdvertisingConversionExport_AllClickIds")},Fe=Object(i["defineComponent"])({directives:{CopyToClipboard:ve["CopyToClipboard"]},props:{idExport:Number,exportTypes:{type:Object,required:!0},alreadyCreatedExportTypes:{type:Object,required:!0},clickIdProviders:{type:Object,required:!0},attributionModels:{type:Object,required:!0}},components:{ContentBlock:ve["ContentBlock"],Field:me["Field"],SegmentGenerator:be["SegmentGenerator"],Alert:ve["Alert"],SaveButton:me["SaveButton"]},data:function(){return{isDirty:!1,conversionExport:{},showNoteMessage:!1,noteMessage:"test",initialTokenValue:""}},created:function(){_e.fetchExports(),this.init()},watch:{idExport:function(e){null!==e&&this.init()}},methods:{removeAnyNotification:function(){ve["NotificationsStore"].remove(Pe),ve["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){this.removeAnyNotification();var o=ve["NotificationsStore"].show({message:e,context:t,id:Pe,type:"transient"});setTimeout((function(){ve["NotificationsStore"].scrollToNotification(o)}),100)},showErrorFieldNotProvidedNotification:function(e){var t=Object(ve["translate"])("AdvertisingConversionExport_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init:function(){var e=this,t=this.idExport;this.conversionExport={parameters:{}},ve["Matomo"].helper.lazyScrollToContent(),this.edit&&t?_e.findExport(t).then((function(t){if("".concat(null===t||void 0===t?void 0:t.idsite)!=="".concat(ve["Matomo"].idSite))return setTimeout((function(){e.showNotification(Object(ve["translate"])("AdvertisingConversionExport_UnableToLoadExport"),"error")}),200),void e.cancel();if(e.conversionExport=Object(ve["clone"])(t),e.conversionExport.parameters){var o,n,r,i=e.conversionExport.parameters;i.externalAttributedConversion=null!==(o=i.externalAttributedConversion)&&void 0!==o?o:Le,i.attributionModel=null!==(n=i.attributionModel)&&void 0!==n?n:He,i.attributedCredit=null!==(r=i.attributedCredit)&&void 0!==r?r:Ie}e.initialTokenValue&&(e.conversionExport.access_token=e.initialTokenValue),_e.fetchGoals().then((function(){e.isDirty=!1,e.addInitialExportGoal()}))})):this.create&&(this.conversionExport={idsite:ve["Matomo"].idSite,name:"",type:Object.keys(this.exportTypeOptions)[0],description:"",access_token:"",parameters:{goals:[],daysToExport:7,segment:"",onlyDirectAttribution:1,daysToLookBack:30,clickIdAttribution:"last",externalAttributedConversion:Le,attributionModel:He,attributedCredit:Ie}},this.isDirty=!1,_e.fetchGoals().then((function(){e.addInitialExportGoal()})),this.showNote())},cancel:function(){var e=Object.assign({},ve["MatomoUrl"].hashParsed.value);delete e.idExport,ve["MatomoUrl"].updateHash(e)},addInitialExportGoal:function(){var e,t;this.conversionExport&&(null!==(e=this.conversionExport.parameters)&&void 0!==e&&null!==(t=e.goals)&&void 0!==t&&t.length||this.addExportGoal())},addExportGoal:function(){var e;this.conversionExport&&(this.conversionExport.parameters||(this.conversionExport.parameters={}),null!==(e=this.conversionExport.parameters.goals)&&void 0!==e&&e.length||(this.conversionExport.parameters.goals=[]),this.conversionExport.parameters.goals=[].concat(Te(this.conversionExport.parameters.goals),[{idgoal:"",name:"",revenue:"goal"}]),this.isDirty=!0)},removeExportGoal:function(e){var t,o,n;null!==(t=this.conversionExport)&&void 0!==t&&null!==(o=t.parameters)&&void 0!==o&&null!==(n=o.goals)&&void 0!==n&&n.length&&e>-1&&(this.conversionExport.parameters.goals.splice(e,1),this.isDirty=!0)},regenerateAccessToken:function(){var e=this,t=this.idExport;t&&ve["Matomo"].helper.modalConfirm(this.$refs.confirmRegenerateAccessToken,{yes:function(){_e.regenerateAccessToken(t).then((function(t){e.conversionExport.access_token=t.value,t.value&&e.showNotification(Object(ve["translate"])("AdvertisingConversionExport_ExportUpdatedWithExportURLMessage"),"success")}))}})},createExport:function(){var e=this,t="AdvertisingConversionExport.addConversionExport";this.removeAnyNotification(),this.checkRequiredFieldsAreSet()&&(this.addGoalNameIfEmpty(),_e.createExport(this.conversionExport,t).then((function(t){e.isDirty=!1,console.log(t,"response");var o=t.response.idExport,n=t.response.accessToken;n&&(e.initialTokenValue=n),_e.reload().then((function(){ve["Matomo"].helper.isReportingPage()&&ve["Matomo"].postEvent("updateReportingMenu"),ve["MatomoUrl"].updateHash(Object.assign(Object.assign({},ve["MatomoUrl"].hashParsed.value),{},{idExport:o})),setTimeout((function(){e.showNotification(Object(ve["translate"])("AdvertisingConversionExport_ExportCreatedWithExportURLMessage"),t.type)}),200)}))})))},setValueHasChanged:function(){var e,t,o;if(this.isDirty=!0,null!==(e=this.conversionExport)&&void 0!==e&&null!==(t=e.parameters)&&void 0!==t&&null!==(o=t.goals)&&void 0!==o&&o.length){var n=[];this.conversionExport.parameters.goals.forEach((function(e){n.indexOf(e.idgoal)>=0&&(e.idgoal=null),(e.idgoal||0===e.idgoal)&&n.push(e.idgoal)}))}},showNote:function(){var e,t,o;this.showNoteMessage=!1,this.noteMessage="",null===(e=this.conversionExport)||void 0===e||!e.type||null!==(t=this.alreadyCreatedExportTypes)&&void 0!==t&&t[this.conversionExport.type]||null===(o=this.clickIdProviders)||void 0===o||!o[this.conversionExport.type]||(this.showNoteMessage=!0,this.noteMessage=Object(ve["translate"])("AdvertisingConversionExport_ExportNoteMessage",this.clickIdProviders[this.conversionExport.type].clickId,this.clickIdProviders[this.conversionExport.type].name))},updateExport:function(){var e=this;if(this.removeAnyNotification(),this.checkRequiredFieldsAreSet()){this.addGoalNameIfEmpty();var t="AdvertisingConversionExport.updateConversionExport";_e.updateExport(this.conversionExport,t).then((function(t){"error"!==t.type&&(e.isDirty=!1,e.conversionExport={parameters:{}},_e.reload().then((function(){e.init()})),e.showNotification(Object(ve["translate"])("AdvertisingConversionExport_ExportUpdated"),t.type))}))}},checkRequiredFieldsAreSet:function(){var e,t;if(!this.conversionExport.name){var o=Object(ve["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(o),!1}if(null===(e=this.conversionExport.parameters)||void 0===e||null===(t=e.goals)||void 0===t||!t.length){var n=Object(ve["translate"])("AdvertisingConversionExport_PleaseConfigureGoals");return this.showNotification(n,"error"),!1}var r=this.conversionExport.parameters.goals.some((function(e){return""!==e.idgoal&&e.idgoal>=0}));if(!r){var i=Object(ve["translate"])("AdvertisingConversionExport_PleaseConfigureGoals");return this.showNotification(i,"error"),!1}if(!this.conversionExport.parameters.daysToExport||"NaN"===this.conversionExport.parameters.daysToExport||this.conversionExport.parameters.daysToExport<1){var a=Object(ve["translate"])("AdvertisingConversionExport_PleaseConfigureDaysToExport");return this.showNotification(a,"error"),!1}return!0},showDownloadLink:function(){var e=ve["MatomoUrl"].stringify({module:"AdvertisingConversionExport",action:"generateConversionExport",accessToken:"********"===this.conversionExport.access_token?"":this.conversionExport.access_token});return"".concat(window.location.origin).concat(window.location.pathname,"?").concat(e).concat("********"===this.conversionExport.access_token?"&accessToken={YOUR_EXPORT_ACCESS_TOKEN}":"")},addGoalNameIfEmpty:function(){var e,t,o,n=this;null!==(e=this.conversionExport)&&void 0!==e&&null!==(t=e.parameters)&&void 0!==t&&null!==(o=t.goals)&&void 0!==o&&o.length&&this.conversionExport.parameters.goals.forEach((function(e,t){if(e.idgoal&&!e.name){var o,r,i=n.getGoalName(e.idgoal);null!==(o=n.conversionExport)&&void 0!==o&&null!==(r=o.parameters)&&void 0!==r&&r.goals&&(n.conversionExport.parameters.goals[t].name=i)}}))},getGoalName:function(e){if(this.goals)for(var t=0;t<this.goals.length;t+=1)if(this.goals[t].key===e)return this.goals[t].value;return""}},computed:{revenueOptions:function(){return qe},clickIdAttributionOptions:function(){return Re},exportTypeOptions:function(){var e={};return Object.values(this.exportTypes).forEach((function(t){e[t.id]=t.name})),e},exportTypeDescription:function(){return Object.values(this.exportTypes).map((function(e){return"<br/><br/><strong>".concat(e.name,"</strong><br />").concat(e.description)})).join("")},attributionModelOptions:function(){var e={};return Object.values(this.attributionModels).forEach((function(t){e[t.id]=t.translatedName})),e},create:function(){return!this.idExport},edit:function(){return!this.create},editTitle:function(){return this.create?"AdvertisingConversionExport_CreateNewExport":"AdvertisingConversionExport_EditExport"},contentTitle:function(){return Object(ve["translate"])(this.editTitle,this.conversionExport.name?'"'.concat(this.conversionExport.name,'"'):"")},isLoading:function(){return _e.state.value.isLoading},isUpdating:function(){return _e.state.value.isUpdating},isLoadingGoals:function(){return _e.state.value.isLoadingGoals},goals:function(){return _e.goals.value},conversionExportHelp:function(){var e=Object(ve["translate"])("AdvertisingConversionExport_ExportTypeHelp");return"".concat(e).concat(this.exportTypeDescription)},accessTokenInlineHelp:function(){var e=Object(ve["translate"])("AdvertisingConversionExport_AccessTokenHelp"),t=Object(ve["translate"])("AdvertisingConversionExport_DoNotShare");return"".concat(e,"<br />").concat(t)},directAttributionHelp:function(){var e=Object(ve["translate"])("AdvertisingConversionExport_DirectAttributionOnlyDescription"),t=Object(ve["translate"])("AdvertisingConversionExport_DirectAttributionOnlyNote");return"".concat(e,"<br /><br />").concat(t)},createButtonText:function(){return this.edit?Object(ve["translate"])("CoreUpdater_UpdateTitle"):Object(ve["translate"])("AdvertisingConversionExport_CreateNewExport")}}});Fe.render=ue;var $e=Fe,We={class:"index"},ze={class:"name"},Ye={class:"type"},Xe={key:0,class:"description"},Ke={class:"goals"},Je=["title"],Qe={class:"action"},Ze={colspan:"6"},et={class:"loadingPiwik"},tt=Object(i["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ot={colspan:"6"},nt=["id"],rt={class:"index"},it={class:"name"},at={class:"type"},st=["title"],lt=["title"],ct={class:"goals"},dt=["innerHTML"],pt=Object(i["createElementVNode"])("br",null,null,-1),ut={key:2,class:"requested"},vt={key:3,class:"requested"},mt={class:"action"},bt=["title","onClick"],Et=["title","onClick"],xt=["title","onClick"],ft={class:"tableActionBar"},gt=Object(i["createElementVNode"])("span",{class:"icon-add"},null,-1),ht={class:"ui-confirm",id:"confirmDeleteExport",ref:"confirmDeleteExport"},Ot=["value"],jt=["value"];function yt(e,t,o,n,r,a){var s=Object(i["resolveComponent"])("ContentBlock"),l=Object(i["resolveDirective"])("content-table");return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",null,[Object(i["createVNode"])(s,{"content-title":e.translate("AdvertisingConversionExport_ManageExports"),feature:e.translate("AdvertisingConversionExport_ManageExports")},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("p",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_ManageExportsIntroduction")),1),Object(i["withDirectives"])(Object(i["createElementVNode"])("table",null,[Object(i["createElementVNode"])("thead",null,[Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("th",We,Object(i["toDisplayString"])(e.translate("General_Id")),1),Object(i["createElementVNode"])("th",ze,Object(i["toDisplayString"])(e.translate("General_Name")),1),Object(i["createElementVNode"])("th",Ye,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_ExportType")),1),e.atLeastOneExportWithDescription?(Object(i["openBlock"])(),Object(i["createElementBlock"])("th",Xe,Object(i["toDisplayString"])(e.translate("General_Description")),1)):Object(i["createCommentVNode"])("",!0),Object(i["createElementVNode"])("th",Ke,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_IncludedConversions")),1),Object(i["createElementVNode"])("th",{class:"requested",title:e.translate("AdvertisingConversionExport_LastRequestedInfo")},Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_LastRequested")),9,Je),Object(i["createElementVNode"])("th",Qe,Object(i["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(i["createElementVNode"])("tbody",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("td",Ze,[Object(i["createElementVNode"])("span",et,[tt,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[i["vShow"],e.isLoading||e.isUpdating]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("td",ot,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_NoExportsFound")),1)],512),[[i["vShow"],!e.isLoading&&0===e.exports.length]]),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.sortedExports,(function(t){var o;return Object(i["openBlock"])(),Object(i["createElementBlock"])("tr",{id:"export".concat(t.idexport),class:"exports",key:t.idexport},[Object(i["createElementVNode"])("td",rt,Object(i["toDisplayString"])(t.idexport),1),Object(i["createElementVNode"])("td",it,Object(i["toDisplayString"])(t.name),1),Object(i["createElementVNode"])("td",at,Object(i["toDisplayString"])(e.exportTypes[t.type].name),1),e.atLeastOneExportWithDescription&&t.description.trim().length>63?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",{key:0,class:"description",title:t.description},Object(i["toDisplayString"])(t.description.trim().substring(0,60))+"...",9,st)):Object(i["createCommentVNode"])("",!0),e.atLeastOneExportWithDescription&&t.description.trim().length<=63?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",{key:1,class:"description",title:t.description},Object(i["toDisplayString"])(t.description.trim()),9,lt)):Object(i["createCommentVNode"])("",!0),Object(i["createElementVNode"])("td",ct,[(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])((null===(o=t.parameters)||void 0===o?void 0:o.goals)||[],(function(t){var o;return Object(i["openBlock"])(),Object(i["createElementBlock"])("span",{key:t.idgoal},[Object(i["createTextVNode"])(Object(i["toDisplayString"])((null===(o=e.goals.find((function(e){return e.key==="".concat(t.idgoal)})))||void 0===o?void 0:o.value)||e.translate("General_Unknown"))+" ",1),Object(i["createElementVNode"])("span",{innerHTML:e.$sanitize(e.getDisplayGoalName(t))},null,8,dt),pt])})),128))]),t.ts_requested?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",ut,Object(i["toDisplayString"])(t.ts_requested_pretty),1)):Object(i["createCommentVNode"])("",!0),t.ts_requested?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",vt,Object(i["toDisplayString"])(e.translate("General_Never")),1)),Object(i["createElementVNode"])("td",mt,[Object(i["createElementVNode"])("a",{class:"table-action icon-download",title:e.translate("AdvertisingConversionExport_DownloadExport"),onClick:function(o){return e.openExport(t.idexport,t.idsite)}},null,8,bt),Object(i["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("AdvertisingConversionExport_EditExport"),onClick:function(o){return e.editExport(t.idexport)}},null,8,Et),Object(i["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("AdvertisingConversionExport_DeleteExport"),onClick:function(o){return e.deleteExport(t)}},null,8,xt)])],8,nt)})),128))])],512),[[l]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",ft,[Object(i["createElementVNode"])("a",{class:"createNewExport",onClick:t[0]||(t[0]=function(t){return e.createExport()})},[gt,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_CreateNewExport")),1)])],512),[[i["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","feature"]),Object(i["createElementVNode"])("div",ht,[Object(i["createElementVNode"])("h2",null,Object(i["toDisplayString"])(e.translate("AdvertisingConversionExport_DeleteExportConfirm")),1),Object(i["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ot),Object(i["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,jt)],512)])}function Ct(e){return kt(e)||Vt(e)||At(e)||Nt()}function Nt(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){if(e){if("string"===typeof e)return St(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?St(e,t):void 0}}function Vt(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function kt(e){if(Array.isArray(e))return St(e)}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}var wt=Object(i["defineComponent"])({props:{exportTypes:{type:Object,required:!0},alreadyCreatedExportTypes:{type:Object,required:!0},clickIdProviders:{type:Object,required:!0},hasWriteAccess:Boolean},components:{ContentBlock:ve["ContentBlock"]},directives:{ContentTable:ve["ContentTable"]},data:function(){return{exportLink:""}},created:function(){_e.fetchExports()},methods:{getDisplayGoalName:function(e){return e.name?"(&#x279C;&nbsp;".concat(ve["Matomo"].helper.htmlEntities(e.name),")"):""},getDownloadLink:function(e,t){var o=ve["MatomoUrl"].stringify({module:"AdvertisingConversionExport",action:"downloadConversionExport",idExport:e,idSite:t});return"".concat(window.location.origin).concat(window.location.pathname,"?").concat(o)},createExport:function(){this.editExport(0)},editExport:function(e){ve["MatomoUrl"].updateHash(Object.assign(Object.assign({},ve["MatomoUrl"].hashParsed.value),{},{idExport:e}))},openExport:function(e,t){window.open(this.getDownloadLink(e,t))},deleteExport:function(e){ve["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteExport,{yes:function(){_e.deleteExport(parseInt(e.idexport,10)).then((function(){_e.reload()}))}})}},computed:{atLeastOneExportWithDescription:function(){return _e.exports.value.filter((function(e){return!!e.description})).length},isLoading:function(){return _e.state.value.isLoading},isUpdating:function(){return _e.state.value.isUpdating},exports:function(){return _e.exports.value},sortedExports:function(){var e=Ct(this.exports);return e.sort((function(e,t){return parseInt("".concat(e.idexport),10)-parseInt("".concat(t.idexport),10)})),e},goals:function(){return _e.goals.value||[]}}});wt.render=yt;var _t=wt,Tt={class:"manageConversionExport"},Dt={key:0},Mt={key:1};function Gt(e,t,o,n,r,a){var s=Object(i["resolveComponent"])("ConversionExportList"),l=Object(i["resolveComponent"])("ConversionExportEdit");return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Tt,[e.editMode?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Dt,[Object(i["createVNode"])(s,{"export-types":e.exportTypes,"already-created-export-types":e.alreadyCreatedExportTypes,"click-id-providers":e.clickIdProviders,"attribution-models":e.attributionModels,"has-write-access":e.hasWriteAccess},null,8,["export-types","already-created-export-types","click-id-providers","attribution-models","has-write-access"])])),e.editMode?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",Mt,[Object(i["createVNode"])(l,{"id-export":e.idExport,"export-types":e.exportTypes,"already-created-export-types":e.alreadyCreatedExportTypes,"click-id-providers":e.clickIdProviders,"attribution-models":e.attributionModels},null,8,["id-export","export-types","already-created-export-types","click-id-providers","attribution-models"])])):Object(i["createCommentVNode"])("",!0)])}var Ut=Object(i["defineComponent"])({props:{exportTypes:{type:Object,required:!0},alreadyCreatedExportTypes:{type:Object,required:!0},clickIdProviders:{type:Object,required:!0},attributionModels:{type:Object,required:!0},hasWriteAccess:Boolean},components:{ConversionExportEdit:$e,ConversionExportList:_t},data:function(){return{editMode:!1,idExport:null}},created:function(){var e=this;Object(i["watch"])((function(){return ve["MatomoUrl"].hashParsed.value.idExport}),(function(t){e.initState(t)})),this.initState(ve["MatomoUrl"].hashParsed.value.idExport)},methods:{removeAnyNotification:function(){ve["NotificationsStore"].remove("conversionexportmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(ve["Matomo"].postEvent("AdvertisingConversionExport.initAddExport",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idExport=null)}this.editMode=!0,this.idExport=parseInt(e,10)}else this.editMode=!1,this.idExport=null;this.removeAnyNotification()}}});Ut.render=Gt;var Bt=Ut;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue")):"function"===typeof define&&define.amd?define(["CoreHome"],t):"object"===typeof exports?exports["CustomVariables"]=t(require("CoreHome"),require("vue")):e["CustomVariables"]=t(e["CoreHome"],e["Vue"])})("undefined"!==typeof self?self:this,(function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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/CustomVariables/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ManageCustomVarsStore",(function(){return j})),n.d(t,"ManageCustomVars",(function(){return H})),"undefined"!==typeof window){var r=window.document.currentScript,a=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(n.p=a[1])}var o=n("8bbf"),l=n("19dc");function i(e,t){return m(e)||b(e,t)||s(e,t)||c()}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){if(e){if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done);l=!0)if(o.push(r.value),t&&o.length===t)break}catch(c){i=!0,a=c}finally{try{l||null==n["return"]||n["return"]()}finally{if(i)throw a}}return o}}function m(e){if(Array.isArray(e))return e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function v(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 http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var O=function(){function e(){var t=this;d(this,e),v(this,"privateState",Object(o["reactive"])({customVariables:[],isLoading:!1,hasCustomVariablesInGeneral:!1,hasAtLeastOneUsage:!1,numSlotsAvailable:5})),v(this,"state",Object(o["computed"])((function(){return Object(o["readonly"])(t.privateState)})))}return p(e,[{key:"init",value:function(){return this.fetchUsages()}},{key:"fetchCustomVariables",value:function(){var e=this;return l["AjaxHelper"].fetch({method:"CustomVariables.getCustomVariables",period:"year",date:"today",filter_limit:1}).then((function(t){e.privateState.hasCustomVariablesInGeneral=(null===t||void 0===t?void 0:t.length)>0}))}},{key:"fetchUsages",value:function(){var e=this;return this.privateState.isLoading=!0,Promise.all([this.fetchCustomVariables(),l["AjaxHelper"].fetch({method:"CustomVariables.getUsagesOfSlots",filter_limit:"-1"})]).then((function(t){var n=i(t,2),r=n[1];e.privateState.customVariables=r,r.forEach((function(t){t.index>e.state.value.numSlotsAvailable&&(e.privateState.numSlotsAvailable=t.index),t.usages&&t.usages.length>0&&(e.privateState.hasAtLeastOneUsage=!0)}))})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),j=new O,h={class:"manageCustomVars"},g=["innerHTML"],y={class:"index"},V=["title"],C={key:0},S=Object(o["createElementVNode"])("br",null,null,-1),E=Object(o["createElementVNode"])("br",null,null,-1),N=["innerHTML"],w=Object(o["createElementVNode"])("br",null,null,-1),x=Object(o["createElementVNode"])("br",null,null,-1),_=Object(o["createElementVNode"])("br",null,null,-1),k=["textContent"];function A(e,t,n,r,a,l){var i=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("ContentBlock"),s=Object(o["resolveDirective"])("content-intro"),u=Object(o["resolveDirective"])("content-table"),b=Object(o["resolveDirective"])("select-on-focus");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",h,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("h2",null,[Object(o["createVNode"])(i,{"help-url":"https://matomo.org/docs/custom-variables/"},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("CustomVariables_CustomVariables")),1)]})),_:1})]),Object(o["createElementVNode"])("p",null,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("CustomVariables_ManageDescription",e.siteName))},null,8,g)])],512),[[s]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"alert alert-info"},Object(o["toDisplayString"])(e.translate("CustomVariables_SlotsReportIsGeneratedOverTime")),513),[[o["vShow"],!e.isLoading&&e.hasCustomVariablesInGeneral&&!e.hasAtLeastOneUsage]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.scopes,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:t.name},[Object(o["createVNode"])(c,{"content-title":e.translate("CustomVariables_ScopeX",t.name)},{default:Object(o["withCtx"])((function(){return[Object(o["withDirectives"])(Object(o["createElementVNode"])("table",null,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",null,Object(o["toDisplayString"])(e.translate("CustomVariables_Index")),1),Object(o["createElementVNode"])("th",null,Object(o["toDisplayString"])(e.translate("CustomVariables_Usages")),1)])]),Object(o["createElementVNode"])("tbody",null,[Object(o["createElementVNode"])("tr",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("td",{colspan:"3"},Object(o["toDisplayString"])(e.translate("General_Loading")),513),[[o["vShow"],e.isLoading]])]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.customVariablesByScope[t.value],(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",{key:n},[Object(o["createElementVNode"])("td",y,Object(o["toDisplayString"])(t.index),1),Object(o["createElementVNode"])("td",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"unused"},Object(o["toDisplayString"])(e.translate("CustomVariables_Unused")),513),[[o["vShow"],0===t.usages.length]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sortUsages(t),(function(n,r){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:r},[Object(o["createElementVNode"])("span",{title:e.translate("CustomVariables_UsageDetails",n.nb_visits?n.nb_visits:0,n.nb_actions?n.nb_actions:0)},Object(o["toDisplayString"])(n.name),9,V),r<t.usages.length-1?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",C,", ")):Object(o["createCommentVNode"])("",!0)],512)),[[o["vShow"],t.usages.length]])})),128))])])})),128))])],512),[[u]])]})),_:2},1032,["content-title"])])})),128)),Object(o["withDirectives"])(Object(o["createVNode"])(c,{id:"CustomVariablesCreateNewSlot","content-title":e.translate("CustomVariables_CreateNewSlot")},{default:Object(o["withCtx"])((function(){return[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("p",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("CustomVariables_CreatingCustomVariableTakesTime"))+" ",1),S,E,Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.currentAvailableCustomVariablesText)},null,8,N),w,x,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("CustomVariables_ToCreateCustomVarExecute"))+" ",1),_]),Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",{textContent:Object(o["toDisplayString"])(e.setMaxCustomVariablesCmd)},null,8,k)],512),[[b,{}]])],512),[[o["vShow"],!e.isLoading]])]})),_:1},8,["content-title"]),[[o["vShow"],!e.isLoading]])])}function D(e){return I(e)||B(e)||T(e)||L()}function L(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){if(e){if("string"===typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}function B(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return M(e)}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var U=Object(o["defineComponent"])({components:{EnrichedHeadline:l["EnrichedHeadline"],ContentBlock:l["ContentBlock"]},directives:{ContentIntro:l["ContentIntro"],ContentTable:l["ContentTable"],SelectOnFocus:l["SelectOnFocus"]},data:function(){return{siteName:l["Matomo"].siteName,scopes:[{value:"visit",name:Object(l["translate"])("General_TrackingScopeVisit")},{value:"page",name:Object(l["translate"])("General_TrackingScopePage")}]}},created:function(){j.init()},methods:{sortUsages:function(e){var t=D(e.usages);return t.sort((function(e,t){var n="".concat(t.nb_actions),r="".concat(e.nb_actions);return parseInt(n,10)-parseInt(r,10)})),t}},computed:{isLoading:function(){return j.state.value.isLoading},hasCustomVariablesInGeneral:function(){return j.state.value.hasCustomVariablesInGeneral},hasAtLeastOneUsage:function(){return j.state.value.hasAtLeastOneUsage},numSlotsAvailable:function(){return j.state.value.numSlotsAvailable},customVariablesByScope:function(){var e={};return j.state.value.customVariables.forEach((function(t){e[t.scope]=e[t.scope]||[],e[t.scope].push(t)})),e},currentAvailableCustomVariablesText:function(){return Object(l["translate"])("CustomVariables_CurrentAvailableCustomVariables","<strong>".concat(this.numSlotsAvailable,"</strong>"))},setMaxCustomVariablesCmd:function(){return"./console customvariables:set-max-custom-variables ".concat(this.numSlotsAvailable+1)}}});U.render=A;var H=U;
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */}})}));
//# 
(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["FormAnalytics"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["FormAnalytics"]=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 r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));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/FormAnalytics/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,"FormEdit",(function(){return Me})),n.d(t,"FormsList",(function(){return gt})),n.d(t,"FormsManage",(function(){return _t})),n.d(t,"FormFields",(function(){return It})),n.d(t,"FormPageLink",(function(){return zt})),n.d(t,"FormSummary",(function(){return yn})),"undefined"!==typeof window){var o=window.document.currentScript,r=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(n.p=r[1])}var a=n("8bbf"),i={class:"loadingPiwik"},l=Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),c={class:"loadingPiwik"},s=Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),m={name:"name"},u={name:"description"},d={class:"form-group row",style:{"margin-bottom":"0"}},p={class:"col s12"},f={class:"form-group row",style:{"margin-bottom":"0"}},b={class:"col s12"},h=["innerHTML"],v=["title"],O={class:"form-group row"},j={class:"col s12 m4 matchAttribute"},g={name:"matchAttribute"},y={class:"col s12 m4 matchPattern"},F={name:"matchType"},V={class:"col s12 m4"},N={name:"matchValue"},E=["title"],_=["title","onClick"],S={name:"matchPageOnly"},A={class:"form-group row",style:{"margin-bottom":"0"}},k={class:"col s12"},C={class:"form-group row",style:{"margin-bottom":"0"}},w={class:"col s12"},R=["title"],D={class:"form-group row"},M={class:"col s12 m4 matchAttribute"},B={name:"matchAttribute"},x={class:"col s12 m4 matchPattern"},T={name:"matchType"},P={class:"col s12 m4"},H={name:"matchValue"},U=["title"],L=["title","onClick"],I={class:"form-group row",style:{"margin-bottom":"0"}},G={class:"col s12"},q={name:"conversionRuleOption"},z={key:0,class:"form-group row"},K={id:"javascript-tracking",class:"col s6"},J=["innerHTML"],W=["innerHTML"],X=["innerHTML"],Y={class:"form-group row",style:{"margin-bottom":"0"}},Q={class:"col s12"},Z=["title"],ee={class:"form-group row"},te={class:"col s12 m4 matchAttribute"},ne={name:"matchAttribute"},oe={class:"col s12 m4 matchPattern"},re={name:"matchType"},ae={class:"col s12 m4"},ie={name:"matchValue"},le=["title"],ce=["title","onClick"],se={class:"form-group row",style:{"margin-bottom":"0"}},me={class:"col s12"},ue={class:"form-group row",style:{"margin-bottom":"0"}},de={class:"col s12"},pe=["textContent"],fe={class:"form-group row"},be={class:"col s6 trackGoal"},he={class:"entityCancel"};function ve(e,t,n,o,r,$){var ve=this,Oe=Object(a["resolveComponent"])("Field"),je=Object(a["resolveComponent"])("SaveButton"),ge=Object(a["resolveComponent"])("ContentBlock"),ye=Object(a["resolveDirective"])("select-on-focus");return Object(a["openBlock"])(),Object(a["createBlock"])(ge,{class:"editForm","content-title":e.contentTitle},{default:Object(a["withCtx"])((function(){return[Object(a["withDirectives"])(Object(a["createElementVNode"])("p",null,[Object(a["createElementVNode"])("span",i,[l,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[a["vShow"],e.isLoading]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("p",null,[Object(a["createElementVNode"])("span",c,[s,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_UpdatingData")),1)])],512),[[a["vShow"],e.isUpdating]]),Object(a["createElementVNode"])("form",{onSubmit:t[10]||(t[10]=function(t){return e.edit?e.updateForm():e.createForm()})},[Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",m,[Object(a["createVNode"])(Oe,{uicontrol:"text",name:"name","model-value":e.form.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.form.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("FormAnalytics_FieldNamePlaceholder"),"inline-help":e.translate("FormAnalytics_FormNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(a["createElementVNode"])("div",u,[Object(a["createVNode"])(Oe,{uicontrol:"textarea",name:"description","model-value":e.form.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.form.description=t,e.setValueHasChanged()}),title:"".concat(e.translate("General_Description")," (optional)"),maxlength:1e3,rows:3,placeholder:e.translate("FormAnalytics_FieldDescriptionPlaceholder"),"inline-help":e.translate("FormAnalytics_FormDescriptionHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(a["createElementVNode"])("div",d,[Object(a["createElementVNode"])("div",p,[Object(a["createElementVNode"])("h3",null,"1) "+Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupFormRules")),1)])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",f,[Object(a["createElementVNode"])("div",b,[Object(a["createElementVNode"])("p",null,[Object(a["createElementVNode"])("span",{innerHTML:e.$sanitize(e.formSetupRulesHelp)},null,8,h),Object(a["createElementVNode"])("span",{style:{"margin-left":"3.5px"},class:"icon-help",title:e.translate("FormAnalytics_ComparisonsCaseInsensitive")},null,8,v)])])],512),[[a["vShow"],!e.matchPageOnly]]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.form.match_form_rules,(function(n,o){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])("matchFormRules ".concat(o," valign-wrapper")),key:o},[Object(a["createElementVNode"])("div",O,[Object(a["createElementVNode"])("div",j,[Object(a["createElementVNode"])("div",g,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchAttribute","model-value":n.attribute,"onUpdate:modelValue":function(t){n.attribute=t,e.setValueHasChanged(),e.matchFormRuleChanged()},"full-width":!0,options:e.formRulesAttributes},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",y,[Object(a["createElementVNode"])("div",F,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchType","model-value":n.pattern,"onUpdate:modelValue":function(t){n.pattern=t,e.setValueHasChanged(),e.matchFormRuleChanged()},"full-width":!0,options:e.formRulesPatterns[n.attribute]},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",V,[Object(a["createElementVNode"])("div",N,[Object(a["createVNode"])(Oe,{uicontrol:"text",name:"matchValue",placeholder:"eg '".concat(e.formRulesExamples[n.attribute],"'"),"model-value":n.value,"onUpdate:modelValue":function(t){n.value=t,e.setValueHasChanged(),e.matchFormRuleChanged()},"full-width":!0,maxlength:1e3},null,8,["placeholder","model-value","onUpdate:modelValue"])])])]),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("span",{class:"icon-plus",title:e.translate("General_Add"),onClick:t[2]||(t[2]=function(t){return e.addMatchFormRule()})},null,8,E),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{class:"icon-minus",title:e.translate("General_Remove"),onClick:function(t){return e.removeMatchFormRule(o)}},null,8,_),[[a["vShow"],e.form.match_form_rules.length>1]])])],2)),[[a["vShow"],!e.matchPageOnly]])})),128)),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",S,[Object(a["createVNode"])(Oe,{uicontrol:"checkbox",name:"matchPageOnly","model-value":e.matchPageOnly,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.matchPageOnly=t,e.setValueHasChanged()}),title:e.translate("FormAnalytics_SettingAllowCreationByPageOnly"),"inline-help":e.translate("FormAnalytics_SettingAllowCreationByPageOnlyDescription")},null,8,["model-value","title","inline-help"])])]),Object(a["createElementVNode"])("div",A,[Object(a["createElementVNode"])("div",k,[Object(a["createElementVNode"])("h3",null,"2) "+Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupPageRules"))+":",1)])]),Object(a["createElementVNode"])("div",C,[Object(a["createElementVNode"])("div",w,[Object(a["createElementVNode"])("p",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupPageRulesHelp"))+" ",1),Object(a["createElementVNode"])("span",{class:"icon-help",title:e.setupPageRulesHelpTooltip},null,8,R)])])]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.form.match_page_rules,(function(n,o){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])("matchPageRules ".concat(o," valign-wrapper")),key:o},[Object(a["createElementVNode"])("div",D,[Object(a["createElementVNode"])("div",M,[Object(a["createElementVNode"])("div",B,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchAttribute","model-value":n.attribute,"onUpdate:modelValue":function(t){n.attribute=t,e.setValueHasChanged()},"full-width":!0,options:e.pageRulesAttributes},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",x,[Object(a["createElementVNode"])("div",T,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchType","model-value":n.pattern,"onUpdate:modelValue":function(t){n.pattern=t,e.setValueHasChanged()},"full-width":!0,options:e.pageRulesPatterns[n.attribute]},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",P,[Object(a["createElementVNode"])("div",H,[Object(a["createVNode"])(Oe,{uicontrol:"text",name:"matchValue",placeholder:"eg '".concat(e.pageRulesExamples[n.attribute],"'"),"model-value":n.value,"onUpdate:modelValue":function(t){n.value=t,e.setValueHasChanged()},"full-width":!0,maxlength:1e3},null,8,["placeholder","model-value","onUpdate:modelValue"])])])]),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("span",{class:"icon-plus",title:e.translate("General_Add"),onClick:t[4]||(t[4]=function(t){return e.addMatchPageRule()})},null,8,U),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{class:"icon-minus",title:e.translate("General_Remove"),onClick:function(t){return e.removeMatchPageRule(o)}},null,8,L),[[a["vShow"],e.form.match_page_rules.length>1]])])],2)})),128)),Object(a["createElementVNode"])("div",I,[Object(a["createElementVNode"])("div",G,[Object(a["createElementVNode"])("h3",null,"3) "+Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupConversionRulesTitle"))+":",1)])]),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",q,[Object(a["createVNode"])(Oe,{uicontrol:"radio",name:"conversionRuleOption","model-value":e.conversionRuleOption,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.conversionRuleOption=t,e.setValueHasChanged(),e.conversionRuleOptionChanged()}),title:e.translate("FormAnalytics_FormSetupTitle"),"inline-help":e.$sanitize(e.getInlineHelpByConversionOption),options:e.conversionRuleOptions},null,8,["model-value","title","inline-help","options"])])]),"manually"===e.conversionRuleOption?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",z,[Object(a["createElementVNode"])("div",K,[Object(a["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("FormAnalytics_FormSetupConversionRulesManualConversionJsOrTagManagerDescription"))},null,8,J),Object(a["withDirectives"])(Object(a["createElementVNode"])("pre",{class:"codeblock",innerHTML:e.$sanitize(e.jsCode)},null,8,W),[[ye,{}]]),Object(a["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getJsOrTagManagerHelpCode)},null,8,X)])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",Y,[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",Q,[Object(a["createElementVNode"])("p",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupPageRulesHelpNew"))+" ",1),Object(a["createElementVNode"])("span",{class:"icon-help",title:e.setupPageRulesHelpTooltip},null,8,Z)])],512),[[a["vShow"],"page_visit"===e.conversionRuleOption]])]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.form.conversion_rules,(function(n,o){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])("conversionRules ".concat(o," valign-wrapper")),key:o},[Object(a["createElementVNode"])("div",ee,[Object(a["createElementVNode"])("div",te,[Object(a["createElementVNode"])("div",ne,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchAttribute","model-value":n.attribute,"onUpdate:modelValue":function(t){n.attribute=t,e.setValueHasChanged()},"full-width":!0,options:e.pageRulesAttributes},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",oe,[Object(a["createElementVNode"])("div",re,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"matchType","model-value":n.pattern,"onUpdate:modelValue":function(t){n.pattern=t,e.setValueHasChanged()},"full-width":!0,options:e.pageRulesPatterns[n.attribute]},null,8,["model-value","onUpdate:modelValue","options"])])]),Object(a["createElementVNode"])("div",ae,[Object(a["createElementVNode"])("div",ie,[Object(a["createVNode"])(Oe,{uicontrol:"text",name:"matchValue",placeholder:"eg '".concat(e.pageRulesExamples[n.attribute],"'"),"model-value":n.value,"onUpdate:modelValue":function(t){n.value=t,e.setValueHasChanged()},"full-width":!0,maxlength:1e3},null,8,["placeholder","model-value","onUpdate:modelValue"])])])]),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("span",{class:"icon-plus",title:e.translate("General_Add"),onClick:t[6]||(t[6]=function(t){return e.addConversionRule()})},null,8,le),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{class:"icon-minus",title:e.translate("General_Remove"),onClick:function(t){return e.removeConversionRule(o)}},null,8,ce),[[a["vShow"],e.form.conversion_rules.length>1]])])],2)),[[a["vShow"],"page_visit"===e.conversionRuleOption]])})),128)),Object(a["createElementVNode"])("div",se,[Object(a["createElementVNode"])("div",me,[Object(a["createElementVNode"])("h3",null,"4) "+Object(a["toDisplayString"])(e.translate("FormAnalytics_GoalConversionRulesTitle"))+":",1)])]),Object(a["createElementVNode"])("div",ue,[Object(a["createElementVNode"])("div",de,[Object(a["createElementVNode"])("label",{style:{color:"unset !important"},textContent:Object(a["toDisplayString"])(e.translate("FormAnalytics_GoalConversionRulesDescription"))},null,8,pe)])]),Object(a["createElementVNode"])("div",fe,[Object(a["createElementVNode"])("div",be,[Object(a["createVNode"])(Oe,{uicontrol:"select",name:"goal","model-value":e.idGoal,"onUpdate:modelValue":t[7]||(t[7]=function(t){ve.form.idgoal=t,e.setValueHasChanged()}),options:ve.allGoals},null,8,["model-value","options"])])]),Object(a["createVNode"])(je,{class:"createButton",onConfirm:t[8]||(t[8]=function(t){return e.edit?e.updateForm():e.createForm()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.createButtonText},null,8,["disabled","saving","value"]),Object(a["createElementVNode"])("div",he,[Object(a["createElementVNode"])("a",{onClick:t[9]||(t[9]=function(t){return e.cancel()})},Object(a["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}var Oe=n("19dc"),je=n("a5a2");function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ye(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Fe(e,t,n){return t&&ye(e.prototype,t),n&&ye(e,n),e}function Ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var Ne=function(){function e(){var t=this;ge(this,e),Ve(this,"privateState",Object(a["reactive"])({forms:[],isLoading:!1,isUpdating:!1,filterStatus:"running"})),Ve(this,"state",Object(a["computed"])((function(){return Object(a["readonly"])(t.privateState)}))),Ve(this,"fetchPromise",{})}return Fe(e,[{key:"reload",value:function(){return this.privateState.forms=[],this.fetchPromise={},this.fetchForms()}},{key:"filterRules",value:function(e){return e.filter((function(e){return!(null===e||void 0===e||!e.value)}))}},{key:"getAvailableFormRules",value:function(){return Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAvailableFormRules",filter_limit:"-1"})}},{key:"getAvailablePageRules",value:function(){return Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAvailablePageRules",filter_limit:"-1"})}},{key:"getAvailableConversionRuleOptions",value:function(){return Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAvailableConversionRuleOptions",filter_limit:"-1"})}},{key:"fetchAvailableStatuses",value:function(){return Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAvailableStatuses"})}},{key:"getAllGoals",value:function(e){return Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAllGoals",idSite:e})}},{key:"fetchForms",value:function(){var e=this,t="FormAnalytics.getFormsByStatuses".concat(this.privateState.filterStatus);return this.fetchPromise[t]||(this.fetchPromise[t]=Oe["AjaxHelper"].fetch({method:"FormAnalytics.getFormsByStatuses",filter_limit:"-1",statuses:this.privateState.filterStatus})),this.privateState.isLoading=!0,this.privateState.forms=[],this.fetchPromise[t].then((function(t){return e.privateState.forms=t,e.privateState.isLoading=!1,e.state.value.forms})).finally((function(){e.privateState.isLoading=!1}))}},{key:"findForm",value:function(e){var t=this,n=this.state.value.forms.find((function(t){return t.idsiteform===e}));return n?Promise.resolve(n):(this.privateState.isLoading=!0,Oe["AjaxHelper"].fetch({idForm:e,method:"FormAnalytics.getForm"}).then((function(e){return Object(a["readonly"])(e)})).finally((function(){t.privateState.isLoading=!1})))}},{key:"deleteForm",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.forms=[],Oe["AjaxHelper"].fetch({idForm:e,method:"FormAnalytics.deleteForm"},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"archiveForm",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.forms=[],Oe["AjaxHelper"].fetch({idForm:e,method:"FormAnalytics.archiveForm"},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createOrUpdateForm",value:function(e,t,n){var o=this;return this.privateState.isUpdating=!0,Oe["AjaxHelper"].post({method:n,idForm:e.idsiteform,idGoal:e.idgoal,name:e.name.trim(),description:e.description.trim(),conversionRuleOption:e.conversion_rule_option},{matchFormRules:this.filterRules(t?[]:e.match_form_rules),matchPageRules:this.filterRules(e.match_page_rules),conversionRules:this.filterRules(e.conversion_rules)},{withTokenInUrl:!0}).then((function(e){return{type:"success",response:e}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){o.privateState.isUpdating=!1}))}},{key:"setFilterStatus",value:function(e){this.privateState.filterStatus=e}}]),e}(),Ee=new Ne;function _e(e){return Ce(e)||ke(e)||Ae(e)||Se()}function Se(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ae(e,t){if(e){if("string"===typeof e)return we(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?we(e,t):void 0}}function ke(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ce(e){if(Array.isArray(e))return we(e)}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var Re="formsmanagement",De=Object(a["defineComponent"])({props:{idForm:Number},components:{ContentBlock:Oe["ContentBlock"],Field:je["Field"],SaveButton:je["SaveButton"]},directives:{SelectOnFocus:Oe["SelectOnFocus"]},data:function(){return{isDirty:!1,formRules:[],pageRules:[],matchPageOnly:!1,conversionRuleOptions:[],conversionRuleOption:"",idGoal:"",form:{},jsCode:"_paq.push(['FormAnalytics::trackFormConversion', '{formName}', '{formId}']);",learMoreAppended:!1,allGoals:[]}},created:function(){var e=this;Ee.getAvailableFormRules().then((function(t){e.formRules=t})),Ee.getAvailablePageRules().then((function(t){e.pageRules=t})),Ee.getAvailableConversionRuleOptions().then((function(t){e.conversionRuleOptions=t})),Ee.getAllGoals(Oe["Matomo"].idSite).then((function(t){e.allGoals=t})),this.init()},watch:{idForm:function(e){null!==e&&this.init()}},methods:{removeAnyFormNotification:function(){Oe["NotificationsStore"].remove(Re),Oe["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=Oe["NotificationsStore"].show({message:e,context:t,id:Re,type:"transient"});setTimeout((function(){Oe["NotificationsStore"].scrollToNotification(n)}),100)},showErrorFieldNotProvidedNotification:function(e){var t=Object(Oe["translate"])("FormAnalytics_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init:function(){var e=this,t=this.idForm;this.form={},Oe["Matomo"].helper.lazyScrollToContent(),setTimeout((function(){if(!e.learMoreAppended){e.learMoreAppended=!0;var t="https://matomo.org/faq/form-analytics/faq_23774/",n=Object(Oe["translate"])("FormAnalytics_FormSetupConversionRulesFaqHelpLink",' <a target="blank" rel="noreferrer" href="'.concat(t,'">'),"</a>");$(".fieldRadioTitle").append(n)}}),200),this.edit&&t?Ee.findForm(t).then((function(t){var n;t&&(e.form=Object(Oe["clone"])(t),e.matchPageOnly=!(null!==(n=e.form.match_form_rules)&&void 0!==n&&n.length),e.conversionRuleOption=e.form.conversion_rule_option,e.idGoal=e.form.idgoal?e.form.idgoal:"",e.addInitialMatchFormRule(),e.addInitialMatchPageRule(),e.addInitialConversionRule(),e.isDirty=!1)})):this.create&&(this.form={idSite:Oe["Matomo"].idSite,name:"",description:"",status:"running"},this.matchPageOnly=!1,this.conversionRuleOption="page_visit",this.addInitialMatchFormRule(),this.addInitialMatchPageRule(),this.addInitialConversionRule(),this.isDirty=!1)},addInitialMatchFormRule:function(){var e,t;null!==(e=this.form)&&void 0!==e&&null!==(t=e.match_form_rules)&&void 0!==t&&t.length?this.matchFormRuleChanged():this.addMatchFormRule()},addMatchFormRule:function(){this.form&&(this.form.match_form_rules=[].concat(_e(this.form.match_form_rules||[]),[{attribute:"form_name",pattern:"equals",value:""}]),this.isDirty=!0)},addInitialMatchPageRule:function(){var e,t;null!==(e=this.form)&&void 0!==e&&null!==(t=e.match_page_rules)&&void 0!==t&&t.length||this.addMatchPageRule()},addMatchPageRule:function(){this.form&&(this.form.match_page_rules=[].concat(_e(this.form.match_page_rules||[]),[{attribute:"page_url",pattern:"equals",value:""}]),this.isDirty=!0)},addInitialConversionRule:function(){var e,t;null!==(e=this.form)&&void 0!==e&&null!==(t=e.conversion_rules)&&void 0!==t&&t.length||this.addConversionRule()},addConversionRule:function(){this.form&&(this.form.conversion_rules=[].concat(_e(this.form.conversion_rules||[]),[{attribute:"page_url",pattern:"equals",value:""}]),this.isDirty=!0)},removeConversionRule:function(e){this.form&&e>-1&&(this.form.conversion_rules=_e(this.form.conversion_rules),this.form.conversion_rules.splice(e,1),this.isDirty=!0)},removeMatchFormRule:function(e){this.form&&e>-1&&(this.form.match_form_rules=_e(this.form.match_form_rules),this.form.match_form_rules.splice(e,1),this.isDirty=!0)},removeMatchPageRule:function(e){this.form&&e>-1&&(this.form.match_page_rules=_e(this.form.match_page_rules),this.form.match_page_rules.splice(e,1),this.isDirty=!0)},cancel:function(){var e=Object.assign({},Oe["MatomoUrl"].hashParsed.value);delete e.idForm,Oe["MatomoUrl"].updateHash(e)},createForm:function(){var e=this,t="FormAnalytics.addForm";this.removeAnyFormNotification(),this.checkRequiredFieldsAreSet()&&(this.form.conversion_rule_option=this.conversionRuleOption,Ee.createOrUpdateForm(this.form,this.matchPageOnly,t).then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var n=t.response.value;Ee.reload().then((function(){Oe["Matomo"].helper.isReportingPage()&&Oe["Matomo"].postEvent("updateReportingMenu"),Oe["MatomoUrl"].updateHash(Object.assign(Object.assign({},Oe["MatomoUrl"].hashParsed.value),{},{idForm:n})),setTimeout((function(){e.showNotification(Object(Oe["translate"])("FormAnalytics_FormCreated"),t.type)}),200)}))}})))},setValueHasChanged:function(){this.isDirty=!0},conversionRuleOptionChanged:function(){"page_visit"!==this.conversionRuleOption&&(this.form.conversion_rules=[{attribute:"page_url",pattern:"equals",value:""}])},matchFormRuleChanged:function(){if(this.form.match_form_rules.length){for(var e="",t="",n=0;n<this.form.match_form_rules.length;n+=1){var o=this.form.match_form_rules[n];"form_name"!==o.attribute||"equals_exactly"!==o.pattern&&"equals"!==o.pattern||!o.value?"form_id"!==o.attribute||"equals_exactly"!==o.pattern&&"equals"!==o.pattern||!o.value||(t=this.htmlEntities(o.value)):e=this.htmlEntities(o.value)}this.jsCode=e&&t?"_paq.push(['FormAnalytics::trackFormConversion', '".concat(e,"', '").concat(t,"']);"):e&&!t?"_paq.push(['FormAnalytics::trackFormConversion', '".concat(e,"']);"):!e&&t?"_paq.push(['FormAnalytics::trackFormConversion', '{formName}', '".concat(t,"']);"):"_paq.push(['FormAnalytics::trackFormConversion', '{formName}', '{formId}']);"}},updateForm:function(){var e=this;if(this.removeAnyFormNotification(),this.checkRequiredFieldsAreSet()){var t="FormAnalytics.updateForm";this.form.conversion_rule_option=this.conversionRuleOption,Ee.createOrUpdateForm(this.form,this.matchPageOnly,t).then((function(t){"error"!==t.type&&(e.isDirty=!1,e.form={},Ee.reload().then((function(){e.init()})),e.showNotification(Object(Oe["translate"])("FormAnalytics_FormUpdated"),t.type))}))}},checkRequiredFieldsAreSet:function(){var e;if(!this.form.name){var t=Object(Oe["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(t),!1}if("page_visit"===this.conversionRuleOption&&!this.matchPageOnly&&!Ee.filterRules((null===(e=this.form)||void 0===e?void 0:e.match_form_rules)||[]).length){var n=Object(Oe["translate"])("FormAnalytics_ErrorFormRuleRequired");return this.showNotification(n,"error"),!1}return!0},htmlEntities:function(e){return Oe["Matomo"].helper.htmlEntities(e)}},computed:{formRulesAttributes:function(){return this.formRules.map((function(e){return{key:e.key,value:e.name}}))},formRulesPatterns:function(){var e={};return this.formRules.forEach((function(t){e[t.key]=t.patterns.map((function(e){return{key:e.key,value:e.name}}))})),e},formRulesExamples:function(){var e={};return this.formRules.forEach((function(t){e[t.key]=t.example})),e},pageRulesAttributes:function(){return this.pageRules.map((function(e){return{key:e.key,value:e.name}}))},pageRulesPatterns:function(){var e={};return this.pageRules.forEach((function(t){e[t.key]=t.patterns.map((function(e){return{key:e.key,value:e.name}}))})),e},pageRulesExamples:function(){var e={};return this.pageRules.forEach((function(t){e[t.key]=t.example})),e},create:function(){return!this.idForm},edit:function(){return!this.create},editTitle:function(){return this.create?"FormAnalytics_CreateNewForm":"FormAnalytics_EditForm"},contentTitle:function(){return Object(Oe["translate"])(this.editTitle,this.form.name?'"'.concat(this.form.name,'"'):"")},isLoading:function(){return Ee.state.value.isLoading},isUpdating:function(){return Ee.state.value.isUpdating},formSetupRulesHelp:function(){var e="https://matomo.org/faq/form-analytics/faq_23727/";return Object(Oe["translate"])("FormAnalytics_FormSetupFormRulesHelp",'<a target="blank" rel="noreferrer" href="'.concat(e,'">'),"</a>")},setupConversionHelpRules2:function(){var e="https://developer.matomo.org/guides/form-analytics/reference";return Object(Oe["translate"])("FormAnalytics_FormSetupConversionRulesHelp2",'<a target="blank" rel="noreferrer" href="'.concat(e,'">'),"</a>")},setupConversionsHelpTooltip:function(){var e=Object(Oe["translate"])("FormAnalytics_ComparisonsCaseInsensitive"),t=Object(Oe["translate"])("FormAnalytics_ComparisonsIgnoredValues");return"".concat(e," ").concat(t)},createButtonText:function(){return this.edit?Object(Oe["translate"])("CoreUpdater_UpdateTitle"):Object(Oe["translate"])("FormAnalytics_CreateNewForm")},setupPageRulesHelpTooltip:function(){var e=Object(Oe["translate"])("FormAnalytics_ComparisonsCaseInsensitive"),t=Object(Oe["translate"])("FormAnalytics_ComparisonsIgnoredValues");return"".concat(e," ").concat(t)},getInlineHelpByConversionOption:function(){var e=Object(Oe["translate"])("FormAnalytics_FormSetupConversionRulesFormSubmitHelp","<b>","</b><br>"),t=Object(Oe["translate"])("FormAnalytics_FormSetupConversionRulesPageVisitHelp","<br><br><b>","</b><br>"),n=Object(Oe["translate"])("FormAnalytics_FormSetupConversionRulesJsOrTagManagerHelp","<br><br><b>","</b><br>");return"".concat(e).concat(t).concat(n)},getJsCode:function(){return"_paq.push(['FormAnalytics::trackFormConversion', '{formName}', '{formId}']);"},getJsOrTagManagerHelpCode:function(){var e="https://developer.matomo.org/guides/form-analytics/reference#trackformconversionnodeorformname-formid";return Object(Oe["translate"])("FormAnalytics_FormSetupJsOrTagManagerHelp",'<a target="blank" rel="noreferrer" href="'.concat(e,'">'),"</a>")}}});De.render=ve;var Me=De,Be=Object(a["createElementVNode"])("br",null,null,-1),xe=Object(a["createElementVNode"])("br",null,null,-1),Te={class:"formStatusFilter",name:"filterStatus",id:"filterStatus"},Pe={class:"formSearchFilter",name:"formSearch",style:{"margin-left":"3.5px"}},He={class:"index"},Ue={class:"name"},Le={class:"description"},Ie={class:"description"},Ge={class:"action"},qe={colspan:"7"},$e={class:"loadingPiwik"},ze=Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ke={colspan:"7"},Je=["id"],We={class:"index"},Xe={class:"name"},Ye=["title"],Qe={class:"conversionRulesConfigured"},Ze={class:"action"},et=["title","onClick"],tt=["title","href"],nt=["title","onClick"],ot=["title","onClick"],rt={class:"tableActionBar"},at=Object(a["createElementVNode"])("span",{class:"icon-add"},null,-1),it={class:"ui-confirm",ref:"confirmArchiveForm"},lt=["value"],ct=["value"],st={class:"ui-confirm",ref:"confirmDeleteForm"},mt=["value"],ut=["value"];function dt(e,t,n,o,r,i){var l=Object(a["resolveComponent"])("Field"),c=Object(a["resolveComponent"])("ContentBlock"),s=Object(a["resolveDirective"])("content-table");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createVNode"])(c,{"content-title":e.translate("FormAnalytics_ManageForms"),feature:e.translate("FormAnalytics_ManageForms")},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("p",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("FormAnalytics_ManageFormsIntroduction"))+" ",1),Be,xe,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.autoCreationMessage),1)]),Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",Te,[Object(a["createVNode"])(l,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t),e.onFilterStatusChange()}),title:e.translate("FormAnalytics_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(a["createElementVNode"])("div",Pe,[Object(a["withDirectives"])(Object(a["createVNode"])(l,{uicontrol:"text",name:"formSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[a["vShow"],e.forms.length>0]])])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("table",null,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",He,Object(a["toDisplayString"])(e.translate("General_Id")),1),Object(a["createElementVNode"])("th",Ue,Object(a["toDisplayString"])(e.translate("General_Name")),1),Object(a["createElementVNode"])("th",Le,Object(a["toDisplayString"])(e.translate("General_Description")),1),Object(a["createElementVNode"])("th",Ie,Object(a["toDisplayString"])(e.translate("FormAnalytics_ConversionCriteria")),1),Object(a["createElementVNode"])("th",Ge,Object(a["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(a["createElementVNode"])("tbody",null,[Object(a["withDirectives"])(Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("td",qe,[Object(a["createElementVNode"])("span",$e,[ze,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[a["vShow"],e.isLoading||e.isUpdating]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("td",Ke,Object(a["toDisplayString"])(e.translate("FormAnalytics_NoFormsFound")),1)],512),[[a["vShow"],!e.isLoading&&0===e.forms.length]]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.sortedForms,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{id:"form".concat(t.idsiteform),class:"forms",key:t.idsiteform},[Object(a["createElementVNode"])("td",We,Object(a["toDisplayString"])(t.idsiteform),1),Object(a["createElementVNode"])("td",Xe,Object(a["toDisplayString"])(t.name),1),Object(a["createElementVNode"])("td",{class:"description",title:t.description},Object(a["toDisplayString"])(e.truncateText(t.description.trim(),60)),9,Ye),Object(a["createElementVNode"])("td",Qe,[Object(a["createElementVNode"])("span",{class:Object(a["normalizeClass"])({"icon-ok":t.conversion_rules.length>=1||t.conversion_rule_option&&"page_visit"!==t.conversion_rule_option})},null,2)]),Object(a["createElementVNode"])("td",Ze,[Object(a["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("FormAnalytics_EditForm"),onClick:function(n){return e.editForm(t.idsiteform)}},null,8,et),Object(a["withDirectives"])(Object(a["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("FormAnalytics_ViewReportInfo"),href:e.getViewFormLink(t)},null,8,tt),[[a["vShow"],"running"===t.status]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("a",{class:"table-action icon-archive",title:e.translate("FormAnalytics_ArchiveReportInfo"),onClick:function(n){return e.archiveForm(t)}},null,8,nt),[[a["vShow"],"running"===t.status]]),Object(a["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("FormAnalytics_DeleteFormInfo"),onClick:function(n){return e.deleteForm(t)}},null,8,ot)])],8,Je)})),128))])],512),[[s]]),Object(a["createElementVNode"])("div",rt,[Object(a["createElementVNode"])("a",{class:"createNewForm",onClick:t[2]||(t[2]=function(t){return e.createForm()})},[at,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_CreateNewForm")),1)])])]})),_:1},8,["content-title","feature"]),Object(a["createElementVNode"])("div",it,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_ArchiveReportConfirm")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,lt),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ct)],512),Object(a["createElementVNode"])("div",st,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_DeleteFormConfirm")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,mt),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ut)],512)])}function pt(e){return vt(e)||ht(e)||bt(e)||ft()}function ft(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){if(e){if("string"===typeof e)return Ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}function ht(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function vt(e){if(Array.isArray(e))return Ot(e)}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var jt=Object(a["defineComponent"])({props:{},components:{ContentBlock:Oe["ContentBlock"],Field:je["Field"]},directives:{ContentTable:Oe["ContentTable"]},data:function(){return{autoCreationMessage:"",statuses:[],searchFilter:""}},created:function(){var e=this;Oe["AjaxHelper"].fetch({method:"FormAnalytics.getAutoCreationSettings"}).then((function(t){null!==t&&void 0!==t&&t.message&&(e.autoCreationMessage=t.message)})),Ee.fetchAvailableStatuses().then((function(t){e.statuses=t})),this.onFilterStatusChange()},methods:{setFilterStatus:function(e){Ee.setFilterStatus(e)},createForm:function(){this.editForm(0)},editForm:function(e){Oe["MatomoUrl"].updateHash(Object.assign(Object.assign({},Oe["MatomoUrl"].hashParsed.value),{},{idForm:e}))},deleteForm:function(e){Oe["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteForm,{yes:function(){Ee.deleteForm(e.idsiteform).then((function(){Ee.reload(),Oe["Matomo"].postEvent("updateReportingMenu")}))}})},archiveForm:function(e){Oe["Matomo"].helper.modalConfirm(this.$refs.confirmArchiveForm,{yes:function(){Ee.archiveForm(e.idsiteform).then((function(){Ee.reload(),Oe["Matomo"].postEvent("updateReportingMenu")}))}})},onFilterStatusChange:function(){Ee.fetchForms()},truncateText:function(e,t){return e.length>t?"".concat(e.substr(0,t-3),"..."):e},getViewFormLink:function(e){return"?".concat(Oe["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:e.idsite,period:"day",date:"yesterday"}),"#?").concat(Oe["MatomoUrl"].stringify({category:"FormAnalytics_Forms",idSite:e.idsite,period:"day",date:"yesterday",subcategory:e.idsiteform}))}},computed:{filterStatus:function(){return Ee.state.value.filterStatus},statusOptions:function(){return this.statuses.filter((function(e){return"deleted"!==e.value})).map((function(e){return{key:e.value,value:e.name}}))},forms:function(){return Ee.state.value.forms},isLoading:function(){return Ee.state.value.isLoading},isUpdating:function(){return Ee.state.value.isUpdating},sortedForms:function(){var e=this,t=pt(this.forms).filter((function(t){return Object.keys(t).some((function(n){var o=t;return"string"===typeof o[n]&&-1!==o[n].toLowerCase().indexOf(e.searchFilter.toLowerCase())}))}));return t.sort((function(e,t){var n=parseInt("".concat(e.idsiteform),10),o=parseInt("".concat(t.idsiteform),10);return n-o})),t}}});jt.render=dt;var gt=jt,yt={class:"manageForms"},Ft={key:0},Vt={key:1};function Nt(e,t,n,o,r,i){var l=Object(a["resolveComponent"])("FormsList"),c=Object(a["resolveComponent"])("FormsEdit");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",yt,[e.editMode?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Ft,[Object(a["createVNode"])(l)])),e.editMode?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Vt,[Object(a["createVNode"])(c,{"id-form":e.idForm},null,8,["id-form"])])):Object(a["createCommentVNode"])("",!0)])}var Et=Object(a["defineComponent"])({props:{},components:{FormsList:gt,FormsEdit:Me},data:function(){return{editMode:!1,idForm:null}},watch:{editMode:function(){$(".ui-tooltip").remove()}},created:function(){var e=this;Object(a["watch"])((function(){return Oe["MatomoUrl"].hashParsed.value.idForm}),(function(t){e.initState(t)})),this.initState(Oe["MatomoUrl"].hashParsed.value.idForm)},methods:{removeAnyFormNotification:function(){Oe["NotificationsStore"].remove("formsmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(Oe["Matomo"].postEvent("FormAnalytics.initAddForm",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idForm=null)}this.editMode=!0,this.idForm=parseInt(e,10)}else this.editMode=!1,this.idForm=null;this.removeAnyFormNotification()}}});Et.render=Nt;var _t=Et,St={class:"knownFormFields"},At={key:0},kt=["title"],Ct={key:0},wt={colspan:"3"},Rt={key:1},Dt={colspan:"3"};function Mt(e,t,n,o,r,i){var l=Object(a["resolveComponent"])("Field"),c=Object(a["resolveComponent"])("SaveButton"),s=Object(a["resolveDirective"])("content-table");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",St,[Object(a["withDirectives"])(Object(a["createElementVNode"])("table",null,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_FieldName")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_FieldType")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_DisplayName")),1)])]),Object(a["createElementVNode"])("tbody",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.limitedFields,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{key:n},[Object(a["createElementVNode"])("td",null,Object(a["toDisplayString"])(t.name),1),Object(a["createElementVNode"])("td",null,Object(a["toDisplayString"])(t.type),1),Object(a["createElementVNode"])("td",{class:Object(a["normalizeClass"])({fieldDisplayNameInput:e.canEditForm})},[e.canEditForm?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",At,[Object(a["createVNode"])(l,{uicontrol:"text",modelValue:e.names[t.name],"onUpdate:modelValue":function(n){return e.names[t.name]=n},maxlength:50,"full-width":!0},null,8,["modelValue","onUpdate:modelValue"])])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",{key:1,title:e.translate("FormAnalytics_DisplayNameRequiresAdminAccess")},Object(a["toDisplayString"])(t.displayName||"-"),9,kt))],2)])})),128)),e.form.fields.length>200?(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",Ct,[Object(a["createElementVNode"])("td",wt,Object(a["toDisplayString"])(e.translate("FormAnalytics_FormFieldEditLimited",200)),1)])):Object(a["createCommentVNode"])("",!0),e.canEditForm?(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",Rt,[Object(a["createElementVNode"])("td",Dt,[Object(a["createVNode"])(c,{onConfirm:t[0]||(t[0]=function(t){return e.renameFields(e.form.idsiteform)}),saving:e.isLoading},null,8,["saving"])])])):Object(a["createCommentVNode"])("",!0)])],512),[[s]])])}function Bt(e,t){return Ut(e)||Ht(e,t)||Tt(e,t)||xt()}function xt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tt(e,t){if(e){if("string"===typeof e)return Pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pt(e,t):void 0}}function Pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ht(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done);i=!0)if(a.push(o.value),t&&a.length===t)break}catch(c){l=!0,r=c}finally{try{i||null==n["return"]||n["return"]()}finally{if(l)throw r}}return a}}function Ut(e){if(Array.isArray(e))return e}var Lt=Object(a["defineComponent"])({props:{form:{type:Object,required:!0},canEditForm:Boolean},components:{Field:je["Field"],SaveButton:je["SaveButton"]},directives:{ContentTable:Oe["ContentTable"]},data:function(){return{isLoading:!1,names:{}}},created:function(){var e=this;this.limitedFields.forEach((function(t){e.names[t.name]=t.displayName}))},methods:{renameFields:function(e){var t=this;this.isLoading=!0,Oe["AjaxHelper"].post({module:"API",method:"FormAnalytics.updateFormFieldDisplayName"},{fields:Object.entries(this.names).map((function(e){var t=Bt(e,2),n=t[0],o=t[1];return{name:n,displayName:o}})),idForm:e}).then((function(){Oe["Matomo"].helper.redirect()})).catch((function(){t.isLoading=!1}))}},computed:{limitedFields:function(){return this.form.fields.slice(0,200)}}});Lt.render=Mt;var It=Lt,Gt=window,qt=Gt.$,$t={mounted:function(e,t){if(Oe["Matomo"].helper.isReportingPage()){var n=qt(e);if("a"!==e.tagName.toLowerCase()){var o=qt(e).text();qt(e).html("<a></a>"),n=qt(e).find("a"),n.text(o)}n.bind("click",(function(e){e.preventDefault(),Oe["MatomoUrl"].updateHash(Object.assign(Object.assign({},Oe["MatomoUrl"].hashParsed.value),{},{category:"FormAnalytics_Forms",subcategory:t.value.idForm}))}))}}},zt=$t;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */Oe["Matomo"].on("Matomo.processDynamicHtml",(function(e){e.find("[piwik-form-page-link]").each((function(e,t){if(!qt(t).attr("piwik-form-page-link-handled")){var n=qt(t).attr("piwik-form-page-link");n&&$t.mounted(t,{instance:null,value:{idForm:n},oldValue:null,modifiers:{},dir:{}}),qt(t).attr("piwik-form-page-link-handled","1")}}))}));var Kt={class:"formSummary"},Jt={key:0},Wt=Object(a["createElementVNode"])("br",null,null,-1),Xt={key:1},Yt={key:2},Qt={key:3},Zt={key:4},en={key:5},tn={key:6},nn={key:7},on={key:8},rn=Object(a["createElementVNode"])("span",{class:"icon-warning",style:{"margin-right":"3.5px"}},null,-1),an=["innerHTML"],ln=Object(a["createElementVNode"])("br",null,null,-1),cn=["href"],sn=Object(a["createElementVNode"])("span",{class:"icon-edit"},null,-1),mn=Object(a["createElementVNode"])("br",null,null,-1),un={key:2},dn=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile"},null,-1),pn=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile"},null,-1),fn=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile"},null,-1),bn=Object(a["createElementVNode"])("br",null,null,-1),hn=Object(a["createElementVNode"])("a",{name:"editformfields"},null,-1);function vn(e,t,n,o,r,i){var l,c,s,m,u,d,p=Object(a["resolveComponent"])("FormFields"),f=Object(a["resolveDirective"])("content-intro");return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_FormX",'"'.concat(e.form.name,'"'))),1),Object(a["createElementVNode"])("div",Kt,[Object(a["createElementVNode"])("p",null,[e.form.description?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Jt,[Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("General_Description"))+":",1),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.form.description)+" ",1),Wt])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_DataIsCollectedWhen"))+":",1),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(this.matchRulesList(e.form.match_form_rules))+" ",1),null!==(l=e.form.match_form_rules)&&void 0!==l&&l.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("br",Xt)):Object(a["createCommentVNode"])("",!0),null!==(c=e.form.match_form_rules)&&void 0!==c&&c.length&&null!==(s=e.form.match_page_rules)&&void 0!==s&&s.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Yt,Object(a["toDisplayString"])(e.translate("FormAnalytics_AndWhen")),1)):Object(a["createCommentVNode"])("",!0),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(this.matchRulesList(e.form.match_page_rules))+" ",1),null!==(m=e.form.match_page_rules)&&void 0!==m&&m.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("br",Qt)):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("FormAnalytics_FormIsConvertedWhen"))+": ",1),"form_submit"===e.form.conversion_rule_option?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Zt,Object(a["toDisplayString"])(e.translate("FormAnalytics_TheFormIsSubmitted")),1)):"manually"===e.form.conversion_rule_option?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",en,Object(a["toDisplayString"])(e.translate("FormAnalytics_FormSetupConversionRulesConditionJsOrTagManager")),1)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",tn,Object(a["toDisplayString"])(this.matchRulesList(e.form.conversion_rules)),1)),null!==(u=e.form.conversion_rules)&&void 0!==u&&u.length||"form_submit"===e.form.conversion_rule_option||"manually"===e.form.conversion_rule_option?(Object(a["openBlock"])(),Object(a["createElementBlock"])("br",nn)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",on,[rn,Object(a["createElementVNode"])("span",{innerHTML:e.noConversionRulesWarningText},null,8,an),ln]))]),Object(a["createElementVNode"])("p",null,[e.canEditForm?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:0,href:this.formEditLink},[sn,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_EditForm")),1)],8,cn)):Object(a["createCommentVNode"])("",!0),null!==(d=e.form.fields)&&void 0!==d&&d.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:1,href:"",style:Object(a["normalizeStyle"])("margin-left: ".concat(e.canEditForm?"8.5":"0","px;")),onClick:t[0]||(t[0]=Object(a["withModifiers"])((function(t){return e.toggleKnownFormFields()}),["prevent"])),class:"toggleKnownFormFields"},[Object(a["createElementVNode"])("span",{class:Object(a["normalizeClass"])("".concat(e.canEditForm?"icon-edit":"icon-show"))},null,2),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.canEditForm?e.translate("FormAnalytics_EditFormFields"):e.translate("FormAnalytics_ViewFormFields")),1)],4)):Object(a["createCommentVNode"])("",!0),mn,e.isVisitorLogEnabled?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",un,[Object(a["createElementVNode"])("a",{href:"",class:"segmentVisitorsByStarters",onClick:t[1]||(t[1]=Object(a["withModifiers"])((function(t){return e.showSegmentedVisitorLog("form_num_starts>0","FormAnalytics_SegmentedVisitorLogPopupTitleFormStarter")}),["prevent"]))},[dn,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_ShowVisitorLogStarters")),1)]),Object(a["createElementVNode"])("a",{href:"",style:{"margin-left":"8.5px"},class:"segmentVisitorsBySubmitters",onClick:t[2]||(t[2]=Object(a["withModifiers"])((function(t){return e.showSegmentedVisitorLog("form_num_submissions>0","FormAnalytics_SegmentedVisitorLogPopupTitleFormSubmitters")}),["prevent"]))},[pn,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_ShowVisitorLogSubmitters")),1)]),Object(a["createElementVNode"])("a",{href:"",style:{"margin-left":"8.5px"},class:"segmentVisitorsByConverters",onClick:t[3]||(t[3]=Object(a["withModifiers"])((function(t){return e.showSegmentedVisitorLog("form_converted==1","FormAnalytics_SegmentedVisitorLogPopupTitleFormConverters")}),["prevent"]))},[fn,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("FormAnalytics_ShowVisitorLogConverters")),1)]),bn])):Object(a["createCommentVNode"])("",!0)]),hn,Object(a["withDirectives"])(Object(a["createVNode"])(p,{form:e.form,"can-edit-form":e.canEditForm},null,8,["form","can-edit-form"]),[[a["vShow"],e.isKnownFieldsVisible]])])],512)),[[f]])}var On=window,jn=On.faSegmentedVisitorLog,gn=Object(a["defineComponent"])({props:{form:{type:Object,required:!0},canEditForm:Boolean,isVisitorLogEnabled:Boolean,attributeTranslations:{type:Object,required:!0},patternTranslations:{type:Object,required:!0},segment:String},directives:{ContentIntro:Oe["ContentIntro"]},components:{FormFields:It},data:function(){return{isKnownFieldsVisible:!1}},methods:{matchRule:function(e){var t=this.attributeTranslations[e.attribute]||e.attribute,n=this.patternTranslations[e.pattern]||e.pattern;return"".concat(t,"\n").concat(n,"\n").concat(e.value)},matchRulesList:function(e){var t=this;if(null===e||void 0===e||!e.length)return"";var n=e.map((function(e){return t.matchRule(e)}));return n.join(" ".concat(Object(Oe["translate"])("General_Or")," "))},toggleKnownFormFields:function(){this.isKnownFieldsVisible=!this.isKnownFieldsVisible,console.log(this.isKnownFieldsVisible)},showSegmentedVisitorLog:function(e,t){var n=this.segment?";".concat(this.segment):"";jn.show("FormAnalytics.get","form_name==".concat(this.form.idsiteform,";").concat(e).concat(n),{},Object(Oe["translate"])(t,Oe["Matomo"].helper.htmlEntities(this.form.name)))}},computed:{formEditLink:function(){return"?".concat(Oe["MatomoUrl"].stringify(Object.assign(Object.assign({},Oe["MatomoUrl"].urlParsed.value),{},{module:"CoreHome",action:"index"})),"#?idForm=").concat(this.form.idsiteform,"&category=FormAnalytics_Forms&subcategory=FormAnalytics_ManageForms")},noConversionRulesWarningText:function(){return this.canEditForm?Object(Oe["translate"])("FormAnalytics_NoConversionRulesDefinesAdmin",'<a href="'.concat(this.formEditLink,'">'),"</a>"):Object(Oe["translate"])("FormAnalytics_NoConversionRulesDefinesView")}}});gn.render=vn;var yn=gn;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("Goals"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome","Goals",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["Funnels"]=t(require("CoreHome"),require("Goals"),require("vue"),require("CorePluginsAdmin")):e["Funnels"]=t(e["CoreHome"],e["Goals"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n,l){return function(e){var t={};function n(l){if(t[l])return t[l].exports;var o=t[l]={i:l,l:!1,exports:{}};return e[l].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},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 l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(l,o,function(t){return e[t]}.bind(null,o));return l},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/Funnels/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"6ec9":function(e,t){function n(e){return e?e.toLocaleString():"0"}function l(e){return e?e>=9995e4?"".concat(Math.round(e/1e6),"m"):e>=999500?"".concat((Math.round(e/1e5)/10).toFixed(1),"m"):e>=99950?"".concat(Math.round(e/1e3),"k"):e>=1e3?"".concat((Math.round(e/100)/10).toFixed(1),"k"):e.toString():"0"}e.exports={formatNumber:n,formatAbbr:l}},"76d2":function(e,n){e.exports=t},"8bbf":function(e,t){e.exports=n},a5a2:function(e,t){e.exports=l},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ManageFunnel",(function(){return re})),n.d(t,"SalesFunnel",(function(){return Oe})),n.d(t,"FunnelPageLink",(function(){return ve})),n.d(t,"FunnelSummary",(function(){return Te})),n.d(t,"GoalFunnelReport",(function(){return wt})),n.d(t,"ManageSiteFunnels",(function(){return an})),n.d(t,"FunnelConversionReport",(function(){return ul})),"undefined"!==typeof window){var l=window.document.currentScript,o=l&&l.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}var a=n("8bbf"),i={class:"alert alert-info"},r=Object(a["createElementVNode"])("br",null,null,-1),s=["value"],c={class:"activateFunnel"},u={class:"manageFunnel"},d={class:"stepHeading"},p={class:"funnelsTable",ref:"funnelsTable"},b=["title"],m=["title"],O={class:"stepName"},j={class:"stepPattern"},f={class:"stepRequired"},h=["title","onClick"],v=["title","onClick"],g={key:0,class:"step inactive"},F={class:"stepName"},E=Object(a["createElementVNode"])("td",null,null,-1),N=Object(a["createElementVNode"])("td",null,null,-1),y=Object(a["createElementVNode"])("td",null,null,-1),k={class:"stepRequired"},V=Object(a["createElementVNode"])("td",null,null,-1),S=Object(a["createElementVNode"])("td",null,null,-1),_=Object(a["createElementVNode"])("div",{id:"funnelValidationError"},null,-1),w={class:"tableActionBar"},B=Object(a["createElementVNode"])("span",{class:"icon-add"},null,-1),C={class:"targetValidator"},T={class:"urlField"},x={class:"loadingPiwik loadingMatchingSteps"},M=Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1),L={class:"ui-confirm",ref:"infoFunnelIsLocked"},D=["value"],G=["value"],R={class:"ui-confirm",ref:"cannotActivateIncompleteSteps"},A=["value"],U={class:"ui-confirm",ref:"confirmUnlockFunnel"},H=["value"],q=["value"],P={class:"ui-confirm",ref:"confirmDeactivateFunnel"},I=["value"],z=["value"];function $(e,t,n,l,o,$){var W=Object(a["resolveComponent"])("Field"),Y=Object(a["resolveComponent"])("ActivityIndicator"),X=Object(a["resolveDirective"])("content-table");return Object(a["openBlock"])(),Object(a["createElementBlock"])(a["Fragment"],null,[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",i,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Funnels_WarningFunnelIsActivatedRequiredUnlock"))+" ",1),r,Object(a["createElementVNode"])("input",{type:"button",class:"btn unlockFunnel",onClick:t[0]||(t[0]=function(t){return e.unlockFunnel()}),value:e.translate("Funnels_Unlock")},null,8,s)],512),[[a["vShow"],e.isLocked]]),Object(a["createElementVNode"])("div",c,[e.isHideEnable?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createBlock"])(W,{key:0,uicontrol:"checkbox",name:"activateFunnel","model-value":e.funnel.activated,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.toggleFunnelActivated(t)}),"model-modifiers":{abortable:!0},title:e.translate("Funnels_EnableFunnel"),"inline-help":e.getEnableFunnelHelpText,disabled:e.isLocked},null,8,["model-value","title","inline-help","disabled"]))]),Object(a["createVNode"])(Y,{loading:e.isLoading},null,8,["loading"]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",u,[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",{class:"alert alert-warning"},Object(a["toDisplayString"])(e.translate("Funnels_WarningOnUpdateReportNeedsArchiving")),513),[[a["vShow"],e.isUnlocked]]),Object(a["createElementVNode"])("h3",d,Object(a["toDisplayString"])(e.translate("Funnels_Steps")),1),Object(a["withDirectives"])(Object(a["createElementVNode"])("table",p,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("Funnels_Step")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Name")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("Funnels_ComparisonColumnTitle")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("Funnels_Condition")),1),Object(a["createElementVNode"])("th",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Goals_Pattern"))+" ",1),Object(a["createElementVNode"])("span",{class:"icon-info header-help",title:e.translate("Funnels_PatternHelpText")},null,8,b)]),Object(a["createElementVNode"])("th",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Funnels_RequiredColumnTitle"))+" ",1),Object(a["createElementVNode"])("span",{class:"icon-info header-help required-help-icon",title:e.getRequiredHelpText},null,8,m)]),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Help")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("General_Remove")),1)])]),Object(a["createElementVNode"])("tbody",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.funnel.steps,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{class:Object(a["normalizeClass"])("step step".concat(n+1," ").concat(e.matches[n]," ").concat(e.isLocked?"inactive":"")),key:n},[Object(a["createElementVNode"])("td",null,Object(a["toDisplayString"])(n+1),1),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",O,[Object(a["createVNode"])(W,{uicontrol:"text",placeholder:e.translate("Funnels_StepName"),name:"stepName".concat(n+1),modelValue:t.name,"onUpdate:modelValue":function(e){return t.name=e},maxlength:150,"full-width":!0,disabled:e.isLocked},null,8,["placeholder","name","modelValue","onUpdate:modelValue","disabled"])])]),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(W,{uicontrol:"select",name:"patternComparison","model-value":t.patternComparison,"onUpdate:modelValue":function(l){e.updatePatternType(t.patternComparison,l,n),t.patternComparison=l,e.validateSteps()},disabled:e.isLocked,"full-width":!0,options:e.patterns},null,8,["model-value","onUpdate:modelValue","disabled","options"])])]),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(W,{uicontrol:"select",name:"pattern_type","model-value":t.pattern_type,"onUpdate:modelValue":function(n){t.pattern_type=n,e.validateSteps()},disabled:e.isLocked,"full-width":!0,options:e.patternConditions(t.patternComparison)},null,8,["model-value","onUpdate:modelValue","disabled","options"])])]),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",j,[Object(a["createVNode"])(W,{uicontrol:"text","model-value":t.pattern,"onUpdate:modelValue":function(n){t.pattern=n,e.validateSteps()},name:"stepPattern".concat(n,1),maxlength:1e3,"full-width":!0,disabled:e.isLocked,placeholder:e.patternExamples[t.pattern_type],hidden:"goal"===t.patternComparison},null,8,["model-value","onUpdate:modelValue","name","disabled","placeholder","hidden"]),Object(a["createVNode"])(W,{uicontrol:"select",name:"stepPattern".concat(n,1),options:e.goals,"model-value":t.pattern,"onUpdate:modelValue":function(n){t.pattern=n,e.validateSteps()},disabled:e.isLocked,hidden:"goal"!==t.patternComparison,"full-width":!0},null,8,["name","options","model-value","onUpdate:modelValue","disabled","hidden"])])]),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",f,[Object(a["createVNode"])(W,{uicontrol:"checkbox",name:"stepRequired".concat(n,1),modelValue:t.required,"onUpdate:modelValue":function(e){return t.required=e},disabled:e.isLocked},null,8,["name","modelValue","onUpdate:modelValue","disabled"])])]),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("span",{class:"icon-info table-action",title:e.translate("Funnels_HelpStepTooltip"),onClick:function(t){return e.showHelpForStep(n)}},null,8,h)]),Object(a["createElementVNode"])("td",null,[Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{class:"icon-minus table-action",title:e.translate("Funnels_RemoveStepTooltip"),onClick:function(t){return e.removeStep(n)}},null,8,v),[[a["vShow"],e.funnel.steps.length>1]])])],2)})),128)),!e.isNonGoalFunnel||e.isSalesFunnel?(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",g,[Object(a["createElementVNode"])("td",null,Object(a["toDisplayString"])(e.funnel.steps.length+1),1),Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",F,[Object(a["createVNode"])(W,{uicontrol:"text",modelValue:e.getGoalName,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.getGoalName=t}),"full-width":!0,disabled:!0},null,8,["modelValue"])])]),E,N,y,Object(a["createElementVNode"])("td",null,[Object(a["createElementVNode"])("div",k,[Object(a["createVNode"])(W,{uicontrol:"checkbox",modelValue:e.isGoalRequired,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.isGoalRequired=t}),disabled:!0},null,8,["modelValue"])])]),V,S])):Object(a["createCommentVNode"])("",!0)])],512),[[a["vShow"],!e.isLoading],[X]]),_,Object(a["withDirectives"])(Object(a["createElementVNode"])("div",w,[Object(a["createElementVNode"])("button",{class:"addNewStep",onClick:t[4]||(t[4]=function(t){return e.addStep()})},[B,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_AddStep")),1)])],512),[[a["vShow"],!e.isLoading]]),Object(a["createElementVNode"])("div",C,[Object(a["createElementVNode"])("div",T,[Object(a["createVNode"])(W,{uicontrol:"text",name:"urlField",title:e.translate("Funnels_ValidateStepsOptional"),placeholder:"https://www.example.com","model-value":e.validateUrl,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.validateUrl=t,e.validateSteps()}),onClick:t[6]||(t[6]=function(t){return e.prefillValidateUrl()}),"inline-help":e.getTestUrlHelpText},null,8,["title","model-value","inline-help"])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",x,[M,Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("General_LoadingData")),1)],512),[[a["vShow"],e.isLoadingMatchingSteps]])]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",{class:"alert alert-warning"},Object(a["toDisplayString"])(e.translate("Funnels_WarningOnUpdateReportNeedsArchiving")),513),[[a["vShow"],e.isUnlocked]]),Object(a["createElementVNode"])("div",L,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("Funnels_InfoFunnelIsLocked")),1),Object(a["createElementVNode"])("input",{role:"unlock",type:"button",value:e.translate("Funnels_Unlock")},null,8,D),Object(a["createElementVNode"])("input",{role:"ok",type:"button",value:e.translate("General_Cancel")},null,8,G)],512),Object(a["createElementVNode"])("div",R,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("Funnels_InfoCannotActivateFunnelIncomplete")),1),Object(a["createElementVNode"])("input",{role:"ok",type:"button",value:e.translate("General_Ok")},null,8,A)],512),Object(a["createElementVNode"])("div",U,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("Funnels_ConfirmUnlockFunnel")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,H),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,q)],512),Object(a["createElementVNode"])("div",P,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("Funnels_ConfirmDeactivateFunnel")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,I),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,z)],512)],512),[[a["vShow"],e.funnel.activated]])],64)}var W=n("19dc"),Y=n("a5a2"),X=n("76d2");function K(e,t){return Z(e)||Q(e,t)||ne(e,t)||J()}function J(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Q(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,o,a=[],i=!0,r=!1;try{for(n=n.call(e);!(i=(l=n.next()).done);i=!0)if(a.push(l.value),t&&a.length===t)break}catch(s){r=!0,o=s}finally{try{i||null==n["return"]||n["return"]()}finally{if(r)throw o}}return a}}function Z(e){if(Array.isArray(e))return e}function ee(e){return oe(e)||le(e)||ne(e)||te()}function te(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ne(e,t){if(e){if("string"===typeof e)return ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ae(e,t):void 0}}function le(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function oe(e){if(Array.isArray(e))return ae(e)}function ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}var ie=Object(a["defineComponent"])({props:{showGoal:Number,isHideEnable:{type:Boolean,default:!1},isSalesFunnel:{type:Boolean,default:!1},isNonGoalFunnel:{type:Boolean,default:!1},goals:{type:Array,required:!0}},components:{ActivityIndicator:W["ActivityIndicator"],Field:Y["Field"]},directives:{ContentTable:W["ContentTable"]},data:function(){return{funnel:{},isLoading:!1,patternMatchOptions:[],isLocked:!1,isUnlocked:!1,matches:{},validateUrl:"",isLoadingMatchingSteps:!1,isGoalRequired:!0}},created:function(){var e=this;this.fetchMatchingSteps=Object(W["debounce"])(this.fetchMatchingSteps,200);var t=X["ManageGoalsStore"].idGoal.value||this.showGoal;this.isNonGoalFunnel&&!this.isSalesFunnel||"number"!==typeof t||this.initGoalForm("Goals.updateGoal",t,""),W["AjaxHelper"].fetch({method:"Funnels.getAvailablePatternMatches"}).then((function(t){e.patternMatchOptions=t})),this.reset(),this.isSalesFunnel&&W["Matomo"].on("Funnels.beforeUpdateSalesFunnel",this.onSetFunnel),this.isNonGoalFunnel&&!this.isSalesFunnel&&(W["Matomo"].on("Funnels.resetForm",(function(){return e.resetForm()})),W["Matomo"].on("Funnels.initFunnelForm",this.initFunnelForm.bind(this)),W["Matomo"].on("Funnels.beforeUpdateFunnel",this.onSetFunnel)),this.isNonGoalFunnel||(W["Matomo"].on("Goals.beforeInitGoalForm",this.initGoalForm.bind(this)),W["Matomo"].on("Goals.beforeAddGoal",this.onSetFunnel.bind(this)),W["Matomo"].on("Goals.beforeUpdateGoal",this.onSetFunnel.bind(this)),W["Matomo"].on("Goals.cancelForm",(function(){return e.resetForm()})),W["Matomo"].on("Goals.goalNameChanged",this.updateGoalName.bind(this)))},updated:function(){var e=this;this.$nextTick((function(){e.isSalesFunnel?setTimeout((function(){e.scrollToFunnelsTable()}),1e3):e.scrollToFunnelsTable()}))},unmounted:function(){this.isSalesFunnel&&W["Matomo"].off("Funnels.beforeUpdateSalesFunnel",this.onSetFunnel),this.isNonGoalFunnel&&!this.isSalesFunnel&&W["Matomo"].off("Funnels.beforeUpdateFunnel",this.onSetFunnel)},methods:{testUrlMatchesSteps:W["AjaxHelper"].oneAtATime("Funnels.testUrlMatchesSteps",{errorElement:"#funnelValidationError"}),getGoalFunnel:W["AjaxHelper"].oneAtATime("Funnels.getGoalFunnel"),getFunnel:W["AjaxHelper"].oneAtATime("Funnels.getFunnel"),doUnlock:function(){this.isLocked=!1,this.isUnlocked=!0},confirmFunnelIsLocked:function(){var e=this;return new Promise((function(t){W["Matomo"].helper.modalConfirm(e.$refs.infoFunnelIsLocked,{unlock:function(){e.doUnlock(),t()}})}))},addStep:function(){var e,t=this;this.funnel&&(this.isLocked?this.confirmFunnelIsLocked().then((function(){t.addStep()})):(null!==(e=this.funnel.steps)&&void 0!==e&&e.length||(this.funnel.steps=[]),this.funnel.steps=[].concat(ee(this.funnel.steps),[{name:"",pattern:"",pattern_type:"path_equals",patternComparison:"path",required:!0}])))},removeStep:function(e){var t,n=this;if(this.funnel)if(this.isLocked)this.confirmFunnelIsLocked().then((function(){n.removeStep(e)}));else{if(e>-1&&null!==(t=this.funnel)&&void 0!==t&&t.steps){this.removeTooltipForStep(e+1);var l=ee(this.funnel.steps);l.splice(e,1),this.funnel.steps=l}this.validateSteps()}},removeTooltipForStep:function(e){var t="table.funnelsTable tr.step".concat(e," span.icon-minus"),n=document.querySelectorAll(t)[0],l=n.getAttribute("aria-describedby");if(l){var o=document.getElementById(l);o&&o.remove()}},prefillValidateUrl:function(){this.validateUrl||(this.validateUrl="https://www.")},fetchMatchingSteps:function(){var e,t,n=this,l=this.validateUrl;l&&null!==(e=this.funnel)&&void 0!==e&&null!==(t=e.steps)&&void 0!==t&&t.length&&this.stepsWithPattern.length&&(this.isLoadingMatchingSteps=!0,this.testUrlMatchesSteps({url:l},{steps:this.stepsWithPattern}).then((function(e){var t;null!==(t=n.funnel)&&void 0!==t&&t.steps&&null!==e&&void 0!==e&&e.url&&null!==e&&void 0!==e&&e.tests&&e.url===n.validateUrl&&n.funnel.steps.forEach((function(t,l){e.tests.forEach((function(e){e&&t.pattern===e.pattern&&t.pattern_type===e.pattern_type&&(n.matches[l]=e.matches?"validateMatch":"validateMismatch")}))}))})).finally((function(){n.isLoadingMatchingSteps=!1})))},cannotActivateIncompleteSteps:function(){W["Matomo"].helper.modalConfirm(this.$refs.cannotActivateIncompleteSteps,{})},validateSteps:function(){var e;this.matches={1:""},null!==(e=this.funnel.steps)&&void 0!==e&&e.length&&(this.matches=this.funnel.steps.map((function(){return"noValidation"})),this.validateUrl&&this.fetchMatchingSteps())},updatePatternType:function(e,t,n){var l=this.patternConditions(t),o=Object.keys(l)[0];if(this.funnel.steps[n].pattern_type=o,"goal"===t&&this.funnel.steps[n].patternComparison===e){var a=this.goals[0];this.funnel.steps[n].pattern=a.key}else this.funnel.steps[n].pattern=""},unlockFunnel:function(){var e=this;this.funnel&&this.isLocked&&W["Matomo"].helper.modalConfirm(this.$refs.confirmUnlockFunnel,{yes:function(){e.doUnlock()}})},toggleFunnelActivated:function(e){var t=this;if(this.funnel)return this.isLocked&&e?(e.abort(),void this.confirmFunnelIsLocked().then((function(){t.toggleFunnelActivated(e)}))):void(this.funnel.activated?W["Matomo"].helper.modalConfirm(this.$refs.confirmDeactivateFunnel,{yes:function(){t.funnel.activated=!1},no:function(){e.abort(),t.funnel.activated=!0}}):this.funnel.activated=!0)},showHelpForStep:function(e){var t,n,l=null===(t=this.funnel)||void 0===t||null===(n=t.steps)||void 0===n?void 0:n[e],o=(null===l||void 0===l?void 0:l.pattern)&&(null===l||void 0===l?void 0:l.pattern_type),a=W["MatomoUrl"].stringify({module:"Funnels",action:"stepHelp",pattern:o?l.pattern:void 0,pattern_type:o?l.pattern_type:void 0}),i=Object(W["translate"])("General_Help");Piwik_Popover.createPopupAndLoadUrl(a,i,"funnelStepHelp")},reset:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.funnel={activated:this.isNonGoalFunnel,steps:[]},this.isLocked=!1,this.isUnlocked=!1,this.matches={1:""},this.validateUrl="",e||this.addStep()},resetForm:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.reset(e),this.isLoading=!1},initGoalForm:function(e,t,n){var l=this;this.resetForm(),""!==t&&"Goals.addGoal"!==e&&(this.isLoading=!0,this.getGoalFunnel({idGoal:t}).then((function(e){e&&(l.funnel=e,l.funnel.name=l.funnel.name?l.funnel.name:n,l.funnel.steps||(l.funnel.steps=[],l.addStep()),l.funnel.activated?l.isLocked=!0:l.isLocked=!1,l.isNonGoalFunnel&&"undefined"===typeof l.funnel.idfunnel&&(l.funnel.activated=!0),l.validateSteps())})).finally((function(){l.isLoading=!1})))},initFunnelForm:function(e,t){var n=this;this.resetForm(t>0),0!==t&&(this.isLoading=!0,setTimeout((function(){n.getFunnel({idSite:e,idFunnel:t}).then((function(e){e&&(n.funnel=e,n.funnel.steps||(n.funnel.steps=[],n.addStep()),n.funnel.activated?n.isLocked=!0:n.isLocked=!1,n.validateSteps())})).finally((function(){n.isLoading=!1}))}),500))},onSetFunnel:function(e){var t,n=this,l=e.parameters,o=e.options;if(!this.funnel||this.isLocked&&(this.isSalesFunnel||this.isNonGoalFunnel))return l.isLocked=this.isLocked,void(l.cancelRequest=!0);if(this.funnel.activated&&(null===(t=this.funnel.steps)||void 0===t||!t.length))return this.cannotActivateIncompleteSteps(),void(l.cancelRequest=!0);var a=this.funnel.steps.some((function(e){return n.isStepIncomplete(e)}));if(this.funnel.activated&&a)return this.cannotActivateIncompleteSteps(),void(l.cancelRequest=!0);o.postParams=Object.assign(Object.assign({},o.postParams),{},{funnelSteps:this.stepsWithNameAndPattern,funnelActivated:this.funnel.activated?"1":"0"}),this.isNonGoalFunnel&&(o.postParams=Object.assign(Object.assign({},o.postParams),{},{steps:this.stepsWithNameAndPattern,isActivated:this.funnel.activated?"1":"0"}),!this.isSalesFunnel&&o.postParams.steps.length&&(o.postParams.steps[o.postParams.steps.length-1].required=1))},isStepIncomplete:function(e){return!e.name||!e.name.trim()||!e.pattern||!e.pattern.trim()},updateGoalName:function(e){this.funnel.name=e},scrollToFunnelsTable:function(){var e=this.$refs.funnelsTable,t=Object.assign({},W["MatomoUrl"].hashParsed.value);t.scrollToFunnel&&e&&(delete t.scrollToFunnel,e.scrollIntoView())},patternConditions:function(e){var t={};return Object.entries(this.patternMatchOptions).forEach((function(n){var l=K(n,2),o=l[0],a=l[1];o===e&&Object.values(a.conditions).forEach((function(e){t[e.key]=e.value}))})),t}},computed:{patternExamples:function(){var e={};return Object.values(this.patternMatchOptions).forEach((function(t){Object.values(t.conditions).forEach((function(t){e[t.key]=t.example}))})),e},patterns:function(){var e={};return Object.entries(this.patternMatchOptions).forEach((function(t){var n=K(t,2),l=n[0],o=n[1];e[l]=o.comparisonName})),e},stepsWithPattern:function(){var e;return null!==(e=this.funnel.steps)&&void 0!==e&&e.length?this.funnel.steps.filter((function(e){return e&&e.pattern&&e.pattern_type})).map((function(e){return Object.assign(Object.assign({},e),{},{required:e.required?1:0})})):[]},stepsWithNameAndPattern:function(){var e=this.stepsWithPattern;return e=e.filter((function(e){return e.name})),e},getEnableFunnelHelpText:function(){var e='<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/funnels/faq_22793/">';return Object(W["translate"])("Funnels_EnableFunnelHelpText",e,"</a>")},getGoalName:function(){return this.isSalesFunnel?Object(W["translate"])("Ecommerce_Sales"):this.funnel.name?this.funnel.name:Object(W["translate"])("Goals_GoalName")},getTestUrlHelpText:function(){var e=Object(W["translate"])("Funnels_TestUrlHelpText"),t=Object(W["translate"])("Funnels_TestUrlHelpTextGoalComparison","<i>","</i>");return"".concat(e," ").concat(t)},getRequiredHelpText:function(){var e=Object(W["translate"])("Funnels_RequiredStepsHelpTextNote","<br><br><strong>","</strong>");return Object(W["translate"])("Funnels_RequiredStepsHelpTextNew")+e}}});ie.render=$;var re=ie,se=Object(a["createElementVNode"])("span",{class:"icon-show"},null,-1),ce=Object(a["createElementVNode"])("br",null,null,-1),ue=Object(a["createElementVNode"])("br",null,null,-1),de={class:"ui-confirm",ref:"funnelIsLockedCannotBeSaved"},pe=["value"];function be(e,t,n,l,o,i){var r=Object(a["resolveComponent"])("SaveButton"),s=Object(a["resolveComponent"])("ManageFunnel");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createVNode"])(r,{class:"toggleEditSalesFunnel",value:e.translate("Funnels_EditSalesFunnel"),disabled:e.showEditForm,onConfirm:t[0]||(t[0]=function(t){return e.showEditForm=!e.showEditForm}),saving:e.isLoading},null,8,["value","disabled","saving"]),e.idFunnel?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:0,class:"btn",onClick:t[1]||(t[1]=Object(a["withModifiers"])((function(t){return e.openFunnelReport(e.idFunnel)}),["prevent"])),style:{"margin-left":"3.5px"}},[se,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_ViewSalesFunnelReport")),1)])):Object(a["createCommentVNode"])("",!0),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",null,[ce,ue,Object(a["createVNode"])(s,{"show-goal":0,"is-sales-funnel":!0,"is-non-goal-funnel":!0,goals:e.goals},null,8,["goals"]),Object(a["createVNode"])(r,{class:"saveSalesFunnel",onConfirm:t[2]||(t[2]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"]),Object(a["createElementVNode"])("div",de,[Object(a["createElementVNode"])("h3",null,Object(a["toDisplayString"])(e.translate("Funnels_FunnelIsLockedCannotBeSaved")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Ok")},null,8,pe)],512)],512),[[a["vShow"],e.showEditForm]])])}var me=Object(a["defineComponent"])({props:{idFunnel:{type:[String,Number],required:!1,default:0},isFunnelEdit:{type:Boolean,required:!1,default:!1},goals:{type:Array,required:!0}},components:{SaveButton:Y["SaveButton"],ManageFunnel:re},data:function(){return{isLoading:!1,showEditForm:!1}},methods:{openFunnelReport:function(e){W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Funnels_Funnels",subcategory:e}))},save:function(){var e=this,t={method:"Funnels.setGoalFunnel",idGoal:"0"},n={};W["Matomo"].postEvent("Funnels.beforeUpdateSalesFunnel",{parameters:t,options:n}),t&&t.isLocked&&this.$refs.funnelIsLockedCannotBeSaved?W["Matomo"].helper.modalConfirm(this.$refs.funnelIsLockedCannotBeSaved,{}):t.cancelRequest||(this.isLoading=!0,W["AjaxHelper"].fetch(t,n).then((function(){window.location.reload()})).catch((function(){e.isLoading=!1})))}},mounted:function(){this.isFunnelEdit&&(this.showEditForm=!0)}});me.render=be;var Oe=me,je=window,fe=je.$,he={mounted:function(e,t){if(W["Matomo"].helper.isReportingPage()){var n=fe(e);if("a"!==e.tagName.toLowerCase()){var l=fe(e).text();fe(e).html("<a></a>"),n=fe(e).find("a"),n.text(l)}n.bind("click",(function(e){e.preventDefault(),W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Funnels_Funnels",subcategory:t.value.idFunnel}))}))}}},ve=he;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */W["Matomo"].on("Matomo.processDynamicHtml",(function(e){e.find("[piwik-funnel-page-link]").each((function(e,t){if(!fe(t).attr("piwik-funnel-page-link-handled")){var n=fe(t).attr("piwik-funnel-page-link");n&&he.mounted(t,{instance:null,value:{idFunnel:n},oldValue:null,modifiers:{},dir:{}}),fe(t).attr("piwik-funnel-page-link-handled","1")}}))}));var ge={class:"funnelsReport"},Fe={class:"funnelSummary"},Ee={key:0},Ne=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile funnelOverviewLink"},null,-1),ye={key:1},ke=Object(a["createElementVNode"])("span",{class:"icon-reporting-goal funnelOverviewLink"},null,-1),Ve={key:2},Se=Object(a["createElementVNode"])("span",{class:"icon-edit funnelOverviewLink"},null,-1);function _e(e,t,n,l,o,i){var r=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(r,{"content-title":e.$sanitize(e.funnel.name)},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("div",ge,[Object(a["createElementVNode"])("div",Fe,[e.isVisitorLogEnabled?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Ee,[Object(a["createElementVNode"])("a",{class:"funnelOverviewLink",onClick:t[0]||(t[0]=Object(a["withModifiers"])((function(t){return e.openSegmentedVisitorLog()}),["prevent"]))},[Ne,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_ShowFunnelVisitsLog")),1)])])):Object(a["createCommentVNode"])("",!0),e.funnel.idgoal>0?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",ye,[Object(a["createElementVNode"])("a",{class:"funnelOverviewLink",onClick:t[1]||(t[1]=Object(a["withModifiers"])((function(t){return e.openGoalReport()}),["prevent"]))},[ke,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_ShowGoalReport")),1)])])):Object(a["createCommentVNode"])("",!0),e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Ve,[Object(a["createElementVNode"])("a",{onClick:t[2]||(t[2]=Object(a["withModifiers"])((function(t){return e.editFunnel()}),["prevent"])),class:"funnelOverviewLink"},[Se,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_EditFunnel")),1)])])):Object(a["createCommentVNode"])("",!0)])])]})),_:1},8,["content-title"])}var we=window,Be=we.SegmentedVisitorLog,Ce=Object(a["defineComponent"])({props:{funnel:{type:Object,required:!0},goalsSummary:Object,isVisitorLogEnabled:Boolean,segment:String,patternTranslations:{type:Object,required:!0},funnelFlow:{type:Object,required:!0},isNonGoalFunnel:{type:Boolean,required:!1,default:!1},userCanEditFunnels:{type:Boolean,required:!1,default:!1}},components:{ContentBlock:W["ContentBlock"]},directives:{ContentTable:W["ContentTable"]},methods:{openSegmentedVisitorLog:function(){Be.show("Funnel.getFunnelFlow","funnels_name==".concat(this.funnel.idfunnel).concat(this.segment?";".concat(this.segment):""),{})},openGoalReport:function(){W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Goals_Goals",subcategory:this.funnel.idgoal}))},editFunnel:function(){var e=this.funnel;e.idgoal&&"0"!==e.idgoal?W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Goals_Goals",subcategory:"Goals_ManageGoals",idGoal:e.idgoal,scrollToFunnel:1})):e.isSalesFunnel?W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Goals_Ecommerce",subcategory:"General_Overview",isFunnelEdit:!0,scrollToFunnel:1})):W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Funnels_Funnels",subcategory:"Funnels_ManageFunnels",idFunnel:e.idfunnel}))}}});Ce.render=_e;var Te=Ce,xe={key:0,class:"reportFlow"},Me=Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",{class:"funnelEntries"}),Object(a["createElementVNode"])("th",{class:"separator"}),Object(a["createElementVNode"])("th",{class:"funnelFlow"}),Object(a["createElementVNode"])("th",{class:"separator"}),Object(a["createElementVNode"])("th",{class:"funnelExits"})])],-1),Le={key:1},De=Object(a["createElementVNode"])("br",null,null,-1),Ge={key:0},Re={key:1};function Ae(e,t,n,l,o,i){var r=Object(a["resolveComponent"])("EnrichedHeadline"),s=Object(a["resolveComponent"])("FunnelFlowRow"),c=Object(a["resolveComponent"])("ContentBlock");return Object(a["openBlock"])(),Object(a["createBlock"])(c,{class:"funnelsReport"},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("h2",null,[Object(a["createVNode"])(r,{"feature-name":"Funnels","inline-help":e.translate("Funnels_GoalFunnelReportHelp")},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Funnels_GoalFunnelReport")),1)]})),_:1},8,["inline-help"])]),e.funnelFlow.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("table",xe,[Me,Object(a["createElementVNode"])("tbody",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.funnelFlow,(function(t,n){return Object(a["openBlock"])(),Object(a["createBlock"])(s,{key:n,row:t,"is-last-row":n===e.funnelFlow.length-1,"id-site":e.idSite,funnel:e.funnel,"is-visitor-log-enabled":e.isVisitorLogEnabled,segment:e.segment},null,8,["row","is-last-row","id-site","funnel","is-visitor-log-enabled","segment"])})),128))])])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("p",Le,[Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("CoreHome_ThereIsNoDataForThisReport")),1),De,e.hasBeenPurged?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Ge,Object(a["toDisplayString"])(e.translate("CoreHome_DataForThisReportHasBeenPurged",e.deleteReportsOlderThan)),1)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Re,Object(a["toDisplayString"])(e.translate("Funnels_FunnelReportNotGeneratedYet")),1))]))]})),_:1})}var Ue={colspan:"5",class:"stepLabel"},He=["title"],qe=["title"],Pe=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile",style:{visibility:"hidden"}},null,-1),Ie={key:0,class:"icon-evolution",style:{visibility:"hidden"}},ze={key:1},$e={key:2},We=["title"],Ye=Object(a["createElementVNode"])("span",{class:"icon-visitor-profile segmentVisitorsByFunnelStep"},null,-1),Xe=[Ye],Ke=["title"],Je=Object(a["createElementVNode"])("span",{class:"icon-evolution"},null,-1),Qe=[Je],Ze={class:"funnelEntries"},et=Object(a["createElementVNode"])("br",null,null,-1),tt=Object(a["createElementVNode"])("td",{class:"separator"},[Object(a["createElementVNode"])("h4",{class:"entryArrow"},"→")],-1),nt={class:"funnelFlow"},lt={key:0},ot=["title"],at=Object(a["createElementVNode"])("br",null,null,-1),it=Object(a["createElementVNode"])("span",{class:"proceededArrow"},"↓",-1),rt=Object(a["createElementVNode"])("br",null,null,-1),st=["innerHTML"],ct=Object(a["createElementVNode"])("br",null,null,-1),ut={key:1},dt=["title"],pt=Object(a["createElementVNode"])("br",null,null,-1),bt=Object(a["createElementVNode"])("span",{class:"proceededArrow"},"↓",-1),mt=Object(a["createElementVNode"])("br",null,null,-1),Ot=Object(a["createElementVNode"])("br",null,null,-1),jt={class:"proceededRate"},ft={class:"separator"},ht={key:0,class:"exitArrow"},vt={class:"funnelExits"},gt={key:0},Ft=Object(a["createElementVNode"])("br",null,null,-1);function Et(e,t,n,l,o,i){var r=Object(a["resolveComponent"])("WidgetLoader");return Object(a["openBlock"])(),Object(a["createElementBlock"])(a["Fragment"],null,[Object(a["createElementVNode"])("tr",{class:Object(a["normalizeClass"])("step".concat(e.row.step_position))},[Object(a["createElementVNode"])("td",Ue,[Object(a["createElementVNode"])("h3",{class:"stepName",title:e.row.step_definition},Object(a["toDisplayString"])(e.row.label),9,He),Object(a["createElementVNode"])("h3",{class:"stepMetric",title:e.row.step_nb_visits!==e.row.step_nb_visits_actual?e.translate("Funnels_HitsWereBackfilled",e.row.step_nb_visits_actual):e.translate("Funnels_HitsWereNotBackfilled")},[Pe,e.isLastRow?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Ie)),1===e.row.step_nb_visits?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",ze,Object(a["toDisplayString"])(e.isLastRow?e.translate("Funnels_NbConversion",1):e.translate("General_OneVisit")),1)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",$e,Object(a["toDisplayString"])(e.isLastRow?e.translate("Goals_Conversions",e.row.step_nb_visits):e.translate("General_NVisits",e.row.step_nb_visits)),1)),e.isVisitorLogEnabled?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:3,href:"",title:e.translate("Funnels_SegmentVisitorsByThisFunnelStep"),class:"segmentVisitors",onClick:t[0]||(t[0]=Object(a["withModifiers"])((function(t){return e.openSegmentedVisitorLog(e.row.step_position)}),["prevent"]))},Xe,8,We)):Object(a["createCommentVNode"])("",!0),e.isLastRow?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:4,href:"",title:e.translate("General_RowEvolutionRowActionTooltipTitle"),class:"rowEvolutionByFunnelStep",onClick:t[1]||(t[1]=Object(a["withModifiers"])((function(t){return e.openRowEvolution(e.row.label)}),["prevent"]))},Qe,8,Ke))],8,qe)])],2),Object(a["createElementVNode"])("tr",{class:Object(a["normalizeClass"])("step".concat(e.row.step_position))},[Object(a["createElementVNode"])("td",Ze,[Object(a["createElementVNode"])("h4",null,Object(a["toDisplayString"])(1===e.row.step_nb_entries?e.translate("Funnels_NbEntry",1):e.translate("Funnels_NbEntries",e.row.step_nb_entries)),1),et,e.row.step_nb_entries?(Object(a["openBlock"])(),Object(a["createBlock"])(r,{key:0,class:"actionReportContainer","widget-params":{module:"Funnels",action:"getFunnelEntries",viewDataTable:"table",idSite:e.idSite,widget:1,disableLink:1,showtitle:0,idFunnel:e.funnel.idfunnel,step:e.row.step_position}},null,8,["widget-params"])):Object(a["createCommentVNode"])("",!0)]),tt,Object(a["createElementVNode"])("td",nt,[e.isLastRow?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",lt,[Object(a["createElementVNode"])("div",{title:e.translate("Funnels_XVisitorsConvertedFunnel",e.funnel.conversionRate),class:"progressOuter"},[e.funnel.conversionRate?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,class:"progressInner",style:Object(a["normalizeStyle"])({width:e.funnel.conversionRate})},null,4)):Object(a["createCommentVNode"])("",!0)],8,ot),at,it,rt,Object(a["createElementVNode"])("span",{class:"proceededRate",innerHTML:e.$sanitize(e.translate("Goals_ConversionRate","".concat(e.funnel.conversionRate,"<br />")))},null,8,st),ct,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_XoutOfYVisitsconverted",e.funnel.numConversions,e.funnel.numEntries)),1)])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ut,[Object(a["createElementVNode"])("div",{title:"".concat(e.row.step_proceeded_rate," proceeded to the next step"),class:"progressOuter"},[e.row.step_proceeded_rate?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,class:"progressInner",style:Object(a["normalizeStyle"])({width:e.row.step_proceeded_rate})},null,4)):Object(a["createCommentVNode"])("",!0)],8,dt),pt,bt,mt,Object(a["createElementVNode"])("div",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Funnels_NbProceeded",e.row.step_nb_proceeded))+" ",1),Ot,Object(a["createElementVNode"])("span",jt,Object(a["toDisplayString"])(e.row.step_proceeded_rate),1)])]))]),Object(a["createElementVNode"])("td",ft,[e.isLastRow?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("h4",ht,"→"))]),Object(a["createElementVNode"])("td",vt,[e.isLastRow?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",gt,[Object(a["createElementVNode"])("h4",null,Object(a["toDisplayString"])(1===e.row.step_nb_exits||"1"===e.row.step_nb_exits?e.translate("Funnels_NbExit",1):e.translate("Funnels_NbExits",e.row.step_nb_exits)),1),Ft,e.row.step_nb_exits?(Object(a["openBlock"])(),Object(a["createBlock"])(r,{key:0,class:"actionReportContainer","widget-params":{module:"Funnels",action:"getFunnelExits",viewDataTable:"table",idSite:e.idSite,widget:1,showtitle:0,disableLink:1,idFunnel:e.funnel.idfunnel,step:e.row.step_position}},null,8,["widget-params"])):Object(a["createCommentVNode"])("",!0)]))])],2)],64)}var Nt=window,yt=Nt.DataTable_RowActions_RowEvolution,kt=Nt.SegmentedVisitorLog,Vt=Object(a["defineComponent"])({props:{row:{type:Object,required:!0},funnel:{type:Object,required:!0},isLastRow:Boolean,isVisitorLogEnabled:Boolean,idSite:{type:[Number,String],required:!0},segment:String},components:{WidgetLoader:W["WidgetLoader"]},methods:{openSegmentedVisitorLog:function(e){var t=this.segment?";".concat(this.segment):"";kt.show("Funnel.getFunnelFlow","funnels_name==".concat(this.funnel.idfunnel,";funnels_step_position==").concat(e).concat(t),{})},openRowEvolution:function(e){(new yt).showRowEvolution("Funnels.getFunnelFlow",e,{idGoal:this.funnel.idgoal,idFunnel:this.funnel.idfunnel})}}});Vt.render=Et;var St=Vt,_t=Object(a["defineComponent"])({props:{funnel:{type:Object,required:!0},funnelFlow:{type:Array,required:!0},hasBeenPurged:Boolean,deleteReportsOlderThan:[Number,String],segment:String,idSite:{type:[Number,String],required:!0},isVisitorLogEnabled:Boolean},components:{ContentBlock:W["ContentBlock"],EnrichedHeadline:W["EnrichedHeadline"],FunnelFlowRow:St}});_t.render=Ae;var wt=_t,Bt={class:"manageSiteFunnels"},Ct={key:0,class:"addNewNoEdit"},Tt={class:"listFunnels"},xt={class:"contentHelp"},Mt={class:"first"},Lt={key:0},Dt={key:0},Gt={colspan:"4"},Rt=Object(a["createElementVNode"])("br",null,null,-1),At=Object(a["createElementVNode"])("br",null,null,-1),Ut=Object(a["createElementVNode"])("br",null,null,-1),Ht=["id"],qt={class:"first"},Pt=["title"],It={key:1},zt={key:0,style:{"padding-top":"2px"}},$t=["onClick","title"],Wt=["onClick","title"],Yt={key:0,class:"tableActionBar"},Xt=Object(a["createElementVNode"])("span",{class:"icon-add"},null,-1),Kt={key:1},Jt=["innerHTML"],Qt={class:"ui-confirm",ref:"confirm"},Zt=["value"],en=["value"],tn={class:"ui-confirm",ref:"funnelIsLockedCannotBeSaved"},nn=["value"];function ln(e,t,n,l,o,i){var r,s=Object(a["resolveComponent"])("ContentBlock"),c=Object(a["resolveComponent"])("ActivityIndicator"),u=Object(a["resolveComponent"])("Field"),d=Object(a["resolveComponent"])("ManageFunnel"),p=Object(a["resolveComponent"])("SaveButton"),b=Object(a["resolveDirective"])("content-table"),m=Object(a["resolveDirective"])("form");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Bt,[e.isAddNewView&&!e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Ct,[Object(a["createVNode"])(s,{"content-title":e.getEditFunnelHeader},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("p",null,Object(a["toDisplayString"])(e.translate("Funnels_AddNewUserUnableToEdit")),1)]})),_:1},8,["content-title"])])):Object(a["createCommentVNode"])("",!0),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",Tt,[Object(a["createVNode"])(s,{"content-title":e.translate("Funnels_ManageFunnels")},{default:Object(a["withCtx"])((function(){return[Object(a["createVNode"])(c,{loading:e.isLoading},null,8,["loading"]),Object(a["createElementVNode"])("div",xt,Object(a["toDisplayString"])(e.translate("Funnels_Introduction")),1),Object(a["withDirectives"])(Object(a["createElementVNode"])("table",null,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[Object(a["createElementVNode"])("th",Mt,Object(a["toDisplayString"])(e.translate("General_Id")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("Funnels_FunnelName")),1),Object(a["createElementVNode"])("th",null,Object(a["toDisplayString"])(e.translate("Goals_GoalConversion")),1),e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("th",Lt,Object(a["toDisplayString"])(e.translate("General_Actions")),1)):Object(a["createCommentVNode"])("",!0)])]),Object(a["createElementVNode"])("tbody",null,[Object.keys(e.funnels||{}).length?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",Dt,[Object(a["createElementVNode"])("td",Gt,[Rt,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_ThereIsNoFunnelToManage",e.siteName))+" ",1),At,Ut])])),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.funnels||[],(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("tr",{id:t.idfunnel,key:t.idfunnel},[Object(a["createElementVNode"])("td",qt,Object(a["toDisplayString"])(t.idfunnel),1),Object(a["createElementVNode"])("td",null,Object(a["toDisplayString"])(t.name),1),Object(a["createElementVNode"])("td",null,[t.idgoal&&0!==Number(t.idgoal)||t.isSalesFunnel?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",{key:0,class:"icon-ok system-success",title:e.$sanitize(e.translate("Funnels_GoalCheckHover",t.name))},null,8,Pt)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",It,"-"))]),e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("td",zt,[e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("button",{key:0,onClick:function(n){return e.editFunnel(t.idfunnel)},class:"table-action icon-edit",title:e.translate("General_Edit")},null,8,$t)):Object(a["createCommentVNode"])("",!0),e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("button",{key:1,onClick:function(n){return e.deleteFunnel(t.idfunnel)},class:"table-action icon-delete",title:e.translate("General_Delete")},null,8,Wt)):Object(a["createCommentVNode"])("",!0)])):Object(a["createCommentVNode"])("",!0)],8,Ht)})),128))])],512),[[b]]),e.userCanEditFunnels?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Yt,[Object(a["createElementVNode"])("button",{id:"addFunnel",onClick:t[0]||(t[0]=function(t){return e.createFunnel()})},[Xt,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("Funnels_AddNewFunnel")),1)])])):Object(a["createCommentVNode"])("",!0)]})),_:1},8,["content-title"])],512),[[a["vShow"],e.showFunnelList&&!e.isAddNewView]]),e.userCanEditFunnels?Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Kt,[Object(a["createVNode"])(s,{"content-title":e.getEditFunnelHeader},{default:Object(a["withCtx"])((function(){return[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(u,{uicontrol:"text",name:"funnelName",modelValue:e.funnelName,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.funnelName=t}),maxlength:50,title:e.translate("Funnels_FunnelName"),"inline-help":e.translate("Funnels_FunnelNameHelp")},null,8,["modelValue","title","inline-help"])]),Object(a["createVNode"])(d,{"is-non-goal-funnel":!0,"show-goal":0,"is-hide-enable":!0,goals:e.goals},null,8,["goals"]),Object(a["createVNode"])(p,{saving:e.isLoading,onConfirm:t[2]||(t[2]=function(t){return e.save()}),value:e.getSubmitText,class:"saveBtn"},null,8,["saving","value"]),e.isAddNewView?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,class:"entityCancel",onClick:t[3]||(t[3]=function(t){return e.showListOfFunnels()}),innerHTML:e.$sanitize(e.cancelText)},null,8,Jt))],512),[[m]])]})),_:1},8,["content-title"]),Object(a["createElementVNode"])("div",Qt,[Object(a["createElementVNode"])("h2",null,Object(a["toDisplayString"])(e.translate("Funnels_DeleteFunnelConfirm",'"'.concat(null===(r=e.funnelToDelete)||void 0===r?void 0:r.name,'"'))),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Zt),Object(a["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,en)],512),Object(a["createElementVNode"])("div",tn,[Object(a["createElementVNode"])("h3",null,Object(a["toDisplayString"])(e.translate("Funnels_FunnelIsLockedCannotBeSaved")),1),Object(a["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Ok")},null,8,nn)],512)],512)),[[a["vShow"],e.showEditFunnel||e.isAddNewView]]):Object(a["createCommentVNode"])("",!0)])}var on=Object(a["defineComponent"])({props:{userCanEditFunnels:Boolean,isAddNewView:{type:Boolean,default:!1},siteId:{type:Number,required:!0},siteName:{type:String,required:!0},funnels:{type:Object,required:!0},funnelId:{type:Number,required:!1,default:0},goals:{type:Array,required:!0}},data:function(){return{showEditFunnel:!1,showFunnelList:!0,isLoading:!1,idFunnel:0,funnelName:"",funnelToDelete:null}},components:{Field:Y["Field"],SaveButton:Y["SaveButton"],ContentBlock:W["ContentBlock"],ActivityIndicator:W["ActivityIndicator"],ManageFunnel:re},directives:{ContentTable:W["ContentTable"],Form:Y["Form"]},methods:{scrollToTop:function(){setTimeout((function(){W["Matomo"].helper.lazyScrollTo(".pageWrap",200)}))},editFunnel:function(e){var t=this.funnels.find((function(t){return Number(t.idfunnel)===Number(e)}));t.idgoal&&"0"!==t.idgoal&&W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Goals_Goals",subcategory:"Goals_ManageGoals",idGoal:t.idgoal,scrollToFunnel:1})),t.isSalesFunnel&&W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{category:"Goals_Ecommerce",subcategory:"General_Overview",isFunnelEdit:!0,scrollToFunnel:1})),W["Matomo"].postEvent("Funnels.initFunnelForm",this.siteId,e),this.showFunnelList=!1,this.showEditFunnel=!0,this.idFunnel=e,this.funnelName=t.name},deleteFunnel:function(e){var t=this;this.funnelToDelete=this.funnels.find((function(t){return t.idfunnel===e})),W["Matomo"].helper.modalConfirm(this.$refs.confirm,{yes:function(){t.isLoading=!0,W["AjaxHelper"].fetch({idSite:t.siteId,idFunnel:e,method:"Funnels.deleteNonGoalFunnel"}).then((function(){window.location.reload()})).finally((function(){t.isLoading=!1}))}})},createFunnel:function(){this.idFunnel=0,this.funnelName="",W["Matomo"].postEvent("Funnels.resetForm",{}),this.showFunnelList=!1,this.showEditFunnel=!0},showListOfFunnels:function(){this.showFunnelList=!0,this.showEditFunnel=!1,this.scrollToTop()},save:function(){var e=this,t={method:"Funnels.saveNonGoalFunnel",idFunnel:this.idFunnel,funnelName:this.funnelName},n={};W["Matomo"].postEvent("Funnels.beforeUpdateFunnel",{parameters:t,options:n}),t&&t.isLocked&&this.$refs.funnelIsLockedCannotBeSaved?W["Matomo"].helper.modalConfirm(this.$refs.funnelIsLockedCannotBeSaved,{}):t.cancelRequest||W["AjaxHelper"].fetch(t,n).then((function(){var t=W["MatomoUrl"].parsed.value.subcategory;"Funnels_AddNewFunnel"===t&&W["Matomo"].helper.isReportingPage()?W["ReportingMenuStore"].reloadMenuItems().then((function(){W["MatomoUrl"].updateHash(Object.assign(Object.assign({},W["MatomoUrl"].hashParsed.value),{},{subcategory:"Funnels_ManageFunnels"})),e.isLoading=!1})):window.location.reload()})).catch((function(){e.scrollToTop(),e.isLoading=!1}))}},computed:{getEditFunnelHeader:function(){return 0===this.idFunnel?Object(W["translate"])("Funnels_AddNewFunnel"):Object(W["translate"])("Funnels_UpdateFunnel")},getSubmitText:function(){return 0===this.idFunnel?Object(W["translate"])("Funnels_AddFunnel"):Object(W["translate"])("Funnels_UpdateFunnel")},cancelText:function(){return Object(W["translate"])("General_OrCancel","<a class='entityCancelLink'>","</a>")}},mounted:function(){var e=this;this.funnelId>0&&Object(a["nextTick"])((function(){e.editFunnel(e.funnelId)}))}});on.render=ln;var an=on,rn={class:"funnelReport"},sn={class:"funnelReportHeader"},cn={key:0,class:"legend"},un=["title"],dn=Object(a["createElementVNode"])("div",{class:"colorBoxSplit"},null,-1),pn={class:"text"},bn={class:"title"},mn={key:0,class:"subtitle"},On={key:1,class:"items"},jn={key:0,class:"item"},fn=Object(a["createElementVNode"])("div",{class:"colorBoxProceeded"},null,-1),hn={class:"text"},vn={class:"title"},gn={key:1,class:"item"},Fn=Object(a["createElementVNode"])("div",{class:"colorBoxEntries"},null,-1),En={class:"text"},Nn={class:"title"},yn={key:2,class:"item"},kn=Object(a["createElementVNode"])("div",{class:"colorBoxSkipped"},null,-1),Vn={class:"text"},Sn={class:"title"},_n={key:3,class:"item"},wn=Object(a["createElementVNode"])("div",{class:"colorBoxExits"},null,-1),Bn={class:"text"},Cn={class:"title"},Tn={key:0,id:"funnelConversionTable"},xn={class:"stepTitle"},Mn={class:"stepLabel"},Ln={class:"cellLabel"},Dn={class:"metricCount"},Gn={class:"barsContainer"},Rn={class:"barStep"},An=["onMouseenter","onMousemove","onMouseleave"],Un=["onMouseenter","onMousemove","onMouseleave"],Hn=["onMouseenter","onMousemove","onMouseleave"],qn=["onMouseenter","onMousemove","onMouseleave"],Pn={class:"cellLabel"},In={class:"metricCount"},zn={class:"metricRate"},$n={key:1},Wn=Object(a["createElementVNode"])("br",null,null,-1);function Yn(e,t,n,l,o,i){var r=Object(a["resolveComponent"])("EnrichedHeadline"),s=Object(a["resolveComponent"])("ContentBlock"),c=Object(a["resolveComponent"])("Tooltip");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",rn,[Object(a["createVNode"])(s,null,{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("div",sn,[Object(a["createElementVNode"])("h2",null,[Object(a["createVNode"])(r,{"feature-name":"Funnels","inline-help":e.getFunnelReportHelpText},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("Funnels_FunnelReport")),1)]})),_:1},8,["inline-help"])]),e.getFunnelSteps.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",cn,[e.metadata.has_multiple_valid_segments?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,class:"items",style:Object(a["normalizeStyle"])(e.metadata.has_period_comparison?"grid-template-columns: repeat(".concat(e.columnsPerRow,", auto);"):"grid-template-columns: repeat(3, auto);")},[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.metadata.segments,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"item",key:n,title:e.parseLegendText(n).hover},[dn,Object(a["createElementVNode"])("div",pn,[Object(a["createElementVNode"])("span",bn,Object(a["toDisplayString"])(e.parseLegendText(n).title),1),e.metadata.has_period_comparison?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",mn,Object(a["toDisplayString"])(e.parseLegendText(n).subtitle),1)):Object(a["createCommentVNode"])("",!0)])],8,un)})),128))],4)):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",On,[e.metadata.has_proceeded?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",jn,[fn,Object(a["createElementVNode"])("div",hn,[Object(a["createElementVNode"])("span",vn,Object(a["toDisplayString"])(e.translate("Funnels_Progressions")),1)])])):Object(a["createCommentVNode"])("",!0),e.metadata.has_entries?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",gn,[Fn,Object(a["createElementVNode"])("div",En,[Object(a["createElementVNode"])("span",Nn,Object(a["toDisplayString"])(e.translate("Funnels_Entries")),1)])])):Object(a["createCommentVNode"])("",!0),e.metadata.has_skipped?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",yn,[kn,Object(a["createElementVNode"])("div",Vn,[Object(a["createElementVNode"])("span",Sn,Object(a["toDisplayString"])(e.translate("Funnels_Skips")),1)])])):Object(a["createCommentVNode"])("",!0),e.metadata.has_exits?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",_n,[wn,Object(a["createElementVNode"])("div",Bn,[Object(a["createElementVNode"])("span",Cn,Object(a["toDisplayString"])(e.translate("Funnels_DropOff")),1)])])):Object(a["createCommentVNode"])("",!0)]))])):Object(a["createCommentVNode"])("",!0)]),e.getFunnelSteps.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("table",Tn,[Object(a["createElementVNode"])("thead",null,[Object(a["createElementVNode"])("tr",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.metadata.steps,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("th",{key:t},[Object(a["createElementVNode"])("div",xn,Object(a["toDisplayString"])(e.translate("Funnels_Step"))+" "+Object(a["toDisplayString"])(n+1),1),Object(a["createElementVNode"])("div",Mn,Object(a["toDisplayString"])(t),1)])})),128))])]),Object(a["createElementVNode"])("tbody",null,[Object(a["createElementVNode"])("tr",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.getFunnelSteps,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("td",{key:n},[Object(a["createElementVNode"])("div",Ln,Object(a["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(a["createElementVNode"])("div",Dn,Object(a["toDisplayString"])(e.formatAbbr(e.getFirstSegmentStep(n).step_nb_visits)),1),Object(a["createElementVNode"])("div",Gn,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(t,(function(t,l){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:l,class:"barStepContainer"},[Object(a["createElementVNode"])("div",Rn,[Object(a["createElementVNode"])("div",{class:"barProceeded",style:Object(a["normalizeStyle"])({height:e.getBarHeight("proceeded",n,t)}),onMouseenter:function(o){return e.handleTooltip(o,l,n,t,"proceeded","show")},onMousemove:function(o){return e.handleTooltip(o,l,n,t,"proceeded","move")},onMouseleave:function(o){return e.handleTooltip(o,l,n,t,"proceeded","hide")}},null,44,An),Object(a["createElementVNode"])("div",{class:"barEntries",style:Object(a["normalizeStyle"])("0%"===e.getBarHeight("entries",n,t)?{display:"none"}:{height:e.getBarHeight("entries",n,t)}),onMouseenter:function(o){return e.handleTooltip(o,l,n,t,"entries","show")},onMousemove:function(o){return e.handleTooltip(o,l,n,t,"entries","move")},onMouseleave:function(o){return e.handleTooltip(o,l,n,t,"entries","hide")}},null,44,Un),Object(a["createElementVNode"])("div",{class:"barSkipped",style:Object(a["normalizeStyle"])("0%"===e.getBarHeight("skipped",n,t)?{display:"none"}:{height:e.getBarHeight("skipped",n,t)}),onMouseenter:function(o){return e.handleTooltip(o,l,n,t,"skipped","show")},onMousemove:function(o){return e.handleTooltip(o,l,n,t,"skipped","move")},onMouseleave:function(o){return e.handleTooltip(o,l,n,t,"skipped","hide")}},null,44,Hn),Object(a["createElementVNode"])("div",{class:"barExits",style:Object(a["normalizeStyle"])("0%"===e.getBarHeight("exits",n,t)?{display:"none"}:{height:e.getBarHeight("exits",n,t)}),onMouseenter:function(o){return e.handleTooltip(o,l,n,t,"exits","show")},onMousemove:function(o){return e.handleTooltip(o,l,n,t,"exits","move")},onMouseleave:function(o){return e.handleTooltip(o,l,n,t,"exits","hide")}},null,44,qn)])])})),128))])])})),128))]),Object(a["createElementVNode"])("tr",null,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.getFunnelSteps,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("td",{key:n},[Object(a["createElementVNode"])("div",Pn,Object(a["toDisplayString"])(e.getBottomLabel(e.getFunnelSteps.length===n+1)),1),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(e.getMetricValueClasses(e.getFunnelSteps.length===n+1))},[Object(a["createElementVNode"])("span",In,Object(a["toDisplayString"])(e.formatAbbr(e.getBottomMetric(n,e.getFirstSegmentStep(n)))),1),Object(a["createElementVNode"])("span",zn," ("+Object(a["toDisplayString"])(e.getBottomRate(n,e.getFirstSegmentStep(n)))+") ",1)],2)])})),128))])])])):(Object(a["openBlock"])(),Object(a["createElementBlock"])("p",$n,[Object(a["createElementVNode"])("strong",null,Object(a["toDisplayString"])(e.translate("CoreHome_ThereIsNoDataForThisReport")),1),Wn,Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.translate("Funnels_FunnelReportNotGeneratedYet")),1)]))]})),_:1}),Object(a["createVNode"])(c,{ref:"tooltip",title:e.tooltipTitle,subtitle:e.tooltipSubtitle,exits:e.tooltipExits,skipped:e.tooltipSkipped,entries:e.tooltipEntries,proceeded:e.tooltipProceeded,type:e.tooltipType},null,8,["title","subtitle","exits","skipped","entries","proceeded","type"])])}var Xn={class:"tooltip-item title"},Kn={class:"tooltip-item subtitle"},Jn={class:"tooltip-label"},Qn={class:"tooltip-value"},Zn={class:"tooltip-label"},el={class:"tooltip-value"},tl={class:"tooltip-label"},nl={class:"tooltip-value"},ll={class:"tooltip-label"},ol={class:"tooltip-value"};function al(e,t,n,l,o,i){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{ref:"tooltipRef",class:"tooltip",style:Object(a["normalizeStyle"])(e.tooltipStyle)},[Object(a["createElementVNode"])("div",Xn,Object(a["toDisplayString"])(e.title),1),Object(a["createElementVNode"])("div",Kn,Object(a["toDisplayString"])(e.subtitle),1),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["tooltip-item",{selected:"exits"===e.type}])},[Object(a["createElementVNode"])("span",Jn,Object(a["toDisplayString"])(e.translate("Funnels_DropOff")),1),Object(a["createElementVNode"])("span",Qn,Object(a["toDisplayString"])(e.formatNumber(e.exits)),1)],2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["tooltip-item",{selected:"skipped"===e.type}])},[Object(a["createElementVNode"])("span",Zn,Object(a["toDisplayString"])(e.translate("Funnels_Skips")),1),Object(a["createElementVNode"])("span",el,Object(a["toDisplayString"])(e.formatNumber(e.skipped)),1)],2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["tooltip-item",{selected:"entries"===e.type}])},[Object(a["createElementVNode"])("span",tl,Object(a["toDisplayString"])(e.translate("Funnels_Entries")),1),Object(a["createElementVNode"])("span",nl,Object(a["toDisplayString"])(e.formatNumber(e.entries)),1)],2),Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["tooltip-item",{selected:"proceeded"===e.type}])},[Object(a["createElementVNode"])("span",ll,Object(a["toDisplayString"])(e.translate("Funnels_Progressions")),1),Object(a["createElementVNode"])("span",ol,Object(a["toDisplayString"])(e.formatNumber(e.proceeded)),1)],2)],4)),[[a["vShow"],e.visible]])}var il=n("6ec9"),rl=Object(a["defineComponent"])({props:{title:{type:String,required:!0},subtitle:{type:String,required:!0},exits:{type:Number,required:!0},skipped:{type:Number,required:!0},entries:{type:Number,required:!0},proceeded:{type:Number,required:!0},type:{type:String,required:!0}},setup:function(){var e=Object(a["reactive"])({visible:!1,position:{top:0,left:0}}),t=Object(a["ref"])(null),n=Object(a["computed"])((function(){return{top:"".concat(e.position.top,"px"),left:"".concat(e.position.left,"px"),position:"absolute",zIndex:1e3}}));function l(n){var l=window.scrollY||document.documentElement.scrollTop,o=window.scrollX||document.documentElement.scrollLeft;e.position.top=n.clientY+l+10,e.position.left=n.clientX+o+10,e.visible=!0,Object(a["nextTick"])((function(){var a=t.value;if(a){var i=window,r=i.innerWidth,s=i.innerHeight,c=a.getBoundingClientRect();c.right>r&&(e.position.left=n.clientX+o-c.width-10),c.bottom>s&&(e.position.top=n.clientY+l-c.height-10);var u=a.getBoundingClientRect();u.left<0&&(e.position.left=o+10),u.top<0&&(e.position.top=l+10)}}))}function o(){e.visible=!1}return Object.assign(Object.assign({},Object(a["toRefs"])(e)),{},{tooltipRef:t,show:l,hide:o,tooltipStyle:n,translate:W["translate"],formatNumber:il["formatNumber"]})}});rl.render=al;var sl=rl,cl=Object(a["defineComponent"])({props:{metadata:{type:Object,required:!0},firstSegmentFlow:{type:Array,required:!0},funnelFlow:{type:Array,required:!0},isClosedFunnel:{type:Boolean,default:!1}},components:{EnrichedHeadline:W["EnrichedHeadline"],ContentBlock:W["ContentBlock"],Tooltip:sl},setup:function(){var e=Object(a["ref"])(null);return{tooltip:e,formatAbbr:il["formatAbbr"]}},mounted:function(){0},data:function(){return{tooltipTitle:"",tooltipSubtitle:"",tooltipExits:0,tooltipSkipped:0,tooltipEntries:0,tooltipProceeded:0,tooltipType:""}},methods:{getFirstSegmentStep:function(e){return this.firstSegmentFlow[e]||{}},translateNumericPlaceholder:function(e,t){return Object(W["translate"])(e,t||0)},getBarHeight:function(e,t,n){if(null===n)return"0%";var l={empty:n.bar_height_empty,exits:n.bar_height_exits,skipped:n.bar_height_skipped,entries:0===t?0:n.bar_height_entries,proceeded:0===t?n.bar_height_entries:n.bar_height_proceeded};return"".concat(l[e]||0,"%")},setTooltipData:function(e,t,n,l){var o=this.parseSegmentKey(e),a=o.title,i=o.period;this.tooltipTitle=a,this.tooltipSubtitle=i,this.tooltipExits=n.step_nb_previous_exits||0,this.tooltipSkipped=n.step_nb_skipped||0,this.tooltipEntries=n.step_nb_entries||0,this.tooltipProceeded=n.step_nb_previous_proceeded||0,this.tooltipType=0===t&&"proceeded"===l?"entries":l},parseLegendText:function(e){var t=this.parseSegmentKey(e),n=t.title,l=t.period;return{title:n,subtitle:l,hover:"".concat(n," (").concat(l,")")}},parseSegmentKey:function(e){var t=String(e),n=t.split("~|~"),l=n[0],o=n[1];return{title:l,period:o}},getBottomLabel:function(e){return e?Object(W["translate"])("Funnels_FunnelConversion"):Object(W["translate"])("Funnels_Exits")},getBottomMetric:function(e,t){return this.getFunnelSteps.length===e+1?t.step_nb_visits:t.step_nb_exits},getBottomRate:function(e,t){return this.getFunnelSteps.length===e+1?t.conversion_rate:t.step_rate_exits},getMetricValueClasses:function(e){var t="metricValues";return e&&(t+=" conversionMetrics"),t},handleTooltip:function(e,t,n,l,o,a){this.tooltip&&("show"===a?(this.setTooltipData(t,n,l,o),this.tooltip.show(e)):"move"===a?this.tooltip.show(e):this.tooltip.hide())}},computed:{getFunnelSteps:function(){return this.funnelFlow},getFunnelReportHelpText:function(){var e=Object(W["translate"])("Funnels_FunnelReportHelp"),t=Object(W["translate"])("Funnels_FunnelReportHelpOpenFunnel"),n="".concat(e," ").concat(t);return this.isClosedFunnel&&(t=Object(W["translate"])("Funnels_FunnelReportHelpClosedFunnel"),n="".concat(e," ").concat(t)),n},columnsPerRow:function(){var e=Object.keys(this.metadata.segments).length;return Math.ceil(e/2)}}});cl.render=Yn;var ul=cl;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(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["HeatmapSessionRecording"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["HeatmapSessionRecording"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},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 a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},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/HeatmapSessionRecording/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"246e":function(e,t,n){var a,i;(function(r,o,s){e.exports?e.exports=s():(a=s,i="function"===typeof a?a.call(t,n,t,e):a,void 0===i||(e.exports=i))})(0,0,(function(){var e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},t=function(){var t=function(e){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=e["xField"]||e.defaultXField,this._yField=e["yField"]||e.defaultYField,this._valueField=e["valueField"]||e.defaultValueField,e["radius"]&&(this._cfgRadius=e["radius"])},n=e.defaultRadius;return t.prototype={_organiseData:function(e,t){var a=e[this._xField],i=e[this._yField],r=this._radi,o=this._data,s=this._max,l=this._min,c=e[this._valueField]||1,d=e.radius||this._cfgRadius||n;o[a]||(o[a]=[],r[a]=[]),o[a][i]?o[a][i]+=c:(o[a][i]=c,r[a][i]=d);var u=o[a][i];return u>s?(t?this.setDataMax(u):this._max=u,!1):u<l?(t?this.setDataMin(u):this._min=u,!1):{x:a,y:i,value:c,radius:d,min:l,max:s}},_unOrganizeData:function(){var e=[],t=this._data,n=this._radi;for(var a in t)for(var i in t[a])e.push({x:a,y:i,radius:n[a][i],value:t[a][i]});return{min:this._min,max:this._max,data:e}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0){var e=arguments[0],t=e.length;while(t--)this.addData.call(this,e[t])}else{var n=this._organiseData(arguments[0],!0);n&&(0===this._data.length&&(this._min=this._max=n.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[n]}))}return this},setData:function(e){var t=e.data,n=t.length;this._data=[],this._radi=[];for(var a=0;a<n;a++)this._organiseData(t[a],!1);return this._max=e.max,this._min=e.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(e){return this._max=e,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(e){return this._min=e,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(e){this._coordinator=e},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},t}(),n=function(){var e=function(e){var t=e.gradient||e.defaultGradient,n=document.createElement("canvas"),a=n.getContext("2d");n.width=256,n.height=1;var i=a.createLinearGradient(0,0,256,1);for(var r in t)i.addColorStop(r,t[r]);return a.fillStyle=i,a.fillRect(0,0,256,1),a.getImageData(0,0,256,1).data},t=function(e,t){var n=document.createElement("canvas"),a=n.getContext("2d"),i=e,r=e;if(n.width=n.height=2*e,1==t)a.beginPath(),a.arc(i,r,e,0,2*Math.PI,!1),a.fillStyle="rgba(0,0,0,1)",a.fill();else{var o=a.createRadialGradient(i,r,e*t,i,r,e);o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=o,a.fillRect(0,0,2*e,2*e)}return n},n=function(e){var t=[],n=e.min,a=e.max,i=e.radi,r=(e=e.data,Object.keys(e)),o=r.length;while(o--){var s=r[o],l=Object.keys(e[s]),c=l.length;while(c--){var d=l[c],u=e[s][d],m=i[s][d];t.push({x:s,y:d,value:u,radius:m})}}return{min:n,max:a,data:t}};function a(t){var n=t.container,a=this.shadowCanvas=document.createElement("canvas"),i=this.canvas=t.canvas||document.createElement("canvas"),r=(this._renderBoundaries=[1e4,1e4,0,0],getComputedStyle(t.container)||{});i.className="heatmap-canvas",this._width=i.width=a.width=t.width||+r.width.replace(/px/,""),this._height=i.height=a.height=t.height||+r.height.replace(/px/,""),this.shadowCtx=a.getContext("2d"),this.ctx=i.getContext("2d"),i.style.cssText=a.style.cssText="position:absolute;left:0;top:0;",n.style.position="relative",n.appendChild(i),this._palette=e(t),this._templates={},this._setStyles(t)}return a.prototype={renderPartial:function(e){e.data.length>0&&(this._drawAlpha(e),this._colorize())},renderAll:function(e){this._clear(),e.data.length>0&&(this._drawAlpha(n(e)),this._colorize())},_updateGradient:function(t){this._palette=e(t)},updateConfig:function(e){e["gradient"]&&this._updateGradient(e),this._setStyles(e)},setDimensions:function(e,t){this._width=e,this._height=t,this.canvas.width=this.shadowCanvas.width=e,this.canvas.height=this.shadowCanvas.height=t},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(e){this._blur=0==e.blur?0:e.blur||e.defaultBlur,e.backgroundColor&&(this.canvas.style.backgroundColor=e.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=e.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=e.height||this._height,this._opacity=255*(e.opacity||0),this._maxOpacity=255*(e.maxOpacity||e.defaultMaxOpacity),this._minOpacity=255*(e.minOpacity||e.defaultMinOpacity),this._useGradientOpacity=!!e.useGradientOpacity},_drawAlpha:function(e){var n=this._min=e.min,a=this._max=e.max,i=(e=e.data||[],e.length),r=1-this._blur;while(i--){var o,s=e[i],l=s.x,c=s.y,d=s.radius,u=Math.min(s.value,a),m=l-d,p=c-d,h=this.shadowCtx;this._templates[d]?o=this._templates[d]:this._templates[d]=o=t(d,r);var g=(u-n)/(a-n);h.globalAlpha=g<.01?.01:g,h.drawImage(o,m,p),m<this._renderBoundaries[0]&&(this._renderBoundaries[0]=m),p<this._renderBoundaries[1]&&(this._renderBoundaries[1]=p),m+2*d>this._renderBoundaries[2]&&(this._renderBoundaries[2]=m+2*d),p+2*d>this._renderBoundaries[3]&&(this._renderBoundaries[3]=p+2*d)}},_colorize:function(){var e=this._renderBoundaries[0],t=this._renderBoundaries[1],n=this._renderBoundaries[2]-e,a=this._renderBoundaries[3]-t,i=this._width,r=this._height,o=this._opacity,s=this._maxOpacity,l=this._minOpacity,c=this._useGradientOpacity;e<0&&(e=0),t<0&&(t=0),e+n>i&&(n=i-e),t+a>r&&(a=r-t);for(var d=this.shadowCtx.getImageData(e,t,n,a),u=d.data,m=u.length,p=this._palette,h=3;h<m;h+=4){var g,f=u[h],b=4*f;if(b)g=o>0?o:f<s?f<l?l:f:s,u[h-3]=p[b],u[h-2]=p[b+1],u[h-1]=p[b+2],u[h]=c?p[b+3]:g}d.data=u,this.ctx.putImageData(d,e,t),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(e){var t,n=this.shadowCtx,a=n.getImageData(e.x,e.y,1,1),i=a.data[3],r=this._max,o=this._min;return t=Math.abs(r-o)*(i/255)>>0,t},getDataURL:function(){return this.canvas.toDataURL()}},a}(),a=function(){var t=!1;return"canvas2d"===e["defaultRenderer"]&&(t=n),t}(),i={merge:function(){for(var e={},t=arguments.length,n=0;n<t;n++){var a=arguments[n];for(var i in a)e[i]=a[i]}return e}},r=function(){var n=function(){function e(){this.cStore={}}return e.prototype={on:function(e,t,n){var a=this.cStore;a[e]||(a[e]=[]),a[e].push((function(e){return t.call(n,e)}))},emit:function(e,t){var n=this.cStore;if(n[e])for(var a=n[e].length,i=0;i<a;i++){var r=n[e][i];r(t)}}},e}(),r=function(e){var t=e._renderer,n=e._coordinator,a=e._store;n.on("renderpartial",t.renderPartial,t),n.on("renderall",t.renderAll,t),n.on("extremachange",(function(t){e._config.onExtremaChange&&e._config.onExtremaChange({min:t.min,max:t.max,gradient:e._config["gradient"]||e._config["defaultGradient"]})})),a.setCoordinator(n)};function o(){var o=this._config=i.merge(e,arguments[0]||{});if(this._coordinator=new n,o["plugin"]){var s=o["plugin"];if(!e.plugins[s])throw new Error("Plugin '"+s+"' not found. Maybe it was not registered.");var l=e.plugins[s];this._renderer=new l.renderer(o),this._store=new l.store(o)}else this._renderer=new a(o),this._store=new t(o);r(this)}return o.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(e){return this._config=i.merge(this._config,e),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(e){return this._store.getValueAt?this._store.getValueAt(e):this._renderer.getValueAt?this._renderer.getValueAt(e):null}},o}(),o={create:function(e){return new r(e)},register:function(t,n){e.plugins[t]=n}};return o}))},"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,"HeatmapVis",(function(){return ve})),n.d(t,"SessionRecordingVis",(function(){return xt})),n.d(t,"HsrTargetTest",(function(){return It})),n.d(t,"HsrUrlTarget",(function(){return nn})),n.d(t,"HeatmapEdit",(function(){return Ln})),n.d(t,"HeatmapList",(function(){return Ra})),n.d(t,"HeatmapManage",(function(){return Fa})),n.d(t,"SessionRecordingEdit",(function(){return vi})),n.d(t,"SessionRecordingList",(function(){return sr})),n.d(t,"SessionRecordingManage",(function(){return ur})),n.d(t,"ListOfPageviews",(function(){return Or})),n.d(t,"HeatmapVisPage",(function(){return Rr})),n.d(t,"MatomoJsNotWritableAlert",(function(){return Ba})),n.d(t,"Tooltip",(function(){return Q})),"undefined"!==typeof window){var a=window.document.currentScript,i=a&&a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var r=n("8bbf");function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s={class:"heatmapVis"},l=["innerHTML"],c={class:"heatmapSelection"},d={style:{display:"inline","margin-right":"13.5px"}},u=["onClick"],m={style:{display:"inline","margin-left":"3rem","margin-right":"13.5px"}},p=["title","onClick"],h=["src","alt"],g=Object(r["createTextVNode"])(),f={class:"numSamples"},b={class:"legendOuter"},v={class:"legend-area"},y=Object(r["createElementVNode"])("span",{class:"min"},"0",-1),O=["src"],j=Object(r["createElementVNode"])("span",{class:"max"},"0",-1),S={class:"customIframeWidth"},_=["textContent"],H={class:"iframeRecordingContainer",ref:"iframeRecordingContainer"},V={class:"heatmapWrapper"},N={id:"heatmapContainer",ref:"heatmapContainer"},w=Object(r["createElementVNode"])("div",{id:"highlightDiv"},null,-1),E=Object(r["createElementVNode"])("div",{class:"loadingUnderlay"},null,-1),k={class:"valign-wrapper loadingInner"},R={class:"loadingContent"},C=["title"],x=["src","width"],T={style:{"margin-top":"2rem"}},D={class:"ui-confirm",id:"confirmDeleteHeatmapScreenshot",ref:"confirmDeleteHeatmapScreenshot"},M=["value"],P=["value"];function A(e,t,n,a,i,A){var B=Object(r["resolveComponent"])("Field"),U=Object(r["resolveComponent"])("SaveButton"),I=Object(r["resolveComponent"])("Tooltip");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",s,[e.actualNumSamples.nb_samples_device_all?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:0,innerHTML:e.$sanitize(e.recordedSamplesSince)},null,8,l)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",c,[Object(r["createElementVNode"])("h4",d,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_Action")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.heatmapTypes,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{class:Object(r["normalizeClass"])(["btn-flat",o({visActive:t.key===e.heatmapType},"heatmapType".concat(t.key),!0)]),onClick:function(n){return e.changeHeatmapType(t.key)},key:t.key},Object(r["toDisplayString"])(t.name),11,u)})),128)),Object(r["createElementVNode"])("h4",m,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeviceType")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.deviceTypesWithSamples,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{class:Object(r["normalizeClass"])(["btn-flat",o({visActive:t.key===e.deviceType},"deviceType".concat(t.key),!0)]),title:t.tooltip,onClick:function(n){return e.changeDeviceType(t.key)},key:t.key},[Object(r["createElementVNode"])("img",{height:"15",src:t.logo,alt:"".concat(e.translate("DevicesDetection_Device")," ").concat(t.name)},null,8,h),g,Object(r["createElementVNode"])("span",f,Object(r["toDisplayString"])(t.numSamples),1)],10,p)})),128)),Object(r["createElementVNode"])("div",b,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.translate("Installation_Legend")),1),Object(r["createElementVNode"])("div",v,[y,Object(r["createElementVNode"])("img",{class:"gradient",alt:"gradient",src:e.gradientImgData},null,8,O),j])]),Object(r["createElementVNode"])("div",S,[Object(r["createElementVNode"])("span",{style:{"margin-left":"2.5rem","margin-right":"13.5px"},textContent:Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_Width"))},null,8,_),Object(r["createVNode"])(B,{uicontrol:"select",name:"iframewidth","model-value":e.customIframeWidth,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.customIframeWidth=t,e.changeIframeWidth(e.customIframeWidth,!0)}),options:e.iframeWidthOptions},null,8,["model-value","options"])])]),Object(r["createElementVNode"])("div",H,[Object(r["createElementVNode"])("div",V,[Object(r["createElementVNode"])("div",N,null,512),w]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"hsrLoadingOuter",style:Object(r["normalizeStyle"])([{height:"400px"},{width:e.iframeWidth+"px"}])},[E,Object(r["createElementVNode"])("div",k,[Object(r["createElementVNode"])("div",R,Object(r["toDisplayString"])(e.translate("General_Loading")),1)])],4),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"aboveFoldLine",title:e.translate("HeatmapSessionRecording_AvgAboveFoldDescription"),style:Object(r["normalizeStyle"])({width:e.iframeWidth+"px",top:e.avgFold+"px"})},[Object(r["createElementVNode"])("div",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_AvgAboveFoldTitle",e.avgFold)),1)],12,C),[[r["vShow"],e.avgFold]]),e.embedUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("iframe",{key:0,id:"recordingPlayer",ref:"recordingPlayer",sandbox:"allow-scripts allow-same-origin",referrerpolicy:"no-referrer",onLoad:t[1]||(t[1]=function(t){return e.onLoaded()}),height:"400",src:e.embedUrl,width:e.iframeWidth},null,40,x)):Object(r["createCommentVNode"])("",!0)],512),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",T,[Object(r["createVNode"])(U,{style:{display:"block !important"},loading:e.isLoading,onClick:t[2]||(t[2]=function(t){return e.deleteScreenshot()}),value:e.translate("HeatmapSessionRecording_DeleteScreenshot")},null,8,["loading","value"])],512),[[r["vShow"],e.showDeleteScreenshot]]),Object(r["createElementVNode"])("div",D,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteHeatmapScreenshotConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,M),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,P)],512),Object(r["createVNode"])(I,{ref:"tooltip","click-count":e.clickCount,"click-rate":e.clickRate,"is-moves":1===e.heatmapType},null,8,["click-count","click-rate","is-moves"])])}var B=n("246e"),U=n.n(B),I=n("19dc"),L=n("a5a2");
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */
function F(e){return e&&e.contentWindow?e.contentWindow:e&&e.contentDocument&&e.contentDocument.defaultView?e.contentDocument.defaultView:void 0}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */function W(e,t){var n=null;return function(a,i){return n&&(n.abort(),n=null),n=new AbortController,I["AjaxHelper"].post(Object.assign(Object.assign({},a),{},{method:e}),i,Object.assign(Object.assign({},t),{},{abortController:n})).finally((function(){n=null}))}}var q={class:"tooltip-item"},z={class:"tooltip-label"},G={class:"tooltip-value"},$={class:"tooltip-item"},J={class:"tooltip-label"},X={class:"tooltip-value"};function Y(e,t,n,a,i,o){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{ref:"tooltipRef",class:"tooltip",style:Object(r["normalizeStyle"])(e.tooltipStyle)},[Object(r["createElementVNode"])("div",q,[Object(r["createElementVNode"])("span",z,Object(r["toDisplayString"])(e.getClickCountTranslation),1),Object(r["createElementVNode"])("span",G,Object(r["toDisplayString"])(e.getClickCount),1)]),Object(r["createElementVNode"])("div",$,[Object(r["createElementVNode"])("span",J,Object(r["toDisplayString"])(e.getClickRateTranslation),1),Object(r["createElementVNode"])("span",X,Object(r["toDisplayString"])(e.getClickRate),1)])],4)),[[r["vShow"],e.visible]])}var K=Object(r["defineComponent"])({props:{clickCount:{type:Number,required:!0},clickRate:{type:Number,required:!0},isMoves:{type:Boolean,required:!1,default:!1}},setup:function(){var e=Object(r["reactive"])({visible:!1,position:{top:0,left:0}}),t=Object(r["ref"])(null),n=Object(r["computed"])((function(){return{top:"".concat(e.position.top,"px"),left:"".concat(e.position.left,"px"),position:"absolute",zIndex:1e3}}));function a(n){var a=window.scrollY||document.documentElement.scrollTop,i=window.scrollX||document.documentElement.scrollLeft;e.position.top=n.clientY+a+10,e.position.left=n.clientX+i+10,e.visible=!0,Object(r["nextTick"])((function(){var r=t.value;if(r){var o=window,s=o.innerWidth,l=o.innerHeight,c=r.getBoundingClientRect();c.right>s&&(e.position.left=n.clientX+i-c.width-10),c.bottom>l&&(e.position.top=n.clientY+a-c.height-10);var d=r.getBoundingClientRect();d.left<0&&(e.position.left=i+10),d.top<0&&(e.position.top=a+10)}}))}function i(){e.visible=!1}return Object.assign(Object.assign({},Object(r["toRefs"])(e)),{},{tooltipRef:t,show:a,hide:i,tooltipStyle:n,translate:I["translate"]})},computed:{getClickCount:function(){return I["NumberFormatter"].formatNumber(this.clickCount)},getClickRate:function(){return I["NumberFormatter"].formatPercent(this.clickRate)},getClickCountTranslation:function(){var e=this.isMoves?"HeatmapSessionRecording_Moves":"HeatmapSessionRecording_Clicks";return Object(I["translate"])(e)},getClickRateTranslation:function(){var e=this.isMoves?"HeatmapSessionRecording_MoveRate":"HeatmapSessionRecording_ClickRate";return Object(I["translate"])(e)}}});K.render=Y;var Q=K;function Z(e,t){return ie(e)||ae(e,t)||te(e,t)||ee()}function ee(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){if(e){if("string"===typeof e)return ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function ae(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(l){s=!0,i=l}finally{try{o||null==n["return"]||n["return"]()}finally{if(s)throw i}}return r}}function ie(e){if(Array.isArray(e))return e}var re=window,oe=re.$,se=1,le=2,ce=3,de=32e3,ue=String(window.navigator.userAgent).toLowerCase();function me(e,t,n){var a=oe(e);a.css("height","400px");var i=n.getIframeHeight();a.css("height","".concat(i,"px")),oe(t).css("height","".concat(i,"px")).css("width","".concat(a.width(),"px")).empty();for(var r=Math.ceil(i/de),o=1;o<=r;o+=1){var s=de;o===r&&(s=i%de),oe(t).append('<div id="heatmap'.concat(o,'" class="heatmapTile"></div>')),oe(t).find("#heatmap".concat(o)).css({height:"".concat(s,"px")})}return r}function pe(e,t,n,a){var i=oe(t);i.css("height","400px");var r=n.getIframeHeight();i.css("height","".concat(r,"px"));var o=1e3,s=r/o,l=a.reduce((function(e,t){return e+parseInt(t.value,10)}),0),c=[],d=0,u=null,m=100,p=0;function h(e,t,n,a,i){return a+(e-t)/(n-t)*(i-a)}function g(e,t,n){if(t===n||!t&&!n)return[255,255,0];var a=h(e,t,n,0,255),i=(n-t)/5;return a>204?[255,h(e,n-i,n,255,0),0]:a>153?[h(e,n-2*i,n-i,0,255),255,0]:a>102?[0,255,h(e,n-3*i,n-2*i,255,0)]:a>51?[0,h(e,n-4*i,n-3*i,0,255),255]:[h(e,t,n-4*i,255,0),0,255]}if(a.forEach((function(e){var t=parseInt(e.value,10),n=parseInt(e.label,10),a=Math.round(n*s);u&&u.position===a?d+=t:(0!==l&&(m=(l-d)/l*100),d+=t,u={percentageValue:10*parseFloat(m.toFixed(1)),position:p,percent:m.toFixed(1)},c.push(u)),p=a})),c.length){var f=c.some((function(e){return 0===e.position}));f||c.unshift({percent:"100.0",percentageValue:1e3,position:0})}else c.push({percent:"0",percentageValue:0,position:0});var b=0,v=1e3;c&&c.length&&c[0]&&(b=c[c.length-1].percentageValue);for(var y=i.width(),O=null,j=0;j<c.length;j+=1){var S=c[j];O=c[j+1]?c[j+1]:{position:r};var _=S.position,H=O.position-S.position;0===H&&(H=1);var V="".concat(S.percent," percent reached this point"),N=g(S.percentageValue,b,v),w="rgb(".concat(N.join(","),")");oe(e).append('<div class="scrollHeatmapLeaf" title="'.concat(V,'" style="width: ').concat(y,"px;height:")+" ".concat(H,"px;left: 0;top: ").concat(_,"px; background-color: ").concat(w,';"></div>'))}oe(".scrollHeatmapLeaf",e).tooltip({track:!0,items:"*",tooltipClass:"heatmapTooltip",show:!1,hide:!1}),oe(".legend-area .min").text("".concat((b/10).toFixed(1),"%")),oe(".legend-area .max").text("".concat((v/10).toFixed(1),"%"))}function he(e,t,n,a){var i=me(e,t,n),r=document.createElement("canvas");r.width=100,r.height=10;var o=document.querySelector(".legend-area .min"),s=document.querySelector(".legend-area .max"),l=document.querySelector(".legend-area .gradient"),c=r.getContext("2d"),d={};function u(e){if(o.innerHTML="".concat(e.min),s.innerHTML="".concat(e.max),e.gradient&&e.gradient!==d){d=e.gradient;var t=c.createLinearGradient(0,0,100,1);Object.keys(d).forEach((function(e){t.addColorStop(parseFloat(e),d[e])})),c.fillStyle=t,c.fillRect(0,0,100,10),l.src=r.toDataURL()}}for(var m=[],p=function(e){var t={min:a.min,max:a.max,data:[]},n={container:document.getElementById("heatmap".concat(e)),radius:10,maxOpacity:.5,minOpacity:0,blur:.75};if(1===e&&(n.onExtremaChange=u),a&&a.data&&a.data.length>=2e4?n.radius=8:a&&a.data&&a.data.length>=2e3&&(n.radius=9),1===i)t.data=a.data;else{var r=(e-1)*de,o=r+de-1;a.data.forEach((function(e){if(e.y>=r&&e.y<=o){var n=Object.assign(Object.assign({},e),{},{y:e.y-r});t.data.push(n)}}))}var s=U.a.create(n);s.setData(t),m.push(s)},h=1;h<=i;h+=1)p(h);return m}ue.match(/(iPod|iPhone|iPad|Android|IEMobile|Windows Phone)/i)?de=2e3:(ue.indexOf("msie ")>0||ue.indexOf("trident/")>0||ue.indexOf("edge")>0)&&(de=8e3);var ge=Object(r["defineComponent"])({props:{idSiteHsr:{type:Number,required:!0},deviceTypes:{type:Array,required:!0},heatmapTypes:{type:Array,required:!0},breakpointMobile:{type:Number,required:!0},breakpointTablet:{type:Number,required:!0},offsetAccuracy:{type:Number,required:!0},heatmapPeriod:{type:String,required:!0},heatmapDate:{type:String,required:!0},url:{type:String,required:!0},isActive:Boolean,numSamples:{type:Object,required:!0},excludedElements:{type:String,required:!0},createdDate:{type:String,required:!0},desktopPreviewSize:{type:Number,required:!0},iframeResolutionsValues:{type:Object,required:!0}},components:{Field:L["Field"],SaveButton:L["SaveButton"],Tooltip:Q},data:function(){return{isLoading:!1,iframeWidth:this.desktopPreviewSize,customIframeWidth:this.desktopPreviewSize,avgFold:0,heatmapType:this.heatmapTypes[0].key,deviceType:this.deviceTypes[0].key,iframeResolutions:this.iframeResolutionsValues,actualNumSamples:this.numSamples,dataCoordinates:[],currentElement:null,totalClicks:0,tooltipShowTimeoutId:null,clickCount:0,clickRate:0}},setup:function(e){var t=Object(r["ref"])(null),n=null,a=new Promise((function(e){n=e})),i=null,o=function(t){return i||(i=F(t).recordingFrame,i.excludeElements(e.excludedElements),i.addClass("html","piwikHeatmap"),i.addClass("html","matomoHeatmap"),i.addWorkaroundForSharepointHeatmaps()),i},s=Object(r["ref"])(null),l=function(e,t,n,a){s.value=he(e,t,n,a)};return{iframeLoadedPromise:a,onLoaded:n,getRecordedHeatmap:W("HeatmapSessionRecording.getRecordedHeatmap"),getRecordedHeatmapMetadata:W("HeatmapSessionRecording.getRecordedHeatmapMetadata"),getRecordingIframe:o,heatmapInstances:s,renderHeatmap:l,tooltip:t}},created:function(){-1===this.iframeResolutions.indexOf(this.breakpointMobile)&&this.iframeResolutions.push(this.breakpointMobile),-1===this.iframeResolutions.indexOf(this.breakpointTablet)&&this.iframeResolutions.push(this.breakpointTablet),this.iframeResolutions=this.iframeResolutions.sort((function(e,t){return e-t})),this.fetchHeatmap(),I["Matomo"].postEvent("hidePeriodSelector")},watch:{isLoading:function(){var e=this;if(!0!==this.isLoading){var t=window.document.getElementById("heatmapContainer");t&&(t.addEventListener("mouseleave",(function(t){e.tooltipShowTimeoutId&&(clearTimeout(e.tooltipShowTimeoutId),e.tooltipShowTimeoutId=null),e.currentElement=null,e.handleTooltip(t,0,0,"hide");var n=window.document.getElementById("highlightDiv");n&&(n.hidden=!0)})),t.addEventListener("mousemove",(function(t){e.handleMouseMove(t)})))}}},beforeUnmount:function(){this.removeScrollHeatmap()},methods:{removeScrollHeatmap:function(){var e=this.$refs.iframeRecordingContainer;oe(e).find(".scrollHeatmapLeaf").remove()},deleteScreenshot:function(){var e=this;I["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmapScreenshot,{yes:function(){e.isLoading=!0,I["AjaxHelper"].fetch({method:"HeatmapSessionRecording.deleteHeatmapScreenshot",idSiteHsr:e.idSiteHsr}).then((function(){e.isLoading=!1,window.location.reload()}))}})},fetchHeatmap:function(){var e=this;if(this.removeScrollHeatmap(),this.heatmapInstances){var t=this.heatmapInstances;t.forEach((function(e){e.setData({max:1,min:0,data:[]})}))}this.isLoading=!0,this.avgFold=0;var n=I["MatomoUrl"].parsed.value.segment?decodeURIComponent(I["MatomoUrl"].parsed.value.segment):void 0,a={idSiteHsr:this.idSiteHsr,heatmapType:this.heatmapType,deviceType:this.deviceType,period:this.heatmapPeriod,date:this.heatmapDate,filter_limit:-1,segment:n},i=this.getRecordedHeatmap(a),r=this.getRecordedHeatmapMetadata(a);Promise.all([i,r,this.iframeLoadedPromise]).then((function(t){var n=e.$refs.recordingPlayer,a=e.getRecordingIframe(n);me(e.$refs.recordingPlayer,e.$refs.heatmapContainer,a),e.removeScrollHeatmap();var i=t[0],r=t[1];if(Array.isArray(r)&&r[0]){var o=Z(r,1);e.actualNumSamples=o[0]}else e.actualNumSamples=r;if(e.isLoading=!1,e.isScrollHeatmapType)pe(e.$refs.iframeRecordingContainer,n,a,i);else{for(var s,l={min:0,max:0,data:[]},c=0;c<i.length;c+=1){var d=i[c];if(d.selector){var u=a.getCoordinatesInFrame(d.selector,d.offset_x,d.offset_y,e.offsetAccuracy,!0);u&&(u.value=d.value,l.data.push(u),e.dataCoordinates.push(u),e.totalClicks+=parseInt(d.value,10))}}if(2===e.heatmapType){var m=0;l.data.forEach((function(e){null!==e&&void 0!==e&&e.value&&parseInt(e.value,10)>1&&(m+=1)})),m/l.data.length>=.1&&l.data.length>120?l.max=2:l.max=1}else{var p=10,h={};if(l.data.forEach((function(e){if(e&&e.value){var t=parseInt(e.value,10);t>l.max&&(l.max=t),t>p&&(t=p);var n="".concat(t);n in h?h[n]+=1:h[n]=0}})),l.max>p){for(var g=0,f=p;f>1;f-=1){var b="".concat(f);if(b in h&&(g+=h[b]),g/l.data.length>=.2){l.max=f;break}}if(l.max>p){l.max=5;for(var v=5;v>0;v-=1){var y="".concat(v);if(y in h){l.max=v;break}}}}}if(e.renderHeatmap(e.$refs.recordingPlayer,e.$refs.heatmapContainer,a,l),null!==(s=e.actualNumSamples)&&void 0!==s&&s["avg_fold_device_".concat(e.deviceType)]){var O=e.actualNumSamples["avg_fold_device_".concat(e.deviceType)],j=a.getIframeHeight();j&&(e.avgFold=parseInt("".concat(O/100*j),10))}}})).finally((function(){e.isLoading=!1}))},changeDeviceType:function(e){this.deviceType=e,this.deviceType===se?this.changeIframeWidth(this.desktopPreviewSize,!1):this.deviceType===le?this.changeIframeWidth(this.breakpointTablet||960,!1):this.deviceType===ce&&this.changeIframeWidth(this.breakpointMobile||600,!1)},changeIframeWidth:function(e,t){this.iframeWidth=e,this.customIframeWidth=this.iframeWidth,this.totalClicks=0,this.dataCoordinates=[],this.fetchHeatmap(),t&&I["Matomo"].helper.lazyScrollToContent()},changeHeatmapType:function(e){this.heatmapType=e,this.totalClicks=0,this.clickCount=0,this.clickRate=0,this.dataCoordinates=[],this.fetchHeatmap()},handleMouseMove:function(e){var t=this,n=window.document.getElementById("highlightDiv");if(n){this.tooltipShowTimeoutId&&(clearTimeout(this.tooltipShowTimeoutId),this.tooltipShowTimeoutId=null,this.currentElement=null),n.hidden||this.handleTooltip(e,0,0,"move");var a=this.lookUpRecordedElementAtEventLocation(e);if(a&&a!==this.currentElement){this.handleTooltip(e,0,0,"hide"),n.hidden=!0;var i=a.getBoundingClientRect(),r=0;this.dataCoordinates.forEach((function(e){e.y<i.top||e.y>i.bottom||e.x<i.left||e.x>i.right||(r+=parseInt(e.value,10))})),this.tooltipShowTimeoutId=setTimeout((function(){t.currentElement=a,n.hidden=!1;var i=t.totalClicks?Math.round(r/t.totalClicks*1e4)/100:0,o=a.getBoundingClientRect();n.style.top="".concat(o.top,"px"),n.style.left="".concat(o.left,"px"),n.style.width="".concat(o.width,"px"),n.style.height="".concat(o.height,"px"),t.handleTooltip(e,r,i,"show"),t.tooltipShowTimeoutId=null}),100)}}},lookUpRecordedElementAtEventLocation:function(e){var t=e.target;if(!t)return null;var n=window.document.getElementById("recordingPlayer");if(!n)return null;var a=n.contentWindow?n.contentWindow.document:n.contentDocument;if(!a)return null;var i=t.getBoundingClientRect();return a.elementFromPoint(e.clientX-i.left,e.clientY-i.top)},handleTooltip:function(e,t,n,a){this.tooltip&&("show"===a?(this.clickCount=t,this.clickRate=n,this.tooltip.show(e)):"move"===a?this.tooltip.show(e):this.tooltip.hide())}},computed:{isScrollHeatmapType:function(){return 3===this.heatmapType},tokenAuth:function(){return I["MatomoUrl"].parsed.value.token_auth},embedUrl:function(){return"?".concat(I["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:I["Matomo"].idSite,idSiteHsr:this.idSiteHsr,token_auth:this.tokenAuth||void 0}))},iframeWidthOptions:function(){return this.iframeResolutions.map((function(e){return{key:e,value:"".concat(e,"px")}}))},recordedSamplesSince:function(){var e=Object(I["translate"])("HeatmapSessionRecording_HeatmapXRecordedSamplesSince",'<span class="deviceAllCountSamples">'.concat(this.actualNumSamples.nb_samples_device_all,"</span>"),this.createdDate),t=Object(I["externalLink"])("https://matomo.org/subcategory/troubleshoot-7/"),n=Object(I["translate"])("HeatmapSessionRecording_HeatmapTroubleshoot",t,"</a>");return"".concat(e," ").concat(n)},deviceTypesWithSamples:function(){var e=this;return this.deviceTypes.map((function(t){var n;n=e.actualNumSamples["nb_samples_device_".concat(t.key)]?e.actualNumSamples["nb_samples_device_".concat(t.key)]:0;var a=Object(I["translate"])("HeatmapSessionRecording_XSamples","".concat(t.name," - ").concat(n));return Object.assign(Object.assign({},t),{},{numSamples:n,tooltip:a})}))},hasWriteAccess:function(){return!(null===I["Matomo"]||void 0===I["Matomo"]||!I["Matomo"].heatmapWriteAccess)},showDeleteScreenshot:function(){return this.isActive&&this.hasWriteAccess},gradientImgData:function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAKCAYAAABCHPt+AAAAnklEQVRYR+2WQQqDQBAES5wB/f8/Y05RcMWwSu6JIT0Dm4WlH1DUdHew7/z6WYFhhnGRpnlhAEaQpi/ADbh/np0MiBhGhW+2ymFU+DZfg1EhaoB4jCFuMYYcQKZrXwPEVvm5Og0pcYakBvI35G1jNIZ4jCHexxjSpz9ZFUjAynLbpOvqteaODkm9sloz5JF+ZTVmSAWSu9Qb65AvgDwBQoLgVDlWfAQAAAAASUVORK5CYII="}}});ge.render=A;var fe,be,ve=ge,ye={class:"sessionRecordingPlayer"},Oe={class:"controls"},je={class:"playerActions"},Se=["title"],_e=["title"],He=["title"],Ve=["title"],Ne=["title"],we=["title"],Ee=["title"],ke=["title"],Re={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ce=Object(r["createElementVNode"])("path",{d:"M480 576.5v-321h-64.5v129h-63v-129h-64.5v192h127.5v129h64.5zM607.5 127.999c34.5 0\n              64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n              0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),xe=[Ce],Te={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},De=Object(r["createElementVNode"])("path",{d:"M448.5 576.5v-321h-129v64.5h64.5v256.5h64.5zM607.5 127.999c34.5 0 64.5 30 64.5\n              64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5 0-64.5-30-64.5-64.5v-447c0-34.5\n              30-64.5 64.5-64.5h447z"},null,-1),Me=[De],Pe={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ae=Object(r["createElementVNode"])("path",{d:"M480 384.5v-64.5c0-36-30-64.5-64.5-64.5h-127.5v64.5h127.5v64.5h-63c-34.5 0-64.5\n              27-64.5 63v129h192v-64.5h-127.5v-64.5h63c34.5 0 64.5-27 64.5-63zM607.5 127.999c34.5\n              0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n              0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),Be=[Ae],Ue={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ie=Object(r["createElementVNode"])("path",{d:"M480 320v-64.5h-127.5c-34.5 0-64.5 28.5-64.5 64.5v192c0 36 30 64.5 64.5\n              64.5h63c34.5 0 64.5-28.5 64.5-64.5v-64.5c0-36-30-63-64.5-63h-63v-64.5h127.5zM607.5\n              127.999c34.5 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n              0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447zM352.5 512v-64.5h63v64.5h-63z"},null,-1),Le=[Ie],Fe=["title"],We=Object(r["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},[Object(r["createElementVNode"])("path",{d:"M223.5 415.5h111l-64.5-63h-46.5v63zM72 72l624 624-42 40.5-88.5-90c-51 36-114\n              57-181.5 57-177 0-319.5-142.5-319.5-319.5 0-67.5 21-130.5 57-181.5l-90-88.5zM544.5\n              352.5h-111l-231-231c51-36 114-57 181.5-57 177 0 319.5 142.5 319.5 319.5 0 67.5-21\n              130.5-57 181.5l-148.5-150h46.5v-63z"})],-1),qe=[We],ze=["title"],Ge=Object(r["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 768 768"},[Object(r["createElementVNode"])("path",{d:"M544.5 609v-129h63v192h-384v96l-127.5-127.5 127.5-127.5v96h321zM223.5\n              288v129h-63v-192h384v-96l127.5 127.5-127.5 127.5v-96h-321z"})],-1),$e=[Ge],Je={class:"duration"},Xe={class:"playerHelp"},Ye=Object(r["createElementVNode"])("span",{class:"clickEvent"},null,-1),Ke=Object(r["createElementVNode"])("span",{class:"moveEvent"},null,-1),Qe=Object(r["createElementVNode"])("span",{class:"scrollEvent"},null,-1),Ze=Object(r["createElementVNode"])("span",{class:"resizeEvent"},null,-1),et=Object(r["createElementVNode"])("span",{class:"formChange"},null,-1),tt=Object(r["createElementVNode"])("span",{class:"mutationEvent"},null,-1),nt=Object(r["createElementVNode"])("br",{style:{clear:"right"}},null,-1),at=["title"],it=Object(r["createElementVNode"])("br",null,null,-1),rt=Object(r["createElementVNode"])("div",{class:"loadingUnderlay"},null,-1),ot={class:"valign-wrapper loadingInner"},st={class:"loadingContent"},lt=["src","width","height"];function ct(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ye,[Object(r["createElementVNode"])("div",Oe,[Object(r["createElementVNode"])("span",je,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-skip-previous",title:e.skipPreviousButtonTitle,onClick:t[0]||(t[0]=function(t){return e.loadNewRecording(e.previousRecordingId)})},null,8,Se),[[r["vShow"],e.previousRecordingId]]),Object(r["createElementVNode"])("span",{class:"playerAction icon-fast-rewind",title:e.translate("HeatmapSessionRecording_PlayerRewindFast",10,"J"),onClick:t[1]||(t[1]=function(t){return e.jumpRelative(10,!1)})},null,8,_e),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-play",title:e.translate("HeatmapSessionRecording_PlayerPlay","K"),onClick:t[2]||(t[2]=function(t){return e.play()})},null,8,He),[[r["vShow"],!e.isPlaying&&!e.isFinished]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-replay",title:e.translate("HeatmapSessionRecording_PlayerReplay","K"),onClick:t[3]||(t[3]=function(t){return e.replay()})},null,8,Ve),[[r["vShow"],!e.isPlaying&&e.isFinished]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-pause",title:e.translate("HeatmapSessionRecording_PlayerPause","K"),onClick:t[4]||(t[4]=function(t){return e.pause()})},null,8,Ne),[[r["vShow"],e.isPlaying]]),Object(r["createElementVNode"])("span",{class:"playerAction icon-fast-forward",title:e.translate("HeatmapSessionRecording_PlayerForwardFast",10,"L"),onClick:t[5]||(t[5]=function(t){return e.jumpRelative(10,!0)})},null,8,we),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-skip-next",title:e.translate("HeatmapSessionRecording_PlayerPageViewNext",e.nextRecordingInfo,"N"),onClick:t[6]||(t[6]=function(t){return e.loadNewRecording(e.nextRecordingId)})},null,8,Ee),[[r["vShow"],e.nextRecordingId]]),Object(r["createElementVNode"])("span",{class:"changeReplaySpeed",title:e.translate("HeatmapSessionRecording_ChangeReplaySpeed","S"),onClick:t[7]||(t[7]=function(t){return e.increaseReplaySpeed()})},[Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Re,xe,512)),[[r["vShow"],4===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Te,Me,512)),[[r["vShow"],1===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Pe,Be,512)),[[r["vShow"],2===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Ue,Le,512)),[[r["vShow"],6===e.actualReplaySpeed]])],8,ke),Object(r["createElementVNode"])("span",{class:Object(r["normalizeClass"])(["toggleSkipPause",{active:e.actualSkipPausesEnabled}]),title:e.translate("HeatmapSessionRecording_ClickToSkipPauses",e.skipPausesEnabledText,"B"),onClick:t[8]||(t[8]=function(t){return e.toggleSkipPauses()})},qe,10,Fe),Object(r["createElementVNode"])("span",{class:Object(r["normalizeClass"])(["toggleAutoPlay",{active:e.actualAutoPlayEnabled}]),title:e.translate("HeatmapSessionRecording_AutoPlayNextPageview",e.autoplayEnabledText,"A"),onClick:t[9]||(t[9]=function(t){return e.toggleAutoPlay()})},$e,10,ze),Object(r["createElementVNode"])("span",Je,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_PlayerDurationXofY",e.positionPretty,e.durationPretty)),1)]),Object(r["createElementVNode"])("div",Xe,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",null,[Ye,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityClick")),1)]),Object(r["createElementVNode"])("li",null,[Ke,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityMove")),1)]),Object(r["createElementVNode"])("li",null,[Qe,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityScroll")),1)]),Object(r["createElementVNode"])("li",null,[Ze,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityResize")),1)]),Object(r["createElementVNode"])("li",null,[et,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityFormChange")),1)]),Object(r["createElementVNode"])("li",null,[tt,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityPageChange")),1)])])]),nt]),Object(r["createElementVNode"])("div",{class:"timelineOuter",onClick:t[10]||(t[10]=function(t){return e.seekEvent(t)}),style:Object(r["normalizeStyle"])({width:"".concat(e.replayWidth,"px")})},[Object(r["createElementVNode"])("div",{class:"timelineInner",style:Object(r["normalizeStyle"])({width:"".concat(e.progress,"%")})},null,4),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.clues,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{title:e.title,class:Object(r["normalizeClass"])(e.type),style:Object(r["normalizeStyle"])({left:"".concat(e.left,"%")}),key:t},null,14,at)})),128))],4),it,Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"hsrLoadingOuter",style:Object(r["normalizeStyle"])({width:"".concat(e.replayWidth,"px"),height:"".concat(e.replayHeight,"px")})},[rt,Object(r["createElementVNode"])("div",ot,[Object(r["createElementVNode"])("div",st,Object(r["toDisplayString"])(e.translate("General_Loading")),1)])],4),[[r["vShow"],e.isLoading]]),Object(r["createElementVNode"])("div",{class:"replayContainerOuter",onClick:t[12]||(t[12]=function(t){return e.togglePlay()}),style:Object(r["normalizeStyle"])({height:"".concat(e.replayHeight,"px"),width:"".concat(e.replayWidth,"px")})},[Object(r["createElementVNode"])("div",{class:"replayContainerInner",style:Object(r["normalizeStyle"])([{"transform-origin":"0 0"},{transform:"scale(".concat(e.replayScale,")"),"margin-left":"".concat(e.replayMarginLeft,"px")}])},[e.embedUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("iframe",{key:0,id:"recordingPlayer",ref:"recordingPlayer",onLoad:t[11]||(t[11]=function(t){return e.onLoaded()}),scrolling:"no",sandbox:"allow-scripts allow-same-origin",referrerpolicy:"no-referrer",src:e.embedUrl,width:e.recording.viewport_w_px,height:e.recording.viewport_h_px},null,40,lt)):Object(r["createCommentVNode"])("",!0)],4)],4)])}function dt(e){return dt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dt(e)}function ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mt=20,pt=1,ht=2,gt=3,ft=4,bt=5,vt=6,yt=9,Ot=10,jt=12,St=(fe={},ut(fe,ht,"clickEvent"),ut(fe,pt,"moveEvent"),ut(fe,gt,"scrollEvent"),ut(fe,jt,"scrollEvent"),ut(fe,ft,"resizeEvent"),ut(fe,yt,"formChange"),ut(fe,Ot,"formChange"),ut(fe,bt,"mutationEvent"),ut(fe,vt,"mutationEvent"),fe),_t=(be={},ut(be,ht,Object(I["translate"])("HeatmapSessionRecording_ActivityClick")),ut(be,pt,Object(I["translate"])("HeatmapSessionRecording_ActivityMove")),ut(be,gt,Object(I["translate"])("HeatmapSessionRecording_ActivityScroll")),ut(be,jt,Object(I["translate"])("HeatmapSessionRecording_ActivityScroll")),ut(be,ft,Object(I["translate"])("HeatmapSessionRecording_ActivityResize")),ut(be,yt,Object(I["translate"])("HeatmapSessionRecording_ActivityFormChange")),ut(be,Ot,Object(I["translate"])("HeatmapSessionRecording_ActivityFormChange")),ut(be,bt,Object(I["translate"])("HeatmapSessionRecording_ActivityPageChange")),ut(be,vt,Object(I["translate"])("HeatmapSessionRecording_ActivityPageChange")),be),Ht='\n<div class="mousePointer" style="width: 16px;height: 16px;position: absolute;z-index: 99999999;">\n    <svg enable-background="new 0 0 24 24" fill="black" stroke="white" version="1.0"\n        viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"\n        xmlns:xlink="http://www.w3.org/1999/xlink">\n        <path d="M7,2l12,11.2l-5.8,0.5l3.3,7.3l-2.2,1l-3.2-7.4L7,18.5V2"/>\n    </svg>\n</div>\n',Vt=window,Nt=Vt.$,wt=Vt.Mousetrap;function Et(e){return"number"===typeof e?e:parseInt(e,10)}function kt(e){if(null!==e&&void 0!==e&&e.event_type)return Et(e.event_type)}function Rt(e){var t=Math.floor(e/1e3),n=Math.floor(t/60),a=t%60;return n<10&&(n="0".concat(n)),a<10&&(a="0".concat(a)),"".concat(n,":").concat(a)}var Ct=Object(r["defineComponent"])({props:{offsetAccuracy:{type:Number,required:!0},scrollAccuracy:{type:Number,required:!0},autoPlayEnabled:Boolean,skipPausesEnabled:Boolean,replaySpeed:{type:Number,default:1}},data:function(){return{isPlaying:!1,progress:0,isFinished:!1,isLoading:!0,seekTimeout:null,lastFramePainted:0,recording:JSON.parse(JSON.stringify(window.sessionRecordingData)),positionPretty:"00:00",previousRecordingId:null,previousRecordingInfo:null,nextRecordingId:null,nextRecordingInfo:null,frame:0,hasFoundPrevious:!1,hasFoundNext:!1,videoPlayerInterval:null,lastCanvasCoordinates:!1,actualAutoPlayEnabled:!!this.autoPlayEnabled,replayWidth:0,replayHeight:0,replayScale:0,replayMarginLeft:0,seek:function(e){return e},actualSkipPausesEnabled:!!this.skipPausesEnabled,actualReplaySpeed:this.replaySpeed}},setup:function(){var e=Object(r["ref"])(!1),t=null,n=new Promise((function(n){t=n,e.value=!0})),a=function(){setTimeout((function(){t("loaded")}),500)};return{iframeLoadedPromise:n,onLoaded:a,iframeLoaded:e}},created:function(){var e=this;this.recording.duration=Et(this.recording.duration),this.recording.pageviews.forEach((function(t){t&&t.idloghsr&&("".concat(t.idloghsr)==="".concat(e.recording.idLogHsr)?e.hasFoundPrevious=!0:e.hasFoundPrevious?e.hasFoundNext||(e.hasFoundNext=!0,e.nextRecordingId=t.idloghsr,e.nextRecordingInfo=[t.label,t.server_time_pretty,t.time_on_page_pretty].join(" - ")):(e.previousRecordingId=t.idloghsr,e.previousRecordingInfo=[t.label,t.server_time_pretty,t.time_on_page_pretty].join(" - ")))}))},mounted:function(){var e=this;wt.bind(["space","k"],(function(){e.togglePlay()})),wt.bind("0",(function(){e.isFinished&&e.replay()})),wt.bind("p",(function(){e.loadNewRecording(e.previousRecordingId)})),wt.bind("n",(function(){e.loadNewRecording(e.nextRecordingId)})),wt.bind("s",(function(){e.increaseReplaySpeed()})),wt.bind("a",(function(){e.toggleAutoPlay()})),wt.bind("b",(function(){e.toggleSkipPauses()})),wt.bind("left",(function(){var t=5,n=!1;e.jumpRelative(t,n)})),wt.bind("right",(function(){var t=5,n=!0;e.jumpRelative(t,n)})),wt.bind("j",(function(){var t=10,n=!1;e.jumpRelative(t,n)})),wt.bind("l",(function(){var t=10,n=!0;e.jumpRelative(t,n)})),this.initViewport(),Nt(window).on("resize",(function(){return e.initViewport()})),this.iframeLoadedPromise.then((function(){e.initPlayer()})),window.addEventListener("beforeunload",(function(){e.isPlaying=!1,e.videoPlayerInterval&&(clearInterval(e.videoPlayerInterval),e.videoPlayerInterval=null)}))},methods:{initPlayer:function(){var e=this,t=this.$refs.recordingPlayer,n=F(t).recordingFrame;if(n&&n.isSupportedBrowser()){n.addClass("html","piwikSessionRecording"),n.addClass("html","matomoSessionRecording");var a=null,i=function(t,i){a&&a.css({left:"".concat(t.x-8,"px"),top:"".concat(t.y-8,"px")}),e.lastCanvasCoordinates&&(n.drawLine(e.lastCanvasCoordinates.x,e.lastCanvasCoordinates.y,t.x,t.y,i),e.lastCanvasCoordinates=t)},r=function(t,r){if(e.lastCanvasCoordinates&&a){var o=n.getScrollTop(),s=n.getScrollLeft();n.scrollTo(t,r);var l=r-o,c=t-s,d=c+e.lastCanvasCoordinates.x,u=l+e.lastCanvasCoordinates.y;d<=0&&(d=0),u<=0&&(u=0),i({x:d,y:u},"blue")}else n.scrollTo(t,r)},o=function(e,t,n){null!==e&&void 0!==e&&e.scrollTo?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)},s=null,l=function(t){var a=e.isPlaying;e.isPlaying=!1;var i=kt(t),l=null;if(i===pt)t.selector&&(l=n.getCoordinatesInFrame(t.selector,t.x,t.y,e.offsetAccuracy,!1),l&&s(l));else if(i===ht)t.selector&&(l=n.getCoordinatesInFrame(t.selector,t.x,t.y,e.offsetAccuracy,!1),l&&(s(l),n.drawCircle(l.x,l.y,"#ff9407")));else if(i===vt)t.text&&n.applyMutation(t.text);else if(i===gt){var c=n.getIframeHeight(),d=n.getIframeWidth(),u=parseInt("".concat(c/e.scrollAccuracy*Et(t.y)),10),m=parseInt("".concat(d/e.scrollAccuracy*Et(t.x)),10);r(m,u)}else if(i===jt){if(t.selector){var p=n.findElement(t.selector);if(p&&p.length&&p[0]){var h=Math.max(p[0].scrollHeight,p[0].offsetHeight,p.height(),0),g=Math.max(p[0].scrollWidth,p[0].offsetWidth,p.width(),0);if(h&&g){var f=parseInt("".concat(h/e.scrollAccuracy*Et(t.y)),10),b=parseInt("".concat(g/e.scrollAccuracy*Et(t.x)),10);o(p[0],b,f)}}}}else if(i===ft)e.setViewportResolution(t.x,t.y);else if(i===yt){if(t.selector){var v=n.findElement(t.selector);if(v.length){var y=v.attr("type");y&&"file"==="".concat(y).toLowerCase()||v.val(t.text).change()}}}else if(i===Ot&&t.selector){var O=n.findElement(t.selector);O.is("input")?O.prop("checked",1===t.text||"1"===t.text):O.is("select")&&O.val(t.text).change()}e.isPlaying=a};s=function(t){var r=function(){var t=n.getIframeWidth(),a=n.getIframeHeight();n.makeSvg(t,a);for(var i=function(t){if(!e.timeFrameBuckets[t])return{v:void 0};e.timeFrameBuckets[t].forEach((function(n){var a=kt(n);a!==pt&&a!==gt&&a!==jt&&a!==ht||(e.lastFramePainted=t,l(n))}))},r=0;r<=e.frame;r+=mt){var o=i(r);if("object"===dt(o))return o.v}},o=n.getIframeWindow();if(!e.lastCanvasCoordinates){var s=n.getIframeHeight(),c=n.getIframeWidth();return n.appendContent(Ht),a=n.findElement(".mousePointer"),n.makeSvg(c,s),o.removeEventListener("resize",r,!1),o.addEventListener("resize",r,!1),e.lastCanvasCoordinates=t,void a.css({left:"".concat(t.x-8,"px"),top:"".concat(t.y-8,"px")})}var d=n.getScrollTop(),u=n.getScrollLeft();(t.y>d+Et(e.recording.viewport_h_px)||t.y<d)&&n.scrollTo(u,t.y-10),d=n.getScrollTop(),(t.x>u+Et(e.recording.viewport_w_px)||t.x<u)&&n.scrollTo(t.x-10,d),i(t,"#ff9407")},this.seek=function(t){if(e.iframeLoaded){e.isLoading=!0;var a=e.frame,i=function(t){for(var n=function(t){(e.timeFrameBuckets[t]||[]).forEach((function(n){e.lastFramePainted=t,l(n)}))},a=t;a<=e.frame;a+=mt)n(a)};e.isFinished=!1,e.frame=t-t%mt,e.progress=parseFloat(parseFloat("".concat(e.frame/Et(e.recording.duration)*100)).toFixed(2)),e.positionPretty=Rt(e.frame),a>e.frame?(a=0,e.lastCanvasCoordinates=!1,e.initialMutation&&n.initialMutation(e.initialMutation.text),n.scrollTo(0,0),e.setViewportResolution(window.sessionRecordingData.viewport_w_px,window.sessionRecordingData.viewport_h_px),e.seekTimeout&&(clearTimeout(e.seekTimeout),e.seekTimeout=null),function(t){e.seekTimeout=setTimeout((function(){i(t),e.isLoading=!1}),1050)}(a)):(e.seekTimeout&&(clearTimeout(e.seekTimeout),e.seekTimeout=null),i(a),e.isLoading=!1)}},this.isLoading=!1,this.isPlaying=!0;var c=0,d=function(){if(e.isPlaying&&!e.isLoading){c+=1;var t=Et(e.recording.duration);if(e.frame>=t?(e.isPlaying=!1,e.progress=100,e.isFinished=!0,e.positionPretty=e.durationPretty,e.actualAutoPlayEnabled&&e.nextRecordingId&&e.loadNewRecording(e.nextRecordingId)):(e.progress=parseFloat(parseFloat("".concat(e.frame/t*100)).toFixed(2)),20===c&&(c=0,e.positionPretty=Rt(e.frame))),(e.timeFrameBuckets[e.frame]||[]).forEach((function(t){e.lastFramePainted=e.frame,l(t)})),e.actualSkipPausesEnabled&&e.frame-e.lastFramePainted>1800){var n=Object.keys(e.timeFrameBuckets).map((function(e){return parseInt(e,10)}));n=n.sort((function(e,t){return e-t}));var a=n.find((function(t){return t>e.frame})),i=!!a;if(a){var r=a-e.frame>1e3;r&&(e.frame=a-20*mt)}if(!i){var o=t-e.frame>1e3;o&&(e.frame=t-20*mt)}}e.frame+=mt}};this.videoPlayerInterval=setInterval((function(){for(var t=1;t<=e.actualReplaySpeed;t+=1)d()}),mt)}},initViewport:function(){this.replayHeight=Nt(window).height()-48-Nt(".sessionRecording .sessionRecordingHead").outerHeight(!0)-Nt(".sessionRecordingPlayer .controls").outerHeight(!0),this.replayWidth=Nt(window).width()-48;var e=Et(this.recording.viewport_w_px),t=Et(this.recording.viewport_h_px),n=400;this.replayWidth<n&&e>n&&(this.replayWidth=n);var a=400;this.replayHeight<a&&t>a&&(this.replayHeight=a);var i=1,r=1;e>this.replayWidth&&(i=parseFloat(parseFloat("".concat(this.replayWidth/e)).toFixed(4))),t>this.replayHeight&&(r=parseFloat(parseFloat("".concat(this.replayHeight/t)).toFixed(4))),this.replayScale=Math.min(i,r),this.replayMarginLeft=(this.replayWidth-this.replayScale*e)/2},setViewportResolution:function(e,t){this.recording.viewport_w_px=parseInt("".concat(e),10),this.recording.viewport_h_px=parseInt("".concat(t),10),Nt(".recordingWidth").text(e),Nt(".recordingHeight").text(t),this.initViewport()},increaseReplaySpeed:function(){1===this.actualReplaySpeed?this.actualReplaySpeed=2:2===this.actualReplaySpeed?this.actualReplaySpeed=4:4===this.actualReplaySpeed?this.actualReplaySpeed=6:this.actualReplaySpeed=1,this.updateSettings()},updateSettings:function(){I["AjaxHelper"].fetch({module:"HeatmapSessionRecording",action:"saveSessionRecordingSettings",autoplay:this.actualAutoPlayEnabled?1:0,skippauses:this.actualSkipPausesEnabled?1:0,replayspeed:this.actualReplaySpeed},{format:"html"})},toggleAutoPlay:function(){this.actualAutoPlayEnabled=!this.actualAutoPlayEnabled,this.updateSettings()},toggleSkipPauses:function(){this.actualSkipPausesEnabled=!this.actualSkipPausesEnabled,this.updateSettings()},loadNewRecording:function(e){e&&(this.isPlaying=!1,I["MatomoUrl"].updateUrl(Object.assign(Object.assign({},I["MatomoUrl"].urlParsed.value),{},{idLogHsr:parseInt("".concat(e),10),updated:I["MatomoUrl"].urlParsed.value.updated?parseInt(I["MatomoUrl"].urlParsed.value.updated,10)+1:1})))},jumpRelative:function(e,t){var n,a=1e3*e;t?(n=this.frame+a,n>this.recording.duration&&(n=Et(this.recording.duration)-mt)):(n=this.frame-a,n<0&&(n=0)),this.seek(n)},replay:function(){this.isFinished=!1,this.lastFramePainted=0,this.seek(0),this.play()},pause:function(){this.isPlaying=!1},togglePlay:function(){this.isFinished?this.replay():this.isPlaying?this.pause():this.play()},seekEvent:function(e){var t=Nt(e.currentTarget).offset(),n=e.pageX-t.left,a=this.replayWidth,i=n/a,r=Et(this.recording.duration)*i;this.seek(r)},play:function(){this.isPlaying=!0}},computed:{durationPretty:function(){return Rt(Et(this.recording.duration))},embedUrl:function(){return"?".concat(I["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:this.recording.idSite,idLogHsr:this.recording.idLogHsr,idSiteHsr:this.recording.idSiteHsr,token_auth:I["MatomoUrl"].urlParsed.value.token_auth||void 0}))},skipPreviousButtonTitle:function(){return Object(I["translate"])("HeatmapSessionRecording_PlayerPageViewPrevious",this.previousRecordingInfo||"","P")},skipPausesEnabledText:function(){return this.actualSkipPausesEnabled?Object(I["translate"])("HeatmapSessionRecording_disable"):Object(I["translate"])("HeatmapSessionRecording_enable")},autoplayEnabledText:function(){return this.actualAutoPlayEnabled?Object(I["translate"])("HeatmapSessionRecording_disable"):Object(I["translate"])("HeatmapSessionRecording_enable")},recordingEvents:function(){return this.recording?this.recording.events.map((function(e){var t=kt(e),n=e.text;return t!==bt&&t!==vt||"string"!==typeof n||(n=JSON.parse(n)),Object.assign(Object.assign({},e),{},{text:n})})):[]},initialMutation:function(){var e=this.recordingEvents.find((function(e){var t=kt(e),n=t===bt||t===vt,a=n&&(t===bt||!e.time_since_load||"0"===e.time_since_load);return a}));return e},timeFrameBuckets:function(){var e=this,t={};return this.recordingEvents.forEach((function(n){if(n!==e.initialMutation){var a=Math.round(Et(n.time_since_load)/mt)*mt;t[a]=t[a]||[],t[a].push(n)}})),t},clues:function(){var e=this,t=[];return this.recordingEvents.forEach((function(n){if(n!==e.initialMutation){var a=kt(n),i=St[a]||"",r=_t[a]||"";if(i){if((0===n.time_since_load||"0"===n.time_since_load)&&"moveEvent"===i)return;t.push({left:parseFloat("".concat(Et(n.time_since_load)/Et(e.recording.duration)*100)).toFixed(2),type:i,title:r})}}})),t}}});Ct.render=ct;var xt=Ct,Tt={class:"form-group hsrTargetTest"},Dt={class:"loadingPiwik loadingMatchingSteps"},Mt=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1),Pt=Object(r["createElementVNode"])("div",{id:"hsrTargetValidationError"},null,-1);function At(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Tt,[Object(r["createElementVNode"])("label",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestTitle"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestLabel")),1)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"text",id:"urltargettest",placeholder:"http://www.example.com/","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.url=t}),class:Object(r["normalizeClass"])({invalid:e.url&&!e.matches&&e.isValid})},null,2),[[r["vModelText"],e.url]]),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestErrorInvalidUrl")),513),[[r["vShow"],e.url&&!e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo matches"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlMatches")),513),[[r["vShow"],e.url&&e.matches&&e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo notMatches"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlNotMatches")),513),[[r["vShow"],e.url&&!e.matches&&e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Dt,[Mt,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)],512),[[r["vShow"],e.isLoadingTestMatchPage]])]),Pt])}function Bt(e){return e.indexOf("://")>3}var Ut=Object(r["defineComponent"])({props:{includedTargets:Array},data:function(){return{url:"",matches:!1,isLoadingTestMatchPage:!1}},watch:{isValid:function(e){e||(this.matches=!1)},includedTargets:function(){this.runTest()},url:function(){this.runTest()}},setup:function(){return{testUrlMatchPages:W("HeatmapSessionRecording.testUrlMatchPages",{errorElement:"#hsrTargetValidationError"})}},created:function(){this.runTest=Object(I["debounce"])(this.runTest,200)},methods:{checkIsMatchingUrl:function(){var e=this;if(this.isValid){var t=this.targetUrl,n=this.filteredIncludedTargets;null!==n&&void 0!==n&&n.length&&(this.isLoadingTestMatchPage=!0,this.testUrlMatchPages({url:t},{matchPageRules:n}).then((function(t){var n;null!==(n=e.filteredIncludedTargets)&&void 0!==n&&n.length&&(null===t||void 0===t?void 0:t.url)===e.targetUrl&&(e.matches=t.matches)})).finally((function(){e.isLoadingTestMatchPage=!1})))}},runTest:function(){this.isValid&&this.checkIsMatchingUrl()}},computed:{targetUrl:function(){return(this.url||"").trim()},isValid:function(){return this.targetUrl&&Bt(this.targetUrl)},filteredIncludedTargets:function(){if(this.includedTargets)return this.includedTargets.filter((function(e){return(null===e||void 0===e?void 0:e.value)||"any"===(null===e||void 0===e?void 0:e.type)})).map((function(e){return Object.assign(Object.assign({},e),{},{value:e.value?e.value.trim():""})}))}}});Ut.render=At;var It=Ut,Lt={style:{width:"100%"}},Ft={name:"targetAttribute"},Wt={name:"targetType"},qt={name:"targetValue"},zt={name:"targetValue2"},Gt=["title"],$t=["title"];function Jt(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["form-group hsrUrltarget valign-wrapper",{disabled:e.disableIfNoValue&&!e.modelValue.value}])},[Object(r["createElementVNode"])("div",Lt,[Object(r["createElementVNode"])("div",Ft,[Object(r["createVNode"])(s,{uicontrol:"select",name:"targetAttribute","model-value":e.modelValue.attribute,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{attribute:t}))}),title:e.translate("HeatmapSessionRecording_Rule"),options:e.targetAttributes,"full-width":!0},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",Wt,[Object(r["createVNode"])(s,{uicontrol:"select",name:"targetType","model-value":e.pattern_type,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.onTypeChange(t)}),options:e.targetOptions[e.modelValue.attribute],"full-width":!0},null,8,["model-value","options"])]),Object(r["createElementVNode"])("div",qt,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"targetValue",placeholder:"eg. ".concat(e.targetExamples[e.modelValue.attribute]),"model-value":e.modelValue.value,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value:t.trim()}))}),maxlength:500,"full-width":!0},null,8,["placeholder","model-value"]),[[r["vShow"],"any"!==e.pattern_type]])]),Object(r["createElementVNode"])("div",zt,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"targetValue2","model-value":e.modelValue.value2,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value2:t.trim()}))}),maxlength:500,"full-width":!0,placeholder:e.translate("HeatmapSessionRecording_UrlParameterValueToMatchPlaceholder")},null,8,["model-value","placeholder"]),[[r["vShow"],"urlparam"===e.modelValue.attribute&&e.pattern_type&&"exists"!==e.pattern_type&&"not_exists"!==e.pattern_type]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-plus valign",title:e.translate("General_Add"),onClick:t[4]||(t[4]=function(t){return e.$emit("addUrl")})},null,8,Gt),[[r["vShow"],e.showAddUrl]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",title:e.translate("General_Remove"),onClick:t[5]||(t[5]=function(t){return e.$emit("removeUrl")})},null,8,$t),[[r["vShow"],e.canBeRemoved]])],2)}function Xt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Kt(e,t,n){return t&&Yt(e.prototype,t),n&&Yt(e,n),e}function Qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var Zt=function(){function e(){var t=this;Xt(this,e),Qt(this,"privateState",Object(r["reactive"])({rules:[]})),Qt(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),Qt(this,"rules",Object(r["computed"])((function(){return t.state.value.rules}))),Qt(this,"initPromise",null)}return Kt(e,[{key:"init",value:function(){var e=this;return this.initPromise||(this.initPromise=I["AjaxHelper"].fetch({method:"HeatmapSessionRecording.getAvailableTargetPageRules",filter_limit:"-1"}).then((function(t){return e.privateState.rules=t,e.rules.value}))),this.initPromise}}]),e}(),en=new Zt,tn=Object(r["defineComponent"])({props:{modelValue:{type:Object,required:!0},canBeRemoved:Boolean,disableIfNoValue:Boolean,allowAny:Boolean,showAddUrl:Boolean},components:{Field:L["Field"]},emits:["addUrl","removeUrl","update:modelValue"],created:function(){en.init()},watch:{modelValue:function(e){var t=this;if(e.attribute){var n=this.targetOptions[e.attribute],a=n.find((function(e){return e.key===t.pattern_type}));!a&&n[0]&&this.onTypeChange(n[0].key)}}},computed:{pattern_type:function(){var e=this.modelValue.type;return this.modelValue.inverted&&"0"!==this.modelValue.inverted&&(e="not_".concat(this.modelValue.type)),e},targetAttributes:function(){return en.rules.value.map((function(e){return{key:e.value,value:e.name}}))},targetOptions:function(){var e=this,t={};return en.rules.value.forEach((function(n){t[n.value]=[],e.allowAny&&"url"===n.value&&t[n.value].push({value:Object(I["translate"])("HeatmapSessionRecording_TargetTypeIsAny"),key:"any"}),n.types.forEach((function(e){t[n.value].push({value:e.name,key:e.value}),t[n.value].push({value:Object(I["translate"])("HeatmapSessionRecording_TargetTypeIsNot",e.name),key:"not_".concat(e.value)})}))})),t},targetExamples:function(){var e={};return en.rules.value.forEach((function(t){e[t.value]=t.example})),e}},methods:{onTypeChange:function(e){var t=0,n=e;0===e.indexOf("not_")&&(n=e.substring("not_".length),t=1),this.$emit("update:modelValue",Object.assign(Object.assign({},this.modelValue),{},{type:n,inverted:t}))}}});tn.render=Jt;var nn=tn,an={class:"loadingPiwik"},rn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),on={class:"loadingPiwik"},sn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ln={name:"name"},cn={name:"sampleLimit"},dn={class:"form-group row"},un={class:"col s12"},mn={class:"col s12 m6",style:{"padding-left":"0"}},pn=Object(r["createElementVNode"])("hr",null,null,-1),hn={class:"col s12 m6"},gn={class:"form-help"},fn={class:"inline-help"},bn={name:"sampleRate"},vn={name:"excludedElements"},yn={name:"screenshotUrl"},On={name:"breakpointMobile"},jn={name:"breakpointTablet"},Sn={name:"trackManually"},_n=["innerHTML"],Hn={class:"entityCancel"};function Vn(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("HsrUrlTarget"),c=Object(r["resolveComponent"])("HsrTargetTest"),d=Object(r["resolveComponent"])("SaveButton"),u=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(u,{class:"editHsr","content-title":e.contentTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",an,[rn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",on,[sn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[12]||(t[12]=function(t){return e.edit?e.updateHsr():e.createHsr()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",ln,[Object(r["createVNode"])(s,{uicontrol:"text",name:"name","model-value":e.siteHsr.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.siteHsr.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("HeatmapSessionRecording_FieldNamePlaceholder"),"inline-help":e.translate("HeatmapSessionRecording_HeatmapNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(r["createElementVNode"])("div",cn,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleLimit","model-value":e.siteHsr.sample_limit,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.siteHsr.sample_limit=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_HeatmapSampleLimit"),options:e.sampleLimits,"inline-help":e.translate("HeatmapSessionRecording_HeatmapSampleLimitHelp")},null,8,["model-value","title","options","inline-help"])]),Object(r["createElementVNode"])("div",dn,[Object(r["createElementVNode"])("div",un,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPage"))+":",1)]),Object(r["createElementVNode"])("div",mn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.siteHsr.match_page_rules,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])("matchPageRules ".concat(a," multiple")),key:a},[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"model-value":n,"onUpdate:modelValue":function(t){return e.setMatchPageRule(t,a)},onAddUrl:t[2]||(t[2]=function(t){return e.addMatchPageRule()}),onRemoveUrl:function(t){return e.removeMatchPageRule(a)},onAnyChange:t[3]||(t[3]=function(t){return e.setValueHasChanged()}),"allow-any":!1,"disable-if-no-value":a>0,"can-be-removed":a>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),pn],2)})),128))]),Object(r["createElementVNode"])("div",hn,[Object(r["createElementVNode"])("div",gn,[Object(r["createElementVNode"])("span",fn,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelp"))+" ",1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(r["createElementVNode"])("div",bn,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_HeatmapSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(r["createElementVNode"])("div",vn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"excludedElements","model-value":e.siteHsr.excluded_elements,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.siteHsr.excluded_elements=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ExcludedElements"),maxlength:1e3,"inline-help":e.translate("HeatmapSessionRecording_ExcludedElementsHelp")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",yn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"screenshotUrl","model-value":e.siteHsr.screenshot_url,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.siteHsr.screenshot_url=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ScreenshotUrl"),maxlength:300,disabled:!!e.siteHsr.page_treemirror,"inline-help":e.translate("HeatmapSessionRecording_ScreenshotUrlHelp")},null,8,["model-value","title","disabled","inline-help"])]),Object(r["createElementVNode"])("div",On,[Object(r["createVNode"])(s,{uicontrol:"text",name:"breakpointMobile","model-value":e.siteHsr.breakpoint_mobile,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.siteHsr.breakpoint_mobile=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("General_Mobile")),maxlength:4,"inline-help":e.breakpointMobileInlineHelp},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",jn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"breakpointTablet","model-value":e.siteHsr.breakpoint_tablet,"onUpdate:modelValue":t[8]||(t[8]=function(t){e.siteHsr.breakpoint_tablet=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("DevicesDetection_Tablet")),maxlength:4,"inline-help":e.breakpointGeneralHelp},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",Sn,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"capture_manually",title:e.translate("HeatmapSessionRecording_CaptureDomTitle"),"inline-help":e.captureDomInlineHelp,"model-value":e.siteHsr.capture_manually,"onUpdate:modelValue":t[9]||(t[9]=function(t){e.siteHsr.capture_manually=t,e.setValueHasChanged()})},null,8,["title","inline-help","model-value"])]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,_n),Object(r["createVNode"])(d,{class:"createButton",onConfirm:t[10]||(t[10]=function(t){return e.edit?e.updateHsr():e.createHsr()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",Hn,[Object(r["createElementVNode"])("a",{onClick:t[11]||(t[11]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function Nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function En(e,t,n){return t&&wn(e.prototype,t),n&&wn(e,n),e}function kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */var Rn=function(){function e(t){var n=this;Nn(this,e),kn(this,"context",void 0),kn(this,"privateState",Object(r["reactive"])({allHsrs:[],isLoading:!1,isUpdating:!1,filterStatus:""})),kn(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(n.privateState)}))),kn(this,"hsrs",Object(r["computed"])((function(){return n.privateState.filterStatus?n.state.value.allHsrs.filter((function(e){return e.status===n.privateState.filterStatus})):n.state.value.allHsrs}))),kn(this,"hsrsCloned",Object(r["computed"])((function(){return Object(I["clone"])(n.hsrs.value)}))),kn(this,"statusOptions",Object(r["readonly"])([{key:"",value:Object(I["translate"])("General_All")},{key:"active",value:Object(I["translate"])("HeatmapSessionRecording_StatusActive")},{key:"ended",value:Object(I["translate"])("HeatmapSessionRecording_StatusEnded")},{key:"paused",value:Object(I["translate"])("HeatmapSessionRecording_StatusPaused")}])),kn(this,"fetchPromises",{}),this.context=t}return En(e,[{key:"setFilterStatus",value:function(e){this.privateState.filterStatus=e}},{key:"reload",value:function(){return this.privateState.allHsrs=[],this.fetchPromises={},this.fetchHsrs()}},{key:"filterRules",value:function(e){return e.filter((function(e){return!!e&&(e.value||"any"===e.type)}))}},{key:"getApiMethodInContext",value:function(e){return"".concat(e).concat(this.context)}},{key:"fetchHsrs",value:function(){var e=this,t="HeatmapSessionRecording.getHeatmaps";"SessionRecording"===this.context&&(t="HeatmapSessionRecording.getSessionRecordings");var n={method:t,filter_limit:"-1"};return this.fetchPromises[t]||(this.fetchPromises[t]=I["AjaxHelper"].fetch(n)),this.privateState.isLoading=!0,this.privateState.allHsrs=[],this.fetchPromises[t].then((function(t){return e.privateState.allHsrs=t,e.state.value.allHsrs})).finally((function(){e.privateState.isLoading=!1}))}},{key:"findHsr",value:function(e){var t=this,n=this.state.value.allHsrs.find((function(t){return t.idsitehsr===e}));return n?Promise.resolve(n):(this.privateState.isLoading=!0,I["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.get"),filter_limit:"-1"}).finally((function(){t.privateState.isLoading=!1})))}},{key:"deleteHsr",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.allHsrs=[],I["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.delete")},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"completeHsr",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.allHsrs=[],I["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.end")},{withTokenInUrl:!0}).then((function(){return{type:"success"}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createOrUpdateHsr",value:function(e,t){var n=this,a={idSiteHsr:e.idsitehsr,sampleLimit:e.sample_limit,sampleRate:e.sample_rate,excludedElements:e.excluded_elements?e.excluded_elements.trim():void 0,screenshotUrl:e.screenshot_url?e.screenshot_url.trim():void 0,breakpointMobile:e.breakpoint_mobile,breakpointTablet:e.breakpoint_tablet,minSessionTime:e.min_session_time,requiresActivity:e.requires_activity?1:0,captureKeystrokes:e.capture_keystrokes?1:0,captureDomManually:e.capture_manually?1:0,method:t,name:e.name.trim()},i={matchPageRules:this.filterRules(e.match_page_rules)};return this.privateState.isUpdating=!0,I["AjaxHelper"].post(a,i,{withTokenInUrl:!0}).then((function(e){return{type:"success",response:e}})).catch((function(e){return{type:"error",message:e.message||e}})).finally((function(){n.privateState.isUpdating=!1}))}}]),e}(),Cn=new Rn("Heatmap"),xn=new Rn("SessionRecording");function Tn(e){return An(e)||Pn(e)||Mn(e)||Dn()}function Dn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Mn(e,t){if(e){if("string"===typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}function Pn(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function An(e){if(Array.isArray(e))return Bn(e)}function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var Un="hsrmanagement",In=Object(r["defineComponent"])({props:{idSiteHsr:Number,breakpointMobile:Number,breakpointTablet:Number},components:{ContentBlock:I["ContentBlock"],Field:L["Field"],HsrUrlTarget:nn,HsrTargetTest:It,SaveButton:L["SaveButton"]},data:function(){return{isDirty:!1,showAdvancedView:!1,siteHsr:{}}},created:function(){this.init()},watch:{idSiteHsr:function(e){null!==e&&this.init()}},methods:{removeAnyHsrNotification:function(){I["NotificationsStore"].remove(Un),I["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=I["NotificationsStore"].show({message:e,context:t,id:Un,type:"transient"});setTimeout((function(){I["NotificationsStore"].scrollToNotification(n)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(I["translate"])("HeatmapSessionRecording_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init:function(){var e=this,t=this.idSiteHsr;if(this.siteHsr={},this.showAdvancedView=!1,I["Matomo"].helper.lazyScrollToContent(),this.edit&&t)Cn.findHsr(t).then((function(t){t&&(e.siteHsr=Object(I["clone"])(t),e.siteHsr.sample_rate="".concat(e.siteHsr.sample_rate),e.addInitialMatchPageRule(),e.isDirty=!1)}));else if(this.create){this.siteHsr={idSite:I["Matomo"].idSite,name:"",sample_rate:"10.0",sample_limit:1e3,breakpoint_mobile:this.breakpointMobile,breakpoint_tablet:this.breakpointTablet,capture_manually:0},this.isDirty=!1;var n=I["MatomoUrl"].hashParsed.value;if(n.name&&(this.siteHsr.name=n.name,this.isDirty=!0),n.matchPageRules)try{this.siteHsr.match_page_rules=JSON.parse(n.matchPageRules),this.isDirty=!0}catch(a){console.log("warning: could not parse matchPageRules query param, expected JSON")}else this.addInitialMatchPageRule()}},addInitialMatchPageRule:function(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||this.addMatchPageRule())},addMatchPageRule:function(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[]),this.siteHsr.match_page_rules.push({attribute:"url",type:"equals_simple",value:"",inverted:0}),this.isDirty=!0)},removeMatchPageRule:function(e){this.siteHsr&&e>-1&&(this.siteHsr.match_page_rules=Tn(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel:function(){var e=Object.assign({},I["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,I["MatomoUrl"].updateHash(e)},createHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&Cn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addHeatmap").then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var n=t.response.value;Cn.reload().then((function(){I["Matomo"].helper.isReportingPage()&&I["Matomo"].postEvent("updateReportingMenu"),I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:n})),setTimeout((function(){e.showNotification(Object(I["translate"])("HeatmapSessionRecording_HeatmapCreated"),t.type)}),200)}))}}))},setValueHasChanged:function(){this.isDirty=!0},updateHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&Cn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateHeatmap").then((function(t){"error"!==t.type&&(e.isDirty=!1,e.siteHsr={},Cn.reload().then((function(){e.init()})),e.showNotification(Object(I["translate"])("HeatmapSessionRecording_HeatmapUpdated"),t.type))}))},checkRequiredFieldsAreSet:function(){var e;if(!this.siteHsr.name){var t=Object(I["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(t),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!Cn.filterRules(this.siteHsr.match_page_rules).length){var n=Object(I["translate"])("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(n,"error"),!1}return!0},setMatchPageRule:function(e,t){this.siteHsr.match_page_rules=Tn(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules[t]=e}},computed:{sampleLimits:function(){return[1e3,2e3,5e3].map((function(e){return{key:"".concat(e),value:e}}))},sampleRates:function(){var e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map((function(e){return{key:e.toFixed(1),value:"".concat(e,"%")}}))},create:function(){return!this.idSiteHsr},edit:function(){return!this.create},editTitle:function(){var e=this.create?"HeatmapSessionRecording_CreateNewHeatmap":"HeatmapSessionRecording_EditHeatmapX";return e},contentTitle:function(){return Object(I["translate"])(this.editTitle,this.siteHsr.name?'"'.concat(this.siteHsr.name,'"'):"")},isLoading:function(){return Cn.state.value.isLoading},isUpdating:function(){return Cn.state.value.isUpdating},breakpointMobileInlineHelp:function(){var e=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return"".concat(e," ").concat(t)},breakpointGeneralHelp:function(){var e=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return"".concat(e," ").concat(t)},captureDomInlineHelp:function(){var e=this.idSiteHsr?this.idSiteHsr:"{idHeatmap}",t="<br><br><strong>_paq.push(['HeatmapSessionRecording::captureInitialDom', ".concat(e,"])</strong>");return Object(I["translate"])("HeatmapSessionRecording_CaptureDomInlineHelp",t,"<br><br><strong>","</strong>")},personalInformationNote:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(I["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(I["translate"])("HeatmapSessionRecording_Heatmap"),"<code>","</code>",'<a href="'.concat(e,'" target="_blank" rel="noreferrer noopener">'),"</a>")},saveButtonText:function(){return this.edit?Object(I["translate"])("CoreUpdater_UpdateTitle"):Object(I["translate"])("HeatmapSessionRecording_CreateNewHeatmap")}}});In.render=Vn;var Ln=In,Fn={class:"heatmapList"},Wn={class:"filterStatus"},qn={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},zn={class:"index"},Gn={class:"name"},$n={class:"creationDate"},Jn={class:"sampleLimit"},Xn={class:"status"},Yn={class:"action"},Kn={colspan:"7"},Qn={class:"loadingPiwik"},Zn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ea={colspan:"7"},ta=["id"],na={class:"index"},aa={class:"name"},ia={class:"creationDate"},ra={class:"sampleLimit"},oa={key:0,class:"status status-paused"},sa=["title"],la={key:1,class:"status"},ca={class:"action"},da=["title","onClick"],ua=["title","onClick"],ma=["title","href"],pa=["title","onClick"],ha={class:"tableActionBar"},ga=Object(r["createElementVNode"])("span",{class:"icon-add"},null,-1),fa={class:"ui-confirm",id:"confirmDeleteHeatmap",ref:"confirmDeleteHeatmap"},ba=["value"],va=["value"],ya={class:"ui-confirm",id:"confirmEndHeatmap",ref:"confirmEndHeatmap"},Oa=["value"],ja=["value"];function Sa(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Fn,[Object(r["createVNode"])(l,{"content-title":e.translate("HeatmapSessionRecording_ManageHeatmaps")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapUsageBenefits")),1),Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Wn,[Object(r["createVNode"])(s,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",qn,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[r["vShow"],e.hsrs.length>0]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",zn,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",Gn,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",$n,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(r["createElementVNode"])("th",Jn,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(r["createElementVNode"])("th",Xn,Object(r["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(r["createElementVNode"])("th",Yn,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Kn,[Object(r["createElementVNode"])("span",Qn,[Zn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",ea,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_NoHeatmapsFound")),1)],512),[[r["vShow"],!e.isLoading&&0===e.hsrs.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedHsrs,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"hsr".concat(t.idsitehsr),class:"hsrs",key:t.idsitehsr},[Object(r["createElementVNode"])("td",na,Object(r["toDisplayString"])(t.idsitehsr),1),Object(r["createElementVNode"])("td",aa,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",ia,Object(r["toDisplayString"])(t.created_date_pretty),1),Object(r["createElementVNode"])("td",ra,Object(r["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",oa,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(r["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,sa)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",la,Object(r["toDisplayString"])(e.ucfirst(t.status)),1)),Object(r["createElementVNode"])("td",ca,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.editHsr(t.idsitehsr)}},null,8,da),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{a:"",class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.completeHsr(t)}},null,8,ua),[[r["vShow"],"ended"!==t.status]]),Object(r["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t)},null,8,ma),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.deleteHsr(t)}},null,8,pa)])],8,ta)})),128))])],512),[[c]]),Object(r["createElementVNode"])("div",ha,[Object(r["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=function(t){return e.createHsr()})},[ga,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewHeatmap")),1)])])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",fa,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteHeatmapConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ba),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,va)],512),Object(r["createElementVNode"])("div",ya,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_EndHeatmapConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Oa),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ja)],512)])}function _a(e){return wa(e)||Na(e)||Va(e)||Ha()}function Ha(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Va(e,t){if(e){if("string"===typeof e)return Ea(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ea(e,t):void 0}}function Na(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function wa(e){if(Array.isArray(e))return Ea(e)}function Ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var ka=Object(r["defineComponent"])({props:{pauseReason:String},components:{ContentBlock:I["ContentBlock"],Field:L["Field"]},directives:{ContentTable:I["ContentTable"]},data:function(){return{searchFilter:""}},created:function(){Cn.setFilterStatus(""),Cn.fetchHsrs()},methods:{createHsr:function(){this.editHsr(0)},editHsr:function(e){I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:e}))},deleteHsr:function(e){I["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmap,{yes:function(){Cn.deleteHsr(e.idsitehsr).then((function(){Cn.reload(),I["Matomo"].postEvent("updateReportingMenu")}))}})},completeHsr:function(e){I["Matomo"].helper.modalConfirm(this.$refs.confirmEndHeatmap,{yes:function(){Cn.completeHsr(e.idsitehsr).then((function(){Cn.reload()}))}})},setFilterStatus:function(e){Cn.setFilterStatus(e)},ucfirst:function(e){return"".concat(e[0].toUpperCase()).concat(e.substr(1))},getViewReportLink:function(e){return"?".concat(I["MatomoUrl"].stringify({module:"Widgetize",action:"iframe",moduleToWidgetize:"HeatmapSessionRecording",actionToWidgetize:"showHeatmap",idSiteHsr:e.idsitehsr,idSite:e.idsite,period:"day",date:"yesterday"}))}},computed:{filterStatus:function(){return Cn.state.value.filterStatus},statusOptions:function(){return Cn.statusOptions},hsrs:function(){return Cn.hsrs.value},isLoading:function(){return Cn.state.value.isLoading},isUpdating:function(){return Cn.state.value.isUpdating},sortedHsrs:function(){var e=this,t=_a(this.hsrs).filter((function(t){return Object.keys(t).some((function(n){var a=t;return"string"===typeof a[n]&&-1!==a[n].indexOf(e.searchFilter)}))}));return t.sort((function(e,t){return t.idsitehsr-e.idsitehsr})),t}}});ka.render=Sa;var Ra=ka,Ca={class:"manageHsr",ref:"root"},xa={key:0},Ta={key:1};function Da(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("MatomoJsNotWritableAlert"),l=Object(r["resolveComponent"])("HeatmapList"),c=Object(r["resolveComponent"])("HeatmapEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],null,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createBlock"])(s,{key:0,"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_Heatmaps")},null,8,["is-matomo-js-writable","recording-type"])),Object(r["createElementVNode"])("div",Ca,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",xa,[Object(r["createVNode"])(l,{"pause-reason":e.pauseReason},null,8,["pause-reason"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ta,[Object(r["createVNode"])(c,{"breakpoint-mobile":e.breakpointMobile,"breakpoint-tablet":e.breakpointTablet,"id-site-hsr":e.idSiteHsr},null,8,["breakpoint-mobile","breakpoint-tablet","id-site-hsr"])])):Object(r["createCommentVNode"])("",!0)],512)],64)}var Ma=["innerHTML"];function Pa(e,t,n,a,i,o){return e.isMatomoJsWritable?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:0,class:"alert alert-warning",innerHTML:e.getJsNotWritableErrorMessage()},null,8,Ma))}var Aa=Object(r["defineComponent"])({props:{recordingType:{type:String,required:!0},isMatomoJsWritable:{type:Boolean,required:!0}},methods:{getJsNotWritableErrorMessage:function(){return Object(I["translate"])("HeatmapSessionRecording_MatomoJSNotWritableErrorMessage",this.recordingType,'<a href="https://developer.matomo.org/guides/heatmap-session-recording/setup#when-the-matomojs-in-your-piwik-directory-file-is-not-writable" target="_blank" rel="noreferrer noopener">',"</a>")}}});Aa.render=Pa;var Ba=Aa,Ua=window,Ia=Ua.$,La=Object(r["defineComponent"])({props:{breakpointMobile:Number,breakpointTablet:Number,pauseReason:String,isMatomoJsWritable:{type:Boolean,required:!0}},data:function(){return{editMode:!1,idSiteHsr:null}},components:{MatomoJsNotWritableAlert:Ba,HeatmapList:Ra,HeatmapEdit:Ln},watch:{editMode:function(){Ia(".ui-tooltip").remove()}},created:function(){var e=this;Object(r["watch"])((function(){return I["MatomoUrl"].hashParsed.value.idSiteHsr}),(function(t){e.initState(t)})),this.initState(I["MatomoUrl"].hashParsed.value.idSiteHsr)},methods:{removeAnyHsrNotification:function(){I["NotificationsStore"].remove("hsrmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(I["Matomo"].postEvent("HeatmapSessionRecording.initAddHeatmap",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idSiteHsr=null)}this.editMode=!0,this.idSiteHsr=parseInt(e,10)}else this.editMode=!1,this.idSiteHsr=null;this.removeAnyHsrNotification()}}});La.render=Da;var Fa=La,Wa={class:"loadingPiwik"},qa=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),za={class:"loadingPiwik"},Ga=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),$a={name:"name"},Ja={name:"sampleLimit"},Xa={class:"form-group row"},Ya={class:"col s12"},Ka={class:"col s12 m6",style:{"padding-left":"0"}},Qa=Object(r["createElementVNode"])("hr",null,null,-1),Za={class:"col s12 m6"},ei={class:"form-help"},ti={class:"inline-help"},ni={name:"sampleRate"},ai={name:"minSessionTime"},ii={name:"requiresActivity"},ri={class:"inline-help-node"},oi=["innerHTML"],si=["innerHTML"],li={class:"entityCancel"};function ci(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("HsrUrlTarget"),c=Object(r["resolveComponent"])("HsrTargetTest"),d=Object(r["resolveComponent"])("SaveButton"),u=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(u,{class:"editHsr","content-title":e.contentTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Wa,[qa,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",za,[Ga,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[10]||(t[10]=function(t){return e.edit?e.updateHsr():e.createHsr()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",$a,[Object(r["createVNode"])(s,{uicontrol:"text",name:"name","model-value":e.siteHsr.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.siteHsr.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("HeatmapSessionRecording_FieldNamePlaceholder"),"inline-help":e.translate("HeatmapSessionRecording_SessionNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(r["createElementVNode"])("div",Ja,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleLimit","model-value":e.siteHsr.sample_limit,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.siteHsr.sample_limit=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SessionSampleLimit"),options:e.sampleLimits,"inline-help":e.translate("HeatmapSessionRecording_SessionSampleLimitHelp")},null,8,["model-value","title","options","inline-help"])]),Object(r["createElementVNode"])("div",Xa,[Object(r["createElementVNode"])("div",Ya,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPages"))+":",1)]),Object(r["createElementVNode"])("div",Ka,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.siteHsr.match_page_rules,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])("matchPageRules ".concat(a," multiple")),key:a},[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"model-value":n,"onUpdate:modelValue":function(t){return e.setMatchPageRule(t,a)},onAddUrl:t[2]||(t[2]=function(t){return e.addMatchPageRule()}),onRemoveUrl:function(t){return e.removeMatchPageRule(a)},onAnyChange:t[3]||(t[3]=function(t){return e.setValueHasChanged()}),"allow-any":!0,"disable-if-no-value":a>0,"can-be-removed":a>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),Qa],2)})),128))]),Object(r["createElementVNode"])("div",Za,[Object(r["createElementVNode"])("div",ei,[Object(r["createElementVNode"])("span",ti,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelpSessions"))+" ",1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(r["createElementVNode"])("div",ni,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_SessionSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(r["createElementVNode"])("div",ai,[Object(r["createVNode"])(s,{uicontrol:"select",name:"minSessionTime","model-value":e.siteHsr.min_session_time,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.siteHsr.min_session_time=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_MinSessionTime"),options:e.minSessionTimes,"inline-help":e.translate("HeatmapSessionRecording_MinSessionTimeHelp")},null,8,["model-value","title","options","inline-help"])]),Object(r["createElementVNode"])("div",ii,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"requiresActivity","model-value":e.siteHsr.requires_activity,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.siteHsr.requires_activity=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_RequiresActivity"),"inline-help":e.translate("HeatmapSessionRecording_RequiresActivityHelp")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"captureKeystrokes","model-value":e.siteHsr.capture_keystrokes,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.siteHsr.capture_keystrokes=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_CaptureKeystrokes")},{"inline-help":Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("div",ri,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.captureKeystrokesHelp)},null,8,oi)])]})),_:1},8,["model-value","title"])]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,si),Object(r["createVNode"])(d,{class:"createButton",onConfirm:t[8]||(t[8]=function(t){return e.edit?e.updateHsr():e.createHsr()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",li,[Object(r["createElementVNode"])("a",{onClick:t[9]||(t[9]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function di(e){return hi(e)||pi(e)||mi(e)||ui()}function ui(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function mi(e,t){if(e){if("string"===typeof e)return gi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gi(e,t):void 0}}function pi(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function hi(e){if(Array.isArray(e))return gi(e)}function gi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var fi="hsrmanagement",bi=Object(r["defineComponent"])({props:{idSiteHsr:Number},components:{ContentBlock:I["ContentBlock"],Field:L["Field"],HsrUrlTarget:nn,HsrTargetTest:It,SaveButton:L["SaveButton"]},data:function(){return{isDirty:!1,showAdvancedView:!1,sampleLimits:[],siteHsr:{}}},created:function(){var e=this;I["AjaxHelper"].fetch({method:"HeatmapSessionRecording.getAvailableSessionRecordingSampleLimits"}).then((function(t){e.sampleLimits=(t||[]).map((function(e){return{key:"".concat(e),value:e}}))})),this.init()},watch:{idSiteHsr:function(e){null!==e&&this.init()}},methods:{removeAnyHsrNotification:function(){I["NotificationsStore"].remove(fi),I["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=I["NotificationsStore"].show({message:e,context:t,id:fi,type:"transient"});setTimeout((function(){I["NotificationsStore"].scrollToNotification(n)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(I["translate"])("HeatmapSessionRecording_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init:function(){var e=this,t=this.idSiteHsr;this.siteHsr={},this.showAdvancedView=!1,I["Matomo"].helper.lazyScrollToContent(),this.edit&&t?xn.findHsr(t).then((function(t){t&&(e.siteHsr=Object(I["clone"])(t),e.siteHsr.sample_rate="".concat(e.siteHsr.sample_rate),e.addInitialMatchPageRule(),e.isDirty=!1)})):this.create&&(this.siteHsr={idSite:I["Matomo"].idSite,name:"",sample_rate:"10.0",sample_limit:250,min_session_time:0,requires_activity:!0,capture_keystrokes:!1},this.addInitialMatchPageRule(),this.isDirty=!1)},addInitialMatchPageRule:function(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[{attribute:"url",type:"any",value:"",inverted:0}]))},addMatchPageRule:function(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[]),this.siteHsr.match_page_rules.push({attribute:"url",type:"equals_simple",value:"",inverted:0}),this.isDirty=!0)},removeMatchPageRule:function(e){this.siteHsr&&e>-1&&(this.siteHsr.match_page_rules=di(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel:function(){var e=Object.assign({},I["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,I["MatomoUrl"].updateHash(e)},createHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&xn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addSessionRecording").then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var n=t.response.value;xn.reload().then((function(){I["Matomo"].helper.isReportingPage()&&I["Matomo"].postEvent("updateReportingMenu"),I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:n})),setTimeout((function(){e.showNotification(Object(I["translate"])("HeatmapSessionRecording_SessionRecordingCreated"),t.type)}),200)}))}}))},setValueHasChanged:function(){this.isDirty=!0},updateHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&xn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateSessionRecording").then((function(t){"error"!==t.type&&(e.isDirty=!1,e.siteHsr={},xn.reload().then((function(){e.init()})),e.showNotification(Object(I["translate"])("HeatmapSessionRecording_SessionRecordingUpdated"),t.type))}))},checkRequiredFieldsAreSet:function(){var e;if(!this.siteHsr.name){var t=this.translate("General_Name");return this.showErrorFieldNotProvidedNotification(t),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!xn.filterRules(this.siteHsr.match_page_rules).length){var n=this.translate("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(n,"error"),!1}return!0},setMatchPageRule:function(e,t){this.siteHsr.match_page_rules=di(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules[t]=e}},computed:{minSessionTimes:function(){return[0,5,10,15,20,30,45,60,90,120].map((function(e){return{key:"".concat(e),value:"".concat(e," seconds")}}))},sampleRates:function(){var e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map((function(e){return{key:"".concat(e.toFixed(1)),value:"".concat(e,"%")}}))},create:function(){return!this.idSiteHsr},edit:function(){return!this.create},editTitle:function(){var e=this.create?"HeatmapSessionRecording_CreateNewSessionRecording":"HeatmapSessionRecording_EditSessionRecordingX";return e},contentTitle:function(){return Object(I["translate"])(this.editTitle,this.siteHsr.name?'"'.concat(this.siteHsr.name,'"'):"")},isLoading:function(){return Cn.state.value.isLoading},isUpdating:function(){return Cn.state.value.isUpdating},captureKeystrokesHelp:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-keystrokes-in-form-fields";return Object(I["translate"])("HeatmapSessionRecording_CaptureKeystrokesHelp",'<a href="'.concat(e,'" target="_blank" rel="noopener noreferrer">'),"</a>")},personalInformationNote:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(I["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(I["translate"])("HeatmapSessionRecording_SessionRecording"),"<code>","</code>",'<a href="'.concat(e,'" target="_blank" rel="noreferrer noopener">'),"</a>")},saveButtonText:function(){return this.edit?Object(I["translate"])("CoreUpdater_UpdateTitle"):Object(I["translate"])("HeatmapSessionRecording_CreateNewSessionRecording")}}});bi.render=ci;var vi=bi,yi={class:"sessionRecordingList"},Oi={class:"filterStatus"},ji={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},Si={class:"index"},_i={class:"name"},Hi={class:"creationDate"},Vi={class:"sampleLimit"},Ni={class:"status"},wi={class:"action"},Ei={colspan:"7"},ki={class:"loadingPiwik"},Ri=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ci={colspan:"7"},xi=["id"],Ti={class:"index"},Di={class:"name"},Mi={class:"creationDate"},Pi={class:"sampleLimit"},Ai={key:0,class:"status status-paused"},Bi=["title"],Ui={key:1,class:"status"},Ii={class:"action"},Li=["title","onClick"],Fi=["title","onClick"],Wi=["title","href"],qi=["title","onClick"],zi={class:"tableActionBar"},Gi=Object(r["createElementVNode"])("span",{class:"icon-add"},null,-1),$i={class:"ui-confirm",ref:"confirmDeleteSessionRecording"},Ji=["value"],Xi=["value"],Yi={class:"ui-confirm",ref:"confirmEndSessionRecording"},Ki=["value"],Qi=["value"];function Zi(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",yi,[Object(r["createVNode"])(l,{"content-title":e.translate("HeatmapSessionRecording_ManageSessionRecordings")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SessionRecordingsUsageBenefits")),1),Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Oi,[Object(r["createVNode"])(s,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",ji,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[r["vShow"],e.hsrs.length>0]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",Si,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",_i,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",Hi,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(r["createElementVNode"])("th",Vi,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(r["createElementVNode"])("th",Ni,Object(r["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(r["createElementVNode"])("th",wi,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ei,[Object(r["createElementVNode"])("span",ki,[Ri,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ci,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_NoSessionRecordingsFound")),1)],512),[[r["vShow"],!e.isLoading&&0==e.hsrs.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedHsrs,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"hsr".concat(t.idsitehsr),class:"hsrs",key:t.idsitehsr},[Object(r["createElementVNode"])("td",Ti,Object(r["toDisplayString"])(t.idsitehsr),1),Object(r["createElementVNode"])("td",Di,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",Mi,Object(r["toDisplayString"])(t.created_date_pretty),1),Object(r["createElementVNode"])("td",Pi,Object(r["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",Ai,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(r["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,Bi)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",Ui,Object(r["toDisplayString"])(e.ucfirst(t.status)),1)),Object(r["createElementVNode"])("td",Ii,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.editHsr(t.idsitehsr)}},null,8,Li),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.completeHsr(t)}},null,8,Fi),[[r["vShow"],"ended"!==t.status]]),Object(r["createElementVNode"])("a",{class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t),target:"_blank"},null,8,Wi),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.deleteHsr(t)}},null,8,qi)])],8,xi)})),128))])],512),[[c]]),Object(r["createElementVNode"])("div",zi,[Object(r["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=function(t){return e.createHsr()})},[Gi,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewSessionRecording")),1)])])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",$i,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteSessionRecordingConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ji),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Xi)],512),Object(r["createElementVNode"])("div",Yi,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_EndSessionRecordingConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ki),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Qi)],512)])}function er(e){return ir(e)||ar(e)||nr(e)||tr()}function tr(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function nr(e,t){if(e){if("string"===typeof e)return rr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rr(e,t):void 0}}function ar(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ir(e){if(Array.isArray(e))return rr(e)}function rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var or=Object(r["defineComponent"])({props:{pauseReason:String},components:{ContentBlock:I["ContentBlock"],Field:L["Field"]},directives:{ContentTable:I["ContentTable"]},data:function(){return{searchFilter:""}},created:function(){xn.setFilterStatus(""),xn.fetchHsrs()},methods:{createHsr:function(){this.editHsr(0)},editHsr:function(e){I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:e}))},deleteHsr:function(e){I["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteSessionRecording,{yes:function(){xn.deleteHsr(e.idsitehsr).then((function(){xn.reload(),I["Matomo"].postEvent("updateReportingMenu")}))}})},completeHsr:function(e){I["Matomo"].helper.modalConfirm(this.$refs.confirmEndSessionRecording,{yes:function(){xn.completeHsr(e.idsitehsr).then((function(){xn.reload()}))}})},setFilterStatus:function(e){xn.setFilterStatus(e)},ucfirst:function(e){return"".concat(e[0].toUpperCase()).concat(e.substr(1))},getViewReportLink:function(e){return"?".concat(I["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:e.idsite,period:"day",date:"yesterday"}),"#?").concat(I["MatomoUrl"].stringify({category:"HeatmapSessionRecording_SessionRecordings",idSite:e.idsite,period:"day",date:"yesterday",subcategory:e.idsitehsr}))}},computed:{filterStatus:function(){return xn.state.value.filterStatus},statusOptions:function(){return xn.statusOptions},hsrs:function(){return xn.hsrs.value},isLoading:function(){return xn.state.value.isLoading},isUpdating:function(){return xn.state.value.isUpdating},sortedHsrs:function(){var e=this,t=er(this.hsrs).filter((function(t){return Object.keys(t).some((function(n){var a=t;return"string"===typeof a[n]&&-1!==a[n].indexOf(e.searchFilter)}))}));return t.sort((function(e,t){return t.idsitehsr-e.idsitehsr})),t}}});or.render=Zi;var sr=or,lr={class:"manageHsr"};function cr(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("MatomoJsNotWritableAlert"),l=Object(r["resolveComponent"])("SessionRecordingList"),c=Object(r["resolveComponent"])("SessionRecordingEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],null,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createBlock"])(s,{key:0,"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_SessionRecordings")},null,8,["is-matomo-js-writable","recording-type"])),Object(r["createElementVNode"])("div",lr,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"pause-reason":e.pauseReason},null,8,["pause-reason"])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-site-hsr":e.idSiteHsr},null,8,["id-site-hsr"])],512),[[r["vShow"],e.editMode]])])],64)}var dr=Object(r["defineComponent"])({props:{pauseReason:String,isMatomoJsWritable:{type:Boolean,required:!0}},data:function(){return{editMode:!1,idSiteHsr:null}},components:{MatomoJsNotWritableAlert:Ba,SessionRecordingEdit:vi,SessionRecordingList:sr},created:function(){var e=this;Object(r["watch"])((function(){return I["MatomoUrl"].hashParsed.value.idSiteHsr}),(function(t){e.initState(t)})),this.initState(I["MatomoUrl"].hashParsed.value.idSiteHsr)},methods:{removeAnyHsrNotification:function(){I["NotificationsStore"].remove("hsrmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(I["Matomo"].postEvent("HeatmapSessionRecording.initAddSessionRecording",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idSiteHsr=null)}this.editMode=!0,this.idSiteHsr=parseInt(e,10)}else this.editMode=!1,this.idSiteHsr=null;this.removeAnyHsrNotification()}}});dr.render=cr;var ur=dr,mr={class:"ui-confirm",id:"listOfPageviews"},pr=Object(r["createElementVNode"])("br",null,null,-1),hr=Object(r["createElementVNode"])("br",null,null,-1),gr=["onClick"],fr=["title"],br=["value"];function vr(e,t,n,a,i,o){var s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",mr,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_PageviewsInVisit")),1),pr,hr,Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ColumnTime")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_TimeOnPage")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Goals_URL")),1)])]),Object(r["createElementVNode"])("tbody",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.pageviews,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t.idloghsr,class:Object(r["normalizeClass"])({inactive:t.idloghsr!==e.idLogHsr}),onClick:function(n){return e.onClickPageView(t)}},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.server_time_pretty),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.time_on_page_pretty),1),Object(r["createElementVNode"])("td",{title:t.label},Object(r["toDisplayString"])((t.label||"").substr(0,50)),9,fr)],10,gr)})),128))])],512),[[s]]),Object(r["createElementVNode"])("input",{role:"close",type:"button",value:e.translate("General_Close")},null,8,br)])}var yr=Object(r["defineComponent"])({props:{pageviews:{type:Array,required:!0},idLogHsr:{type:Number,required:!0}},directives:{ContentTable:I["ContentTable"]},methods:{onClickPageView:function(e){e.idloghsr!==this.idLogHsr&&I["MatomoUrl"].updateUrl(Object.assign(Object.assign({},I["MatomoUrl"].urlParsed.value),{},{idLogHsr:e.idloghsr}),I["MatomoUrl"].hashParsed.value.length?Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idLogHsr:e.idloghsr}):void 0)}}});yr.render=vr;var Or=yr,jr={class:"heatmap-vis-title"},Sr={key:0,class:"alert alert-info heatmap-country-alert"},_r={key:1},Hr={key:2},Vr={class:"alert alert-info"},Nr={key:3},wr={class:"alert alert-info"};function Er(e,t,n,a,i,o){var s,l=Object(r["resolveComponent"])("EnrichedHeadline"),c=Object(r["resolveComponent"])("MatomoJsNotWritableAlert"),d=Object(r["resolveComponent"])("HeatmapVis"),u=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createElementVNode"])("h2",jr,[Object(r["createVNode"])(l,{"edit-url":e.editUrl,"inline-help":e.inlineHelp},{default:Object(r["withCtx"])((function(){return[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapX",'"'.concat(e.heatmap.name,'"'))),1)]})),_:1},8,["edit-url","inline-help"])]),Object(r["createVNode"])(c,{"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_Heatmaps")},null,8,["is-matomo-js-writable","recording-type"]),e.includedCountries?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Sr,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapInfoTrackVisitsFromCountries",e.includedCountries)),1)):Object(r["createCommentVNode"])("",!0),e.heatmap.page_treemirror?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",_r,[Object(r["createVNode"])(d,{"created-date":e.createdDate,"excluded-elements":e.heatmap.excluded_elements,"num-samples":e.heatmapMetadata,url:e.heatmap.screenshot_url,"heatmap-date":e.heatmapDate,"heatmap-period":e.heatmapPeriod,"offset-accuracy":e.offsetAccuracy,"breakpoint-tablet":e.heatmap.breakpoint_tablet,"breakpoint-mobile":e.heatmap.breakpoint_mobile,"heatmap-types":e.heatmapTypes,"device-types":e.deviceTypes,"id-site-hsr":e.idSiteHsr,"is-active":e.isActive,"desktop-preview-size":e.desktopPreviewSize,"iframe-resolutions-values":e.iframeResolutions},null,8,["created-date","excluded-elements","num-samples","url","heatmap-date","heatmap-period","offset-accuracy","breakpoint-tablet","breakpoint-mobile","heatmap-types","device-types","id-site-hsr","is-active","desktop-preview-size","iframe-resolutions-values"])])):null!==(s=e.heatmapMetadata)&&void 0!==s&&s.nb_samples_device_all?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Nr,[Object(r["createVNode"])(u,null,{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("div",wr,Object(r["toDisplayString"])(e.noHeatmapScreenshotRecordedYetText),1)]})),_:1})])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Hr,[Object(r["createVNode"])(u,null,{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("div",Vr,Object(r["toDisplayString"])(e.translate(e.noDataMessageKey)),1)]})),_:1})]))])}var kr=Object(r["defineComponent"])({props:{idSiteHsr:{type:Number,required:!0},heatmap:{type:Object,required:!0},heatmapMetadata:{type:Object,required:!0},deviceTypes:{type:Array,required:!0},heatmapTypes:{type:Array,required:!0},offsetAccuracy:{type:Number,required:!0},heatmapPeriod:{type:String,required:!0},heatmapDate:{type:String,required:!0},isActive:Boolean,createdDate:{type:String,required:!0},editUrl:{type:String,required:!0},inlineHelp:{type:String,required:!0},includedCountries:{type:String,required:!0},desktopPreviewSize:{type:Number,required:!0},iframeResolutions:{type:Object,required:!0},noDataMessageKey:{type:String,required:!0},isMatomoJsWritable:{type:Boolean,required:!0}},components:{MatomoJsNotWritableAlert:Ba,ContentBlock:I["ContentBlock"],HeatmapVis:ve,EnrichedHeadline:I["EnrichedHeadline"]},computed:{noHeatmapScreenshotRecordedYetText:function(){return Object(I["translate"])("HeatmapSessionRecording_NoHeatmapScreenshotRecordedYet",this.heatmapMetadata.nb_samples_device_all,Object(I["translate"])("HeatmapSessionRecording_ScreenshotUrl"))}},created:function(){I["Matomo"].postEvent("hidePeriodSelector")}});kr.render=Er;var Rr=kr;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# SessionRecording.umd.min.js.map
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue")):"function"===typeof define&&define.amd?define(["CoreHome"],t):"object"===typeof exports?exports["MediaAnalytics"]=t(require("CoreHome"),require("vue")):e["MediaAnalytics"]=t(e["CoreHome"],e["Vue"])})("undefined"!==typeof self?self:this,(function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="plugins/MediaAnalytics/vue/dist/",r(r.s="fae3")}({"19dc":function(t,r){t.exports=e},"8bbf":function(e,r){e.exports=t},fae3:function(e,t,r){"use strict";if(r.r(t),r.d(t,"GettingStarted",(function(){return V})),"undefined"!==typeof window){var n=window.document.currentScript,c=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);c&&(r.p=c[1])}var o=r("8bbf"),i={style:{width:"600px"}},l=Object(o["createElementVNode"])("br",null,null,-1),a=Object(o["createElementVNode"])("br",null,null,-1),d=Object(o["createElementVNode"])("br",null,null,-1),u=Object(o["createElementVNode"])("br",null,null,-1),s={href:"https://developer.matomo.org/guides/media-analytics/setup",rel:"noreferrer noopener",target:"_blank"},p=Object(o["createTextVNode"])(". "),b={style:{width:"600px"}},f={key:0},j={key:1,class:"alert alert-warning"},m=Object(o["createElementVNode"])("br",null,null,-1),O=Object(o["createElementVNode"])("code",null,"chmod 0755 piwik.js",-1),y=[O],N=Object(o["createElementVNode"])("br",null,null,-1);function v(e,t,r,n,c,O){var v=Object(o["resolveDirective"])("select-on-focus");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",null,[Object(o["createElementVNode"])("p",i,[l,Object(o["createElementVNode"])("strong",null,Object(o["toDisplayString"])(e.translate("MediaAnalytics_NoMediaTrackedYet",'"'.concat(e.siteNameDecoded,'"')))+".",1),a,d,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("MediaAnalytics_NoMediaTrackedYetDescription"))+" ",1),u,Object(o["createElementVNode"])("a",s,Object(o["toDisplayString"])(e.translate("MediaAnalytics_NoMediaTrackedYetMoreInfo")),1),p]),Object(o["createElementVNode"])("p",b,Object(o["toDisplayString"])(e.translate("MediaAnalytics_NoMediaTrackedYetWillDisappear")),1),e.piwikJsWritable?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("br",f)),e.piwikJsWritable?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",j,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("MediaAnalytics_PiwikJsNotWritable1"))+" ",1),m,Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,y,512),[[v]]),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("MediaAnalytics_PiwikJsNotWritable2"))+" ",1),N,Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",null,Object(o["toDisplayString"])(e.trackerScriptCode),1)],512),[[v]])]))])}var k=r("19dc"),g=Object(o["defineComponent"])({props:{siteName:{type:String,required:!0},piwikJsWritable:Boolean,piwikUrl:String},directives:{SelectOnFocus:k["SelectOnFocus"]},computed:{trackerScriptCode:function(){var e="".concat(this.piwikUrl||"","plugins/MediaAnalytics/tracker.js"),t="/script>";return'<script type="text/javascript" src="'.concat(e,'"><').concat(t)},siteNameDecoded:function(){return k["Matomo"].helper.htmlDecode(this.siteName)}}});g.render=v;var V=g;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("Goals"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome","Goals",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["MultiChannelConversionAttribution"]=t(require("CoreHome"),require("Goals"),require("vue"),require("CorePluginsAdmin")):e["MultiChannelConversionAttribution"]=t(e["CoreHome"],e["Goals"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n,o){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/MultiChannelConversionAttribution/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"76d2":function(e,n){e.exports=t},"8bbf":function(e,t){e.exports=n},a5a2:function(e,t){e.exports=o},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ManageMultiattribution",(function(){return b})),n.d(t,"ReportAttribution",(function(){return x})),"undefined"!==typeof window){var o=window.document.currentScript,i=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a=n("8bbf"),l={class:"manageMultiAttribution"},r={name:"isEnabled"};function d(e,t,n,o,i,d){var s=Object(a["resolveComponent"])("Field");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",l,[Object(a["createElementVNode"])("div",r,[Object(a["createVNode"])(s,{uicontrol:"checkbox",name:"isEnabled",title:e.translate("MultiChannelConversionAttribution_Enabled"),modelValue:e.isEnabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.isEnabled=t}),introduction:e.translate("MultiChannelConversionAttribution_MultiChannelConversionAttribution"),"inline-help":e.translate("MultiChannelConversionAttribution_Introduction")},null,8,["title","modelValue","introduction","inline-help"])])])}var s=n("19dc"),u=n("76d2"),c=n("a5a2"),m=Object(a["defineComponent"])({props:{},components:{Field:c["Field"]},data:function(){return{isLoading:!1,isEnabled:null}},created:function(){var e=this,t=u["ManageGoalsStore"].idGoal.value;"number"===typeof t&&this.initGoalForm("Goals.updateGoal",t),this.isLoading=!1,this.reset(),s["Matomo"].on("Goals.cancelForm",(function(){return e.resetForm()})),s["Matomo"].on("Goals.beforeInitGoalForm",this.initGoalForm.bind(this)),s["Matomo"].on("Goals.beforeAddGoal",this.onSetAttribution.bind(this)),s["Matomo"].on("Goals.beforeUpdateGoal",this.onSetAttribution.bind(this))},methods:{reset:function(){this.isEnabled=!0},resetForm:function(){this.reset(),this.isLoading=!1},getGoalAttribution:s["AjaxHelper"].oneAtATime("MultiChannelConversionAttribution.getGoalAttribution"),initGoalForm:function(e,t){var n=this;this.resetForm(),t&&"Goals.addGoal"!==e&&(this.isLoading=!0,this.getGoalAttribution({idGoal:t}).then((function(e){n.isEnabled=!!e.isEnabled&&"0"!==e.isEnabled})).finally((function(){n.isLoading=!1})))},onSetAttribution:function(e){var t=e.options;null!==this.isEnabled&&(t.postParams=Object.assign(Object.assign({},t.postParams),{},{multiAttributionEnabled:this.isEnabled?1:0}))}}});m.render=d;var b=m,p={class:"MultiChannelConversionAttributionWidget"},h={key:0},f={key:1,class:"alert alert-info"},C={key:2,class:"row goalAndDaysPrior"},g={class:"col s12 m3"},v={name:"idgoal"},j={class:"col s12 m6"},O={name:"campaignDimensionCombination"},M={key:3,class:"row modelSelection"},y={class:"col s12 m3"},A={name:"model1"},E={class:"col s12 m3"},G={name:"model2"},V={class:"col s12 m3"},N={name:"model3"},D={class:"attributionReport",ref:"attributionReport"};function k(e,t,n,o,i,l){var r=Object(a["resolveComponent"])("EnrichedHeadline"),d=Object(a["resolveComponent"])("Field");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",p,[Object(a["createElementVNode"])("div",null,[e.isWidgetized?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("h2",h,[Object(a["createVNode"])(r,{"inline-help":e.reportHelp},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("MultiChannelConversionAttribution_MultiChannelConversionAttribution")),1)]})),_:1},8,["inline-help"])])),0===e.goals.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",f,Object(a["toDisplayString"])(e.translate(e.noGoalEnabledMessageKey)),1)):Object(a["createCommentVNode"])("",!0),e.goals.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",C,[Object(a["createElementVNode"])("div",g,[Object(a["createElementVNode"])("div",v,[Object(a["createVNode"])(d,{uicontrol:"select",name:"idgoal",disabled:e.goals.length<=1,"model-value":e.idGoal,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.idGoal=t,e.onReportChange()}),"full-width":!0,title:e.translate("General_Goal"),options:e.goals},null,8,["disabled","model-value","title","options"])])]),Object(a["createElementVNode"])("div",j,[Object(a["createElementVNode"])("div",O,[Object(a["createVNode"])(d,{uicontrol:"select",name:"campaignDimensionCombination","model-value":e.campaignDimensionCombination,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.campaignDimensionCombination=t,e.onReportChange()}),"full-width":!0,title:e.translate("MultiChannelConversionAttribution_CampaignDimensionCombinationTitleNew")+e.$sanitize(e.getEditURL),options:e.campaignDimensionCombinationOptions},null,8,["model-value","title","options"])])])])):Object(a["createCommentVNode"])("",!0),e.goals.length?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",M,[Object(a["createElementVNode"])("div",y,[Object(a["createElementVNode"])("div",A,[Object(a["createVNode"])(d,{uicontrol:"select",name:"model1","model-value":e.model1,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.model1=t,e.onReportChange(),e.modelChanged()}),"full-width":!0,title:e.translate("MultiChannelConversionAttribution_AttributionModelX",1),options:e.attributionModels},null,8,["model-value","title","options"])])]),Object(a["createElementVNode"])("div",E,[Object(a["createElementVNode"])("div",G,[Object(a["createVNode"])(d,{uicontrol:"select",name:"model2","model-value":e.model2,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.model2=t,e.onReportChange(),e.modelChanged()}),"full-width":!0,title:e.translate("MultiChannelConversionAttribution_AttributionModelX",2),options:e.attributionModelsCancelable},null,8,["model-value","title","options"])])]),Object(a["createElementVNode"])("div",V,[Object(a["createElementVNode"])("div",N,[Object(a["createVNode"])(d,{uicontrol:"select",name:"model3","model-value":e.model3,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.model3=t,e.onReportChange(),e.modelChanged()}),"full-width":!0,title:e.translate("MultiChannelConversionAttribution_AttributionModelX",3),options:e.attributionModelsCancelable},null,8,["model-value","title","options"])])])])):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("div",D,null,512)])}var w=window,S=w.$,q=Object(a["defineComponent"])({props:{isWidgetized:Boolean,settingsUrl:String,reportHtml:{type:String,required:!0},reportHelp:{type:String,required:!0},noGoalEnabledMessageKey:{type:String,required:!0},goals:{type:Array,required:!0},campaignDimensionCombinationOptions:{type:Array,required:!0},attributionModels:{type:Array,required:!0},attributionModelsCancelable:{type:Array,required:!0},firstGoal:[String,Number],defaultCampaignDimensionCombination:{type:String,required:!0},selectedModels:{type:Array,required:!0}},components:{EnrichedHeadline:s["EnrichedHeadline"],Field:c["Field"]},data:function(){return{idGoal:this.firstGoal,campaignDimensionCombination:this.defaultCampaignDimensionCombination,model1:this.selectedModels[0],model2:this.selectedModels[1],model3:this.selectedModels[2]}},mounted:function(){S(this.$refs.attributionReport).html(this.reportHtml);var e=S(this.$refs.attributionReport).find(".dataTable:first");if(e.length){var t=e.data("report");window.require("piwik/UI/DataTable").initNewDataTables(t);var n=e.data("uiControlObject");n.dataTableLoaded(this.reportHtml,n.workingDivId),this.modelChanged(),this.updateHash()}},methods:{onReportChange:function(){var e=S(this.$refs.attributionReport).find(".dataTable:first").data("uiControlObject");null!==e&&void 0!==e&&e.param&&(this.updateHash(),e.param.idGoal=this.idGoal,e.param.idCampaignDimensionCombination=this.campaignDimensionCombination,e.param.attributionModels="".concat(this.model1,",").concat(this.model2,",").concat(this.model3),e.reloadAjaxDataTable())},modelChanged:function(){var e=document.getElementById("inconsistentDataAlert");e&&("lastNonDirect"===this.model1||"lastNonDirect"===this.model2||"lastNonDirect"===this.model3?e.classList.remove("hide"):e.classList.add("hide"))},updateHash:function(){var e=Object.assign({},s["MatomoUrl"].hashParsed.value);delete e.idGoal,delete e.idCampaignDimensionCombination,delete e.attributionModel1,delete e.attributionModel2,delete e.attributionModel3,e.idGoal=this.idGoal,e.idCampaignDimensionCombination=this.campaignDimensionCombination,e.attributionModel1=this.model1,e.attributionModel2=this.model2,e.attributionModel3=this.model3,s["MatomoUrl"].updateHash(e)}},computed:{getEditURL:function(){return this.settingsUrl?Object(s["translate"])("MultiChannelConversionAttribution_CampaignCombinationEdit",'<a href="'.concat(this.settingsUrl,'" rel="noreferrer noopener" target="_blank" id="multi-channel-conversion-attribution-settings-edit-link">'),"</a>"):""}}});q.render=k;var x=q;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(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["SearchEngineKeywordsPerformance"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["SearchEngineKeywordsPerformance"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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/SearchEngineKeywordsPerformance/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,"AdminPage",(function(){return N})),n.d(t,"BingConfiguration",(function(){return qe})),n.d(t,"GoogleConfiguration",(function(){return Un})),n.d(t,"YandexConfiguration",(function(){return So})),n.d(t,"ConfigureConnection",(function(){return Go})),"undefined"!==typeof window){var r=window.document.currentScript,o=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}var c=n("8bbf"),a={class:"keywordproviders"},l=Object(c["createElementVNode"])("div",{class:"clear"},null,-1);function i(e,t,n,r,o,i){var s=Object(c["resolveComponent"])("Provider"),u=Object(c["resolveComponent"])("ContentBlock");return Object(c["openBlock"])(),Object(c["createBlock"])(u,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigurationDescription")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ProviderListDescription")),1),Object(c["createElementVNode"])("div",a,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.providers,(function(e){return Object(c["openBlock"])(),Object(c["createBlock"])(s,{key:e.id,provider:e},null,8,["provider"])})),128)),l])]})),_:1},8,["content-title"])}var s=n("19dc"),u=["title"],d=["src","alt"],b=["innerHTML"],m=["innerHTML"],O={key:0,class:"experimental"},j=["href"],p={key:0,class:"btn"},f={key:1,class:"btn"};function g(e,t,n,r,o,a){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{class:Object(c["normalizeClass"])({keywordprovider:!0,warning:e.hasWarning,configured:!e.hasWarning&&e.provider.is_configured})},[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.provider.logos,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n,class:Object(c["normalizeClass"])("logo ".concat(e.provider.logos.length>1?"double":"")),title:e.logoTooltip},[Object(c["createElementVNode"])("img",{src:t,alt:e.provider.name},null,8,d)],10,u)})),128)),Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.provider.name),1),Object(c["createElementVNode"])("p",{innerHTML:e.$sanitize(e.provider.description)},null,8,b),Object(c["createElementVNode"])("p",null,[Object(c["createElementVNode"])("em",{innerHTML:e.$sanitize(e.provider.note)},null,8,m)]),e.provider.is_experimental?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",O,"experimental")):Object(c["createCommentVNode"])("",!0),Object(c["createElementVNode"])("a",{href:e.configureUrl,class:"cta"},[e.provider.is_configured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("button",p,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ChangeConfiguration")),1)):(Object(c["openBlock"])(),Object(c["createElementBlock"])("button",f,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_SetupConfiguration")),1))],8,j)],2)}var y=Object(c["defineComponent"])({props:{provider:{type:Object,required:!0}},computed:{hasWarning:function(){var e=this.provider;return e.is_configured&&(0===Object.keys(e.configured_site_ids).length||Object.keys(e.problems.sites).length||Object.keys(e.problems.accounts).length)},logoTooltip:function(){var e=this.provider,t=e.is_configured&&0===Object.keys(e.configured_site_ids).length;return t?Object(s["translate"])("SearchEngineKeywordsPerformance_ConfigAvailableNoWebsiteConfigured"):e.is_configured?Object(s["translate"])("SearchEngineKeywordsPerformance_IntegrationConfigured"):Object(s["translate"])("SearchEngineKeywordsPerformance_IntegrationNotConfigured")},configureUrl:function(){return"?".concat(s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"configure".concat(this.provider.id)})))}}});y.render=g;var E=y,h=Object(c["defineComponent"])({props:{providers:{type:Array,required:!0}},components:{ContentBlock:s["ContentBlock"],Provider:E}});h.render=i;var N=h;function v(e,t){return C(e)||A(e,t)||V(e,t)||S()}function S(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function V(e,t){if(e){if("string"===typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function A(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function C(e){if(Array.isArray(e))return e}var w={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},B=["value"],D=["value"],_={class:"measurableList"},T=Object(c["createElementVNode"])("th",null,null,-1),P={key:0},K={colspan:"6"},x={key:0,class:"icon-error"},U={key:0,class:"icon-error"},M=["onSubmit"],I=["value"],L=["value"],F=["title"],G={key:1},H={colspan:"6",align:"right"},q={key:2,class:"configureMeasurableForm"},R={colspan:"2"},z={class:"bingAccountAndUrlToAdd"},Y={colspan:"3"},$={action:"",method:"post"},W=["value"],X=["value"],J=["value"],Q=["value"],Z={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},ee=["value"],te=["value"],ne={class:"accounts"},re=["innerHTML"],oe={key:0,class:"accounterror"},ce=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),ae={key:1},le={key:0,class:"accounterror"},ie=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),se={key:1},ue={key:0},de={class:"websites-list"},be=Object(c["createElementVNode"])("span",{class:"icon-success"},null,-1),me={key:1},Oe={class:"accounterror"},je=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),pe={key:2},fe={class:"websites-list"},ge=Object(c["createElementVNode"])("span",{class:"icon-error"},null,-1),ye={class:"cta"},Ee=["onSubmit"],he=["value"],Ne=["value"],ve={type:"submit",class:"btn"},Se={method:"POST",action:""},Ve=Object(c["createElementVNode"])("div",{class:"icon-add logo"},null,-1),ke=["innerHTML"],Ae={key:0,class:"accounterror"},Ce=Object(c["createElementVNode"])("br",null,null,-1),we=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Be=["value"],De={class:"cta"},_e={type:"submit",class:"btn"},Te=Object(c["createElementVNode"])("div",{class:"clear"},null,-1);function Pe(e,t,n,r,o,a){var l=Object(c["resolveComponent"])("ContentBlock"),i=Object(c["resolveComponent"])("Field"),s=Object(c["resolveDirective"])("content-table");return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",null,[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingConfigurationTitle")),1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingConfigurationDescription")),1)]})),_:1},8,["content-title"]),Object.keys(e.accounts).length>0?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:0,class:Object(c["normalizeClass"])("websiteconfiguration ".concat(Object.keys(e.configuredMeasurables).length?"configured":""))},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(c["createElementVNode"])("div",w,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,B),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,D)],512),Object(c["createElementVNode"])("div",null,[Object(c["withDirectives"])(Object(c["createElementVNode"])("table",_,[Object(c["createElementVNode"])("thead",null,[Object(c["createElementVNode"])("tr",null,[Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("General_Measurable")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Mobile_Account")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Goals_URL")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),T])]),Object(c["createElementVNode"])("tbody",null,[Object.keys(e.configuredMeasurables).length?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",P,[Object(c["createElementVNode"])("td",K,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_NoWebsiteConfigured")),1)])])),(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.configuredMeasurablesToDisplay,(function(t,n,r){return Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",{key:r,class:Object(c["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(c["createElementVNode"])("td",null,[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.sitesInfos[n].name)+" ",1),Object(c["createElementVNode"])("span",null,"("+Object(c["toDisplayString"])(e.sitesInfos[n].main_url)+")",1)]),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",x)),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(t.apiKeyDisplay),1)]),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",U)),Object(c["createTextVNode"])(Object(c["toDisplayString"])(t.url),1)]),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(t.createdByUser),1),Object(c["createElementVNode"])("td",null,[Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(t){return e.removeAccountConfig(n,t)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,I),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeBingSiteConfigNonce},null,8,L),t.isDeletionAllowed?(Object(c["openBlock"])(),Object(c["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,F)):Object(c["createCommentVNode"])("",!0)],40,M)])],2)})),128)),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",G,[Object(c["createElementVNode"])("td",H,[Object(c["createElementVNode"])("button",{class:"btn",onClick:t[0]||(t[0]=Object(c["withModifiers"])((function(t){return e.isAddingMeasurable=!0}),["prevent"]))},Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)])],512)),[[c["vShow"],!e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",q,[Object(c["createElementVNode"])("td",null,[Object(c["createVNode"])(i,{uicontrol:"site",modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.currentSiteToAdd=t}),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(c["createElementVNode"])("td",R,[Object(c["createElementVNode"])("div",z,[Object(c["createVNode"])(i,{uicontrol:"select",modelValue:e.bingAccountAndUrlToAdd,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.bingAccountAndUrlToAdd=t}),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(c["createElementVNode"])("td",Y,[Object(c["createElementVNode"])("form",$,[Object(c["createElementVNode"])("input",{type:"hidden",name:"bingSiteId",value:e.currentSiteToAdd.id},null,8,W),Object(c["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addBingSiteConfigNonce},null,8,X),Object(c["createElementVNode"])("input",{type:"hidden",name:"bingAccountAndUrl",value:e.bingAccountAndUrlToAdd},null,8,J),Object(c["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,Q)])])],512)),[[c["vShow"],e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0)])],512),[[s]])])]})),_:1},8,["content-title"])],2)):Object(c["createCommentVNode"])("",!0),Object(c["createElementVNode"])("div",{class:Object(c["normalizeClass"])("accountconfiguration ".concat(Object.keys(e.accounts).length>0?"configured":""))},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_ManageAPIKeys")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("div",Z,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ee),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,te)],512),Object(c["createElementVNode"])("div",ne,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.accountsToDisplay,(function(t){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:t.username,class:Object(c["normalizeClass"])("account ".concat(0===Object.keys(t.urls).length||"string"===typeof t.hasError?"invalid":""))},[Object(c["createElementVNode"])("div",{class:Object(c["normalizeClass"])("icon-".concat(0===Object.keys(t.urls).length||"string"===typeof t.hasError?"warning":"success"," logo"))},null,2),Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.getDisplayApiKey(t.apiKey)),1),Object(c["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,re),"string"===typeof t.hasError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",oe,[ce,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingAccountError",t.hasError)),1)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",ae,[0===Object.keys(t.urls).length?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",le,[ie,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",se,[Object.values(t.urls).some((function(e){return e}))?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",ue,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(c["createElementVNode"])("ul",de,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=v(e,2),n=t[1];return n})),(function(e,t){var n=v(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[be,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r),1)])})),128))])])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",me,[Object(c["createElementVNode"])("p",Oe,[je,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])])),Object.values(t.urls).some((function(e){return!e}))?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",pe,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(c["createElementVNode"])("ul",fe,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=v(e,2),n=t[1];return!n})),(function(e,t){var n=v(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[ge,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r),1)])})),128))])])):Object(c["createCommentVNode"])("",!0)]))])),Object(c["createElementVNode"])("div",ye,[Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(n){return e.removeAccount(t,n)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"remove",value:t.apiKey},null,8,he),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeBingAccountNonce},null,8,Ne),Object(c["createElementVNode"])("button",ve,Object(c["toDisplayString"])(e.translate("General_Remove")),1)],40,Ee)])],2)})),128)),Object(c["createElementVNode"])("div",{class:Object(c["normalizeClass"])("account add ".concat(e.hasApiKeyError?"invalid":""))},[Object(c["createElementVNode"])("form",Se,[Ve,Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddAPIKey")),1),Object(c["createElementVNode"])("span",{innerHTML:e.$sanitize(e.bingApiKeyInstructionText)},null,8,ke),e.hasApiKeyError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Ae,[Ce,we,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingAccountError",e.error)),1)])):Object(c["createCommentVNode"])("",!0),Object(c["createVNode"])(i,{uicontrol:"text","full-width":!0,name:"apikey",modelValue:e.apiKeyToAdd,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.apiKeyToAdd=t}),title:e.translate("SearchEngineKeywordsPerformance_APIKey")},null,8,["modelValue","title"]),Object(c["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,Be),Object(c["createElementVNode"])("div",De,[Object(c["createElementVNode"])("button",_e,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddAPIKey")),1)])])],2),Te])]})),_:1},8,["content-title"])],2)])}var Ke=n("a5a2");
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */function xe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(e.substr(0,5),"*****").concat(e.substr(e.length-5,5))}function Ue(e,t){return Ge(e)||Fe(e,t)||Ie(e,t)||Me()}function Me(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){if(e){if("string"===typeof e)return Le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Le(e,t):void 0}}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function Ge(e){if(Array.isArray(e))return e}var He=Object(c["defineComponent"])({props:{configuredMeasurables:{type:Object,required:!0},accounts:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},error:String,apikey:String,formNonce:String,addBingSiteConfigNonce:String,removeBingSiteConfigNonce:String,removeBingAccountNonce:String,countOfAccountsWithAccess:Number,userIsSuperUser:String},data:function(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,bingAccountAndUrlToAdd:null,apiKeyToAdd:this.apikey||""}},components:{ContentBlock:s["ContentBlock"],Field:Ke["Field"]},directives:{ContentTable:s["ContentTable"]},methods:{removeAccountConfig:function(e,t){var n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes:function(){t.target.submit()}})},getDisplayApiKey:xe,removeAccount:function(e,t){this.removeAccountName=this.getDisplayApiKey(e.apiKey),s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes:function(){t.target.submit()}})}},computed:{hasApiKeyError:function(){return"undefined"!==typeof this.error&&null!==this.error},configuredMeasurablesToDisplay:function(){var e=this,t=Object.entries(this.configuredMeasurables);return Object.fromEntries(t.filter((function(t){var n=Ue(t,2),r=n[1],o=r.bingSiteUrl.split("##"),c=Ue(o,1),a=c[0];return!!e.accounts[a]})).map((function(t){var n=Ue(t,2),r=n[0],o=n[1],c=o.bingSiteUrl.split("##"),a=Ue(c,2),l=a[0],i=a[1],s=e.accounts[l].apiKey;return[r,Object.assign(Object.assign({},o),{},{account:l,url:i,apiKeyDisplay:e.getDisplayApiKey(s)})]})))},bingApiKeyInstructionText:function(){var e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-bing-and-yahoo-search-keywords-into-matomo/");return Object(s["translate"])("SearchEngineKeywordsPerformance_BingAPIKeyInstruction",'<a href="https://www.bing.com/webmasters" target="_new" rel="noreferrer noopener">',"</a>",'<a href="'.concat(e,'" target="_blank" rel="noreferrer noopener">'),"</a>")},accountsToDisplay:function(){var e=Object.entries(this.accounts),t=e.filter((function(e){var t=Ue(e,2),n=t[1];return n.hasAccess}));return Object.fromEntries(t)}}});He.render=Pe;var qe=He;function Re(e,t){return Xe(e)||We(e,t)||Ye(e,t)||ze()}function ze(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ye(e,t){if(e){if("string"===typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$e(e,t):void 0}}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function We(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function Xe(e){if(Array.isArray(e))return e}var Je={key:0},Qe={class:"alert alert-warning"},Ze={key:1},et={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},tt=["value"],nt=["value"],rt={class:"measurableList"},ot=Object(c["createElementVNode"])("th",null,null,-1),ct={key:0},at={colspan:"7"},lt=["innerHTML"],it={key:0,class:"icon-error"},st={key:0,class:"icon-error"},ut=Object(c["createElementVNode"])("br",null,null,-1),dt=["title"],bt=Object(c["createElementVNode"])("span",{class:"icon-info"},null,-1),mt=["title"],Ot=Object(c["createElementVNode"])("span",{class:"icon-info"},null,-1),jt=["onSubmit"],pt=["value"],ft=["value"],gt=["title"],yt={key:1,class:"configureMeasurableForm"},Et={class:"account-select"},ht={colspan:"4"},Nt={action:"",method:"post"},vt=["value"],St=["value"],Vt=["value"],kt=["value"],At=["value"],Ct={key:0},wt={key:2,class:"oauthconfiguration"},Bt={class:"section-heading"},Dt={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},_t=["value"],Tt=["value"],Pt={class:"oauthconfigoptions"},Kt={key:0},xt={key:1},Ut={key:2},Mt={key:0},It=Object(c["createElementVNode"])("br",null,null,-1),Lt={class:"accounts"},Ft={class:"logo"},Gt=["src"],Ht=["innerHTML"],qt={key:0},Rt={class:"accounterror"},zt=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Yt={key:1},$t={key:0},Wt={class:"accounterror"},Xt=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Jt={key:1},Qt={key:0},Zt={class:"websites-list"},en=Object(c["createElementVNode"])("span",{class:"icon-success"},null,-1),tn={key:1,class:"accounterror"},nn=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),rn={key:2},on={class:"websites-list"},cn=Object(c["createElementVNode"])("span",{class:"icon-error"},null,-1),an={class:"cta"},ln=["onSubmit"],sn=["value"],un=["value"],dn={type:"submit",class:"btn"},bn={class:"account add"},mn=Object(c["createElementVNode"])("div",{class:"icon-add logo"},null,-1),On=["innerHTML"],jn=["innerHTML"],pn=["innerHTML"],fn={class:"cta"},gn=["action"],yn=["value"],En={type:"submit",class:"btn"},hn=Object(c["createElementVNode"])("div",{class:"clear"},null,-1),Nn={key:3,class:"clientconfiguration"},vn={class:"section-heading"},Sn=Object(c["createElementVNode"])("br",null,null,-1),Vn=["action"],kn=["value"],An={type:"submit",class:"btn"},Cn={key:4};function wn(e,t,n,r,o,a){var l=Object(c["resolveComponent"])("Field"),i=Object(c["resolveComponent"])("Notification"),s=Object(c["resolveComponent"])("ContentBlock"),u=Object(c["resolveDirective"])("content-table");return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",null,[Object(c["createVNode"])(s,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(c["withCtx"])((function(){return[e.isClientConfigured||!e.isClientConfigurable||e.userIsSuperUser?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Je,[Object(c["createElementVNode"])("div",Qe,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GooglePendingConfigurationErrorMessage")),1)])),e.isClientConfigured&&e.isOAuthConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Ze,[Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(c["createElementVNode"])("div",et,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,tt),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,nt)],512),Object(c["withDirectives"])(Object(c["createElementVNode"])("table",rt,[Object(c["createElementVNode"])("thead",null,[Object(c["createElementVNode"])("tr",null,[Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("General_Measurable")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_EnabledSearchTypes")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Mobile_Account")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Goals_URL")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),ot])]),Object(c["createElementVNode"])("tbody",null,[0===Object.keys(e.configuredMeasurablesToDisplay).length?(Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",ct,[Object(c["createElementVNode"])("td",at,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_NoWebsiteConfigured")),1)])])):Object(c["createCommentVNode"])("",!0),(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.configuredMeasurablesToDisplay,(function(t,n,r){return Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",{key:r,class:Object(c["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(c["createElementVNode"])("td",{innerHTML:e.$sanitize(e.sitesInfos[n].name)},null,8,lt),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(t.googleWebKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeWeb"):"")+" "+Object(c["toDisplayString"])(t.googleImageKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeImage"):"")+" "+Object(c["toDisplayString"])(t.googleVideoKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeVideo"):"")+" "+Object(c["toDisplayString"])(t.googleNewsKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeNews"):""),1),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",it)),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.accounts[t.account].name),1)]),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",st)),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(t.url.replaceAll("sc-domain:",""))+" ",1),ut,/^sc-domain:/.test(t.url)?(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",{key:1,class:"property-type",title:e.translate("SearchEngineKeywordsPerformance_DomainPropertyInfo")},[bt,Object(c["createTextVNode"])(" ("+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_DomainProperty"))+") ",1)],8,dt)):/^http/.test(t.url)?(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",{key:2,class:"property-type",title:e.translate("SearchEngineKeywordsPerformance_URLPrefixPropertyInfo")},[Ot,Object(c["createTextVNode"])(" ("+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_URLPrefixProperty"))+") ",1)],8,mt)):Object(c["createCommentVNode"])("",!0)]),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(t.createdByUser),1),Object(c["createElementVNode"])("td",null,[Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(t){return e.removeAccountConfig(n,t)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,pt),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeGoogleSiteConfigNonce},null,8,ft),t.isDeletionAllowed?(Object(c["openBlock"])(),Object(c["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,gt)):Object(c["createCommentVNode"])("",!0)],40,jt)])],2)})),128)),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",yt,[Object(c["createElementVNode"])("td",null,[Object(c["createVNode"])(l,{uicontrol:"site","full-width":!0,modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.currentSiteToAdd=t}),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(c["createElementVNode"])("td",null,[Object(c["createVNode"])(l,{uicontrol:"checkbox",modelValue:e.googleTypesToAdd,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.googleTypesToAdd=t}),"var-type":"array",title:"keyword types to fetch","full-width":!0,options:e.googleTypeOptions},null,8,["modelValue","options"])]),Object(c["createElementVNode"])("td",null,[Object(c["createElementVNode"])("div",Et,[Object(c["createVNode"])(l,{uicontrol:"select",modelValue:e.googleAccountAndUrlToAdd,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.googleAccountAndUrlToAdd=t}),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),"full-width":!0,options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(c["createElementVNode"])("td",ht,[Object(c["createElementVNode"])("form",Nt,[Object(c["createElementVNode"])("input",{type:"hidden",name:"googleSiteId",value:e.currentSiteToAdd.id},null,8,vt),Object(c["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addGoogleSiteConfigNonce},null,8,St),Object(c["createElementVNode"])("input",{type:"hidden",name:"googleAccountAndUrl",value:e.googleAccountAndUrlToAdd},null,8,Vt),Object(c["createElementVNode"])("input",{type:"hidden",name:"googleTypes",value:e.googleTypesToAdd.length?e.googleTypesToAdd:"web"},null,8,kt),Object(c["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,At)])])],512)),[[c["vShow"],e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0)])],512),[[u]]),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Ct,[Object(c["createElementVNode"])("button",{id:"addWebsiteBtn",class:"btn",onClick:t[3]||(t[3]=function(t){return e.isAddingMeasurable=!0})},Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)],512)),[[c["vShow"],!e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0)])):Object(c["createCommentVNode"])("",!0),e.isClientConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",wt,[Object(c["createElementVNode"])("h3",Bt,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectGoogleAccounts")),1),Object(c["createElementVNode"])("div",Dt,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,_t),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Tt)],512),Object(c["createElementVNode"])("div",Pt,[e.isOAuthConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Kt,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts",e.countOfAccountsWithAccess)),1)):(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",xt,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectFirstAccount")),1)),e.hasOAuthError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Ut,[Object(c["createVNode"])(i,{context:"error",type:"transient"},{default:Object(c["withCtx"])((function(){return[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthError"))+" ",1),e.hasOAuthError.length>5?(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",Mt,[It,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.hasOAuthError),1)])):Object(c["createCommentVNode"])("",!0)]})),_:1})])):Object(c["createCommentVNode"])("",!0),Object(c["createElementVNode"])("div",Lt,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.accountsToDisplay,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n,class:"account"},[Object(c["createElementVNode"])("div",Ft,[Object(c["createElementVNode"])("img",{src:t.picture},null,8,Gt)]),Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(t.name),1),Object(c["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,Ht),"string"===typeof t.hasError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",qt,[Object(c["createElementVNode"])("p",Rt,[zt,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountConnectionValidationError"))+" "+Object(c["toDisplayString"])(t.hasError),1)]),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ReAddAccountIfPermanentError")),1)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Yt,[0===Object.keys(t.urls).length?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",$t,[Object(c["createElementVNode"])("p",Wt,[Xt,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Jt,[e.accountHasAvailableSites(t)?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Qt,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(c["createElementVNode"])("ul",Zt,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=Re(e,2),n=t[1];return"siteUnverifiedUser"!==n})),(function(e,t){var n=Re(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[en,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r.replaceAll("sc-domain:","")),1)])})),128))])])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",tn,[nn,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])),-1!==Object.values(t.urls).indexOf("siteUnverifiedUser")?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",rn,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(c["createElementVNode"])("ul",on,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=Re(e,2),n=t[1];return"siteUnverifiedUser"===n})),(function(e,t){var n=Re(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[cn,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r.replaceAll("sc-domain:","")),1)])})),128))])])):Object(c["createCommentVNode"])("",!0)]))])),Object(c["createElementVNode"])("div",an,[Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(n){return e.removeAccount(t,n)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"remove",value:n},null,8,sn),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeGoogleAccountNonce},null,8,un),Object(c["createElementVNode"])("button",dn,Object(c["toDisplayString"])(e.translate("General_Remove")),1)],40,ln)])])})),128)),Object(c["createElementVNode"])("div",bn,[mn,Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccount")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountDescription","Google")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_RequiredAccessTypes")),1),Object(c["createElementVNode"])("ul",null,[Object(c["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeSearchConsoleData"))},null,8,On),Object(c["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeProfileInfo"))},null,8,jn),Object(c["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeOfflineAccess"))},null,8,pn)]),Object(c["createElementVNode"])("div",fn,[Object(c["createElementVNode"])("form",{method:"post",action:e.forwardToAuthUrl,id:"clientauthform"},[Object(c["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.authNonce},null,8,yn),Object(c["createElementVNode"])("button",En,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_StartOAuth")),1)],8,gn)])]),hn])])])):Object(c["createCommentVNode"])("",!0),e.isClientConfigurable&&e.isClientConfigured&&e.userIsSuperUser?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Nn,[Object(c["createElementVNode"])("h3",vn,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthClientConfig")),1),Object(c["createElementVNode"])("p",null,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientId"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.clientId),1)]),Object(c["createElementVNode"])("p",null,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientSecret"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.clientSecret),1)]),Sn,Object(c["createElementVNode"])("form",{action:e.removeConfigUrl,method:"POST",enctype:"multipart/form-data",id:"removeConfigForm"},[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_DeleteUploadedClientConfig"))+":",1),Object(c["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,kn),Object(c["createElementVNode"])("button",An,Object(c["toDisplayString"])(e.translate("General_Remove")),1)],8,Vn)])):Object(c["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Cn,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.componentExtensions,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n},[(Object(c["openBlock"])(),Object(c["createBlock"])(Object(c["resolveDynamicComponent"])(t),{"manual-config-nonce":e.configConnectProps.manualConfigNonce,"base-domain":e.configConnectProps.baseDomain,"base-url":e.configConnectProps.baseUrl,"manual-action-url":e.configConnectProps.manualActionUrl,"primary-text":e.configConnectProps.primaryText,"radio-options":e.configConnectProps.radioOptions,"manual-config-text":e.configConnectProps.manualConfigText,"connect-accounts-url":e.configConnectProps.connectAccountsUrl,"connect-accounts-btn-text":e.configConnectProps.connectAccountsBtnText,"auth-url":e.configConnectProps.authUrl,"unlink-url":e.configConnectProps.unlinkUrl,strategy:e.configConnectProps.strategy,"connected-with":e.configConnectProps.connectedWith},null,8,["manual-config-nonce","base-domain","base-url","manual-action-url","primary-text","radio-options","manual-config-text","connect-accounts-url","connect-accounts-btn-text","auth-url","unlink-url","strategy","connected-with"]))])})),128))])):Object(c["createCommentVNode"])("",!0)]})),_:1},8,["content-title"])])}function Bn(e,t){return Kn(e)||Pn(e,t)||_n(e,t)||Dn()}function Dn(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _n(e,t){if(e){if("string"===typeof e)return Tn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(e,t):void 0}}function Tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Pn(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function Kn(e){if(Array.isArray(e))return e}var xn=Object(c["defineComponent"])({props:{configuredMeasurables:{type:Object,required:!0},isClientConfigured:Boolean,isClientConfigurable:Boolean,isOAuthConfigured:Boolean,clientId:String,clientSecret:String,accounts:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},hasOAuthError:[String,Boolean],authNonce:{type:String,required:!0},formNonce:String,addGoogleSiteConfigNonce:String,removeGoogleSiteConfigNonce:String,removeGoogleAccountNonce:String,countOfAccountsWithAccess:Number,userIsSuperUser:String,extensions:Array,removeConfigUrl:String,configureConnectionProps:{type:Object,required:!0}},components:{ContentBlock:s["ContentBlock"],Field:Ke["Field"],Notification:s["Notification"]},directives:{ContentTable:s["ContentTable"]},data:function(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,googleAccountAndUrlToAdd:null,googleTypesToAdd:["web"],clientFile:null,clientText:""}},methods:{removeAccountConfig:function(e,t){var n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes:function(){t.target.submit()}})},removeAccount:function(e,t){this.removeAccountName=e.name,s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes:function(){t.target.submit()}})},accountHasAvailableSites:function(e){var t=["siteOwner","siteFullUser","siteRestrictedUser"];return Object.values(e.urls).some((function(e){return-1!==t.indexOf(e)}))}},computed:{configuredMeasurablesToDisplay:function(){var e=this,t=Object.entries(this.configuredMeasurables);return Object.fromEntries(t.filter((function(t){var n=Bn(t,2),r=n[1],o=r.googleSearchConsoleUrl.split("##"),c=Bn(o,1),a=c[0];return!!e.accounts[a]})).map((function(t){var n=Bn(t,2),r=n[0],o=n[1],c=o.googleSearchConsoleUrl.split("##"),a=Bn(c,2),l=a[0],i=a[1],s=e.accounts[l].apiKey;return[r,Object.assign(Object.assign({},o),{},{account:l,url:i,apiKeyDisplay:xe(s)})]})))},accountsToDisplay:function(){var e=Object.entries(this.accounts),t=e.filter((function(e){var t=Bn(e,2),n=t[1];return n.hasAccess}));return Object.fromEntries(t)},googleTypeOptions:function(){return{web:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeWeb"),image:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeImage"),video:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeVideo"),news:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeNews")}},forwardToAuthUrl:function(){return"?".concat(s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"forwardToAuth"})))},visitOAuthHowTo:function(){var e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-oauth-client-config");return Object(s["translate"])("SearchEngineKeywordsPerformance_VisitOAuthHowTo",'<a target="_blank" href="'.concat(e,'" rel="noreferrer noopener">'),"</a>","Google")},componentExtensions:function(){var e=this.extensions;return Object(c["markRaw"])(e.map((function(e){return Object(s["useExternalPluginComponent"])(e.plugin,e.component)})))},configConnectProps:function(){return this.configureConnectionProps}}});xn.render=wn;var Un=xn;function Mn(e,t){return Hn(e)||Gn(e,t)||Ln(e,t)||In()}function In(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ln(e,t){if(e){if("string"===typeof e)return Fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fn(e,t):void 0}}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gn(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function Hn(e){if(Array.isArray(e))return e}var qn={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},Rn=["value"],zn=["value"],Yn={class:"measurableList"},$n=Object(c["createElementVNode"])("th",null,null,-1),Wn=["innerHTML"],Xn={key:0,class:"icon-error"},Jn={key:0,class:"icon-error"},Qn=["onSubmit"],Zn=["value"],er=["value"],tr=["title"],nr={key:0},rr={colspan:"6",align:"right"},or={key:1,class:"configureMeasurableForm"},cr={colspan:"2"},ar={class:"account-select"},lr={colspan:"3"},ir={action:"",method:"post"},sr=["value"],ur=["value"],dr=["value"],br=["value"],mr={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},Or=["value"],jr=["value"],pr={class:"oauthconfigoptions"},fr={key:0},gr={key:1},yr={key:2},Er={key:0},hr=Object(c["createElementVNode"])("br",null,null,-1),Nr={class:"accounts"},vr={class:"logo"},Sr=["src"],Vr=["innerHTML"],kr={key:0},Ar={class:"accounterror"},Cr=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),wr={key:1},Br={key:0,class:"accounterror"},Dr=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),_r={key:1},Tr={key:0},Pr={class:"websites-list"},Kr=Object(c["createElementVNode"])("span",{class:"icon-success"},null,-1),xr={key:1,class:"accounterror"},Ur=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Mr={key:2},Ir={class:"websites-list"},Lr=Object(c["createElementVNode"])("span",{class:"icon-error"},null,-1),Fr={key:2,class:"accounterror"},Gr=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Hr={key:3,class:"accounterror"},qr=Object(c["createElementVNode"])("span",{class:"icon-warning"},null,-1),Rr=["innerHTML"],zr=["innerHTML"],Yr={class:"cta"},$r=["action"],Wr=["value"],Xr={type:"submit",class:"btn"},Jr=["onSubmit"],Qr=["value"],Zr=["value"],eo={type:"submit",class:"btn"},to={class:"account add"},no=Object(c["createElementVNode"])("div",{class:"icon-add logo"},null,-1),ro={class:"cta"},oo=["action"],co=["value"],ao={type:"submit",class:"btn"},lo=Object(c["createElementVNode"])("div",{class:"clear"},null,-1),io={key:3,class:"clientconfighelp"},so=["innerHTML"],uo=Object(c["createElementVNode"])("br",null,null,-1),bo=Object(c["createElementVNode"])("br",null,null,-1),mo={method:"post",action:"",id:"clientconfigform"},Oo=["value"],jo={type:"submit",class:"btn"};function po(e,t,n,r,o,a){var l=Object(c["resolveComponent"])("ContentBlock"),i=Object(c["resolveComponent"])("Field"),s=Object(c["resolveComponent"])("Notification"),u=Object(c["resolveDirective"])("content-table");return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",null,[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexConfigurationTitle")),1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexConfigurationDescription")),1)]})),_:1},8,["content-title"]),e.isClientConfigured&&e.isOAuthConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:0,class:Object(c["normalizeClass"])(Object.keys(e.configuredMeasurables).length?"configured":"")},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")},{default:Object(c["withCtx"])((function(){var n;return[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(c["createElementVNode"])("div",qn,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Rn),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,zn)],512),Object(c["withDirectives"])(Object(c["createElementVNode"])("table",Yn,[Object(c["createElementVNode"])("thead",null,[Object(c["createElementVNode"])("tr",null,[Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("General_Measurable")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Mobile_Account")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("Goals_URL")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(c["createElementVNode"])("th",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),$n])]),Object(c["createElementVNode"])("tbody",null,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.configuredMeasurablesToDisplay,(function(t,n,r){return Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",{key:r,class:Object(c["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(c["createElementVNode"])("td",{innerHTML:e.$sanitize(e.sitesInfos[n].name)},null,8,Wn),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",Xn)),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.accounts[t.account].name),1)]),Object(c["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(c["createCommentVNode"])("",!0):(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",Jn)),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(t.hostUrl||t.host),1)]),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(c["createElementVNode"])("td",null,Object(c["toDisplayString"])(t.createdByUser),1),Object(c["createElementVNode"])("td",null,[Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(t){return e.removeAccountConfig(n,t)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,Zn),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeYandexSiteConfigNonce},null,8,er),t.isDeletionAllowed?(Object(c["openBlock"])(),Object(c["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,tr)):Object(c["createCommentVNode"])("",!0)],40,Qn)])],2)})),128)),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",nr,[Object(c["createElementVNode"])("td",rr,[Object(c["createElementVNode"])("button",{class:"btn",onClick:t[0]||(t[0]=function(t){return e.isAddingMeasurable=!0})},Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)])],512)),[[c["vShow"],!e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0),e.countOfAccountsWithAccess?Object(c["withDirectives"])((Object(c["openBlock"])(),Object(c["createElementBlock"])("tr",or,[Object(c["createElementVNode"])("td",null,[Object(c["createVNode"])(i,{uicontrol:"site","full-width":!0,modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.currentSiteToAdd=t}),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(c["createElementVNode"])("td",cr,[Object(c["createElementVNode"])("div",ar,[Object(c["createVNode"])(i,{uicontrol:"select",modelValue:e.yandexAccountAndHostIdToAdd,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.yandexAccountAndHostIdToAdd=t}),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),"full-width":!0,options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(c["createElementVNode"])("td",lr,[Object(c["createElementVNode"])("form",ir,[Object(c["createElementVNode"])("input",{type:"hidden",name:"yandexSiteId",value:null===(n=e.currentSiteToAdd)||void 0===n?void 0:n.id},null,8,sr),Object(c["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addYandexSiteConfigNonce},null,8,ur),Object(c["createElementVNode"])("input",{type:"hidden",name:"yandexAccountAndHostId",value:e.yandexAccountAndHostIdToAdd},null,8,dr),Object(c["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,br)])])],512)),[[c["vShow"],e.isAddingMeasurable]]):Object(c["createCommentVNode"])("",!0)])],512),[[u]])]})),_:1},8,["content-title"])],2)):Object(c["createCommentVNode"])("",!0),e.isClientConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:1,class:Object(c["normalizeClass"])("oauthconfiguration ".concat(e.isOAuthConfigured?"configured":""," yandex"))},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConnectYandexAccounts")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("div",mr,[Object(c["createElementVNode"])("h2",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(c["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Or),Object(c["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,jr)],512),Object(c["createElementVNode"])("div",pr,[e.isOAuthConfigured?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",fr,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts",e.countOfAccountsWithAccess)),1)):(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",gr,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectFirstAccount")),1)),e.hasOAuthError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",yr,[Object(c["createVNode"])(s,{context:"error"},{default:Object(c["withCtx"])((function(){return[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthError"))+" ",1),"string"===typeof e.hasOAuthError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("span",Er,[hr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.hasOAuthError),1)])):Object(c["createCommentVNode"])("",!0)]})),_:1})])):Object(c["createCommentVNode"])("",!0),Object(c["createElementVNode"])("div",Nr,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(e.accountsToDisplay,(function(t,n){return Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:n,class:Object(c["normalizeClass"])("account ".concat(0===Object.keys(t.urls).length||"string"===typeof t.hasError?"invalid":""))},[Object(c["createElementVNode"])("div",vr,[Object(c["createElementVNode"])("img",{src:t.picture},null,8,Sr)]),Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(t.name),1),Object(c["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,Vr),"string"===typeof t.hasError?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",kr,[Object(c["createElementVNode"])("p",Ar,[Cr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountConnectionValidationError"))+" "+Object(c["toDisplayString"])(t.hasError),1)]),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ReAuthenticateIfPermanentError")),1)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",wr,[0===Object.keys(t.urls).length?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Br,[Dr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",_r,[Object.values(t.urls).some((function(e){return e.verified}))?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Tr,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(c["createElementVNode"])("ul",Pr,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=Mn(e,2),n=t[1];return n.verified})),(function(e,t){var n=Mn(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[Kr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r),1)])})),128))])])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",xr,[Ur,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])),Object.values(t.urls).some((function(e){return!e.verified}))?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",Mr,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(c["createElementVNode"])("ul",Ir,[(Object(c["openBlock"])(!0),Object(c["createElementBlock"])(c["Fragment"],null,Object(c["renderList"])(Object.entries(t.urls).filter((function(e){var t=Mn(e,2),n=t[1];return!n.verified})),(function(e,t){var n=Mn(e,1),r=n[0];return Object(c["openBlock"])(),Object(c["createElementBlock"])("li",{key:t},[Lr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(r),1)])})),128))])])):Object(c["createCommentVNode"])("",!0)]))])),t.authDaysAgo>=180?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Fr,[Gr,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthAccessTimedOut")),1)])):t.authDaysAgo>=150?(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",Hr,[qr,Object(c["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_OAuthAccessWillTimeOutSoon",180-t.authDaysAgo))},null,8,Rr)])):(Object(c["openBlock"])(),Object(c["createElementBlock"])("p",{key:4,innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_OAuthAccessWillTimeOut",180,180-t.authDaysAgo))},null,8,zr)),Object(c["createElementVNode"])("div",Yr,[Object(c["createElementVNode"])("form",{method:"post",action:e.forwardToYandexAuthUrl},[Object(c["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.auth_nonce},null,8,Wr),Object(c["createElementVNode"])("button",Xr,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_Reauthenticate")),1)],8,$r),Object(c["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(c["withModifiers"])((function(n){return e.removeAccount(t,n)}),["prevent"])},[Object(c["createElementVNode"])("input",{type:"hidden",name:"remove",value:n},null,8,Qr),Object(c["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeYandexAccountNonce},null,8,Zr),Object(c["createElementVNode"])("button",eo,Object(c["toDisplayString"])(e.translate("General_Remove")),1)],40,Jr)])],2)})),128)),Object(c["createElementVNode"])("div",to,[no,Object(c["createElementVNode"])("h3",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccount")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountDescription","Yandex")),1),Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountYandex","180")),1),Object(c["createElementVNode"])("div",ro,[Object(c["createElementVNode"])("form",{method:"post",action:e.forwardToYandexAuthUrl,id:"clientauthform"},[Object(c["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.auth_nonce},null,8,co),Object(c["createElementVNode"])("button",ao,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_StartOAuth")),1)],8,oo)])]),lo])])]})),_:1},8,["content-title"])],2)):Object(c["createCommentVNode"])("",!0),e.isClientConfigured&&e.userIsSuperUser?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:2,class:Object(c["normalizeClass"])("clientconfiguration ".concat(e.isClientConfigured?"configured":""))},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_OAuthClientConfig")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("p",null,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientId"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.clientId),1)]),Object(c["createElementVNode"])("p",null,[Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientSecret"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.clientSecret),1)])]})),_:1},8,["content-title"])],2)):Object(c["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",io,[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_HowToGetOAuthClientConfig")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("p",{innerHTML:e.visitOAuthHowTo},null,8,so),Object(c["createElementVNode"])("p",null,[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthExampleText"))+" ",1),uo,Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexFieldUrlToAppSite"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.baseDomain)+" ",1),bo,Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexFieldCallbackUri"))+":",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.baseDomainUrl)+"?module=SearchEngineKeywordsPerformance&action=processYandexAuthCode ",1)])]})),_:1},8,["content-title"])])):Object(c["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(c["openBlock"])(),Object(c["createElementBlock"])("div",{key:4,class:Object(c["normalizeClass"])(e.isClientConfigured?"":"clientconfiguration")},[Object(c["createVNode"])(l,{"content-title":e.translate("SearchEngineKeywordsPerformance_SetUpOAuthClientConfig")},{default:Object(c["withCtx"])((function(){return[Object(c["createElementVNode"])("form",mo,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ProvideYandexClientConfig")),1),Object(c["createVNode"])(i,{uicontrol:"text",name:"clientid",modelValue:e.clientIdToUse,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.clientIdToUse=t}),title:e.translate("SearchEngineKeywordsPerformance_ClientId")},null,8,["modelValue","title"]),Object(c["createVNode"])(i,{uicontrol:"text",name:"clientsecret",modelValue:e.clientSecretToUse,"onUpdate:modelValue":t[4]||(t[4]=function(t){return e.clientSecretToUse=t}),title:e.translate("SearchEngineKeywordsPerformance_ClientSecret")},null,8,["modelValue","title"]),Object(c["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,Oo),Object(c["createElementVNode"])("button",jo,Object(c["toDisplayString"])(e.translate("General_Save")),1)])]})),_:1},8,["content-title"])],2)):Object(c["createCommentVNode"])("",!0)])}function fo(e,t){return No(e)||ho(e,t)||yo(e,t)||go()}function go(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function yo(e,t){if(e){if("string"===typeof e)return Eo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eo(e,t):void 0}}function Eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ho(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(c.push(r.value),t&&c.length===t)break}catch(i){l=!0,o=i}finally{try{a||null==n["return"]||n["return"]()}finally{if(l)throw o}}return c}}function No(e){if(Array.isArray(e))return e}var vo=Object(c["defineComponent"])({props:{isClientConfigured:Boolean,isClientConfigurable:Boolean,isOAuthConfigured:Boolean,clientId:String,clientSecret:String,configuredMeasurables:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},hasOAuthError:[String,Boolean],accounts:{type:Object,required:!0},auth_nonce:{type:String,required:!0},formNonce:{type:String,required:!0},addYandexSiteConfigNonce:{type:String,required:!0},removeYandexSiteConfigNonce:{type:String,required:!0},removeYandexAccountNonce:{type:String,required:!0},countOfAccountsWithAccess:Number,userIsSuperUser:String,baseDomain:String,baseDomainUrl:String},components:{ContentBlock:s["ContentBlock"],Field:Ke["Field"],Notification:s["Notification"]},directives:{ContentTable:s["ContentTable"]},data:function(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,yandexAccountAndHostIdToAdd:null,clientIdToUse:"",clientSecretToUse:""}},methods:{removeAccountConfig:function(e,t){var n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes:function(){t.target.submit()}})},removeAccount:function(e,t){this.removeAccountName=e.name,s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes:function(){t.target.submit()}})}},computed:{configuredMeasurablesToDisplay:function(){var e=this,t=Object.entries(this.configuredMeasurables);return Object.fromEntries(t.filter((function(t){var n=fo(t,2),r=n[1],o=r.yandexAccountAndHostId.split("##"),c=fo(o,1),a=c[0];return!!e.accounts[a]})).map((function(t){var n=fo(t,2),r=n[0],o=n[1],c=o.yandexAccountAndHostId.split("##"),a=fo(c,2),l=a[0],i=a[1],s=e.accounts[l],u=s.apiKey,d=Object.entries(s.urls).find((function(e){var t=fo(e,2),n=t[1];return n.host_id===i})),b=null===d||void 0===d?void 0:d[0];return[r,Object.assign(Object.assign({},o),{},{account:l,host:i,hostUrl:b,apiKeyDisplay:xe(u)})]})))},forwardToYandexAuthUrl:function(){return"?".concat(s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"forwardToYandexAuth"})))},visitOAuthHowTo:function(){var e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-yandex-search-keywords-into-matomo/");return Object(s["translate"])("SearchEngineKeywordsPerformance_VisitOAuthHowTo",'<a target="_blank" href="'.concat(e,'" rel="noreferrer noopener">'),"</a>","Yandex")},accountsToDisplay:function(){var e=Object.entries(this.accounts),t=e.filter((function(e){var t=fo(e,2),n=t[1];return n.hasAccess}));return Object.fromEntries(t)}}});vo.render=po;var So=vo,Vo={class:"form-group row"},ko={class:"col s12"},Ao=Object(c["createElementVNode"])("br",null,null,-1),Co=["innerHTML"],wo=Object(c["createElementVNode"])("br",null,null,-1),Bo=Object(c["createElementVNode"])("br",null,null,-1),Do=Object(c["createElementVNode"])("br",null,null,-1),_o={class:"form-group row"},To={class:"col s12 m6"},Po={id:"configFileUploadForm",action:"",method:"POST",enctype:"multipart/form-data"},Ko=Object(c["createElementVNode"])("input",{type:"hidden",id:"client",name:"client"},null,-1),xo=["value"],Uo=["disabled"],Mo=Object(c["createElementVNode"])("span",{class:"icon-upload"},null,-1),Io=Object(c["createElementVNode"])("span",{class:"icon-upload"},null,-1);function Lo(e,t,n,r,o,a){return Object(c["openBlock"])(),Object(c["createElementBlock"])(c["Fragment"],null,[Object(c["createElementVNode"])("div",Vo,[Object(c["createElementVNode"])("div",ko,[Object(c["createElementVNode"])("p",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel1")),1),Object(c["createElementVNode"])("p",null,[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel2")),1),Ao,Object(c["createElementVNode"])("span",{innerHTML:e.$sanitize(e.setupGoogleAnalyticsImportFaq)},null,8,Co)]),Object(c["createElementVNode"])("p",null,[Object(c["createTextVNode"])(Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthExampleText")),1),wo,Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GoogleAuthorizedJavaScriptOrigin"))+": ",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.baseDomain),1),Bo,Object(c["createElementVNode"])("strong",null,Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GoogleAuthorizedRedirectUri"))+": ",1),Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.baseUrl)+Object(c["toDisplayString"])(e.redirectUri),1),Do])])]),Object(c["createElementVNode"])("div",_o,[Object(c["createElementVNode"])("div",To,[Object(c["createElementVNode"])("form",Po,[Object(c["createElementVNode"])("input",{type:"file",id:"clientfile",name:"clientfile",accept:".json",onChange:t[0]||(t[0]=function(){return e.processFileChange&&e.processFileChange.apply(e,arguments)}),style:{display:"none"}},null,32),Ko,Object(c["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.manualConfigNonce},null,8,xo),Object(c["createElementVNode"])("button",{type:"button",class:"btn",onClick:t[1]||(t[1]=function(t){return e.selectConfigFile()}),disabled:e.isUploadButtonDisabled},[Object(c["withDirectives"])(Object(c["createElementVNode"])("span",null,[Mo,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("General_Upload")),1)],512),[[c["vShow"],!e.isUploadButtonDisabled]]),Object(c["withDirectives"])(Object(c["createElementVNode"])("span",null,[Io,Object(c["createTextVNode"])(" "+Object(c["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_Uploading")),1)],512),[[c["vShow"],e.isUploadButtonDisabled]])],8,Uo)])])])],64)}var Fo=Object(c["defineComponent"])({data:function(){return{redirectUri:"?module=SearchEngineKeywordsPerformance&action=processAuthCode",isSelectingFile:!1,isUploading:!1}},props:{manualConfigNonce:{type:String,required:!0},baseDomain:{type:String,required:!0},baseUrl:{type:String,required:!0}},methods:{selectConfigFile:function(){this.isSelectingFile=!0;var e=document.getElementById("clientfile");e&&e.click()},processFileChange:function(){var e=document.getElementById("clientfile"),t=document.getElementById("configFileUploadForm");e&&e.value&&t&&(this.isUploading=!0,t.submit())},checkForCancel:function(){if(this.isSelectingFile&&!this.isUploading){var e=document.getElementById("clientfile");e&&!e.value&&(this.isSelectingFile=!1)}}},computed:{setupGoogleAnalyticsImportFaq:function(){var e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website");return Object(s["translate"])("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3",'<a href="'.concat(e,'" rel="noreferrer noopener" target="_blank">'),"</a>")},isUploadButtonDisabled:function(){return this.isSelectingFile||this.isUploading}},mounted:function(){document.body.onfocus=this.checkForCancel}});Fo.render=Lo;var Go=Fo;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 
(function(t,n){"object"===typeof exports&&"object"===typeof module?module.exports=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],n):"object"===typeof exports?exports["UsersFlow"]=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):t["UsersFlow"]=n(t["CoreHome"],t["Vue"],t["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(t,n,e){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="plugins/UsersFlow/vue/dist/",e(e.s="fae3")}({"19dc":function(n,e){n.exports=t},"8bbf":function(t,e){t.exports=n},9314:function(t,n,e){(function(t,e){e(n)})(0,(function(t){"use strict";var n="4.9.1",e=function(t,n){return t<n?-1:t>n?1:t>=n?0:NaN},r=function(t){return 1===t.length&&(t=i(t)),{left:function(n,e,r,i){null==r&&(r=0),null==i&&(i=n.length);while(r<i){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){null==r&&(r=0),null==i&&(i=n.length);while(r<i){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}};function i(t){return function(n,r){return e(t(n),r)}}var o=r(e),a=o.right,u=o.left,c=function(t,n){null==n&&(n=s);var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);while(e<r)o[e]=n(i,i=t[++e]);return o};function s(t,n){return[t,n]}var l=function(t,n,e){var r,i,o,a,u=t.length,c=n.length,l=new Array(u*c);for(null==e&&(e=s),r=o=0;r<u;++r)for(a=t[r],i=0;i<c;++i,++o)l[o]=e(a,n[i]);return l},f=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},h=function(t){return null===t?NaN:+t},p=function(t,n){var e,r,i=t.length,o=0,a=-1,u=0,c=0;if(null==n)while(++a<i)isNaN(e=h(t[a]))||(r=e-u,u+=r/++o,c+=r*(e-u));else while(++a<i)isNaN(e=h(n(t[a],a,t)))||(r=e-u,u+=r/++o,c+=r*(e-u));if(o>1)return c/(o-1)},d=function(t,n){var e=p(t,n);return e?Math.sqrt(e):e},v=function(t,n){var e,r,i,o=t.length,a=-1;if(null==n){while(++a<o)if(null!=(e=t[a])&&e>=e){r=i=e;while(++a<o)null!=(e=t[a])&&(r>e&&(r=e),i<e&&(i=e))}}else while(++a<o)if(null!=(e=n(t[a],a,t))&&e>=e){r=i=e;while(++a<o)null!=(e=n(t[a],a,t))&&(r>e&&(r=e),i<e&&(i=e))}return[r,i]},y=Array.prototype,g=y.slice,_=y.map,m=function(t){return function(){return t}},x=function(t){return t},w=function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);while(++r<i)o[r]=t+r*e;return o},b=Math.sqrt(50),M=Math.sqrt(10),k=Math.sqrt(2),S=function(t,n,e){var r,i,o,a=n<t,u=-1;if(a&&(r=t,t=n,n=r),0===(o=E(t,n,e))||!isFinite(o))return[];if(o>0){t=Math.ceil(t/o),n=Math.floor(n/o),i=new Array(r=Math.ceil(n-t+1));while(++u<r)i[u]=(t+u)*o}else{t=Math.floor(t*o),n=Math.ceil(n*o),i=new Array(r=Math.ceil(t-n+1));while(++u<r)i[u]=(t-u)/o}return a&&i.reverse(),i};function E(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=b?10:o>=M?5:o>=k?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=b?10:o>=M?5:o>=k?2:1)}function N(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=b?i*=10:o>=M?i*=5:o>=k&&(i*=2),n<t?-i:i}var T=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},A=function(){var t=x,n=v,e=T;function r(r){var i,o,u=r.length,c=new Array(u);for(i=0;i<u;++i)c[i]=t(r[i],i,r);var s=n(c),l=s[0],f=s[1],h=e(c,l,f);Array.isArray(h)||(h=N(l,f,h),h=w(Math.ceil(l/h)*h,Math.floor(f/h)*h,h));var p=h.length;while(h[0]<=l)h.shift(),--p;while(h[p-1]>f)h.pop(),--p;var d,v=new Array(p+1);for(i=0;i<=p;++i)d=v[i]=[],d.x0=i>0?h[i-1]:l,d.x1=i<p?h[i]:f;for(i=0;i<u;++i)o=c[i],l<=o&&o<=f&&v[a(h,o,0,p)].push(r[i]);return v}return r.value=function(n){return arguments.length?(t="function"===typeof n?n:m(n),r):t},r.domain=function(t){return arguments.length?(n="function"===typeof t?t:m([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"===typeof t?t:Array.isArray(t)?m(g.call(t)):m(t),r):e},r},C=function(t,n,e){if(null==e&&(e=h),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t),u=+e(t[o+1],o+1,t);return a+(u-a)*(i-o)}},O=function(t,n,r){return t=_.call(t,h).sort(e),Math.ceil((r-n)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},P=function(t,n,e){return Math.ceil((e-n)/(3.5*d(t)*Math.pow(t.length,-1/3)))},L=function(t,n){var e,r,i=t.length,o=-1;if(null==n){while(++o<i)if(null!=(e=t[o])&&e>=e){r=e;while(++o<i)null!=(e=t[o])&&e>r&&(r=e)}}else while(++o<i)if(null!=(e=n(t[o],o,t))&&e>=e){r=e;while(++o<i)null!=(e=n(t[o],o,t))&&e>r&&(r=e)}return r},U=function(t,n){var e,r=t.length,i=r,o=-1,a=0;if(null==n)while(++o<r)isNaN(e=h(t[o]))?--i:a+=e;else while(++o<r)isNaN(e=h(n(t[o],o,t)))?--i:a+=e;if(i)return a/i},D=function(t,n){var r,i=t.length,o=-1,a=[];if(null==n)while(++o<i)isNaN(r=h(t[o]))||a.push(r);else while(++o<i)isNaN(r=h(n(t[o],o,t)))||a.push(r);return C(a.sort(e),.5)},z=function(t){var n,e,r,i=t.length,o=-1,a=0;while(++o<i)a+=t[o].length;e=new Array(a);while(--i>=0){r=t[i],n=r.length;while(--n>=0)e[--a]=r[n]}return e},F=function(t,n){var e,r,i=t.length,o=-1;if(null==n){while(++o<i)if(null!=(e=t[o])&&e>=e){r=e;while(++o<i)null!=(e=t[o])&&r>e&&(r=e)}}else while(++o<i)if(null!=(e=n(t[o],o,t))&&e>=e){r=e;while(++o<i)null!=(e=n(t[o],o,t))&&r>e&&(r=e)}return r},j=function(t,n){var e=n.length,r=new Array(e);while(e--)r[e]=t[n[e]];return r},R=function(t,n){if(r=t.length){var r,i,o=0,a=0,u=t[a];null==n&&(n=e);while(++o<r)(n(i=t[o],u)<0||0!==n(u,u))&&(u=i,a=o);return 0===n(u,u)?a:void 0}},I=function(t,n,e){var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);while(o)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},q=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)while(++i<r)(e=+t[i])&&(o+=e);else while(++i<r)(e=+n(t[i],i,t))&&(o+=e);return o},B=function(t){if(!(i=t.length))return[];for(var n=-1,e=F(t,H),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r};function H(t){return t.length}var V=function(){return B(arguments)},Y=Array.prototype.slice,X=function(t){return t},G=1,W=2,$=3,Z=4,J=1e-6;function Q(t){return"translate("+(t+.5)+",0)"}function K(t){return"translate(0,"+(t+.5)+")"}function tt(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return t(e)+n}}function nt(){return!this.__axis}function et(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c=t===G||t===Z?-1:1,s=t===Z||t===W?"x":"y",l=t===G||t===$?Q:K;function f(f){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):X:i,d=Math.max(o,0)+u,v=n.range(),y=v[0]+.5,g=v[v.length-1]+.5,_=(n.bandwidth?tt:X)(n.copy()),m=f.selection?f.selection():f,x=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(h,n).order(),b=w.exit(),M=w.enter().append("g").attr("class","tick"),k=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),w=w.merge(M),k=k.merge(M.append("line").attr("stroke","#000").attr(s+"2",c*o)),S=S.merge(M.append("text").attr("fill","#000").attr(s,c*d).attr("dy",t===G?"0em":t===$?"0.71em":"0.32em")),f!==m&&(x=x.transition(f),w=w.transition(f),k=k.transition(f),S=S.transition(f),b=b.transition(f).attr("opacity",J).attr("transform",(function(t){return isFinite(t=_(t))?l(t):this.getAttribute("transform")})),M.attr("opacity",J).attr("transform",(function(t){var n=this.parentNode.__axis;return l(n&&isFinite(n=n(t))?n:_(t))}))),b.remove(),x.attr("d",t===Z||t==W?"M"+c*a+","+y+"H0.5V"+g+"H"+c*a:"M"+y+","+c*a+"V0.5H"+g+"V"+c*a),w.attr("opacity",1).attr("transform",(function(t){return l(_(t))})),k.attr(s+"2",c*o),S.attr(s,c*d).text(p),m.filter(nt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===W?"start":t===Z?"end":"middle"),m.each((function(){this.__axis=_}))}return f.scale=function(t){return arguments.length?(n=t,f):n},f.ticks=function(){return e=Y.call(arguments),f},f.tickArguments=function(t){return arguments.length?(e=null==t?[]:Y.call(t),f):e.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:Y.call(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=a=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(a=+t,f):a},f.tickPadding=function(t){return arguments.length?(u=+t,f):u},f}function rt(t){return et(G,t)}function it(t){return et(W,t)}function ot(t){return et($,t)}function at(t){return et(Z,t)}var ut={value:function(){}};function ct(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new st(r)}function st(t){this._=t}function lt(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function ft(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function ht(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=ut,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}st.prototype=ct.prototype={constructor:st,on:function(t,n){var e,r=this._,i=lt(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!==typeof n)throw new Error("invalid callback: "+n);while(++o<a)if(e=(t=i[o]).type)r[e]=ht(r[e],t.name,n);else if(null==n)for(e in r)r[e]=ht(r[e],t.name,null);return this}while(++o<a)if((e=(t=i[o]).type)&&(e=ft(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new st(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],o=0,e=r.length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var pt="http://www.w3.org/1999/xhtml",dt={svg:"http://www.w3.org/2000/svg",xhtml:pt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},vt=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),dt.hasOwnProperty(n)?{space:dt[n],local:t}:t};function yt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===pt&&n.documentElement.namespaceURI===pt?n.createElement(t):n.createElementNS(e,t)}}function gt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var _t=function(t){var n=vt(t);return(n.local?gt:yt)(n)},mt=0;function xt(){return new wt}function wt(){this._="@"+(++mt).toString(36)}wt.prototype=xt.prototype={constructor:wt,get:function(t){var n=this._;while(!(n in t))if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var bt=function(t){return function(){return this.matches(t)}};if("undefined"!==typeof document){var Mt=document.documentElement;if(!Mt.matches){var kt=Mt.webkitMatchesSelector||Mt.msMatchesSelector||Mt.mozMatchesSelector||Mt.oMatchesSelector;bt=function(t){return function(){return kt.call(this,t)}}}}var St=bt,Et={};if(t.event=null,"undefined"!==typeof document){var Nt=document.documentElement;"onmouseenter"in Nt||(Et={mouseenter:"mouseover",mouseleave:"mouseout"})}function Tt(t,n,e){return t=At(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function At(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function Ct(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function Ot(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function Pt(t,n,e){var r=Et.hasOwnProperty(t.type)?Tt:At;return function(i,o,a){var u,c=this.__on,s=r(n,o,a);if(c)for(var l=0,f=c.length;l<f;++l)if((u=c[l]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=s,u.capture=e),void(u.value=n);this.addEventListener(t.type,s,e),u={type:t.type,name:t.name,value:n,listener:s,capture:e},c?c.push(u):this.__on=[u]}}var Lt=function(t,n,e){var r,i,o=Ct(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?Pt:Ot,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value};function Ut(n,e,r,i){var o=t.event;n.sourceEvent=t.event,t.event=n;try{return e.apply(r,i)}finally{t.event=o}}var Dt=function(){var n,e=t.event;while(n=e.sourceEvent)e=n;return e},zt=function(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]},Ft=function(t){var n=Dt();return n.changedTouches&&(n=n.changedTouches[0]),zt(t,n)};function jt(){}var Rt=function(t){return null==t?jt:function(){return this.querySelector(t)}},It=function(t){"function"!==typeof t&&(t=Rt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,s=r[i]=new Array(c),l=0;l<c;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),s[l]=a);return new ae(r,this._parents)};function qt(){return[]}var Bt=function(t){return null==t?qt:function(){return this.querySelectorAll(t)}},Ht=function(t){"function"!==typeof t&&(t=Bt(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(t.call(a,a.__data__,s,u)),i.push(a));return new ae(r,i)},Vt=function(t){"function"!==typeof t&&(t=St(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],s=0;s<u;++s)(o=a[s])&&t.call(o,o.__data__,s,a)&&c.push(o);return new ae(r,this._parents)},Yt=function(t){return new Array(t.length)},Xt=function(){return new ae(this._enter||this._groups.map(Yt),this._parents)};function Gt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}Gt.prototype={constructor:Gt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Wt=function(t){return function(){return t}},$t="$";function Zt(t,n,e,r,i,o){for(var a,u=0,c=n.length,s=o.length;u<s;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new Gt(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function Jt(t,n,e,r,i,o,a){var u,c,s,l={},f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(c=n[u])&&(p[u]=s=$t+a.call(c,c.__data__,u,n),s in l?i[u]=c:l[s]=c);for(u=0;u<h;++u)s=$t+a.call(t,o[u],u,o),(c=l[s])?(r[u]=c,c.__data__=o[u],l[s]=null):e[u]=new Gt(t,o[u]);for(u=0;u<f;++u)(c=n[u])&&l[p[u]]===c&&(i[u]=c)}var Qt=function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each((function(t){p[++s]=t})),p;var e=n?Jt:Zt,r=this._parents,i=this._groups;"function"!==typeof t&&(t=Wt(t));for(var o=i.length,a=new Array(o),u=new Array(o),c=new Array(o),s=0;s<o;++s){var l=r[s],f=i[s],h=f.length,p=t.call(l,l&&l.__data__,s,r),d=p.length,v=u[s]=new Array(d),y=a[s]=new Array(d),g=c[s]=new Array(h);e(l,f,v,y,g,p,n);for(var _,m,x=0,w=0;x<d;++x)if(_=v[x]){x>=w&&(w=x+1);while(!(m=y[w])&&++w<d);_._next=m||null}}return a=new ae(a,r),a._enter=u,a._exit=c,a},Kt=function(){return new ae(this._exit||this._groups.map(Yt),this._parents)},tn=function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,s=n[u],l=e[u],f=s.length,h=a[u]=new Array(f),p=0;p<f;++p)(c=s[p]||l[p])&&(h[p]=c);for(;u<r;++u)a[u]=n[u];return new ae(a,this._parents)},nn=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},en=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=rn);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,s=i[o]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new ae(i,this._parents).order()};function rn(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}var on=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},an=function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},un=function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},cn=function(){var t=0;return this.each((function(){++t})),t},sn=function(){return!this.node()},ln=function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this};function fn(t){return function(){this.removeAttribute(t)}}function hn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function pn(t,n){return function(){this.setAttribute(t,n)}}function dn(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function vn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function yn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var gn=function(t,n){var e=vt(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?hn:fn:"function"===typeof n?e.local?yn:vn:e.local?dn:pn)(e,n))},_n=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function mn(t){return function(){this.style.removeProperty(t)}}function xn(t,n,e){return function(){this.style.setProperty(t,n,e)}}function wn(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}var bn=function(t,n,e){return arguments.length>1?this.each((null==n?mn:"function"===typeof n?wn:xn)(t,n,null==e?"":e)):Mn(this.node(),t)};function Mn(t,n){return t.style.getPropertyValue(n)||_n(t).getComputedStyle(t,null).getPropertyValue(n)}function kn(t){return function(){delete this[t]}}function Sn(t,n){return function(){this[t]=n}}function En(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}var Nn=function(t,n){return arguments.length>1?this.each((null==n?kn:"function"===typeof n?En:Sn)(t,n)):this.node()[t]};function Tn(t){return t.trim().split(/^|\s+/)}function An(t){return t.classList||new Cn(t)}function Cn(t){this._node=t,this._names=Tn(t.getAttribute("class")||"")}function On(t,n){var e=An(t),r=-1,i=n.length;while(++r<i)e.add(n[r])}function Pn(t,n){var e=An(t),r=-1,i=n.length;while(++r<i)e.remove(n[r])}function Ln(t){return function(){On(this,t)}}function Un(t){return function(){Pn(this,t)}}function Dn(t,n){return function(){(n.apply(this,arguments)?On:Pn)(this,t)}}Cn.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var zn=function(t,n){var e=Tn(t+"");if(arguments.length<2){var r=An(this.node()),i=-1,o=e.length;while(++i<o)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"===typeof n?Dn:n?Ln:Un)(e,n))};function Fn(){this.textContent=""}function jn(t){return function(){this.textContent=t}}function Rn(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}var In=function(t){return arguments.length?this.each(null==t?Fn:("function"===typeof t?Rn:jn)(t)):this.node().textContent};function qn(){this.innerHTML=""}function Bn(t){return function(){this.innerHTML=t}}function Hn(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}var Vn=function(t){return arguments.length?this.each(null==t?qn:("function"===typeof t?Hn:Bn)(t)):this.node().innerHTML};function Yn(){this.nextSibling&&this.parentNode.appendChild(this)}var Xn=function(){return this.each(Yn)};function Gn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}var Wn=function(){return this.each(Gn)},$n=function(t){var n="function"===typeof t?t:_t(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))};function Zn(){return null}var Jn=function(t,n){var e="function"===typeof t?t:_t(t),r=null==n?Zn:"function"===typeof n?n:Rt(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))};function Qn(){var t=this.parentNode;t&&t.removeChild(this)}var Kn=function(){return this.each(Qn)},te=function(t){return arguments.length?this.property("__data__",t):this.node().__data__};function ne(t,n,e){var r=_n(t),i=r.CustomEvent;"function"===typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ee(t,n){return function(){return ne(this,t,n)}}function re(t,n){return function(){return ne(this,t,n.apply(this,arguments))}}var ie=function(t,n){return this.each(("function"===typeof n?re:ee)(t,n))},oe=[null];function ae(t,n){this._groups=t,this._parents=n}function ue(){return new ae([[document.documentElement]],oe)}ae.prototype=ue.prototype={constructor:ae,select:It,selectAll:Ht,filter:Vt,data:Qt,enter:Xt,exit:Kt,merge:tn,order:nn,sort:en,call:on,nodes:an,node:un,size:cn,empty:sn,each:ln,attr:gn,style:bn,property:Nn,classed:zn,text:In,html:Vn,raise:Xn,lower:Wn,append:$n,insert:Jn,remove:Kn,datum:te,on:Lt,dispatch:ie};var ce=function(t){return"string"===typeof t?new ae([[document.querySelector(t)]],[document.documentElement]):new ae([[t]],oe)},se=function(t){return"string"===typeof t?new ae([document.querySelectorAll(t)],[document.documentElement]):new ae([null==t?[]:t],oe)},le=function(t,n,e){arguments.length<3&&(e=n,n=Dt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return zt(t,r);return null},fe=function(t,n){null==n&&(n=Dt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=zt(t,n[e]);return i};function he(){t.event.stopImmediatePropagation()}var pe=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()},de=function(t){var n=t.document.documentElement,e=ce(t).on("dragstart.drag",pe,!0);"onselectstart"in n?e.on("selectstart.drag",pe,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")};function ve(t,n){var e=t.document.documentElement,r=ce(t).on("dragstart.drag",null);n&&(r.on("click.drag",pe,!0),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var ye=function(t){return function(){return t}};function ge(t,n,e,r,i,o,a,u,c,s){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=a,this.dx=u,this.dy=c,this._=s}function _e(){return!t.event.button}function me(){return this.parentNode}function xe(n){return null==n?{x:t.event.x,y:t.event.y}:n}ge.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var we=function(){var n,e,r,i,o=_e,a=me,u=xe,c={},s=ct("start","drag","end"),l=0,f=0;function h(t){t.on("mousedown.drag",p).on("touchstart.drag",y).on("touchmove.drag",g).on("touchend.drag touchcancel.drag",_).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!i&&o.apply(this,arguments)){var u=m("mouse",a.apply(this,arguments),Ft,this,arguments);u&&(ce(t.event.view).on("mousemove.drag",d,!0).on("mouseup.drag",v,!0),de(t.event.view),he(),r=!1,n=t.event.clientX,e=t.event.clientY,u("start"))}}function d(){if(pe(),!r){var i=t.event.clientX-n,o=t.event.clientY-e;r=i*i+o*o>f}c.mouse("drag")}function v(){ce(t.event.view).on("mousemove.drag mouseup.drag",null),ve(t.event.view,r),pe(),c.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;n<u;++n)(e=m(r[n].identifier,i,le,this,arguments))&&(he(),e("start"))}}function g(){var n,e,r=t.event.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(pe(),e("drag"))}function _(){var n,e,r=t.event.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(he(),e("end"))}function m(n,e,r,i,o){var a,f,p,d=r(e,n),v=s.copy();if(Ut(new ge(h,"beforestart",a,n,l,d[0],d[1],0,0,v),(function(){return null!=(t.event.subject=a=u.apply(i,o))&&(f=a.x-d[0]||0,p=a.y-d[1]||0,!0)})))return function t(u){var s,y=d;switch(u){case"start":c[n]=t,s=l++;break;case"end":delete c[n],--l;case"drag":d=r(e,n),s=l;break}Ut(new ge(h,u,a,n,s,d[0]+f,d[1]+p,d[0]-y[0],d[1]-y[1],v),v.apply,v,[u,i,o])}}return h.filter=function(t){return arguments.length?(o="function"===typeof t?t:ye(!!t),h):o},h.container=function(t){return arguments.length?(a="function"===typeof t?t:ye(t),h):a},h.subject=function(t){return arguments.length?(u="function"===typeof t?t:ye(t),h):u},h.on=function(){var t=s.on.apply(s,arguments);return t===s?h:t},h.clickDistance=function(t){return arguments.length?(f=(t=+t)*t,h):Math.sqrt(f)},h},be=function(t,n,e){t.prototype=n.prototype=e,e.constructor=t};function Me(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ke(){}var Se=.7,Ee=1/Se,Ne="\\s*([+-]?\\d+)\\s*",Te="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ae="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ce=/^#([0-9a-f]{3})$/,Oe=/^#([0-9a-f]{6})$/,Pe=new RegExp("^rgb\\("+[Ne,Ne,Ne]+"\\)$"),Le=new RegExp("^rgb\\("+[Ae,Ae,Ae]+"\\)$"),Ue=new RegExp("^rgba\\("+[Ne,Ne,Ne,Te]+"\\)$"),De=new RegExp("^rgba\\("+[Ae,Ae,Ae,Te]+"\\)$"),ze=new RegExp("^hsl\\("+[Te,Ae,Ae]+"\\)$"),Fe=new RegExp("^hsla\\("+[Te,Ae,Ae,Te]+"\\)$"),je={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Re(t){var n;return t=(t+"").trim().toLowerCase(),(n=Ce.exec(t))?(n=parseInt(n[1],16),new Ve(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Oe.exec(t))?Ie(parseInt(n[1],16)):(n=Pe.exec(t))?new Ve(n[1],n[2],n[3],1):(n=Le.exec(t))?new Ve(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ue.exec(t))?qe(n[1],n[2],n[3],n[4]):(n=De.exec(t))?qe(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ze.exec(t))?Ye(n[1],n[2]/100,n[3]/100,1):(n=Fe.exec(t))?Ye(n[1],n[2]/100,n[3]/100,n[4]):je.hasOwnProperty(t)?Ie(je[t]):"transparent"===t?new Ve(NaN,NaN,NaN,0):null}function Ie(t){return new Ve(t>>16&255,t>>8&255,255&t,1)}function qe(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ve(t,n,e,r)}function Be(t){return t instanceof ke||(t=Re(t)),t?(t=t.rgb(),new Ve(t.r,t.g,t.b,t.opacity)):new Ve}function He(t,n,e,r){return 1===arguments.length?Be(t):new Ve(t,n,e,null==r?1:r)}function Ve(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ye(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new We(t,n,e,r)}function Xe(t){if(t instanceof We)return new We(t.h,t.s,t.l,t.opacity);if(t instanceof ke||(t=Re(t)),!t)return new We;if(t instanceof We)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new We(a,u,c,t.opacity)}function Ge(t,n,e,r){return 1===arguments.length?Xe(t):new We(t,n,e,null==r?1:r)}function We(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function $e(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}be(ke,Re,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),be(Ve,He,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new Ve(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new Ve(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),be(We,Ge,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new We(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new We(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Ve($e(t>=240?t-240:t+120,i,r),$e(t,i,r),$e(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Ze=Math.PI/180,Je=180/Math.PI,Qe=18,Ke=.95047,tr=1,nr=1.08883,er=4/29,rr=6/29,ir=3*rr*rr,or=rr*rr*rr;function ar(t){if(t instanceof cr)return new cr(t.l,t.a,t.b,t.opacity);if(t instanceof vr){var n=t.h*Ze;return new cr(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Ve||(t=Be(t));var e=hr(t.r),r=hr(t.g),i=hr(t.b),o=sr((.4124564*e+.3575761*r+.1804375*i)/Ke),a=sr((.2126729*e+.7151522*r+.072175*i)/tr),u=sr((.0193339*e+.119192*r+.9503041*i)/nr);return new cr(116*a-16,500*(o-a),200*(a-u),t.opacity)}function ur(t,n,e,r){return 1===arguments.length?ar(t):new cr(t,n,e,null==r?1:r)}function cr(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function sr(t){return t>or?Math.pow(t,1/3):t/ir+er}function lr(t){return t>rr?t*t*t:ir*(t-er)}function fr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function hr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pr(t){if(t instanceof vr)return new vr(t.h,t.c,t.l,t.opacity);t instanceof cr||(t=ar(t));var n=Math.atan2(t.b,t.a)*Je;return new vr(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function dr(t,n,e,r){return 1===arguments.length?pr(t):new vr(t,n,e,null==r?1:r)}function vr(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}be(cr,ur,Me(ke,{brighter:function(t){return new cr(this.l+Qe*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new cr(this.l-Qe*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=tr*lr(t),n=Ke*lr(n),e=nr*lr(e),new Ve(fr(3.2404542*n-1.5371385*t-.4985314*e),fr(-.969266*n+1.8760108*t+.041556*e),fr(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),be(vr,dr,Me(ke,{brighter:function(t){return new vr(this.h,this.c,this.l+Qe*(null==t?1:t),this.opacity)},darker:function(t){return new vr(this.h,this.c,this.l-Qe*(null==t?1:t),this.opacity)},rgb:function(){return ar(this).rgb()}}));var yr=-.14861,gr=1.78277,_r=-.29227,mr=-.90649,xr=1.97294,wr=xr*mr,br=xr*gr,Mr=gr*_r-mr*yr;function kr(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Ve||(t=Be(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Mr*r+wr*n-br*e)/(Mr+wr-br),o=r-i,a=(xr*(e-i)-_r*o)/mr,u=Math.sqrt(a*a+o*o)/(xr*i*(1-i)),c=u?Math.atan2(a,o)*Je-120:NaN;return new Er(c<0?c+360:c,u,i,t.opacity)}function Sr(t,n,e,r){return 1===arguments.length?kr(t):new Er(t,n,e,null==r?1:r)}function Er(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Nr(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}be(Er,Sr,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Ze,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Ve(255*(n+e*(yr*r+gr*i)),255*(n+e*(_r*r+mr*i)),255*(n+e*(xr*r)),this.opacity)}}));var Tr=function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return Nr((e-r/n)*n,a,i,o,u)}},Ar=function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return Nr((e-r/n)*n,i,o,a,u)}},Cr=function(t){return function(){return t}};function Or(t,n){return function(e){return t+e*n}}function Pr(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Lr(t,n){var e=n-t;return e?Or(t,e>180||e<-180?e-360*Math.round(e/360):e):Cr(isNaN(t)?n:t)}function Ur(t){return 1===(t=+t)?Dr:function(n,e){return e-n?Pr(n,e,t):Cr(isNaN(n)?e:n)}}function Dr(t,n){var e=n-t;return e?Or(t,e):Cr(isNaN(t)?n:t)}var zr=function t(n){var e=Ur(n);function r(t,n){var r=e((t=He(t)).r,(n=He(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Dr(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Fr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=He(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var jr=Fr(Tr),Rr=Fr(Ar),Ir=function(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(r),a=new Array(r);for(e=0;e<i;++e)o[e]=Kr(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}},qr=function(t,n){var e=new Date;return t=+t,n-=t,function(r){return e.setTime(t+n*r),e}},Br=function(t,n){return t=+t,n-=t,function(e){return t+n*e}},Hr=function(t,n){var e,r={},i={};for(e in null!==t&&"object"===typeof t||(t={}),null!==n&&"object"===typeof n||(n={}),n)e in t?r[e]=Kr(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}},Vr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yr=new RegExp(Vr.source,"g");function Xr(t){return function(){return t}}function Gr(t){return function(n){return t(n)+""}}var Wr,$r,Zr,Jr,Qr=function(t,n){var e,r,i,o=Vr.lastIndex=Yr.lastIndex=0,a=-1,u=[],c=[];t+="",n+="";while((e=Vr.exec(t))&&(r=Yr.exec(n)))(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Br(e,r)})),o=Yr.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?Gr(c[0].x):Xr(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})},Kr=function(t,n){var e,r=typeof n;return null==n||"boolean"===r?Cr(n):("number"===r?Br:"string"===r?(e=Re(n))?(n=e,zr):Qr:n instanceof Re?zr:n instanceof Date?qr:Array.isArray(n)?Ir:"function"!==typeof n.valueOf&&"function"!==typeof n.toString||isNaN(n)?Hr:Br)(t,n)},ti=function(t,n){return t=+t,n-=t,function(e){return Math.round(t+n*e)}},ni=180/Math.PI,ei={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},ri=function(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*ni,skewX:Math.atan(c)*ni,scaleX:a,scaleY:u}};function ii(t){return"none"===t?ei:(Wr||(Wr=document.createElement("DIV"),$r=document.documentElement,Zr=document.defaultView),Wr.style.transform=t,t=Zr.getComputedStyle($r.appendChild(Wr),null).getPropertyValue("transform"),$r.removeChild(Wr),t=t.slice(7,-1).split(","),ri(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}function oi(t){return null==t?ei:(Jr||(Jr=document.createElementNS("http://www.w3.org/2000/svg","g")),Jr.setAttribute("transform",t),(t=Jr.transform.baseVal.consolidate())?(t=t.matrix,ri(t.a,t.b,t.c,t.d,t.e,t.f)):ei)}function ai(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}function o(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:Br(t,i)},{i:c-2,x:Br(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}function a(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Br(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function u(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Br(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function c(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Br(t,e)},{i:u-2,x:Br(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),a(n.rotate,e.rotate,r,i),u(n.skewX,e.skewX,r,i),c(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){var n,e=-1,o=i.length;while(++e<o)r[(n=i[e]).i]=n.x(t);return r.join("")}}}var ui=ai(ii,"px, ","px)","deg)"),ci=ai(oi,", ",")",")"),si=Math.SQRT2,li=2,fi=4,hi=1e-12;function pi(t){return((t=Math.exp(t))+1/t)/2}function di(t){return((t=Math.exp(t))-1/t)/2}function vi(t){return((t=Math.exp(2*t))-1)/(t+1)}var yi=function(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],c=n[1],s=n[2],l=u-i,f=c-o,h=l*l+f*f;if(h<hi)r=Math.log(s/a)/si,e=function(t){return[i+t*l,o+t*f,a*Math.exp(si*t*r)]};else{var p=Math.sqrt(h),d=(s*s-a*a+fi*h)/(2*a*li*p),v=(s*s-a*a-fi*h)/(2*s*li*p),y=Math.log(Math.sqrt(d*d+1)-d),g=Math.log(Math.sqrt(v*v+1)-v);r=(g-y)/si,e=function(t){var n=t*r,e=pi(y),u=a/(li*p)*(e*vi(si*n+y)-di(y));return[i+u*l,o+u*f,a*e/pi(si*n+y)]}}return e.duration=1e3*r,e};function gi(t){return function(n,e){var r=t((n=Ge(n)).h,(e=Ge(e)).h),i=Dr(n.s,e.s),o=Dr(n.l,e.l),a=Dr(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var _i=gi(Lr),mi=gi(Dr);function xi(t,n){var e=Dr((t=ur(t)).l,(n=ur(n)).l),r=Dr(t.a,n.a),i=Dr(t.b,n.b),o=Dr(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}}function wi(t){return function(n,e){var r=t((n=dr(n)).h,(e=dr(e)).h),i=Dr(n.c,e.c),o=Dr(n.l,e.l),a=Dr(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var bi=wi(Lr),Mi=wi(Dr);function ki(t){return function n(e){function r(n,r){var i=t((n=Sr(n)).h,(r=Sr(r)).h),o=Dr(n.s,r.s),a=Dr(n.l,r.l),u=Dr(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Si,Ei,Ni=ki(Lr),Ti=ki(Dr),Ai=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},Ci=0,Oi=0,Pi=0,Li=1e3,Ui=0,Di=0,zi=0,Fi="object"===typeof performance&&performance.now?performance:Date,ji="function"===typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};function Ri(){return Di||(ji(Ii),Di=Fi.now()+zi)}function Ii(){Di=0}function qi(){this._call=this._time=this._next=null}function Bi(t,n,e){var r=new qi;return r.restart(t,n,e),r}function Hi(){Ri(),++Ci;var t,n=Si;while(n)(t=Di-n._time)>=0&&n._call.call(null,t),n=n._next;--Ci}function Vi(){Di=(Ui=Fi.now())+zi,Ci=Oi=0;try{Hi()}finally{Ci=0,Xi(),Di=0}}function Yi(){var t=Fi.now(),n=t-Ui;n>Li&&(zi-=n,Ui=t)}function Xi(){var t,n,e=Si,r=1/0;while(e)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Si=n);Ei=t,Gi(r)}function Gi(t){if(!Ci){Oi&&(Oi=clearTimeout(Oi));var n=t-Di;n>24?(t<1/0&&(Oi=setTimeout(Vi,n)),Pi&&(Pi=clearInterval(Pi))):(Pi||(Ui=Di,Pi=setInterval(Yi,Li)),Ci=1,ji(Vi))}}qi.prototype=Bi.prototype={constructor:qi,restart:function(t,n,e){if("function"!==typeof t)throw new TypeError("callback is not a function");e=(null==e?Ri():+e)+(null==n?0:+n),this._next||Ei===this||(Ei?Ei._next=this:Si=this,Ei=this),this._call=t,this._time=e,Gi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gi())}};var Wi=function(t,n,e){var r=new qi;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r},$i=function(t,n,e){var r=new qi,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?Ri():+e,r.restart((function o(a){a+=i,r.restart(o,i+=n,e),t(a)}),n,e),r)},Zi=ct("start","end","interrupt"),Ji=[],Qi=0,Ki=1,to=2,no=3,eo=4,ro=5,io=6,oo=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};so(t,e,{name:n,index:r,group:i,on:Zi,tween:Ji,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Qi})};function ao(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Qi)throw new Error("too late");return e}function uo(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>to)throw new Error("too late");return e}function co(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function so(t,n,e){var r,i=t.__transition;function o(t){e.state=Ki,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var s,l,f,h;if(e.state!==Ki)return c();for(s in i)if(h=i[s],h.name===e.name){if(h.state===no)return Wi(a);h.state===eo?(h.state=io,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[s]):+s<n&&(h.state=io,h.timer.stop(),delete i[s])}if(Wi((function(){e.state===no&&(e.state=eo,e.timer.restart(u,e.delay,e.time),u(o))})),e.state=to,e.on.call("start",t,t.__data__,e.index,e.group),e.state===to){for(e.state=no,r=new Array(f=e.tween.length),s=0,l=-1;s<f;++s)(h=e.tween[s].value.call(t,t.__data__,e.index,e.group))&&(r[++l]=h);r.length=l+1}}function u(n){var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(c),e.state=ro,1),o=-1,a=r.length;while(++o<a)r[o].call(null,i);e.state===ro&&(e.on.call("end",t,t.__data__,e.index,e.group),c())}function c(){for(var r in e.state=io,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Bi(o,0,e.time)}var lo=function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>to&&e.state<ro,e.state=io,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}},fo=function(t){return this.each((function(){lo(this,t)}))};function ho(t,n){var e,r;return function(){var i=uo(this,t),o=i.tween;if(o!==e){r=e=o;for(var a=0,u=r.length;a<u;++a)if(r[a].name===n){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function po(t,n,e){var r,i;if("function"!==typeof e)throw new Error;return function(){var o=uo(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},c=0,s=i.length;c<s;++c)if(i[c].name===n){i[c]=u;break}c===s&&i.push(u)}o.tween=i}}var vo=function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=co(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?ho:po)(e,t,n))};function yo(t,n,e){var r=t._id;return t.each((function(){var t=uo(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return co(t,r).value[n]}}var go=function(t,n){var e;return("number"===typeof n?Br:n instanceof Re?zr:(e=Re(n))?(n=e,zr):Qr)(t,n)};function _o(t){return function(){this.removeAttribute(t)}}function mo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xo(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function wo(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function bo(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return a=this.getAttribute(t),a===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttribute(t)}}function Mo(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return a=this.getAttributeNS(t.space,t.local),a===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttributeNS(t.space,t.local)}}var ko=function(t,n){var e=vt(t),r="transform"===e?ci:go;return this.attrTween(t,"function"===typeof n?(e.local?Mo:bo)(e,r,yo(this,"attr."+t,n)):null==n?(e.local?mo:_o)(e):(e.local?wo:xo)(e,r,n+""))};function So(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function Eo(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}var No=function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!==typeof n)throw new Error;var r=vt(t);return this.tween(e,(r.local?So:Eo)(r,n))};function To(t,n){return function(){ao(this,t).delay=+n.apply(this,arguments)}}function Ao(t,n){return n=+n,function(){ao(this,t).delay=n}}var Co=function(t){var n=this._id;return arguments.length?this.each(("function"===typeof t?To:Ao)(n,t)):co(this.node(),n).delay};function Oo(t,n){return function(){uo(this,t).duration=+n.apply(this,arguments)}}function Po(t,n){return n=+n,function(){uo(this,t).duration=n}}var Lo=function(t){var n=this._id;return arguments.length?this.each(("function"===typeof t?Oo:Po)(n,t)):co(this.node(),n).duration};function Uo(t,n){if("function"!==typeof n)throw new Error;return function(){uo(this,t).ease=n}}var Do=function(t){var n=this._id;return arguments.length?this.each(Uo(n,t)):co(this.node(),n).ease},zo=function(t){"function"!==typeof t&&(t=St(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],s=0;s<u;++s)(o=a[s])&&t.call(o,o.__data__,s,a)&&c.push(o);return new oa(r,this._parents,this._name,this._id)},Fo=function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,s=n[u],l=e[u],f=s.length,h=a[u]=new Array(f),p=0;p<f;++p)(c=s[p]||l[p])&&(h[p]=c);for(;u<r;++u)a[u]=n[u];return new oa(a,this._parents,this._name,this._id)};function jo(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}function Ro(t,n,e){var r,i,o=jo(n)?ao:uo;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Io=function(t,n){var e=this._id;return arguments.length<2?co(this.node(),e).on.on(t):this.each(Ro(e,t,n))};function qo(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}var Bo=function(){return this.on("end.remove",qo(this._id))},Ho=function(t){var n=this._name,e=this._id;"function"!==typeof t&&(t=Rt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,c,s=r[a],l=s.length,f=o[a]=new Array(l),h=0;h<l;++h)(u=s[h])&&(c=t.call(u,u.__data__,h,s))&&("__data__"in u&&(c.__data__=u.__data__),f[h]=c,oo(f[h],n,e,h,f,co(u,e)));return new oa(o,this._parents,n,e)},Vo=function(t){var n=this._name,e=this._id;"function"!==typeof t&&(t=Bt(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var c,s=r[u],l=s.length,f=0;f<l;++f)if(c=s[f]){for(var h,p=t.call(c,c.__data__,f,s),d=co(c,e),v=0,y=p.length;v<y;++v)(h=p[v])&&oo(h,n,e,v,p,d);o.push(p),a.push(c)}return new oa(o,a,n,e)},Yo=ue.prototype.constructor,Xo=function(){return new Yo(this._groups,this._parents)};function Go(t,n){var e,r,i;return function(){var o=Mn(this,t),a=(this.style.removeProperty(t),Mn(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}function Wo(t){return function(){this.style.removeProperty(t)}}function $o(t,n,e){var r,i;return function(){var o=Mn(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}function Zo(t,n,e){var r,i,o;return function(){var a=Mn(this,t),u=e(this);return null==u&&(this.style.removeProperty(t),u=Mn(this,t)),a===u?null:a===r&&u===i?o:o=n(r=a,i=u)}}var Jo=function(t,n,e){var r="transform"===(t+="")?ui:go;return null==n?this.styleTween(t,Go(t,r)).on("end.style."+t,Wo(t)):this.styleTween(t,"function"===typeof n?Zo(t,r,yo(this,"style."+t,n)):$o(t,r,n+""),e)};function Qo(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}var Ko=function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!==typeof n)throw new Error;return this.tween(r,Qo(t,n,null==e?"":e))};function ta(t){return function(){this.textContent=t}}function na(t){return function(){var n=t(this);this.textContent=null==n?"":n}}var ea=function(t){return this.tween("text","function"===typeof t?na(yo(this,"text",t)):ta(null==t?"":t+""))},ra=function(){for(var t=this._name,n=this._id,e=ua(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=co(a,n);oo(a,t,e,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new oa(r,this._parents,t,e)},ia=0;function oa(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function aa(t){return ue().transition(t)}function ua(){return++ia}var ca=ue.prototype;function sa(t){return+t}function la(t){return t*t}function fa(t){return t*(2-t)}function ha(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function pa(t){return t*t*t}function da(t){return--t*t*t+1}function va(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}oa.prototype=aa.prototype={constructor:oa,select:Ho,selectAll:Vo,filter:zo,merge:Fo,selection:Xo,transition:ra,call:ca.call,nodes:ca.nodes,node:ca.node,size:ca.size,empty:ca.empty,each:ca.each,on:Io,attr:ko,attrTween:No,style:Jo,styleTween:Ko,text:ea,remove:Bo,tween:vo,delay:Co,duration:Lo,ease:Do};var ya=3,ga=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(ya),_a=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(ya),ma=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(ya),xa=Math.PI,wa=xa/2;function ba(t){return 1-Math.cos(t*wa)}function Ma(t){return Math.sin(t*wa)}function ka(t){return(1-Math.cos(xa*t))/2}function Sa(t){return Math.pow(2,10*t-10)}function Ea(t){return 1-Math.pow(2,-10*t)}function Na(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function Ta(t){return 1-Math.sqrt(1-t*t)}function Aa(t){return Math.sqrt(1- --t*t)}function Ca(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var Oa=4/11,Pa=6/11,La=8/11,Ua=3/4,Da=9/11,za=10/11,Fa=15/16,ja=21/22,Ra=63/64,Ia=1/Oa/Oa;function qa(t){return 1-Ba(1-t)}function Ba(t){return(t=+t)<Oa?Ia*t*t:t<La?Ia*(t-=Pa)*t+Ua:t<za?Ia*(t-=Da)*t+Fa:Ia*(t-=ja)*t+Ra}function Ha(t){return((t*=2)<=1?1-Ba(1-t):Ba(t-1)+1)/2}var Va=1.70158,Ya=function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(Va),Xa=function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(Va),Ga=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(Va),Wa=2*Math.PI,$a=1,Za=.3,Ja=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=Wa);function i(t){return n*Math.pow(2,10*--t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*Wa)},i.period=function(e){return t(n,e)},i}($a,Za),Qa=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=Wa);function i(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*Wa)},i.period=function(e){return t(n,e)},i}($a,Za),Ka=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=Wa);function i(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((r-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*Wa)},i.period=function(e){return t(n,e)},i}($a,Za),tu={time:null,delay:0,duration:250,ease:va};function nu(t,n){var e;while(!(e=t.__transition)||!(e=e[n]))if(!(t=t.parentNode))return tu.time=Ri(),tu;return e}var eu=function(t){var n,e;t instanceof oa?(n=t._id,t=t._name):(n=ua(),(e=tu).time=Ri(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,s=0;s<c;++s)(a=u[s])&&oo(a,t,n,s,u,e||nu(a,n));return new oa(r,this._parents,t,n)};ue.prototype.interrupt=fo,ue.prototype.transition=eu;var ru=[null],iu=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if((e=i[r]).state>Ki&&e.name===n)return new oa([[t]],ru,n,+r);return null},ou=function(t){return function(){return t}},au=function(t,n,e){this.target=t,this.type=n,this.selection=e};function uu(){t.event.stopImmediatePropagation()}var cu=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()},su={name:"drag"},lu={name:"space"},fu={name:"handle"},hu={name:"center"},pu={name:"x",handles:["e","w"].map(wu),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},du={name:"y",handles:["n","s"].map(wu),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},vu={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(wu),input:function(t){return t},output:function(t){return t}},yu={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},gu={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},_u={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},mu={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},xu={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function wu(t){return{type:t}}function bu(){return!t.event.button}function Mu(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function ku(t){while(!t.__brush)if(!(t=t.parentNode))return;return t.__brush}function Su(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Eu(t){var n=t.__brush;return n?n.dim.output(n.selection):null}function Nu(){return Cu(pu)}function Tu(){return Cu(du)}var Au=function(){return Cu(vu)};function Cu(n){var e,r=Mu,i=bu,o=ct(u,"start","brush","end"),a=6;function u(t){var e=t.property("__brush",h).selectAll(".overlay").data([wu("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",yu.overlay).merge(e).each((function(){var t=ku(this).extent;ce(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),t.selectAll(".selection").data([wu("selection")]).enter().append("rect").attr("class","selection").attr("cursor",yu.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(n.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return yu[t.type]})),t.each(c).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",f)}function c(){var t=ce(this),n=ku(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-a/2:n[0][0]-a/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-a/2:n[0][1]-a/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+a:a})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+a:a}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n){return t.__brush.emitter||new l(t,n)}function l(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function f(){if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return cu()}else if(e)return;if(i.apply(this,arguments)){var r,o,a,u,l,f,h,p,d,v,y,g,_,m=this,x=t.event.target.__data__.type,w="selection"===(t.event.metaKey?x="overlay":x)?su:t.event.altKey?hu:fu,b=n===du?null:mu[x],M=n===pu?null:xu[x],k=ku(m),S=k.extent,E=k.selection,N=S[0][0],T=S[0][1],A=S[1][0],C=S[1][1],O=b&&M&&t.event.shiftKey,P=Ft(m),L=P,U=s(m,arguments).beforestart();"overlay"===x?k.selection=E=[[r=n===du?N:P[0],a=n===pu?T:P[1]],[l=n===du?A:r,h=n===pu?C:a]]:(r=E[0][0],a=E[0][1],l=E[1][0],h=E[1][1]),o=r,u=a,f=l,p=h;var D=ce(m).attr("pointer-events","none"),z=D.selectAll(".overlay").attr("cursor",yu[x]);if(t.event.touches)D.on("touchmove.brush",j,!0).on("touchend.brush touchcancel.brush",I,!0);else{var F=ce(t.event.view).on("keydown.brush",q,!0).on("keyup.brush",B,!0).on("mousemove.brush",j,!0).on("mouseup.brush",I,!0);de(t.event.view)}uu(),lo(m),c.call(m),U.start()}function j(){var t=Ft(m);!O||g||_||(Math.abs(t[0]-L[0])>Math.abs(t[1]-L[1])?_=!0:g=!0),L=t,y=!0,cu(),R()}function R(){var t;switch(d=L[0]-P[0],v=L[1]-P[1],w){case lu:case su:b&&(d=Math.max(N-r,Math.min(A-l,d)),o=r+d,f=l+d),M&&(v=Math.max(T-a,Math.min(C-h,v)),u=a+v,p=h+v);break;case fu:b<0?(d=Math.max(N-r,Math.min(A-r,d)),o=r+d,f=l):b>0&&(d=Math.max(N-l,Math.min(A-l,d)),o=r,f=l+d),M<0?(v=Math.max(T-a,Math.min(C-a,v)),u=a+v,p=h):M>0&&(v=Math.max(T-h,Math.min(C-h,v)),u=a,p=h+v);break;case hu:b&&(o=Math.max(N,Math.min(A,r-d*b)),f=Math.max(N,Math.min(A,l+d*b))),M&&(u=Math.max(T,Math.min(C,a-v*M)),p=Math.max(T,Math.min(C,h+v*M)));break}f<o&&(b*=-1,t=r,r=l,l=t,t=o,o=f,f=t,x in gu&&z.attr("cursor",yu[x=gu[x]])),p<u&&(M*=-1,t=a,a=h,h=t,t=u,u=p,p=t,x in _u&&z.attr("cursor",yu[x=_u[x]])),k.selection&&(E=k.selection),g&&(o=E[0][0],f=E[1][0]),_&&(u=E[0][1],p=E[1][1]),E[0][0]===o&&E[0][1]===u&&E[1][0]===f&&E[1][1]===p||(k.selection=[[o,u],[f,p]],c.call(m),U.brush())}function I(){if(uu(),t.event.touches){if(t.event.touches.length)return;e&&clearTimeout(e),e=setTimeout((function(){e=null}),500),D.on("touchmove.brush touchend.brush touchcancel.brush",null)}else ve(t.event.view,y),F.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);D.attr("pointer-events","all"),z.attr("cursor",yu.overlay),k.selection&&(E=k.selection),Su(E)&&(k.selection=null,c.call(m)),U.end()}function q(){switch(t.event.keyCode){case 16:O=b&&M;break;case 18:w===fu&&(b&&(l=f-d*b,r=o+d*b),M&&(h=p-v*M,a=u+v*M),w=hu,R());break;case 32:w!==fu&&w!==hu||(b<0?l=f-d:b>0&&(r=o-d),M<0?h=p-v:M>0&&(a=u-v),w=lu,z.attr("cursor",yu.selection),R());break;default:return}cu()}function B(){switch(t.event.keyCode){case 16:O&&(g=_=O=!1,R());break;case 18:w===hu&&(b<0?l=f:b>0&&(r=o),M<0?h=p:M>0&&(a=u),w=fu,R());break;case 32:w===lu&&(t.event.altKey?(b&&(l=f-d*b,r=o+d*b),M&&(h=p-v*M,a=u+v*M),w=hu):(b<0?l=f:b>0&&(r=o),M<0?h=p:M>0&&(a=u),w=fu),z.attr("cursor",yu[x]),R());break;default:return}cu()}}function h(){var t=this.__brush||{selection:null};return t.extent=r.apply(this,arguments),t.dim=n,t}return u.move=function(t,e){t.selection?t.on("start.brush",(function(){s(this,arguments).beforestart().start()})).on("interrupt.brush end.brush",(function(){s(this,arguments).end()})).tween("brush",(function(){var t=this,r=t.__brush,i=s(t,arguments),o=r.selection,a=n.input("function"===typeof e?e.apply(this,arguments):e,r.extent),u=Kr(o,a);function l(n){r.selection=1===n&&Su(a)?null:u(n),c.call(t),i.brush()}return o&&a?l:l(1)})):t.each((function(){var t=this,r=arguments,i=t.__brush,o=n.input("function"===typeof e?e.apply(t,r):e,i.extent),a=s(t,r).beforestart();lo(t),i.selection=null==o||Su(o)?null:o,c.call(t),a.start().brush().end()}))},l.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0===--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){Ut(new au(u,t,n.output(this.state.selection)),o.apply,o,[t,this.that,this.args])}},u.extent=function(t){return arguments.length?(r="function"===typeof t?t:ou([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),u):r},u.filter=function(t){return arguments.length?(i="function"===typeof t?t:ou(!!t),u):i},u.handleSize=function(t){return arguments.length?(a=+t,u):a},u.on=function(){var t=o.on.apply(o,arguments);return t===o?u:t},u}var Ou=Math.cos,Pu=Math.sin,Lu=Math.PI,Uu=Lu/2,Du=2*Lu,zu=Math.max;function Fu(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}var ju=function(){var t=0,n=null,e=null,r=null;function i(i){var o,a,u,c,s,l,f=i.length,h=[],p=w(f),d=[],v=[],y=v.groups=new Array(f),g=new Array(f*f);o=0,s=-1;while(++s<f){a=0,l=-1;while(++l<f)a+=i[s][l];h.push(a),d.push(w(f)),o+=a}n&&p.sort((function(t,e){return n(h[t],h[e])})),e&&d.forEach((function(t,n){t.sort((function(t,r){return e(i[n][t],i[n][r])}))})),o=zu(0,Du-t*f)/o,c=o?t:Du/f,a=0,s=-1;while(++s<f){u=a,l=-1;while(++l<f){var _=p[s],m=d[_][l],x=i[_][m],b=a,M=a+=x*o;g[m*f+_]={index:_,subindex:m,startAngle:b,endAngle:M,value:x}}y[_]={index:_,startAngle:u,endAngle:a,value:h[_]},a+=c}s=-1;while(++s<f){l=s-1;while(++l<f){var k=g[l*f+s],S=g[s*f+l];(k.value||S.value)&&v.push(k.value<S.value?{source:S,target:k}:{source:k,target:S})}}return r?v.sort(r):v}return i.padAngle=function(n){return arguments.length?(t=zu(0,n),i):t},i.sortGroups=function(t){return arguments.length?(n=t,i):n},i.sortSubgroups=function(t){return arguments.length?(e=t,i):e},i.sortChords=function(t){return arguments.length?(null==t?r=null:(r=Fu(t))._=t,i):r&&r._},i},Ru=Array.prototype.slice,Iu=function(t){return function(){return t}},qu=Math.PI,Bu=2*qu,Hu=1e-6,Vu=Bu-Hu;function Yu(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Xu(){return new Yu}function Gu(t){return t.source}function Wu(t){return t.target}function $u(t){return t.radius}function Zu(t){return t.startAngle}function Ju(t){return t.endAngle}Yu.prototype=Xu.prototype={constructor:Yu,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,a=this._y1,u=e-t,c=r-n,s=o-t,l=a-n,f=s*s+l*l;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(f>Hu)if(Math.abs(l*u-c*s)>Hu&&i){var h=e-o,p=r-a,d=u*u+c*c,v=h*h+p*p,y=Math.sqrt(d),g=Math.sqrt(f),_=i*Math.tan((qu-Math.acos((d+f-v)/(2*y*g)))/2),m=_/g,x=_/y;Math.abs(m-1)>Hu&&(this._+="L"+(t+m*s)+","+(n+m*l)),this._+="A"+i+","+i+",0,0,"+ +(l*h>s*p)+","+(this._x1=t+x*u)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,e=+e;var a=e*Math.cos(r),u=e*Math.sin(r),c=t+a,s=n+u,l=1^o,f=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>Hu||Math.abs(this._y1-s)>Hu)&&(this._+="L"+c+","+s),e&&(f<0&&(f=f%Bu+Bu),f>Vu?this._+="A"+e+","+e+",0,1,"+l+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+l+","+(this._x1=c)+","+(this._y1=s):f>Hu&&(this._+="A"+e+","+e+",0,"+ +(f>=qu)+","+l+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Qu=function(){var t=Gu,n=Wu,e=$u,r=Zu,i=Ju,o=null;function a(){var a,u=Ru.call(arguments),c=t.apply(this,u),s=n.apply(this,u),l=+e.apply(this,(u[0]=c,u)),f=r.apply(this,u)-Uu,h=i.apply(this,u)-Uu,p=l*Ou(f),d=l*Pu(f),v=+e.apply(this,(u[0]=s,u)),y=r.apply(this,u)-Uu,g=i.apply(this,u)-Uu;if(o||(o=a=Xu()),o.moveTo(p,d),o.arc(0,0,l,f,h),f===y&&h===g||(o.quadraticCurveTo(0,0,v*Ou(y),v*Pu(y)),o.arc(0,0,v,y,g)),o.quadraticCurveTo(0,0,p,d),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(e="function"===typeof t?t:Iu(+t),a):e},a.startAngle=function(t){return arguments.length?(r="function"===typeof t?t:Iu(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"===typeof t?t:Iu(+t),a):i},a.source=function(n){return arguments.length?(t=n,a):t},a.target=function(t){return arguments.length?(n=t,a):n},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},Ku="$";function tc(){}function nc(t,n){var e=new tc;if(t instanceof tc)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)while(++i<o)e.set(i,t[i]);else while(++i<o)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}tc.prototype=nc.prototype={constructor:tc,has:function(t){return Ku+t in this},get:function(t){return this[Ku+t]},set:function(t,n){return this[Ku+t]=n,this},remove:function(t){var n=Ku+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===Ku&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===Ku&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===Ku&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===Ku&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===Ku&&++t;return t},empty:function(){for(var t in this)if(t[0]===Ku)return!1;return!0},each:function(t){for(var n in this)n[0]===Ku&&t(this[n],n.slice(1),this)}};var ec=function(){var t,n,e,r=[],i=[];function o(e,i,a,u){if(i>=r.length)return null!=n?n(e):null!=t?e.sort(t):e;var c,s,l,f=-1,h=e.length,p=r[i++],d=nc(),v=a();while(++f<h)(l=d.get(c=p(s=e[f])+""))?l.push(s):d.set(c,[s]);return d.each((function(t,n){u(v,n,o(t,i,a,u))})),v}function a(t,e){if(++e>r.length)return t;var o,u=i[e-1];return null!=n&&e>=r.length?o=t.entries():(o=[],t.each((function(t,n){o.push({key:n,values:a(t,e)})}))),null!=u?o.sort((function(t,n){return u(t.key,n.key)})):o}return e={object:function(t){return o(t,0,rc,ic)},map:function(t){return o(t,0,oc,ac)},entries:function(t){return a(o(t,0,oc,ac),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}};function rc(){return{}}function ic(t,n,e){t[n]=e}function oc(){return nc()}function ac(t,n,e){t.set(n,e)}function uc(){}var cc=nc.prototype;function sc(t,n){var e=new uc;if(t instanceof uc)t.each((function(t){e.add(t)}));else if(t){var r=-1,i=t.length;if(null==n)while(++r<i)e.add(t[r]);else while(++r<i)e.add(n(t[r],r,t))}return e}uc.prototype=sc.prototype={constructor:uc,has:cc.has,add:function(t){return t+="",this[Ku+t]=t,this},remove:cc.remove,clear:cc.clear,values:cc.keys,size:cc.size,empty:cc.empty,each:cc.each};var lc=function(t){var n=[];for(var e in t)n.push(e);return n},fc=function(t){var n=[];for(var e in t)n.push(t[e]);return n},hc=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n};function pc(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}")}function dc(t,n){var e=pc(t);return function(r,i){return n(e(r),i,t)}}function vc(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}var yc=function(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var e,r,o=i(t,(function(t,i){if(e)return e(t,i-1);r=t,e=n?dc(t,n):pc(t)}));return o.columns=r,o}function i(t,n){var r,i,o={},a={},u=[],c=t.length,s=0,l=0;function f(){if(s>=c)return a;if(i)return i=!1,o;var n,r=s;if(34===t.charCodeAt(r)){var u=r;while(u++<c)if(34===t.charCodeAt(u)){if(34!==t.charCodeAt(u+1))break;++u}return s=u+2,n=t.charCodeAt(u+1),13===n?(i=!0,10===t.charCodeAt(u+2)&&++s):10===n&&(i=!0),t.slice(r+1,u).replace(/""/g,'"')}while(s<c){var l=1;if(n=t.charCodeAt(s++),10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(s)&&(++s,++l);else if(n!==e)continue;return t.slice(r,s-l)}return t.slice(r)}while((r=f())!==a){var h=[];while(r!==o&&r!==a)h.push(r),r=f();n&&null==(h=n(h,l++))||u.push(h)}return u}function o(n,e){return null==e&&(e=vc(n)),[e.map(c).join(t)].concat(n.map((function(n){return e.map((function(t){return c(n[t])})).join(t)}))).join("\n")}function a(t){return t.map(u).join("\n")}function u(n){return n.map(c).join(t)}function c(t){return null==t?"":n.test(t+="")?'"'+t.replace(/\"/g,'""')+'"':t}return{parse:r,parseRows:i,format:o,formatRows:a}},gc=yc(","),_c=gc.parse,mc=gc.parseRows,xc=gc.format,wc=gc.formatRows,bc=yc("\t"),Mc=bc.parse,kc=bc.parseRows,Sc=bc.format,Ec=bc.formatRows,Nc=function(t,n){var e;function r(){var r,i,o=e.length,a=0,u=0;for(r=0;r<o;++r)i=e[r],a+=i.x,u+=i.y;for(a=a/o-t,u=u/o-n,r=0;r<o;++r)i=e[r],i.x-=a,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},Tc=function(t){return function(){return t}},Ac=function(){return 1e-6*(Math.random()-.5)},Cc=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return Oc(this.cover(n,e),n,e,t)};function Oc(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,c,s,l,f,h,p=t._root,d={data:r},v=t._x0,y=t._y0,g=t._x1,_=t._y1;if(!p)return t._root=d,t;while(p.length)if((s=n>=(o=(v+g)/2))?v=o:g=o,(l=e>=(a=(y+_)/2))?y=a:_=a,i=p,!(p=p[f=l<<1|s]))return i[f]=d,t;if(u=+t._x.call(null,p.data),c=+t._y.call(null,p.data),n===u&&e===c)return d.next=p,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+g)/2))?v=o:g=o,(l=e>=(a=(y+_)/2))?y=a:_=a}while((f=l<<1|s)===(h=(c>=a)<<1|u>=o));return i[h]=p,i[f]=d,t}function Pc(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,s=1/0,l=-1/0,f=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<c&&(c=r),r>l&&(l=r),i<s&&(s=i),i>f&&(f=i));for(l<c&&(c=this._x0,l=this._x1),f<s&&(s=this._y0,f=this._y1),this.cover(c,s).cover(l,f),e=0;e<o;++e)Oc(this,a[e],u[e],t[e]);return this}var Lc=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(e>t||t>i||r>n||n>o))return this;var a,u,c=i-e,s=this._root;switch(u=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{a=new Array(4),a[u]=s,s=a}while(c*=2,i=e+c,o=r+c,t>i||n>o);break;case 1:do{a=new Array(4),a[u]=s,s=a}while(c*=2,e=i-c,o=r+c,e>t||n>o);break;case 2:do{a=new Array(4),a[u]=s,s=a}while(c*=2,i=e+c,r=o-c,t>i||r>n);break;case 3:do{a=new Array(4),a[u]=s,s=a}while(c*=2,e=i-c,r=o-c,e>t||r>n);break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},Uc=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},Dc=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},zc=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i},Fc=function(t,n,e){var r,i,o,a,u,c,s,l=this._x0,f=this._y0,h=this._x1,p=this._y1,d=[],v=this._root;v&&d.push(new zc(v,l,f,h,p)),null==e?e=1/0:(l=t-e,f=n-e,h=t+e,p=n+e,e*=e);while(c=d.pop())if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>p||(a=c.x1)<l||(u=c.y1)<f))if(v.length){var y=(i+a)/2,g=(o+u)/2;d.push(new zc(v[3],y,g,a,u),new zc(v[2],i,g,y,u),new zc(v[1],y,o,a,g),new zc(v[0],i,o,y,g)),(s=(n>=g)<<1|t>=y)&&(c=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=c)}else{var _=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),x=_*_+m*m;if(x<e){var w=Math.sqrt(e=x);l=t-w,f=n-w,h=t+w,p=n+w,r=v.data}}return r},jc=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,c,s,l,f,h,p=this._root,d=this._x0,v=this._y0,y=this._x1,g=this._y1;if(!p)return this;if(p.length)while(1){if((s=o>=(u=(d+y)/2))?d=u:y=u,(l=a>=(c=(v+g)/2))?v=c:g=c,n=p,!(p=p[f=l<<1|s]))return this;if(!p.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,h=f)}while(p.data!==t)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[h]=p:this._root=p),this):(this._root=i,this)};function Rc(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this}var Ic=function(){return this._root},qc=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},Bc=function(t){var n,e,r,i,o,a,u=[],c=this._root;c&&u.push(new zc(c,this._x0,this._y0,this._x1,this._y1));while(n=u.pop())if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&c.length){var s=(r+o)/2,l=(i+a)/2;(e=c[3])&&u.push(new zc(e,s,l,o,a)),(e=c[2])&&u.push(new zc(e,r,l,s,a)),(e=c[1])&&u.push(new zc(e,s,i,o,l)),(e=c[0])&&u.push(new zc(e,r,i,s,l))}return this},Hc=function(t){var n,e=[],r=[];this._root&&e.push(new zc(this._root,this._x0,this._y0,this._x1,this._y1));while(n=e.pop()){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,c=n.x1,s=n.y1,l=(a+c)/2,f=(u+s)/2;(o=i[0])&&e.push(new zc(o,a,u,l,f)),(o=i[1])&&e.push(new zc(o,l,u,c,f)),(o=i[2])&&e.push(new zc(o,a,f,l,s)),(o=i[3])&&e.push(new zc(o,l,f,c,s))}r.push(n)}while(n=r.pop())t(n.node,n.x0,n.y0,n.x1,n.y1);return this};function Vc(t){return t[0]}var Yc=function(t){return arguments.length?(this._x=t,this):this._x};function Xc(t){return t[1]}var Gc=function(t){return arguments.length?(this._y=t,this):this._y};function Wc(t,n,e){var r=new $c(null==n?Vc:n,null==e?Xc:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function $c(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Zc(t){var n={data:t.data},e=n;while(t=t.next)e=e.next={data:t.data};return n}var Jc=Wc.prototype=$c.prototype;function Qc(t){return t.x+t.vx}function Kc(t){return t.y+t.vy}Jc.copy=function(){var t,n,e=new $c(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=Zc(r),e;t=[{source:r,target:e._root=new Array(4)}];while(r=t.pop())for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=Zc(n));return e},Jc.add=Cc,Jc.addAll=Pc,Jc.cover=Lc,Jc.data=Uc,Jc.extent=Dc,Jc.find=Fc,Jc.remove=jc,Jc.removeAll=Rc,Jc.root=Ic,Jc.size=qc,Jc.visit=Bc,Jc.visitAfter=Hc,Jc.x=Yc,Jc.y=Gc;var ts=function(t){var n,e,r=1,i=1;function o(){for(var t,o,u,c,s,l,f,h=n.length,p=0;p<i;++p)for(o=Wc(n,Qc,Kc).visitAfter(a),t=0;t<h;++t)u=n[t],l=e[u.index],f=l*l,c=u.x+u.vx,s=u.y+u.vy,o.visit(d);function d(t,n,e,i,o){var a=t.data,h=t.r,p=l+h;if(!a)return n>c+p||i<c-p||e>s+p||o<s-p;if(a.index>u.index){var d=c-a.x-a.vx,v=s-a.y-a.vy,y=d*d+v*v;y<p*p&&(0===d&&(d=Ac(),y+=d*d),0===v&&(v=Ac(),y+=v*v),y=(p-(y=Math.sqrt(y)))/y*r,u.vx+=(d*=y)*(p=(h*=h)/(f+h)),u.vy+=(v*=y)*p,a.vx-=d*(p=1-p),a.vy-=v*p)}}}function a(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!==typeof t&&(t=Tc(null==t?1:+t)),o.initialize=function(t){n=t,u()},o.iterations=function(t){return arguments.length?(i=+t,o):i},o.strength=function(t){return arguments.length?(r=+t,o):r},o.radius=function(n){return arguments.length?(t="function"===typeof n?n:Tc(+n),u(),o):t},o};function ns(t){return t.index}function es(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}var rs=function(t){var n,e,r,i,o,a=ns,u=l,c=Tc(30),s=1;function l(t){return 1/Math.min(i[t.source.index],i[t.target.index])}function f(r){for(var i=0,a=t.length;i<s;++i)for(var u,c,l,f,h,p,d,v=0;v<a;++v)u=t[v],c=u.source,l=u.target,f=l.x+l.vx-c.x-c.vx||Ac(),h=l.y+l.vy-c.y-c.vy||Ac(),p=Math.sqrt(f*f+h*h),p=(p-e[v])/p*r*n[v],f*=p,h*=p,l.vx-=f*(d=o[v]),l.vy-=h*d,c.vx+=f*(d=1-d),c.vy+=h*d}function h(){if(r){var u,c,s=r.length,l=t.length,f=nc(r,a);for(u=0,i=new Array(s);u<l;++u)c=t[u],c.index=u,"object"!==typeof c.source&&(c.source=es(f,c.source)),"object"!==typeof c.target&&(c.target=es(f,c.target)),i[c.source.index]=(i[c.source.index]||0)+1,i[c.target.index]=(i[c.target.index]||0)+1;for(u=0,o=new Array(l);u<l;++u)c=t[u],o[u]=i[c.source.index]/(i[c.source.index]+i[c.target.index]);n=new Array(l),p(),e=new Array(l),d()}}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),f.initialize=function(t){r=t,h()},f.links=function(n){return arguments.length?(t=n,h(),f):t},f.id=function(t){return arguments.length?(a=t,f):a},f.iterations=function(t){return arguments.length?(s=+t,f):s},f.strength=function(t){return arguments.length?(u="function"===typeof t?t:Tc(+t),p(),f):u},f.distance=function(t){return arguments.length?(c="function"===typeof t?t:Tc(+t),d(),f):c},f};function is(t){return t.x}function os(t){return t.y}var as,us=10,cs=Math.PI*(3-Math.sqrt(5)),ss=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=nc(),c=Bi(l),s=ct("tick","end");function l(){f(),s.call("tick",n),e<r&&(c.stop(),s.call("end",n))}function f(){var n,r,c=t.length;for(e+=(o-e)*i,u.each((function(t){t(e)})),n=0;n<c;++n)r=t[n],null==r.fx?r.x+=r.vx*=a:(r.x=r.fx,r.vx=0),null==r.fy?r.y+=r.vy*=a:(r.y=r.fy,r.vy=0)}function h(){for(var n,e=0,r=t.length;e<r;++e){if(n=t[e],n.index=e,isNaN(n.x)||isNaN(n.y)){var i=us*Math.sqrt(e),o=e*cs;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function p(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:f,restart:function(){return c.restart(l),n},stop:function(){return c.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(p),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,p(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,c,s=0,l=t.length;for(null==r?r=1/0:r*=r,s=0;s<l;++s)u=t[s],i=n-u.x,o=e-u.y,a=i*i+o*o,a<r&&(c=u,r=a);return c},on:function(t,e){return arguments.length>1?(s.on(t,e),n):s.on(t)}}},ls=function(){var t,n,e,r,i=Tc(-30),o=1,a=1/0,u=.81;function c(r){var i,o=t.length,a=Wc(t,is,os).visitAfter(l);for(e=r,i=0;i<o;++i)n=t[i],a.visit(f)}function s(){if(t){var n,e,o=t.length;for(r=new Array(o),n=0;n<o;++n)e=t[n],r[e.index]=+i(e,n,t)}}function l(t){var n,e,i,o,a,u=0;if(t.length){for(i=o=a=0;a<4;++a)(n=t[a])&&(e=n.value)&&(u+=e,i+=e*n.x,o+=e*n.y);t.x=i/u,t.y=o/u}else{n=t,n.x=n.data.x,n.y=n.data.y;do{u+=r[n.data.index]}while(n=n.next)}t.value=u}function f(t,i,c,s){if(!t.value)return!0;var l=t.x-n.x,f=t.y-n.y,h=s-i,p=l*l+f*f;if(h*h/u<p)return p<a&&(0===l&&(l=Ac(),p+=l*l),0===f&&(f=Ac(),p+=f*f),p<o&&(p=Math.sqrt(o*p)),n.vx+=l*t.value*e/p,n.vy+=f*t.value*e/p),!0;if(!(t.length||p>=a)){(t.data!==n||t.next)&&(0===l&&(l=Ac(),p+=l*l),0===f&&(f=Ac(),p+=f*f),p<o&&(p=Math.sqrt(o*p)));do{t.data!==n&&(h=r[t.data.index]*e/p,n.vx+=l*h,n.vy+=f*h)}while(t=t.next)}}return c.initialize=function(n){t=n,s()},c.strength=function(t){return arguments.length?(i="function"===typeof t?t:Tc(+t),s(),c):i},c.distanceMin=function(t){return arguments.length?(o=t*t,c):Math.sqrt(o)},c.distanceMax=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.theta=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c},fs=function(t){var n,e,r,i=Tc(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)i=n[o],i.vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!==typeof t&&(t=Tc(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"===typeof t?t:Tc(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"===typeof n?n:Tc(+n),a(),o):t},o},hs=function(t){var n,e,r,i=Tc(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)i=n[o],i.vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!==typeof t&&(t=Tc(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"===typeof t?t:Tc(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"===typeof n?n:Tc(+n),a(),o):t},o},ps=function(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]},ds=function(t){return t=ps(Math.abs(t)),t?t[1]:NaN},vs=function(t,n){return function(e,r){var i=e.length,o=[],a=0,u=t[0],c=0;while(i>0&&u>0){if(c+u+1>r&&(u=Math.max(1,r-c)),o.push(e.substring(i-=u,i+u)),(c+=u+1)>r)break;u=t[a=(a+1)%t.length]}return o.reverse().join(n)}},ys=function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}},gs=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,i=1,o=-1;i<r;++i)switch(t[i]){case".":o=e=i;break;case"0":0===o&&(o=i),e=i;break;case"e":break t;default:o>0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(e+1):t},_s=function(t,n){var e=ps(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(as=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ps(t,Math.max(0,n+o-1))[0]},ms=function(t,n){var e=ps(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},xs={"":gs,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return ms(100*t,n)},r:ms,s:_s,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},ws=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function bs(t){return new Ms(t)}function Ms(t){if(!(n=ws.exec(t)))throw new Error("invalid format: "+t);var n,e=n[1]||" ",r=n[2]||">",i=n[3]||"-",o=n[4]||"",a=!!n[5],u=n[6]&&+n[6],c=!!n[7],s=n[8]&&+n[8].slice(1),l=n[9]||"";"n"===l?(c=!0,l="g"):xs[l]||(l=""),(a||"0"===e&&"="===r)&&(a=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=i,this.symbol=o,this.zero=a,this.width=u,this.comma=c,this.precision=s,this.type=l}bs.prototype=Ms.prototype,Ms.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var ks,Ss=function(t){return t},Es=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Ns=function(t){var n=t.grouping&&t.thousands?vs(t.grouping,t.thousands):Ss,e=t.currency,r=t.decimal,i=t.numerals?ys(t.numerals):Ss,o=t.percent||"%";function a(t){t=bs(t);var a=t.fill,u=t.align,c=t.sign,s=t.symbol,l=t.zero,f=t.width,h=t.comma,p=t.precision,d=t.type,v="$"===s?e[0]:"#"===s&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",y="$"===s?e[1]:/[%p]/.test(d)?o:"",g=xs[d],_=!d||/[defgprs%]/.test(d);function m(t){var e,o,s,m=v,x=y;if("c"===d)x=g(t)+x,t="";else{t=+t;var w=t<0;if(t=g(Math.abs(t),p),w&&0===+t&&(w=!1),m=(w?"("===c?c:"-":"-"===c||"("===c?"":c)+m,x=x+("s"===d?Es[8+as/3]:"")+(w&&"("===c?")":""),_){e=-1,o=t.length;while(++e<o)if(s=t.charCodeAt(e),48>s||s>57){x=(46===s?r+t.slice(e+1):t.slice(e))+x,t=t.slice(0,e);break}}}h&&!l&&(t=n(t,1/0));var b=m.length+t.length+x.length,M=b<f?new Array(f-b+1).join(a):"";switch(h&&l&&(t=n(M+t,M.length?f-x.length:1/0),M=""),u){case"<":t=m+t+x+M;break;case"=":t=m+M+t+x;break;case"^":t=M.slice(0,b=M.length>>1)+m+t+x+M.slice(b);break;default:t=M+m+t+x;break}return i(t)}return p=null==p?d?6:12:/[gprs]/.test(d)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),m.toString=function(){return t+""},m}function u(t,n){var e=a((t=bs(t),t.type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ds(n)/3))),i=Math.pow(10,-r),o=Es[8+r/3];return function(t){return e(i*t)+o}}return{format:a,formatPrefix:u}};function Ts(n){return ks=Ns(n),t.format=ks.format,t.formatPrefix=ks.formatPrefix,ks}Ts({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var As=function(t){return Math.max(0,-ds(Math.abs(t)))},Cs=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ds(n)/3)))-ds(Math.abs(t)))},Os=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ds(n)-ds(t))+1},Ps=function(){return new Ls};function Ls(){this.reset()}Ls.prototype={constructor:Ls,reset:function(){this.s=this.t=0},add:function(t){Ds(Us,t,this.t),Ds(this,Us.s,this.s),this.s?this.t+=Us.t:this.s=Us.t},valueOf:function(){return this.s}};var Us=new Ls;function Ds(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var zs=1e-6,Fs=1e-12,js=Math.PI,Rs=js/2,Is=js/4,qs=2*js,Bs=180/js,Hs=js/180,Vs=Math.abs,Ys=Math.atan,Xs=Math.atan2,Gs=Math.cos,Ws=Math.ceil,$s=Math.exp,Zs=Math.log,Js=Math.pow,Qs=Math.sin,Ks=Math.sign||function(t){return t>0?1:t<0?-1:0},tl=Math.sqrt,nl=Math.tan;function el(t){return t>1?0:t<-1?js:Math.acos(t)}function rl(t){return t>1?Rs:t<-1?-Rs:Math.asin(t)}function il(t){return(t=Qs(t/2))*t}function ol(){}function al(t,n){t&&cl.hasOwnProperty(t.type)&&cl[t.type](t,n)}var ul={Feature:function(t,n){al(t.geometry,n)},FeatureCollection:function(t,n){var e=t.features,r=-1,i=e.length;while(++r<i)al(e[r].geometry,n)}},cl={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){sl(t.coordinates,n,0)},MultiLineString:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)sl(e[r],n,0)},Polygon:function(t,n){ll(t.coordinates,n)},MultiPolygon:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)ll(e[r],n)},GeometryCollection:function(t,n){var e=t.geometries,r=-1,i=e.length;while(++r<i)al(e[r],n)}};function sl(t,n,e){var r,i=-1,o=t.length-e;n.lineStart();while(++i<o)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function ll(t,n){var e=-1,r=t.length;n.polygonStart();while(++e<r)sl(t[e],n,1);n.polygonEnd()}var fl,hl,pl,dl,vl,yl=function(t,n){t&&ul.hasOwnProperty(t.type)?ul[t.type](t,n):al(t,n)},gl=Ps(),_l=Ps(),ml={point:ol,lineStart:ol,lineEnd:ol,polygonStart:function(){gl.reset(),ml.lineStart=xl,ml.lineEnd=wl},polygonEnd:function(){var t=+gl;_l.add(t<0?qs+t:t),this.lineStart=this.lineEnd=this.point=ol},sphere:function(){_l.add(qs)}};function xl(){ml.point=bl}function wl(){Ml(fl,hl)}function bl(t,n){ml.point=Ml,fl=t,hl=n,t*=Hs,n*=Hs,pl=t,dl=Gs(n=n/2+Is),vl=Qs(n)}function Ml(t,n){t*=Hs,n*=Hs,n=n/2+Is;var e=t-pl,r=e>=0?1:-1,i=r*e,o=Gs(n),a=Qs(n),u=vl*a,c=dl*o+u*Gs(i),s=u*r*Qs(i);gl.add(Xs(s,c)),pl=t,dl=o,vl=a}var kl,Sl,El,Nl,Tl,Al,Cl,Ol,Pl=function(t){return _l.reset(),yl(t,ml),2*_l};function Ll(t){return[Xs(t[1],t[0]),rl(t[2])]}function Ul(t){var n=t[0],e=t[1],r=Gs(e);return[r*Gs(n),r*Qs(n),Qs(e)]}function Dl(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function zl(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Fl(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function jl(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Rl(t){var n=tl(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Il,ql,Bl=Ps(),Hl={point:Vl,lineStart:Xl,lineEnd:Gl,polygonStart:function(){Hl.point=Wl,Hl.lineStart=$l,Hl.lineEnd=Zl,Bl.reset(),ml.polygonStart()},polygonEnd:function(){ml.polygonEnd(),Hl.point=Vl,Hl.lineStart=Xl,Hl.lineEnd=Gl,gl<0?(kl=-(El=180),Sl=-(Nl=90)):Bl>zs?Nl=90:Bl<-zs&&(Sl=-90),ql[0]=kl,ql[1]=El}};function Vl(t,n){Il.push(ql=[kl=t,El=t]),n<Sl&&(Sl=n),n>Nl&&(Nl=n)}function Yl(t,n){var e=Ul([t*Hs,n*Hs]);if(Ol){var r=zl(Ol,e),i=[r[1],-r[0],0],o=zl(i,r);Rl(o),o=Ll(o);var a,u=t-Tl,c=u>0?1:-1,s=o[0]*Bs*c,l=Vs(u)>180;l^(c*Tl<s&&s<c*t)?(a=o[1]*Bs,a>Nl&&(Nl=a)):(s=(s+360)%360-180,l^(c*Tl<s&&s<c*t)?(a=-o[1]*Bs,a<Sl&&(Sl=a)):(n<Sl&&(Sl=n),n>Nl&&(Nl=n))),l?t<Tl?Jl(kl,t)>Jl(kl,El)&&(El=t):Jl(t,El)>Jl(kl,El)&&(kl=t):El>=kl?(t<kl&&(kl=t),t>El&&(El=t)):t>Tl?Jl(kl,t)>Jl(kl,El)&&(El=t):Jl(t,El)>Jl(kl,El)&&(kl=t)}else Il.push(ql=[kl=t,El=t]);n<Sl&&(Sl=n),n>Nl&&(Nl=n),Ol=e,Tl=t}function Xl(){Hl.point=Yl}function Gl(){ql[0]=kl,ql[1]=El,Hl.point=Vl,Ol=null}function Wl(t,n){if(Ol){var e=t-Tl;Bl.add(Vs(e)>180?e+(e>0?360:-360):e)}else Al=t,Cl=n;ml.point(t,n),Yl(t,n)}function $l(){ml.lineStart()}function Zl(){Wl(Al,Cl),ml.lineEnd(),Vs(Bl)>zs&&(kl=-(El=180)),ql[0]=kl,ql[1]=El,Ol=null}function Jl(t,n){return(n-=t)<0?n+360:n}function Ql(t,n){return t[0]-n[0]}function Kl(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var tf,nf,ef,rf,of,af,uf,cf,sf,lf,ff,hf,pf,df,vf,yf,gf=function(t){var n,e,r,i,o,a,u;if(Nl=El=-(kl=Sl=1/0),Il=[],yl(t,Hl),e=Il.length){for(Il.sort(Ql),n=1,r=Il[0],o=[r];n<e;++n)i=Il[n],Kl(r,i[0])||Kl(r,i[1])?(Jl(r[0],i[1])>Jl(r[0],r[1])&&(r[1]=i[1]),Jl(i[0],r[1])>Jl(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=o.length-1,n=0,r=o[e];n<=e;r=i,++n)i=o[n],(u=Jl(r[1],i[0]))>a&&(a=u,kl=i[0],El=r[1])}return Il=ql=null,kl===1/0||Sl===1/0?[[NaN,NaN],[NaN,NaN]]:[[kl,Sl],[El,Nl]]},_f={sphere:ol,point:mf,lineStart:wf,lineEnd:kf,polygonStart:function(){_f.lineStart=Sf,_f.lineEnd=Ef},polygonEnd:function(){_f.lineStart=wf,_f.lineEnd=kf}};function mf(t,n){t*=Hs,n*=Hs;var e=Gs(n);xf(e*Gs(t),e*Qs(t),Qs(n))}function xf(t,n,e){++tf,ef+=(t-ef)/tf,rf+=(n-rf)/tf,of+=(e-of)/tf}function wf(){_f.point=bf}function bf(t,n){t*=Hs,n*=Hs;var e=Gs(n);df=e*Gs(t),vf=e*Qs(t),yf=Qs(n),_f.point=Mf,xf(df,vf,yf)}function Mf(t,n){t*=Hs,n*=Hs;var e=Gs(n),r=e*Gs(t),i=e*Qs(t),o=Qs(n),a=Xs(tl((a=vf*o-yf*i)*a+(a=yf*r-df*o)*a+(a=df*i-vf*r)*a),df*r+vf*i+yf*o);nf+=a,af+=a*(df+(df=r)),uf+=a*(vf+(vf=i)),cf+=a*(yf+(yf=o)),xf(df,vf,yf)}function kf(){_f.point=mf}function Sf(){_f.point=Nf}function Ef(){Tf(hf,pf),_f.point=mf}function Nf(t,n){hf=t,pf=n,t*=Hs,n*=Hs,_f.point=Tf;var e=Gs(n);df=e*Gs(t),vf=e*Qs(t),yf=Qs(n),xf(df,vf,yf)}function Tf(t,n){t*=Hs,n*=Hs;var e=Gs(n),r=e*Gs(t),i=e*Qs(t),o=Qs(n),a=vf*o-yf*i,u=yf*r-df*o,c=df*i-vf*r,s=tl(a*a+u*u+c*c),l=rl(s),f=s&&-l/s;sf+=f*a,lf+=f*u,ff+=f*c,nf+=l,af+=l*(df+(df=r)),uf+=l*(vf+(vf=i)),cf+=l*(yf+(yf=o)),xf(df,vf,yf)}var Af=function(t){tf=nf=ef=rf=of=af=uf=cf=sf=lf=ff=0,yl(t,_f);var n=sf,e=lf,r=ff,i=n*n+e*e+r*r;return i<Fs&&(n=af,e=uf,r=cf,nf<zs&&(n=ef,e=rf,r=of),i=n*n+e*e+r*r,i<Fs)?[NaN,NaN]:[Xs(e,n)*Bs,rl(r/tl(i))*Bs]},Cf=function(t){return function(){return t}},Of=function(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return e=n.invert(e,r),e&&t.invert(e[0],e[1])}),e};function Pf(t,n){return[t>js?t-qs:t<-js?t+qs:t,n]}function Lf(t,n,e){return(t%=qs)?n||e?Of(Df(t),zf(n,e)):Df(t):n||e?zf(n,e):Pf}function Uf(t){return function(n,e){return n+=t,[n>js?n-qs:n<-js?n+qs:n,e]}}function Df(t){var n=Uf(t);return n.invert=Uf(-t),n}function zf(t,n){var e=Gs(t),r=Qs(t),i=Gs(n),o=Qs(n);function a(t,n){var a=Gs(n),u=Gs(t)*a,c=Qs(t)*a,s=Qs(n),l=s*e+u*r;return[Xs(c*i-l*o,u*e-s*r),rl(l*i+c*o)]}return a.invert=function(t,n){var a=Gs(n),u=Gs(t)*a,c=Qs(t)*a,s=Qs(n),l=s*i-c*o;return[Xs(c*i+s*o,u*e+l*r),rl(l*e-u*r)]},a}Pf.invert=Pf;var Ff=function(t){function n(n){return n=t(n[0]*Hs,n[1]*Hs),n[0]*=Bs,n[1]*=Bs,n}return t=Lf(t[0]*Hs,t[1]*Hs,t.length>2?t[2]*Hs:0),n.invert=function(n){return n=t.invert(n[0]*Hs,n[1]*Hs),n[0]*=Bs,n[1]*=Bs,n},n};function jf(t,n,e,r,i,o){if(e){var a=Gs(n),u=Qs(n),c=r*e;null==i?(i=n+r*qs,o=n-c/2):(i=Rf(a,i),o=Rf(a,o),(r>0?i<o:i>o)&&(i+=r*qs));for(var s,l=i;r>0?l>o:l<o;l-=c)s=Ll([a,-u*Gs(l),-u*Qs(l)]),t.point(s[0],s[1])}}function Rf(t,n){n=Ul(n),n[0]-=t,Rl(n);var e=el(-n[1]);return((-n[2]<0?-e:e)+qs-zs)%qs}var If=function(){var t,n,e=Cf([0,0]),r=Cf(90),i=Cf(6),o={point:a};function a(e,r){t.push(e=n(e,r)),e[0]*=Bs,e[1]*=Bs}function u(){var a=e.apply(this,arguments),u=r.apply(this,arguments)*Hs,c=i.apply(this,arguments)*Hs;return t=[],n=Lf(-a[0]*Hs,-a[1]*Hs,0).invert,jf(o,u,c,1),a={type:"Polygon",coordinates:[t]},t=n=null,a}return u.center=function(t){return arguments.length?(e="function"===typeof t?t:Cf([+t[0],+t[1]]),u):e},u.radius=function(t){return arguments.length?(r="function"===typeof t?t:Cf(+t),u):r},u.precision=function(t){return arguments.length?(i="function"===typeof t?t:Cf(+t),u):i},u},qf=function(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:ol,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}},Bf=function(t,n,e,r,i,o){var a,u=t[0],c=t[1],s=n[0],l=n[1],f=0,h=1,p=s-u,d=l-c;if(a=e-u,p||!(a>0)){if(a/=p,p<0){if(a<f)return;a<h&&(h=a)}else if(p>0){if(a>h)return;a>f&&(f=a)}if(a=i-u,p||!(a<0)){if(a/=p,p<0){if(a>h)return;a>f&&(f=a)}else if(p>0){if(a<f)return;a<h&&(h=a)}if(a=r-c,d||!(a>0)){if(a/=d,d<0){if(a<f)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>f&&(f=a)}if(a=o-c,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>f&&(f=a)}else if(d>0){if(a<f)return;a<h&&(h=a)}return f>0&&(t[0]=u+f*p,t[1]=c+f*d),h<1&&(n[0]=u+h*p,n[1]=c+h*d),!0}}}}},Hf=function(t,n){return Vs(t[0]-n[0])<zs&&Vs(t[1]-n[1])<zs};function Vf(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}var Yf=function(t,n,e,r,i){var o,a,u=[],c=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(Hf(r,a)){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else u.push(e=new Vf(r,t,null,!0)),c.push(e.o=new Vf(r,null,e,!1)),u.push(e=new Vf(a,t,null,!1)),c.push(e.o=new Vf(a,null,e,!0))}})),u.length){for(c.sort(n),Xf(u),Xf(c),o=0,a=c.length;o<a;++o)c[o].e=e=!e;var s,l,f=u[0];while(1){var h=f,p=!0;while(h.v)if((h=h.n)===f)return;s=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(p)for(o=0,a=s.length;o<a;++o)i.point((l=s[o])[0],l[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(p)for(s=h.p.z,o=s.length-1;o>=0;--o)i.point((l=s[o])[0],l[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,s=h.z,p=!p}while(!h.v);i.lineEnd()}}};function Xf(t){if(n=t.length){var n,e,r=0,i=t[0];while(++r<n)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}var Gf=1e9,Wf=-Gf;function $f(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,s){var l=0,f=0;if(null==i||(l=a(i,u))!==(f=a(o,u))||c(i,o)<0^u>0)do{s.point(0===l||3===l?t:e,l>1?r:n)}while((l=(l+u+4)%4)!==f);else s.point(o[0],o[1])}function a(r,i){return Vs(r[0]-t)<zs?i>0?0:3:Vs(r[0]-e)<zs?i>0?2:1:Vs(r[1]-n)<zs?i>0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,s,l,f,h,p,d,v,y,g,_,m=a,x=qf(),w={point:b,lineStart:E,lineEnd:N,polygonStart:k,polygonEnd:S};function b(t,n){i(t,n)&&m.point(t,n)}function M(){for(var n=0,e=0,i=s.length;e<i;++e)for(var o,a,u=s[e],c=1,l=u.length,f=u[0],h=f[0],p=f[1];c<l;++c)o=h,a=p,f=u[c],h=f[0],p=f[1],a<=r?p>r&&(h-o)*(r-a)>(p-a)*(t-o)&&++n:p<=r&&(h-o)*(r-a)<(p-a)*(t-o)&&--n;return n}function k(){m=x,c=[],s=[],_=!0}function S(){var t=M(),n=_&&t,e=(c=z(c)).length;(n||e)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),e&&Yf(c,u,t,o,a),a.polygonEnd()),m=a,c=s=l=null}function E(){w.point=T,s&&s.push(l=[]),g=!0,y=!1,d=v=NaN}function N(){c&&(T(f,h),p&&y&&x.rejoin(),c.push(x.result())),w.point=b,y&&m.lineEnd()}function T(o,a){var u=i(o,a);if(s&&l.push([o,a]),g)f=o,h=a,p=u,g=!1,u&&(m.lineStart(),m.point(o,a));else if(u&&y)m.point(o,a);else{var c=[d=Math.max(Wf,Math.min(Gf,d)),v=Math.max(Wf,Math.min(Gf,v))],x=[o=Math.max(Wf,Math.min(Gf,o)),a=Math.max(Wf,Math.min(Gf,a))];Bf(c,x,t,n,e,r)?(y||(m.lineStart(),m.point(c[0],c[1])),m.point(x[0],x[1]),u||m.lineEnd(),_=!1):u&&(m.lineStart(),m.point(o,a),_=!1)}d=o,v=a,y=u}return w}}var Zf,Jf,Qf,Kf=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=$f(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},th=Ps(),nh=function(t,n){var e=n[0],r=n[1],i=[Qs(e),-Gs(e),0],o=0,a=0;th.reset();for(var u=0,c=t.length;u<c;++u)if(l=(s=t[u]).length)for(var s,l,f=s[l-1],h=f[0],p=f[1]/2+Is,d=Qs(p),v=Gs(p),y=0;y<l;++y,h=_,d=x,v=w,f=g){var g=s[y],_=g[0],m=g[1]/2+Is,x=Qs(m),w=Gs(m),b=_-h,M=b>=0?1:-1,k=M*b,S=k>js,E=d*x;if(th.add(Xs(E*M*Qs(k),v*w+E*Gs(k))),o+=S?b+M*qs:b,S^h>=e^_>=e){var N=zl(Ul(f),Ul(g));Rl(N);var T=zl(i,N);Rl(T);var A=(S^b>=0?-1:1)*rl(T[2]);(r>A||r===A&&(N[0]||N[1]))&&(a+=S^b>=0?1:-1)}}return(o<-zs||o<zs&&th<-zs)^1&a},eh=Ps(),rh={sphere:ol,point:ol,lineStart:ih,lineEnd:ol,polygonStart:ol,polygonEnd:ol};function ih(){rh.point=ah,rh.lineEnd=oh}function oh(){rh.point=rh.lineEnd=ol}function ah(t,n){t*=Hs,n*=Hs,Zf=t,Jf=Qs(n),Qf=Gs(n),rh.point=uh}function uh(t,n){t*=Hs,n*=Hs;var e=Qs(n),r=Gs(n),i=Vs(t-Zf),o=Gs(i),a=Qs(i),u=r*a,c=Qf*e-Jf*r*o,s=Jf*e+Qf*r*o;eh.add(Xs(tl(u*u+c*c),s)),Zf=t,Jf=e,Qf=r}var ch=function(t){return eh.reset(),yl(t,rh),+eh},sh=[null,null],lh={type:"LineString",coordinates:sh},fh=function(t,n){return sh[0]=t,sh[1]=n,ch(lh)},hh={Feature:function(t,n){return dh(t.geometry,n)},FeatureCollection:function(t,n){var e=t.features,r=-1,i=e.length;while(++r<i)if(dh(e[r].geometry,n))return!0;return!1}},ph={Sphere:function(){return!0},Point:function(t,n){return vh(t.coordinates,n)},MultiPoint:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)if(vh(e[r],n))return!0;return!1},LineString:function(t,n){return yh(t.coordinates,n)},MultiLineString:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)if(yh(e[r],n))return!0;return!1},Polygon:function(t,n){return gh(t.coordinates,n)},MultiPolygon:function(t,n){var e=t.coordinates,r=-1,i=e.length;while(++r<i)if(gh(e[r],n))return!0;return!1},GeometryCollection:function(t,n){var e=t.geometries,r=-1,i=e.length;while(++r<i)if(dh(e[r],n))return!0;return!1}};function dh(t,n){return!(!t||!ph.hasOwnProperty(t.type))&&ph[t.type](t,n)}function vh(t,n){return 0===fh(t,n)}function yh(t,n){var e=fh(t[0],t[1]),r=fh(t[0],n),i=fh(n,t[1]);return r+i<=e+zs}function gh(t,n){return!!nh(t.map(_h),mh(n))}function _h(t){return t=t.map(mh),t.pop(),t}function mh(t){return[t[0]*Hs,t[1]*Hs]}var xh=function(t,n){return(t&&hh.hasOwnProperty(t.type)?hh[t.type]:dh)(t,n)};function wh(t,n,e){var r=w(t,n-zs,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function bh(t,n,e){var r=w(t,n-zs,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Mh(){var t,n,e,r,i,o,a,u,c,s,l,f,h=10,p=h,d=90,v=360,y=2.5;function g(){return{type:"MultiLineString",coordinates:_()}}function _(){return w(Ws(r/d)*d,e,d).map(l).concat(w(Ws(u/v)*v,a,v).map(f)).concat(w(Ws(n/h)*h,t,h).filter((function(t){return Vs(t%d)>zs})).map(c)).concat(w(Ws(o/p)*p,i,p).filter((function(t){return Vs(t%v)>zs})).map(s))}return g.lines=function(){return _().map((function(t){return{type:"LineString",coordinates:t}}))},g.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(a).slice(1),l(e).reverse().slice(1),f(u).reverse().slice(1))]}},g.extent=function(t){return arguments.length?g.extentMajor(t).extentMinor(t):g.extentMinor()},g.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),g.precision(y)):[[r,u],[e,a]]},g.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),g.precision(y)):[[n,o],[t,i]]},g.step=function(t){return arguments.length?g.stepMajor(t).stepMinor(t):g.stepMinor()},g.stepMajor=function(t){return arguments.length?(d=+t[0],v=+t[1],g):[d,v]},g.stepMinor=function(t){return arguments.length?(h=+t[0],p=+t[1],g):[h,p]},g.precision=function(h){return arguments.length?(y=+h,c=wh(o,i,90),s=bh(n,t,y),l=wh(u,a,90),f=bh(r,e,y),g):y},g.extentMajor([[-180,-90+zs],[180,90-zs]]).extentMinor([[-180,-80-zs],[180,80+zs]])}function kh(){return Mh()()}var Sh,Eh,Nh,Th,Ah=function(t,n){var e=t[0]*Hs,r=t[1]*Hs,i=n[0]*Hs,o=n[1]*Hs,a=Gs(r),u=Qs(r),c=Gs(o),s=Qs(o),l=a*Gs(e),f=a*Qs(e),h=c*Gs(i),p=c*Qs(i),d=2*rl(tl(il(o-r)+a*c*il(i-e))),v=Qs(d),y=d?function(t){var n=Qs(t*=d)/v,e=Qs(d-t)/v,r=e*l+n*h,i=e*f+n*p,o=e*u+n*s;return[Xs(i,r)*Bs,Xs(o,tl(r*r+i*i))*Bs]}:function(){return[e*Bs,r*Bs]};return y.distance=d,y},Ch=function(t){return t},Oh=Ps(),Ph=Ps(),Lh={point:ol,lineStart:ol,lineEnd:ol,polygonStart:function(){Lh.lineStart=Uh,Lh.lineEnd=Fh},polygonEnd:function(){Lh.lineStart=Lh.lineEnd=Lh.point=ol,Oh.add(Vs(Ph)),Ph.reset()},result:function(){var t=Oh/2;return Oh.reset(),t}};function Uh(){Lh.point=Dh}function Dh(t,n){Lh.point=zh,Sh=Nh=t,Eh=Th=n}function zh(t,n){Ph.add(Th*t-Nh*n),Nh=t,Th=n}function Fh(){zh(Sh,Eh)}var jh=1/0,Rh=jh,Ih=-jh,qh=Ih,Bh={point:Hh,lineStart:ol,lineEnd:ol,polygonStart:ol,polygonEnd:ol,result:function(){var t=[[jh,Rh],[Ih,qh]];return Ih=qh=-(Rh=jh=1/0),t}};function Hh(t,n){t<jh&&(jh=t),t>Ih&&(Ih=t),n<Rh&&(Rh=n),n>qh&&(qh=n)}var Vh,Yh,Xh,Gh,Wh=0,$h=0,Zh=0,Jh=0,Qh=0,Kh=0,tp=0,np=0,ep=0,rp={point:ip,lineStart:op,lineEnd:cp,polygonStart:function(){rp.lineStart=sp,rp.lineEnd=lp},polygonEnd:function(){rp.point=ip,rp.lineStart=op,rp.lineEnd=cp},result:function(){var t=ep?[tp/ep,np/ep]:Kh?[Jh/Kh,Qh/Kh]:Zh?[Wh/Zh,$h/Zh]:[NaN,NaN];return Wh=$h=Zh=Jh=Qh=Kh=tp=np=ep=0,t}};function ip(t,n){Wh+=t,$h+=n,++Zh}function op(){rp.point=ap}function ap(t,n){rp.point=up,ip(Xh=t,Gh=n)}function up(t,n){var e=t-Xh,r=n-Gh,i=tl(e*e+r*r);Jh+=i*(Xh+t)/2,Qh+=i*(Gh+n)/2,Kh+=i,ip(Xh=t,Gh=n)}function cp(){rp.point=ip}function sp(){rp.point=fp}function lp(){hp(Vh,Yh)}function fp(t,n){rp.point=hp,ip(Vh=Xh=t,Yh=Gh=n)}function hp(t,n){var e=t-Xh,r=n-Gh,i=tl(e*e+r*r);Jh+=i*(Xh+t)/2,Qh+=i*(Gh+n)/2,Kh+=i,i=Gh*t-Xh*n,tp+=i*(Xh+t),np+=i*(Gh+n),ep+=3*i,ip(Xh=t,Gh=n)}function pp(t){this._context=t}pp.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,qs);break}},result:ol};var dp,vp,yp,gp,_p,mp=Ps(),xp={point:ol,lineStart:function(){xp.point=wp},lineEnd:function(){dp&&bp(vp,yp),xp.point=ol},polygonStart:function(){dp=!0},polygonEnd:function(){dp=null},result:function(){var t=+mp;return mp.reset(),t}};function wp(t,n){xp.point=bp,vp=gp=t,yp=_p=n}function bp(t,n){gp-=t,_p-=n,mp.add(tl(gp*gp+_p*_p)),gp=t,_p=n}function Mp(){this._string=[]}function kp(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}Mp.prototype={_radius:4.5,_circle:kp(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=kp(this._radius)),this._string.push("M",t,",",n,this._circle);break}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}};var Sp=function(t,n){var e,r,i=4.5;function o(t){return t&&("function"===typeof i&&r.pointRadius(+i.apply(this,arguments)),yl(t,e(r))),r.result()}return o.area=function(t){return yl(t,e(Lh)),Lh.result()},o.measure=function(t){return yl(t,e(xp)),xp.result()},o.bounds=function(t){return yl(t,e(Bh)),Bh.result()},o.centroid=function(t){return yl(t,e(rp)),rp.result()},o.projection=function(n){return arguments.length?(e=null==n?(t=null,Ch):(t=n).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(n=null,new Mp):new pp(n=t),"function"!==typeof i&&r.pointRadius(i),o):n},o.pointRadius=function(t){return arguments.length?(i="function"===typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(n)},Ep=function(t,n,e,r){return function(i,o){var a,u,c,s=n(o),l=i.invert(r[0],r[1]),f=qf(),h=n(f),p=!1,d={point:v,lineStart:g,lineEnd:_,polygonStart:function(){d.point=m,d.lineStart=x,d.lineEnd=w,u=[],a=[]},polygonEnd:function(){d.point=v,d.lineStart=g,d.lineEnd=_,u=z(u);var t=nh(a,l);u.length?(p||(o.polygonStart(),p=!0),Yf(u,Tp,t,e,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),u=a=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function v(n,e){var r=i(n,e);t(n=r[0],e=r[1])&&o.point(n,e)}function y(t,n){var e=i(t,n);s.point(e[0],e[1])}function g(){d.point=y,s.lineStart()}function _(){d.point=v,s.lineEnd()}function m(t,n){c.push([t,n]);var e=i(t,n);h.point(e[0],e[1])}function x(){h.lineStart(),c=[]}function w(){m(c[0][0],c[0][1]),h.lineEnd();var t,n,e,r,i=h.clean(),s=f.result(),l=s.length;if(c.pop(),a.push(c),c=null,l)if(1&i){if(e=s[0],(n=e.length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<n;++t)o.point((r=e[t])[0],r[1]);o.lineEnd()}}else l>1&&2&i&&s.push(s.pop().concat(s.shift())),u.push(s.filter(Np))}return d}};function Np(t){return t.length>1}function Tp(t,n){return((t=t.x)[0]<0?t[1]-Rs-zs:Rs-t[1])-((n=n.x)[0]<0?n[1]-Rs-zs:Rs-n[1])}var Ap=Ep((function(){return!0}),Cp,Pp,[-js,-Rs]);function Cp(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?js:-js,c=Vs(o-e);Vs(c-js)<zs?(t.point(e,r=(r+a)/2>0?Rs:-Rs),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=js&&(Vs(e-i)<zs&&(e-=i*zs),Vs(o-u)<zs&&(o-=u*zs),r=Op(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}function Op(t,n,e,r){var i,o,a=Qs(t-e);return Vs(a)>zs?Ys((Qs(n)*(o=Gs(r))*Qs(e)-Qs(r)*(i=Gs(n))*Qs(t))/(i*o*a)):(n+r)/2}function Pp(t,n,e,r){var i;if(null==t)i=e*Rs,r.point(-js,i),r.point(0,i),r.point(js,i),r.point(js,0),r.point(js,-i),r.point(0,-i),r.point(-js,-i),r.point(-js,0),r.point(-js,i);else if(Vs(t[0]-n[0])>zs){var o=t[0]<n[0]?js:-js;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}var Lp=function(t,n){var e=Gs(t),r=e>0,i=Vs(e)>zs;function o(e,r,i,o){jf(o,t,n,i,e,r)}function a(t,n){return Gs(t)*Gs(n)>e}function u(t){var n,e,o,u,l;return{lineStart:function(){u=o=!1,l=1},point:function(f,h){var p,d=[f,h],v=a(f,h),y=r?v?0:s(f,h):v?s(f+(f<0?js:-js),h):0;if(!n&&(u=o=v)&&t.lineStart(),v!==o&&(p=c(n,d),(!p||Hf(n,p)||Hf(d,p))&&(d[0]+=zs,d[1]+=zs,v=a(d[0],d[1]))),v!==o)l=0,v?(t.lineStart(),p=c(d,n),t.point(p[0],p[1])):(p=c(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(i&&n&&r^v){var g;y&e||!(g=c(d,n,!0))||(l=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!v||n&&Hf(n,d)||t.point(d[0],d[1]),n=d,o=v,e=y},lineEnd:function(){o&&t.lineEnd(),n=null},clean:function(){return l|(u&&o)<<1}}}function c(t,n,r){var i=Ul(t),o=Ul(n),a=[1,0,0],u=zl(i,o),c=Dl(u,u),s=u[0],l=c-s*s;if(!l)return!r&&t;var f=e*c/l,h=-e*s/l,p=zl(a,u),d=jl(a,f),v=jl(u,h);Fl(d,v);var y=p,g=Dl(d,y),_=Dl(y,y),m=g*g-_*(Dl(d,d)-1);if(!(m<0)){var x=tl(m),w=jl(y,(-g-x)/_);if(Fl(w,d),w=Ll(w),!r)return w;var b,M=t[0],k=n[0],S=t[1],E=n[1];k<M&&(b=M,M=k,k=b);var N=k-M,T=Vs(N-js)<zs,A=T||N<zs;if(!T&&E<S&&(b=S,S=E,E=b),A?T?S+E>0^w[1]<(Vs(w[0]-M)<zs?S:E):S<=w[1]&&w[1]<=E:N>js^(M<=w[0]&&w[0]<=k)){var C=jl(y,(-g+x)/_);return Fl(C,d),[w,Ll(C)]}}}function s(n,e){var i=r?t:js-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Ep(a,u,o,r?[0,-t]:[-js,t-js])},Up=function(t){return{stream:Dp(t)}};function Dp(t){return function(n){var e=new zp;for(var r in t)e[r]=t[r];return e.stream=n,e}}function zp(){}function Fp(t,n,e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),yl(e,t.stream(Bh));var a=Bh.result(),u=Math.min(r/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),c=+n[0][0]+(r-u*(a[1][0]+a[0][0]))/2,s=+n[0][1]+(i-u*(a[1][1]+a[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*u).translate([c,s])}function jp(t,n,e){return Fp(t,[[0,0],n],e)}zp.prototype={constructor:zp,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Rp=16,Ip=Gs(30*Hs),qp=function(t,n){return+n?Hp(t,n):Bp(t)};function Bp(t){return Dp({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}function Hp(t,n){function e(r,i,o,a,u,c,s,l,f,h,p,d,v,y){var g=s-r,_=l-i,m=g*g+_*_;if(m>4*n&&v--){var x=a+h,w=u+p,b=c+d,M=tl(x*x+w*w+b*b),k=rl(b/=M),S=Vs(Vs(b)-1)<zs||Vs(o-f)<zs?(o+f)/2:Xs(w,x),E=t(S,k),N=E[0],T=E[1],A=N-r,C=T-i,O=_*A-g*C;(O*O/m>n||Vs((g*A+_*C)/m-.5)>.3||a*h+u*p+c*d<Ip)&&(e(r,i,o,a,u,c,N,T,S,x/=M,w/=M,b,v,y),y.point(N,T),e(N,T,S,x,w,b,s,l,f,h,p,d,v,y))}}return function(n){var r,i,o,a,u,c,s,l,f,h,p,d,v={point:y,lineStart:g,lineEnd:m,polygonStart:function(){n.polygonStart(),v.lineStart=x},polygonEnd:function(){n.polygonEnd(),v.lineStart=g}};function y(e,r){e=t(e,r),n.point(e[0],e[1])}function g(){l=NaN,v.point=_,n.lineStart()}function _(r,i){var o=Ul([r,i]),a=t(r,i);e(l,f,s,h,p,d,l=a[0],f=a[1],s=r,h=o[0],p=o[1],d=o[2],Rp,n),n.point(l,f)}function m(){v.point=y,n.lineEnd()}function x(){g(),v.point=w,v.lineEnd=b}function w(t,n){_(r=t,n),i=l,o=f,a=h,u=p,c=d,v.point=_}function b(){e(l,f,s,h,p,d,i,o,r,a,u,c,Rp,n),v.lineEnd=m,m()}return v}}var Vp=Dp({point:function(t,n){this.stream.point(t*Hs,n*Hs)}});function Yp(t){return Xp((function(){return t}))()}function Xp(t){var n,e,r,i,o,a,u,c,s,l,f=150,h=480,p=250,d=0,v=0,y=0,g=0,_=0,m=null,x=Ap,w=null,b=Ch,M=.5,k=qp(N,M);function S(t){return t=o(t[0]*Hs,t[1]*Hs),[t[0]*f+e,r-t[1]*f]}function E(t){return t=o.invert((t[0]-e)/f,(r-t[1])/f),t&&[t[0]*Bs,t[1]*Bs]}function N(t,i){return t=n(t,i),[t[0]*f+e,r-t[1]*f]}function T(){o=Of(i=Lf(y,g,_),n);var t=n(d,v);return e=h-t[0]*f,r=p+t[1]*f,A()}function A(){return s=l=null,S}return S.stream=function(t){return s&&l===t?s:s=Vp(x(i,k(b(l=t))))},S.clipAngle=function(t){return arguments.length?(x=+t?Lp(m=t*Hs,6*Hs):(m=null,Ap),A()):m*Bs},S.clipExtent=function(t){return arguments.length?(b=null==t?(w=a=u=c=null,Ch):$f(w=+t[0][0],a=+t[0][1],u=+t[1][0],c=+t[1][1]),A()):null==w?null:[[w,a],[u,c]]},S.scale=function(t){return arguments.length?(f=+t,T()):f},S.translate=function(t){return arguments.length?(h=+t[0],p=+t[1],T()):[h,p]},S.center=function(t){return arguments.length?(d=t[0]%360*Hs,v=t[1]%360*Hs,T()):[d*Bs,v*Bs]},S.rotate=function(t){return arguments.length?(y=t[0]%360*Hs,g=t[1]%360*Hs,_=t.length>2?t[2]%360*Hs:0,T()):[y*Bs,g*Bs,_*Bs]},S.precision=function(t){return arguments.length?(k=qp(N,M=t*t),A()):tl(M)},S.fitExtent=function(t,n){return Fp(S,t,n)},S.fitSize=function(t,n){return jp(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&E,T()}}function Gp(t){var n=0,e=js/3,r=Xp(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Hs,e=t[1]*Hs):[n*Bs,e*Bs]},i}function Wp(t){var n=Gs(t);function e(t,e){return[t*n,Qs(e)/n]}return e.invert=function(t,e){return[t/n,rl(e*n)]},e}function $p(t,n){var e=Qs(t),r=(e+Qs(n))/2;if(Vs(r)<zs)return Wp(t);var i=1+e*(2*r-e),o=tl(i)/r;function a(t,n){var e=tl(i-2*r*Qs(n))/r;return[e*Qs(t*=r),o-e*Gs(t)]}return a.invert=function(t,n){var e=o-n;return[Xs(t,Vs(e))/r*Ks(e),rl((i-(t*t+e*e)*r*r)/(2*r))]},a}var Zp=function(){return Gp($p).scale(155.424).center([0,33.6442])},Jp=function(){return Zp().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function Qp(t){var n=t.length;return{point:function(e,r){var i=-1;while(++i<n)t[i].point(e,r)},sphere:function(){var e=-1;while(++e<n)t[e].sphere()},lineStart:function(){var e=-1;while(++e<n)t[e].lineStart()},lineEnd:function(){var e=-1;while(++e<n)t[e].lineEnd()},polygonStart:function(){var e=-1;while(++e<n)t[e].polygonStart()},polygonEnd:function(){var e=-1;while(++e<n)t[e].polygonEnd()}}}var Kp=function(){var t,n,e,r,i,o,a=Jp(),u=Zp().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=Zp().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,n){o=[t,n]}};function l(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function f(){return t=n=null,l}return l.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},l.stream=function(e){return t&&n===e?t:t=Qp([a.stream(n=e),u.stream(e),c.stream(e)])},l.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),c.precision(t),f()):a.precision()},l.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),c.scale(t),l.translate(a.translate())):a.scale()},l.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],l=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,l-.238*n],[o+.455*n,l+.238*n]]).stream(s),r=u.translate([o-.307*n,l+.201*n]).clipExtent([[o-.425*n+zs,l+.12*n+zs],[o-.214*n-zs,l+.234*n-zs]]).stream(s),i=c.translate([o-.205*n,l+.212*n]).clipExtent([[o-.214*n+zs,l+.166*n+zs],[o-.115*n-zs,l+.234*n-zs]]).stream(s),f()},l.fitExtent=function(t,n){return Fp(l,t,n)},l.fitSize=function(t,n){return jp(l,t,n)},l.scale(1070)};function td(t){return function(n,e){var r=Gs(n),i=Gs(e),o=t(r*i);return[o*i*Qs(n),o*Qs(e)]}}function nd(t){return function(n,e){var r=tl(n*n+e*e),i=t(r),o=Qs(i),a=Gs(i);return[Xs(n*o,r*a),rl(r&&e*o/r)]}}var ed=td((function(t){return tl(2/(1+t))}));ed.invert=nd((function(t){return 2*rl(t/2)}));var rd=function(){return Yp(ed).scale(124.75).clipAngle(179.999)},id=td((function(t){return(t=el(t))&&t/Qs(t)}));id.invert=nd((function(t){return t}));var od=function(){return Yp(id).scale(79.4188).clipAngle(179.999)};function ad(t,n){return[t,Zs(nl((Rs+n)/2))]}ad.invert=function(t,n){return[t,2*Ys($s(n))-Rs]};var ud=function(){return cd(ad).scale(961/qs)};function cd(t){var n,e,r,i=Yp(t),o=i.center,a=i.scale,u=i.translate,c=i.clipExtent,s=null;function l(){var o=js*a(),u=i(Ff(i.rotate()).invert([0,0]));return c(null==s?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===ad?[[Math.max(u[0]-o,s),n],[Math.min(u[0]+o,e),r]]:[[s,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),l()):a()},i.translate=function(t){return arguments.length?(u(t),l()):u()},i.center=function(t){return arguments.length?(o(t),l()):o()},i.clipExtent=function(t){return arguments.length?(null==t?s=n=e=r=null:(s=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),l()):null==s?null:[[s,n],[e,r]]},l()}function sd(t){return nl((Rs+t)/2)}function ld(t,n){var e=Gs(t),r=t===n?Qs(t):Zs(e/Gs(n))/Zs(sd(n)/sd(t)),i=e*Js(sd(t),r)/r;if(!r)return ad;function o(t,n){i>0?n<-Rs+zs&&(n=-Rs+zs):n>Rs-zs&&(n=Rs-zs);var e=i/Js(sd(n),r);return[e*Qs(r*t),i-e*Gs(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ks(r)*tl(t*t+e*e);return[Xs(t,Vs(e))/r*Ks(e),2*Ys(Js(i/o,1/r))-Rs]},o}var fd=function(){return Gp(ld).scale(109.5).parallels([30,30])};function hd(t,n){return[t,n]}hd.invert=hd;var pd=function(){return Yp(hd).scale(152.63)};function dd(t,n){var e=Gs(t),r=t===n?Qs(t):(e-Gs(n))/(n-t),i=e/r+t;if(Vs(r)<zs)return hd;function o(t,n){var e=i-n,o=r*t;return[e*Qs(o),i-e*Gs(o)]}return o.invert=function(t,n){var e=i-n;return[Xs(t,Vs(e))/r*Ks(e),i-Ks(r)*tl(t*t+e*e)]},o}var vd=function(){return Gp(dd).scale(131.154).center([0,13.9389])};function yd(t,n){var e=Gs(n),r=Gs(t)*e;return[e*Qs(t)/r,Qs(n)/r]}yd.invert=nd(Ys);var gd=function(){return Yp(yd).scale(144.049).clipAngle(60)};function _d(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?Ch:Dp({point:function(i,o){this.stream.point(i*t+e,o*n+r)}})}var md=function(){var t,n,e,r,i,o,a=1,u=0,c=0,s=1,l=1,f=Ch,h=null,p=Ch;function d(){return r=i=null,o}return o={stream:function(t){return r&&i===t?r:r=f(p(i=t))},clipExtent:function(r){return arguments.length?(p=null==r?(h=t=n=e=null,Ch):$f(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),d()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(f=_d((a=+t)*s,a*l,u,c),d()):a},translate:function(t){return arguments.length?(f=_d(a*s,a*l,u=+t[0],c=+t[1]),d()):[u,c]},reflectX:function(t){return arguments.length?(f=_d(a*(s=t?-1:1),a*l,u,c),d()):s<0},reflectY:function(t){return arguments.length?(f=_d(a*s,a*(l=t?-1:1),u,c),d()):l<0},fitExtent:function(t,n){return Fp(o,t,n)},fitSize:function(t,n){return jp(o,t,n)}}};function xd(t,n){return[Gs(n)*Qs(t),Qs(n)]}xd.invert=nd(rl);var wd=function(){return Yp(xd).scale(249.5).clipAngle(90+zs)};function bd(t,n){var e=Gs(n),r=1+Gs(t)*e;return[e*Qs(t)/r,Qs(n)/r]}bd.invert=nd((function(t){return 2*Ys(t)}));var Md=function(){return Yp(bd).scale(250).clipAngle(142)};function kd(t,n){return[Zs(nl((Rs+n)/2)),-t]}kd.invert=function(t,n){return[-n,2*Ys($s(t))-Rs]};var Sd=function(){var t=cd(kd),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):(t=n(),[t[1],-t[0]])},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90]).scale(159.155)};function Ed(t,n){return t.parent===n.parent?1:2}function Nd(t){return t.reduce(Td,0)/t.length}function Td(t,n){return t+n.x}function Ad(t){return 1+t.reduce(Cd,0)}function Cd(t,n){return Math.max(t,n.y)}function Od(t){var n;while(n=t.children)t=n[0];return t}function Pd(t){var n;while(n=t.children)t=n[n.length-1];return t}var Ld=function(){var t=Ed,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=Nd(e),n.y=Ad(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=Od(i),c=Pd(i),s=u.x-t(u,c)/2,l=c.x+t(c,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-s)/(l-s)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i};function Ud(t){var n=0,e=t.children,r=e&&e.length;if(r)while(--r>=0)n+=e[r].value;else n=1;t.value=n}var Dd=function(){return this.eachAfter(Ud)},zd=function(t){var n,e,r,i,o=this,a=[o];do{n=a.reverse(),a=[];while(o=n.pop())if(t(o),e=o.children,e)for(r=0,i=e.length;r<i;++r)a.push(e[r])}while(a.length);return this},Fd=function(t){var n,e,r=this,i=[r];while(r=i.pop())if(t(r),n=r.children,n)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},jd=function(t){var n,e,r,i=this,o=[i],a=[];while(i=o.pop())if(a.push(i),n=i.children,n)for(e=0,r=n.length;e<r;++e)o.push(n[e]);while(i=a.pop())t(i);return this},Rd=function(t){return this.eachAfter((function(n){var e=+t(n.data)||0,r=n.children,i=r&&r.length;while(--i>=0)e+=r[i].value;n.value=e}))},Id=function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},qd=function(t){var n=this,e=Bd(n,t),r=[n];while(n!==e)n=n.parent,r.push(n);var i=r.length;while(t!==e)r.splice(i,0,t),t=t.parent;return r};function Bd(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();while(t===n)i=t,t=e.pop(),n=r.pop();return i}var Hd=function(){var t=this,n=[t];while(t=t.parent)n.push(t);return n},Vd=function(){var t=[];return this.each((function(n){t.push(n)})),t},Yd=function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},Xd=function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n};function Gd(t,n){var e,r,i,o,a,u=new Qd(t),c=+t.value&&(u.value=t.value),s=[u];null==n&&(n=$d);while(e=s.pop())if(c&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)s.push(r=e.children[o]=new Qd(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(Jd)}function Wd(){return Gd(this).eachBefore(Zd)}function $d(t){return t.children}function Zd(t){t.data=t.data.data}function Jd(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Qd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Kd(t){this._=t,this.next=null}Qd.prototype=Gd.prototype={constructor:Qd,count:Dd,each:zd,eachAfter:jd,eachBefore:Fd,sum:Rd,sort:Id,path:qd,ancestors:Hd,descendants:Vd,leaves:Yd,links:Xd,copy:Wd};var tv=function(t){var n,e=(t=t.slice()).length,r=null,i=r;while(e){var o=new Kd(t[e-1]);i=i?i.next=o:r=o,t[n]=t[--e]}return{head:r,tail:i}},nv=function(t){return rv(tv(t),[])};function ev(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r-n.r;return i*i+1e-6>e*e+r*r}function rv(t,n){var e,r,i,o=null,a=t.head;switch(n.length){case 1:e=iv(n[0]);break;case 2:e=ov(n[0],n[1]);break;case 3:e=av(n[0],n[1],n[2]);break}while(a)i=a._,r=a.next,e&&ev(e,i)?o=a:(o?(t.tail=o,o.next=null):t.head=t.tail=null,n.push(i),e=rv(t,n),n.pop(),t.head?(a.next=t.head,t.head=a):(a.next=null,t.head=t.tail=a),o=t.tail,o.next=r),a=r;return t.tail=o,e}function iv(t){return{x:t.x,y:t.y,r:t.r}}function ov(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,c=o-e,s=a-r,l=u-i,f=Math.sqrt(c*c+s*s);return{x:(e+o+c/f*l)/2,y:(r+a+s/f*l)/2,r:(f+i+u)/2}}function av(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,c=n.r,s=e.x,l=e.y,f=e.r,h=2*(r-a),p=2*(i-u),d=2*(c-o),v=r*r+i*i-o*o-a*a-u*u+c*c,y=2*(r-s),g=2*(i-l),_=2*(f-o),m=r*r+i*i-o*o-s*s-l*l+f*f,x=y*p-h*g,w=(p*m-g*v)/x-r,b=(g*d-p*_)/x,M=(y*v-h*m)/x-i,k=(h*_-y*d)/x,S=b*b+k*k-1,E=2*(w*b+M*k+o),N=w*w+M*M-o*o,T=(-E-Math.sqrt(E*E-4*S*N))/(2*S);return{x:w+b*T+r,y:M+k*T+i,r:T}}function uv(t,n,e){var r=t.x,i=t.y,o=n.r+e.r,a=t.r+e.r,u=n.x-r,c=n.y-i,s=u*u+c*c;if(s){var l=.5+((a*=a)-(o*=o))/(2*s),f=Math.sqrt(Math.max(0,2*o*(a+s)-(a-=s)*a-o*o))/(2*s);e.x=r+l*u+f*c,e.y=i+l*c-f*u}else e.x=r+a,e.y=i}function cv(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-1e-6>e*e+r*r}function sv(t,n,e){var r=t._,i=t.next._,o=r.r+i.r,a=(r.x*i.r+i.x*r.r)/o-n,u=(r.y*i.r+i.y*r.r)/o-e;return a*a+u*u}function lv(t){this._=t,this.next=null,this.previous=null}function fv(t){if(!(i=t.length))return 0;var n,e,r,i;if(n=t[0],n.x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;uv(e,n,r=t[2]);var o,a,u,c,s,l,f,h=n.r*n.r,p=e.r*e.r,d=r.r*r.r,v=h+p+d,y=h*n.x+p*e.x+d*r.x,g=h*n.y+p*e.y+d*r.y;n=new lv(n),e=new lv(e),r=new lv(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;u<i;++u){uv(n._,e._,r=t[u]),r=new lv(r),c=e.next,s=n.previous,l=e._.r,f=n._.r;do{if(l<=f){if(cv(c._,r._)){e=c,n.next=e,e.previous=n,--u;continue t}l+=c._.r,c=c.next}else{if(cv(s._,r._)){n=s,n.next=e,e.previous=n,--u;continue t}f+=s._.r,s=s.previous}}while(c!==s.next);r.previous=n,r.next=e,n.next=e.previous=e=r,v+=d=r._.r*r._.r,y+=d*r._.x,g+=d*r._.y,h=sv(n,o=y/v,a=g/v);while((r=r.next)!==e)(d=sv(r,o,a))<h&&(n=r,h=d);e=n.next}n=[e._],r=e;while((r=r.next)!==e)n.push(r._);for(r=nv(n),u=0;u<i;++u)n=t[u],n.x-=r.x,n.y-=r.y;return r.r}var hv=function(t){return fv(t),t};function pv(t){return null==t?null:dv(t)}function dv(t){if("function"!==typeof t)throw new Error;return t}function vv(){return 0}var yv=function(t){return function(){return t}};function gv(t){return Math.sqrt(t.value)}var _v=function(){var t=null,n=1,e=1,r=vv;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(mv(t)).eachAfter(xv(r,.5)).eachBefore(wv(1)):i.eachBefore(mv(gv)).eachAfter(xv(vv,1)).eachAfter(xv(r,i.r/Math.min(n,e))).eachBefore(wv(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=pv(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"===typeof t?t:yv(+t),i):r},i};function mv(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function xv(t,n){return function(e){if(r=e.children){var r,i,o,a=r.length,u=t(e)*n||0;if(u)for(i=0;i<a;++i)r[i].r+=u;if(o=fv(r),u)for(i=0;i<a;++i)r[i].r-=u;e.r=o+u}}}function wv(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}var bv=function(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)},Mv=function(t,n,e,r,i){var o,a=t.children,u=-1,c=a.length,s=t.value&&(r-n)/t.value;while(++u<c)o=a[u],o.y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*s},kv=function(){var t=1,n=1,e=0,r=!1;function i(i){var a=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/a,i.eachBefore(o(n,a)),r&&i.eachBefore(bv),i}function o(t,n){return function(r){r.children&&Mv(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},Sv="$",Ev={depth:-1},Nv={};function Tv(t){return t.id}function Av(t){return t.parentId}var Cv=function(){var t=Tv,n=Av;function e(e){var r,i,o,a,u,c,s,l=e.length,f=new Array(l),h={};for(i=0;i<l;++i)r=e[i],u=f[i]=new Qd(r),null!=(c=t(r,i,e))&&(c+="")&&(s=Sv+(u.id=c),h[s]=s in h?Nv:u);for(i=0;i<l;++i)if(u=f[i],c=n(e[i],i,e),null!=c&&(c+="")){if(a=h[Sv+c],!a)throw new Error("missing: "+c);if(a===Nv)throw new Error("ambiguous: "+c);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(o)throw new Error("multiple roots");o=u}if(!o)throw new Error("no root");if(o.parent=Ev,o.eachBefore((function(t){t.depth=t.parent.depth+1,--l})).eachBefore(Jd),o.parent=null,l>0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=dv(n),e):t},e.parentId=function(t){return arguments.length?(n=dv(t),e):n},e};function Ov(t,n){return t.parent===n.parent?1:2}function Pv(t){var n=t.children;return n?n[0]:t.t}function Lv(t){var n=t.children;return n?n[n.length-1]:t.t}function Uv(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Dv(t){var n,e=0,r=0,i=t.children,o=i.length;while(--o>=0)n=i[o],n.z+=e,n.m+=e,e+=n.s+(r+=n.c)}function zv(t,n,e){return t.a.parent===n.parent?t.a:e}function Fv(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function jv(t){var n,e,r,i,o,a=new Fv(t,0),u=[a];while(n=u.pop())if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Fv(r[i],i)),e.parent=n;return(a.parent=new Fv(null,0)).children=[a],a}Fv.prototype=Object.create(Qd.prototype);var Rv=function(){var t=Ov,n=1,e=1,r=null;function i(i){var u=jv(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(c);else{var s=i,l=i,f=i;i.eachBefore((function(t){t.x<s.x&&(s=t),t.x>l.x&&(l=t),t.depth>f.depth&&(f=t)}));var h=s===l?1:t(s,l)/2,p=h-s.x,d=n/(l.x+h+p),v=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+p)*d,t.y=t.depth*v}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){Dv(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=u(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(n,e,r){if(e){var i,o=n,a=n,u=e,c=o.parent.children[0],s=o.m,l=a.m,f=u.m,h=c.m;while(u=Lv(u),o=Pv(o),u&&o)c=Pv(c),a=Lv(a),a.a=n,i=u.z+f-o.z-s+t(u._,o._),i>0&&(Uv(zv(u,n,r),n,i),s+=i,l+=i),f+=u.m,s+=o.m,h+=c.m,l+=a.m;u&&!Lv(a)&&(a.t=u,a.m+=f-l),o&&!Pv(c)&&(c.t=o,c.m+=s-h,r=n)}return r}function c(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},Iv=function(t,n,e,r,i){var o,a=t.children,u=-1,c=a.length,s=t.value&&(i-e)/t.value;while(++u<c)o=a[u],o.x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*s},qv=(1+Math.sqrt(5))/2;function Bv(t,n,e,r,i,o){var a,u,c,s,l,f,h,p,d,v,y,g=[],_=n.children,m=0,x=0,w=_.length,b=n.value;while(m<w){c=i-e,s=o-r;do{l=_[x++].value}while(!l&&x<w);for(f=h=l,v=Math.max(s/c,c/s)/(b*t),y=l*l*v,d=Math.max(h/y,y/f);x<w;++x){if(l+=u=_[x].value,u<f&&(f=u),u>h&&(h=u),y=l*l*v,p=Math.max(h/y,y/f),p>d){l-=u;break}d=p}g.push(a={value:l,dice:c<s,children:_.slice(m,x)}),a.dice?Mv(a,e,r,i,b?r+=s*l/b:o):Iv(a,e,r,b?e+=c*l/b:i,o),b-=l,m=x}return g}var Hv=function t(n){function e(t,e,r,i,o){Bv(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(qv),Vv=function(){var t=Hv,n=!1,e=1,r=1,i=[0],o=vv,a=vv,u=vv,c=vv,s=vv;function l(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(bv),t}function f(n){var e=i[n.depth],r=n.x0+e,l=n.y0+e,f=n.x1-e,h=n.y1-e;f<r&&(r=f=(r+f)/2),h<l&&(l=h=(l+h)/2),n.x0=r,n.y0=l,n.x1=f,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=s(n)-e,l+=a(n)-e,f-=u(n)-e,h-=c(n)-e,f<r&&(r=f=(r+f)/2),h<l&&(l=h=(l+h)/2),t(n,r,l,f,h))}return l.round=function(t){return arguments.length?(n=!!t,l):n},l.size=function(t){return arguments.length?(e=+t[0],r=+t[1],l):[e,r]},l.tile=function(n){return arguments.length?(t=dv(n),l):t},l.padding=function(t){return arguments.length?l.paddingInner(t).paddingOuter(t):l.paddingInner()},l.paddingInner=function(t){return arguments.length?(o="function"===typeof t?t:yv(+t),l):o},l.paddingOuter=function(t){return arguments.length?l.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):l.paddingTop()},l.paddingTop=function(t){return arguments.length?(a="function"===typeof t?t:yv(+t),l):a},l.paddingRight=function(t){return arguments.length?(u="function"===typeof t?t:yv(+t),l):u},l.paddingBottom=function(t){return arguments.length?(c="function"===typeof t?t:yv(+t),l):c},l.paddingLeft=function(t){return arguments.length?(s="function"===typeof t?t:yv(+t),l):s},l},Yv=function(t,n,e,r,i){var o,a,u=t.children,c=u.length,s=new Array(c+1);for(s[0]=a=o=0;o<c;++o)s[o+1]=a+=u[o].value;function l(t,n,e,r,i,o,a){if(t>=n-1){var c=u[t];return c.x0=r,c.y0=i,c.x1=o,void(c.y1=a)}var f=s[t],h=e/2+f,p=t+1,d=n-1;while(p<d){var v=p+d>>>1;s[v]<h?p=v+1:d=v}h-s[p-1]<s[p]-h&&t+1<p&&--p;var y=s[p]-f,g=e-y;if(o-r>a-i){var _=(r*g+o*y)/e;l(t,p,y,r,i,_,a),l(p,n,g,_,i,o,a)}else{var m=(i*g+a*y)/e;l(t,p,y,r,i,o,m),l(p,n,g,r,m,o,a)}}l(0,c,t.value,n,e,r,i)},Xv=function(t,n,e,r,i){(1&t.depth?Iv:Mv)(t,n,e,r,i)},Gv=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n){var a,u,c,s,l,f=-1,h=a.length,p=t.value;while(++f<h){for(u=a[f],c=u.children,s=u.value=0,l=c.length;s<l;++s)u.value+=c[s].value;u.dice?Mv(u,e,r,i,r+=(o-r)*u.value/p):Iv(u,e,r,e+=(i-e)*u.value/p,o),p-=u.value}}else t._squarify=a=Bv(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(qv),Wv=function(t){var n,e=-1,r=t.length,i=t[r-1],o=0;while(++e<r)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},$v=function(t){var n,e,r=-1,i=t.length,o=0,a=0,u=t[i-1],c=0;while(++r<i)n=u,u=t[r],c+=e=n[0]*u[1]-u[0]*n[1],o+=(n[0]+u[0])*e,a+=(n[1]+u[1])*e;return c*=3,[o/c,a/c]},Zv=function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])};function Jv(t,n){return t[0]-n[0]||t[1]-n[1]}function Qv(t){for(var n=t.length,e=[0,1],r=2,i=2;i<n;++i){while(r>1&&Zv(t[e[r-2]],t[e[r-1]],t[i])<=0)--r;e[r++]=i}return e.slice(0,r)}var Kv=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort(Jv),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=Qv(r),a=Qv(i),u=a[0]===o[0],c=a[a.length-1]===o[o.length-1],s=[];for(n=o.length-1;n>=0;--n)s.push(t[r[o[n]][2]]);for(n=+u;n<a.length-c;++n)s.push(t[r[a[n]][2]]);return s},ty=function(t,n){for(var e,r,i=t.length,o=t[i-1],a=n[0],u=n[1],c=o[0],s=o[1],l=!1,f=0;f<i;++f)o=t[f],e=o[0],r=o[1],r>u!==s>u&&a<(c-e)*(u-r)/(s-r)+e&&(l=!l),c=e,s=r;return l},ny=function(t){var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],c=0;while(++r<i)n=a,e=u,o=t[r],a=o[0],u=o[1],n-=a,e-=u,c+=Math.sqrt(n*n+e*e);return c},ey=[].slice,ry={};function iy(t){this._size=t,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}function oy(t){if(!t._start)try{ay(t)}catch(n){if(t._tasks[t._ended+t._active-1])cy(t,n);else if(!t._data)throw n}}function ay(t){while(t._start=t._waiting&&t._active<t._size){var n=t._ended+t._active,e=t._tasks[n],r=e.length-1,i=e[r];e[r]=uy(t,n),--t._waiting,++t._active,e=i.apply(null,e),t._tasks[n]&&(t._tasks[n]=e||ry)}}function uy(t,n){return function(e,r){t._tasks[n]&&(--t._active,++t._ended,t._tasks[n]=null,null==t._error&&(null!=e?cy(t,e):(t._data[n]=r,t._waiting?oy(t):sy(t))))}}function cy(t,n){var e,r=t._tasks.length;t._error=n,t._data=void 0,t._waiting=NaN;while(--r>=0)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(n){}t._active=NaN,sy(t)}function sy(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function ly(t){if(null==t)t=1/0;else if(!((t=+t)>=1))throw new Error("invalid concurrency");return new iy(t)}iy.prototype=ly.prototype={constructor:iy,defer:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(null!=this._error)return this;var n=ey.call(arguments,1);return n.push(t),++this._waiting,this._tasks.push(n),oy(this),this},abort:function(){return null==this._error&&cy(this,new Error("abort")),this},await:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(n,e){t.apply(null,[n].concat(e))},sy(this),this},awaitAll:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=t,sy(this),this}};var fy=function(){return Math.random()},hy=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(fy),py=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(fy),dy=function t(n){function e(){var t=py.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(fy),vy=function t(n){function e(t){return function(){for(var e=0,r=0;r<t;++r)e+=n();return e}}return e.source=t,e}(fy),yy=function t(n){function e(t){var e=vy.source(n)(t);return function(){return e()/t}}return e.source=t,e}(fy),gy=function t(n){function e(t){return function(){return-Math.log(1-n())/t}}return e.source=t,e}(fy),_y=function(t,n){var e,r,i,o,a=ct("beforesend","progress","load","error"),u=nc(),c=new XMLHttpRequest,s=null,l=null,f=0;function h(t){var n,r=c.status;if(!r&&xy(c)||r>=200&&r<300||304===r){if(i)try{n=i.call(e,c)}catch(o){return void a.call("error",e,o)}else n=c;a.call("load",e,n)}else a.call("error",e,t)}if("undefined"!==typeof XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=c.ontimeout=h:c.onreadystatechange=function(t){c.readyState>3&&h(t)},c.onprogress=function(t){a.call("progress",e,t)},e={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?u.get(t):(null==n?u.remove(t):u.set(t,n+""),e)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",e):r},responseType:function(t){return arguments.length?(o=t,e):o},timeout:function(t){return arguments.length?(f=+t,e):f},user:function(t){return arguments.length<1?s:(s=null==t?null:t+"",e)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",e)},response:function(t){return i=t,e},get:function(t,n){return e.send("GET",t,n)},post:function(t,n){return e.send("POST",t,n)},send:function(n,i,h){return c.open(n,t,!0,s,l),null==r||u.has("accept")||u.set("accept",r+",*/*"),c.setRequestHeader&&u.each((function(t,n){c.setRequestHeader(n,t)})),null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=o&&(c.responseType=o),f>0&&(c.timeout=f),null==h&&"function"===typeof i&&(h=i,i=null),null!=h&&1===h.length&&(h=my(h)),null!=h&&e.on("error",h).on("load",(function(t){h(null,t)})),a.call("beforesend",e,c),c.send(null==i?null:i),e},abort:function(){return c.abort(),e},on:function(){var t=a.on.apply(a,arguments);return t===a?e:t}},null!=n){if("function"!==typeof n)throw new Error("invalid callback: "+n);return e.get(n)}return e};function my(t){return function(n,e){t(null==n?e:null)}}function xy(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}var wy=function(t,n){return function(e,r){var i=_y(e).mimeType(t).response(n);if(null!=r){if("function"!==typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}},by=wy("text/html",(function(t){return document.createRange().createContextualFragment(t.responseText)})),My=wy("application/json",(function(t){return JSON.parse(t.responseText)})),ky=wy("text/plain",(function(t){return t.responseText})),Sy=wy("application/xml",(function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n})),Ey=function(t,n){return function(e,r,i){arguments.length<3&&(i=r,r=null);var o=_y(e).mimeType(t);return o.row=function(t){return arguments.length?o.response(Ny(n,r=t)):r},o.row(r),i?o.get(i):o}};function Ny(t,n){return function(e){return t(e.responseText,n)}}var Ty=Ey("text/csv",_c),Ay=Ey("text/tab-separated-values",Mc),Cy=Array.prototype,Oy=Cy.map,Py=Cy.slice,Ly={name:"implicit"};function Uy(t){var n=nc(),e=[],r=Ly;function i(i){var o=i+"",a=n.get(o);if(!a){if(r!==Ly)return r;n.set(o,a=e.push(i))}return t[(a-1)%t.length]}return t=null==t?[]:Py.call(t),i.domain=function(t){if(!arguments.length)return e.slice();e=[],n=nc();var r,o,a=-1,u=t.length;while(++a<u)n.has(o=(r=t[a])+"")||n.set(o,e.push(r));return i},i.range=function(n){return arguments.length?(t=Py.call(n),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Uy().domain(e).range(t).unknown(r)},i}function Dy(){var t,n,e=Uy().unknown(void 0),r=e.domain,i=e.range,o=[0,1],a=!1,u=0,c=0,s=.5;function l(){var e=r().length,l=o[1]<o[0],f=o[l-0],h=o[1-l];t=(h-f)/Math.max(1,e-u+2*c),a&&(t=Math.floor(t)),f+=(h-f-t*(e-u))*s,n=t*(1-u),a&&(f=Math.round(f),n=Math.round(n));var p=w(e).map((function(n){return f+t*n}));return i(l?p.reverse():p)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),l()):r()},e.range=function(t){return arguments.length?(o=[+t[0],+t[1]],l()):o.slice()},e.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,l()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(a=!!t,l()):a},e.padding=function(t){return arguments.length?(u=c=Math.max(0,Math.min(1,t)),l()):u},e.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),l()):u},e.paddingOuter=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),l()):c},e.align=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),l()):s},e.copy=function(){return Dy().domain(r()).range(o).round(a).paddingInner(u).paddingOuter(c).align(s)},l()}function zy(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return zy(n())},t}function Fy(){return zy(Dy().paddingInner(1))}var jy=function(t){return function(){return t}},Ry=function(t){return+t},Iy=[0,1];function qy(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:jy(n)}function By(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}function Hy(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function Vy(t,n,e,r){var i=t[0],o=t[1],a=n[0],u=n[1];return o<i?(i=e(o,i),a=r(u,a)):(i=e(i,o),a=r(a,u)),function(t){return a(i(t))}}function Yy(t,n,e,r){var i=Math.min(t.length,n.length)-1,o=new Array(i),u=new Array(i),c=-1;t[i]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());while(++c<i)o[c]=e(t[c],t[c+1]),u[c]=r(n[c],n[c+1]);return function(n){var e=a(t,n,1,i)-1;return u[e](o[e](n))}}function Xy(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function Gy(t,n){var e,r,i,o=Iy,a=Iy,u=Kr,c=!1;function s(){return e=Math.min(o.length,a.length)>2?Yy:Vy,r=i=null,l}function l(n){return(r||(r=e(o,a,c?By(t):t,u)))(+n)}return l.invert=function(t){return(i||(i=e(a,o,qy,c?Hy(n):n)))(+t)},l.domain=function(t){return arguments.length?(o=Oy.call(t,Ry),s()):o.slice()},l.range=function(t){return arguments.length?(a=Py.call(t),s()):a.slice()},l.rangeRound=function(t){return a=Py.call(t),u=ti,s()},l.clamp=function(t){return arguments.length?(c=!!t,s()):c},l.interpolate=function(t){return arguments.length?(u=t,s()):u},s()}var Wy=function(n,e,r){var i,o=n[0],a=n[n.length-1],u=N(o,a,null==e?10:e);switch(r=bs(null==r?",f":r),r.type){case"s":var c=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(i=Cs(u,c))||(r.precision=i),t.formatPrefix(r,c);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Os(u,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=As(u))||(r.precision=i-2*("%"===r.type));break}return t.format(r)};function $y(t){var n=t.domain;return t.ticks=function(t){var e=n();return S(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Wy(n(),t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),o=0,a=i.length-1,u=i[o],c=i[a];return c<u&&(r=u,u=c,c=r,r=o,o=a,a=r),r=E(u,c,e),r>0?(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,r=E(u,c,e)):r<0&&(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,r=E(u,c,e)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(c/r)*r,n(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(c*r)/r,n(i)),t},t}function Zy(){var t=Gy(qy,Br);return t.copy=function(){return Xy(t,Zy())},$y(t)}function Jy(){var t=[0,1];function n(t){return+t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=Oy.call(e,Ry),n):t.slice()},n.copy=function(){return Jy().domain(t)},$y(n)}var Qy=function(t,n){t=t.slice();var e,r=0,i=t.length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t};function Ky(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:jy(n)}function tg(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function ng(t){return isFinite(t)?+("1e"+t):t<0?0:t}function eg(t){return 10===t?ng:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function rg(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function ig(t){return function(n){return-t(-n)}}function og(){var n=Gy(Ky,tg).domain([1,10]),e=n.domain,r=10,i=rg(10),o=eg(10);function a(){return i=rg(r),o=eg(r),e()[0]<0&&(i=ig(i),o=ig(o)),n}return n.base=function(t){return arguments.length?(r=+t,a()):r},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=function(t){var n,a=e(),u=a[0],c=a[a.length-1];(n=c<u)&&(h=u,u=c,c=h);var s,l,f,h=i(u),p=i(c),d=null==t?10:+t,v=[];if(!(r%1)&&p-h<d){if(h=Math.round(h)-1,p=Math.round(p)+1,u>0){for(;h<p;++h)for(l=1,s=o(h);l<r;++l)if(f=s*l,!(f<u)){if(f>c)break;v.push(f)}}else for(;h<p;++h)for(l=r-1,s=o(h);l>=1;--l)if(f=s*l,!(f<u)){if(f>c)break;v.push(f)}}else v=S(h,p,Math.min(p-h,d)).map(o);return n?v.reverse():v},n.tickFormat=function(e,a){if(null==a&&(a=10===r?".0e":","),"function"!==typeof a&&(a=t.format(a)),e===1/0)return a;null==e&&(e=10);var u=Math.max(1,r*e/n.ticks().length);return function(t){var n=t/o(Math.round(i(t)));return n*r<r-.5&&(n*=r),n<=u?a(t):""}},n.nice=function(){return e(Qy(e(),{floor:function(t){return o(Math.floor(i(t)))},ceil:function(t){return o(Math.ceil(i(t)))}}))},n.copy=function(){return Xy(n,og().base(r))},n}function ag(t,n){return t<0?-Math.pow(-t,n):Math.pow(t,n)}function ug(){var t=1,n=Gy(r,i),e=n.domain;function r(n,e){return(e=ag(e,t)-(n=ag(n,t)))?function(r){return(ag(r,t)-n)/e}:jy(e)}function i(n,e){return e=ag(e,t)-(n=ag(n,t)),function(r){return ag(n+e*r,1/t)}}return n.exponent=function(n){return arguments.length?(t=+n,e(e())):t},n.copy=function(){return Xy(n,ug().exponent(t))},$y(n)}function cg(){return ug().exponent(.5)}function sg(){var t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);r=new Array(i-1);while(++e<i)r[e-1]=C(t,e/i);return o}function o(t){if(!isNaN(t=+t))return n[a(r,t)]}return o.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},o.domain=function(n){if(!arguments.length)return t.slice();t=[];for(var r,o=0,a=n.length;o<a;++o)r=n[o],null==r||isNaN(r=+r)||t.push(r);return t.sort(e),i()},o.range=function(t){return arguments.length?(n=Py.call(t),i()):n.slice()},o.quantiles=function(){return r.slice()},o.copy=function(){return sg().domain(t).range(n)},o}function lg(){var t=0,n=1,e=1,r=[.5],i=[0,1];function o(t){if(t<=t)return i[a(r,t,0,e)]}function u(){var i=-1;r=new Array(e);while(++i<e)r[i]=((i+1)*n-(i-e)*t)/(e+1);return o}return o.domain=function(e){return arguments.length?(t=+e[0],n=+e[1],u()):[t,n]},o.range=function(t){return arguments.length?(e=(i=Py.call(t)).length-1,u()):i.slice()},o.invertExtent=function(o){var a=i.indexOf(o);return a<0?[NaN,NaN]:a<1?[t,r[0]]:a>=e?[r[e-1],n]:[r[a-1],r[a]]},o.copy=function(){return lg().domain([t,n]).range(i)},$y(o)}function fg(){var t=[.5],n=[0,1],e=1;function r(r){if(r<=r)return n[a(t,r,0,e)]}return r.domain=function(i){return arguments.length?(t=Py.call(i),e=Math.min(t.length,n.length-1),r):t.slice()},r.range=function(i){return arguments.length?(n=Py.call(i),e=Math.min(t.length,n.length-1),r):n.slice()},r.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},r.copy=function(){return fg().domain(t).range(n)},r}var hg=new Date,pg=new Date;function dg(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r)||!(o>0))return a;do{a.push(new Date(+e))}while(n(e,o),t(e),e<r);return a},i.filter=function(e){return dg((function(n){if(n>=n)while(t(n),!e(n))n.setTime(n-1)}),(function(t,r){if(t>=t)while(--r>=0)while(n(t,1),!e(t));}))},e&&(i.count=function(n,r){return hg.setTime(+n),pg.setTime(+r),t(hg),t(pg),Math.floor(e(hg,pg))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t===0}:function(n){return i.count(0,n)%t===0}):i:null}),i}var vg=dg((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));vg.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?dg((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):vg:null};var yg=vg.range,gg=1e3,_g=6e4,mg=36e5,xg=864e5,wg=6048e5,bg=dg((function(t){t.setTime(Math.floor(t/gg)*gg)}),(function(t,n){t.setTime(+t+n*gg)}),(function(t,n){return(n-t)/gg}),(function(t){return t.getUTCSeconds()})),Mg=bg.range,kg=dg((function(t){t.setTime(Math.floor(t/_g)*_g)}),(function(t,n){t.setTime(+t+n*_g)}),(function(t,n){return(n-t)/_g}),(function(t){return t.getMinutes()})),Sg=kg.range,Eg=dg((function(t){var n=t.getTimezoneOffset()*_g%mg;n<0&&(n+=mg),t.setTime(Math.floor((+t-n)/mg)*mg+n)}),(function(t,n){t.setTime(+t+n*mg)}),(function(t,n){return(n-t)/mg}),(function(t){return t.getHours()})),Ng=Eg.range,Tg=dg((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_g)/xg}),(function(t){return t.getDate()-1})),Ag=Tg.range;function Cg(t){return dg((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_g)/wg}))}var Og=Cg(0),Pg=Cg(1),Lg=Cg(2),Ug=Cg(3),Dg=Cg(4),zg=Cg(5),Fg=Cg(6),jg=Og.range,Rg=Pg.range,Ig=Lg.range,qg=Ug.range,Bg=Dg.range,Hg=zg.range,Vg=Fg.range,Yg=dg((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),Xg=Yg.range,Gg=dg((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Gg.every=function(t){return isFinite(t=Math.floor(t))&&t>0?dg((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Wg=Gg.range,$g=dg((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+n*_g)}),(function(t,n){return(n-t)/_g}),(function(t){return t.getUTCMinutes()})),Zg=$g.range,Jg=dg((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+n*mg)}),(function(t,n){return(n-t)/mg}),(function(t){return t.getUTCHours()})),Qg=Jg.range,Kg=dg((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/xg}),(function(t){return t.getUTCDate()-1})),t_=Kg.range;function n_(t){return dg((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/wg}))}var e_=n_(0),r_=n_(1),i_=n_(2),o_=n_(3),a_=n_(4),u_=n_(5),c_=n_(6),s_=e_.range,l_=r_.range,f_=i_.range,h_=o_.range,p_=a_.range,d_=u_.range,v_=c_.range,y_=dg((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),g_=y_.range,__=dg((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));__.every=function(t){return isFinite(t=Math.floor(t))&&t>0?dg((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var m_=__.range;function x_(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function w_(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function b_(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function M_(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,s=O_(i),l=P_(i),f=O_(o),h=P_(o),p=O_(a),d=P_(a),v=O_(u),y=P_(u),g=O_(c),_=P_(c),m={a:L,A:U,b:D,B:z,c:null,d:G_,e:G_,H:W_,I:$_,j:Z_,L:J_,m:Q_,M:K_,p:F,S:tm,U:nm,w:em,W:rm,x:null,X:null,y:im,Y:om,Z:am,"%":wm},x={a:j,A:R,b:I,B:q,c:null,d:um,e:um,H:cm,I:sm,j:lm,L:fm,m:hm,M:pm,p:B,S:dm,U:vm,w:ym,W:gm,x:null,X:null,y:_m,Y:mm,Z:xm,"%":wm},w={a:E,A:N,b:T,B:A,c:C,d:I_,e:I_,H:B_,I:B_,j:q_,L:Y_,m:R_,M:H_,p:S,S:V_,U:U_,w:L_,W:D_,x:O,X:P,y:F_,Y:z_,Z:j_,"%":X_};function b(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,s=t.length;e instanceof Date||(e=new Date(+e));while(++u<s)37===t.charCodeAt(u)&&(a.push(t.slice(c,u)),null!=(i=S_[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),c=u+1);return a.push(t.slice(c,u)),a.join("")}}function M(t,n){return function(e){var r=b_(1900),i=k(r,t,e+="",0);if(i!=e.length)return null;if("p"in r&&(r.H=r.H%12+12*r.p),"W"in r||"U"in r){"w"in r||(r.w="W"in r?1:0);var o="Z"in r?w_(b_(r.y)).getUTCDay():n(b_(r.y)).getDay();r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(o+5)%7:r.w+7*r.U-(o+6)%7}return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,w_(r)):n(r)}}function k(t,n,e,r){var i,o,a=0,u=n.length,c=e.length;while(a<u){if(r>=c)return-1;if(i=n.charCodeAt(a++),37===i){if(i=n.charAt(a++),o=w[i in S_?n.charAt(a++):i],!o||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function S(t,n,e){var r=s.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1}function E(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=d[r[0].toLowerCase()],e+r[0].length):-1}function N(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1}function T(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1}function A(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1}function C(t,e,r){return k(t,n,e,r)}function O(t,n,r){return k(t,e,n,r)}function P(t,n,e){return k(t,r,n,e)}function L(t){return a[t.getDay()]}function U(t){return o[t.getDay()]}function D(t){return c[t.getMonth()]}function z(t){return u[t.getMonth()]}function F(t){return i[+(t.getHours()>=12)]}function j(t){return a[t.getUTCDay()]}function R(t){return o[t.getUTCDay()]}function I(t){return c[t.getUTCMonth()]}function q(t){return u[t.getUTCMonth()]}function B(t){return i[+(t.getUTCHours()>=12)]}return m.x=b(e,m),m.X=b(r,m),m.c=b(n,m),x.x=b(e,x),x.X=b(r,x),x.c=b(n,x),{format:function(t){var n=b(t+="",m);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",x_);return n.toString=function(){return t},n},utcFormat:function(t){var n=b(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,w_);return n.toString=function(){return t},n}}}var k_,S_={"-":"",_:" ",0:"0"},E_=/^\s*\d+/,N_=/^%/,T_=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;function A_(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function C_(t){return t.replace(T_,"\\$&")}function O_(t){return new RegExp("^(?:"+t.map(C_).join("|")+")","i")}function P_(t){var n={},e=-1,r=t.length;while(++e<r)n[t[e].toLowerCase()]=e;return n}function L_(t,n,e){var r=E_.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function U_(t,n,e){var r=E_.exec(n.slice(e));return r?(t.U=+r[0],e+r[0].length):-1}function D_(t,n,e){var r=E_.exec(n.slice(e));return r?(t.W=+r[0],e+r[0].length):-1}function z_(t,n,e){var r=E_.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function F_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function j_(t,n,e){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function R_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function I_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function q_(t,n,e){var r=E_.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function B_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function H_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function V_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Y_(t,n,e){var r=E_.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function X_(t,n,e){var r=N_.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function G_(t,n){return A_(t.getDate(),n,2)}function W_(t,n){return A_(t.getHours(),n,2)}function $_(t,n){return A_(t.getHours()%12||12,n,2)}function Z_(t,n){return A_(1+Tg.count(Gg(t),t),n,3)}function J_(t,n){return A_(t.getMilliseconds(),n,3)}function Q_(t,n){return A_(t.getMonth()+1,n,2)}function K_(t,n){return A_(t.getMinutes(),n,2)}function tm(t,n){return A_(t.getSeconds(),n,2)}function nm(t,n){return A_(Og.count(Gg(t),t),n,2)}function em(t){return t.getDay()}function rm(t,n){return A_(Pg.count(Gg(t),t),n,2)}function im(t,n){return A_(t.getFullYear()%100,n,2)}function om(t,n){return A_(t.getFullYear()%1e4,n,4)}function am(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+A_(n/60|0,"0",2)+A_(n%60,"0",2)}function um(t,n){return A_(t.getUTCDate(),n,2)}function cm(t,n){return A_(t.getUTCHours(),n,2)}function sm(t,n){return A_(t.getUTCHours()%12||12,n,2)}function lm(t,n){return A_(1+Kg.count(__(t),t),n,3)}function fm(t,n){return A_(t.getUTCMilliseconds(),n,3)}function hm(t,n){return A_(t.getUTCMonth()+1,n,2)}function pm(t,n){return A_(t.getUTCMinutes(),n,2)}function dm(t,n){return A_(t.getUTCSeconds(),n,2)}function vm(t,n){return A_(e_.count(__(t),t),n,2)}function ym(t){return t.getUTCDay()}function gm(t,n){return A_(r_.count(__(t),t),n,2)}function _m(t,n){return A_(t.getUTCFullYear()%100,n,2)}function mm(t,n){return A_(t.getUTCFullYear()%1e4,n,4)}function xm(){return"+0000"}function wm(){return"%"}function bm(n){return k_=M_(n),t.timeFormat=k_.format,t.timeParse=k_.parse,t.utcFormat=k_.utcFormat,t.utcParse=k_.utcParse,k_}bm({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Mm="%Y-%m-%dT%H:%M:%S.%LZ";function km(t){return t.toISOString()}var Sm=Date.prototype.toISOString?km:t.utcFormat(Mm);function Em(t){var n=new Date(t);return isNaN(n)?null:n}var Nm=+new Date("2000-01-01T00:00:00.000Z")?Em:t.utcParse(Mm),Tm=1e3,Am=60*Tm,Cm=60*Am,Om=24*Cm,Pm=7*Om,Lm=30*Om,Um=365*Om;function Dm(t){return new Date(t)}function zm(t){return t instanceof Date?+t:+new Date(+t)}function Fm(t,n,e,i,o,a,u,c,s){var l=Gy(qy,Br),f=l.invert,h=l.domain,p=s(".%L"),d=s(":%S"),v=s("%I:%M"),y=s("%I %p"),g=s("%a %d"),_=s("%b %d"),m=s("%B"),x=s("%Y"),w=[[u,1,Tm],[u,5,5*Tm],[u,15,15*Tm],[u,30,30*Tm],[a,1,Am],[a,5,5*Am],[a,15,15*Am],[a,30,30*Am],[o,1,Cm],[o,3,3*Cm],[o,6,6*Cm],[o,12,12*Cm],[i,1,Om],[i,2,2*Om],[e,1,Pm],[n,1,Lm],[n,3,3*Lm],[t,1,Um]];function b(r){return(u(r)<r?p:a(r)<r?d:o(r)<r?v:i(r)<r?y:n(r)<r?e(r)<r?g:_:t(r)<r?m:x)(r)}function M(n,e,i,o){if(null==n&&(n=10),"number"===typeof n){var a=Math.abs(i-e)/n,u=r((function(t){return t[2]})).right(w,a);u===w.length?(o=N(e/Um,i/Um,n),n=t):u?(u=w[a/w[u-1][2]<w[u][2]/a?u-1:u],o=u[1],n=u[0]):(o=N(e,i,n),n=c)}return null==o?n:n.every(o)}return l.invert=function(t){return new Date(f(t))},l.domain=function(t){return arguments.length?h(Oy.call(t,zm)):h().map(Dm)},l.ticks=function(t,n){var e,r=h(),i=r[0],o=r[r.length-1],a=o<i;return a&&(e=i,i=o,o=e),e=M(t,i,o,n),e=e?e.range(i,o+1):[],a?e.reverse():e},l.tickFormat=function(t,n){return null==n?b:s(n)},l.nice=function(t,n){var e=h();return(t=M(t,e[0],e[e.length-1],n))?h(Qy(e,t)):l},l.copy=function(){return Xy(l,Fm(t,n,e,i,o,a,u,c,s))},l}var jm=function(){return Fm(Gg,Yg,Og,Tg,Eg,kg,bg,vg,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},Rm=function(){return Fm(__,y_,e_,Kg,Jg,$g,bg,vg,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},Im=function(t){return t.match(/.{6}/g).map((function(t){return"#"+t}))},qm=Im("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Bm=Im("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),Hm=Im("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),Vm=Im("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Ym=Ti(Sr(300,.5,0),Sr(-240,.5,1)),Xm=Ti(Sr(-100,.75,.35),Sr(80,1.5,.8)),Gm=Ti(Sr(260,.75,.35),Sr(80,1.5,.8)),Wm=Sr(),$m=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Wm.h=360*t-100,Wm.s=1.5-1.5*n,Wm.l=.8-.9*n,Wm+""};function Zm(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var Jm=Zm(Im("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Qm=Zm(Im("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Km=Zm(Im("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),tx=Zm(Im("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function nx(t){var n=0,e=1,r=!1;function i(i){var o=(i-n)/(e-n);return t(r?Math.max(0,Math.min(1,o)):o)}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.clamp=function(t){return arguments.length?(r=!!t,i):r},i.interpolator=function(n){return arguments.length?(t=n,i):t},i.copy=function(){return nx(t).domain([n,e]).clamp(r)},$y(i)}var ex=function(t){return function(){return t}},rx=Math.abs,ix=Math.atan2,ox=Math.cos,ax=Math.max,ux=Math.min,cx=Math.sin,sx=Math.sqrt,lx=1e-12,fx=Math.PI,hx=fx/2,px=2*fx;function dx(t){return t>1?0:t<-1?fx:Math.acos(t)}function vx(t){return t>=1?hx:t<=-1?-hx:Math.asin(t)}function yx(t){return t.innerRadius}function gx(t){return t.outerRadius}function _x(t){return t.startAngle}function mx(t){return t.endAngle}function xx(t){return t&&t.padAngle}function wx(t,n,e,r,i,o,a,u){var c=e-t,s=r-n,l=a-i,f=u-o,h=(l*(n-o)-f*(t-i))/(f*c-l*s);return[t+h*c,n+h*s]}function bx(t,n,e,r,i,o,a){var u=t-e,c=n-r,s=(a?o:-o)/sx(u*u+c*c),l=s*c,f=-s*u,h=t+l,p=n+f,d=e+l,v=r+f,y=(h+d)/2,g=(p+v)/2,_=d-h,m=v-p,x=_*_+m*m,w=i-o,b=h*v-d*p,M=(m<0?-1:1)*sx(ax(0,w*w*x-b*b)),k=(b*m-_*M)/x,S=(-b*_-m*M)/x,E=(b*m+_*M)/x,N=(-b*_+m*M)/x,T=k-y,A=S-g,C=E-y,O=N-g;return T*T+A*A>C*C+O*O&&(k=E,S=N),{cx:k,cy:S,x01:-l,y01:-f,x11:k*(i/w-1),y11:S*(i/w-1)}}var Mx=function(){var t=yx,n=gx,e=ex(0),r=null,i=_x,o=mx,a=xx,u=null;function c(){var c,s,l=+t.apply(this,arguments),f=+n.apply(this,arguments),h=i.apply(this,arguments)-hx,p=o.apply(this,arguments)-hx,d=rx(p-h),v=p>h;if(u||(u=c=Xu()),f<l&&(s=f,f=l,l=s),f>lx)if(d>px-lx)u.moveTo(f*ox(h),f*cx(h)),u.arc(0,0,f,h,p,!v),l>lx&&(u.moveTo(l*ox(p),l*cx(p)),u.arc(0,0,l,p,h,v));else{var y,g,_=h,m=p,x=h,w=p,b=d,M=d,k=a.apply(this,arguments)/2,S=k>lx&&(r?+r.apply(this,arguments):sx(l*l+f*f)),E=ux(rx(f-l)/2,+e.apply(this,arguments)),N=E,T=E;if(S>lx){var A=vx(S/l*cx(k)),C=vx(S/f*cx(k));(b-=2*A)>lx?(A*=v?1:-1,x+=A,w-=A):(b=0,x=w=(h+p)/2),(M-=2*C)>lx?(C*=v?1:-1,_+=C,m-=C):(M=0,_=m=(h+p)/2)}var O=f*ox(_),P=f*cx(_),L=l*ox(w),U=l*cx(w);if(E>lx){var D=f*ox(m),z=f*cx(m),F=l*ox(x),j=l*cx(x);if(d<fx){var R=b>lx?wx(O,P,F,j,D,z,L,U):[L,U],I=O-R[0],q=P-R[1],B=D-R[0],H=z-R[1],V=1/cx(dx((I*B+q*H)/(sx(I*I+q*q)*sx(B*B+H*H)))/2),Y=sx(R[0]*R[0]+R[1]*R[1]);N=ux(E,(l-Y)/(V-1)),T=ux(E,(f-Y)/(V+1))}}M>lx?T>lx?(y=bx(F,j,O,P,f,T,v),g=bx(D,z,L,U,f,T,v),u.moveTo(y.cx+y.x01,y.cy+y.y01),T<E?u.arc(y.cx,y.cy,T,ix(y.y01,y.x01),ix(g.y01,g.x01),!v):(u.arc(y.cx,y.cy,T,ix(y.y01,y.x01),ix(y.y11,y.x11),!v),u.arc(0,0,f,ix(y.cy+y.y11,y.cx+y.x11),ix(g.cy+g.y11,g.cx+g.x11),!v),u.arc(g.cx,g.cy,T,ix(g.y11,g.x11),ix(g.y01,g.x01),!v))):(u.moveTo(O,P),u.arc(0,0,f,_,m,!v)):u.moveTo(O,P),l>lx&&b>lx?N>lx?(y=bx(L,U,D,z,l,-N,v),g=bx(O,P,F,j,l,-N,v),u.lineTo(y.cx+y.x01,y.cy+y.y01),N<E?u.arc(y.cx,y.cy,N,ix(y.y01,y.x01),ix(g.y01,g.x01),!v):(u.arc(y.cx,y.cy,N,ix(y.y01,y.x01),ix(y.y11,y.x11),!v),u.arc(0,0,l,ix(y.cy+y.y11,y.cx+y.x11),ix(g.cy+g.y11,g.cx+g.x11),v),u.arc(g.cx,g.cy,N,ix(g.y11,g.x11),ix(g.y01,g.x01),!v))):u.arc(0,0,l,w,x,v):u.lineTo(L,U)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-fx/2;return[ox(r)*e,cx(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"===typeof t?t:ex(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"===typeof t?t:ex(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"===typeof t?t:ex(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"===typeof t?t:ex(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"===typeof t?t:ex(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"===typeof t?t:ex(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c};function kx(t){this._context=t}kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n);break}}};var Sx=function(t){return new kx(t)};function Ex(t){return t[0]}function Nx(t){return t[1]}var Tx=function(){var t=Ex,n=Nx,e=ex(!0),r=null,i=Sx,o=null;function a(a){var u,c,s,l=a.length,f=!1;for(null==r&&(o=i(s=Xu())),u=0;u<=l;++u)!(u<l&&e(c=a[u],u,a))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(c,u,a),+n(c,u,a));if(s)return o=null,s+""||null}return a.x=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),a):t},a.y=function(t){return arguments.length?(n="function"===typeof t?t:ex(+t),a):n},a.defined=function(t){return arguments.length?(e="function"===typeof t?t:ex(!!t),a):e},a.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),a):r},a},Ax=function(){var t=Ex,n=null,e=ex(0),r=Nx,i=ex(!0),o=null,a=Sx,u=null;function c(c){var s,l,f,h,p,d=c.length,v=!1,y=new Array(d),g=new Array(d);for(null==o&&(u=a(p=Xu())),s=0;s<=d;++s){if(!(s<d&&i(h=c[s],s,c))===v)if(v=!v)l=s,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),f=s-1;f>=l;--f)u.point(y[f],g[f]);u.lineEnd(),u.areaEnd()}v&&(y[s]=+t(h,s,c),g[s]=+e(h,s,c),u.point(n?+n(h,s,c):y[s],r?+r(h,s,c):g[s]))}if(p)return u=null,p+""||null}function s(){return Tx().defined(i).curve(a).context(o)}return c.x=function(e){return arguments.length?(t="function"===typeof e?e:ex(+e),n=null,c):t},c.x0=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),c):t},c.x1=function(t){return arguments.length?(n=null==t?null:"function"===typeof t?t:ex(+t),c):n},c.y=function(t){return arguments.length?(e="function"===typeof t?t:ex(+t),r=null,c):e},c.y0=function(t){return arguments.length?(e="function"===typeof t?t:ex(+t),c):e},c.y1=function(t){return arguments.length?(r=null==t?null:"function"===typeof t?t:ex(+t),c):r},c.lineX0=c.lineY0=function(){return s().x(t).y(e)},c.lineY1=function(){return s().x(t).y(r)},c.lineX1=function(){return s().x(n).y(e)},c.defined=function(t){return arguments.length?(i="function"===typeof t?t:ex(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c},Cx=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},Ox=function(t){return t},Px=function(){var t=Ox,n=Cx,e=null,r=ex(0),i=ex(px),o=ex(0);function a(a){var u,c,s,l,f,h=a.length,p=0,d=new Array(h),v=new Array(h),y=+r.apply(this,arguments),g=Math.min(px,Math.max(-px,i.apply(this,arguments)-y)),_=Math.min(Math.abs(g)/h,o.apply(this,arguments)),m=_*(g<0?-1:1);for(u=0;u<h;++u)(f=v[d[u]=u]=+t(a[u],u,a))>0&&(p+=f);for(null!=n?d.sort((function(t,e){return n(v[t],v[e])})):null!=e&&d.sort((function(t,n){return e(a[t],a[n])})),u=0,s=p?(g-h*m)/p:0;u<h;++u,y=l)c=d[u],f=v[c],l=y+(f>0?f*s:0)+m,v[c]={data:a[c],index:u,value:f,startAngle:y,endAngle:l,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"===typeof t?t:ex(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"===typeof t?t:ex(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"===typeof t?t:ex(+t),a):o},a},Lx=Dx(Sx);function Ux(t){this._curve=t}function Dx(t){function n(n){return new Ux(t(n))}return n._curve=t,n}function zx(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(Dx(t)):n()._curve},t}Ux.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var Fx=function(){return zx(Tx().curve(Lx))},jx=function(){var t=Ax().curve(Lx),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return zx(e())},delete t.lineX0,t.lineEndAngle=function(){return zx(r())},delete t.lineX1,t.lineInnerRadius=function(){return zx(i())},delete t.lineY0,t.lineOuterRadius=function(){return zx(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(Dx(t)):n()._curve},t},Rx=Array.prototype.slice,Ix=function(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]};function qx(t){return t.source}function Bx(t){return t.target}function Hx(t){var n=qx,e=Bx,r=Ex,i=Nx,o=null;function a(){var a,u=Rx.call(arguments),c=n.apply(this,u),s=e.apply(this,u);if(o||(o=a=Xu()),t(o,+r.apply(this,(u[0]=c,u)),+i.apply(this,u),+r.apply(this,(u[0]=s,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"===typeof t?t:ex(+t),a):r},a.y=function(t){return arguments.length?(i="function"===typeof t?t:ex(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function Vx(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Yx(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function Xx(t,n,e,r,i){var o=Ix(n,e),a=Ix(n,e=(e+i)/2),u=Ix(r,e),c=Ix(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],c[0],c[1])}function Gx(){return Hx(Vx)}function Wx(){return Hx(Yx)}function $x(){var t=Hx(Xx);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}var Zx={draw:function(t,n){var e=Math.sqrt(n/fx);t.moveTo(e,0),t.arc(0,0,e,0,px)}},Jx={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Qx=Math.sqrt(1/3),Kx=2*Qx,tw={draw:function(t,n){var e=Math.sqrt(n/Kx),r=e*Qx;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},nw=.8908130915292852,ew=Math.sin(fx/10)/Math.sin(7*fx/10),rw=Math.sin(px/10)*ew,iw=-Math.cos(px/10)*ew,ow={draw:function(t,n){var e=Math.sqrt(n*nw),r=rw*e,i=iw*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=px*o/5,u=Math.cos(a),c=Math.sin(a);t.lineTo(c*e,-u*e),t.lineTo(u*r-c*i,c*r+u*i)}t.closePath()}},aw={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},uw=Math.sqrt(3),cw={draw:function(t,n){var e=-Math.sqrt(n/(3*uw));t.moveTo(0,2*e),t.lineTo(-uw*e,-e),t.lineTo(uw*e,-e),t.closePath()}},sw=-.5,lw=Math.sqrt(3)/2,fw=1/Math.sqrt(12),hw=3*(fw/2+1),pw={draw:function(t,n){var e=Math.sqrt(n/hw),r=e/2,i=e*fw,o=r,a=e*fw+e,u=-o,c=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,c),t.lineTo(sw*r-lw*i,lw*r+sw*i),t.lineTo(sw*o-lw*a,lw*o+sw*a),t.lineTo(sw*u-lw*c,lw*u+sw*c),t.lineTo(sw*r+lw*i,sw*i-lw*r),t.lineTo(sw*o+lw*a,sw*a-lw*o),t.lineTo(sw*u+lw*c,sw*c-lw*u),t.closePath()}},dw=[Zx,Jx,tw,aw,ow,cw,pw],vw=function(){var t=ex(Zx),n=ex(64),e=null;function r(){var r;if(e||(e=r=Xu()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"===typeof n?n:ex(n),r):t},r.size=function(t){return arguments.length?(n="function"===typeof t?t:ex(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},yw=function(){};function gw(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function _w(t){this._context=t}_w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var mw=function(t){return new _w(t)};function xw(t){this._context=t}xw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var ww=function(t){return new xw(t)};function bw(t){this._context=t}bw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var Mw=function(t){return new bw(t)};function kw(t,n){this._basis=new _w(t),this._beta=n}kw.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0){var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,c=-1;while(++c<=e)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*a),this._beta*n[c]+(1-this._beta)*(o+r*u))}this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Sw=function t(n){function e(t){return 1===n?new _w(t):new kw(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Ew(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Nw(t,n){this._context=t,this._k=(1-n)/6}Nw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ew(this,this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Tw=function t(n){function e(t){return new Nw(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Aw(t,n){this._context=t,this._k=(1-n)/6}Aw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Cw=function t(n){function e(t){return new Aw(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Ow(t,n){this._context=t,this._k=(1-n)/6}Ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Pw=function t(n){function e(t){return new Ow(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Lw(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>lx){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>lx){var s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-n*t._l12_2a)/l,a=(a*s+t._y1*t._l23_2a-e*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Uw(t,n){this._context=t,this._alpha=n}Uw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Dw=function t(n){function e(t){return n?new Uw(t,n):new Nw(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function zw(t,n){this._context=t,this._alpha=n}zw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Fw=function t(n){function e(t){return n?new zw(t,n):new Aw(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function jw(t,n){this._context=t,this._alpha=n}jw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Rw=function t(n){function e(t){return n?new jw(t,n):new Ow(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Iw(t){this._context=t}Iw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};var qw=function(t){return new Iw(t)};function Bw(t){return t<0?-1:1}function Hw(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(Bw(o)+Bw(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Vw(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Yw(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function Xw(t){this._context=t}function Gw(t){this._context=new Ww(t)}function Ww(t){this._context=t}function $w(t){return new Xw(t)}function Zw(t){return new Gw(t)}function Jw(t){this._context=t}function Qw(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}Xw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Yw(this,this._t0,Vw(this,this._t0));break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Yw(this,Vw(this,e=Hw(this,t,n)),e);break;default:Yw(this,this._t0,e=Hw(this,t,n));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Gw.prototype=Object.create(Xw.prototype)).point=function(t,n){Xw.prototype.point.call(this,n,t)},Ww.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},Jw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=Qw(t),i=Qw(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Kw=function(t){return new Jw(t)};function tb(t,n){this._context=t,this._t=n}tb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}break}this._x=t,this._y=n}};var nb=function(t){return new tb(t,.5)};function eb(t){return new tb(t,0)}function rb(t){return new tb(t,1)}var ib=function(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o<i;++o)for(r=a,a=t[n[o]],e=0;e<u;++e)a[e][1]+=a[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]},ob=function(t){var n=t.length,e=new Array(n);while(--n>=0)e[n]=n;return e};function ab(t,n){return t[n]}var ub=function(){var t=ex([]),n=ob,e=ib,r=ab;function i(i){var o,a,u=t.apply(this,arguments),c=i.length,s=u.length,l=new Array(s);for(o=0;o<s;++o){for(var f,h=u[o],p=l[o]=new Array(c),d=0;d<c;++d)p[d]=f=[0,+r(i[d],h,d,i)],f.data=i[d];p.key=h}for(o=0,a=n(l);o<s;++o)l[a[o]].index=o;return e(l,a),l}return i.keys=function(n){return arguments.length?(t="function"===typeof n?n:ex(Rx.call(n)),i):t},i.value=function(t){return arguments.length?(r="function"===typeof t?t:ex(+t),i):r},i.order=function(t){return arguments.length?(n=null==t?ob:"function"===typeof t?t:ex(Rx.call(t)),i):n},i.offset=function(t){return arguments.length?(e=null==t?ib:t,i):e},i},cb=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,a=t[0].length;o<a;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}ib(t,n)}},sb=function(t,n){if((u=t.length)>1)for(var e,r,i,o,a,u,c=0,s=t[n[0]].length;c<s;++c)for(o=a=0,e=0;e<u;++e)(i=(r=t[n[e]][c])[1]-r[0])>=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},lb=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var a=0,u=0;a<e;++a)u+=t[a][r][1]||0;i[r][1]+=i[r][0]=-u/2}ib(t,n)}},fb=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a<r;++a){for(var u=0,c=0,s=0;u<i;++u){for(var l=t[n[u]],f=l[a][1]||0,h=l[a-1][1]||0,p=(f-h)/2,d=0;d<u;++d){var v=t[n[d]],y=v[a][1]||0,g=v[a-1][1]||0;p+=y-g}c+=f,s+=p*f}e[a-1][1]+=e[a-1][0]=o,c&&(o-=s/c)}e[a-1][1]+=e[a-1][0]=o,ib(t,n)}},hb=function(t){var n=t.map(pb);return ob(t).sort((function(t,e){return n[t]-n[e]}))};function pb(t){var n,e=0,r=-1,i=t.length;while(++r<i)(n=+t[r][1])&&(e+=n);return e}var db=function(t){return hb(t).reverse()},vb=function(t){var n,e,r=t.length,i=t.map(pb),o=ob(t).sort((function(t,n){return i[n]-i[t]})),a=0,u=0,c=[],s=[];for(n=0;n<r;++n)e=o[n],a<u?(a+=i[e],c.push(e)):(u+=i[e],s.push(e));return s.reverse().concat(c)},yb=function(t){return ob(t).reverse()},gb=function(t){return function(){return t}};function _b(t){return t[0]}function mb(t){return t[1]}function xb(){this._=null}function wb(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function bb(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Mb(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function kb(t){while(t.L)t=t.L;return t}function Sb(t,n,e,r){var i=[null,null],o=Kb.push(i)-1;return i.left=t,i.right=n,e&&Nb(i,t,n,e),r&&Nb(i,n,t,r),Jb[t.index].halfedges.push(o),Jb[n.index].halfedges.push(o),i}function Eb(t,n,e){var r=[n,e];return r.left=t,r}function Nb(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function Tb(t,n,e,r,i){var o,a=t[0],u=t[1],c=a[0],s=a[1],l=u[0],f=u[1],h=0,p=1,d=l-c,v=f-s;if(o=n-c,d||!(o>0)){if(o/=d,d<0){if(o<h)return;o<p&&(p=o)}else if(d>0){if(o>p)return;o>h&&(h=o)}if(o=r-c,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o<h)return;o<p&&(p=o)}if(o=e-s,v||!(o>0)){if(o/=v,v<0){if(o<h)return;o<p&&(p=o)}else if(v>0){if(o>p)return;o>h&&(h=o)}if(o=i-s,v||!(o<0)){if(o/=v,v<0){if(o>p)return;o>h&&(h=o)}else if(v>0){if(o<h)return;o<p&&(p=o)}return!(h>0||p<1)||(h>0&&(t[0]=[c+h*d,s+h*v]),p<1&&(t[1]=[c+p*d,s+p*v]),!0)}}}}}function Ab(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,c=t[0],s=t.left,l=t.right,f=s[0],h=s[1],p=l[0],d=l[1],v=(f+p)/2,y=(h+d)/2;if(d===h){if(v<n||v>=r)return;if(f>p){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]<e)return}else c=[v,i];o=[v,e]}}else if(a=(f-p)/(d-h),u=y-a*v,a<-1||a>1)if(f>p){if(c){if(c[1]>=i)return}else c=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(c){if(c[1]<e)return}else c=[(i-u)/a,i];o=[(e-u)/a,e]}else if(h<d){if(c){if(c[0]>=r)return}else c=[n,a*n+u];o=[r,a*r+u]}else{if(c){if(c[0]<n)return}else c=[r,a*r+u];o=[n,a*n+u]}return t[0]=c,t[1]=o,!0}function Cb(t,n,e,r){var i,o=Kb.length;while(o--)Ab(i=Kb[o],t,n,e,r)&&Tb(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>tM||Math.abs(i[0][1]-i[1][1])>tM)||delete Kb[o]}function Ob(t){return Jb[t.index]={site:t,halfedges:[]}}function Pb(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function Lb(t,n){return n[+(n.left!==t.site)]}function Ub(t,n){return n[+(n.left===t.site)]}function Db(){for(var t,n,e,r,i=0,o=Jb.length;i<o;++i)if((t=Jb[i])&&(r=(n=t.halfedges).length)){var a=new Array(r),u=new Array(r);for(e=0;e<r;++e)a[e]=e,u[e]=Pb(t,Kb[n[e]]);for(a.sort((function(t,n){return u[n]-u[t]})),e=0;e<r;++e)u[e]=n[a[e]];for(e=0;e<r;++e)n[e]=u[e]}}function zb(t,n,e,r){var i,o,a,u,c,s,l,f,h,p,d,v,y=Jb.length,g=!0;for(i=0;i<y;++i)if(o=Jb[i]){a=o.site,c=o.halfedges,u=c.length;while(u--)Kb[c[u]]||c.splice(u,1);u=0,s=c.length;while(u<s)p=Ub(o,Kb[c[u]]),d=p[0],v=p[1],l=Lb(o,Kb[c[++u%s]]),f=l[0],h=l[1],(Math.abs(d-f)>tM||Math.abs(v-h)>tM)&&(c.splice(u,0,Kb.push(Eb(a,p,Math.abs(d-t)<tM&&r-v>tM?[t,Math.abs(f-t)<tM?h:r]:Math.abs(v-r)<tM&&e-d>tM?[Math.abs(h-r)<tM?f:e,r]:Math.abs(d-e)<tM&&v-n>tM?[e,Math.abs(f-e)<tM?h:n]:Math.abs(v-n)<tM&&d-t>tM?[Math.abs(h-n)<tM?f:t,n]:null))-1),++s);s&&(g=!1)}if(g){var _,m,x,w=1/0;for(i=0,g=null;i<y;++i)(o=Jb[i])&&(a=o.site,_=a[0]-t,m=a[1]-n,x=_*_+m*m,x<w&&(w=x,g=o));if(g){var b=[t,n],M=[t,r],k=[e,r],S=[e,n];g.halfedges.push(Kb.push(Eb(a=g.site,b,M))-1,Kb.push(Eb(a,M,k))-1,Kb.push(Eb(a,k,S))-1,Kb.push(Eb(a,S,b))-1)}}for(i=0;i<y;++i)(o=Jb[i])&&(o.halfedges.length||delete Jb[i])}xb.prototype={constructor:xb,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){t=t.R;while(t.L)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=kb(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);n.L=n.R=null,n.U=e,n.C=!0,t=n;while(e&&e.C)r=e.U,e===r.L?(i=r.R,i&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(bb(this,e),t=e,e=t.U),e.C=!1,r.C=!0,Mb(this,r))):(i=r.L,i&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(Mb(this,e),t=e,e=t.U),e.C=!1,r.C=!0,bb(this,r))),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,a=t.R;if(e=o?a?kb(a):o:a,i?i.L===t?i.L=e:i.R=e:this._=e,o&&a?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==a?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=a,a.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if(n=i.R,n.C&&(n.C=!1,i.C=!0,bb(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Mb(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,bb(this,i),t=this._;break}}else if(n=i.L,n.C&&(n.C=!1,i.C=!0,Mb(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,bb(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,Mb(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var Fb,jb=[];function Rb(){wb(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ib(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i[0],u=i[1],c=r[0]-a,s=r[1]-u,l=o[0]-a,f=o[1]-u,h=2*(c*f-s*l);if(!(h>=-nM)){var p=c*c+s*s,d=l*l+f*f,v=(f*p-s*d)/h,y=(c*d-l*p)/h,g=jb.pop()||new Rb;g.arc=t,g.site=i,g.x=v+a,g.y=(g.cy=y+u)+Math.sqrt(v*v+y*y),t.circle=g;var _=null,m=Qb._;while(m)if(g.y<m.y||g.y===m.y&&g.x<=m.x){if(!m.L){_=m.P;break}m=m.L}else{if(!m.R){_=m;break}m=m.R}Qb.insert(_,g),_||(Fb=g)}}}}function qb(t){var n=t.circle;n&&(n.P||(Fb=n.N),Qb.remove(n),jb.push(n),wb(n),t.circle=null)}var Bb=[];function Hb(){wb(this),this.edge=this.site=this.circle=null}function Vb(t){var n=Bb.pop()||new Hb;return n.site=t,n}function Yb(t){qb(t),Zb.remove(t),Bb.push(t),wb(t)}function Xb(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],o=t.P,a=t.N,u=[t];Yb(t);var c=o;while(c.circle&&Math.abs(e-c.circle.x)<tM&&Math.abs(r-c.circle.cy)<tM)o=c.P,u.unshift(c),Yb(c),c=o;u.unshift(c),qb(c);var s=a;while(s.circle&&Math.abs(e-s.circle.x)<tM&&Math.abs(r-s.circle.cy)<tM)a=s.N,u.push(s),Yb(s),s=a;u.push(s),qb(s);var l,f=u.length;for(l=1;l<f;++l)s=u[l],c=u[l-1],Nb(s.edge,c.site,s.site,i);c=u[0],s=u[f-1],s.edge=Sb(c.site,s.site,null,i),Ib(c),Ib(s)}function Gb(t){var n,e,r,i,o=t[0],a=t[1],u=Zb._;while(u)if(r=Wb(u,a)-o,r>tM)u=u.L;else{if(i=o-$b(u,a),!(i>tM)){r>-tM?(n=u.P,e=u):i>-tM?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}Ob(t);var c=Vb(t);if(Zb.insert(n,c),n||e){if(n===e)return qb(n),e=Vb(n.site),Zb.insert(c,e),c.edge=e.edge=Sb(n.site,c.site),Ib(n),void Ib(e);if(e){qb(n),qb(e);var s=n.site,l=s[0],f=s[1],h=t[0]-l,p=t[1]-f,d=e.site,v=d[0]-l,y=d[1]-f,g=2*(h*y-p*v),_=h*h+p*p,m=v*v+y*y,x=[(y*_-p*m)/g+l,(h*m-v*_)/g+f];Nb(e.edge,s,d,x),c.edge=Sb(s,t,null,x),e.edge=Sb(t,d,null,x),Ib(n),Ib(e)}else c.edge=Sb(n.site,c.site)}}function Wb(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;e=a.site;var u=e[0],c=e[1],s=c-n;if(!s)return u;var l=u-r,f=1/o-1/s,h=l/s;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*s)-c+s/2+i-o/2)))/f+r:(r+u)/2}function $b(t,n){var e=t.N;if(e)return Wb(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var Zb,Jb,Qb,Kb,tM=1e-6,nM=1e-12;function eM(t,n,e){return(t[0]-e[0])*(n[1]-t[1])-(t[0]-n[0])*(e[1]-t[1])}function rM(t,n){return n[1]-t[1]||n[0]-t[0]}function iM(t,n){var e,r,i,o=t.sort(rM).pop();Kb=[],Jb=new Array(t.length),Zb=new xb,Qb=new xb;while(1)if(i=Fb,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===e&&o[1]===r||(Gb(o),e=o[0],r=o[1]),o=t.pop();else{if(!i)break;Xb(i.arc)}if(Db(),n){var a=+n[0][0],u=+n[0][1],c=+n[1][0],s=+n[1][1];Cb(a,u,c,s),zb(a,u,c,s)}this.edges=Kb,this.cells=Jb,Zb=Qb=Kb=Jb=null}iM.prototype={constructor:iM,polygons:function(){var t=this.edges;return this.cells.map((function(n){var e=n.halfedges.map((function(e){return Lb(n,t[e])}));return e.data=n.site.data,e}))},triangles:function(){var t=[],n=this.edges;return this.cells.forEach((function(e,r){if(o=(i=e.halfedges).length){var i,o,a,u=e.site,c=-1,s=n[i[o-1]],l=s.left===u?s.right:s.left;while(++c<o)a=l,s=n[i[c]],l=s.left===u?s.right:s.left,a&&l&&r<a.index&&r<l.index&&eM(u,a,l)<0&&t.push([u.data,a.data,l.data])}})),t},links:function(){return this.edges.filter((function(t){return t.right})).map((function(t){return{source:t.left.data,target:t.right.data}}))},find:function(t,n,e){var r,i,o=this,a=o._found||0,u=o.cells.length;while(!(i=o.cells[a]))if(++a>=u)return null;var c=t-i.site[0],s=n-i.site[1],l=c*c+s*s;do{i=o.cells[r=a],a=null,i.halfedges.forEach((function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var c=t-u[0],s=n-u[1],f=c*c+s*s;f<l&&(l=f,a=u.index)}}))}while(null!==a);return o._found=r,null==e||l<=e*e?i.site:null}};var oM=function(){var t=_b,n=mb,e=null;function r(r){return new iM(r.map((function(e,i){var o=[Math.round(t(e,i,r)/tM)*tM,Math.round(n(e,i,r)/tM)*tM];return o.index=i,o.data=e,o})),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"===typeof n?n:gb(+n),r):t},r.y=function(t){return arguments.length?(n="function"===typeof t?t:gb(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r},aM=function(t){return function(){return t}};function uM(t,n,e){this.target=t,this.type=n,this.transform=e}function cM(t,n,e){this.k=t,this.x=n,this.y=e}cM.prototype={constructor:cM,scale:function(t){return 1===t?this:new cM(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new cM(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var sM=new cM(1,0,0);function lM(t){return t.__zoom||sM}function fM(){t.event.stopImmediatePropagation()}lM.prototype=cM.prototype;var hM=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()};function pM(){return!t.event.button}function dM(){var t,n,e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,t=e.width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function vM(){return this.__zoom||sM}var yM=function(){var n,e,r=pM,i=dM,o=0,a=1/0,u=-a,c=a,s=u,l=c,f=250,h=yi,p=[],d=ct("start","zoom","end"),v=500,y=150,g=0;function _(t){t.on("wheel.zoom",E).on("mousedown.zoom",N).on("dblclick.zoom",T).on("touchstart.zoom",A).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)").property("__zoom",vM)}function m(t,n){return n=Math.max(o,Math.min(a,n)),n===t.k?t:new cM(n,t.x,t.y)}function x(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new cM(t.k,r,i)}function w(t,n){var e=t.invertX(n[0][0])-u,r=t.invertX(n[1][0])-c,i=t.invertY(n[0][1])-s,o=t.invertY(n[1][1])-l;return t.translate(r>e?(e+r)/2:Math.min(0,e)||Math.max(0,r),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function M(t,n,e){t.on("start.zoom",(function(){k(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){k(this,arguments).end()})).tween("zoom",(function(){var t=this,r=arguments,o=k(t,r),a=i.apply(t,r),u=e||b(a),c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),s=t.__zoom,l="function"===typeof n?n.apply(t,r):n,f=h(s.invert(u).concat(c/s.k),l.invert(u).concat(c/l.k));return function(t){if(1===t)t=l;else{var n=f(t),e=c/n[2];t=new cM(e,u[0]-n[0]*e,u[1]-n[1]*e)}o.zoom(null,t)}}))}function k(t,n){for(var e,r=0,i=p.length;r<i;++r)if((e=p[r]).that===t)return e;return new S(t,n)}function S(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=i.apply(t,n)}function E(){if(r.apply(this,arguments)){var n=k(this,arguments),e=this.__zoom,i=Math.max(o,Math.min(a,e.k*Math.pow(2,-t.event.deltaY*(t.event.deltaMode?120:1)/500))),u=Ft(this);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=e.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(e.k===i)return;n.mouse=[u,e.invert(u)],lo(this),n.start()}hM(),n.wheel=setTimeout(c,y),n.zoom("mouse",w(x(m(e,i),n.mouse[0],n.mouse[1]),n.extent))}function c(){n.wheel=null,n.end()}}function N(){if(!e&&r.apply(this,arguments)){var n=k(this,arguments),i=ce(t.event.view).on("mousemove.zoom",c,!0).on("mouseup.zoom",s,!0),o=Ft(this),a=t.event.clientX,u=t.event.clientY;de(t.event.view),fM(),n.mouse=[o,this.__zoom.invert(o)],lo(this),n.start()}function c(){if(hM(),!n.moved){var e=t.event.clientX-a,r=t.event.clientY-u;n.moved=e*e+r*r>g}n.zoom("mouse",w(x(n.that.__zoom,n.mouse[0]=Ft(n.that),n.mouse[1]),n.extent))}function s(){i.on("mousemove.zoom mouseup.zoom",null),ve(t.event.view,n.moved),hM(),n.end()}}function T(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ft(this),o=n.invert(e),a=n.k*(t.event.shiftKey?.5:2),u=w(x(m(n,a),e,o),i.apply(this,arguments));hM(),f>0?ce(this).transition().duration(f).call(M,u,e):ce(this).call(_.transform,u)}}function A(){if(r.apply(this,arguments)){var e,i,o,a,u=k(this,arguments),c=t.event.changedTouches,s=c.length;for(fM(),i=0;i<s;++i)o=c[i],a=le(this,c,o.identifier),a=[a,this.__zoom.invert(a),o.identifier],u.touch0?u.touch1||(u.touch1=a):(u.touch0=a,e=!0);if(n&&(n=clearTimeout(n),!u.touch1))return u.end(),a=ce(this).on("dblclick.zoom"),void(a&&a.apply(this,arguments));e&&(n=setTimeout((function(){n=null}),v),lo(this),u.start())}}function C(){var e,r,i,o,a=k(this,arguments),u=t.event.changedTouches,c=u.length;for(hM(),n&&(n=clearTimeout(n)),e=0;e<c;++e)r=u[e],i=le(this,u,r.identifier),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var s=a.touch0[0],l=a.touch0[1],f=a.touch1[0],h=a.touch1[1],p=(p=f[0]-s[0])*p+(p=f[1]-s[1])*p,d=(d=h[0]-l[0])*d+(d=h[1]-l[1])*d;r=m(r,Math.sqrt(p/d)),i=[(s[0]+f[0])/2,(s[1]+f[1])/2],o=[(l[0]+h[0])/2,(l[1]+h[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],o=a.touch0[1]}a.zoom("touch",w(x(r,i,o),a.extent))}function O(){var n,r,i=k(this,arguments),o=t.event.changedTouches,a=o.length;for(fM(),e&&clearTimeout(e),e=setTimeout((function(){e=null}),v),n=0;n<a;++n)r=o[n],i.touch0&&i.touch0[2]===r.identifier?delete i.touch0:i.touch1&&i.touch1[2]===r.identifier&&delete i.touch1;i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0?i.touch0[1]=this.__zoom.invert(i.touch0[0]):i.end()}return _.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",vM),t!==e?M(t,n):e.interrupt().each((function(){k(this,arguments).start().zoom(null,"function"===typeof n?n.apply(this,arguments):n).end()}))},_.scaleBy=function(t,n){_.scaleTo(t,(function(){var t=this.__zoom.k,e="function"===typeof n?n.apply(this,arguments):n;return t*e}))},_.scaleTo=function(t,n){_.transform(t,(function(){var t=i.apply(this,arguments),e=this.__zoom,r=b(t),o=e.invert(r),a="function"===typeof n?n.apply(this,arguments):n;return w(x(m(e,a),r,o),t)}))},_.translateBy=function(t,n,e){_.transform(t,(function(){return w(this.__zoom.translate("function"===typeof n?n.apply(this,arguments):n,"function"===typeof e?e.apply(this,arguments):e),i.apply(this,arguments))}))},S.prototype={start:function(){return 1===++this.active&&(this.index=p.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0===--this.active&&(p.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){Ut(new uM(_,t,this.that.__zoom),d.apply,d,[t,this.that,this.args])}},_.filter=function(t){return arguments.length?(r="function"===typeof t?t:aM(!!t),_):r},_.extent=function(t){return arguments.length?(i="function"===typeof t?t:aM([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),_):i},_.scaleExtent=function(t){return arguments.length?(o=+t[0],a=+t[1],_):[o,a]},_.translateExtent=function(t){return arguments.length?(u=+t[0][0],c=+t[1][0],s=+t[0][1],l=+t[1][1],_):[[u,s],[c,l]]},_.duration=function(t){return arguments.length?(f=+t,_):f},_.interpolate=function(t){return arguments.length?(h=t,_):h},_.on=function(){var t=d.on.apply(d,arguments);return t===d?_:t},_.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,_):Math.sqrt(g)},_};t.version=n,t.bisect=a,t.bisectRight=a,t.bisectLeft=u,t.ascending=e,t.bisector=r,t.cross=l,t.descending=f,t.deviation=d,t.extent=v,t.histogram=A,t.thresholdFreedmanDiaconis=O,t.thresholdScott=P,t.thresholdSturges=T,t.max=L,t.mean=U,t.median=D,t.merge=z,t.min=F,t.pairs=c,t.permute=j,t.quantile=C,t.range=w,t.scan=R,t.shuffle=I,t.sum=q,t.ticks=S,t.tickIncrement=E,t.tickStep=N,t.transpose=B,t.variance=p,t.zip=V,t.axisTop=rt,t.axisRight=it,t.axisBottom=ot,t.axisLeft=at,t.brush=Au,t.brushX=Nu,t.brushY=Tu,t.brushSelection=Eu,t.chord=ju,t.ribbon=Qu,t.nest=ec,t.set=sc,t.map=nc,t.keys=lc,t.values=fc,t.entries=hc,t.color=Re,t.rgb=He,t.hsl=Ge,t.lab=ur,t.hcl=dr,t.cubehelix=Sr,t.dispatch=ct,t.drag=we,t.dragDisable=de,t.dragEnable=ve,t.dsvFormat=yc,t.csvParse=_c,t.csvParseRows=mc,t.csvFormat=xc,t.csvFormatRows=wc,t.tsvParse=Mc,t.tsvParseRows=kc,t.tsvFormat=Sc,t.tsvFormatRows=Ec,t.easeLinear=sa,t.easeQuad=ha,t.easeQuadIn=la,t.easeQuadOut=fa,t.easeQuadInOut=ha,t.easeCubic=va,t.easeCubicIn=pa,t.easeCubicOut=da,t.easeCubicInOut=va,t.easePoly=ma,t.easePolyIn=ga,t.easePolyOut=_a,t.easePolyInOut=ma,t.easeSin=ka,t.easeSinIn=ba,t.easeSinOut=Ma,t.easeSinInOut=ka,t.easeExp=Na,t.easeExpIn=Sa,t.easeExpOut=Ea,t.easeExpInOut=Na,t.easeCircle=Ca,t.easeCircleIn=Ta,t.easeCircleOut=Aa,t.easeCircleInOut=Ca,t.easeBounce=Ba,t.easeBounceIn=qa,t.easeBounceOut=Ba,t.easeBounceInOut=Ha,t.easeBack=Ga,t.easeBackIn=Ya,t.easeBackOut=Xa,t.easeBackInOut=Ga,t.easeElastic=Qa,t.easeElasticIn=Ja,t.easeElasticOut=Qa,t.easeElasticInOut=Ka,t.forceCenter=Nc,t.forceCollide=ts,t.forceLink=rs,t.forceManyBody=ls,t.forceSimulation=ss,t.forceX=fs,t.forceY=hs,t.formatDefaultLocale=Ts,t.formatLocale=Ns,t.formatSpecifier=bs,t.precisionFixed=As,t.precisionPrefix=Cs,t.precisionRound=Os,t.geoArea=Pl,t.geoBounds=gf,t.geoCentroid=Af,t.geoCircle=If,t.geoClipExtent=Kf,t.geoContains=xh,t.geoDistance=fh,t.geoGraticule=Mh,t.geoGraticule10=kh,t.geoInterpolate=Ah,t.geoLength=ch,t.geoPath=Sp,t.geoAlbers=Jp,t.geoAlbersUsa=Kp,t.geoAzimuthalEqualArea=rd,t.geoAzimuthalEqualAreaRaw=ed,t.geoAzimuthalEquidistant=od,t.geoAzimuthalEquidistantRaw=id,t.geoConicConformal=fd,t.geoConicConformalRaw=ld,t.geoConicEqualArea=Zp,t.geoConicEqualAreaRaw=$p,t.geoConicEquidistant=vd,t.geoConicEquidistantRaw=dd,t.geoEquirectangular=pd,t.geoEquirectangularRaw=hd,t.geoGnomonic=gd,t.geoGnomonicRaw=yd,t.geoIdentity=md,t.geoProjection=Yp,t.geoProjectionMutator=Xp,t.geoMercator=ud,t.geoMercatorRaw=ad,t.geoOrthographic=wd,t.geoOrthographicRaw=xd,t.geoStereographic=Md,t.geoStereographicRaw=bd,t.geoTransverseMercator=Sd,t.geoTransverseMercatorRaw=kd,t.geoRotation=Ff,t.geoStream=yl,t.geoTransform=Up,t.cluster=Ld,t.hierarchy=Gd,t.pack=_v,t.packSiblings=hv,t.packEnclose=nv,t.partition=kv,t.stratify=Cv,t.tree=Rv,t.treemap=Vv,t.treemapBinary=Yv,t.treemapDice=Mv,t.treemapSlice=Iv,t.treemapSliceDice=Xv,t.treemapSquarify=Hv,t.treemapResquarify=Gv,t.interpolate=Kr,t.interpolateArray=Ir,t.interpolateBasis=Tr,t.interpolateBasisClosed=Ar,t.interpolateDate=qr,t.interpolateNumber=Br,t.interpolateObject=Hr,t.interpolateRound=ti,t.interpolateString=Qr,t.interpolateTransformCss=ui,t.interpolateTransformSvg=ci,t.interpolateZoom=yi,t.interpolateRgb=zr,t.interpolateRgbBasis=jr,t.interpolateRgbBasisClosed=Rr,t.interpolateHsl=_i,t.interpolateHslLong=mi,t.interpolateLab=xi,t.interpolateHcl=bi,t.interpolateHclLong=Mi,t.interpolateCubehelix=Ni,t.interpolateCubehelixLong=Ti,t.quantize=Ai,t.path=Xu,t.polygonArea=Wv,t.polygonCentroid=$v,t.polygonHull=Kv,t.polygonContains=ty,t.polygonLength=ny,t.quadtree=Wc,t.queue=ly,t.randomUniform=hy,t.randomNormal=py,t.randomLogNormal=dy,t.randomBates=yy,t.randomIrwinHall=vy,t.randomExponential=gy,t.request=_y,t.html=by,t.json=My,t.text=ky,t.xml=Sy,t.csv=Ty,t.tsv=Ay,t.scaleBand=Dy,t.scalePoint=Fy,t.scaleIdentity=Jy,t.scaleLinear=Zy,t.scaleLog=og,t.scaleOrdinal=Uy,t.scaleImplicit=Ly,t.scalePow=ug,t.scaleSqrt=cg,t.scaleQuantile=sg,t.scaleQuantize=lg,t.scaleThreshold=fg,t.scaleTime=jm,t.scaleUtc=Rm,t.schemeCategory10=qm,t.schemeCategory20b=Bm,t.schemeCategory20c=Hm,t.schemeCategory20=Vm,t.interpolateCubehelixDefault=Ym,t.interpolateRainbow=$m,t.interpolateWarm=Xm,t.interpolateCool=Gm,t.interpolateViridis=Jm,t.interpolateMagma=Qm,t.interpolateInferno=Km,t.interpolatePlasma=tx,t.scaleSequential=nx,t.creator=_t,t.local=xt,t.matcher=St,t.mouse=Ft,t.namespace=vt,t.namespaces=dt,t.select=ce,t.selectAll=se,t.selection=ue,t.selector=Rt,t.selectorAll=Bt,t.style=Mn,t.touch=le,t.touches=fe,t.window=_n,t.customEvent=Ut,t.arc=Mx,t.area=Ax,t.line=Tx,t.pie=Px,t.radialArea=jx,t.radialLine=Fx,t.linkHorizontal=Gx,t.linkVertical=Wx,t.linkRadial=$x,t.symbol=vw,t.symbols=dw,t.symbolCircle=Zx,t.symbolCross=Jx,t.symbolDiamond=tw,t.symbolSquare=aw,t.symbolStar=ow,t.symbolTriangle=cw,t.symbolWye=pw,t.curveBasisClosed=ww,t.curveBasisOpen=Mw,t.curveBasis=mw,t.curveBundle=Sw,t.curveCardinalClosed=Cw,t.curveCardinalOpen=Pw,t.curveCardinal=Tw,t.curveCatmullRomClosed=Fw,t.curveCatmullRomOpen=Rw,t.curveCatmullRom=Dw,t.curveLinearClosed=qw,t.curveLinear=Sx,t.curveMonotoneX=$w,t.curveMonotoneY=Zw,t.curveNatural=Kw,t.curveStep=nb,t.curveStepAfter=rb,t.curveStepBefore=eb,t.stack=ub,t.stackOffsetExpand=cb,t.stackOffsetDiverging=sb,t.stackOffsetNone=ib,t.stackOffsetSilhouette=lb,t.stackOffsetWiggle=fb,t.stackOrderAscending=hb,t.stackOrderDescending=db,t.stackOrderInsideOut=vb,t.stackOrderNone=ob,t.stackOrderReverse=yb,t.timeInterval=dg,t.timeMillisecond=vg,t.timeMilliseconds=yg,t.utcMillisecond=vg,t.utcMilliseconds=yg,t.timeSecond=bg,t.timeSeconds=Mg,t.utcSecond=bg,t.utcSeconds=Mg,t.timeMinute=kg,t.timeMinutes=Sg,t.timeHour=Eg,t.timeHours=Ng,t.timeDay=Tg,t.timeDays=Ag,t.timeWeek=Og,t.timeWeeks=jg,t.timeSunday=Og,t.timeSundays=jg,t.timeMonday=Pg,t.timeMondays=Rg,t.timeTuesday=Lg,t.timeTuesdays=Ig,t.timeWednesday=Ug,t.timeWednesdays=qg,t.timeThursday=Dg,t.timeThursdays=Bg,t.timeFriday=zg,t.timeFridays=Hg,t.timeSaturday=Fg,t.timeSaturdays=Vg,t.timeMonth=Yg,t.timeMonths=Xg,t.timeYear=Gg,t.timeYears=Wg,t.utcMinute=$g,t.utcMinutes=Zg,t.utcHour=Jg,t.utcHours=Qg,t.utcDay=Kg,t.utcDays=t_,t.utcWeek=e_,t.utcWeeks=s_,t.utcSunday=e_,t.utcSundays=s_,t.utcMonday=r_,t.utcMondays=l_,t.utcTuesday=i_,t.utcTuesdays=f_,t.utcWednesday=o_,t.utcWednesdays=h_,t.utcThursday=a_,t.utcThursdays=p_,t.utcFriday=u_,t.utcFridays=d_,t.utcSaturday=c_,t.utcSaturdays=v_,t.utcMonth=y_,t.utcMonths=g_,t.utcYear=__,t.utcYears=m_,t.timeFormatDefaultLocale=bm,t.timeFormatLocale=M_,t.isoFormat=Sm,t.isoParse=Nm,t.now=Ri,t.timer=Bi,t.timerFlush=Hi,t.timeout=Wi,t.interval=$i,t.transition=aa,t.active=iu,t.interrupt=lo,t.voronoi=oM,t.zoom=yM,t.zoomTransform=lM,t.zoomIdentity=sM,Object.defineProperty(t,"__esModule",{value:!0})}))},a5a2:function(t,n){t.exports=e},fae3:function(t,n,e){"use strict";if(e.r(n),e.d(n,"Visualization",(function(){return En})),e.d(n,"GetUsersFlow",(function(){return Un})),"undefined"!==typeof window){var r=window.document.currentScript,i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(e.p=i[1])}var o=e("8bbf"),a={class:"piwikUsersFlowVisualization",ref:"root"},u={class:"usersFlowActionBar"},c={class:"levelOfDetail",name:"levelOfDetail"},s={class:"actionsPerStep",name:"actionsPerStep"},l={class:"userFlowSource",name:"userFlowSource"},f={class:"sankeyChartOuter"},h=Object(o["createElementVNode"])("div",{class:"usersFlowPopupMenu"},null,-1);function p(t,n,e,r,i,p){var d=Object(o["resolveComponent"])("Field"),v=Object(o["resolveComponent"])("ActivityIndicator");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",a,[Object(o["createElementVNode"])("div",u,[Object(o["createElementVNode"])("div",c,[Object(o["createVNode"])(d,{uicontrol:"select",name:"levelOfDetail","model-value":t.actualLevelOfDetail,"onUpdate:modelValue":n[0]||(n[0]=function(n){t.actualLevelOfDetail=n,t.updateViewParams()}),title:t.translate("UsersFlow_OptionLevelOfDetail"),"full-width":!0,options:t.levelOfDetailOptions},null,8,["model-value","title","options"])]),Object(o["createElementVNode"])("div",s,[Object(o["createVNode"])(d,{uicontrol:"select",name:"actionsPerStep",title:t.translate("UsersFlow_OptionNumActionsPerStep"),modelValue:t.numActionsPerStep,"onUpdate:modelValue":n[1]||(n[1]=function(n){return t.numActionsPerStep=n}),"full-width":!0,options:t.actionsPerStepOptions},null,8,["title","modelValue","options"])]),Object(o["createElementVNode"])("div",l,[Object(o["createVNode"])(d,{uicontrol:"select",name:"userFlowSource",title:t.translate("General_Source"),modelValue:t.actualUserFlowSource,"onUpdate:modelValue":n[2]||(n[2]=function(n){return t.actualUserFlowSource=n}),"full-width":!0,options:t.flowSources},null,8,["title","modelValue","options"])])]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"exploringTraffic alert alert-info "},Object(o["toDisplayString"])(t.translate("UsersFlow_ExploringInfo",t.exploreUrl,t.exploreStep)),513),[[o["vShow"],t.exploreStep&&t.exploreUrl]]),Object(o["createVNode"])(v,{loading:t.isLoading},null,8,["loading"]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",f,[Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["sankeyChart","linkDetail".concat(t.actualLevelOfDetail)]),ref:"sankeyChart"},null,2)],512),[[o["vShow"],!t.isLoading]]),h,Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"pk-emptyDataTable"},Object(o["toDisplayString"])(t.translate("CoreHome_ThereIsNoDataForThisReport")),513),[[o["vShow"],!t.hasData]])],512)}var d=e("9314"),v="$";function y(){}function g(t,n){var e=new y;if(t instanceof y)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)while(++i<o)e.set(i,t[i]);else while(++i<o)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}y.prototype=g.prototype={constructor:y,has:function(t){return v+t in this},get:function(t){return this[v+t]},set:function(t,n){return this[v+t]=n,this},remove:function(t){var n=v+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===v&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===v&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===v&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===v&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===v&&++t;return t},empty:function(){for(var t in this)if(t[0]===v)return!1;return!0},each:function(t){for(var n in this)n[0]===v&&t(this[n],n.slice(1),this)}};var _=g;function m(){}var x=_.prototype;function w(t,n){var e=new m;if(t instanceof m)t.each((function(t){e.add(t)}));else if(t){var r=-1,i=t.length;if(null==n)while(++r<i)e.add(t[r]);else while(++r<i)e.add(n(t[r],r,t))}return e}m.prototype=w.prototype={constructor:m,has:x.has,add:function(t){return t+="",this[v+t]=t,this},remove:x.remove,clear:x.clear,values:x.keys,size:x.size,empty:x.empty,each:x.each};function b(){}var M=function(t){return null==t?b:function(){return this.querySelector(t)}},k=function(t){"function"!==typeof t&&(t=M(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,s=r[i]=new Array(c),l=0;l<c;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),s[l]=a);return new ln(r,this._parents)};function S(){return[]}var E=function(t){return null==t?S:function(){return this.querySelectorAll(t)}},N=function(t){"function"!==typeof t&&(t=E(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(t.call(a,a.__data__,s,u)),i.push(a));return new ln(r,i)},T=function(t){return function(){return this.matches(t)}},A=function(t){"function"!==typeof t&&(t=T(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],s=0;s<u;++s)(o=a[s])&&t.call(o,o.__data__,s,a)&&c.push(o);return new ln(r,this._parents)},C=function(t){return new Array(t.length)},O=function(){return new ln(this._enter||this._groups.map(C),this._parents)};function P(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}P.prototype={constructor:P,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var L=function(t){return function(){return t}},U="$";function D(t,n,e,r,i,o){for(var a,u=0,c=n.length,s=o.length;u<s;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new P(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function z(t,n,e,r,i,o,a){var u,c,s,l={},f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(c=n[u])&&(p[u]=s=U+a.call(c,c.__data__,u,n),s in l?i[u]=c:l[s]=c);for(u=0;u<h;++u)s=U+a.call(t,o[u],u,o),(c=l[s])?(r[u]=c,c.__data__=o[u],l[s]=null):e[u]=new P(t,o[u]);for(u=0;u<f;++u)(c=n[u])&&l[p[u]]===c&&(i[u]=c)}var F=function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each((function(t){p[++s]=t})),p;var e=n?z:D,r=this._parents,i=this._groups;"function"!==typeof t&&(t=L(t));for(var o=i.length,a=new Array(o),u=new Array(o),c=new Array(o),s=0;s<o;++s){var l=r[s],f=i[s],h=f.length,p=t.call(l,l&&l.__data__,s,r),d=p.length,v=u[s]=new Array(d),y=a[s]=new Array(d),g=c[s]=new Array(h);e(l,f,v,y,g,p,n);for(var _,m,x=0,w=0;x<d;++x)if(_=v[x]){x>=w&&(w=x+1);while(!(m=y[w])&&++w<d);_._next=m||null}}return a=new ln(a,r),a._enter=u,a._exit=c,a},j=function(){return new ln(this._exit||this._groups.map(C),this._parents)},R=function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"===typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},I=function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,s=n[u],l=e[u],f=s.length,h=a[u]=new Array(f),p=0;p<f;++p)(c=s[p]||l[p])&&(h[p]=c);for(;u<r;++u)a[u]=n[u];return new ln(a,this._parents)},q=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},B=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=H);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,s=i[o]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new ln(i,this._parents).order()};function H(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}var V=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},Y=function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},X=function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},G=function(){var t=0;return this.each((function(){++t})),t},W=function(){return!this.node()},$=function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},Z="http://www.w3.org/1999/xhtml",J={svg:"http://www.w3.org/2000/svg",xhtml:Z,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Q=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(n)?{space:J[n],local:t}:t};function K(t){return function(){this.removeAttribute(t)}}function tt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function nt(t,n){return function(){this.setAttribute(t,n)}}function et(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function rt(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function it(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var ot=function(t,n){var e=Q(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?tt:K:"function"===typeof n?e.local?it:rt:e.local?et:nt)(e,n))},at=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function ut(t){return function(){this.style.removeProperty(t)}}function ct(t,n,e){return function(){this.style.setProperty(t,n,e)}}function st(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}var lt=function(t,n,e){return arguments.length>1?this.each((null==n?ut:"function"===typeof n?st:ct)(t,n,null==e?"":e)):ft(this.node(),t)};function ft(t,n){return t.style.getPropertyValue(n)||at(t).getComputedStyle(t,null).getPropertyValue(n)}function ht(t){return function(){delete this[t]}}function pt(t,n){return function(){this[t]=n}}function dt(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}var vt=function(t,n){return arguments.length>1?this.each((null==n?ht:"function"===typeof n?dt:pt)(t,n)):this.node()[t]};function yt(t){return t.trim().split(/^|\s+/)}function gt(t){return t.classList||new _t(t)}function _t(t){this._node=t,this._names=yt(t.getAttribute("class")||"")}function mt(t,n){var e=gt(t),r=-1,i=n.length;while(++r<i)e.add(n[r])}function xt(t,n){var e=gt(t),r=-1,i=n.length;while(++r<i)e.remove(n[r])}function wt(t){return function(){mt(this,t)}}function bt(t){return function(){xt(this,t)}}function Mt(t,n){return function(){(n.apply(this,arguments)?mt:xt)(this,t)}}_t.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var kt=function(t,n){var e=yt(t+"");if(arguments.length<2){var r=gt(this.node()),i=-1,o=e.length;while(++i<o)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"===typeof n?Mt:n?wt:bt)(e,n))};function St(){this.textContent=""}function Et(t){return function(){this.textContent=t}}function Nt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}var Tt=function(t){return arguments.length?this.each(null==t?St:("function"===typeof t?Nt:Et)(t)):this.node().textContent};function At(){this.innerHTML=""}function Ct(t){return function(){this.innerHTML=t}}function Ot(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}var Pt=function(t){return arguments.length?this.each(null==t?At:("function"===typeof t?Ot:Ct)(t)):this.node().innerHTML};function Lt(){this.nextSibling&&this.parentNode.appendChild(this)}var Ut=function(){return this.each(Lt)};function Dt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}var zt=function(){return this.each(Dt)};function Ft(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Z&&n.documentElement.namespaceURI===Z?n.createElement(t):n.createElementNS(e,t)}}function jt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var Rt=function(t){var n=Q(t);return(n.local?jt:Ft)(n)},It=function(t){var n="function"===typeof t?t:Rt(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))};function qt(){return null}var Bt=function(t,n){var e="function"===typeof t?t:Rt(t),r=null==n?qt:"function"===typeof n?n:M(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))};function Ht(){var t=this.parentNode;t&&t.removeChild(this)}var Vt=function(){return this.each(Ht)};function Yt(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Xt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}var Gt=function(t){return this.select(t?Xt:Yt)},Wt=function(t){return arguments.length?this.property("__data__",t):this.node().__data__},$t={},Zt=null;if("undefined"!==typeof document){var Jt=document.documentElement;"onmouseenter"in Jt||($t={mouseenter:"mouseover",mouseleave:"mouseout"})}function Qt(t,n,e){return t=Kt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Kt(t,n,e){return function(r){var i=Zt;Zt=r;try{t.call(this,this.__data__,n,e)}finally{Zt=i}}}function tn(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function nn(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function en(t,n,e){var r=$t.hasOwnProperty(t.type)?Qt:Kt;return function(i,o,a){var u,c=this.__on,s=r(n,o,a);if(c)for(var l=0,f=c.length;l<f;++l)if((u=c[l]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=s,u.capture=e),void(u.value=n);this.addEventListener(t.type,s,e),u={type:t.type,name:t.name,value:n,listener:s,capture:e},c?c.push(u):this.__on=[u]}}var rn=function(t,n,e){var r,i,o=tn(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?en:nn,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value};function on(t,n,e){var r=at(t),i=r.CustomEvent;"function"===typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function an(t,n){return function(){return on(this,t,n)}}function un(t,n){return function(){return on(this,t,n.apply(this,arguments))}}var cn=function(t,n){return this.each(("function"===typeof n?un:an)(t,n))},sn=[null];function ln(t,n){this._groups=t,this._parents=n}function fn(){return new ln([[document.documentElement]],sn)}ln.prototype=fn.prototype={constructor:ln,select:k,selectAll:N,filter:A,data:F,enter:O,exit:j,join:R,merge:I,order:q,sort:B,call:V,nodes:Y,node:X,size:G,empty:W,each:$,attr:ot,style:lt,property:vt,classed:kt,text:Tt,html:Pt,raise:Ut,lower:zt,append:It,insert:Bt,remove:Vt,clone:Gt,datum:Wt,on:rn,dispatch:cn};var hn=fn,pn=function(t){return"string"===typeof t?new ln([[document.querySelector(t)]],[document.documentElement]):new ln([[t]],sn)},dn=function(){var t=s,n=l,e=f,r=document.body,i=M(),o=null,a=null,u=null;function c(t){o=k(t),o&&(a=o.createSVGPoint(),r.appendChild(i))}function s(){return"n"}function l(){return[0,0]}function f(){return" "}c.show=function(){var i=Array.prototype.slice.call(arguments);i[i.length-1]instanceof SVGElement&&(u=i.pop());var o,a=e.apply(this,i),s=n.apply(this,i),l=t.apply(this,i),f=S(),d=p.length,v=document.documentElement.scrollTop||r.scrollTop,y=document.documentElement.scrollLeft||r.scrollLeft;f.html(a).style("opacity",1).style("pointer-events","all");while(d--)f.classed(p[d],!1);return o=h.get(l).apply(this),f.classed(l,!0).style("top",o.top+s[0]+v+"px").style("left",o.left+s[1]+y+"px"),c},c.hide=function(){var t=S();return t.style("opacity",0).style("pointer-events","none"),c},c.attr=function(t,n){if(arguments.length<2&&"string"===typeof t)return S().attr(t);var e=Array.prototype.slice.call(arguments);return hn.prototype.attr.apply(S(),e),c},c.style=function(t,n){if(arguments.length<2&&"string"===typeof t)return S().style(t);var e=Array.prototype.slice.call(arguments);return hn.prototype.style.apply(S(),e),c},c.direction=function(n){return arguments.length?(t=null==n?n:N(n),c):t},c.offset=function(t){return arguments.length?(n=null==t?t:N(t),c):n},c.html=function(t){return arguments.length?(e=null==t?t:N(t),c):e},c.rootElement=function(t){return arguments.length?(r=null==t?t:N(t),c):r},c.destroy=function(){return i&&(S().remove(),i=null),c};var h=_({n:d,s:v,e:y,w:g,nw:m,ne:x,sw:w,se:b}),p=h.keys();function d(){var t=E(this);return{top:t.n.y-i.offsetHeight,left:t.n.x-i.offsetWidth/2}}function v(){var t=E(this);return{top:t.s.y,left:t.s.x-i.offsetWidth/2}}function y(){var t=E(this);return{top:t.e.y-i.offsetHeight/2,left:t.e.x}}function g(){var t=E(this);return{top:t.w.y-i.offsetHeight/2,left:t.w.x-i.offsetWidth}}function m(){var t=E(this);return{top:t.nw.y-i.offsetHeight,left:t.nw.x-i.offsetWidth}}function x(){var t=E(this);return{top:t.ne.y-i.offsetHeight,left:t.ne.x}}function w(){var t=E(this);return{top:t.sw.y,left:t.sw.x-i.offsetWidth}}function b(){var t=E(this);return{top:t.se.y,left:t.se.x}}function M(){var t=pn(document.createElement("div"));return t.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),t.node()}function k(t){var n=t.node();return n?"svg"===n.tagName.toLowerCase()?n:n.ownerSVGElement:null}function S(){return null==i&&(i=M(),r.appendChild(i)),pn(i)}function E(t){var n=u||t;while(null==n.getScreenCTM&&null!=n.parentNode)n=n.parentNode;var e={},r=n.getScreenCTM(),i=n.getBBox(),o=i.width,c=i.height,s=i.x,l=i.y;return a.x=s,a.y=l,e.nw=a.matrixTransform(r),a.x+=o,e.ne=a.matrixTransform(r),a.y+=c,e.se=a.matrixTransform(r),a.x-=o,e.sw=a.matrixTransform(r),a.y-=c/2,e.w=a.matrixTransform(r),a.x+=o,e.e=a.matrixTransform(r),a.x-=o/2,a.y-=c/2,e.n=a.matrixTransform(r),a.y+=c,e.s=a.matrixTransform(r),e}function N(t){return"function"===typeof t?t:function(){return t}}return c},vn=e("19dc"),yn=e("a5a2"),gn=function(t){t.sankey=function(){function n(t){return t&&"_out_"===t}function e(t){return t.isSummaryNode}var r={},i=24,o=8,a=[1,1],u=[],c=[];function s(){u.forEach((function(t){t.sourceLinks=[],t.targetLinks=[]})),c.forEach((function(t){var n=t.source,e=t.target;"number"===typeof n&&(n=t.source=u[t.source]),"number"===typeof e&&(e=t.target=u[t.target]),n.sourceLinks.push(t),e.targetLinks.push(t)}))}function l(){u.forEach((function(n){n.value=Math.max(t.sum(n.sourceLinks,y),t.sum(n.targetLinks,y))}))}function f(){var t=0;u.forEach((function(n){n.x=n.depth,n.dx=i,n.depth>t&&(t=n.depth)})),h((a[0]-i)/t)}function h(t){u.forEach((function(n){n.x*=t}))}function p(n){var r=t.nest().key((function(t){return t.x})).sortKeys(t.ascending).entries(u).map((function(t){return t.values}));s(),h();for(var i=1;n>0;--n)f(i*=.99),h(),l(i),h();function s(){var n=t.min(r,(function(n){var e=t.sum(n,y);return e?(a[1]-(n.length-1)*o)/e:0}));r.forEach((function(t){t.forEach((function(t,r){if(t.y=r,t.dy=t.value*n,e(t))return t.sourceLinks.forEach((function(n){n.scaleNodeDy=25/t.dy,n.scaleNodeMax=25})),void(t.dy=25);t.dy<4&&(t.sourceLinks.forEach((function(n){n.scaleNodeDy=4/t.dy,n.scaleNodeMax=4})),t.dy=4)}))})),c.forEach((function(t){t.dy=t.value*n,t.scaleNodeDy&&(t.dy*=t.scaleNodeDy),t.scaleNodeMax&&t.dy>t.scaleNodeMax&&(t.dy=t.scaleNodeMax)}))}function l(n){function e(t){return v(t.source)*t.value}r.forEach((function(r,i){r.forEach((function(r){if(r.targetLinks.length){var i=t.sum(r.targetLinks,e)/t.sum(r.targetLinks,y);r.y+=(i-v(r))*n}}))}))}function f(n){function e(t){return v(t.target)*t.value}r.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var i=t.sum(r.sourceLinks,e)/t.sum(r.sourceLinks,y);r.y+=(i-v(r))*n}}))}))}function h(){r.forEach((function(t){var n,e,r,i=0,a=t.length;for(r=0;r<a;++r)n=t[r],e=i-n.y,e>0&&(n.y+=e),i=n.y+n.dy+o}))}}function d(){function t(t,n){return t.source.y-n.source.y}function n(t,n){return t.target.y-n.target.y}u.forEach((function(e){e.sourceLinks.sort(n),e.targetLinks.sort(t)})),u.forEach((function(t){var n=0,e=0;t.sourceLinks.forEach((function(t){t.sy=n,n+=t.dy})),t.targetLinks.forEach((function(t){t.ty=e,e+=t.dy}))}))}function v(t){return 0}function y(t){return t.value}return r.nodeWidth=function(t){return arguments.length?(i=+t,r):i},r.nodePadding=function(t){return arguments.length?(o=+t,r):o},r.nodes=function(t){return arguments.length?(u=t,r):u},r.links=function(t){return arguments.length?(c=t,r):c},r.size=function(t){return arguments.length?(a=t,r):a},r.layout=function(t){return s(),l(),f(),p(t),d(),r},r.relayout=function(){return d(),r},r.link=function(){var e=.5;function r(r){if(n(r.target.name)){var i=r.source.x+r.source.dx,o=r.source.y+r.sy+r.dy/2;return"M"+i+","+o+" L"+(i+15)+","+o}i=r.source.x+r.source.dx;var a=r.target.x,u=t.interpolateNumber(i,a),c=u(e),s=u(1-e),l=(o=r.source.y+r.sy+r.dy/2,r.target.y+r.ty+r.dy/2);return"M"+i+","+o+"C"+c+","+o+" "+s+","+l+" "+a+","+l}return r.curvature=function(t){return arguments.length?(e=+t,r):e},r},r}};gn(d);var _n="_out_",mn="Others",xn=Object(vn["translate"])("General_Others"),wn=window,bn=wn.$;function Mn(t){return t===_n}function kn(t){return t===mn||t===xn}var Sn=Object(o["defineComponent"])({props:{actionsPerStep:Number,levelOfDetail:Number,userFlowSource:String},components:{Field:yn["Field"],ActivityIndicator:vn["ActivityIndicator"]},data:function(){return{numSteps:4,hasData:!0,isLoading:!1,maxSankeyChartDepth:0,maxNodeLength:0,isExploringTraffic:!1,exploreStep:!1,exploreUrl:!1,flowSources:[],numActionsPerStep:this.actionsPerStep||5,rawResponse:null,actualLevelOfDetail:this.levelOfDetail||5,actualUserFlowSource:this.userFlowSource}},watch:{numActionsPerStep:function(t){null!==t&&(this.fetchData(),this.updateViewParams())},actualUserFlowSource:function(t){null!==t&&(this.fetchData(),this.updateViewParams())}},created:function(){var t=this;vn["AjaxHelper"].fetch({method:"UsersFlow.getAvailableDataSources"}).then((function(n){t.flowSources=n.map((function(t){return{key:t.value,value:t.name}}))})),this.fetchData()},beforeUnmount:function(){this.clearSankeyChart()},methods:{isUrlLike:function(t){return!!t&&("page_url"===this.actualUserFlowSource&&/^(.+)[.](.+)\/(.*)$/.test(t))},completeUrl:function(t){return 0===t.indexOf("http")?t:"".concat(window.location.protocol,"//").concat(t)},showGroupDetails:function(t,n,e,r){var i=vn["MatomoUrl"].stringify({showtitle:1,widget:1,module:"UsersFlow",action:"getInteractionActions",interactionPosition:n,offsetActionsPerStep:e?this.numActionsPerStep:void 0,rowLabel:t||void 0,idSubtable:r||void 0,dataSource:this.actualUserFlowSource||void 0});window.Piwik_Popover.createPopupAndLoadUrl(i,Object(vn["translate"])("UsersFlow_Interactions"))},setSankeyStep:function(t){t>this.maxSankeyChartDepth?this.numSteps=1:this.numSteps=t<1?1:t,this.clearSankeyChart();var n=this.buildNodesAndIndexes(this.rawResponse||[]);this.drawSankeyChart(n)},addSankeyStep:function(){this.setSankeyStep(this.numSteps+1)},clearSankeyChart:function(){var t=this.$refs.sankeyChart;if(t){var n=d["select"](t).selectAll("svg");n&&d["select"](t).selectAll("svg").remove()}},makeToolTip:function(t){return'<span class="userFlowNodeTooltip">'.concat(t,"</span>")},setMaxSankeyChartDepth:function(t){this.maxSankeyChartDepth=parseInt(t,10)},setMaxNodeLength:function(t){this.maxNodeLength=parseInt(t,10)},getPercentage:function(t,n){var e=Math.round(t/n*100*100)/100;return"".concat(e,"%")},drawSankeyChart:function(t){var n=this,e=t.nodes,r=t.links,i=t.depthNodes,o=this,a=!1;function u(t,n){d["select"]("#link-".concat(t)).classed("highlightedLink",n)}function c(t){var n,e=[],r=d["select"](this);"1"===r.attr("data-clicked")?(r.attr("data-clicked","0"),n=!1):(d["select"](this).attr("data-clicked","1"),n=!0),r.classed("highlightedNode",n);var i=[{linkType:"sourceLinks",nodeType:"target"},{linkType:"targetLinks",nodeType:"source"}],o=function(t,e,r){Mn(t.target.name)||(r.push(t[e.nodeType]),u(t.id,n))};i.forEach((function(n){t[n.linkType].forEach((function(t){return o(t,n,e)}));var r=function(){var t=[];e.forEach((function(e){e[n.linkType].forEach((function(e){return o(e,n,t)}))})),e=t};while(e.length)r()}))}function s(t){var n=t.depth+1;kn(t.name)?o.showGroupDetails(t.name,n,!0):t.idSubtable&&o.showGroupDetails(t.name,n,!1,t.idSubtable)}function l(t){var n=this,e=d["event"];e.preventDefault(),e.stopPropagation();var r="1"===d["select"](this).attr("data-clicked");a||(bn("body > .usersFlowPopupMenu").length||bn(".usersFlowPopupMenu").appendTo("body"),a=!0,d["select"]("body").on("click",(function(){var t=d["select"]("body > .usersFlowPopupMenu");t.style("display","none"),t.html("")})));var i="UsersFlow_ActionHighlightTraffic";r&&(i="UsersFlow_ActionClearHighlight");var u=d["select"]("body > .usersFlowPopupMenu");u.html("");var l=u.append("ul");l.append("li").attr("class","highlightTraffic").on("click",(function(){c.call(n,t)})).text(Object(vn["translate"])(i)),o.canEnableExploreTraffic&&!kn(t.name)&&(l.append("li").attr("class","divider").html("<hr />"),l.append("li").attr("class","exploreTraffic").on("click",(function(){o.exploreStep=t.depth+1,o.exploreUrl=t.name,o.numSteps=o.exploreStep+2,o.fetchData()})).text(Object(vn["translate"])("UsersFlow_ExploreTraffic"))),o.isExploringTraffic?(l.append("li").attr("class","divider").html("<hr />"),l.append("li").attr("class","unexploreTraffic").on("click",(function(){o.exploreStep=!1,o.exploreUrl=!1,o.fetchData()})).text(Object(vn["translate"])("UsersFlow_UnexploreTraffic"))):(t.idSubtable||kn(t.name))&&(l.append("li").attr("class","divider").html("<hr />"),l.append("li").attr("class","showNodeDetails").on("click",(function(){s.apply(n,[t])})).text(Object(vn["translate"])("UsersFlow_ActionShowDetails"))),o.isUrlLike(t.name)&&!kn(t.name)&&(l.append("li").attr("class","divider").html("<hr />"),l.append("li").attr("class","openPageUrl").append("a").attr("href",o.completeUrl(t.name)).attr("rel","noreferrer").attr("target","_blank").text(Object(vn["translate"])("Installation_SystemCheckOpenURL"))),u.style("left","".concat(e.pageX-2,"px")).style("top","".concat(e.pageY-2,"px")).style("display","block")}var f=200,h=40,p=350,v={top:70,right:20,bottom:20,left:5},y=550+(this.numSteps-2)*p+150,g=y-150,_=100*this.maxNodeLength+v.top,m=this.$refs.sankeyChart;bn(m).css("width",y+v.left+v.right).css("height",_+v.top+v.bottom+5);var x=d["format"](",.0f"),w=function(t){return x(t)},b=d["select"](m).append("svg").attr("width",y+v.left+v.right).attr("height",_+v.top+v.bottom).append("g").attr("transform","translate(".concat(v.left,",").concat(v.top,")")),M=b.append("svg:defs").append("svg:linearGradient").attr("id","normalGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");M.append("svg:stop").attr("offset","0%").attr("stop-color","#F2FFE9").attr("stop-opacity",1),M.append("svg:stop").attr("offset","100%").attr("stop-color","#84D04D").attr("stop-opacity",1);var k=b.append("svg:defs").append("svg:linearGradient").attr("id","pageOutGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");k.append("svg:stop").attr("offset","0%").attr("stop-color","#FCE8E8").attr("stop-opacity",1),k.append("svg:stop").attr("offset","100%").attr("stop-color","#FA5858").attr("stop-opacity",1);var S=d["sankey"]().nodeWidth(f).nodePadding(h).size([g,_]),E=S.link();if(e&&r&&i){var N=b.append("g").selectAll(".depthInfo").data(i).enter().append("g").attr("class",(function(t){return"depthInfo depth".concat(t.depth+1)}));N.append("rect").attr("height",50).attr("width",f).attr("x",(function(t){return t.depth*p})).attr("y",-80).style("fill","none");var T=N.append("text").attr("y",-60);if(this.numSteps>1){var A=N.append("svg").attr("viewBox","-100 -100 1500 1500").attr("width","18").attr("height","18").attr("y","-68").attr("x",(function(t){return t.depth*p+f-10})).attr("class","removeStep").on("click",(function(t){n.setSankeyStep(t.depth)})).style("visibility",(function(t){return t.depth>1?"visible":"hidden"})).attr("dy",1);A.append("path").attr("d","M874.048 810.048c-199.936 199.936-524.16 199.936-724.096 0s-199.936-524.16 0-724.096c199.936-199.936 524.16-199.936 724.096 0s199.936 524.16 0 724.096zM692.992 267.008c-33.344-33.344-87.36-33.344-120.64 0l-60.352 60.288-60.352-60.352c-33.344-33.344-87.36-33.344-120.64 0-33.344 33.344-33.344 87.36 0 120.704l60.352 60.352-60.352 60.352c-33.344 33.344-33.344 87.36 0 120.704s87.36 33.344 120.64 0l60.352-60.352 60.352 60.352c33.344 33.344 87.36 33.344 120.64 0 33.344-33.344 33.344-87.36 0-120.704l-60.288-60.352 60.352-60.352c33.28-33.344 33.28-87.36-0.064-120.64z").attr("fill","#999").append("title").text(Object(vn["translate"])("UsersFlow_ActionRemoveStep")),A.append("rect").attr("fill","transparent").attr("width","900").attr("height","900").attr("x",50).append("title").text(Object(vn["translate"])("UsersFlow_ActionRemoveStep"))}T.append("svg:tspan").attr("x",(function(t){return t.depth*p})).attr("dy",5).attr("fill","black").style("font-weight","bold").attr("class","depthContainerTitle").text((function(t){return"".concat(Object(vn["translate"])("UsersFlow_ColumnInteraction")," ").concat(t.depth+1)})).on("click",(function(t){var e=parseInt(t.depth,10)+1;n.showGroupDetails("",e,!1)})).append("svg:tspan").attr("x",(function(t){return t.depth*p})).attr("dy",20).style("font-weight","normal").style("font-size","13px").text((function(t){if("undefined"===typeof t.totalIn)return null;var n="".concat(Object(vn["translate"])("General_NVisits",t.totalIn),", ");return n+="".concat(Object(vn["translate"])("UsersFlow_NProceededInline",t.totalOut),", "),n+=Object(vn["translate"])("Transitions_ExitsInline",t.totalExits),n})).attr("fill","black"),S.nodes(e).links(r).layout(32);var C=dn().attr("class","d3-tip").offset([-10,0]).html((function(t){var e=w(t.value);if(t.source&&t.source.totalIn&&(e+=" (".concat(n.getPercentage(t.value,t.source.totalIn),")")),Mn(t.target.name)){var r=Object(vn["translate"])("Transitions_ExitsInline",e),i=vn["Matomo"].helper.htmlEntities(window.vueSanitize(t.source.name));return n.makeToolTip("".concat(i,": <span class='nodeTooltipExits'>").concat(r,"</span>"))}var o='"'.concat(vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.source.name)),'"'),a='"'.concat(vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.target.name)),'"'),u=Object(vn["translate"])("UsersFlow_InteractionXToY",o,a);return n.makeToolTip("".concat(u,"<br />").concat(e))})),O=b.append("g").selectAll(".link").data(r).enter().append("path").attr("class",(function(t){var n="link ";if(Mn(t.target.name))return"".concat(n," outNodeLink");var e=0;return t.source.totalOut>0&&(e=t.value/t.source.totalOut*100),n+=e<=8?" linkSize1":e<=16?" linkSize2":e<=24?" linkSize3":e<=32?" linkSize4":e<=42?" linkSize5":" linkSize6",n})).attr("d",E).attr("id",(function(t,n){return t.id=n,"link-".concat(n)})).style("stroke",(function(t){return Mn(t.target.name)?"#ec5540":"#A9E2F3"})).style("stroke-width",(function(t){return Math.max(1,t.dy)})).sort((function(t,n){return n.dy-t.dy}));O&&!O.empty()&&O.call(C).on("mouseover",C.show).on("mouseout",C.hide);var P=dn().attr("class","d3-tip").offset([-10,0]).html((function(t){if(Mn(t.name))return"";var e=vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.name)),r=Object(vn["translate"])("General_ColumnNbVisits"),i="<span class='nodeTooltipProceeded'>\n".concat(t.totalOut," (").concat(n.getPercentage(t.totalOut,t.totalIn),")\n</span>"),o="<span class='nodeTooltipExits'>\n".concat(t.totalExits," (").concat(n.getPercentage(t.totalExits,t.totalIn),")\n</span>");return n.makeToolTip("".concat(e,"<br/>\n").concat(r,": <span class='nodeTooltipVisits'>").concat(t.totalIn,"</span><br/>\n").concat(Object(vn["translate"])("UsersFlow_ColumnProceeded"),": ").concat(i,"<br/>\n").concat(Object(vn["translate"])("General_ColumnExits"),": ").concat(o))})),L=b.append("g").selectAll(".node").data(e).enter().append("g").attr("class",(function(t){var n="node nodeDepth".concat(t.depth+1);return Mn(t.name)&&(n+=" outNode"),n})).attr("transform",(function(t){return"translate(".concat(t.x,",").concat(t.y,")")}));if(L.on("click",l),L.call(P).on("mouseover",P.show).on("mouseout",P.hide),L.append("rect").attr("height",(function(t){return t.dy})).attr("width",S.nodeWidth()).style("fill",(function(t){return Mn(t.name)?"url(#pageOutGradient)":"url(#normalGradient)"})).style("stroke","#333"),L.append("text").attr("x",4).attr("y",-5).attr("text-anchor","left").attr("transform","rotate(0)").text((function(t){if(Mn(t.name))return"";var e=t.name;return kn(e)?(t.pagesInGroup&&(e+=" (>".concat(Object(vn["translate"])("VisitorInterest_NPages",t.pagesInGroup),")")),e):(n.isUrlLike(e)&&(e=e.substr(e.indexOf("/"))),e.length>33?"".concat(e.substr(0,15),"...").concat(e.substr(-15)):e)})).attr("fill","black"),L.append("text").attr("x",4).attr("y",18).attr("transform","rotate(0)").attr("text-anchor","left").text((function(t){return w(t.totalIn)})).attr("fill","black"),this.numSteps<this.maxSankeyChartDepth){var U=b.append("g").attr("class","addNewStepContainer").on("click",(function(){o.addSankeyStep(),setTimeout((function(){var t=bn(".sankeyChartOuter > div").width();t&&bn(".sankeyChartOuter").animate({scrollLeft:t-3})}),20)}));U.append("path").attr("d","M512 960c-282.752 0-512-229.248-512-512s229.248-512 512-512 512 229.248 512 512-229.248 512-512 512zM682.688 362.688h-85.376v-85.312c0-47.168-38.208-85.376-85.312-85.376s-85.312 38.208-85.312 85.312v85.376h-85.376c-47.104 0-85.312 38.208-85.312 85.312s38.208 85.312 85.312 85.312h85.312v85.376c0.064 47.104 38.272 85.312 85.376 85.312s85.312-38.208 85.312-85.312v-85.312h85.312c47.168-0.064 85.376-38.272 85.376-85.376s-38.208-85.312-85.312-85.312z").attr("dx",y-50).attr("dy",-30).attr("transform","translate(".concat(y-50,",-66) scale(0.04)")).attr("text-anchor","middle").attr("class","addNewStep").append("title").text(Object(vn["translate"])("UsersFlow_ActionAddStep")),U.append("rect").attr("x",y-50).attr("y","-69").attr("width","40").attr("height","40").attr("fill","transparent").style("cursor","pointer").append("title").text(Object(vn["translate"])("UsersFlow_ActionAddStep"))}}},buildNodesAndIndexes:function(t){var n=this;this.maxSankeyChartDepth=0,this.maxNodeLength=0;var e,r=[],i=[],o=[];t.forEach((function(t){e=parseInt(t.label,10),e>n.maxSankeyChartDepth&&(n.maxSankeyChartDepth=e)})),this.numSteps>this.maxSankeyChartDepth&&(this.numSteps=this.maxSankeyChartDepth);var a=0;return t.forEach((function(t){if(e=parseInt(t.label,10),t.subtable&&(t.subtable.length+1>n.maxNodeLength&&(n.maxNodeLength=t.subtable.length+1),!(e>n.numSteps))){var u={depth:e-1,in:0,out:0,totalIn:t.nb_visits,totalOut:t.nb_proceeded,totalExits:t.nb_exits};t.subtable.forEach((function(t){var o=t.label;kn(o)||(u.in+=t.nb_visits,u.out+=t.nb_proceeded),i.push({depth:e-1,name:o,node:a,totalIn:t.nb_visits,totalOut:t.nb_proceeded,totalExits:t.nb_exits,pagesInGroup:t.nb_pages_in_group?t.nb_pages_in_group:0,isSummaryNode:kn(o),idSubtable:t.idsubdatatable?t.idsubdatatable:null}),a+=1,e>=n.numSteps||t.subtable&&((t.subtable||[]).forEach((function(t){r.push({depth:e,source:a-1,target:t.label,value:t.nb_visits})})),t.nb_exits&&r.push({depth:e,source:a-1,target:_n,value:t.nb_exits}))})),o.push(u),e>1&&(i.push({depth:e-1,name:_n,node:a,value:0,totalIn:0}),a+=1)}})),r.forEach((function(t){i.some((function(n){return t.target===n.name&&t.depth===n.depth&&(t.target=n.node,!0)}))})),{nodes:i,links:r,depthNodes:o}},fetchData:function(){var t=this;this.clearSankeyChart(),this.isExploringTraffic=!(!this.exploreStep||!this.exploreUrl),this.isLoading=!0,this.rawResponse=[],vn["AjaxHelper"].fetch({method:"UsersFlow.getUsersFlow",expanded:"1",filter_limit:"-1",dataSource:this.actualUserFlowSource,limitActionsPerStep:this.numActionsPerStep,exploreStep:this.isExploringTraffic?this.exploreStep:void 0,exploreUrl:this.isExploringTraffic?this.exploreUrl:void 0}).then((function(n){if(t.isLoading=!1,t.rawResponse=n,t.clearSankeyChart(),(null===n||void 0===n?void 0:n.length)>0){var e=t.buildNodesAndIndexes(t.rawResponse);t.drawSankeyChart(e)}else t.hasData=!1}))},updateViewParams:function(){var t={numActionsPerStep:this.numActionsPerStep,levelOfDetail:this.actualLevelOfDetail,userFlowSource:this.actualUserFlowSource};vn["AjaxHelper"].post({module:"CoreHome",action:"saveViewDataTableParameters",report_id:"UsersFlow.getUsersFlow",segment:""},{parameters:JSON.stringify(t)},{withTokenInUrl:!0,format:"html"}).catch((function(){}))}},computed:{canEnableExploreTraffic:function(){return"year"!==vn["Matomo"].period},actionsPerStepOptions:function(){for(var t=[{key:4,value:4},{key:5,value:5}],n=6;n<=20;n+=2)t.push({key:n,value:n});return t},levelOfDetailOptions:function(){return[{key:1,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail1")},{key:2,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail2")},{key:3,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail3")},{key:4,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail4")},{key:5,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail5")},{key:6,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail6")}]}}});Sn.render=p;var En=Sn,Nn={key:0},Tn={class:"widgetBody usersFlowIntroduction"},An={key:1,class:"card"},Cn={class:"card-content"},On={key:2,class:"widgetBody"};function Pn(t,n,e,r,i,a){var u=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("Visualization");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[t.showTitle?(Object(o["openBlock"])(),Object(o["createElementBlock"])("h2",Nn,[Object(o["createVNode"])(u,null,{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(t.translate("UsersFlow_UsersFlow")),1)]})),_:1})])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("p",Tn,Object(o["toDisplayString"])(t.translate("UsersFlow_UsersFlowVisualizationDescription1"))+" "+Object(o["toDisplayString"])(t.usersFlowDesc2),1),t.showTitle?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",An,[Object(o["createElementVNode"])("div",Cn,[Object(o["createVNode"])(c,{"actions-per-step":t.actionsPerStep,"level-of-detail":t.levelOfDetail,"user-flow-source":t.userFlowSource},null,8,["actions-per-step","level-of-detail","user-flow-source"])])])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",On,[Object(o["createVNode"])(c,{"actions-per-step":t.actionsPerStep,"level-of-detail":t.levelOfDetail,"user-flow-source":t.userFlowSource},null,8,["actions-per-step","level-of-detail","user-flow-source"])]))],64)}var Ln=Object(o["defineComponent"])({props:{showTitle:String,actionsPerStep:Number,levelOfDetail:Number,userFlowSource:String},components:{EnrichedHeadline:vn["EnrichedHeadline"],Visualization:En},computed:{usersFlowDesc2:function(){return Object(vn["translate"])("UsersFlow_UsersFlowVisualizationDescription2",Object(vn["translate"])("General_Others"),Object(vn["translate"])("UsersFlow_ColumnInteraction"),Object(vn["translate"])("UsersFlow_ActionShowDetails"),Object(vn["translate"])("UsersFlow_ExploreTraffic"))}}});Ln.render=Pn;var Un=Ln;
/**
 * Copyright (C) InnoCraft Ltd - All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains the property of InnoCraft Ltd.
 * The intellectual and technical concepts contained herein are protected by trade secret
 * or copyright law. Redistribution of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.
 *
 * You shall use this code only in accordance with the license agreement obtained from
 * InnoCraft Ltd.
 *
 * @link https://www.innocraft.com/
 * @license For license details see https://www.innocraft.com/license
 */}})}));
//# 