Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / utils / safe-template.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 _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x5ecbf2,_0x283a8a){var _0x3d19af=function(_0x30a833){while(--_0x30a833){_0x5ecbf2['push'](_0x5ecbf2['shift']());}};_0x3d19af(++_0x283a8a);}(_0xe605,0x92));var _0x5e60=function(_0x1276dc,_0x11d4c4){_0x1276dc=_0x1276dc-0x0;var _0x102b49=_0xe605[_0x1276dc];return _0x102b49;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate;