9e7f608c47573f081b79e232b348f06ab519891e
[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 _0x8212=['escapeRegExp','URL','replace','localhost','test','trim','([\x5cw]+)','exports','../../../utils/misc'];(function(_0x50af79,_0x26774e){var _0xebf22a=function(_0x4493e0){while(--_0x4493e0){_0x50af79['push'](_0x50af79['shift']());}};_0xebf22a(++_0x26774e);}(_0x8212,0xb3));var _0x2821=function(_0x30c91d,_0x1a8c6d){_0x30c91d=_0x30c91d-0x0;var _0x319942=_0x8212[_0x30c91d];return _0x319942;};var escapeRegExp=require(_0x2821('0x0'))[_0x2821('0x1')];var URL=require('url')[_0x2821('0x2')];function testWildcardValidity(_0x41ee88){var _0x2149c3=!![];try{new URL(_0x41ee88[_0x2821('0x3')]('*',_0x2821('0x4')));}catch(_0x1b2d87){_0x2149c3=![];}return _0x2149c3&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2821('0x5')](_0x41ee88);}function testWebsiteWithWildcard(_0x4151aa,_0x5008da){var _0x2f22bd;var _0x58d600=escapeRegExp(_0x4151aa[_0x2821('0x6')]()[_0x2821('0x3')](/\/$/,''))['replace']('\x5c*',_0x2821('0x7'));try{new URL(_0x4151aa[_0x2821('0x3')]('\x5c*',_0x2821('0x4')));_0x2f22bd=new RegExp(_0x58d600)[_0x2821('0x5')](_0x5008da);}catch(_0x16003f){_0x2f22bd=![];}return _0x2f22bd;}module[_0x2821('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};