PageSourceSearch

https://ooni.com/cdn/shop/t/621/assets/__vite-product-upgrade.D6FWyMI1.js

js ooni.com collected 2026-09-24 09:07:35 UTC 2,364 bytes, 1 lines download raw bytes

1import{s as u}from"./__vite-events.BG3kQIAq.js";import{r as p}from"./__vite-product-handler.8_BJ9EmK.js";import{d as i}from"./__vite-richTextConverter.IKlQw-Sh.js";import"./__vite-utils.bEHj0ca_.js";import"./__vite-currency.CSCTdhpv.js";import"./__vite-preact.module.DLwCyBYy.js";import"./__vite-hooks.module.BfHYZFGq.js";import"./__vite-ChevronDownIcon.CAwKTRcL.js";class l extends HTMLElement{constructor(){super(...arguments),this._upgradeOptions=null,this._upgradeOptionsData=[],this._variantsMount=null,this._variantSelectHeading=null}connectedCallback(){var t;this._upgradeOptions=this.querySelectorAll(".product-upgrade__option"),this._upgradeOptionsData=this.parseUpgradeOptions(),this._variantsMount=this.querySelector("[data-upgrade-variants]"),this._variantSelectHeading=((t=this.dataset.variantSelectHeading)==null?void 0:t.trim())||null,this.setupEventListeners(),u()}parseUpgradeOptions(){const t=this.querySelector("script[data-upgrade-options]");if(!(t!=null&&t.textContent))return[];const e=i(t.textContent);try{return JSON.parse(e)}catch{return[]}}setupEventListeners(){var t;(t=this._upgradeOptions)==null||t.forEach(e=>{e.addEventListener("click",this.handleSelectedOption.bind(this,e))})}handleSelectedOption(t,e){var r;if(e.preventDefault(),e.stopPropagation(),this._upgradeOptions&&this._upgradeOptions.length<1)return;const a=(r=Array.from(this._upgradeOptions||[]))==null?void 0:r.filter(n=>n!==t);t.setAttribute("data-upgrade-selected","true"),a.length>0&&a.forEach(n=>{n.setAttribute("data-upgrade-selected","false")}),this.renderInputs(t)}renderInputs(t){if(!this._variantsMount)return;const e=t.dataset.upgradeProductId,a=t.hasAttribute("data-default-option")||!e?null:this._upgradeOptionsData.find(r=>String(r.id)===e)??null;p({product:a,target:this._variantsMount,countries:e?this.parseCountriesFor(e):null,variantSelectHeading:this._variantSelectHeading})}parseCountriesFor(t){const e=this.querySelector(`script[data-upgrade-countries="${t}"]`);if(!(e!=null&&e.textContent))return[];let a;try{a=JSON.parse(i(e.textContent))}catch{return[]}return a.split(", ").map(r=>r.split("||")).filter(r=>r.length>=3&&r[0]).map(r=>{const[n,o,d]=r,s=n.split("-");return{name:s[0],isoCode:s[s.length-1],pressure:o,available:d==="true",flagUrl:r[6]??""}}).sort((r,n)=>r.name.localeCompare(n.name))}}customElements.define("ooni-product-upgrade",l);

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.