peji-inspektor-crx/popup.dist.js
2024-12-15 18:40:40 +00:00

6 lines
26 KiB
JavaScript

/*!
* Peji Inspektor/Popup v0.1.0.110
* Copyright 2024-2024 Ray Lam (https://www.hiimray.co.uk)
*
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PejiInspektor=t():e.PejiInspektor=t()}(this,(()=>(()=>{var e={645:function(e){var t;t=()=>(()=>{var e={814:()=>{Array.isEmpty=function(e){return"array"!=Object.getDataType(e)||e.length<=0},Array.toFlatten=function(e,t,n){for(let r=0;r<e.length;r++)n.push(e[r]),null!=typeof e[r][t]&&e[r][t].length>0&&Array.toFlatten(e[r][t],t,n)},Array.prototype.addRange=function(e){return null==e||e.forEach((e=>{this.push(e)})),this},Array.prototype.all=function(e,t){for(let n=0;n<this.length;n++)if(null==e){if(this[n]!=t)return!1}else if(void 0!==this[n][e]&&this[n][e]!=t)return!1;return!0},Array.prototype.any=function(e,t){for(let n=0;n<this.length;n++)if(null==e){if(this[n]==t)return!0}else if(void 0!==this[n][e]&&this[n][e]==t)return!0;return!1},Array.prototype.copy=function(){return JSON.parse(JSON.stringify(this))},Array.prototype.count=function(e,t){let n=0;for(let r=0;r<this.length;r++)null==e?this[r]==t&&n++:void 0!==this[r][e]&&this[r][e]==t&&n++;return n},Array.prototype.countMany=function(...e){let t=0;return e.forEach((e=>{t+=this.count(e.propName,e.value)})),t},Array.prototype.create=function(e,t){let n=[];for(let r=0;r<e;r++)n.push(t);return n},Array.prototype.distinct=function(){return this.filter(((e,t,n)=>t===n.findIndex((t=>JSON.stringify(t)===JSON.stringify(e)))))},Array.prototype.flatten=function(e){let t=[];return Array.toFlatten(this,e,t),t},Array.prototype.get=function(e){return e<0||e>=this.length?"":this[e]},Array.prototype.index=function(e,t){const n=this.indexes(e,t);return n.length<=0?null:n[0]},Array.prototype.indexes=function(e,t){let n=[];for(let r=0;r<this.length;r++)null==e?this[r]==t&&n.push(r):void 0!==this[r][e]&&this[r][e]==t&&n.push(r);return n},Array.prototype.insert=function(e,t){return e<0?this.splice(0,0,t):e>=this.length?this.push(t):this.splice(e,0,t),this},Array.prototype.joinIfNotNullOrWhitespace=function(e){let t="";for(let n=0;n<this.length;n++)String.isNullOrWhitespace(this[n])||(String.isNullOrWhitespace(t)||(t+=e),t+=this[n]);return t},Array.prototype.first=function(e,t){for(let n=0;n<this.length;n++)if(void 0!==this[n][e]&&this[n][e]==t)return this[n];return null},Array.prototype.forEachTree=function(e,t){for(let n=0;n<this.length;n++){if(!1===t(this[n]))return;if(!(this[n][e].length<=0)&&!1===this[n][e].forEachTree(e,t))return}},Array.prototype.orderBy=function(e){return this.sort((function(t,n){return t[e]<n[e]?-1:t[e]>n[e]?1:0})),this},Array.prototype.orderByDesc=function(e){return this.sort((function(t,n){return t[e]<n[e]?1:t[e]>n[e]?-1:0})),this},Array.prototype.remove=function(e){let t=[];for(let n=0;n<this.length;n++)this[n]==e&&t.push(n);for(let e=t.length-1;e>=0;e--)this.removeAt(t[e]);return this},Array.prototype.removeAt=function(e){return e<0||e>=this.length||this.splice(e,1),this},Array.prototype.removeRange=function(e){for(let t=0;t<e.length;t++)this.remove(e[t]);return this},Array.prototype.notSelect=function(e,t){let n=[];for(let r=0;r<this.length;r++)void 0!==this[r][e]&&this[r][e]!=t&&n.push(this[r]);return n},Array.prototype.select=function(e,t){let n=[];for(let r=0;r<this.length;r++)void 0!==this[r][e]&&this[r][e]==t&&n.push(this[r]);return n},Array.prototype.selectMany=function(...e){let t=this;return e.forEach((e=>{t=t.select(e.propName,e.value)})),t},Array.prototype.toList=function(e){let t=[];return this.forEach((n=>{null!=typeof n[e]&&t.push(n[e])})),t},Array.prototype.sortTree=function(e,t){this.orderBy(t);for(let n=0;n<this.length;n++)this[n][e].length<=0||this[n][e].orderBy(t)}},523:()=>{Boolean.isFalse=function(e){return!!String.isNullOrUndefined(e)||e.toString().containsCI("false","f","y","0","x")},Boolean.isTrue=function(e){return!String.isNullOrUndefined(e)&&e.toString().containsCI("true","t","n","1","o")},Boolean.ifTrue=function(e,t,n){return Boolean.isTrue(e)?t:n}},579:()=>{Date.addDays=function(e,t){let n=new Date(e);return n.addDays(t),n},Date.addMonths=function(e,t){let n=new Date(e);return n.addMonths(t),n},Date.addYears=function(e,t){let n=new Date(e);return n.addYears(t),n},Date.max=function(e,t){return null==e?t:null==t?e:new Date(e)<=new Date(t)?new Date(t):new Date(e)},Date.min=function(e,t){return null==e?t:null==t?e:new Date(e)<=new Date(t)?new Date(e):new Date(t)},Date.diffDays=function(e,t){return Math.ceil((new Date(t).getTime()-new Date(e).getTime())/864e5)},Date.today=function(){let e=new Date;return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e},Date.prototype.addDays=function(e){this.setDate(this.getDate()+parseInt(e))},Date.prototype.addMonths=function(e){this.setMonth(this.getMonth()+parseInt(e))},Date.prototype.addYears=function(e){this.setFullYear(this.getFullYear()+parseInt(e))},Date.prototype.toCString=function(e){let t=e;return t=t.replace("fffffff",this.getMilliseconds().toString().padStart(7,"0")),t=t.replace("ffffff",this.getMilliseconds().toString().padStart(6,"0")),t=t.replace("fffff",this.getMilliseconds().toString().padStart(5,"0")),t=t.replace("yyyy",this.getFullYear().toString().padStart(4,"0")),t=t.replace("MMMM","{1}"),t=t.replace("dddd","{2}"),t=t.replace("ffff",this.getMilliseconds().toString().padStart(4,"0")),t=t.replace("yyy",this.getFullYear().toString().padStart(3,"0")),t=t.replace("MMM","{3}"),t=t.replace("ddd","{4}"),t=t.replace("fff",this.getMilliseconds().toString().padStart(3,"0")),t=t.replace("zzz",""),t=t.replace("yy",this.getFullYear().toString().slice(-2)),t=t.replace("MM",(this.getMonth()+1).toString().padStart(2,"0")),t=t.replace("dd",this.getDate().toString().padStart(2,"0")),t=t.replace("HH",this.getHours().toString().padStart(2,"0")),t=t.replace("hh",(this.getHours()>12?this.getHours()-12:this.getHours()).toString().padStart(2,"0")),t=t.replace("mm",this.getMinutes().toString().padStart(2,"0")),t=t.replace("ss",this.getSeconds().toString().padStart(2,"0")),t=t.replace("ff",this.getMilliseconds().toString().padStart(2,"0")),t=t.replace("tt","{5}"),t=t.replace("zz",""),t=t.replace("y",this.getFullYear().toString()),t=t.replace("M",(this.getMonth()+1).toString()),t=t.replace("d",this.getDate().toString()),t=t.replace("H",this.getHours().toString()),t=t.replace("h",(this.getHours()>12?this.getHours()-12:this.getHours()).toString()),t=t.replace("m",this.getMinutes().toString()),t=t.replace("s",this.getSeconds().toString()),t=t.replace("z",""),t=t.replace("t","{6}"),t=t.replace("Z",""),t=t.replace("{1}",this.toLocaleString("default",{month:"long"})),t=t.replace("{2}",this.toLocaleString("default",{weekday:"long"})),t=t.replace("{3}",this.toLocaleString("default",{month:"short"})),t=t.replace("{4}",this.toLocaleString("default",{weekday:"short"})),t=t.replace("{5}",this.getHours()>=12?"PM":"AM"),t=t.replace("{6}",this.getHours()>=12?"P":"A"),t}},874:()=>{Document.ready=async function(e){!async function(){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",(function(){e()}))}()},Document.getWidth=function(e){return null==e||void 0===e?0:e.offsetWidth||e.innerWidth||e.clientWidth},Document.getHeight=function(e){return null==e||void 0===e?0:e.offsetHeight||e.innerHeight||e.clientHeight},Document.appendHtml=function(e,t){const n=document.createElement(t);e.appendChild(n)},Document.addClass=function(e,t){e.classList.contains(t)||e.classList.add(t)},Document.removeClass=function(e,t){e.classList.contains(t)&&e.classList.remove(t)}},705:()=>{Math.randomN=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e)+e)},Math.average=function(e){let t=0;return e.forEach((e=>{t+=parseFloat(e)})),t/e.length},Math.avg=function(...e){let t=0;return e.forEach((e=>{t+=parseFloat(e)})),t/e.length},Math.half=function(e){return e/2}},428:()=>{Object.isNullOrUndefined=function(e){return void 0===e||null==e},Object.getDataType=function(e){return String.isNullOrUndefined(e)?"null":"object"==typeof e?Array.isArray(e)?"array":"object":typeof e}},930:()=>{String.isNullOrUndefined=function(e){return void 0===e||null==e},String.isNullOrWhitespace=function(e){return!!String.isNullOrUndefined(e)||("string"==typeof e?e.trim().length<=0:e.toString().trim().length<=0)},String.joinIfNotNullOrWhitespace=function(e,...t){let n="";for(let r=0;r<t.length;r++)String.isNullOrWhitespace(t[r])||(String.isNullOrWhitespace(n)||(n+=e),n+=t[r]);return n},String.prototype.contains=function(...e){for(let t of e)if(this==t)return!0;return!1},String.prototype.containsCI=function(...e){for(let t of e)if(this.toLowerCase()==t.toLowerCase())return!0;return!1},String.prototype.encodeHtmlLinks=function(){return value.replace(/(http[s]{0,1}:\/\/[^\s]+)/g,"<a href='$1'>$1</a>")},String.prototype.toTitleCase=function(){let e=this;return e=e.replace(/([A-Z]{1})/g," $1"),e=e.trim(),e=e.charAt(0).toUpperCase()+e.substr(1),e},String.prototype.getFilename=function(){return this.substring(this.lastIndexOf("/")+1)}},323:()=>{Window.goToTop=function(){Window.scrollTo(0,0)},Window.fragment={get:function(){if(!window.location.hash)return null;const e=window.location.hash.indexOf("?");return e<0?window.location.hash.substring(1):window.location.hash.substring(1,e)},getQuery:function(){if(!window.location.hash)return null;let e=window.location.hash;const t=e.indexOf("?");if(t<0)return null;e=hasQueryString.substring(t+1);const n=new URLSearchParams(e),r={};for(const[e,t]of n.entries())r[e]=t;return r},clear:function(){location.hash="",history.replaceState("","",location.pathname)}}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n(814),n(523),n(579),n(874),n(705),n(428),n(930),n(323)})(),r})(),e.exports=t()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}return(()=>{"use strict";n(645);const e=class{_popupService=null;_containerId=null;constructor(e){this._popupService=e}get Container(){return document.getElementById(this._containerId)}GenerateCheckBox(e,t,n){const r="checkbox"+Math.randomN(100001,999999);let o="";return o+='<div class="form-check form-switch">',o+='<input class="form-check-input" type="checkbox" role="switch" id="'+r+'" name="checkbox'+e+'" '+(n?"checked":"")+">",o+='<label class="form-check-label" for="'+r+'">'+t+"</label>",o+="</div>",o}GenerateCSVLine(e,...t){1===t.length&&"array"==Object.getDataType(t[0])&&(t=t[0]);let n="";for(let r=0;r<t.length;r++)r>0&&(n+=e),n+=t[r];return n}GenerateRow(...e){const t=this;1===e.length&&"array"==Object.getDataType(e[0])&&(e=e[0]);let n="";for(let r=0;r<e.length;r++)n+=t._generateTableCell(e[r]);return"<tr>"+n+"</tr>"}_generateCheckBoxPanel(e,t){const n=this;let r="",o="";for(let t=0;t<e.length;t++)r+=n.GenerateCheckBox(e[t].id,e[t].text,e[t].checked);for(let e=0;e<t.length;e++)o+=n.GenerateCheckBox(t[e].id,t[e].text,t[e].checked);return n.#e(r,o)}_generateTextarea(){let e="";return e+='<textarea class="form-control font-monospace text-sm px-1 py-1" rows="16"></textarea>','<textarea class="form-control font-monospace text-sm px-1 py-1" rows="16"></textarea>'}_generateTable(){let e="";return e+='<table class="table table-bordered table-hover table-sm table-striped">',e+="<thead></thead>",e+="<tbody></tbody>",e+="</table>",'<table class="table table-bordered table-hover table-sm table-striped"><thead></thead><tbody></tbody></table>'}_generateTableCell(e){return'<td class=""><input type="text" class="display" readonly="readonly" value="'+e+'" /></td>'}_generateTableHeader(e,t){const n=this;let r="";for(let t=0;t<e.length;t++)r+="<th>"+e[t]+"</th>";for(let e=0;e<t.length;e++)n._getCheckBox(t[e].id)&&(r+="<th>"+t[e].name+"</th>");return r}_getButton(e){return this.#t("button",e)}_getCheckBox(e){const t="checkbox"+e,n=this.#t("input[type='checkbox'][name='"+t+"']",1);return null!=n&&n.checked}_getComboBox(e){const t=this.#t("select",e);return null==t?"":t.value}_getLabel(e){return this.#t("[role='label']",e)}_getPanel(e,t){return this.#t("div[role='"+e+"']",t)}_getTextBox(e){return this.#t("input[type='text']",e)}_setHtml(e,t){null!=e&&(e.innerHTML=t)}#e(...e){let t="";for(let n=0;n<e.length;n++)t+='<div class="col">'+e[n]+"</div>";return t}#t(e,t){if(null==this.Container)return null;const n=this.Container.querySelectorAll(e);return n.length<=0||n.length>t?null:n[t-1]}},t=class extends e{_button1=null;_button2=null;_label1=null;_panel1=null;_panel2=null;_panel3=null;_textBox1=null;_optionsCol1=[];_optionsCol2=[];_filtersCol1=[];_filtersCol2=[];constructor(e){super(e)}InitialiseComponents(){const e=this,t=e.Container.querySelectorAll("button");e._button1=t[0],e._button2=t[1],e._label1=e._getLabel(1),e._panel1=e._getPanel("options",1),e._panel2=e._getPanel("filters",1),e._panel3=e._getPanel("results",1),e._textBox1=e._getTextBox(1),e.Clear(!0);const n=e._generateCheckBoxPanel(e._optionsCol1,e._optionsCol2);e._setHtml(e._panel1,n);const r=e._generateCheckBoxPanel(e._filtersCol1,e._filtersCol2);e._setHtml(e._panel2,r),e._button1.addEventListener("click",(async function(t){e._button2.disabled=!0,e._textBox1.value="",await e.Search(),e._button2.disabled=!1})),e._button2.addEventListener("click",(async function(t){e._button2.disabled=!0,await e.Search(),e._button2.disabled=!1}))}Clear(e){const t=this;t._label1.innerText="",Boolean.isTrue(e)&&(t._setHtml(t._panel1,""),t._setHtml(t._panel2,"")),t._setHtml(t._panel3,"")}async Search(){const e=this,t=await e._retrieveResult(),n=t.length,r=await e._filterResult(t.copy());switch(r.length==n?e._label1.innerText="Showing "+n+" result"+(1==n?"":"s"):e._label1.innerText="Showing "+r.length+" of "+n+" result"+(1==n?"":"s"),e._getComboBox(2)){case"table":e._renderTable(r);break;case"csv":e._renderCSV(r);break;case"links":e._renderLinks(r)}}async _retrieveResult(){return[]}async _filterResult(e){return e}_renderTable(e){}_renderCSV(e){}_renderLinks(e){}},r=new class{async SendMessage(e,t){chrome.tabs.query({active:!0,currentWindow:!0},(function(n){chrome.tabs.sendMessage(n[0].id,{event:e},t)}))}async GetHyperlinks(){const e=this;return new Promise((function(t){e.SendMessage("GetHyperlinkNodes",(async function(e){t(e.copy())}))}))}async GetImages(){const e=this;return new Promise((function(t){e.SendMessage("GetImageNodes",(async function(e){t(e.copy())}))}))}async GetScripts(){const e=this;return new Promise((function(t){e.SendMessage("GetScriptNodes",(async function(e){t(e.copy())}))}))}async GetLocation(){const e=this;return new Promise((function(t){e.SendMessage("GetLocation",(function(e){t(e)}))}))}async GetMetas(){const e=this;return new Promise((function(t){e.SendMessage("GetMetaNodes",(async function(e){t(e.copy())}))}))}},o=new class extends t{constructor(e){super(e);const t=this;t._containerId="nav-hyperlinks",t._optionsCol1=[{id:1,text:"Show Anchor as HTML",checked:!1},{id:4,text:"Resolve Relative URL",checked:!1}],t._optionsCol2=[{id:3,text:"Sort By Anchor Text",checked:!0},{id:2,text:"Trim Anchor Text",checked:!0}],t._filtersCol1=[{id:12,text:"Hide External Links",checked:!0},{id:5,text:"Hide Duplicates",checked:!0},{id:14,text:"Hide Blank Anchors",checked:!0},{id:15,text:"Hide Blank Links",checked:!0},{id:11,text:"Hide Fragments",checked:!0},{id:13,text:"Hide Mailto/Tel",checked:!0},{id:16,text:"Hide Javascript",checked:!0}],t._filtersCol2=[{id:6,text:"Show Title",checked:!0},{id:7,text:"Show Target",checked:!1},{id:8,text:"Show Rel",checked:!1},{id:9,text:"Show Type",checked:!1},{id:10,text:"Show Count",checked:!1}]}async _retrieveResult(){return await this._popupService.GetHyperlinks()}async _filterResult(e){const t=this,n=await t._popupService.GetLocation(),r=new URL(n).hostname;let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(t._getCheckBox(11)&&l.href.startsWith("#"))continue;if(t._getCheckBox(15)&&String.isNullOrWhitespace(l.href))continue;if(t._getCheckBox(13)&&(l.href.toLowerCase().startsWith("telno:")||l.href.toLowerCase().startsWith("mailto:")))continue;if(t._getCheckBox(16)&&l.href.toLowerCase().startsWith("javascript:"))continue;const s=new URL(l.href,n);if(t._getCheckBox(12)&&r!=s.hostname)continue;let a=t._getCheckBox(1)?l.innerHTML:l.innerText;if(t._getCheckBox(14)&&String.isNullOrWhitespace(a))continue;const c=t._getCheckBox(4)?s.href:l.href;if(t._getCheckBox(2)&&(a=a.trim()),!String.isNullOrWhitespace(t._textBox1.value))if("href"==t._getComboBox(1)){if(!c.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue}else if(!a.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue;o.push({text:a,href:c,title:t._getCheckBox(6)?l.title:"",target:t._getCheckBox(7)?l.target:"",rel:t._getCheckBox(8)?l.rel:"",type:t._getCheckBox(9)?l.type:"",occurrence:""})}if(t._getCheckBox(10)){let e=[];for(let t=0;t<o.length;t++){const n=o.filter((e=>JSON.stringify(e)===JSON.stringify(o[t]))).length;e.push(n)}for(let t=0;t<o.length;t++)o[t].occurrence=e[t]}return t._getCheckBox(5)&&(o=o.distinct()),t._getCheckBox(3)&&(o=o.orderBy("text")),o}_renderTable(e){const t=this,n=t._generateTable();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("thead")[0],o=t._panel3.querySelectorAll("tbody")[0];r.innerHTML="<tr>"+t.#n()+"</tr>";for(let n=0;n<e.length;n++){const r=e[n];let i=[r.text,r.href];t._getCheckBox(6)&&i.push(r.title),t._getCheckBox(7)&&i.push(r.target),t._getCheckBox(8)&&i.push(r.rel),t._getCheckBox(9)&&i.push(r.type),t._getCheckBox(10)&&i.push(r.occurrence),o.innerHTML+=t.GenerateRow(i)}}_renderCSV(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];let i=[o.text,o.href];t._getCheckBox(6)&&i.push(o.title),t._getCheckBox(7)&&i.push(o.target),t._getCheckBox(8)&&i.push(o.rel),t._getCheckBox(9)&&i.push(o.type),t._getCheckBox(10)&&i.push(o.occurrence),r.value+=t.GenerateCSVLine("\t",i),r.value+="\n"}}_renderLinks(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];r.value+=t.GenerateCSVLine("\t",[o.href]),r.value+="\n"}}#n(){return this._generateTableHeader(["Anchor Text","Address"],[{id:6,name:"Title"},{id:7,name:"Target"},{id:8,name:"Rel"},{id:9,name:"Type"},{id:10,name:"Count"}])}}(r),i=new class extends t{constructor(e){super(e);const t=this;t._containerId="nav-images",t._optionsCol1=[{id:203,text:"Sort By Source URL",checked:!0},{id:204,text:"Resolve Relative URL",checked:!1}],t._optionsCol2=[{id:202,text:"Trim Alternate Text",checked:!0}],t._filtersCol1=[{id:212,text:"Hide External Links",checked:!1},{id:205,text:"Hide Duplicates",checked:!0},{id:214,text:"Hide Blank Alternate Text",checked:!1},{id:215,text:"Hide Blank Source URL",checked:!0}],t._filtersCol2=[{id:206,text:"Show Alternative Text",checked:!0},{id:207,text:"Show Source Set",checked:!1},{id:208,text:"Show Image Map",checked:!1},{id:210,text:"Show Count",checked:!1}]}async _retrieveResult(){return await this._popupService.GetImages()}async _filterResult(e){const t=this,n=await t._popupService.GetLocation(),r=new URL(n).hostname;let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(t._getCheckBox(215)&&String.isNullOrWhitespace(l.src))continue;const s=new URL(l.src,n);if(t._getCheckBox(212)&&r!=s.hostname)continue;if(t._getCheckBox(214)&&String.isNullOrWhitespace(l.alt))continue;const a=t._getCheckBox(204)?s.href:l.src,c=t._getCheckBox(202)?l.alt.trim():l.alt;if(!String.isNullOrWhitespace(t._textBox1.value))if("src"==t._getComboBox(1)){if(!a.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue}else if(!c.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue;o.push({src:a,alt:t._getCheckBox(206)?c:"",srcset:t._getCheckBox(207)?l.srcset:"",usemap:t._getCheckBox(208)?l.usemap:"",occurrence:""})}if(t._getCheckBox(210)){let e=[];for(let t=0;t<o.length;t++){const n=o.filter((e=>JSON.stringify(e)===JSON.stringify(o[t]))).length;e.push(n)}for(let t=0;t<o.length;t++)o[t].occurrence=e[t]}return t._getCheckBox(205)&&(o=o.distinct()),t._getCheckBox(203)&&(o=o.orderBy("src")),o}_renderTable(e){const t=this,n=t._generateTable();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("thead")[0],o=t._panel3.querySelectorAll("tbody")[0];r.innerHTML="<tr>"+t.#n()+"</tr>";for(let n=0;n<e.length;n++){const r=e[n];let i=[r.src];t._getCheckBox(206)&&i.push(r.alt),t._getCheckBox(207)&&i.push(r.srcset),t._getCheckBox(208)&&i.push(r.usemap),t._getCheckBox(210)&&i.push(r.occurrence),o.innerHTML+=t.GenerateRow(i)}}_renderCSV(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];let i=[o.src];t._getCheckBox(206)&&i.push(o.alt),t._getCheckBox(207)&&i.push(o.srcset),t._getCheckBox(208)&&i.push(o.usemap),t._getCheckBox(210)&&i.push(o.occurrence),r.value+=t.GenerateCSVLine("\t",i),r.value+="\n"}}_renderLinks(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];r.value+=t.GenerateCSVLine("\t",[o.src]),r.value+="\n"}}#n(){return this._generateTableHeader(["Source"],[{id:206,name:"Alternative Text"},{id:207,name:"Source Set"},{id:208,name:"Image Map"},{id:210,name:"Count"}])}}(r),l=new class extends t{constructor(e){super(e);const t=this;t._containerId="nav-scripts",t._optionsCol1=[{id:303,text:"Sort By Source URL",checked:!0},{id:304,text:"Resolve Relative URL",checked:!1}],t._optionsCol2=[{id:302,text:"Trim Alternate Type",checked:!0}],t._filtersCol1=[{id:312,text:"Hide External Links",checked:!1},{id:305,text:"Hide Duplicates",checked:!0},{id:314,text:"Hide Blank Type",checked:!1},{id:315,text:"Hide Blank Source URL",checked:!0}],t._filtersCol2=[{id:306,text:"Show Type",checked:!0},{id:310,text:"Show Count",checked:!1}]}async _retrieveResult(){return await this._popupService.GetScripts()}async _filterResult(e){const t=this,n=await t._popupService.GetLocation(),r=new URL(n).hostname;let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(t._getCheckBox(315)&&String.isNullOrWhitespace(l.src))continue;const s=new URL(l.src,n);if(t._getCheckBox(312)&&r!=s.hostname)continue;if(t._getCheckBox(314)&&String.isNullOrWhitespace(l.type))continue;const a=t._getCheckBox(304)?s.href:l.src,c=t._getCheckBox(302)?l.type.trim():l.type;if(!String.isNullOrWhitespace(t._textBox1.value))if("src"==t._getComboBox(1)){if(!a.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue}else if(!c.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue;o.push({src:a,type:t._getCheckBox(306)?c:"",occurrence:""})}if(t._getCheckBox(310)){let e=[];for(let t=0;t<o.length;t++){const n=o.filter((e=>JSON.stringify(e)===JSON.stringify(o[t]))).length;e.push(n)}for(let t=0;t<o.length;t++)o[t].occurrence=e[t]}return t._getCheckBox(305)&&(o=o.distinct()),t._getCheckBox(303)&&(o=o.orderBy("src")),o}_renderTable(e){const t=this,n=t._generateTable();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("thead")[0],o=t._panel3.querySelectorAll("tbody")[0];r.innerHTML="<tr>"+t.#n()+"</tr>";for(let n=0;n<e.length;n++){const r=e[n];let i=[r.src];t._getCheckBox(306)&&i.push(r.type),t._getCheckBox(310)&&i.push(r.occurrence),o.innerHTML+=t.GenerateRow(i)}}_renderCSV(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];let i=[o.src];t._getCheckBox(306)&&i.push(o.type),t._getCheckBox(310)&&i.push(o.occurrence),r.value+=t.GenerateCSVLine("\t",i),r.value+="\n"}}_renderLinks(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];r.value+=t.GenerateCSVLine("\t",[o.src]),r.value+="\n"}}#n(){return this._generateTableHeader(["Source"],[{id:306,name:"Type"},{id:310,name:"Count"}])}}(r),s=new class extends t{constructor(e){super(e);const t=this;t._containerId="nav-metas",t._optionsCol1=[{id:303,text:"Sort By Name",checked:!0}],t._optionsCol2=[{id:302,text:"Trim Content",checked:!0}],t._filtersCol1=[{id:305,text:"Hide Duplicates",checked:!0},{id:314,text:"Hide Blank Name",checked:!1},{id:315,text:"Hide Blank Content",checked:!0}],t._filtersCol2=[{id:310,text:"Show Count",checked:!1}]}async _retrieveResult(){return await this._popupService.GetMetas()}async _filterResult(e){const t=this;await t._popupService.GetLocation();let n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t._getCheckBox(302)?o.content.trim():o.content;if(!(t._getCheckBox(315)&&String.isNullOrWhitespace(i)||t._getCheckBox(314)&&String.isNullOrWhitespace(o.name))){if(!String.isNullOrWhitespace(t._textBox1.value))if("name"==t._getComboBox(1)){if(!o.name.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue}else if(!i.toLowerCase().includes(t._textBox1.value.toLowerCase()))continue;n.push({name:o.name,content:i,occurrence:""})}}if(t._getCheckBox(310)){let e=[];for(let t=0;t<n.length;t++){const r=n.filter((e=>JSON.stringify(e)===JSON.stringify(n[t]))).length;e.push(r)}for(let t=0;t<n.length;t++)n[t].occurrence=e[t]}return t._getCheckBox(305)&&(n=n.distinct()),t._getCheckBox(303)&&(n=n.orderBy("name")),n}_renderTable(e){const t=this,n=t._generateTable();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("thead")[0],o=t._panel3.querySelectorAll("tbody")[0];r.innerHTML="<tr>"+t.#n()+"</tr>";for(let n=0;n<e.length;n++){const r=e[n];let i=[r.name,r.content];t._getCheckBox(310)&&i.push(r.occurrence),o.innerHTML+=t.GenerateRow(i)}}_renderCSV(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];let i=[o.name,o.content];t._getCheckBox(310)&&i.push(o.occurrence),r.value+=t.GenerateCSVLine("\t",i),r.value+="\n"}}_renderLinks(e){const t=this,n=t._generateTextarea();t._setHtml(t._panel3,n);const r=t._panel3.querySelectorAll("textarea")[0];for(let n=0;n<e.length;n++){const o=e[n];r.value+=t.GenerateCSVLine("\t",[o.content]),r.value+="\n"}}#n(){return this._generateTableHeader(["Name","Content"],[{id:310,name:"Count"}])}}(r);document.addEventListener("DOMContentLoaded",(function(e){o.InitialiseComponents(),i.InitialiseComponents(),l.InitialiseComponents(),s.InitialiseComponents()}))})(),{}})()));