9e0682591d7b63428c9e9e789ce92d6886e170d9
[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 _0xfaf2=['exports','../../../utils/misc','escapeRegExp','url','URL','replace','localhost','test','trim','([\x5cw]+)'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xfaf2,0x169));var _0x2faf=function(_0xf9fa3c,_0x516842){_0xf9fa3c=_0xf9fa3c-0x0;var _0x1a49eb=_0xfaf2[_0xf9fa3c];return _0x1a49eb;};var escapeRegExp=require(_0x2faf('0x0'))[_0x2faf('0x1')];var URL=require(_0x2faf('0x2'))[_0x2faf('0x3')];function testWildcardValidity(_0x2f673c){var _0x4b9362=!![];try{new URL(_0x2f673c[_0x2faf('0x4')]('*',_0x2faf('0x5')));}catch(_0x1be5d0){_0x4b9362=![];}return _0x4b9362&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2faf('0x6')](_0x2f673c);}function testWebsiteWithWildcard(_0x1b9f32,_0x579955){var _0x4eacb2;var _0x5cf241=escapeRegExp(_0x1b9f32[_0x2faf('0x7')]()[_0x2faf('0x4')](/\/$/,''))[_0x2faf('0x4')]('\x5c*',_0x2faf('0x8'));try{new URL(_0x1b9f32[_0x2faf('0x4')]('\x5c*','localhost'));_0x4eacb2=new RegExp(_0x5cf241)['test'](_0x579955);}catch(_0x9c958c){_0x4eacb2=![];}return _0x4eacb2;}module[_0x2faf('0x9')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};