c1927eb9888840d6ee8a41da4747cf1a6c32f4b0
[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 _0x0624=['exports','replace','localhost','test','([\x5cw]+)'];(function(_0x4e3ac5,_0x18d402){var _0x3b408f=function(_0xd0214a){while(--_0xd0214a){_0x4e3ac5['push'](_0x4e3ac5['shift']());}};_0x3b408f(++_0x18d402);}(_0x0624,0x132));var _0x4062=function(_0x50b8dc,_0x1a6352){_0x50b8dc=_0x50b8dc-0x0;var _0x439b2a=_0x0624[_0x50b8dc];return _0x439b2a;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require('url')['URL'];function testWildcardValidity(_0x2d6840){let _0x144406=!![];try{new URL(_0x2d6840[_0x4062('0x0')]('*',_0x4062('0x1')));}catch(_0x29add8){_0x144406=![];}return _0x144406&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x4062('0x2')](_0x2d6840);}function testWebsiteWithWildcard(_0x4bb157,_0x553d08){let _0x353a85;const _0x2ec6dd=escapeRegExp(_0x4bb157)[_0x4062('0x0')]('\x5c*',_0x4062('0x3'));try{new URL(_0x4bb157[_0x4062('0x0')]('\x5c*','localhost'));_0x353a85=new RegExp(_0x2ec6dd)[_0x4062('0x2')](_0x553d08);}catch(_0x4b36f6){_0x353a85=![];}return _0x353a85;}module[_0x4062('0x4')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};