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AAW,SAAS,IACrB,GAAI,EAAU,SAAiC,WAAtB,EAAU,QAAsB,CACrD,MAAM,EAAc,KAAK,QAAQ,GAC7B,GACA,EAAa,KAAK,EAE1B,KAGD,CACX,CACA,MAAO,GACH,MAAM,IAAI,MAAM,EACpB,CACJ,CACA,qBAAA,CAAsB,GAClB,IACI,MAAM,EAAc,GACd,EAAO,KAAK,QAAQ,GAAU,GAUpC,OATI,GACA,EAAK,WAAW,SAAS,IACjB,EAAU,SAAiC,WAAtB,EAAU,SAC3B,EAAU,SAAW,EAAU,QAAQ,OACvC,EAAY,KAAK,EAAU,QAAQ,MAE3C,IAGD,CACX,CACA,MAAO,GACH,MAAM,IAAI,MAAM,EACpB,CACJ,EAEJ,QAAQ,QAAU","file":"/npm/chriofvtp@1.3.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/chriofvtp@1.3.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n    if (mod && mod.__esModule) return mod;\n    var result = {};\n    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n    result[\"default\"] = mod;\n    return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst cheerio = __importStar(require(\"cheerio\"));\nconst utilitiesfvtp_1 = require(\"utilitiesfvtp\");\nclass CheerioFVTP {\n    constructor(html) {\n        this.html = html;\n        this.tmpString = \"\";\n        this.$ = cheerio.load(this.html);\n    }\n    getForms(removedForms = [], onlyForms = []) {\n        try {\n            const inputs = this.$(\"body\").find(\"input\");\n            const selects = this.$(\"body\").find(\"select\");\n            let obj = {};\n            if (inputs.length) {\n                for (let index = 0; index < inputs.length; index++) {\n                    const input = inputs[index];\n                    if (input.tagName === \"input\" && input.type === \"tag\") {\n                        if (removedForms.length !== 0) {\n                            if (removedForms.indexOf(input.attribs.name) === -1) {\n                                obj = Object.assign({}, obj, { [input.attribs.name]: input.attribs.value ? input.attribs.value : \"\" });\n                            }\n                        }\n                        else if (onlyForms.length !== 0) {\n                            if (onlyForms.indexOf(input.attribs.name) !== -1) {\n                                obj = Object.assign({}, obj, { [input.attribs.name]: input.attribs.value ? input.attribs.value : \"\" });\n                            }\n                        }\n                        else if (removedForms.length === 0 && onlyForms.length === 0) {\n                            obj = Object.assign({}, obj, { [input.attribs.name]: input.attribs.value ? input.attribs.value : \"\" });\n                        }\n                    }\n                }\n                if (selects.length) {\n                    for (let index = 0; index < selects.length; index++) {\n                        const select = selects[index];\n                        const name = select.attribs.name;\n                        select.childNodes.forEach(childNode => {\n                            if (childNode.name === \"option\") {\n                                if (childNode.attribs.selected && childNode.attribs.selected === \"selected\") {\n                                    if (removedForms.length !== 0) {\n                                        if (removedForms.indexOf(childNode.attribs.value) === -1) {\n                                            obj = Object.assign({}, obj, { [name]: childNode.attribs.value ? childNode.attribs.value : \"\" });\n                                        }\n                                    }\n                                    else if (onlyForms.length !== 0) {\n                                        if (onlyForms.indexOf(childNode.attribs.value) !== -1) {\n                                            obj = Object.assign({}, obj, { [name]: childNode.attribs.value ? childNode.attribs.value : \"\" });\n                                        }\n                                    }\n                                    else if (removedForms.length === 0 && onlyForms.length === 0) {\n                                        obj = Object.assign({}, obj, { [name]: childNode.attribs.value ? childNode.attribs.value : \"\" });\n                                    }\n                                }\n                            }\n                        });\n                    }\n                }\n            }\n            return obj;\n        }\n        catch (error) {\n            throw `F:getForms ${error}`;\n        }\n    }\n    text(selector) {\n        try {\n            return this.$(selector).text();\n        }\n        catch (error) {\n            throw `F:text ${error}`;\n        }\n    }\n    getNode(selector) {\n        try {\n            return this.$(selector);\n        }\n        catch (error) {\n            throw `F:getNode S:${selector} ${error}`;\n        }\n    }\n    getNodes(node, tagName, type) {\n        try {\n            if (!node)\n                return [];\n            const nodes = node.childNodes.filter((childNode) => {\n                if (type)\n                    return childNode.type === type;\n                return childNode.tagName === tagName;\n            });\n            return nodes;\n        }\n        catch (error) {\n            throw `F:getNodes ${error}`;\n        }\n    }\n    getText(node) {\n        try {\n            let text = this.$(node).text();\n            text = utilitiesfvtp_1.cleanString(text);\n            return text;\n        }\n        catch (error) {\n            throw `F:getTexts ${error}`;\n        }\n    }\n    getTableIndex(tdContent) {\n        try {\n            const tables = this.getNode(\"table\");\n            for (let index = 0; index < tables.length; index++) {\n                const table = tables[index];\n                const tbody = this.getNodes(table, \"tbody\");\n                if (tbody && tbody[0]) {\n                    const trs = this.getNodes(tbody[0], \"tr\");\n                    for (let trsIndex = 0; trsIndex < trs.length; trsIndex++) {\n                        const tr = trs[trsIndex];\n                        const tds = this.getNodes(tr, \"td\");\n                        for (let tdsIndex = 0; tdsIndex < tds.length; tdsIndex++) {\n                            const td = tds[tdsIndex];\n                            const innerText = this.getText(td);\n                            if (tdContent.toLowerCase() === innerText.toLowerCase())\n                                return index;\n                        }\n                        const ths = this.getNodes(tr, \"th\");\n                        for (let thsIndex = 0; thsIndex < ths.length; thsIndex++) {\n                            const th = ths[thsIndex];\n                            const innerText = this.getText(th);\n                            if (tdContent.toLowerCase() === innerText.toLowerCase())\n                                return index;\n                        }\n                    }\n                }\n            }\n            return -1;\n        }\n        catch (error) {\n            throw `F:getTableIndex ${error}`;\n        }\n    }\n    getTable(tableIndex) {\n        try {\n            const tableArr = [];\n            const tables = this.getNode(\"table\");\n            if (tableIndex > -1) {\n                const table = tables[tableIndex];\n                const tbody = this.getNodes(table, \"tbody\");\n                if (tbody && tbody[0]) {\n                    const trs = this.getNodes(tbody[0], \"tr\");\n                    for (let trsIndex = 0; trsIndex < trs.length; trsIndex++) {\n                        const tr = trs[trsIndex];\n                        const tds = this.getNodes(tr, \"td\");\n                        const ths = this.getNodes(tr, \"th\");\n                        const trArr = [];\n                        for (let tdsIndex = 0; tdsIndex < tds.length; tdsIndex++) {\n                            const td = tds[tdsIndex];\n                            const innerText = this.getText(td);\n                            trArr.push(innerText);\n                        }\n                        for (let thsIndex = 0; thsIndex < ths.length; thsIndex++) {\n                            const th = ths[thsIndex];\n                            const innerText = this.getText(th);\n                            trArr.push(innerText);\n                        }\n                        tableArr.push(trArr);\n                    }\n                }\n            }\n            return tableArr;\n        }\n        catch (error) {\n            throw `F:getTable ${error}`;\n        }\n    }\n    getTableObject(findTdContent) {\n        try {\n            const tableIndex = this.getTableIndex(findTdContent);\n            const table = this.getTable(tableIndex);\n            let obj = {};\n            table.forEach((arr) => {\n                if (arr.length % 2 === 0) {\n                    for (let index = 0; index < arr.length; index += 2) {\n                        const fieldName = utilitiesfvtp_1.cleanString(utilitiesfvtp_1.replaceChrStr(arr[index], \":\", \"\"));\n                        const fieldValue = utilitiesfvtp_1.cleanString(utilitiesfvtp_1.replaceChrStr(arr[index + 1], \":\", \"\"));\n                        if (!utilitiesfvtp_1.checkObjectProp({ obj, key: fieldName }))\n                            obj = Object.assign({}, obj, { [fieldName]: fieldValue });\n                        else\n                            obj = Object.assign({}, obj, { [\"_\" + fieldName]: fieldValue });\n                    }\n                }\n            });\n            return obj;\n        }\n        catch (error) {\n            throw error;\n        }\n    }\n    getTableArrayObject(findTdContent, header = 0) {\n        try {\n            const tableIndex = this.getTableIndex(findTdContent);\n            const table = this.getTable(tableIndex);\n            const obj = utilitiesfvtp_1.tableArrayToObject(table, header);\n            return obj;\n        }\n        catch (error) {\n            throw error;\n        }\n    }\n    getSelectOptionsText(selector) {\n        try {\n            const optionsValue = [];\n            const node = this.getNode(selector)[0];\n            if (node) {\n                node.childNodes.forEach((childNode) => {\n                    if (childNode.tagName && childNode.tagName === \"option\") {\n                        const optionValue = this.getText(childNode);\n                        if (optionValue) {\n                            optionsValue.push(optionValue);\n                        }\n                    }\n                });\n            }\n            return optionsValue;\n        }\n        catch (error) {\n            throw new Error(error);\n        }\n    }\n    getSelectOptionsValue(selector) {\n        try {\n            const optionsText = [];\n            const node = this.getNode(selector)[0];\n            if (node) {\n                node.childNodes.forEach((childNode) => {\n                    if (childNode.tagName && childNode.tagName === \"option\") {\n                        if (childNode.attribs && childNode.attribs.value) {\n                            optionsText.push(childNode.attribs.value);\n                        }\n                    }\n                });\n            }\n            return optionsText;\n        }\n        catch (error) {\n            throw new Error(error);\n        }\n    }\n}\nexports.default = CheerioFVTP;\n"]}