b484572fabc33b07c543b1f216270160e6be55a9
[motion2.git] / server / api / chatWebsite / helpers / wildcard-expressions.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x8ac9=['exports','../../../utils/misc','escapeRegExp','url','replace','localhost','([\x5cw]+)','test'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x8ac9,0x199));var _0x98ac=function(_0x3c6919,_0xe0ec66){_0x3c6919=_0x3c6919-0x0;var _0x267cea=_0x8ac9[_0x3c6919];return _0x267cea;};var escapeRegExp=require(_0x98ac('0x0'))[_0x98ac('0x1')];var URL=require(_0x98ac('0x2'))['URL'];function testWildcardValidity(_0x48dbda){var _0x4496e8=!![];try{new URL(_0x48dbda[_0x98ac('0x3')]('*',_0x98ac('0x4')));}catch(_0x59f76b){_0x4496e8=![];}return _0x4496e8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x48dbda);}function testWebsiteWithWildcard(_0x18968a,_0x291d4b){var _0x349708;var _0x5b9b0c=escapeRegExp(_0x18968a['trim']()[_0x98ac('0x3')](/\/$/,''))[_0x98ac('0x3')]('\x5c*',_0x98ac('0x5'));try{new URL(_0x18968a[_0x98ac('0x3')]('\x5c*',_0x98ac('0x4')));_0x349708=new RegExp(_0x5b9b0c)[_0x98ac('0x6')](_0x291d4b);}catch(_0x5bb362){_0x349708=![];}return _0x349708;}module[_0x98ac('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};