6e5505dc58a707b3f456244cf254ac298b967cc8
[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 _0x5c4a=['url','localhost','test','replace','([\x5cw]+)','exports','escapeRegExp'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x498aaa,_0x5b4e79){_0x498aaa=_0x498aaa-0x0;var _0x4f226e=_0x5c4a[_0x498aaa];return _0x4f226e;};var escapeRegExp=require('../../../utils/misc')[_0xa5c4('0x0')];var URL=require(_0xa5c4('0x1'))['URL'];function testWildcardValidity(_0x1972e1){let _0x2ff2f2=!![];try{new URL(_0x1972e1['replace']('*',_0xa5c4('0x2')));}catch(_0x180239){_0x2ff2f2=![];}return _0x2ff2f2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xa5c4('0x3')](_0x1972e1);}function testWebsiteWithWildcard(_0x3864c4,_0x747b24){let _0x49af82;const _0x2410cf=escapeRegExp(_0x3864c4)[_0xa5c4('0x4')]('\x5c*',_0xa5c4('0x5'));try{new URL(_0x3864c4[_0xa5c4('0x4')]('\x5c*',_0xa5c4('0x2')));_0x49af82=new RegExp(_0x2410cf)[_0xa5c4('0x3')](_0x747b24);}catch(_0x4cd657){_0x49af82=![];}return _0x49af82;}module[_0xa5c4('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};