1"use strict";(self.webpackChunkinfobip2024=self.webpackChunkinfobip2024||[]).push([[19503],{19503(t,e,n){var r=n(98490),a=n.n(r),l=n(23106),o=n(95418),i=function(){var t;function e(t){var n=t.tableElement,r=t.selector;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.tableElement=n,this.ACTIVE_CURRENCY=this.tableElement.dataset.defaultCurrency,this.PRECISION=this.tableElement.dataset.precision,this.channel=this.tableElement.dataset.channel,this.transformationFactor=parseFloat(this.tableElement.dataset.transformationFactor),this.TABS_TEMPLATE_SELECTOR="".concat(r,"-template"),this.TAB_TRIGGER_SELECTOR="".concat(r,"-tab-button"),this.hasOperatorColumn=!["whatsapp","viber"].includes(this.channel),this.currencies=["EUR","USD"],this.parsedData=[],this.TABLE_DATA={headings:[],data:[]},this.rowRecords=[]}return t=[{key:"init",value:function(){this.parseData(),this.initTable(),this.setupCurrencyPicker(),this.syncCurrencyTabs(),this.registerCurrencyChangeEventListeners(),this.renderActiveCurrencyCells()}},{key:"parseData",value:function(){this.parsedData=JSON.parse(this.tableElement.dataset.pricing),this.TABLE_DATA=this.buildTableData(),this.parsedData.length<=2?this.tableElement.classList.add("single-row"):this.tableElement.classList.remove("single-row")}},{key:"buildTableData",value:function(){var t=this,e={headings:this.hasOperatorColumn?[this.tableElement.dataset.countryLabel,this.tableElement.dataset.unitLabel]:[this.tableElement.dataset.countryLabel,this.tableElement.dataset.typeLabel,this.tableElement.dataset.unitLabel],data:[]};return this.rowRecords=[],this.parsedData.filter(function(e){return e.currency===t.ACTIVE_CURRENCY}).forEach(function(n){var r,a,l={};t.currencies.forEach(function(e){var r;r=t.hasOperatorColumn?t.parsedData.find(function(t){return t.currency===e&&t.country===n.country}):t.parsedData.find(function(t){return t.currency===e&&t.country===n.country&&t.operator===n.operator}),l[e]=t.formatPrice(null==r?void 0:r.price)});var o=t.normalizeOperator(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){var r;r=n[e],e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r})}return t}({},n),t.channel),i=l[t.ACTIVE_CURRENCY];t.hasOperatorColumn?e.data.push([t.getCountryLabel(n.country,n.country_full_name),i]):e.data.push([t.getCountryLabel(n.country,n.country_full_name),null!=(a=null==o?void 0:o.operator)?a:n.operator,i]),t.rowRecords.push({country:n.country,countryFullName:n.country_full_name,operator:null!=(r=null==o?void 0:o.operator)?r:n.operator,prices:l})}),e}},{key:"normalizeOperator",value:function(t,e){return(null==t?void 0:t.operator)==="FreeForm"&&(t.operator="Free Form"),(null==t?void 0:t.operator)==="AuthenticationInternational"&&(t.operator="International Authentication"),(null==t?void 0:t.operator)==="Marketing"&&"whatsapp"===e&&(t.operator="Marketing (Cloud)"),(null==t?void 0:t.operator)==="Mmlite"&&(t.operator="Marketing (formerly MM Lite)"),(null==t?void 0:t.operator)==="Otp"&&(t.operator="OTP"),t}},{key:"formatPrice",value:function(t){return Number(Math.round(parseFloat(t)*this.transformationFactor/100+"e"+this.PRECISION)+"e-"+this.PRECISION)}},{key:"initTable",value:function(){var t,e,n,r,a,i,u,s,c=this,h=JSON.parse(this.tableElement.dataset.translations),d=this.getPriceColumnIndex();this.table=new l.bQ(this.tableElement,{data:this.TABLE_DATA,pagerDelta:1,columns:[{select:d,type:"number",render:function(t){var e=c.ACTIVE_CURRENCY;return'<span aria-hidden="true">'.concat(t,'</span><span class="sr-only">').concat(t," ").concat(e,"</span>")}}],classes:{table:null!=(t=null==(a=o.tailwind)||null==(r=a.parts)||null==(n=r.table)?void 0:n.twClasses)?t:"",row:null!=(e=null==(s=o.tailwind)||null==(u=s.parts)||null==(i=u.row)?void 0:i.twClasses)?e:""},labels:h}),this.enhanceSortAccessibility()}},{key:"enhanceSortAccessibility",value:function(){this.tableElement.querySelectorAll("th").forEach(function(t){var e=t.querySelector("button");if(e){var n,r=(null==(n=t.textContent)?void 0:n.trim())||"";e.setAttribute("aria-label","Sort by ".concat(r))}})}},{key:"getCountryLabel",value:function(t,e){var n=e.replace(/[^a-zA-Z]/g,"").toLowerCase();return'<img alt="" aria-hidden="true" class="country-'.concat(n,' h-auto w-18 inline-block mr-8" src="/wp-content/themes/infobip2024/flags/').concat(t.toLowerCase(),'.svg" /> ').concat(e)}},{key:"setupCurrencyPicker",value:function(){var t=this.tableElement.querySelector(this.TABS_TEMPLATE_SELECTOR),e=this.tableElement.querySelector(".datatable-top");t&&e&&e.appendChild(t.content.cloneNode(!0).firstElementChild)}},{key:"syncCurrencyTabs",value:function(){var t=this;this.tableElement.querySelectorAll(this.TAB_TRIGGER_SELECTOR).forEac
1h(function(e){e.setAttribute("aria-selected",e.dataset.currency===t.ACTIVE_CURRENCY?"true":"false")})}},{key:"getPriceColumnIndex",value:function(){return this.hasOperatorColumn?1:2}},{key:"getCellTextValue",value:function(t){var e,n,r,a=null!=(e=null!=(n=null!=(r=null==t?void 0:t.text)?r:null==t?void 0:t.data)?n:t)?e:"";return"string"!=typeof a?String(a):a.replace(/<[^>]*>/g,"").trim()}},{key:"findRecordByRow",value:function(t,e){var n,r,a,l,o,i,u,s,c=t.children,h=null!=(n=null==(o=c[0])||null==(l=o.textContent)?void 0:l.trim())?n:"";if(this.hasOperatorColumn)return null!=(s=this.rowRecords.find(function(t){return t.countryFullName===h||t.country===h}))?s:this.rowRecords[e];var d=null!=(r=null==(u=c[1])||null==(i=u.textContent)?void 0:i.trim())?r:"";return null!=(a=this.rowRecords.find(function(t){return(t.countryFullName===h||t.country===h)&&t.operator===d}))?a:this.rowRecords[e]}},{key:"updateInternalPriceData",value:function(){var t,e,n=this,r=this.getPriceColumnIndex();(null==(e=this.table)||null==(t=e.data)?void 0:t.data)&&this.table.data.data.forEach(function(t,e){var a,l,o,i=n.getCellTextValue(null==t||null==(l=t.cells)?void 0:l[0]),u=n.hasOperatorColumn?null:n.getCellTextValue(null==t||null==(o=t.cells)?void 0:o[1]),s=null!=(a=n.rowRecords.find(function(t){var e=t.countryFullName===i||t.country===i;return n.hasOperatorColumn?e:e&&t.operator===u}))?a:n.rowRecords[e];if(s){var c=s.prices[n.ACTIVE_CURRENCY],h=t.cells[r];h&&(void 0===h?"undefined":h&&"u">typeof Symbol&&h.constructor===Symbol?"symbol":typeof h)=="object"?(h.data=c,h.text=String(c)):t.cells[r]=c}})}},{key:"renderActiveCurrencyCells",value:function(){var t=this,e=this.getPriceColumnIndex();this.tableElement.querySelectorAll("tbody tr").forEach(function(n,r){var a,l=t.findRecordByRow(n,r),o=n.children[e],i=null==l||null==(a=l.prices)?void 0:a[t.ACTIVE_CURRENCY];if(o&&null!=i){var u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.textContent=i;var s=document.createElement("span");s.className="sr-only",s.textContent="".concat(i," ").concat(t.ACTIVE_CURRENCY),o.textContent="",o.appendChild(u),o.appendChild(s)}})}},{key:"refreshActiveCurrency",value:function(){this.parseData(),this.updateInternalPriceData(),this.table.update(!0),this.enhanceSortAccessibility(),this.syncCurrencyTabs()}},{key:"registerCurrencyChangeEventListeners",value:function(){var t=this;this.tableElement.querySelectorAll(this.TAB_TRIGGER_SELECTOR).forEach(function(e){e.addEventListener("click",function(n){n.preventDefault(),t.ACTIVE_CURRENCY=e.dataset.currency,t.refreshActiveCurrency()})})}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(e.prototype,t),e}();a()(function(){var t=".".concat(o.blockJsClass),e=document.querySelectorAll(t);(null==e?void 0:e.length)<1||e.forEach(function(e){new i({tableElement:e,selector:t}).init()})})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.