PageSourceSearch

https://mmanagement.co.kr/js/common.1790659391.js

js mmanagement.co.kr collected 2026-10-05 23:32:56 UTC 733,430 bytes, 13,253 lines download raw bytes

1var selRange, product_brand_list;
2if (typeof(COMMON_JS) == 'undefined') {
3    jQuery.migrateTrace = false;
4    jQuery.migrateMute = true;
5    $.fn.outerHTML = function() {
6        return $(this).clone().wrapAll("<div/>").parent().html();
7    }
8
9    $.toast = function(opts) {
10        var closeToast = function ($toast, opts) {
11            $toast.find('.toast-box').fadeOut(opts.animation_duration);
12            setTimeout(function () {
13                $toast.remove();
14            }, opts.animation_duration);
15            
16            $(document).off('.toast');
17            $(window).off('.toast');
18        }; 
19
20        var show = function() {
21            if($('.toast-container').length) $('.toast-container').remove();
22
23            var $toast = $(`
24                <div class="toast-container">
25                    <div class="toast-box">${opts.title}</div>
26                </div>
27            `);
28
29            var $box = $toast.find('.toast-box');
30
31            // 애니메이션 방법1
32            // var set_height = $toast.height();
33            // $toast.css({
34            //     'top' : opts.top, 
35            //     'left' : opts.left, 
36            //     'z-index': opts.zIndex,
37            //     'box-shadow' : '1px 1px 4px ' + colorset + 'aa',
38            //     'color' : colorset,
39            //     'font-size' : '14px',
40            //     'border' : '1px solid ' + colorset,
41            //     'height' : '0px',
42            // }).animate({'height' : set_height}, opts.animation_duration);
43
44            // 애니메이션 방법2
45            // $toast.css({
46            //     'display':'none', 
47            //     'top' : opts.top, 
48            //     'left' : opts.left, 
49            //     'z-index': opts.zIndex,
50            //     'box-shadow' : '1px 1px 4px ' + colorset + 'aa',
51            //     'color' : colorset,
52            //     'font-size' : '14px',
53            //     'border' : '1px solid ' + colorset,
54            // }).fadeIn(opts.animation_duration);
55
56            // 애니메이션 방법3
57            $box.css({
58                top: opts.top,
59                left: opts.left,
60                zIndex: opts.zIndex,
61                transform: `translate(-50%,-50%) scale(0)`,
62                transition: `transform ${(opts.animation_duration / 1000)}s`,
63                opacity: '.3',
64                position: 'fixed',
65                wordBreak : 'auto-phrase',
66            });
67
68            $box.css(opts.boxCss || {});
69            $box.addClass(opts.type);
70
71            $('body').append($toast);
72
73            setTimeout(function() {
74                $box.css({ transform: `translate(-50%,-50%) scale(1)` });
75                $box.animate({ opacity: '1' }, opts.animation_duration);
76            }, 0);
77
78            // auto close
79            if (opts.autoClose) {
80                setTimeout(function () {
81                    closeToast($toast, opts);
82                }, opts.display_duration + opts.animation_duration);
83            } else {
84                $toast.addClass('autoclose');
85
86                setTimeout(function () {
87                    $(window).on('wheel.toast', function () {
88                        closeToast($toast, opts);
89                    });
90
91                    $(window).on('scroll.toast', function () {
92                        closeToast($toast, opts);
93                    });
94                }, 0);
95            }
96
97            
98            // outside click close
99            if (!opts.autoClose && opts.outsideClickClose) {
100                $box.on('click', function (e) {
101                    e.stopPropagation();
102                });
103
104                setTimeout(function () {
105                    $(document).on('click.toast', function () {
106                        closeToast($toast, opts);
107                        $(document).off('click.toast');
108                    });
109                }, 0);
110            }
111
112            
113            // self click close
114            if (!opts.autoClose && !opts.outsideClickClose) {
115                $box.css('cursor', 'pointer');
116
117                $box.on('click', function (e) {
118                    e.stopPropagation();
119                    closeToast($toast, opts);
120                });
121            }
122
123        };
124
125        opts = $.extend(true, {}, $.toast.defaults, opts);
126        show();
127    }
128
129    $.toast.defaults = {
130        title: 'Type the title.',
131        type: 'info', // info - blue, danger - red, 
132        display_duration: 3000,
133        animation_duration: 300,
134        top: '150px',
135        left: '50%',
136        zIndex: '9999',
137
138        autoClose: true, // 자동 닫힘
139        outsideClickClose: true, // 바깥 클릭 닫힘
140        boxCss: {}
141    };
142
143    if (typeof rt_path == 'undefined')
144        alert('rt_path 변수가 선언되지 않았습니다.');
145
146    var COMMON_JS = true;
147
148    var setLogs = function(type, action, icon, obj, page, select_el) {
149        if (typeof IS_CONFIG == 'undefined' || IS_CONFIG !== true) return false;
150        if (typeof SID == 'undefined' || !SID) return false;
151        if(typeof page == 'undefined') page = PAGE;
152        if(typeof select_el == 'undefined') select_el = editEL;
153        $.ajax({
154            url:'/template/log',
155            type:'post',
156            async: true,
157            dataType:'json',
158            data: { sid: SID, page: page, type: type, el: select_el, action: action, icon: icon, obj: obj },
159            success:function(data) {
160                if (typeof data.error != 'undefined' && data.error) {
161                    return false;
162                }
163                addlogs(data);
164            }
165        });
166    }
167    
168    var getHistoryLogText = function(data) {
169        var action = (typeof data.msg != 'undefined' && data.msg) ? data.msg : ((typeof data.action != 'undefined') ? data.action : '');
170        var objKey = (typeof data.obj != 'undefined' && data.obj) ? data.obj : '';
171        var str = (typeof $.lang[LANG]['log.' + action] != 'undefined') ? $.lang[LANG]['log.' + action] : action;
172        var obj = (typeof $.lang[LANG]['log.' + objKey] == 'undefined') ? objKey + ' ' : $.lang[LANG]['log.' + objKey] + ' ';
173
174        obj = (data.type == 'MENU' || data.type == 'FOOT' || data.type == 'BOOKMARK') ? obj : '';
175        if (obj === '' && typeof str != 'undefined' && str.length > 0) str = str.replace(/^: /, '');
176
177        return obj + str;
178    }
179
180    var createHistoryLogItem = function(data, activeSeq) {
181        var $li = $('<li>'),
182            $log = $('<a>'),
183            icon = (typeof data.icon != 'undefined' && data.icon) ? data.icon : '',
184            date = (typeof data.regdate != 'undefined' && data.regdate) ? data.regdate : ((typeof data.date != 'undefined') ? data.date : '');
185
186        $log.attr('href', '#')
187            .attr('data-seq', data.seq)
188            .attr('data-mode', (typeof data.mode != 'undefined' && data.mode) ? data.mode : 'snapshot')
189            .attr('data-target-seq', (typeof data.target_seq != 'undefined' && data.target_seq) ? data.target_seq : '')
190            .attr('data-toggle', 'tooltip')
191            .attr('data-placement', 'left')
192            .attr('data-container', 'body')
193            .attr('title', date)
194            .addClass('user-logs');
195
196        if (typeof activeSeq != 'undefined' && activeSeq && String(activeSeq) == String(data.seq)) {
197            $log.addClass('active');
198        }
199
200        $log.append($('<i>').addClass('fa').addClass(icon));
201        $log.append(document.createTextNode(' ' + getHistoryLogText(data)));
202        $li.append($log);
203
204        return $li;
205    }
206
207    var renderHistoryList = function(actionList, activeSeq) {
208        var $dropdown = $('.history-dropdown');
209        if($dropdown.length == 0 || !$.isArray(actionList)) return false;
210
211        $dropdown.empty();
212        $.each(actionList, function(i, data) {
213            if(!data || !data.seq) return true;
214            $dropdown.append(createHistoryLogItem(data, activeSeq));
215        });
216
217        return true;
218    }
219
220    var refreshHistoryList = function(activeSeq) {
221        if (typeof SID == 'undefined' || !SID) return false;
222
223        $.ajax({
224            url:'/template/history_list',
225            type:'post',
226            async: true,
227            dataType:'json',
228            data: { sid: SID },
229            success:function(data) {
230                var r = checkError(data);
231                if (r == false) return false;
232
233                var currentSeq = (typeof activeSeq != 'undefined' && activeSeq) ? activeSeq : data.history;
234                renderHistoryList(data.action, currentSeq);
235            }
236        });
237
238        return true;
239    }
240
241    var addlogs = function(data) {
242        var hasDeletedAction = (typeof data.deleted_action_seq_list != 'undefined' && $.isArray(data.deleted_action_seq_list) && data.deleted_action_seq_list.length > 0);
243        if (typeof data.deleted_action_seq_list != 'undefined' && $.isArray(data.deleted_action_seq_list)) {
244            $.each(data.deleted_action_seq_list, function(i, seq) {
245                $('.history-dropdown .user-logs[data-seq="' + seq + '"]').closest('li').remove();
246            });
247        }
248        $('.history-dropdown li a').removeClass('active');
249        var maxHistoryLogCount = 50;
250        while ($('.history-dropdown').children().length > maxHistoryLogCount - 1) {
251            $('.history-dropdown li').last().remove();
252        }
253        $('.history-dropdown').prepend(createHistoryLogItem(data, data.seq));
254        if(hasDeletedAction) refreshHistoryList(data.seq);
255    }
256
257    function getServiceHost() {
258        var s = window.location.hostname;
259        if (s == 'www.creatorlink.net' || s == 'creatorlink.net' || s == 'www.showbible.com' || s == 'showbible.com' || s == 'www.addblock.net' || s == 'addblock.net' ||
260            s == 'www.creatorlink-gabia.com' || s == 'creatorlink-gabia.com') {
261            s = s.replace('www.', '');
262            s = (window.location.port) ? s + ':' + window.location.port : s;
263        } else {
264            s = window.location.host;
265        }
266        return s;
267    }
268
269    function clLocalStorageClear() {
270      var cl_key_arr = ['referer','sid','type','pid','view','page_mode','status','parent','reply_name','reply','id','content','secret','href','forum_email'];
271      $.each(cl_key_arr, function(i, k) {
272          if (typeof k != 'undefined' && k) window.localStorage.removeItem(k);
273      });
274    }
275
276    function log_analytics(sid, googleAnalytics, googleAnalytics_check) {
277        var scriptTag = '';
278        if (googleAnalytics_check == 'old') {
279            scriptTag = "\
280            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n\
281            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n\
282            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n\
283            })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n\
284            ";
285            if (googleAnalytics) {
286                scriptTag += "\
287                ga('create', '" + googleAnalytics + "', 'auto');\n\
288                ga('require', 'displayfeatures');\n\
289                ga('require', 'linkid');\n\
290                ga('send', 'pageview');\n\
291                ";
292            }
293
294        } else {
295            if (sid && googleAnalytics) {
296                scriptTag = "\
297                window.dataLayer = window.dataLayer || [];\n\
298                function gtag(){dataLayer.push(arguments); }\n\
299                gtag('js', new Date());\n\
300                ";
301                scriptTag += (googleAnalytics) ? "gtag('config', '" + googleAnalytics + "');\n" : "";
302                $('body').prepend('<script async src="https://www.googletagmanager.com/gtag/js?i
302d=' + googleAnalytics + '"></script>');
303            }
304        }
305
306        if(scriptTag != '') {
307            var addScriptTag = '';
308            if(sid && googleAnalytics) {
309                addScriptTag += "\n\
310                    <script>\n\
311                        window.dataLayer = window.dataLayer || [];\n\
312                        if(typeof localStorage.getItem('googleAnalyticsUID"+sid+"') != 'undefined' && localStorage.getItem('googleAnalyticsUID"+sid+"')) {\n\
313                            dataLayer.push({ 'user_id': localStorage.getItem('googleAnalyticsUID"+sid+"') });\n\
314                        }\n\
315                    </script>\n\
316                ";
317            }
318
319            addScriptTag += '<script>' + scriptTag + '</script>'
320            $('body').prepend(addScriptTag);
321        }
322        
323    }
324
325    function naverSeo(type) {
326        var jsonscript = '';
327        switch (type) {
328            case 'faq':
329                {
330                    jsonscript +=
331                    '\
332                    {\
333                      "@context": "http://schema.org",\
334                      "@type": "FAQPage",\
335                      "mainEntity": [\
336                        {\
337                          "@type": "Question",\
338                          "name": "포트폴리오 사이트만 만들 수 있나요?",\
339                          "acceptedAnswer": {\
340                            "@type": "Answer",\
341                            "text": "아닙니다. 쇼핑몰, 회사홈페이지, 개인블로그, 모바일청첩장 등 원하시는 사이트를 자유롭게 만드실 수 있습니다."\
342                          }\
343                        },\
344                        {\
345                          "@type": "Question",\
346                          "name": "결제 기능(쇼핑몰)을 사용할 수 있나요",\
347                          "acceptedAnswer": {\
348                            "@type": "Answer",\
349                            "text": "<ul>\
350                                        <li>쇼핑 요금제를 적용하여 쇼핑몰을 만들 수 있습니다.</li>\
351                                        <li> </li>\
352                                        <li>PG가입을 통해 신용카드나 계좌이체 등의 결제시스템을 연동할 수 있으며, 상품관리나 주문배송관리 등의 쇼핑 관련 기능이 제공됩니다.</li>\
353                                        <li>기존에 크리에이터링크에서 만든 홈페이지가 있는 경우에도 새로 쇼핑몰을 만들 필요 없이 쇼핑 요금제만 적용하면 쇼핑몰로 전환할 수 있습니다.</li>\
354                                        <li><a href=\\"https://www.creatorlink.net/shoppingevent\\">쇼핑 요금제 자세히 보기</a></li>\
355                                    </ul>"\
356                          }\
357                        },\
358                        {\
359                          "@type": "Question",\
360                          "name": "코딩을 몰라도 홈페이지를 만들 수 있나요?",\
361                          "acceptedAnswer": {\
362                            "@type": "Answer",\
363                            "text": "네. 코딩을 전혀 몰라도 쉽게 만들 수 있는 모듈형 제작방식을 제공하고 있습니다."\
364                          }\
365                        },\
366                        {\
367                          "@type": "Question",\
368                          "name": "홈페이지는 몇 개까지 만들 수 있나요?",\
369                          "acceptedAnswer": {\
370                            "@type": "Answer",\
371                            "text": "계정 당 10개의 홈페이지를 만들 수 있습니다."\
372                          }\
373                        },\
374                        {\
375                          "@type": "Question",\
376                          "name": "네이버나 다음에 노출시킬 수 있나요?",\
377                          "acceptedAnswer": {\
378                            "@type": "Answer",\
379                            "text": "네. 사이트를 만드신 후 각 포털에 검색등록을 하실 수 있습니다."\
380                          }\
381                        }\
382                      ]\
383                    }\
384                ';
385                    break;
386                }
387            case 'carousel':
388                {
389                    jsonscript +=
390                    '\
391                    {\
392                      "@context":"http://schema.org",\
393                      "@type":"ItemList",\
394                      "itemListElement":[\
395                        {\
396                          "@type": "ListItem",\
397                          "name": "Dajeong",\
398                          "image": "https://storage.googleapis.com/cr-resource/image/b79b620cbfea30807340cf90ed5e5bbe/rousefleur/rousefleur-bestsite.jpg",\
399                          "url": "https://rousefleur.creatorlink.net",\
400                          "position": "1"\
401                        },\
402                        {\
403                          "@type": "ListItem",\
404                          "name": "궁리",\
405                          "image": "https://storage.googleapis.com/cr-resource/image/91cd3ae4e7326ec246d8ce207325311e/guungri/guungri-bestsite.jpg",\
406                          "url": "https://guungri.creatorlink.net",\
407                          "position": "2"\
408                        },\
409                        {\
410                          "@type": "ListItem",\
411                          "name": "운타",\
412                          "image": "https://storage.googleapis.com/cr-resource/image/0a1afa78e08359fea268dc23cf25feba/unta/unta-bestsite.jpg",\
413                          "url": "https://unta.creatorlink.net",\
414                          "position": "3"\
415                        },\
416                        {\
417                          "@type": "ListItem",\
418                          "name": "HC DESIGN",\
419                          "image": "https://storage.googleapis.com/cr-resource/image/8a3065df6f50178993b1d7d5ab5bb345/metafranchise/metafranchise-bestsite.jpg",\
420                          "url": "https://metafranchise.creatorlink.net",\
421                          "position": "4"\
422                        },\
423                        {\
424                          "@type": "ListItem",\
425                          "name": "에이캠스튜디오",\
426                          "image": "https://storage.googleapis.com/cr-resource/image/17fbe9f7a0ddd0efddf0f34aeca01744/acamstudio/acamstudio-bestsite.jpg",\
427                          "url": "https://acamstudio.creatorlink.net",\
428                          "position": "5"\
429                        },\
430                        {\
431                          "@type": "ListItem",\
432                          "name": "미카엘",\
433                          "image": "https://storage.googleapis.com/cr-resource/image/5fa6beb099367406036b7744fdf0d518/lawyerljw/lawyerljw-bestsite.jpg",\
434                          "url": "https://lawyerljw.creatorlink.net",\
435                          "position": "6"\
436                        },\
437                        {\
438                          "@type": "ListItem",\
439                          "name": "포씨드",\
440                          "image": "//storage.googleapis.com/cr-resource/image/774baa5c985fc6eb5824f15d60130756/forseed/forseed-bestsite.jpg",\
441                          "url": "https://forseed.creatorlink.net",\
442                          "position": "7"\
443                        },\
444                        {\
445                          "@type": "ListItem",\
446                          "name": "snoworks",\
447                          "image": "https://storage.googleapis.com/cr-resource/image/8bb728caf2a19b5f6263478d7eaaee24/w
447haledesign/whaledesign-bestsite.jpg",\
448                          "url": "https://whaledesign.creatorlink.net",\
449                          "position": "8"\
450                        },\
451                        {\
452                          "@type": "ListItem",\
453                          "name": "NARKO",\
454                          "image": "https://storage.googleapis.com/cr-resource/image/a206b43e3689c50cb9affa3a7f76df8a/narko/narko-bestsite.jpg",\
455                          "url": "https://narko.creatorlink.net",\
456                          "position": "9"\
457                        } \
458                      ]\
459                    }\
460                ';
461                    break;
462                }
463            case 'review':
464                {
465                    jsonscript +=
466                    '\
467                    {\
468                      "@context": "https://schema.org",\
469                      "@type": "Product",\
470                      "aggregateRating": {\
471                        "@type": "AggregateRating",\
472                        "ratingValue": "5",\
473                        "reviewCount": "70"\
474                      },\
475                      "name" : "Responsive Homepage",\
476                      "review": [\
477                        {\
478                          "@type": "Review",\
479                          "author": "soh******",\
480                          "name": "써본것 중 제일 쉽고 편했어요",\
481                          "reviewBody": "간단하게 사이트를 만들 수 있어 좋아요 :) 직접 코딩을 해서 제작해 본 적도 있고, 카***** 같은 유사 플랫폼을 이용한 적도 있는데 제가 시도해 본 것 중엔 사용방식이나 설정 방법이 제일 쉽고 편했어요. 웹사이트 제작 필요하신 분들께 추천드려봅니다.",\
482                          "reviewRating": {\
483                            "@type": "Rating",\
484                            "bestRating": "5",\
485                            "ratingValue": "5"\
486                          }\
487                        },\
488                        {\
489                          "@type": "Review",\
490                          "author": "지**",\
491                          "name": "디자인도 퀄리티가 너무 높아서.... 놀랐습니다.",\
492                          "reviewBody": "홈페이지 제작 어렵게 생각했는데 이렇게 멋진 홈페이지가 간단하게 뚝딱 제작된다니...너무 놀랍네요...홈페이지가 필요하시거나 포폴필요하신분은 크리에이터링크로 작업하시면 너무 좋을듯합니다. 디자인도 퀄리티가 너무 높아서.... 놀랐습니다.",\
493                          "reviewRating": {\
494                            "@type": "Rating",\
495                            "bestRating": "5",\
496                            "ratingValue": "5"\
497                          }\
498                        },\
499                        {\
500                          "@type": "Review",\
501                          "author": "fa***",\
502                          "name": "창업 사이트도 크리에이터 링크를 이용하고 있답니다.",\
503                          "reviewBody": "크리에이터 링크 사이트를 이용해서 사이트를 만들어 사용한지 벌써 일년이 넘었네요! 너무나 편리하고 필수적인 기능들이 잘 들어가 있어서, 초보자들도 바로 만들 수 있게끔 되어있어요. 저도 처음엔 개인 포트폴리오 사이트를 만드려고 크리에이터 링크를 이용하다가 너무 좋아서 지금은 창업 사이트도 크리에이터 링크를 이용하고 있답니다.",\
504                          "reviewRating": {\
505                            "@type": "Rating",\
506                            "bestRating": "5",\
507                            "ratingValue": "5"\
508                          }\
509                        },\
510                        {\
511                          "@type": "Review",\
512                          "author": "이**",\
513                          "name": "\\"쉽고 빠르게 홈페이지 제작은..크리에이터 링크가 답입니다.",\
514                          "reviewBody": "\\"우리나라에서 제공하는 무료 홈페이지 중에서 \\"\\"아, 이게 제일 나다운 홈페이지다.\\"\\" 하고 느꼈네요. 내가 원하는 대로 만들려면 어려운 코딩 공부를 해야 되죠ㅠㅠ 하지만 크리에이터 링크는 척척! 잘 만들어주니까 너무 좋아요! 여러분.. 쉽고 빠르게 홈페이지 제작은..크리에이터 링크가 답입니다.\\"",\
515                          "reviewRating": {\
516                            "@type": "Rating",\
517                            "bestRating": "5",\
518                            "ratingValue": "5"\
519                          }\
520                        },\
521                        {\
522                          "@type": "Review",\
523                          "author": "윤**",\
524                          "name": "윅*에서 크리에이터링크로 갈아탔네요~",\
525                          "reviewBody": "원래는 포트폴리오 사이트를 외국사이트 윅*로 만들어보려고 계획했었는데 우연히 크리에이터링크 사이트 발견하고 거기 작업하던거 포기하고 바로 갈아탔네요~ 쉽ê²
525Œ 블럭으로 추가되는 것도 편리하고 편집하는 것도 직관적이고 무엇보다도 한글 서체가 다양해서 만족입니다~ " ,\
526                          "reviewRating" : {\
527                            "@type": "Rating",\
528                            "bestRating": "5",\
529                            "ratingValue": "5"\
530                          }\
531                        }\
532                      ]\
533                    }\
534                ';
535                    break;
536                }
537
538            default:
539                {
540                    break;
541                }
542        }
543        $('body').prepend('<script type="application/ld+json">' + jsonscript + '</script>');
544    }
545
546    function arrayUnique(array) {
547        var a = array.concat();
548        for (var i = 0; i < a.length; ++i) {
549            for (var j = i + 1; j < a.length; ++j) {
550                if (a[i] === a[j])
551                    a.splice(j--, 1);
552            }
553        }
554        return a;
555    }
556
557    function arrayRemove(arr, value) {
558        return arr.filter(function(ele) {
559            return ele != value;
560        });
561    }
562
563    function win_open(url, name, option) {
564        var popup = window.open(rt_path + '/' + url, name, option);
565        popup.focus();
566    }
567
568    // 쪽지 창
569    function win_memo(url) {
570        if (!url)
571            url = "member/memo/lists";
572        win_open(url, "winMemo", "left=50,top=50,width=620,height=460,scrollbars=1");
573    }
574
575    // 자기소개 창
576    function win_profile(mb_id) {
577        win_open("member/profile/qry/" + mb_id, 'winProfile', 'left=50,top=50,width=400,height=500,scrollbars=1');
578    }
579
580    // 우편번호 창
581    function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2) {
582        url = "useful/zip/qry/" + frm_name + "/" + frm_zip1 + "/" + frm_zip2 + "/" + frm_addr1 + "/" + frm_addr2;
583        win_open(url, "winZip", "left=50,top=50,width=616,height=460,scrollbars=1");
584    }
585
586    // POST 전송, 결과값 리턴
587    function post_s(href, parm, del) {
588        /*if (!del || confirm(  $.lang[LANG]['page.board.cts.msg.delete'] )) {
589            $.post(rt_path + '/' + href, parm, function (req) {
590                document.write(req);
591            });
592        }*/
593        var confirm = false;
594        var modal = $(this).showModalFlat('', $.lang[LANG]['page.board.cts.msg.delete'], true, true, function() {
595            confirm = true;
596            if (!del || confirm) {
597                $.post(rt_path + '/' + href, parm, function(req) {
598                    document.write(req);
599                });
600            }
601        }, 'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn', '', '', function() {
602            $(document).on('keydown', function(e) {
603                if (e.keyCode == 27) modal.modal('hide');
604            });
605        });
606    }
607
608    // POST 이동
609    function post_goto(url, parm, target) {
610        var f = document.createElement('form');
611
612        var objs, value;
613        for (var key in parm) {
614            value = parm[key];
615            objs = document.createElement('input');
616            objs.setAttribute('type', 'hidden');
617            objs.setAttribute('name', key);
618            objs.setAttribute('value', value);
619            f.appendChild(objs);
620        }
621
622        if (target)
623            f.setAttribute('target', target);
624
625        f.setAttribute('method', 'post');
626        f.setAttribute('action', rt_path + '/' + url);
627        document.body.appendChild(f);
628        f.submit();
629    }
630
631    // POST ì°½
632    function post_win(name, url, parm, opt) {
633        var temp_win = window.open('', name, opt);
634        post_goto(url, parm, name);
635    }
636
637    // 일반 삭제 검사 확인
638    function del(href) {
639        if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?"))
640            document.location.href = rt_path + '/' + href;
641    }
642
643    // 플래시에 변수 추가 fh
644    function flash_movie(src, ids, width, height, wmode, fh) {
645        var wh = "";
646        if (parseInt(width) && parseInt(height))
647            wh = " width='" + width + "' height='" + height + "' ";
648        return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/s
648hockwave/cabs/flash/swflash.cab#version=6,0,0,0' " + wh + " id=" + ids + "><param name=wmode value=" + wmode + "><param name=movie value=" + src + "><param name=quality value=high><param name=flashvars value=" + fh + "><embed src=" + src + " quality=high wmode=" + wmode + " flashvars=" + fh + " type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' " + wh + "></embed></object>";
649    }
650
651    // 동영상 파일
652    function obj_movie(src, ids, width, height, autostart) {
653        var wh = "";
654        if (parseInt(width) && parseInt(height))
655            wh = " width='" + width + "' height='" + height + "' ";
656        if (!autostart) autostart = false;
657        return "<embed src='" + src + "' " + wh + " autostart='" + autostart + "'></embed>";
658    }
659
660    // 아이프레임 높이 자동조절
661    function reSize(obj) {
662        try {
663            var objBody = frames[obj].document.body;
664            var objFrame = document.getElementById(obj);
665            ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
666            objFrame.style.height = ifrmHeight;
667        } catch (e) {}
668    }
669
670    function sEncode(val) {
671        return encodeURIComponent(val).replace(/%/g, '.');
672    }
673
674    // script 에서 js 파일 로드
675    function importScript(FILES) {
676        var _importScript = function(filename) {
677            if (filename) {
678                document.write('<script type="text/javascript" src="' + rt_path + '/js/' + filename + '.js"></s' + 'cript>');
679            }
680        };
681
682        for (var i = 0; i < FILES.length; i++) {
683            _importScript(FILES[i]);
684        }
685    }
686
687    // jQuery textarea
688    function txresize(tx, type, size) {
689        var tx = $('#' + tx);
690        if (type == 1)
691            tx.animate({ 'height': '-=' + size + 'px' }, 'fast');
692        else if (type == 2)
693            tx.animate({ 'height': size }, 'fast');
694        else if (type == 3)
695            tx.animate({ 'height': '+=' + size + 'px' }, 'fast');
696    }
697
698    // 팝업 닫기
699    function popup_close(id, onday) {
700        if (onday) {
701            var today = new Date();
702            today.setTime(today.getTime() + (60 * 60 * 1000 * 24));
703            document.cookie = id + "=" + escape(true) + "; path=/; expires=" + today.toGMTString() + ";";
704        }
705
706        if (window.parent.name.indexOf(id) != -1)
707            window.close();
708        else
709            document.getElementById(id).style.display = 'none';
710    }
711
712    function checkcode(e) {
713        var code = (window.event) ? event.keyCode : e.which; //IE : FF - Chrome both
714        if (code > 31 && code < 45) nAllow(e);
715        if (code > 45 && code < 48) nAllow(e);
716        if (code > 57 && code < 65) nAllow(e);
717        if (code > 90 && code < 97) nAllow(e);
718        if (code > 122 && code < 127) nAllow(e);
719    }
720
721    function nAllow(e) {
722        alert('특수문자 - 만 사용할수있습니다');
723        if (navigator.appName != "Netscape") {
724            //for not returning keycode value
725            event.returnValue = false; //IE ,  - Chrome both
726        } else {
727            e.preventDefault(); //FF ,  - Chrome both
728        }
729    }
730
731    function copyToClipboard(text) {
732        if (window.clipboardData && window.clipboardData.setData) {
733            // IE specific code path to prevent textarea being shown while dialog is visible.
734            return clipboardData.setData("Text", text);
735
736        } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
737            var textarea = document.createElement("textarea");
738            textarea.textContent = text;
739            textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge.
740            document.body.appendChild(textarea);
741            textarea.select();
742            try {
743                return document.execCommand("copy"); // Security exception may be thrown by some browsers.
744            } catch (ex) {
745                console.warn("Copy to clipboard failed.", ex);
746                return false;
747            } finally {
748                document.body.removeChild(textarea);
749            }
750        }
751
752        return false;
753    }
754
755    function copyTextToClipboard(text) {
756        var copyFrom = $('<textarea class="hide"/>');
757        copyFrom.text(text);
758        $('body').append(copyFrom);
759        copyFrom.select();
760        document.execCommand('copy');
761        copyFrom.remove();
762    }
763
764    var autoCopySelector = '.element [data-edit="true"] [data-copy-group], .forum-view .tpl-forum-content .fr-view [data-copy-group], .forum-view.post .fr-view [data-copy-group]';
765
766    function getAutoCopyGroup($target) {
767        var groupId = $target.attr('data-copy-group');
768        var $scope = $target.closest('.fr-view, .element');
769        if(!$scope.length) $scope = $(document.body);
770
771        return $scope.find('[data-copy-group]').filter(function() {
772            return $(this).attr('data-copy-group') === groupId;
773        });
774    }
775
776    function decodeAutoCopyText(text) {
777        return text.replace(/\\(\\|n)/g, function(match, value) {
778            return value === 'n' ? '\n' : '\\';
779        });
780    }
781
782    function isAutoCopyDisabled($target) {
783        return $target.closest('.fr-view[contenteditable="true"]').length || (typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c');
784    }
785
786    function removeAutoCopyTooltip($target) {
787        var $tooltip = $target.data('auto-copy-tooltip');
788
789        if($tooltip) $tooltip.remove();
790        $target.removeData('auto-copy-tooltip');
791    }
792
793    $(document)
794        .on('mouseenter focusin', autoCopySelector, function() {
795            var $this = $(this);
796            var $group = getAutoCopyGroup($this);
797
798            $group.addClass('auto-copy-group-hover');
799
800            if(isAutoCopyDisabled($this)) {
801                removeAutoCopyTooltip($this);
802                return;
803            }
804
805            removeAutoCopyTooltip($this);
806            var $tooltip = $('<div class="tooltip top in auto-copy-tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>');
807            var $owner = $group.filter('[data-copy]').first();
808            var background = $owner.get(0) || this;
809            var targetRect = background.getBoundingClientRect();
810            var backgroundOffsetTop = parseFloat(window.getComputedStyle(background, '::before').top) || 0;
811            var backgroundTop = targetRect.top + backgroundOffsetTop + $(window).scrollTop();
812            var backgroundCenter = targetRect.left + $(window).scrollLeft() + (targetRect.width / 2);
813
814            $this.data('auto-copy-tooltip', $tooltip);
815            $tooltip.find('.tooltip-inner').text($.lang[LANG]['editor.auto-copy.tooltip']);
816            $tooltip.css('margin-top', 0);
817            $('body').append($tooltip);
818
819            var tooltipRect = $tooltip[0].getBoundingClientRect();
820            var arrowRect = $tooltip.find('.tooltip-arrow')[0].getBoundingClientRect();
821            var visualHeight = Math.max(tooltipRect.bottom, arrowRect.bottom) - tooltipRect.top;
822
823            $tooltip.css({
824                top: backgroundTop - visualHeight - 5,
825                left: backgroundCenter - (tooltipRect.width / 2)
826            });
827        })
828        .on('mouseleave focusout', autoCopySelector, function() {
829            var $this = $(this);
830            var $group = getAutoCopyGroup($this).removeClass('auto-copy-group-hover');
831
832            $group.each(function() {
833                if(!$(this).attr('class')) $(this).removeAttr('class');
834            });
835            removeAutoCopyTooltip($this);
836        });
837
838    $(document).on('click', autoCopySelector, function(e) {
839        var $target = $(this);
840        if(isAutoCopyDisabled($target)) return;
841
842        var $owner = getAutoCopyGroup($target).filter('[data-copy]').first();
843        var copyValue = $owner.attr('data-copy');
844        if(typeof copyValue == 'undefined' || copyValue === '') return;
845
846        var copyText = decodeAutoCopyText(copyValue);
847
848        e.preventDefault();
849        e.stopPropagation();
850        e.stopImmediatePropagation();
851
852        var result = copyToClipboard(copyText);
853        var confirmText = $owner.attr('data-copy-confirm');
854        if(result !== false) {
855            if(typeof confirmText == 'undefined' || $.trim(confirmText) === '') confirmText = $.lang[LANG]['editor.auto-copy.copied'];
856            alert(confirmText);
857        }
858    });
859
860    function trim(str) {
861        str = str.replace(/^\s*/, '').replace(/\s*$/, '');
862        return str; //변환한 스트링을 리턴.
863    }
864
865    jQuery.fn.center = function() {
866        this.css("position", "absolute");
867        this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
868        this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
869        return this;
870    }
871
872    function setCookie(cookieName, cookieValue, expireDate) {
873        var today = new Date();
874        today.setDate(today.getDate() + parseInt(expireDate));
875        document.cookie = cookieName + "=" + escape(cookieValue) + "; path=/; expires=" + today.toGMTString() + ";";
876    }
877
878    function getCookie(cookieName) {
879        var search = cookieName + "=";
880        var cookie = document.cookie;
881
882        // 현재 쿠키가 존재할 경우
883        if (cookie.length > 0) {
884            // 해당 쿠키명이 존재하는지 검색한 후 존재하면 위치를 리턴.
885            startIndex = cookie.indexOf(cookieName);
886
887            // 만약 존재한다면
888            if (startIndex != -1) {
889                // 값을 얻어내기 위해 시작 인덱스 조절
890                startIndex += cookieName.length;
891
892                // 값을 얻어내기 위해 종료 인덱스 추출
893                endIndex = cookie.indexOf(";", startIndex);
894
895                // 만약 종료 인덱스를 못찾게 되면 쿠키 전체길이로 설정
896                if (endIndex == -1) endIndex = cookie.length;
897
898                // 쿠키값을 추출하여 리턴
899                return unescape(cookie.substring(startIndex + 1, endIndex));
900            } else {
901                // 쿠키 내에 해당 쿠키가 존재하지 않을 경우
902                return false;
903            }
904        } else {
905            // 쿠키 자체가 없을 경우
906            return false;
907        }
908    }
909
910    function deleteCookie(cookieName) {
911        var expireDate = new Date();
912
913        //어제 날짜를 쿠키 소멸 날짜로 설정한다.
914        expireDate.setDate(expireDate.getDate() - 1);
915        document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
916    }
917
918    function getRandom() {
919        var result = Math.floor(Math.random() * 10) + 1;
920        return result;
921    }
922
923    function strpos(haystack, needle, offset) {
924        // From: http://phpjs.org/functions
925        // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
926        // +   improved by: Onno Marsman
927        // +   bugfixed by: Daniel Esteban
928        // +   improved by: Brett Zamir (http://brett-zamir.me)
929        // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
930        // *     returns 1: 14
931        var i = (haystack + '').indexOf(needle, (offset || 0));
932        return i === -1 ? false : i;
933    }
934
935    function htmlEntities(str) {
936        return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
937    }
938
939    function removeEmptyLines(html) {
940        return html
941            .split('\n')                    
942            .map(line => line.trim())       
943            .filter(line => line !== '')    
944            .join('\n');                    
945    }
946    
947
948    function htmlspecialchars_decode(string, quote_style) {
949        if(typeof string == 'undefined' || !string) return '';
950
951        var optTemp = 0;
952        var i = 0;
953        var noquotes = false;
954        if (typeof quote_style === 'undefined') {
955            quote_style = 2;
956        }
957        string = string.toString()
958            .replace(/&lt;/g, '<')
959            .replace(/&gt;/g, '>')
960            .replace(/&amp;lt;/g, '<')
961            .replace(/&amp;gt;/g, '>');
962
963        var OPTS = {
964            'ENT_NOQUOTES': 0,
965            'ENT_HTML_QUOTE_SINGLE': 1,
966            'ENT_HTML_QUOTE_DOUBLE': 2,
967            'ENT_COMPAT': 2,
968            'ENT_QUOTES': 3,
969            'ENT_IGNORE': 4
970        };
971        if (quote_style === 0) {
972            noquotes = true;
973        }
974        if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags
975            quote_style = [].concat(quote_style);
976            for (i = 0; i < quote_style.length; i++) {
977                // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
978                if (OPTS[quote_style[i]] === 0) {
979                    noquotes = true;
980                } else if (OPTS[quote_style[i]]) {
981                    optTemp = optTemp | OPTS[quote_style[i]];
982                }
983            }
984            quote_style = optTemp;
985        }
986        if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
987            string = string.replace(/&#0*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
988            // string = string.replace(/&apos;|&#x0*27;/g, "'"); // This would also be useful here, but not a part of PHP
989        }
990        if (!noquotes) {
991            string = string.replace(/&quot;/g, '"');
992        }
993        // Put this in last place to avoid escape being double-decoded
994        string = string.replace(/&amp;/g, '&');
995
996        return string;
997    }
998
999    function explode(delimiter, string, limit) {
1000        //  discuss at: http://phpjs.org/functions/explode/
1001        // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1002        //   example 1: explode(' ', 'Kevin van Zonneveld');
1003        //   returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
1004
1005        if (arguments.length < 2 || typeof delimiter === 'undefined' || typeof string === 'undefined') return null;
1006        if (delimiter === '' || delimiter === false || delimiter === null) return false;
vendor: 4,135 bytes, lines 1007-1124
1007        if (typeof delimiter === 'function' || typeof delimiter === 'object' || typeof string === 'function' || typeof string ===
1008            'object') {
1009            return {
1010                0: ''
1011            };
1012        }
1013        if (delimiter === true) delimiter = '1';
1014
1015        // Here we go...
1016        delimiter += '';
1017        string += '';
1018
1019        var s = string.split(delimiter);
1020
1021        if (typeof limit === 'undefined') return s;
1022
1023        // Support for limit
1024        if (limit === 0) limit = 1;
1025
1026        // Positive limit
1027        if (limit > 0) {
1028            if (limit >= s.length) return s;
1029            return s.slice(0, limit - 1)
1030                .concat([s.slice(limit - 1)
1031                    .join(delimiter)
1032                ]);
1033        }
1034
1035        // Negative limit
1036        if (-limit >= s.length) return [];
1037
1038        s.splice(s.length + limit);
1039        return s;
1040    }
1041
1042    function microtime(get_as_float) {
1043        var now = new Date()
1044            .getTime() / 1000;
1045        var s = parseInt(now, 10);
1046
1047        return (get_as_float) ? now * 1000 : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
1048    }
1049
1050    function log(r) {
1051        console.log(r);
1052    }
1053
1054    function pathinfo(path, options) {
1055        //        note: which makes it fully compliant with PHP syntax.
1056        //  depends on: basename
1057        //   example 1: pathinfo('/www/htdocs/index.html', 1);
1058        //   returns 1: '/www/htdocs'
1059        //   example 2: pathinfo('/www/htdocs/index.html', 'PATHINFO_BASENAME');
1060        //   returns 2: 'index.html'
1061        //   example 3: pathinfo('/www/htdocs/index.html', 'PATHINFO_EXTENSION');
1062        //   returns 3: 'html'
1063        //   example 4: pathinfo('/www/htdocs/index.html', 'PATHINFO_FILENAME');
1064        //   returns 4: 'index'
1065        //   example 5: pathinfo('/www/htdocs/index.html', 2 | 4);
1066        //   returns 5: {basename: 'index.html', extension: 'html'}
1067        //   example 6: pathinfo('/www/htdocs/index.html', 'PATHINFO_ALL');
1068        //   returns 6: {dirname: '/www/htdocs', basename: 'index.html', extension: 'html', filename: 'index'}
1069        //   example 7: pathinfo('/www/htdocs/index.html');
1070        //   returns 7: {dirname: '/www/htdocs', basename: 'index.html', extension: 'html', filename: 'index'}
1071        var opt = '',
1072            optName = '',
1073            optTemp = 0,
1074            tmp_arr = {},
1075            cnt = 0,
1076            i = 0;
1077        var have_basename = false,
1078            have_extension = false,
1079            have_filename = false;
1080
1081        // Input defaulting & sanitation
1082        if (!path) {
1083            return false;
1084        }
1085        if (!options) {
1086            options = 'PATHINFO_ALL';
1087        }
1088
1089        // Initialize binary arguments. Both the string & integer (constant) input is
1090        // allowed
1091        var OPTS = {
1092            'PATHINFO_DIRNAME': 1,
1093            'PATHINFO_BASENAME': 2,
1094            'PATHINFO_EXTENSION': 4,
1095            'PATHINFO_FILENAME': 8,
1096            'PATHINFO_ALL': 0
1097        };
1098
1099        // PATHINFO_ALL sums up all previously defined PATHINFOs (could just pre-calculate)
1100        for (optName in OPTS) {
1101            OPTS.PATHINFO_ALL = OPTS.PATHINFO_ALL | OPTS[optName];
1102        }
1103        if (typeof options !== 'number') { // Allow for a single string or an array of string flags
1104            options = [].concat(options);
1105            for (i = 0; i < options.length; i++) {
1106                // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
1107                if (OPTS[options[i]]) {
1108                    optTemp = optTemp | OPTS[options[i]];
1109                }
1110            }
1111            options = optTemp;
1112        }
1113
1114        // Internal Functions
1115        var __getExt = function(path) {
1116            var str = path + '';
1117            var dotP = str.lastIndexOf('.') + 1;
1118            return !dotP ? false : dotP !== str.length ? str.substr(dotP) : '';
1119        };
1120
1121        function basename(path, suffix) {
1122            //  discuss at: http://phpjs.org/functions/basename/
1123            // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1124            // improved by: Ash Searle (http://hexmen.com/blog/)
1125            // improved by: Lincoln Ramsay
1126            // improved by: djmix
1127            // improved by: Dmitry Gorelenkov
1128            //   example 1: basename('/www/site/home.htm', '.htm');
1129            //   returns 1: 'home'
1130            //   example 2: basename('ecra.php?p=1');
1131            //   returns 2: 'ecra.php?p=1'
1132            //   example 3: basename('/some/path/');
1133            //   returns 3: 'path'
1134            //   example 4: basename('/some/path_ext.ext/','.ext');
1135            //   returns 4: 'path_ext'
1136
1137            var b = path;
1138            var lastChar = b.charAt(b.length - 1);
1139
1140            if (lastChar === '/' || lastChar === '\\') {
1141                b = b.slice(0, -1);
1142            }
1143
1144            b = b.replace(/^.*[\/\\]/g, '');
1145
1146            if (typeof suffix === 'string' && b.substr(b.length - suffix.length) == suffix) {
1147                b = b.substr(0, b.length - suffix.length);
1148            }
1149            return b;
1150        }
1151
1152        // Gather path infos
1153        if (options & OPTS.PATHINFO_DIRNAME) {
1154            var dirName = path.replace(/\\/g, '/')
1155                .replace(/\/[^\/]*\/?$/, ''); // dirname
1156            tmp_arr.dirname = dirName === path ? '.' : dirName;
1157        }
1158
1159        if (options & OPTS.PATHINFO_BASENAME) {
1160            if (false === have_basename) {
1161                have_basename = basename(path);
1162            }
1163            tmp_arr.basename = have_basename;
1164        }
1165
1166        if (options & OPTS.PATHINFO_EXTENSION) {
1167            if (false === have_basename) {
1168                have_basename = basename(path);
1169            }
1170            if (false === have_extension) {
1171                have_extension = __getExt(have_basename);
1172            }
1173            if (false !== have_extension) {
1174                tmp_arr.extension = have_extension;
1175            }
1176        }
1177
1178        if (options & OPTS.PATHINFO_FILENAME) {
1179            if (false === have_basename) {
1180                have_basename = basename(path);
1181            }
1182            if (false === have_extension) {
1183                have_extension = __getExt(have_basename);
1184            }
1185            if (false === have_filename) {
1186                have_filename = have_basename.slice(0, have_basename.length - (have_extension ? have_extension.length + 1 :
1187                    have_extension === false ? 0 : 1));
1188            }
1189            tmp_arr.filename = have_filename;
1190        }
1191
1192        // If array contains only 1 element: return string
1193        cnt = 0;
1194        for (opt in tmp_arr) {
1195            cnt++;
1196        }
1197        if (cnt == 1) {
1198            return tmp_arr[opt];
1199        }
1200
1201        // Return full-blown array
1202        return tmp_arr;
1203    }
1204
1205    function isIE() {
1206        userAgent = window.navigator.userAgent;
1207        return userAgent.indexOf("MSIE ") > -1 || userAgent.indexOf("Trident/") > -1 || userAgent.indexOf("Edge/") > -1;
1208    }
1209
1210    function isMobile() {
1211        return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) ? true : false;
1212    }
1213
1214    $(document).on('click', '#goto-top-m', function(e) {
1215        e.preventDefault();
1216        $('body,html').animate({ scrollTop: 0 }, 400);
1217    });
1218
1219    $(window).on('scroll', function() {
1220        if ($(this).scrollTop() > 50) {
1221            $('.site-cts-banner, .cl-cts-banner, #ch-plugin').addClass('up');
1222            $('#goto-top-m, #goto-top-s').addClass('show');
1223        } else {
1224            $('.site-cts-banner, .cl-cts-banner, #ch-plugin').removeClass('up');
1225            $('#goto-top-m, #goto-top-s').removeClass('show');
1226        }
1227    });
1228
1229    $(document).on('click', '.tpl-share-snsPost', function(e) {
1230        var sns = $(this).attr('data-sns'),
1231            sid = (typeof SID == 'undefined') ? property.SID : SID,
1232            host = (typeof HOST == 'undefined') ? property.HOST : HOST,
1233            view = (typeof VIEW == 'undefined') ? property.VIEW : VIEW,
1234            page = (property.PAGE).split(','),
1235            hostname = (host.indexOf('addblock') > -1) ? window.location.host : window.location.hostname,
1236            url = window.location.protocol + '//' + hostname + '/' + page[0] + '/view/' + view,
1237            txt = (page[0] == 'forum') ? $('.tpl-forum-title').text() : $('[data-project-title]').text(),
1238            pageLang = sid.split('__');
1239        if (pageLang.length > 1) url = window.location.protocol + '//' + hostname + '/_lang/' + pageLang[1] + '/' + page[0] + '/view/' + view;
1240        sendSns(sns, url, txt);
1241    });
1242
1243    function sendSns(sns, url, txt) {
1244        var img = $('meta[property="og:image"]').attr('content'),
1245            description = ($('meta[property="og:description"]').length > 0) ? $('meta[property="og:description"]').attr('content') : $('meta[name="description"]').attr('content');
1246
1247        var o,
1248            _url = (typeof url == "undefined") ? encodeURIComponent("http://creatorlink.net") : encodeURIComponent(url),
1249            _txt = (typeof txt === "string" && txt.trim()) ? encodeURIComponent(txt) : encodeURIComponent("Make your portfolio site as easily as stacking blocks"),
1250            _br = encodeURIComponent('\r\n'),
1251            _img = (typeof img == "undefined") ? 'https://storage.googleapis.com/i.addblock.net/config/aboutVideoImg00.png' : img,
1252            _kakaolinkurl = (typeof url == "undefined") ? "http://creatorlink.net" : url;
1253
1254        switch (sns) {
1255            case 'facebook':
1256                o = {
1257                    method: 'popup',
1258                    url: 'https://www.facebook.com/sharer/sharer.php?u=' + _url + '&t=' + _txt
1259                };
1260                break;
1261            case 'twitter':
1262                o = {
1263                    method: 'popup',
1264                    url: 'http://twitter.com/intent/tweet?text=' + _txt + '&url=' + _url + '&source=' + _url
1265                };
1266                break;
1267            case 'google':
1268                o = {
1269                    method: 'popup',
1270                    url: 'https://plus.google.com/share?url=' + _url
1271                };
1272                break;
1273            case 'pinterest':
1274                o = {
1275                    method: 'popup',
1276                    url: 'http://pinterest.com/pin/create/button/?url=' + _url + '&media=' + _img + '&description=' + _txt
1277                };
1278                break;
1279            case "tumblr":
1280                o = {
1281                    method: 'popup',
1282                    url: 'http://www.tumblr.com/share?v=3&u=' + _url + '&t=creatorlink&s='
1283                };
1284                break;
1285            case "naverblog":
1286                o = {
1287                    method: 'popup',
1288                    url: 'http://share.naver.com/web/shareView.nhn?url=' + _url + '&title=' + _txt
1289                };
1290                break;
1291            case "kakaotalk":
1292                if (typeof property.SETTINGS.kakaolink != 'undefined') {
1293                    var kakaolink_key = property.SETTINGS.kakaolink_key;
1294                    console.log('txt: '+txt);
1295                    console.log('description: '+description);
1296                    kakaotalkShare(txt, description, _img, kakaolink_key, _kakaolinkurl);
1297                } else alert('카카오 API키 오류');
1298                o = {
1299                    method: ''
1300                };
1301                break;
1302            case "urlcopy":
1303                copyToUrlClipboard(url);
1304                o = {
1305                    method: ''
1306                };
1307                break;
1308            default:
1309                o = {
1310                    method: ''
1311                };
1312                break;
1313        }
1314        switch (o.method) {
1315            case "popup":
1316                var left = (screen.width / 2) - (575 / 2);
1317                var top = (screen.height / 2) - (575 / 2);
1318                window.open(o.url, 'Share', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=575, height=575, top=' + top + ', left=' + left);
1319                break;
1320            default:
1321                break;
1322        }
1323    }
1324
1325    function kakaotalkShare(title, content, img, kakaolink_key, url) {
1326        Kakao.cleanup();
1327        Kakao.init(kakaolink_key);
1328        if(Kakao.isInitialized()) {
1329            Kakao.Share.sendDefault({
1330                objectType: 'feed',
1331                content: {
1332                    title: title,
1333                    description: content,
1334                    imageUrl: img,
1335                    link: {
1336                        mobileWebUrl: url,
1337                        webUrl: url
1338                    }
1339                },
1340                buttons: [{
1341                    title: '웹으로 보기',
1342                    link: {
1343                        mobileWebUrl: url,
1344                        webUrl: url
1345                    }
1346                }]
1347            });
1348        }
1349    }
1350
1351    function copyToUrlClipboard(url) {
1352        if (window.clipboardData && window.clipboardData.setData) {
1353            // IE specific code path to prevent textarea being shown while dialog is visible.
1354            return clipboardData.setData("Text", url);
1355
1356        } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
1357            var textarea = document.createElement("textarea");
1358            textarea.textContent = url;
1359            textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge.
1360            document.body.appendChild(textarea);
1361            textarea.select();
1362            try {
1363                return document.execCommand("copy"); // Security exception may be thrown by some browsers.
1364            } catch (ex) {
1365                console.warn("Copy to clipboard failed.", ex);
1366                return false;
1367            } finally {
1368                document.body.removeChild(textarea);
1369                alert($.lang[LANG]['config.sns.urlcopy.alert']);
1370            }
1371        }
1372    }
1373
1374    function stripslashes(str) {
1375        return (str + '')
1376            .replace(/\\(.?)/g, function(s, n1) {
1377                switch (n1) {
1378                    case '\\':
1379                        return '\\';
1380                    case '0':
1381                        return '\u0000';
1382                    case '':
1383                        return '';
1384                    default:
1385                        return n1;
1386                }
1387            });
1388    }
1389
1390    function isNumber(s) {
1391        s += '';
1392        s = s.replace(/^\s*|\s*$/g, '');
1393        if (s == '' || isNaN(s)) return false;
1394        return true;
1395    }
1396
1397    function saveSelection() {
1398        if (window.getSelection) {
1399            sel = window.getSelection();
1400            if (sel.getRangeAt && sel.rangeCount) {
1401                return sel.getRangeAt(0);
1402            }
1403        } else if (document.selection && document.selection.createRange) {
1404            return document.selection.createRange();
1405        }
1406        return null;
1407    }
1408
1409    function restoreSelection(range) {
1410        if (range) {
1411            if (window.getSelection) {
1412                sel = window.getSelection();
1413                sel.removeAllRanges();
1414                sel.addRange(range);
1415            } else if (document.selection && range.select) {
1416                range.select();
1417            }
1418        }
1419    }
1420
1421    function getBytes(string) {
1422        if(string == '') return 0;
1423        var cnt = 0,
1424            ch = "";
1425        for (var i = 0; i < string.length; i++) {
1426            ch = string.charAt(i);
1427            if (escape(ch).length > 4) {
1428                cnt += 2;
1429            } else {
1430                cnt += 1;
1431            }
1432        }
1433        return cnt;
1434    }
1435
1436    function getWidthPercent(el) {
1437        var width = parseFloat($(el).css('width')) / parseFloat($(el).parent().css('width'));
1438        return Math.round(100 * width) + '%';
1439    }
1440
1441    // smartresize
1442    (function($, sr) {
1443
1444        // debouncing function from John Hann
1445        // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
1446        var debounce = function(func, threshold, execAsap) {
1447                var timeout;
1448
1449                return function debounced() {
1450                    var obj = this,
1451                        args = arguments;
1452
1453                    function delayed() {
1454                        if (!execAsap)
1455                            func.apply(obj, args);
1456                        timeout = null;
1457                    };
1458
1459                    if (timeout)
1460                        clearTimeout(timeout);
1461                    else if (execAsap)
1462                        func.apply(obj, args);
1463
1464                    timeout = setTimeout(delayed, threshold || 100);
1465                };
1466            }
1467            // smartresize 
1468        jQuery.fn[sr] = function(fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
1469
1470    })(jQuery, 'smartresize');
1471
1472    function emailcheck(email) {
1473        // var regExp = /[0-9a-zA-Z][_0-9a-zA-Z-]*@[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+){1,2}$/;
1474        var regExp = /^[a-zA-Z0-9+-\_.]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;
1475        if (email.lenght == 0) return false;
1476        if (!email.match(regExp)) return false;
1477        if (email.indexOf(',') > -1) return false;
1478        return true;
1479    }
1480
1481    function shareModal() {
1482        var title = $('meta[property="og:title"]').attr('content'),
1483            description = ($('meta[property="og:description"]').length > 0) ? $('meta[property="og:description"]').attr('content') : $('meta[name="description"]').attr('content');
1484        $(this).showModalFlat($.lang[LANG]['config.sns-share-btn'], snsPost(), false, false, '', '', '', 'cl-modal cl-cmmodal cl-p70 cl-s-btn cl-close-btn cl-t80 w320 share-modal');
1485    }
1486
1487    var snsPost = function() {
1488        str = "" +
1489            "   <ul class='tpl-share-sns'>";
1490        if (property.SETTINGS.kakaolink == 'on') {
1491            str += "<li class='tpl-share-snsPost' data-sns='kakaotalk' id='kakao-link-btn'><span class='share-round'><svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M12 1.89c-6.08 0-11 3.89-11 8.7 0 3.13 2.09 5.87 5.22 7.4 -0.23 0.86-0.83 3.11-0.95 3.59 -0.15 0.6 0.22 0.59 0.46 0.43 0.19-0.13 3.01-2.05 4.23-2.88 0.66 0.1 1.34 0.15 2.04 0.15 6.08 0 11-3.89 11-8.7C23 5.79 18.08 1.89 12 1.89\"/></svg></span> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.kakaotalk"] + "</span></li>";
1492        }
1493
1494        str += "<li class='tpl-share-snsPost' data-sns='facebook'><span class='share-round'><svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M15.64 4.65l2.07 0v-3.5C17.35 1.11 16.12 1 14.69 1c-2.98 0-5.03 1.82-5.03 5.17v2.88H6.29v3.91h3.38V23h4.04V12.96h3.37l0.5-3.91H13.7v-2.5C13.7 5.42 14.02 4.65 15.64 4.65z\"/></svg></span> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.facebook"] + "</span></li>" +
1495            "       <li class='tpl-share-snsPost' data-sns='twitter'><span class='share-round'><svg viewBox=\"0 0 20 20\" width=\"20\" height=\"20\"><path d=\"M14.21 16.71h1.53L5.86 3.2H4.22l9.98 13.52Zm.97-15.13h2.76l-6.03 7.14L19 18.43h-5.55L9.1 12.54l-4.98 5.89H1.36l6.45-7.63L1 1.58h5.7l3.93 5.38 4.55-5.38Z\"/></svg></span> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.twitter"] + "</span></li>" +
1496            "       <li class='tpl-share-snsPost' data-sns='naverblog'><span class='share-round'><svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M18.49 10.29c-0.48 0-0.87 0.39-0.87 0.87 0 0.48 0.39 0.87 0.87 0.87 0.48 0 0.87-0.39 0.87-0.87C19.36 10.68 18.97 10.29 18.49 10.29z\"/><path d=\"M13.3 10.29c-0.48 0-0.87 0.39-0.87 0.87 0 0.48 0.39 0.87 0.87 0.87 0.48 0 0.87-0.39 0.87-0.87C14.17 10.68 13.78 10.29 13.3 10.29z\"/><path d=\"M5.59 10.29c-0.48 0-0.87 0.39-0.87 0.87 0 0.48 0.39 0.87 0.87 0.87 0.48 0 0.87-0.39 0.87-0.87C6.45 10.68 6.07 10.29 5.59 10.29z\"/><path d=\"M19.53 3H4.47C2.56 3 1 4.56 1 6.49v8.27c0 1.93 1.56 3.49 3.47 3.49h5.18l1.77 2.88c0 0 0.02 0.03 0.06 0.08 0.1 0.18 0.29 0.3 0.51 0.3 0.22 0 0.41-0.12 0.51-0.29 0.04-0.05 0.06-0.09 0.06-0.09l1.77-2.88h5.18c1.92 0 3.47-1.56 3.47-3.49V6.49C23 4.56 21.44 3 19.53 3zM5.89 13.21c-0.81 0-1.13-0.58-1.13-0.58v0.44H3.39V7.46h1.35v2.14c0.54-0.53 1.14-0.53 1.14-0.53 1.83 0 1.9 2.05 1.9 2.05C7.78 13.14 5.89 13.21 5.89 13.21zM10.13 9.44v3.63h-1.3V9.75c0-1.14-0.61-1.12-0.61-1.12v-1.3C10.19 7.33 10.13 9.44 10.13 9.44zM15.58 11.16c0 2.05-2.28 2.05-2.28 2.05 -2.3 0-2.23-2.05-2.23-2.05 0-2.08 2.23-2.08 2.23-2.08C15.65 9.08 15.58 11.16 15.58 11.16zM20.61 13.01c0 2.13-1.97 2.1-1.97 2.1h-0.52v-1.19h0.32c0.95 0 0.86-0.98 0.86-0.98v-0.31c-0.42 0.54-1.18 0.51-1.18 0.51 -1.87 0-1.85-2-1.85-2 0-2.14 1.91-2.06 1.91-2.06 0.74 0 1.13 0.51 1.13 0.51V9.21h1.31V13.01z\"/></svg></span> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.naverblog"] + "</span></li>" +
1497            "       <li class='tpl-share-snsPost' data-sns='urlcopy'><span class='share-round'><svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\"><path d=\"M8.71 18.87c-0.48 0.48-1.11 0.74-1.79 0.74s-1.31-0.26-1.79-0.74c-0.99-0.99-0.99-2.59 0-3.58l4.15-4.15c0.48-0.48 1.11-0.74 1.79-0.74 0.68 0 1.31 0.26 1.79 0.74l0.98-0.98c-0.76-0.76-1.77-1.15-2.77-1.15s-2 0.38-2.77 1.15l-4.15 4.15c-1.53 1.53-1.53 4.01 0 5.54C4.91 20.62 5.91 21 6.92 21s2-0.38 2.77-1.15l2.08-2.08 -0.98-0.98L8.71 18.87z\"/><path d=\"M19.85 4.15C19.09 3.38 18.09 3 17.08 3c-1 0-2 0.38-2.77 1.15l-2.08 2.08 0.98 0.98 2.08-2.08c0.48-0.48 1.11-0.74 1.79-0.74s1.31 0.26 1.79 0.74c0.99 0.99 0.99 2.59 0 3.58l-4.15 4.15c-0.48 0.48-1.11 0.74-1.79 0.74 -0.68 0-1.31-0.26-1.79-0.74l-0.98 0.98c0.76 0.76 1.77 1.15 2.77 1.15s2-0.38 2.77-1.15l4.15-4.15C21.38 8.16 21.38 5.68 19.85 4.15z\"/></svg></span> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.urlcopy"] + "</span></li>" +
1498            "       <!--<li class='tpl-share-snsPost' data-sns='google'><i class='fa fa-google-plus-square'></i> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.google"] + "</span></li>" +
1499            "       <li class='tpl-share-snsPost' data-sns='pinterest'><i class='fa fa-pinterest-square'></i> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.pinterest"] + "</span></li>" +
1500            "       <li class='tpl-share-snsPost' data-sns='tumblr'><i class='fa fa-tumblr-square'></i> <span class='tpl-share-sns-name'>" + $.lang[LANG]["config.sns.tumblr"] + "</span></li>-->" +
1501            "   </ul>" +
1502            "";
1503        return str;
1504    }
1505
1506
1507    var getLike = function(view) {
1508        var deferred = $.Deferred();
1509        var lSID = (PAGE_MODE == 'c') ? SID : property.SID,
1510            lPARENT = (PAGE_MODE == 'c') ? PARENT : property.PARENT,
1511            lVIEW = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
1512        var type = (lPARENT.mode) ? 'P' : 'F';
1513
1514        if (view !== undefined && view) {
1515            type = 'P';
1516            lPARENT = '';
1517            lVIEW = view;
1518        }
1519
1520        $.ajax({
1521            type: 'post',
1522            url: '/template/like/get',
1523            data: { type: type, view: lVIEW, sid: lSID },
1524            dataType: 'json',
1525            async: false,
1526            success: function(data) {
1527                deferred.resolve(data);
1528            }
1529        });
1530
1531        return deferred.promise();
1532    }
1533
1534    var setLike = function(el, mode) {
1535        if (typeof MODE !== 'undefined' && MODE == 'demo') return false;
1536        var umemberActivate = (PAGE_MODE == 'c') ? Number(UMEMBER_ACTIVATE) : Number(property.UMEMBER_ACTIVATE);
1537        var checkLogin = (PAGE_MODE == 'c') ? true : false;
1538        var view = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
1539        var parent = (PAGE_MODE == 'c') ? PARENT : property.PARENT;
1540        var sid = (PAGE_MODE == 'c') ? SID : property.SID;
1541
1542        var cm_id = '';
1543        var elsettings = {};
1544        var $this = el;
1545
1546        if (PAGE_MODE == 's') {
1547            var umember = property.UMEMBER;
1548            checkLogin = umember.check_login;
1549
1550            if (umemberActivate == 0 && umember.id_type == 'creatorlink') { //creatorlink login
1551                checkLogin = (umember.id !== undefined && umember.id) ? true : false;
1552            }
1553
1554            if ($('#write-login').length > 0) $('#write-login').remove();
1555
1556            if (parent.page) {
1557                elsettings = JSON.parse(parent.settings);
1558            } else {
1559                var parent_id = ($this.hasClass('gallery-like')) ? $this.closest('.blueimp-gallery').attr('id').replace('gframe-', '') : $this.closest('.element').attr('data-id');
1560                var el_idx = $('.element[data-id="' + parent_id + '"]').attr('data-el').replace('el_', '')
1561                var el_target = property.INITPAGE[el_idx];
1562                elsettings = JSON.parse(el_target.elsettings);
1563            }
1564
1565            var like_key = (mode == 'comment') ? 'likeComment_display' : 'like_display',
1566                like = (elsettings && elsettings.hasOwnProperty(like_key)) ? elsettings[like_key] : 'A';
1567
1568            if (like == 'M' && checkLogin == false) {
1569                if (confirm($.lang[LANG]['config.like.onlylogin'])) {
1570                    var action = (property.VALIDTYPE == 'SM') ? '/_login' : '/_cllogin';
1571                    var url = $(location).attr('pathname');
1572                    var html = '<form name="write_login_form" id="write-login" method="post" action="' + action + '" style="display:none;">\
1573                                    <input type="hidden" name="status" value="like">\
1574                                    <input type="hidden" name="sid" value="' + property.SID + '">\
1575                                    <input type="hidden" name="url" value="' + url + '">\
1576                                </form>';
1577                    $('body').append(html);
1578                    document.write_login_form.submit();
1579                }
1580                return false;
1581            }
1582        }
1583
1584        var like_id = $this.attr('data-like');
1585        var cnt = 0;
1586
1587        if (mode == 'list') {
1588            like_id = $this.closest('.figure.like').attr('data-like');
1589        }
1590        $this.addClass('disabled');
1591        var type = (parent.mode)? 'P':'F';
1592        var pid = parent.pid;
1593        switch (mode) {
1594            case 'gallery':
1595                type = 'P';
1596                pid = '';
1597                view = $this.attr('data-seq');
1598                break;
1599            case 'list':
1600                type = 'P';
1601                pid = '';
1602                view = $this.closest('.gallery-item').attr('data-seq');
1603                break;
1604            case 'comment':
1605                type += 'C';
1606                view = $this.closest('.page-comments').attr('data-id');
1607                cm_id = $this.attr('data-id');
1608                break;
1609        }
1610
1611        if (like_id !== undefined && like_id) { //delete like
1612            $.ajax({
1613                type: 'post',
1614                url: '/template/like/delete',
1615                data: { type: type, view: like_id, sid: sid, pid: pid, cm_id: cm_id },
1616                dataType: 'json',
1617                async: true,
1618                success: function(data) {
1619                    $this.removeClass('disabled');
1620                    switch (mode) {
1621                        case 'list':
1622                            $this.closest('.figure.like').removeClass('active').removeAttr('data-like');
1623                            $this.closest('.figure.like').find('.figure-like-cnt').text(data.cnt);
1624                            break;
1625
1626                        case 'gallery':
1627                            $this.removeClass('active').removeAttr('data-like');
1628                            view = $this.attr('data-seq');
1629                            var $figureLike = $('.gallery-item[data-seq="' + view + '"] .figure.like');
1630                            cnt = $figureLike.find('.figure-like-cnt').text();
1631                            $figureLike.removeClass('active').removeAttr('data-like');
1632                            $figureLike.find('.figure-like-cnt').text(data.cnt);
1633                            break;
1634
1635                        case 'project':
1636                            $this.removeClass('active').removeAttr('data-like');
1637                            $this.find('.btn-label').text(data.cnt);
1638                            break;
1639
1640                        case 'forum':
1641                            $this.removeClass('active').removeAttr('data-like');
1642                            $this.find('.btn-label').text(data.cnt);
1643
1644                            if ($('.page-bottomlist').length > 0) {
1645                                $('.tpl-forum-list-like[data-id="' + view + '"]').removeClass('active').removeAttr('data-like');
1646                                if ($('.tpl-forum-list-like[data-id="' + view + '"]').is('td') && $('.tpl-forum-list-like[data-id="' + view + '"] .forum-like-cnt').length == 0) {
1647                                    $('.tpl-forum-list-like[data-id="' + view + '"]').text(data.cnt);
1648                                } else {
1649                                    $('.tpl-forum-list-like[data-id="' + view + '"] .forum-like-cnt').text(data.cnt);
1650                                }
1651                            }
1652                            break;
1653
1654                        case 'comment':
1655                            $this.removeClass('active').removeAttr('data-like');
1656                            $this.find('.cm-like-cnt').text(data.cnt);
1657
1658                            break;
1659
1660                        default:
1661                            break;
1662                    }
1663                }
1664            });
1665        } else { //insert like
1666            $.ajax({
1667                type: 'post',
1668                url: '/template/like/update',
1669                data: { type: type, view: view, sid: sid, pid: pid, cm_id: cm_id },
1670                dataType: 'json',
1671                async: true,
1672                success: function(data) {
1673                    $this.removeClass('disabled');
1674                    switch (mode) {
1675                        case 'list':
1676                            $this.closest('.figure.like').addClass('active').attr('data-like', view);
1677                            $this.closest('.figure.like').find('.figure-like-cnt').text(data.cnt);
1678                            break;
1679
1680                        case 'gallery':
1681                            $this.addClass('active').attr('data-like', view);
1682
1683                            var $figureLike = $('.gallery-item[data-seq="' + view + '"] .figure.like');
1684                            cnt = $figureLike.find('.figure-like-cnt').text();
1685
1686                            $figureLike.addClass('active').attr('data-like', view);
1687                            $figureLike.find('.figure-like-cnt').text(data.cnt);
1688                            break;
1689
1690                        case 'project':
1691                            $this.addClass('active').attr('data-like', view);
1692                            $this.find('.btn-label').text(data.cnt);
1693                            break;
1694
1695                        case 'forum':
1696                            $this.addClass('active').attr('data-like', view);
1697                            $this.find('.btn-label').text(data.cnt);
1698
1699                            if ($('.page-bottomlist').length > 0) {
1700                                $('.tpl-forum-list-like[data-id="' + view + '"]').addClass('active').attr('data-like', view);
1701                                if ($('.tpl-forum-list-like[data-id="' + view + '"]').is('td') && $('.tpl-forum-list-like[data-id="' + view + '"] .forum-like-cnt').length == 0) {
1702                                    $('.tpl-forum-list-like[data-id="' + view + '"]').text(data.cnt);
1703                                } else {
1704                                    $('.tpl-forum-list-like[data-id="' + view + '"] .forum-like-cnt').text(data.cnt);
1705                                }
1706                            }
1707                            break;
1708
1709                        case 'comment':
1710                            $this.addClass('active').attr('data-like', view);
1711                            $this.find('.cm-like-cnt').text(data.cnt);
1712
1713                            break;
1714
1715                        default:
1716                            break;
1717                    }
1718                }
1719            });
1720        }
1721    }
1722
1723    var imgPopupFrame = function (el) {
1724        $('#imgPopupFrame').remove();
1725        var href = (typeof el == 'string')? el : $(el).attr('href');
1726        var imgSrc = (href.indexOf('googleusercontent') > -1)? getServeImage(href, 0, '') : href;
1727        var str = '\
1728            <div id="imgPopupFrame">\
1729                <div class="image-popup"><img src="'+imgSrc+'" onerror="this.src=\'//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png\'"></div>\
1730                <div class="zoomable hide"></div>\
1731                <a class="close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22"><polygon points="22 1.06 20.94 0 11 9.94 1.06 0 0 1.06 9.94 11 0 20.94 1.06 22 11 12.06 20.94 22 22 20.94 12.06 11 "/></svg></a>\
1732                <a class="zoom-in" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="확대"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
1732<path d="M24 22.94l-6.42-6.42C19.08 14.76 20 12.49 20 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10c2.49 0 4.76-0.92 6.52-2.42L22.94 24 24 22.94zM1.5 10c0-4.69 3.81-8.5 8.5-8.5 4.69 0 8.5 3.81 8.5 8.5s-3.81 8.5-8.5 8.5C5.31 18.5 1.5 14.69 1.5 10z"/><polygon points="10.75 6 9.25 6 9.25 9.25 6 9.25 6 10.75 9.25 10.75 9.25 14 10.75 14 10.75 10.75 14 10.75 14 9.25 10.75 9.25 "/></svg></a>\
1733                <a class="zoom-out disabled" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="축소"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 23" width="23" height="23"><g><path d="m23 21.98-6.16-6.16a9.566 9.566 0 0 0 2.32-6.24C19.17 4.29 14.88 0 9.58 0S0 4.29 0 9.58s4.29 9.58 9.58 9.58c2.39 0 4.57-.88 6.24-2.32L21.98 23 23 21.98zM1.44 9.58c0-4.49 3.65-8.15 8.15-8.15 4.49 0 8.15 3.65 8.15 8.15s-3.65 8.15-8.15 8.15-8.15-3.66-8.15-8.15z"/><path d="M5.75 8.86h7.67v1.44H5.75z"/></g></svg></a>\
1734                <a class="view-original disabled" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="화면 크기에 맞춰 확대">\
1735                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27" width="27" height="27"><g><path d="M1 4.12v18.75h25V4.12H1zm23.5 17.26h-22V5.62h22v15.76z"/><path d="M8.03 18.19h1.56V8.81H6.47v1.57h1.56zM12.72 10.38h1.56v1.56h-1.56zM12.72 15.06h1.56v1.56h-1.56zM18.19 18.19h1.56V8.81h-3.13v1.57h1.57z"/></g></svg>\
1736                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27" width="27" height="27"><path d="M24.03 4.03 24 4V3h-1l-.03-.03-.03.03H13.5v1.5h7.94L4.5 21.44V13.5H3v9.44l-.03.03L3 23v1h1l.03.03.03-.03h9.44v-1.5H5.56L22.5 5.56v7.94H24V4.06z"/></svg>\
1737                </a>\
1738            </div>\
1739        ';
1740        
1741        $('.dsgn-body').append(str);
1742
1743        setTimeout(function(){
1744            $('#imgPopupFrame').addClass('imgPopup-display');
1745
1746            var currentWidth = $('#imgPopupFrame .image-popup img').width();
1747            if(currentWidth >= $(window).width()) {
1748                $('#imgPopupFrame .view-original').addClass('disabled');
1749            } else {
1750                $('#imgPopupFrame .view-original').removeClass('disabled');
1751            }
1752            setImgPopupIconTooltip($('#imgPopupFrame'));
1753        }, 500);
1754    }
1755
1756    var setImgPopupIconTooltip = function(el){
1757        $(el).find('.zoom-in, .zoom-out, .view-original, .view-original.fullscreen').attr({
1758            'data-toggle': 'tooltip',
1759            'data-placement': 'bottom',
1760            'data-html': 'true',
1761        });
1762
1763        $(el).find('.zoom-in').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.zoom-in']);
1764        $(el).find('.zoom-out').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.zoom-out']);
1765
1766        $(el).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.view-fullscreen']);
1767        if($(el).find('.view-original').hasClass('fullscreen')) {
1768            $(el).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.view-original']);
1769        } else {
1770            $(el).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.view-fullscreen']);
1771        }
1772    }
1773
1774    var setPopupImgScale = function(el, scale) {
1775        var $img = el.find('img');
1776        var currentWidth = $img.width();
1777        var currentHeight = $img.height();
1778
1779        var zoomable = el.find('.zoomable');
1780
1781        if(zoomable.find('img').length == 0) {
1782            var $cloneImg = el.find('img').clone();
1783            $cloneImg.addClass('clone').attr('data-width', currentWidth).attr('data-height', currentHeight);
1784            zoomable.append($cloneImg);
1785        }
1786        var zoomableImg = zoomable.find('img');
1787
1788        var windowWidth = $(window).width();
1789        var windowHeight = $(window).height();
1790        var scaledWidth = currentWidth * scale;
1791        var scaledHeight = currentHeight * scale;
1792
1793        var scrollTop = zoomable.scrollTop();
1794        var scrollLeft = zoomable.scrollLeft();
1795
1796        var offsetX = ((windowWidth - currentWidth) > 0) ? (windowWidth - currentWidth) * 0.5 : 0;
1797        var offsetY = ((windowHeight - currentHeight) > 0) ? (windowHeight - currentHeight) * 0.5 : 0;
1798        var scaledOffsetX = ((windowWidth - scaledWidth - 8) > 0) ? (windowWidth - scaledWidth - 8) * 0.5 : 0;
1799        var scaledOffsetY = ((windowHeight - scaledHeight) > 0) ? (windowHeight - scaledHeight) * 0.5 : 0;
1800        var offset = {top: scaledOffsetY + 'px', left: scaledOffsetX + 'px'};
1801        var isScroll = false;
1802        var centerX = 0;
1803        var centerY = 0;
1804        var scrollPositionX = 0;
1805        var scrollPositionY = 0;
1806
1807        zoomable.removeClass('scroll');
1808        if(scaledWidth > windowWidth) {
1809            zoomable.css('width', scaledWidth);
1810            isScroll = true;
1811            offset = {top: scaledOffsetY+'px', left: 0};
1812        }
1813
1814        if(scaledHeight > windowHeight) {
1815            zoomable.css('height', scaledHeight);
1816            isScroll = true;
1817            offset = {top: 0, left: scaledOffsetX+'px'};
1818        } 
1819
1820        if(scaledWidth >= windowWidth && scaledHeight >= windowHeight) {
1821            offset = {top: 0, left: 0};
1822        }
1823
1824        if(isScroll) {
1825            zoomable.addClass('scroll');
1826            var scrollOffsetX = scaledWidth - windowWidth;
1827            var scrollOffsetY = scaledHeight - windowHeight;
1828            centerX = (scrollOffsetX - 8) * 0.5;
1829            centerY = (scrollOffsetY - 8) * 0.5;
1830            
1831            scrollPositionX = (zoomable.attr('data-scroll-left') !== undefined)? Number(zoomable.attr('data-scroll-left')) * scrollOffsetX : centerX;
1832            scrollPositionY = (zoomable.attr('data-scroll-top') !== undefined)? Number(zoomable.attr('data-scroll-top')) * scrollOffsetY : centerY;
1833        }
1834
1835        var scaleAnimation = Object.assign({}, offset, {width: scaledWidth+'px', height: scaledHeight+'px', scrollLeft: scrollPositionX, scrollTop: scrollPositionY});
1836
1837        if (scale > 1) {    
1838            $('#imgPopupFrame a.zoom-out').removeClass('disabled');
1839            zoomable.removeClass('hide');
1840            var zoomWidth = zoomableImg.attr('data-width');
1841            var zoomHeight = zoomableImg.attr('data-height');
1842            var initialWidth = zoomableImg.width();
1843            var initialHeight = zoomableImg.height();
1844
1845            if(Number(zoomWidth) == currentWidth) {
1846                zoomableImg.css({width: currentWidth+'px', height: currentHeight+'px', top: offsetY+'px', left: offsetX+'px'});
1847            }
1848
1849            zoomable.addClass('visible');
1850            setTimeout(function(){
1851                el.addClass('fullscreen');
1852                
1853                zoomableImg.animate(scaleAnimation, 200);
1854                // console.log(initialWidth, scaledWidth);
1855                if(initialWidth < windowWidth && scaledWidth > windowWidth) {
1856                    scrollPositionX = centerX;
1857                    var scrollLeft = centerX / (scaledWidth - windowWidth);
1858                    zoomable.attr({'data-scroll-left': scrollLeft});
1859                }
1860                if(initialHeight < windowHeight && scaledHeight > windowHeight) {
1861                    scrollPositionY = centerY;
1862                    var scrollTop = centerY / (scaledHeight - windowHeight);
1863                    zoomable.attr({'data-scroll-top': scrollTop});
1864                }
1865
1866                zoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 200); //scroll
1867
1868                // if(scaledWidth >= windowWidth && scaledHeight >= windowHeight) zoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 500);
1869
1870                zoomableImg.attr('data-scale', scale).attr('data-width', scaledWidth).attr('data-height', scaledHeight);
1871
1872                var isDragging = false;
1873                var lastX, lastY;
1874                zoomable.off('mousedown mousemove mouseup scroll');
1875                zoomable.on("mousedown", function(e) {
1876                    isDragging = true;
1877                    lastX = e.clientX;
1878                    lastY = e.clientY;
1879                    $(this).addClass('dragging');
1880                    e.preventDefault();
1881                    e.stopPropagation();
1882
1883                }).on("mousemove", function(e) {
1884                    if (isDragging) {
1885                        var deltaX = e.clientX - lastX;
1886                        var deltaY = e.clientY - lastY;
1887                        $(this).scrollLeft($(this).scrollLeft() - deltaX);
1888                        $(this).scrollTop($(this).scrollTop() - deltaY);
1889                        lastX = e.clientX;
1890                        lastY = e.clientY;
1891                        e.preventDefault();
1892                        e.stopPropagation();
1893                    }
1894                }).on("mouseup", function() {
1895                    isDragging = false;
1896                    $(this).removeClass('dragging');
1897
1898                    var scrollLeft = (($(this)[0].scrollWidth - $(this)[0].clientWidth) > 0) ? $(this).scrollLeft() / ($(this)[0].scrollWidth - $(this)[0].clientWidth) : 0;  // 가로 스크롤 좌표
1899                    var scrollTop = (($(this)[0].scrollHeight - $(this)[0].clientHeight) > 0) ? $(this).scrollTop() / ($(this)[0].scrollHeight - $(this)[0].clientHeight) : 0;    // 세로 스크롤 좌표
1900
1901                    zoomable.attr({'data-scroll-top': scrollTop, 'data-scroll-left': scrollLeft});
1902                    // console.log("가로 스크롤 좌표: " + scrollLeft);
1903                    // console.log("세로 스크롤 좌표: " + scrollTop);
1904                });
1905
1906                zoomable.on('mousewheel', function(e){
1907                    var scrollLeft = (($(this)[0].scrollWidth - $(this)[0].clientWidth) > 0) ? $(this).scrollLeft() / ($(this)[0].scrollWidth - $(this)[0].clientWidth) : 0;  // 가로 스크롤 좌표
1908                    var scrollTop = (($(this)[0].scrollHeight - $(this)[0].clientHeight) > 0) ? $(this).scrollTop() / ($(this)[0].scrollHeight - $(this)[0].clientHeight) : 0;    // 세로 스크롤 좌표
1909
1910                    zoomable.attr({'data-scroll-top': scrollTop, 'data-scroll-left': scrollLeft});
1911                    // console.log("가로 스크롤 좌표: " + scrollLeft);
1912                    // console.log("세로 스크롤 좌표: " + scrollTop);
1913                });
1914            }, 100);
1915        } else { //원본 크기
1916            zoomableImg.animate(scaleAnimation, 200);
1917            zoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 200);
1918
1919            $('#imgPopupFrame a.zoom-out').addClass('disabled');
1920            $('#imgPopupFrame a.view-original').removeClass('fullscreen');
1921
1922            if(scaledWidth == $(window).width()) {
1923                $('#imgPopupFrame a.view-original').addClass('disabled');
1924            }
1925
1926            setTimeout(function(){
1927                el.removeClass('fullscreen');
1928            }, 100);
1929            setTimeout(function(){
1930                zoomable.removeClass('visible').addClass('hide');
1931                zoomable.removeAttr('data-scroll-top data-scroll-left')
1932                zoomableImg.remove();
1933            }, 200);
1934        }
1935    
1936        
1937    }
1938
1939    var drawBadgeList = function(use_badge, badge_settings) {
1940        var badgeList = '';
1941        if(typeof badge_settings == 'undefined' || !badge_settings) {
1942            badge_settings = {}
1943        }
1944        if(typeof use_badge != 'undefined' && use_badge) {
1945            var badgeCnt = use_badge.length;
1946            $.each(use_badge, function(idx, b){
1947                var bsettings = (typeof badge_settings[b] != 'undefined')? badge_settings[b] : {};
1948                var badgeType = (typeof bsettings.type != 'undefined' && bsettings.type)? bsettings.type : 'edit';
1949                var badgeStyle = (typeof bsettings.style != 'undefined' && bsettings.style)? bsettings.style : 'default-1 small';
1950                var badgeText = (typeof bsettings.badge_text != 'undefined' && bsettings.badge_text)? bsettings.badge_text : $.lang[LANG]['gallery.shopping.badge.'+b];
1951                var badgeBorderColor = (typeof bsettings.border_color != 'undefined' && bsettings.border_color)? bsettings.border_color : '';
1952                var badgeBackgroundColor = (typeof bsettings.background_color != 'undefined' && bsettings.background_color)? bsettings.background_color : '';
1953                var badgeFontColor = (typeof bsettings.font_color != 'undefined' && bsettings.font_color)? bsettings.font_color : '';
1954                var $badge = (badgeType == 'edit')? $('<span class="product-badge ' + badgeStyle + '">' + badgeText + '</span>') : $('<span class="product-badge"><img class="badge-img" src="' + bsettings.image_src + '"></span>');
1955                
1956                if(badgeBorderColor) $badge.css('border-color', badgeBorderColor);
1957                if(badgeBackgroundColor) $badge.css('background-color', badgeBackgroundColor);
1958                if(badgeFontColor) $badge.css('color', badgeFontColor);
1959                // if(typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c') $badge.attr('data-type', b);
1960                $badge.attr('data-type', b);
1961
1962                badgeList += $badge[0].outerHTML;
1963            });
1964        }
1965        
1966        return badgeList;
1967    }
1968
1969    var getBadgeSize = function(badge_settings) {
1970        var small = 0;
1971        var medium = 0;
1972        var large = 0;
1973        var cnt = 0;
1974        if(typeof badge_settings != 'undefined' && badge_settings) {
1975            $.each(badge_settings, function(t, b){
1976                if(b.type == 'edit') {
1977                    cnt++;
1978                    if(b.style.indexOf('small') > -1) small++;
1979                    if(b.style.indexOf('medium') > -1) medium++;
1980                    if(b.style.indexOf('large') > -1) large++;
1981                }
1982            });
1983        }
1984        
1985        var flag = false;
1986        if(cnt == small) flag = 'badge-small';
1987        if(cnt == medium) flag = 'badge-medium';
1988        if(cnt == large) flag = 'badge-large';
1989
1990        return flag;
1991    }
1992
1993    $(document).on('click', '#imgPopupFrame .close, #imgPopupFrame .image-popup', function(e){
1994        if(!$(e.target).is('img')) $('#imgPopupFrame').fadeOut(500);
1995    });
1996
1997    $(document).on('dblclick','#imgPopupFrame .image-popup img, #imgPopupFrame .zoomable img', function(e) {
1998        e.preventDefault();
1999        e.stopPropagation();
2000        $('#imgPopupFrame a.view-original').toggleClass('fullscreen');
2001
2002        var el = $('#imgPopupFrame');
2003        var $img = $('#imgPopupFrame .image-popup img');
2004
2005        if($('#imgPopupFrame a.view-original').hasClass('fullscreen')) {
2006            var img = $img[0];
2007
2008            var currentWidth = $img.width();
2009            var currentHeight = $img.height();
2010            var windowWidth = $(window).width()-8;
2011            var windowHeight = $(window).height();
2012            var naturalWidth = img.naturalWidth,
2013                naturalHeight = img.naturalHeight;
2014            
2015            scale = (windowWidth / currentWidth).toFixed(15);
2016        } else {
2017            scale = 1;
2018        }
2019
2020        setImgPopupIconTooltip(el);
2021        setPopupImgScale(el, scale);
2022    });
2023
2024    $(document).on('click','#imgPopupFrame a.view-original', function(e) {
2025        e.preventDefault();
2026        e.stopPropagation();
2027        $(this).toggleClass('fullscreen');
2028
2029        var el = $('#imgPopupFrame');
2030        setImgPopupIconTooltip(el);
2031        $('#imgPopupFrame .view-original[data-toggle="tooltip"]').tooltip('show');
2032
2033        var $img = el.find('img');
2034        if($(this).hasClass('fullscreen')) {
2035            var img = $img[0];
2036
2037            var currentWidth = $img.width();
2038            var currentHeight = $img.height();
2039            var windowWidth = $(window).width()-8;
2040            var windowHeight = $(window).height();
2041            var naturalWidth = img.naturalWidth,
2042                naturalHeight = img.naturalHeight;
2043            
2044            scale = (windowWidth / currentWidth).toFixed(15);
2045        } else {
2046            scale = 1;
2047        }
2048        setPopupImgScale(el, scale);
2049    });
2050
2051    $(document).on('click','#imgPopupFrame a.zoom-in, #imgPopupFrame a.zoom-out', function(e) {
2052        e.stopPropagation();
2053
2054        var scale = $('#imgPopupFrame .zoomable img').attr('data-scale');
2055        if(scale === undefined) scale = 1;
2056
2057        if($(this).hasClass('zoom-in')) {
2058            $('#imgPopupFrame a.view-original').removeClass('disabled').addClass('fullscreen');
2059
2060            scale = Number(scale) + 0.5;
2061        } else {
2062            if(scale > 1) scale = Number(scale) - 0.5;
2063            if(scale < 1) scale = 1;
2064            if(scale == 1) {
2065                $('#imgPopupFrame a.view-original').removeClass('fullscreen');
2066            }
2067        }
2068        
2069        // setImgPopupIconTooltip(el);
2070        setPopupImgScale($('#imgPopupFrame'), scale);
2071        
2072    });
2073
2074    $(document).on('click', '.data-feed-load-more', function() {
2075        var feed = $(this).attr('data-feed-el');
2076        let feed_view = $('.'+feed+' .social-feed-element:visible').length;
2077        if ($('.' + feed + ' .listprogress').length) {
2078            $(this).showModalFlat('INFORMATION', 'Please wait...', true, false, '', 'ok');
2079            return false;
2080        }
2081        $('.' + feed + ' .social-feed-element').addClass('show-posts');
2082        if (typeof $('.' + feed + ' .social-feed-element:eq(0)').first().attr('social-feed-id') != 'undefined') $(this).hide();
2083    });
2084
2085    var loadingElement = function(el, msg) {
2086        $('.' + el + ' .listprogress').remove();
2087        if ($('.' + el).find('.social-feed-container').hasClass('listprogress-end')) return false;
2088        msg = (typeof msg == "undefined") ? "" : msg;
2089        var p = (msg) ? "<p class='text-center'>" + msg + "</p>" : "";
2090        $('.' + el + ' .social-feed-container').append('<div class="listprogress" style="width: 100%; text-align:center; padding:50px 0;"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:20px; height: 20px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg>' + p + '</div>');
2091    }
2092
2093    var setCustomPagination = function(config) {
2094
2095        var $obj = config['$obj'],
2096            total = config['total'],
2097            view = (config['view']) ? config['view'] : 10,
2098            page_num = (config['page_num']) ? config['page_num'] : 1,
2099            page_view = (config['page_view']) ? config['page_view'] : 5,
2100            pagingContainer = config['pagingContainer'],
2101            section = config['section'],
2102            base_url = config['base_url'];
2103
2104        start = Math.floor((page_num - 1) / page_view) * page_view,
2105            pages = Math.ceil(total / view),
2106            end = (Math.floor((page_num - 1) / page_view) + 1) * page_view,
2107            end = (end > pages) ? pages : end,
2108            prev = (start > 0) ? start : 1,
2109            next = ((end + 1) > pages) ? pages : end + 1,
2110            page_class = section + '-page';
2111
2112        $obj.empty();
2113
2114        for (i = start; i < end; i++) {
2115            var active = ((i + 1) == page_num) ? "active" : "",
2116                pageHref = base_url + (i + 1);
2117
2118            $obj.append($("<li class='" + page_class + " " + active + "' data-view='" + view + "' data-page-num='" + (i + 1) + "'><a href='" + pageHref + "'>" + (i + 1) + "</a></li>"));
2119        }
2120
2121        var prevHref = base_url + prev,
2122            nextHref = base_url + next,
2123            firstHref = base_url + '1',
2124            lastHref = base_url + pages,
2125            $prev = "" +
2126            "<li class='" + page_class + " prev' data-view='" + view +
2127            "' data-page-num='" + (start) + "'>" +
2128            "<a href='" + prevHref + "' aria-label='Previous'>" +
2129            "<span aria-hidden='true'>" +
2130            "<i class='fa fa-angle-left'></i>" +
2131            "</span>" +
2132            "</a>" +
2133            "</li>",
2134            $next = "" +
2135            "<li class='" + page_class + " next' data-view='" + view +
2136            "' data-page-num='" + (i + 1) + "'>" +
2137            "<a href='" + nextHref + "' aria-label='Previous'>" +
2138            "<span aria-hidden='true'>" +
2139            "<i class='fa fa-angle-right'></i>" +
2140            "</span>" +
2141            "</a>" +
2142            "</li>",
2143            $first = "" +
2144            "<li class='" + page_class + " prev' data-view='" + view +
2145            "' data-page-num='1'>" +
2146            "<a href='" + firstHref + "' aria-label='First'>" +
2147            "<span aria-hidden='true'>" +
2148            "<i class='fa fa-angle-double-left'></i>" +
2149            "</span>" +
2150            "</a>" +
2151            "</li>",
2152            $last = "" +
2153            "<li class='" + page_class + " prev' data-view='" + view +
2154            "' data-page-num='" + pages + "'>" +
2155            "<a href='" + lastHref + "' aria-label='Last'>" +
2156            "<span aria-hidden='true'>" +
2157            "<i class='fa fa-angle-double-right'></i>" +
2158            "</span>" +
2159            "</a>" +
2160            "</li>";
2161
2162        if (start != 0)
2163            $obj.prepend($prev);
2164
2165        if (end != pages)
2166            $obj.append($next);
2167
2168        if (pages > 5) {
2169            if (page_num > 5) $obj.prepend($first);
2170            $obj.append($last);
2171        }
2172
2173    }
2174
2175    function memberLogin() {
2176        location.href = "/";
2177    }
2178
2179
2180    Number.prototype.format = function(n, x) {
2181        var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')';
2182        return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,');
2183    };
2184
2185    // 뎁스가 있는 값을 확인하기
2186    var checkNested = function(obj) {
2187        var args = Array.prototype.slice.call(arguments, 1);
2188
2189        for (var i = 0; i < args.length; i++) {
2190            if (!obj || !obj.hasOwnProperty(args[i])) {
2191                return false;
2192            }
2193            obj = obj[args[i]];
2194        }
2195        return true;
2196    }
2197
2198    Number.prototype.format = function() {
2199        if (this == 0) return 0;
2200
2201        var reg = /(^[+-]?\d+)(\d{3})/;
2202        var n = (this + '');
2203
2204        while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2');
2205
2206        return n;
2207    };
2208
2209
2210    String.prototype.format = function() {
2211        var num = parseFloat(this);
2212        if (isNaN(num)) return "0";
2213
2214        return num.format();
2215    };
2216
2217    function selectionRect() {
2218        var s = window.getSelection();
2219        oRange = s.getRangeAt(0); //get the text range
2220        oRect = oRange.getBoundingClientRect();
2221        return oRect;
2222    }
2223
2224    function isHangulKey(event) {
2225        return (event.keyCode >= 12593 && event.keyCode <= 12622) || // 자모음 범위
2226        (event.keyCode >= 44032 && event.keyCode <= 55203) || // 완성형 범위
2227        (event.keyCode >= 12592 && event.keyCode <= 12687);
2228    }            
2229
2230    function placeCaretAtEnd(el) {
2231        el.focus();
2232        if (typeof window.getSelection != "undefined" &&
2233            typeof document.createRange != "undefined") {
2234            var range = document.createRange();
2235            range.selectNodeContents(el);
2236            range.collapse(false);
2237            var sel = window.getSelection();
2238            sel.removeAllRanges();
2239            sel.addRange(range);
2240        } else if (typeof document.body.createTextRange != "undefined") {
2241            var textRange = document.body.createTextRange();
2242            textRange.moveToElementText(el);
2243            textRange.collapse(false);
2244            textRange.select();
2245        }
2246    }
2247
2248    var insertVideo = function(sUrl, mode) {
2249        if (typeof sUrl == 'object') {
2250            var result = [];
2251            $.each(sUrl, function(i, v) {
2252                var r = insertVideo(v);
2253                if (typeof r != 'undefined') result.push(r);
2254            });
2255            return (sUrl.length == result.length) ? result : false;
2256        }
2257
2258        sUrl = sUrl.replace('www.', '');
2259        var img = 'https://storage.googleapis.com/i.addblock.net/video-icon.jpg';
2260        // video url patterns(youtube, instagram, vimeo, dailymotion)
2261        var ytRegExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
2262        var ytMatch = sUrl.match(ytRegExp);
2263
2264        var igRegExp = /\/\/instagram.com\/p\/(.[a-zA-Z0-9]*)/;
2265        var igMatch = sUrl.match(igRegExp);
2266
2267        var vRegExp = /\/\/vine.co\/v\/(.[a-zA-Z0-9]*)/;
2268        var vMatch = sUrl.match(vRegExp);
2269
2270        var vimRegExp = /\/\/(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/;
2271        var vimMatch = sUrl.match(vimRegExp);
2272
2273        var dmRegExp = /.+dailymotion.com\/(video|hub|embed)\/([^_]+)[^#]*(#video=([^_&]+))?/;
2274        var dmMatch = sUrl.match(dmRegExp);
2275
2276        var mcRegExp = /\/\/metacafe.com\/watch\/(.[a-zA-Z0-9]*)\/(.[a-zA-Z0-9\-]*)\//;
2277        var mcMatch = sUrl.match(mcRegExp);
2278
2279        var kakaoExp = /\/\/tv.kakao.com\/(channel|embed)\/([0-9]{6,11}|player)\/cliplink\/([0-9]{6,11})/;
2280        var kaMatch = sUrl.match(kakaoExp);
2281
2282        var kakaoExp2 = /\/\/tv.kakao.com\/(v|l)\/([0-9]{6,11})/;
2283        var kaMatch2 = sUrl.match(kakaoExp2);
2284
2285        var naverExp = /\/\/serviceapi.rmcnmv.naver.com\/(.*)/;
2286        var naMatch = sUrl.match(naverExp);
2287
2288        var sound = sUrl.search('soundcloud.com');
2289        var $video, src;
2290        if (ytMatch && ytMatch[2].length === 11) {
2291            var youtubeId = ytMatch[2];
2292            src = '//www.youtube.com/embed/' + youtubeId;
2293            src = src.replace('watch?v=', 'v/');
2294
2295            $video = $('<iframe>')
2296                .attr({ 'src': src + '?wmode=transparent', 'frameborder': '0' });
2297            img = '//img.youtube.com/vi/' + youtubeId + '/default.jpg';
2298            /*        
2299            } else if (igMatch && igMatch[0].length > 0) {
2300                $video = $('<iframe>')
2301                .attr('src', igMatch[0] + '/embed/')
2302                .attr('width', '612').attr('height', '710')
2303                .attr('scrolling', 'no')
2304                .attr('allowtransparency', 'true');
2305            } else if (vMatch && vMatch[0].length > 0) {
2306                $video = $('<iframe>')
2307                .attr('src', vMatch[0] + '/embed/simple')
2308                //.attr('width', '600').attr('height', '600')
2309                .attr('class', 'vine-embed');
2310                src = vMatch[0] + '/embed/simple';
2311            */
2312        } else if (vimMatch && vimMatch[3].length > 0) {
2313            $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')
2314                .attr('src', '//player.vimeo.com/video/' + vimMatch[3]);
2315            //.attr('width', '640').attr('height', '360');
2316            src = '//player.vimeo.com/video/' + vimMatch[3];
2317            $.getJSON('https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/' + vimMatch[3] + '&width=640', function(data) {
2318                if (typeof data.thumbnail_url != 'undefined' && data.thumbnail_url) {
2319                    img = data.thumbnail_url;
2320                }
2321            });
2322        } else if (dmMatch && dmMatch[2].length > 0) {
2323            dmMatch[2] = dmMatch[2].replace("video/", "");
2324            $video = $('<iframe>')
2325                .attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2]);
2326            //.attr('width', '640').attr('height', '360');
2327            src = '//www.dailymotion.com/embed/video/' + dmMatch[2];
2328            img = '//dailymotion.com/thumbnail/video/' + dmMatch[2];
2329        }
2330        /* else if (mcMatch && mcMatch[1].length > 0) {
2331                    $video = $('<iframe>')
2332                    .attr('src', 'http://www.metacafe.com/embed/' + mcMatch[1] + '/' + mcMatch[2]);
2333                    //.attr('width', '640').attr('height', '360');
2334                    src = 'http://www.metacafe.com/embed/' + mcMatch[1] + '/' + mcMatch[2];
2335                }*/
2336        else if (sound > -1) {
2337            $.getJSON('https://soundcloud.com/oembed?format=json&url=' + sUrl, function(data) {
2338                if (typeof data.html == 'undefined') {
2339                    alert('get Soundcloud API error');
2340                    return;
2341                }
2342                $video = $(data.html);
2343                src = $video.prop('src');
2344                img = data.thumbnail_url;
2345            }).fail(function(response) {
2346                console.log(response);
2347                alert('get Soundcloud API error');
2348                $video = false;
2349                src = false;
2350            });
2351        } else if (kaMatch && kaMatch[3].length > 0) {
2352            $video = $('<iframe>')
2353                .attr('src', '//tv.kakao.com/embed/player/cliplink/' + kaMatch[3] + '?service=kakao_tv');
2354            src = '//tv.kakao.com/embed/player/cliplink/' + kaMatch[3] + '?service=kakao_tv';
2355            // img = file_get_contents('//tv.kakao.com/v/' + kaMatch[3]);
2356        } else if (kaMatch2 && kaMatch2[2].length > 0) {
2357            var kakao_tv_iframe = {
2358                    'l': '//play-tv.kakao.com/embed/player/livelink?liveLinkId=',
2359                    'v': '//play-tv.kakao.com/embed/player/cliplink/'
2360                },
2361                kakao_tv_parameter = {
2362                    'l': '&service=player_share',
2363                    'v': '?service=player_share'
2364                }
2365            kakao_tv_src = kakao_tv_iframe[kaMatch2[1]] + kaMatch2[2] + kakao_tv_parameter[kaMatch2[1]];
2366
2367            $video = $('<iframe>')
2368                .attr('src', kakao_tv_src)
2369                .attr('scrolling', 'no')
2370                .attr('allow', 'autoplay');
2371            src = kakao_tv_src;
2372        }
2373        /* else if(naMatch && naMatch[1].length > 0) {
2374                   $video = $('<iframe>')
2375                   .attr('src', '//serviceapi.rmcnmv.naver.com/' + naMatch[1]);
2376                   src = '//serviceapi.rmcnmv.naver.com/' + naMatch[1];
2377               } */
2378        else {
2379            // this is not a known video link. Now what, Cat? Now what?
2380        }
2381
2382        if ($video) {
2383            $video.attr('frameborder', 0);
2384        }
2385
2386        switch (mode) {
2387            case "src":
2388                return src;
2389                break;
2390            case "img":
2391                return img;
2392                break;
2393            default:
2394                return $video;
2395                break;
2396        }
2397    }
2398
2399    function setForumWrap() {
2400        var width = $('body').width(),
2401            margin = 0,
2402            size = $('.fr-view').width(),
2403            sidebar = $('.dsgn-body').hasClass('sidebar');
2404
2405        width = (sidebar) ? width - $('header.sidebar').width() : width;
2406        $.each($('.f-align-full, .f-align-wide'), function(i, v) {
2407            if ($(this).hasClass('f-align-full')) {
2408                margin = (width - size) / 2;
2409            } else {
2410                container = (size == 720) ? (size + 240) : (size + 220);
2411                if (width <= container) container = width;
2412                width = container;
2413                margin = (container - size) / 2;
2414            }
2415            $(this).css('cssText', 'width: ' + width + 'px !important; margin-left:-' + margin + 'px; max-width:' + width + 'px !important;');
2416        });
2417    }
2418
2419    function doGetCaretPosition(oField) {
2420
2421        // Initialize
2422        var iCaretPos = 0;
2423
2424        // IE Support
2425        if (document.selection) {
2426
2427            // Set focus on the element
2428            oField.focus();
2429
2430            // To get cursor position, get empty selection range
2431            var oSel = document.selection.createRange();
2432
2433            // Move selection start to 0 position
2434            oSel.moveStart('character', -oField.value.length);
2435
2436            // The caret position is selection length
2437            iCaretPos = oSel.text.length;
2438        }
2439
2440        // Firefox support
2441        else if (oField.selectionStart || oField.selectionStart == '0')
2442            iCaretPos = oField.selectionStart;
2443
2444
2445        // Return results
2446        return iCaretPos;
2447    }
2448
2449    function resetForm($obj) {
2450        $.each($obj.find('.tpl-form-element'), function(i, v) {
2451            var type = $(this).prop('type');
2452            switch (type) {
2453                case 'text':
2454                case 'tel':
2455                case 'number':
2456                case 'textarea':
2457                    $(this).val('');
2458                    break;
2459
2460                case 'radio':
2461                case 'checkbox':
2462                    $(this).prop('checked', false);
2463                    break;
2464
2465                case 'select-one':
2466                case 'select-multi':
2467                    $(this).val('');
2468                    $(this)[0].selectIndex = -1;
2469                    break;
2470            }
2471        });
2472    }
2473
2474    function getRecommendInfo($el, $img, mode) {
2475        // alert('el: ' + $el + ', img:' + $img + ', mode:' + mode);
2476        if (typeof mode == 'undefined' || $el.hasClass('el-footer')) mode = true;
2477
2478        var width = '';
2479        if (mode == false) {
2480            width = ($('#element-display > div').is('[data-width]')) ? $('#element-display > div').attr('data-width') : $el.attr('data-width');
2481        } else {
2482            if (typeof $el.attr('data-width') != 'undefined' && $el.attr('data-type2') != 'logo') width = $el.attr('data-width');
2483            else if ($el.attr('data-type2') == 'logo' && $el.attr('data-case') == 'slideshow69') width = '160';
2484            else if ($el.attr('data-type2') == 'logo' && $el.attr('data-case') == 'slideshow68') width = '100';
2485            else width = 0;
2486        }
2487
2488        var src = $img.prop('src');
2489        var preVerRegExp = new RegExp('/'+SID+'/'),
2490            newVerRegExp = new RegExp('googleusercontent'),
2491            sample_check = (src.match(preVerRegExp) === null && src.match(newVerRegExp) === null) ? true : false,
2492            ori_src = src,
2493            src = (sample_check || width == 0) ? src : getServeImage(src, 0,RESOURCE + '/' + SID);
2494
2495        var gallery_check = (($el.attr('data-id') == 'all_products' || $el.attr('data-type2') == 'premium') && $el.attr('data-type') == 'gallery' && $el.find('.gjs').attr('data-js-code') == 1) ? true : false;
2496
2497        var img_resolution = '',
2498            img = new Image(),
2499            nWidth = 0,
2500            nHeight = 0,
2501            txt_img_click = (mode) ? $.lang[LANG]['editor.image.click.change'] + '<br>' : '',
2502            recomm_str = '',
2503            footerlogo = (selectEL == 'el-footer') ? $img[0].src.split(':')[1] : '',
2504            isfooterAttach = typeof $('img[src="' + footerlogo + '"]').is('[data-footer-attach]') == 'undefined' ? false : $('img[src="' + footerlogo + '"]').is('[data-footer-attach]');
2505
2506        img.src = (typeof src == 'undefined') ? '' : src;
2507
2508        // if (width == 0) {
2509            // if (selectEL == 'el-menu' || (selectEL == 'el-footer' && isfooterAttach)) { 푸터 로고 이미지 호버 시 내용 없는 툴팁 노출 되어 툴팁 미노출 되도록 처리
2510            if (selectEL == 'el-menu' || (selectEL == 'el-footer')) {
2511                var el_img = $('.' + selectEL).find('img[data-attach="true"]');
2512                if (typeof el_img.attr('src') != "undefined" && ori_src.match(el_img.attr('src')) !== null) {
2513                    // HTML[data-max-width] > CSS max-width > HTML ELEMENT width()
2514                    nWidth = (typeof el_img.css('max-width') != 'undefined' && el_img.css('max-width').match(/px/gi) !== null) ? el_img.css('max-width').replace('px', '') : el_img.width();
2515                    nHeight = (typeof el_img.css('max-height') != 'undefined' && el_img.css('max-height').match(/px/gi) !== null) ? el_img.css('max-height').replace('px', '') : el_img.height();
2516
2517                    img_resolution = (typeof el_img.closest('.navbar-brand').attr('data-recommend') != 'undefined') ? el_img.closest('.navbar-brand').attr('data-recommend') : nWidth + ' X ' + nHeight;
2518                    // return '<div class="text-left">' + txt_img_click + '<span class="txt-recomm">' + $.lang[LANG]['editor.image.recomm.menu'] + '<br>' + img_resolution + '</span></div>';
2519                    return "<div class=\'text-left\'>" + txt_img_click + "</div>";
2520                }
2521            } else {
2522                img.onload = function() {
2523                    nWidth = this.width;
2524                    nHeight = this.height;
2525                    img_resolution = ((nWidth) ? nWidth : $img.width()) + ' X ' + ((nHeight) ? nHeight : $img.height());
2526
2527                    recomm_str = "<div class=\'text-left\'>" + txt_img_click + "<span class=\'txt-recomm\'>" + $.lang[LANG]['editor.image.recomm.size'] + "<br>" + img_resolution + "</span></div>";
2528
2529                    if (mode) {
2530                        var this_src = ori_src.substr(ori_src.lastIndexOf('/') + 1);
2531                        if(gallery_check) $('.bc-resource').find('[style*="' + this_src + '"]').attr('data-original-title', recomm_str);
2532                        else $('.bc-resource').find('img[src$="' + this_src + '"]').attr('data-original-title', recomm_str);
2533                    } else {
2534                        if ($('.recomm-image-text').length > 0) $('.recomm-image-text').html(recomm_str).show();
2535                        else $('body').append(recomm_str);
2536                    }
2537                }
2538                return "<div class=\'text-left\'>" + txt_img_click + "<span class=\'txt-recomm\' data-loading=\'true\'>Loading...</span></div>";
2539            }
2540
2541
2542            // if(mode) return '<div class="text-left">' + $.lang[LANG]['editor.image.click.change'] + '<br><span class="txt-recomm">' + $.lang[LANG]['editor.image.recomm'] + '<br>' + img_resolution + '</span></div>';
2543            // else return '<div class="text-left"><span class="txt-recomm">' + $.lang[LANG]['editor.image.recomm'] + '<br>' + img_resolution + '</span></div>';
2544        /*
2545        } else {
2546            switch (width) {
2547                case '1920':
2548                    img_resolution = '1920 X FREE';
2549                    break;
2550                case '800':
2551                    img_resolution = '800 X FREE';
2552                    break;
2553                case '700':
2554                    img_resolution = '700 X 500';
2555                    break;
2556                case '670':
2557                    img_resolution = '670 X 980';
2558                    break;
2559                case '650':
2560                    img_resolution = '650 X 370';
2561                    break;
2562                case '600':
2563                    img_resolution = '600 X 600';
2564                    break;
2565                case '250':
2566                    img_resolution = '250 X 250';
2567                    break;
2568                case '160':
2569                    img_resolution = '160 X 100';
2570                    break;
2571                case '100':
2572                    img_resolution = '100 X 100';
2573                    break;
2574                case '60':
2575                    img_resolution = '60 X 60';
2576                    break;
2577            }
2578            // var gallery_check = (($el.attr('data-id') == 'all_products' || $el.attr('data-type2') == 'premium') && $el.attr('data-type') == 'gallery' && $el.find('.gjs').attr('data-js-code') == 1) ? true : false;
2579            // if(!gallery_check) {
2580            //   if(width > 1000) {
2581            //     nWidth = this.width;
2582            //     nHeight = this.height;
2583            //     img_resolution = ((nWidth) ? nWidth : $img[0].naturalWidth) + ' X ' + ((nHeight) ? nHeight : $img[0].naturalHeight);
2584            //   } else {
2585            //     //현재 블럭의 이미지 영역의 2배 사이즈
2586            //     var $el_img = $('.' + selectEL).find('[data-attach="true"]');
2587            //     var img_width = ($el_img[0].width) ? $el_img[0].width : $el_img[0].clientWidth,
2588            //         img_height = ($el_img[0].height) ? $el_img[0].height : $el_img[0].clientHeight;
2589            //     img_resolution = (img_width * 2) + ' X ' + (img_height * 2);
2590            //   }
2591            // }
2592
2593            return "<div class=\'text-left\'>" + txt_img_click + "<span class=\'txt-recomm\'>" + $.lang[LANG]['editor.image.recomm.size'] + "<br>" + img_resolution + "</span></div>";
2594        }
2595        */
2596
2597    }
2598
2599    var getRatio = function(w) {
2600        var r = '';
2601        switch (w) {
2602            case "1920":
2603                r = '&w=1920&fit=crop';
2604                break;
2605            case "800":
2606                r = '&w=800&fit=crop';
2607                break;
2608            case "700":
2609                r = '&w=700&h=500&crop=face&fit=crop';
2610                break;
2611            case "670":
2612                r = '&w=670&h=980&crop=face&fit=crop';
2613                break;
2614            case "650":
2615                r = '&w=600&h=370&crop=face&fit=crop';
2616                break;
2617            case "600":
2618                r = '&w=600&h=600&crop=face&fit=crop';
2619                break;
2620            case "250":
2621                r = '&w=250&h=250&crop=face&fit=crop';
2622                break;
2623            case "60":
2624                r = '&w=60&h=60&crop=face&fit=crop';
2625                break;
2626            case "0":
2627                r = '';
2628                break;
2629        }
2630        return r;
2631    }
2632
2633    var tplFormitem = function(type, idx, val) {
2634        var tpl = '';
2635        if (typeof val == 'undefined' || val == '') {
2636            if ($.inArray(type, ['radio.image', 'check.image']) > -1) {
2637                val = {"options":[
2638                        {"label":"A","image":"https://storage.googleapis.com/i.addblock.net/sample/form_selection_sample01.jpg"},
2639                        {"label":"B","image":"https://storage.googleapis.com/i.addblock.net/sample/form_selection_sample02.jpg"},
2640                        {"label":"C","image":"https://storage.googleapis.com/i.addblock.net/sample/form_selection_sample03.jpg"},
2641                        {"label":"D","image":"https://storage.googleapis.com/i.addblock.net/sample/form_selection_sample04.jpg"},
2642                    ],"imageConfig":{"mode":"fixed","column":4}};
2643            } else if ($.inArray(type, ['file.download', 'file.upload']) > -1) {
2644                val = '';
2645            } else {
2646                val = ['A', 'B'];
2647            }
2648        } else {
2649            if ($.inArray(type, ['radio.image', 'check.image']) > -1) {
2650                val = $.parseJSON(val);
2651            } else if ($.inArray(type, ['file.download', 'file.upload']) > -1) {
2652                val = val.split('||');
2653            } else {
2654                val = val.split('`');
2655            }
2656        }
2657        // console.log(type, idx, val);
2658        var blang = (typeof $('.' + selectEL).attr('data-blocklang') == 'undefined') ? $('#element-display[data-ref="' + selectEL + '"]').attr('data-blocklang') : $('.' + selectEL).attr('data-blocklang'),
2659            sdefault = '';
2660        if (typeof blang == 'undefined') {
2661            blang = getLanguage(true);
2662        }
2663
2664        if (blang == 'ko') {
2665            sdefault = '선택하세요';
2666            datePlaceholder = '날짜 선택';
2667            date2Placeholder = '날짜/시간 선택';
2668        } else if (blang == 'en') {
2669            sdefault = 'Select';
2670            datePlaceholder = 'Date';
2671            date2Placeholder = 'Date/Time';
2672        } else if (blang == 'ja') {
2673            sdefault = '選択してください';
2674            datePlaceholder = 'Date';
2675            date2Placeholder = 'Date/Time';
2676        } else {
2677            sdefault = 'Select';
2678            datePlaceholder = 'Date';
2679            date2Placeholder = 'Date/Time';
2680        }
2681        switch (type) {
2682            case 'text':
2683                tpl = '<input class="form-control" type="text">';
2684                break;
2685            case 'memo':
2686                tpl = '<textarea class="form-control"></textarea>';
2687                break;
2688            case 'select':
2689                var isFranchiseBar = ($('.' + selectEL).attr('data-type2') == 'franchise bar' || $('#element-display[data-ref="' + selectEL + '"]').attr('data-type2') == 'franchise bar');
2690                
2691                if (isFranchiseBar) {
2692                    tpl = '<div class="franchise-form-select">';
2693                    tpl = tpl + '<select class="form-control franchise-form-select-native hide">';
2694                    tpl = tpl + '<option value="">' + sdefault + '</option>';
2695                    $.each(val, function(i, v) {
2696                        tpl = tpl + '<option value="' + replaceQuote(v) + '">' + v + '</option>';
2697                    });
2698                    tpl = tpl + '</select>';
2699                    tpl = tpl + '<button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
2700                    tpl = tpl + '<span class="franchise-form-select-label">' + sdefault + '</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12"><path d="m6 8 4-4H2z"/></svg>';
2701                    tpl = tpl + '</button>';
2702                    tpl = tpl + '<ul class="dropdown-menu" role="menu">';
2703                    tpl = tpl + '<li><a href="javascript:;" data-value="">' + sdefault + '</a></li>';
2704                    $.each(val, function(i, v) {
2705                        tpl = tpl + '<li><a href="javascript:;" data-value="' + replaceQuote(v) + '">' + v + '</a></li>';
2706                    });
2707                    tpl = tpl + '</ul>';
2708                    tpl = tpl + '</div>';
2709                } else {
2710                    tpl = '<select class="form-control">';
2711                    tpl = tpl + '<option value="">' + sdefault + '</option>';
2712                    $.each(val, function(i, v) {
2713                        tpl = tpl + '<option value="' + replaceQuote(v) + '">' + v + '</option>';
2714                    });
2715                    tpl = tpl + '</select>';
2716                }
2717                break;
2718            case 'check':
2719                tpl = '<div>';
2720                $.each(val, function(i, v) {
2721                    tpl = tpl + '<label class="checkbox-inline"><input type="checkbox" class="forms-item-check" name="' + (type + idx) + '" value="' + replaceQuote(v) + '">' + v + '</label>';
2722                });
2723                tpl = tpl + '</div>';
2724                break;
2725            case 'radio':
2726                tpl = '<div>';
2727                $.each(val, function(i, v) {
2728                    tpl = tpl + '<label class="radio-inline"><input type="radio" class="forms-item-radio" name="' + (type + idx) + '" value="' + replaceQuote(v) + '">' + v + '</label>';
2729                });
2730                tpl = tpl + '</div>';
2731                break;
2732            case 'check.image':
2733            case 'radio.image':
2734                var optionArr = val.options;
2735                let inputType = (type == 'check.image')? 'checkbox' : 'radio';
2736                tpl = '<div>';
2737                $.each(optionArr, function(i, v) {
2738                    // let hasImage = !!v.image;
2739                    tpl = tpl + `<label class="${inputType}-inline">
2740                        <div class="forms-item-image"><img class="img-responsive" src="${v.image}"></div>
2741                        <div><input type="${inputType}" class="forms-item-check" name="${type + idx}" value="${replaceQuote(v.label)}"><span>${v.label}</span></div>
2742                    </label>`;
2743                });
2744                tpl = tpl + '</div>';
2745                break;
2746            case 'date':
2747                tpl = '<div>';
2748                tpl = tpl + '<input class="form-control form-date date-ymd" type="text" readonly placeholder="' + datePlaceholder + '"/><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
2748<path d="M18.92 7.48s-.02-.08-.04-.12c-.2-.58-.66-1.04-1.24-1.24-.04-.01-.08-.03-.12-.04-.17-.05-.35-.08-.52-.08h-1V5c0-.55-.45-1-1-1s-1 .45-1 1v1h-4V5c0-.55-.45-1-1-1s-1 .45-1 1v1H7c-.18 0-.35.03-.52.08-.04.01-.08.02-.12.04-.58.2-1.04.66-1.24 1.24A1.876 1.876 0 0 0 5 8v10c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V8c0-.18-.03-.35-.08-.52M17.75 18c0 .41-.34.75-.75.75H7c-.41 0-.75-.34-.75-.75v-8h11.5zM11 15h2v2h-2zm3 0h2v2h-2zm-3-3h2v2h-2zm3 0h2v2h-2zm-6 3h2v2H8zm0-3h2v2H8z"/></svg>';
2749                tpl = tpl + '</div>';
2750                break;
2751            case 'date2':
2752                tpl = '<div>';
2753                tpl = tpl + '<input class="form-control date-ymd form-date" type="text" readonly placeholder="' + date2Placeholder + '"/><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M18.92 7.48s-.02-.08-.04-.12c-.2-.58-.66-1.04-1.24-1.24-.04-.01-.08-.03-.12-.04-.17-.05-.35-.08-.52-.08h-1V5c0-.55-.45-1-1-1s-1 .45-1 1v1h-4V5c0-.55-.45-1-1-1s-1 .45-1 1v1H7c-.18 0-.35.03-.52.08-.04.01-.08.02-.12.04-.58.2-1.04.66-1.24 1.24A1.876 1.876 0 0 0 5 8v10c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V8c0-.18-.03-.35-.08-.52M17.75 18c0 .41-.34.75-.75.75H7c-.41 0-.75-.34-.75-.75v-8h11.5zM11 15h2v2h-2zm3 0h2v2h-2zm-3-3h2v2h-2zm3 0h2v2h-2zm-6 3h2v2H8zm0-3h2v2H8z"/></svg>';
2754                tpl = tpl + '</div>';
2755                break;
2756            case 'file.upload':
2757                tpl = '<div>';
2758                tpl = tpl + '<input type="text" class="hide" value="" /><label class=""><input type="file" class="hide" />' + clSVG('paperclip', '16', '16', false, '') + $.lang[blang]['config.form.btn.attachment'] + ' <span class="file-uploaded-number">(0/10)</span></label><p class="file-title text">' + $.lang[blang]['config.form.file.attachment.none'] + '</p></div>';
2759                break;
2760            case 'file.download':
2761                tpl = '<div>';
2762                tpl = tpl + '<p class="file-title text">' + clSVG('paperclip', '16', '16', false, '') + (val[0] ? val[0] : $.lang[blang]['config.form.file.attachment.none']) + '</p>';
2763                tpl = tpl + '</div>';
2764                break;
2765        }
2766        // console.log('tpl return', tpl);
2767        return tpl;
2768    }
2769
2770    $(function() {
2771        $('.franchise-form-select.dropdown').removeClass('dropdown');
2772        $('.franchise-form-select .dropdown-toggle').removeClass('btn btn-default');
2773    });
2774
2775    function setContactFranchiseDropdownDirection($select) {
2776        var $block = $select.closest('[data-type="contact"][data-type2="franchise bar"]'),
2777            $toggle = $select.find('.dropdown-toggle').first(),
2778            $menu = $select.find('.dropdown-menu').first();
2779
2780        if ($block.length == 0 || $toggle.length == 0 || $menu.length == 0 || typeof $toggle[0].getBoundingClientRect == 'undefined') {
2781            $select.removeClass('dropup');
2782            return;
2783        }
2784
2785        var rect = $toggle[0].getBoundingClientRect(),
2786            viewportHeight = window.innerHeight || document.documentElement.clientHeight || $(window).height(),
2787            bottomSpace = viewportHeight - rect.bottom,
2788            topSpace = rect.top,
2789            menuHeight = $menu.outerHeight(),
2790            menuStyle = $menu.attr('style'),
2791            gap = 12;
2792
2793        if (menuHeight == 0) {
2794            $menu.css({'display': 'block', 'visibility': 'hidden'});
2795            menuHeight = $menu.outerHeight();
2796            if (typeof menuStyle == 'undefined') $menu.removeAttr('style');
2797            else $menu.attr('style', menuStyle);
2798        }
2799
2800        if (bottomSpace < menuHeight + gap && topSpace > bottomSpace) $select.addClass('dropup');
2801        else $select.removeClass('dropup');
2802    }
2803
2804    $(document).on('show.bs.dropdown', '[data-type="contact"][data-type2="franchise bar"] .franchise-form-select', function() {
2805        var $select = $(this),
2806            $block = $select.closest('[data-type="contact"][data-type2="franchise bar"]');
2807
2808        $block.add($block.closest('.elem-hidden')).addClass('franchise-form-select-open');
2809        setContactFranchiseDropdownDirection($select);
2810    });
2811
2812    $(document).on('hidden.bs.dropdown', '[data-type="contact"][data-type2="franchise bar"] .franchise-form-select', function() {
2813        var $select = $(this),
2814            $block = $select.closest('[data-type="contact"][data-type2="franchise bar"]');
2815
2816        $select.removeClass('dropup');
2817        $block.add($block.closest('.elem-hidden')).removeClass('franchise-form-select-open');
2818    });
2819
2820    $('.franchise-form-select .dropdown-menu a').live('click', function(e) {
2821        e.preventDefault();
2822
2823        var $option = $(this),
2824            value = $option.attr('data-value'),
2825            text = $option.text(),
2826            $select = $option.closest('.franchise-form-select');
2827
2828        $select.find('select.franchise-form-select-native').val(value).change();
2829        $select.find('.franchise-form-select-label').text(text).toggleClass('selected', value != '');
2830        $select.find('.dropdown-menu li').removeClass('active');
2831        $option.closest('li').addClass('active');
2832    });
2833
2834    function replaceQuote(str) {
2835        // str = str.replace(/\\/g, '\\\\');
2836        // str = str.replace(/\'/g, '\\\'');
2837        str = str.replace(/\"/g, '&quot;');
2838        // str = str.replace(/\0/g, '\\0');
2839        return str;
2840    }
2841
2842    function buildLargePostData(fieldName, value, data) {
2843        var chunkSize = 4000,
2844            encodedValue = JSON.stringify((typeof value == 'undefined' || value === null) ? '' : String(value)),
2845            chunkFieldName = fieldName + '_chunks',
2846            start = 0,
2847            end,
2848            code;
2849
2850        if (typeof data == 'undefined' || data === null) data = {};
2851
2852        if (encodedValue.length <= chunkSize) {
2853            data[fieldName] = encodedValue;
2854            return data;
2855        }
2856
2857        data[fieldName] = '';
2858        data[chunkFieldName] = [];
2859
2860        while (start < encodedValue.length) {
2861            end = start + chunkSize;
2862            if (end < encodedValue.length) {
2863                code = encodedValue.charCodeAt(end - 1);
2864                if (code >= 0xD800 && code <= 0xDBFF) end--;
2865            }
2866            if (end <= start) end = start + chunkSize;
2867
2868            data[chunkFieldName].push(encodedValue.substring(start, end));
2869            start = end;
2870        }
2871
2872        return data;
2873    }
2874
2875    var captchaContainer = null;
2876    var loadCaptcha = function() {
2877        $('#recaptcha').attr('data-res', '');
2878        captchaContainer = grecaptcha.render('recaptcha', {
2879            'sitekey': '6LfZjyIUAAAAAIMcTzt0XriAdVXHExtrVsNUaiHz',
2880            'callback': loadCaptchaCallback
2881        });
2882    }
2883    var loadCaptchaCallback = function(res) { $('#recaptcha').attr('data-res', res); }
2884    var recaptchCallback = function() {}
2885    var checkCaptcha = function() {
2886        var s = $('#recaptcha').attr('data-res');
2887        var res = $.post('/fm/recaptcha', { r: s }, function(data) {
2888            return data;
2889        }, 'json');
2890        return res;
2891    }
2892
2893    var load_kcaptcha = function() {
2894        $('#kcaptcha').attr('src', 'https://storage.googleapis.com/i.addblock.net/js/load_kcaptcha.gif');
2895        $('#kcaptcha').attr('title', $.lang[LANG]['page.reset-password.captcha-tip']);
2896
2897        $.ajax({
2898            type: 'POST',
2899            url: rt_path + '/check/kcaptcha/session?_' + new Date().getTime(),
2900            xhrFields: { withCredentials: true },
2901            success: function(data) {
2902                md5_norobot_key = data;
2903                var t = (new Date).getTime();
2904                setTimeout(function() {
2905                    var t = new Date().getTime();
2906                    $('#kcaptcha').attr('src', rt_path + '/check/kcaptcha/image?_=' + t);
2907                }, 100);
2908            }
2909        });
2910    }
2911
2912    var load_form_kcaptcha = function($formEL, pid) {
2913        $formEL.find('.kcaptcha-box img').attr('src', '//storage.googleapis.com/i.addblock.net/js/load_kcaptcha.gif');
2914        $.ajax({
2915            type: 'POST',
2916            url: rt_path + '/check/kcaptcha/session/' + pid + '?_' + new Date().getTime(),
2917            xhrFields: { withCredentials: true },
2918            success: function(data) {
2919                md5_norobot_pid = data;
2920                setTimeout(function() {
2921                    var t = new Date().getTime();
2922                    $formEL.find('.kcaptcha-box img').attr('src', rt_path + '/check/kcaptcha/image/' + pid + '?_=' + t);
2923                }, 100);                
2924            }
2925        });
2926    }
2927
2928    var getContactCaptchaHTML = function(blocklang) {
2929        if(!blocklang || typeof $.lang[blocklang] == 'undefined') blocklang = LANG;
2930
2931        return '\
2932            <div class="form-group form-captcha">\
2933                <div class="kcaptcha-wrap display-flex">\
2934                    <div class="kcaptcha-box">\
2935                        <img src="//storage.googleapis.com/i.addblock.net/forum/captcha_sample_Img.jpg" id="kcaptcha" alt="" title="' + $.lang[blocklang]['form.item.captcha-tip'] + '">\
2936                    </div>\
2937                    <div class="text-left kcaptcha-key-wrap">\
2938                        <input type="text" id="wr_key" name="wr_key" class="col-xs-12 col-sm-12 col-md-12 ed input-bg-opacity input-captcha" placeholder="' + $.lang[blocklang]['form.item.captcha.placeholder'] + '">\
2939                        <a href="#" class="kcaptcha-change hand small fsize12">' + $.lang[blocklang]['form.item.captcha-change'] + '</a>\
2940                    </div>\
2941                </div>\
2942            </div>\
2943        ';
2944    }
2945
2946    var setContactSubmitSecurity = function($contactEL, pid, settings, blocklang) {
2947        if(!$contactEL || $contactEL.length == 0 || $contactEL.attr('data-type') != 'contact') return;
2948        if(!settings) settings = {};
2949
2950        var submit_ip_block_use = (typeof settings.submit_ip_block_use != 'undefined' && settings.submit_ip_block_use == 'ON') ? 'ON' : 'OFF',
2951            captcha_use = (typeof settings.captcha_use != 'undefined' && settings.captcha_use == 'ON') ? 'ON' : 'OFF',
2952            check_config_mode = $('body').hasClass('mode-config') || $('.dsgn-body').hasClass('mode-config');
2953
2954        $contactEL.attr('data-submit-ip-block', submit_ip_block_use);
2955        $contactEL.attr('data-captcha', (captcha_use == 'ON' && !check_config_mode) ? 'true' : 'false');
2956        $contactEL.find('.form-captcha').remove();
2957    }
2958
2959    $('.element[data-type="form"] .form-group .view-privacy').live('click', function(){
2960        $(this).toggleClass('active');
2961        if($(this).hasClass('active')) {
2962            $(this).closest('.form-privacy').find('textarea').show();
2963        } else {
2964            $(this).closest('.form-privacy').find('textarea').hide();
2965        }
2966    });
2967
2968    $('.element[data-type="contact"][data-type2="franchise bar"] .form-group .view-privacy').live('click', function(){
2969        let $el = $(this).closest('.element');
2970        let blocklang = (typeof $el.attr('data-blocklang') != 'undefined')? $el.attr('data-blocklang') : LANG;
2971        let slang = (typeof SLANG != 'undefined' && typeof SLANG.select_code != 'undefined' && SLANG.select_code != 'ko')? 'en' : 'ko';
2972        let privacyTxt = $(this).closest('.form-privacy').find('textarea').val();
2973
2974        // if(PAGE_MODE == 'c') slang = LANG;
2975        if(!privacyTxt) privacyTxt = $.lang[blocklang]['contact.privacy.text.default'];
2976
2977        let modal_content = '<div class="textarea-container">' + privacyTxt + '</div>';
2978        $(this).showModalFlat($.lang[blocklang]['contact.consult.privacy.view.title'], modal_content, true, false, '', $.lang[slang]['config.close'], '', 'cl-cmmodal cl-s-btn cover cl-p70 cl-t80 cl-modal w560 cl-okbtn-pbt70 cl-close-btn contact-privacy-view');
2979    });
2980
2981    var loadMapDropdown = function ($el, selected, index) {
2982        if(typeof selected == 'undefined') selected = '';
2983        if(typeof index == 'undefined') index = 0;
2984        var blocklang = (typeof $el.attr('data-blocklang') != 'undefined')? $el.attr('data-blocklang') : LANG;
2985        var area0 = {
2986            [$.lang[blocklang]['contact.map.search.sido']] : '',
2987            [$.lang[blocklang]['contact.map.search.sido.1']]: '서울',
2988            [$.lang[blocklang]['contact.map.search.sido.2']]: '인천',
2989            [$.lang[blocklang]['contact.map.search.sido.3']]: '대전',
2990            [$.lang[blocklang]['contact.map.search.sido.4']]: '세종',
2991            [$.lang[blocklang]['contact.map.search.sido.5']]: '광주',
2992            [$.lang[blocklang]['contact.map.search.sido.6']]: '대구',
2993            [$.lang[blocklang]['contact.map.search.sido.7']]: '울산',
2994            [$.lang[blocklang]['contact.map.search.sido.8']]: '부산',
2995            [$.lang[blocklang]['contact.map.search.sido.9']]: '경기',
2996            [$.lang[blocklang]['contact.map.search.sido.10']]: '강원',
2997            [$.lang[blocklang]['contact.map.search.sido.11']]: '충북',
2998            [$.lang[blocklang]['contact.map.search.sido.12']]: '충남',
2999            [$.lang[blocklang]['contact.map.search.sido.13']]: '전북',
3000            [$.lang[blocklang]['contact.map.search.sido.14']]: '전남',
3001            [$.lang[blocklang]['contact.map.search.sido.15']]: '경북',
3002            [$.lang[blocklang]['contact.map.search.sido.16']]: '경남',
3003            [$.lang[blocklang]['contact.map.search.sido.17']]: '제주',
3004        };
3005        var areaObj = {
3006            area1: ["강남구","강동구","강북구","강서구","관악구","광진구","구로구","금천구","노원구","도봉구","동대문구","동작구","마포구","서대문구","서초구","성동구","성북구","송파구","양천구","영등포구","용산구","은평구","종로구","중구","중랑구"],
3007            area2: ["계양구","남구","남동구","동구","부평구","서구","연수구","중구","강화군","옹진군"],
3008            area3: ["대덕구","동구","서구","유성구","중구"],
3009            area4: ["세종시"],
3010            area5: ["광산구","남구","동구","북구","서구"],
3011            area6: ["남구","달서구","동구","북구","서구","수성구","중구","달성군"],
3012            area7: ["남구","동구","북구","중구","울주군"],
3013            area8: ["강서구","금정구","남구","동구","동래구","부산진구","북구","사상구","사하구","서구","수영구","연제구","영도구","중구","해운대구","기장군"],
3014            area9: ["고양시","과천시","광명시","광주시","구리시","군포시","김포시","남양주시","동두천시","부천시","성남시","수원시","시흥시","안산시","안성시","안양시","양주시","오산시","용인시","의왕시","의정부시","이천시","파주시","평택시","포천시","하남시","화성시","가평군","양평군","여주군","연천군"],
3015            area10: ["강릉시","동해시","삼척시","속초시","원주시","춘천시","태백시","고성군","양구군","양양군","영월군","인제군","정선군","철원군","평창군","홍천군","화천군","횡성군"],
3016            area11: ["제천시","청주시","충주시","괴산군","단양군","보은군","영동군","옥천군","음성군","증평군","진천군","청원군"],
3017            area12: ["계룡시","공주시","논산시","보령시","서산시","아산시","천안시","금산군","당진군","부여군","서천군","연기군","예산군","청양군","태안군","홍성군"],
3018            area13: ["군산시","김제시","남원시","익산시","전주시","정읍시","고창군","무주군","부안군","순창군","완주군","임실군","장수군","진안군"],
3019            area14: ["광양시","나주시","목포시","순천시","여수시","강진군","고흥군","곡성군","구례군","담양군","무안군","보성군","신안군","영광군","영암군","완도군","장성군","장흥군","진도군","함평군","해남군","화순군"],
3020            area15: ["경산시","경주시","구미시","김천시","문경시","상주시","안동시","영주시","영천시","포항시","고령군","군위군","봉화군","성주군","영덕군","영양군","예천군","울릉군","울진군","의성군","청도군","청송군","칠곡군"],
3021            area16: ["거제시","김해시","마산시","밀양시","사천시","양산시","진주시","진해시","창원시","통영시","거창군","고성군","남해군","산청군","의령군","창녕군","하동군","함안군","함양군","합천군"],
3022            area17: ["서귀포시","제주시","남제주군","북제주군"],
3023        };
3024
3025        var areaObj_en = {
3026            area1: ["Gangnam District", "Gangdong District", "Gangbuk District", "Gangseo District", "Gwanak District", "Gwangjin District", "Guro District", "Geumcheon District", "Nowon District", "Dobong District", "Dongdaemun District", "Dongjak District", "Mapo District", "Seodaemun District", "Seocho District", "Seongdong District", "Seongbuk District", "Songpa District", "Yangcheon District", "Yeongdeungpo District", "Yongsan District", "Eunpyeong District", "Jongno District", "Jung District", "Jungnang District"],
3027            area2: ["Gyeyang District", "Nam District", "Namdong District", "Dong District", "Bupyeong District", "Seo District", "Yeonsu District", "Jung District", "Ganghwa County", "Ongjin County"],
3028            area3: ["Daedeok District", "Dong District", "Seo District", "Yuseong District", "Jung District"],
3029            area4: ["Gwangsan District", "Nam District", "Dong District", "Buk District", "Seo District"],
3030            area5: ["Nam District", "Dalseo District", "Dong District", "Buk District", "Seo District", "Suseong District", "Jung District", "Dalseong County"],
3031            area6: ["Nam District", "Dong District", "Buk District", "Jung District", "Ulju County"],
3032            area7: ["Gangseo District", "Geumjeong District", "Nam District", "Dong District", "Dongnae District", "Busanjin District", "Buk District", "Sasang District", "Saha District", "Seo District", "Suyeong District", "Yeonje District", "Yeongdo District", "Jung District", "Haeundae District", "Gijang County"],
3033            area8: ["Goyang City", "Gwacheon City", "Gawngmyeong City", "Gwangju City", "Guri City", "Gunpo City", "Gimpo City", "Namyangju City", "Dongducheon City", "Bucheon City", "Seongnam City", "Suwon City", "Siheung City", "Ansan City", "Anseong City", "Anyang City", "Yangju City", "Osan City", "Yongin City", "Uiwang City", "Uijeongbu City", "Icheon City", "Paju City", "Pyeongtaek City", "Pocheon City", "Hanam City", "Hwaseong City", "Gapyeong City", "Yangpyeong County", "Yeoju County", "Yeoncheon County"],
3034            area9: ["Gangneung City", "Donghae City", "Samcheok City", "Sokcho City", "Wonju City", "Chuncheon City", "Taebaek City", "Goseong County", "Yanggu County", "Yangyang County", "Yeongwol County", "Inje County", "Jeongseon County", "Cheorwon County", "Pyeongchang County", "Hongcheon County", "Hwacheon County", "Hoengseong County"],
3035            area10: ["Jecheon City", "Cheongju City", "Chungju City", " Goesan County", "Danyang County", "Boeun County", "Yeongdong County", "Okcheon County", "Eumseong County", "Jeungpyeong County", "Jincheon County", "Cheongwon County"],
3036            area11: ["Gyeryong City", "Gongju City", "Nonsan City", "Boryeong City", "Seosan City", "Asan City", "Cheonan City", "Geumsan County", "Dangjin County", "Buyeo County", "Seocheon County", "Yeongi County", "Yesan County", "Cheongyang County", "Taean County", "Hongseong County"],
3037            area12: ["Gunsan City", "Gimje City", "Namwon City", "Iksan City", "Jeonju City", "Jeongeup City", "Gochang County", "Muju County", "Buan County", "Sunchang County", "Wanju County", "Imsil County", "Jangsu County", "Jinan County"],
3038            area13: ["Gwangyang City", "Naju City", "Mokpo City", "Suncheon City", "Yeosu City", "Gangjin County", "Goheung County", "Gokseong County", "Gurye County", "Damyang County", "Muan County", "Boseong County", "Sinan County", "Yeonggwang County", "Yeongam County", "Wando County", "Jangseong County", "Jangheung County", "Jindo County", "Hampyeong County", "Haenam County", "Hwasun County"],
3039            area14: ["Gyeongsan City", "Gyeongju City", "Gumi City", "Gimcheon City", "Mungyeong City", "Sangju City", "Andong City", "Yeongju City", "Yeongcheon City", "Pohang City", "Goryeong County", "Gunwi County", "Bonghwa County", "Seongju County", "Yeongdeok County", "Yeongyang County", "Yecheon County", "Ulleung County", "Uljin County", "Uiseong County", "Cheongdo County", "Cheongsong County", "Chilgok County"],
3040            area15: ["Geoje City", "Gimhae City", "Masan City", "Miryang City", "Sacheon City", "Yangsan City", "Jinju City", "Jinhae-gu", "Changwon City", "Tongyeong City", "Geochang County", "Goseong County", "Namhae County", "Sancheong County", "Uiryeong County", "Changnyeong County", "Hadong County", "Haman County", "Hamyang County", "Hapcheon County"],
3041            area16: ["Seogwipo City", "Jeju City", "Namjeju County", "Bukjeju County"],
3042            area17: ["Sejong City"],
3043        };
3044
3045        var sido = '';
3046        var gungu = '<li class="empty"><a href="javascript:;">' + $.lang[blocklang]['contact.map.search.gungu'] + '</a></li>';
3047
3048        var idx = 0
3049        $.each(area0, function(k, v){
3050            var active = (selected == k)? 'active' : '';  
3051            sido += '<li class="' + active + '"><a href="javascript:;" data-idx="' + idx + '" data-val="' + v + '">' + k + '</a></li>';
3052            idx ++;
3053        });
3054
3055        $el.find('.select-si-do .dropdown-menu').html(sido);
3056
3057        var area = 'area' + index;
3058        if(index > 0) {
3059            var num = 0;
3060            $.each(areaObj[area], function(k, v) {
3061                let gunguTxt = (blocklang == 'en')? areaObj_en[area][k] : v;
3062                gungu += '<li><a href="javascript:;" data-idx="' + num + '" data-val="' + v + '">' + gunguTxt + '</a></li>';
3063                num ++;
3064            });
3065        }
3066
3067        $el.find('.select-gun-gu .dropdown-menu').html(gungu);
3068    }
3069
3070    var searchByStoreAddr = function ($el, val, mode) {
3071        if(typeof mode == 'undefined') mode = '';
3072        let total = 0;
3073        let regionMap = {
3074            '충남': ['충남', '충청남도'],
3075            '충북': ['충북', '충청북도'],
3076            '전남': ['전남', '전라남도'],
3077            '전북': ['전북', '전라북도'],
3078            '경남': ['경남', '경상남도'],
3079            '경북': ['경북', '경상북도'],
3080        };
3081        let regionKeywords = regionMap[val] || [val];
3082        $el.find('.map-item-list .map-item-empty').remove();
3083
3084        $el.find('.item').each(function(idx, v){
3085            if(mode == 'gungu' && $(v).hasClass('not-result')) {
3086                return true;
3087            }
3088            var addr = $(v).attr('data-addr');
3089            let matched = regionKeywords.some(function (keyword) {
3090                return addr.indexOf(keyword) !== -1;
3091            });
3092
3093            if (!matched) {
3094                $(this).addClass('hide not-result');
3095            } else {
3096                $(this).removeClass('hide not-result');
3097                total++;
3098            }
3099        });
3100
3101        if(val) searchResultEmpty($el, total);
3102        if ($('body').width() <= 991) fmapMobilePaging($el);
3103    }
3104
3105    var searchByStorename = function ($el) {
3106        var val = $el.find('.searchby-storename input').val().trim().toLowerCase();
3107        let total = 0;
3108
3109        $el.find('.map-item-list .map-item-empty').remove();
3110        $el.find('.item').removeClass('hide not-result');
3111        
3112        if($el.find('.select-si-do .selected').length) {
3113            let selectedIdx1 = $el.find('.select-si-do .selected').attr('data-selected-idx');
3114            searchByStoreAddr($el, $el.find('.select-si-do li a[data-idx="' + selectedIdx1 + '"]').attr('data-val'));
3115
3116            if($el.find('.select-gun-gu .selected').length) {
3117                let selectedIdx2 = $el.find('.select-gun-gu .selected').attr('data-selected-idx');
3118                searchByStoreAddr($el, $el.find('.select-gun-gu li a[data-idx="' + selectedIdx2 + '"]').attr('data-val'), 'gungu');
3119            }
3120        }
3121        
3122        if(typeof val != 'undefined' && val) {
3123            $el.find('.item').each(function(idx, v){
3124                if($(v).hasClass('not-result')) {
3125                    return true;
3126                }
3127                var itemName = $(v).find('.item-name').text().toLowerCase();
3128                if(typeof itemName != 'undefined' && itemName.indexOf(val) === -1) {
3129                    $(v).addClass('hide not-result');
3130                } else {
3131                    $(v).removeClass('hide not-result');
3132                    total ++;
3133                }
3134            });
3135
3136            searchResultEmpty($el, total);
3137        }
3138        
3139        $el.find('.searchby-storename input').blur();
3140        if ($('body').width() <= 991) fmapMobilePaging($el);
3141    }
3142
3143    var searchResultEmpty = function ($el, total) {
3144        let blocklang = ($el.attr('data-blocklang'))? $el.attr('data-blocklang') : LANG;
3145        let emptyHTML = '<div class="map-item-empty">' + $.lang[blocklang]['contact.map.search.results.empty'] + '</div>';
3146        let searchCnt = $el.find('.map-item-list .item:not(.hide)').length;
3147
3148        if(total == 0) {
3149            $el.find('.map-item-list .map-item-empty').remove();
3150            $el.find('.map-item-list').append(emptyHTML);
3151        }
3152    }
3153
3154    $('[data-type="contact"][data-type2="franchise map"] .select-si-do .dropdown-toggle').live('click', function(e){
3155        e.preventDefault();
3156
3157        var $el = $(this).closest('.element');
3158        var $btn = $(this).find('span');
3159        var val = $(this).find('span').text();
3160        var idx = ($btn.attr('data-selected-idx'))? $btn.attr('data-selected-idx') : 0;
3161        loadMapDropdown($el, val, idx);
3162    });
3163
3164    $('[data-type="contact"][data-type2="franchise map"] .select-si-do li a').live('click', function(e){
3165        var $el = $(this).closest('.element');
3166        var $btn = $(this).closest('.dropdown').find('button.dropdown-toggle > span');
3167        var idx = $(this).attr('data-idx');
3168        var val = $(this).attr('data-val');
3169        var valTxt = $(this).text();
3170        var blocklang = (typeof $el.attr('data-blocklang') != 'undefined')? $el.attr('data-blocklang') : LANG;
3171
3172        $(this).closest('.map-search').find('.select-gun-gu .dropdown-toggle > span').removeClass('selected');
3173        $(this).closest('.map-search').find('.select-gun-gu .dropdown-toggle > span').text($.lang[blocklang]['contact.map.search.gungu']);
3174
3175        $el.find('.searchby-storename input').val('');
3176        $btn.text(valTxt);
3177
3178        $el.find('.item').removeClass('hide not-result');
3179        $btn.removeClass('selected');
3180
3181        if(typeof val != 'undefined' && val) {
3182            $btn.addClass('selected');
3183            $btn.attr('data-selected-idx', idx);
3184            searchByStoreAddr($el, val);
3185        } else {
3186            $el.find('.map-item-list .map-item-empty').remove();
3187            $el.find('.item').removeClass('hide not-result');
3188            if ($('body').width() <= 991) fmapMobilePaging($el);
3189        }
3190
3191        loadMapDropdown($el, val, $(this).attr('data-idx'));
3192    });
3193
3194    $('[data-type="contact"][data-type2="franchise map"] .select-gun-gu .dropdown-toggle').live('click', function(e){
3195        e.preventDefault();
3196
3197        var $el = $(this).closest('.element');
3198        var blocklang = (typeof $el.attr('data-blocklang') != 'undefined')? $el.attr('data-blocklang') : LANG;
3199        
3200        if($el.find('.select-si-do .selected').length == 0) {
3201            $el.find('.select-gun-gu .dropdown-menu').html('<li class="empty"><a href="javascript:;">' + $.lang[blocklang]['contact.map.search.gungu'] + '</a></li>');
3202        }
3203    });
3204
3205    $('[data-type="contact"][data-type2="franchise map"] .select-gun-gu li a').live('click', function(e){
3206        var $el = $(this).closest('.element');
3207        var $li = $(this).closest('li');
3208        var $btn = $(this).closest('.dropdown').find('button.dropdown-toggle > span');
3209        var idx = $(this).attr('data-idx');
3210        var val = $(this).attr('data-val');
3211        var valTxt = $(this).text();
3212
3213        $el.find('.searchby-storename input').val('');
3214        $btn.text(valTxt);
3215        $btn.removeClass('selected');
3216        // console.log('gungu', val, $el.find('.select-si-do .selected'));
3217        // if(typeof val != 'undefined' && val) {
3218        //     $btn.addClass('selected');
3219        //     $btn.attr('data-selected-idx', idx);
3220        //     searchByStoreAddr($el, val);
3221        // } else {
3222        //     if($el.find('.select-si-do .selected')) {
3223        //         let selectedIdx = $('.select-si-do .selected').attr('data-selected-idx');
3224        //         searchByStoreAddr($el, $el.find('.select-si-do li a[data-idx="' + selectedIdx + '"]').attr('data-val'));
3225        //     } else {
3226        //         $el.find('.item').removeClass('hide not-result');                
3227        //     }
3228        // }
3229        if($el.find('.select-si-do .selected').length) {
3230            let selectedIdx = $('.select-si-do .selected').attr('data-selected-idx');
3231            searchByStoreAddr($el, $el.find('.select-si-do li a[data-idx="' + selectedIdx + '"]').attr('data-val'));
3232
3233            if(typeof val != 'undefined' && val) {
3234                $btn.addClass('selected');
3235                $btn.attr('data-selected-idx', idx);
3236                if(selectedIdx != '4') searchByStoreAddr($el, val, 'gungu');
3237            }
3238        } else {
3239            $el
3239.find('.map-item-list .map-item-empty').remove();
3240            $el.find('.item').removeClass('hide not-result');
3241            if ($('body').width() <= 991) fmapMobilePaging($el);
3242        }
3243    });
3244
3245    $('[data-type="contact"][data-type2="franchise map"] .searchby-storename input[type="text"]').live('keyup', function(e){
3246        if(e.keyCode == 13) {
3247            var $el = $(this).closest('.element');
3248            searchByStorename($el);
3249        }
3250    });
3251    $('[data-type="contact"][data-type2="franchise map"] .searchby-storename .map-search-btn').live('click', function(e){
3252        var $el = $(this).closest('.element');
3253        searchByStorename($el);
3254    });
3255
3256    $('[data-type="contact"][data-type2="franchise map"] .map-item-list > .item:not(.selected)').live('click', function(){
3257        var $el = $(this).closest('.element');
3258        var mapKind = $(this).attr('data-map_kind');
3259        $el.find('.map-item-list > .item').removeClass('selected');
3260        $(this).addClass('selected');
3261
3262        drawMap($(this), $el);
3263
3264        if($el.find('.map-info').length > 0) {
3265            var idx = (typeof $(this).attr('data-idx') == 'undefined')? 0 : $(this).attr('data-idx');
3266            // console.log('idx', idx);
3267            $el.find('.map-info').addClass('hide');
3268            $el.find('.map-info[data-idx="'+idx+'"]').removeClass('hide');
3269        }
3270    });
3271
3272    var drawMap = function($item, $el){
3273        var iVALIDPLAN = (PAGE_MODE == 'c') ? VALIDPLAN : property.VALIDPLAN;
3274        var id = $el.attr('data-id');
3275        var mapKind = $item.attr('data-map_kind');
3276        var zoomInOut = $item.attr('data-zoominout');
3277        var mapTitle = $item.attr('data-maptitle');
3278        var mapContent = $item.attr('data-mapcontent');
3279        var useTitle = $item.attr('data-usetitle');
3280        var useContent = $item.attr('data-usecontent');
3281        var lat = $item.attr("data-lat");
3282        var lng = $item.attr("data-lng");
3283        var zoom = $item.attr("data-zoom");
3284
3285        if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false;
3286        if(typeof zoom == 'undefined' || !zoom) zoom = 17;
3287        if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = '';
3288        if(typeof mapContent == 'undefined' || !mapContent) mapContent = '';
3289        if(typeof useTitle == 'undefined' || !useTitle) useTitle = false;
3290        if(typeof useContent == 'undefined' || !useContent) useContent = false;
3291
3292        zoomInOut = JSON.parse(zoomInOut);
3293        useTitle = JSON.parse(useTitle);
3294        useContent = JSON.parse(useContent);
3295
3296        $el.find('.map-wrap').html('<div id="map-container-'+id+'" class="map-container"></div>')
3297
3298        $el.find('.map-container').attr('data-map_kind', mapKind);
3299        $el.find('.map-container').attr('data-zoominout', zoomInOut);
3300        $el.find('.map-container').attr('data-maptitle', mapTitle);
3301        $el.find('.map-container').attr('data-mapcontent', mapContent);
3302        $el.find('.map-container').attr('data-usetitle', useTitle);
3303        $el.find('.map-container').attr('data-usecontent', useContent);
3304
3305        var container = 'map-container-'+id;
3306
3307        switch(mapKind) {
3308            case 'google':
3309                var mapUrl = $item.attr('data-map_url');
3310                var map_set = (mapUrl.match(/^@/) !== null) ? 'html' : 'link';
3311                var map_iframe = '';
3312                if(map_set == 'html') {
3313                    map_iframe = decodeURIComponent(atob(mapUrl.replace(/^@/,'')));
3314                    console.log(map_iframe);
3315                } else {
3316                    map_iframe = getMapURL(mapUrl, 'html');
3317                }
3318                $el.find('.map-wrap').html(map_iframe);
3319                break;
3320            case 'kakao':
3321                if($el.find('.map-container[data-map_kind="kakao"]').length && (typeof kakao == 'undefined' || typeof kakao.maps == 'undefined' || kakao.maps == null || iVALIDPLAN == '')) {
3322                    $el.find('.map-wrap').html('지도연결해제됨. Javascript키 확인');
3323                    $el.find('.map-wrap').html('<iframe class="google-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3165.5659473821083!2d127.0282496015659!3d37.494568!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca1598c361b2b%3A0xdbf9af292beff3c!2z6rCV64Ko!5e0!3m2!1sko!2skr!4v1637303748377!5m2!1sko!2skr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>');
3324                } else {
3325                    var options = { center: new kakao.maps.LatLng(lat, lng), level: 3};
3326                    var c_map = new kakao.maps.Map($('#' + container).get(0), options);
3327                    var marker = new kakao.maps.Marker({ position: new kakao.maps.LatLng(lat, lng), map: c_map});
3328
3329                    if(zoomInOut == true) {
3330                        var zoomControlHtml = '';
3331                        zoomControlHtml += '\
3332                            <div class="zoom-control" style="margin-top: 8px; margin-right: 8px; right: 0; width: 30px; position: absolute; background-color: #fff; z-index: 1; border-radius: 3px; box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);">\
3333                                <div class="btn-zoom-control" data-inout="I" style="cursor: pointer; width: 30px; height: 30px;">\
3334                                    <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
3334<path d="M17 11h-4V7c0-.55-.45-1-1-1s-1 .45-1 1v4H7c-.55 0-1 .45-1 1s.45 1 1 1h4v4c0 .55.45 1 1 1s1-.45 1-1v-4h4c.55 0 1-.45 1-1s-.45-1-1-1z"/></svg>\
3335                                </div>\
3336                                <div class="slider-wrap-container" style="height: 130px;">\
3337                                    <div class="slider-wrap small" style="text-align: center; height: 100%;">\
3338                                        <div style="max-height: 100%;" class="zoom-control-slider"></div>\
3339                                    </div>\
3340                                </div>\
3341                                <div class="btn-zoom-control" data-inout="O" style="cursor: pointer; width: 30px; height: 30px;">\
3342                                    <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17 13H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1z"/></svg>\
3343                                </div>\
3344                            </div>\
3345                        ';
3346                        var $zoomController = $(zoomControlHtml);
3347                        $('#' + container).append($zoomController);
3348                        var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
3349                            'orientation': 'vertical',
3350                            'min' : 1,
3351                            'max' : 14,
3352                            'step' : 1,
3353                            'value' : 3,
3354                            'handle' : 'square',
3355                            'tooltip' : 'hide',
3356                        }).on('slide', function(data) {
3357                            c_map.setLevel(data.value);
3358                            c_map.setCenter(marker.getPosition());
3359                        }).on('slideStop', function(data) {
3360                            c_map.setLevel(data.value);
3361                            c_map.setCenter(marker.getPosition());
3362                        });
3363
3364                        $zoomController.find('.btn-zoom-control').on('click', function() {
3365                            if($(this).data('inout') == 'I') {
3366                                c_map.setLevel(c_map.getLevel() - 1);
3367                                zoom_slider.slider('setValue', c_map.getLevel());
3368                            } else if($(this).data('inout' == 'O')) {
3369                                c_map.setLevel(c_map.getLevel() + 1);
3370                                zoom_slider.slider('setValue', c_map.getLevel());
3371                            }
3372                        });
3373
3374                        kakao.maps.event.addListener(c_map, 'zoom_changed', function() {
3375                            zoom_slider.slider('setValue', c_map.getLevel());
3376                        });
3377                    }
3378                        
3379                    if(useTitle == true || useContent == true) {
3380                        var iwContent = '';
3381
3382                        if(!mapTitle) mapTitle = $.lang[LANG]['config.contact.map.placeholder.place'];
3383                        if(!mapContent) mapContent = $.lang[LANG]['config.contact.map.placeholder.content'];
3384
3385                        if(useTitle == true) {
3386                            iwContent = '<div class="title">' + mapTitle + '</div>';
3387                        }
3388                        if(useContent == true) {
3389                            iwContent += '<div class="content">' + mapContent + '</div>';
3390                        }
3391                        // console.log('iwContent', iwContent);
3392                        if(iwContent) {
3393                            iwContent = '<div class="contact-map-info-window"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 0C4.69 0 2 2.69 2 6s1 4 6 10c5-6 6-6.69 6-10s-2.69-6-6-6zm0 8.3a2.3 2.3 0 1 1 0-4.6 2.3 2.3 0 0 1 0 4.6z"/></svg>' + iwContent + '</div>';
3394                            var infoWindow = $(iwContent);
3395                            $('#' + container).append(infoWindow);
3396                        }
3397                    }
3398
3399                    $(window).on("resize", function() {
3400                        c_map.setCenter(marker.getPosition());
3401                    });
3402                    c_map.relayout();
3403                }
3404                break;
3405            case 'naver':
3406                if($el.find('.map-container[data-map_kind="naver"]').length && (typeof naver == 'undefined' || typeof naver.maps == 'undefined' || naver.maps == null || iVALIDPLAN == '')) {
3407                    $el.find('.map-wrap').html('지도연결해제됨. Client ID 확인');
3408                    $el.find('.map-wrap').html('<iframe class="google-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3165.5659473821083!2d127.0282496015659!3d37.494568!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca1598c361b2b%3A0xdbf9af292beff3c!2z6rCV64Ko!5e0!3m2!1sko!2skr!4v1637303748377!5m2!1sko!2skr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>');
3409                } else {       
3410                    var options = { center: new naver.maps.LatLng(lat, lng), zoom: 17};
3411                    var c_map = new naver.maps.Map(container, options);
3412                    var marker = new naver.maps.Marker({ position: new naver.maps.LatLng(lat, lng), map: c_map});
3413
3414                    if(zoomInOut == true) {
3415                        var zoomControlHtml = '';
3416                        zoomControlHtml += '\
3417                            <div class="zoom-control" style="margin-top: 8px; margin-right: 8px; right: 0; width: 30px; position: absolute; background-color: #fff; z-index: 1; border-radius: 3px; box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);">\
3418                                <div class="btn-zoom-control" data-inout="I" style="cursor: pointer; width: 30px; height: 30px;">\
3419                                    <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
3419<path d="M17 11h-4V7c0-.55-.45-1-1-1s-1 .45-1 1v4H7c-.55 0-1 .45-1 1s.45 1 1 1h4v4c0 .55.45 1 1 1s1-.45 1-1v-4h4c.55 0 1-.45 1-1s-.45-1-1-1z"/></svg>\
3420                                </div>\
3421                                <div class="slider-wrap-container" style="height: 130px;">\
3422                                    <div class="slider-wrap small" style="text-align: center; height: 100%;">\
3423                                        <div style="max-height: 100%;" class="zoom-control-slider"></div>\
3424                                    </div>\
3425                                </div>\
3426                                <div class="btn-zoom-control" data-inout="O" style="cursor: pointer; width: 30px; height: 30px;">\
3427                                    <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17 13H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1z"/></svg>\
3428                                </div>\
3429                            </div>\
3430                        ';
3431                        var $zoomController = $(zoomControlHtml);
3432                        $('#' + container).append($zoomController);
3433                        var zoom_slider = $zoomController.find('.zoom-control-slider').slider({
3434                            'orientation': 'vertical',
3435                            'min' : 6,
3436                            'max' : 21,
3437                            'step' : 1,
3438                            'value' : zoom,
3439                            'handle' : 'square',
3440                            'reversed' : true,
3441                            'tooltip' : 'hide',
3442                        }).on('slide', function(data) {
3443                            c_map.setZoom(data.value);
3444                            c_map.setCenter(marker.getPosition());
3445                        }).on('slideStop', function(data) {
3446                            c_map.setZoom(data.value);
3447                            c_map.setCenter(marker.getPosition());
3448                        });
3449                        $zoomController.find('.btn-zoom-control').on('click', function() {
3450                            if($(this).data('inout') == 'I') {
3451                                c_map.setZoom(c_map.getZoom() + 1);
3452                                zoom_slider.slider('setValue', c_map.getZoom());
3453                            } else if($(this).data('inout' == 'O')) {
3454                                c_map.setZoom(c_map.getZoom() - 1);
3455                                zoom_slider.slider('setValue', c_map.getZoom());
3456                            }
3457                        });
3458
3459                        naver.maps.Event.addListener(c_map, 'zoom_changed', function(zoom) {
3460                            zoom_slider.slider('setValue', c_map.getZoom());
3461                        });
3462                    }
3463
3464                    if(useTitle == true || useContent == true) {
3465                        var iwContent = '';
3466                        
3467                        if(!mapTitle) mapTitle = $.lang[LANG]['config.contact.map.placeholder.place'];
3468                        if(!mapContent) mapContent = $.lang[LANG]['config.contact.map.placeholder.content'];
3469
3470                        if(useTitle == true) {
3471                            iwContent = '<div class="title">' + mapTitle + '</div>';
3472                        }
3473                        if(useContent == true) {
3474                            iwContent += '<div class="content">' + mapContent + '</div>';
3475                        }
3476
3477                        if(iwContent) {
3478                            iwContent = '<div class="contact-map-info-window"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 0C4.69 0 2 2.69 2 6s1 4 6 10c5-6 6-6.69 6-10s-2.69-6-6-6zm0 8.3a2.3 2.3 0 1 1 0-4.6 2.3 2.3 0 0 1 0 4.6z"/></svg>' + iwContent + '</div>';
3479                            var infoWindow = $(iwContent);
3480                            $('#' + container).append(infoWindow);
3481                            // infoWindow.css('bottom', 'calc(-100% + ' + (infoWindow.outerHeight() + 36) + 'px)');  
3482                        }
3483                    }
3484                    $(window).on("resize", function() {
3485                        c_map.setCenter(marker.getPosition());
3486                    });
3487                }
3488                break;
3489        }
3490    }
3491
3492    var setDefaultFranchiseMap = function($el) {
3493        let blocklang = (typeof $el.attr('data-blocklang') != 'undefined')? $el.attr('data-blocklang') : LANG;
3494        $el.find('.map-search-dropdown .dropdown-menu').html('');
3495        $el.find('.map-search-dropdown .dropdown-toggle > span').removeClass('selected');
3496        $el.find('.select-si-do .dropdown-toggle > span').text($.lang[blocklang]['contact.map.search.sido']);
3497        $el.find('.select-gun-gu .dropdown-toggle > span').text($.lang[blocklang]['contact.map.search.gungu']);
3498        $el.find('.searchby-storename input').val('');
3499
3500        $el.find('.map-item-list > .item').removeAttr('style');
3501        $el.find('.map-item-list >
3501 .item').removeClass('__matrix_focus');
3502        $el.find('.map-item-list > .item').removeClass('hide');
3503        $el.find('.map-item-list > .item').removeClass('selected');
3504        $el.find('.map-item-list > .item').eq(0).addClass('selected');
3505        $el.find('.map-item-list .map-item-empty').remove();
3506
3507        if($el.find('.map-info').length > 0) {
3508            $el.find('.map-info').addClass('hide');
3509            $el.find('.map-info').eq(0).removeClass('hide');
3510        }
3511
3512        drawMap($el.find('.map-item-list > .item').eq(0), $el);
3513    }
3514
3515    var paginatedItems = new Array();
3516    var fmapMobilePaging = function($el) { //init
3517        var $items = $el.find('[data-fmap-loop="true"] > .item:not(.not-result)');
3518        var itemArr = $items.get();
3519        var itemsPerPage = ($('body').width() <= 767)? 3 : 8;
3520        // console.log('itemArr', itemArr);
3521        if($('body').width() <= 767) {
3522            if($el.find('[data-fmap-loop="true"]').attr('data-view-m')) itemsPerPage = $el.find('[data-fmap-loop="true"]').attr('data-view-m') * 1;
3523        } else if($('body').width() <= 991) {
3524            if($el.find('[data-fmap-loop="true"]').attr('data-view-t')) itemsPerPage = $el.find('[data-fmap-loop="true"]').attr('data-view-t') * 1;
3525        } else {
3526            $items.removeClass('hide');
3527        }
3528        // console.log('itemsPerPage', itemsPerPage);
3529
3530        // 전체 페이지 수 계산
3531        var totalPages = Math.ceil(itemArr.length / itemsPerPage);
3532
3533        // console.log('totalPages', totalPages);
3534        if ($('body').width() <= 991) {
3535
3536            if(totalPages > 1) {
3537                // 배열을 페이지당 나누기
3538                var pageNumHTML = '';
3539                var elname = $el.attr('data-name');
3540                paginatedItems[elname] = [];
3541                // console.log(paginatedItems);
3542                for (var i = 0; i < totalPages; i++) {
3543                    var start = i * itemsPerPage;
3544                    var end = start + itemsPerPage;
3545                    // console.log(start, end);
3546                    paginatedItems[elname].push(itemArr.slice(start, end));
3547                }
3548
3549                var endPage = paginatedItems[elname].length - 1;
3550                // console.log('paginatedItems[elname]', paginatedItems[elname]);
3551                $.each(paginatedItems[elname], function(idx, v){
3552                    var pageNum = idx + 1;
3553                    pageNumHTML += '<li class="' + (pageNum == 1? 'active' : (pageNum > 5? 'hide' : '')) + '" data-item-page="' + idx + '">'+pageNum+'</li>'
3554                });
3555
3556                var paginationHTML = '\
3557                <ul class="display-flex align-items-center">\
3558                    <li class="go-start disabled" data-item-page="0"><i class="fa fa-angle-double-left" aria-hidden="true"></i></li>\
3559                    <li class="go-prev disabled" data-item-page="prev"><i class="fa fa-angle-left" aria-hidden="true"></i></li>\
3560                    ' + pageNumHTML + '\
3561                    <li class="go-next" data-item-page="next"><i class="fa fa-angle-right" aria-hidden="true"></i></li>\
3562                    <li class="go-end" data-item-page="' + endPage + '"><i class="fa fa-angle-double-right" aria-hidden="true"></i></li>\
3563                </ul>\
3564                ';
3565
3566                $el.find('.m-map-pagination').html(paginationHTML);
3567
3568                $items.addClass('hide');
3569                $.each(paginatedItems[elname][0], function(idx, v){
3570                    $(v).removeClass('hide');
3571                });
3572            } else {
3573                $el.find('.m-map-pagination').html('');
3574            }
3575
3576            $('.m-map-pagination > ul > li:not(.disabled)').die('click');
3577            $('.m-map-pagination > ul > li:not(.disabled)').live('click', function(){
3578                let $this = (typeof isElviewPage != 'undefined' && isElviewPage === true)? $(this).closest('.el_viewblock') : $(this).closest('.element');
3579                let page = $(this).attr('data-item-page');
3580                let currentElName = $this.attr('data-name');
3581                let endPage = $this.find('li.go-end').attr('data-item-page') * 1;
3582                let activated = $this.find('.m-map-pagination > ul > li.active').attr('data-item-page') * 1;
3583                let currentItems = new Array();
3584
3585                $this.find('.m-map-pagination > ul > li').removeClass('active');
3586                $this.find('.m-map-pagination > ul > li').removeClass('disabled');
3587
3588                if(isNaN(activated)) activated = endPage;
3589                // console.log(activated, endPage, paginatedItems[currentElName]);
3590                switch (page) {
3591                    case 'prev':
3592                        if(activated > 0) {
3593                            page = activated - 1;
3594                        } else {
3595                            page = 0;
3596                        }
3597                        break;
3598                    case 'next':
3599                        if(activated < endPage) {
3600                            page = activated + 1;
3601                        } else {
3602                            page = endPage;
3603                        }
3604                        break;
3605                    default:
3606                        page = page * 1;
3607                        break;
3608                }
3609
3610                if(page == 0) {
3611                    $this.find('.m-map-pagination > ul > li.go-start').addClass('disabled');
3612                    $this.find('.m-map-pagination > ul > li.go-prev').addClass('disabled');
3613                }
3614                if(page >= 4) {
3615                    $this.find('.m-map-pagination > ul >
3615 li:not(.go-start):not(.go-end):not(.go-prev):not(.go-next)').addClass('hide');
3616                    $this.find('.m-map-pagination > ul > li[data-item-page="' + (page - 2) + '"]').removeClass('hide');
3617                    $this.find('.m-map-pagination > ul > li[data-item-page="' + (page - 1) + '"]').removeClass('hide');
3618                    $this.find('.m-map-pagination > ul > li[data-item-page="' + page + '"]').removeClass('hide');
3619                    $this.find('.m-map-pagination > ul > li[data-item-page="' + (page + 1) + '"]').removeClass('hide');
3620                    $this.find('.m-map-pagination > ul > li[data-item-page="' + (page + 2) + '"]').removeClass('hide');
3621                } else {
3622                    $this.find('.m-map-pagination > ul > li:not(.go-start):not(.go-end):not(.go-prev):not(.go-next)').addClass('hide');
3623                    $this.find('.m-map-pagination > ul > li[data-item-page="0"]').removeClass('hide');
3624                    $this.find('.m-map-pagination > ul > li[data-item-page="1"]').removeClass('hide');
3625                    $this.find('.m-map-pagination > ul > li[data-item-page="2"]').removeClass('hide');
3626                    $this.find('.m-map-pagination > ul > li[data-item-page="3"]').removeClass('hide');
3627                    $this.find('.m-map-pagination > ul > li[data-item-page="4"]').removeClass('hide');
3628                }
3629                if(page == endPage) {
3630                    $this.find('.m-map-pagination > ul > li.go-end').addClass('disabled');
3631                    $this.find('.m-map-pagination > ul > li.go-next').addClass('disabled');
3632                }
3633
3634                currentItems = paginatedItems[currentElName][page];
3635                // console.log('currentItems', page, currentItems);
3636                $this.find('[data-fmap-loop="true"] > .item').addClass('hide');
3637                if(typeof currentItems != 'undefined') {
3638                    $.each(currentItems, function(idx, v){
3639                        // console.log($(v));
3640                        $(v).removeClass('hide');
3641                    });
3642                }
3643
3644                $this.find('.m-map-pagination > ul > li[data-item-page="' + page + '"]:not(.go-start):not(.go-end)').addClass('active');
3645            });
3646        }
3647    }
3648
3649    $('#comm-name,#comm-pass').live('blur', function(e) {
3650        if ($(this).hasClass('guestbook-pass')) return false;
3651        window.scrollTo(0, 0);
3652    });
3653    var getLocation = function(url) {
3654        var parser = document.createElement('a');
3655        parser.href = url;
3656        parser.href = parser.href;
3657
3658        if (parser.host === '') {
3659            var newProtocolAndHost = window.location.protocol + '//' + window.location.host;
3660            if (url.charAt(1) === '/') {
3661                parser.href = newProtocolAndHost + url;
3662            } else {
3663                var currentFolder = ('/' + parser.pathname).match(/.*\//)[0];
3664                parser.href = newProtocolAndHost + currentFolder + url;
3665            }
3666        }
3667        var properties = ['host', 'hostname', 'hash', 'href', 'port', 'protocol', 'search'];
3668        for (var i = 0, n = properties.length; i < n; i++) {
3669            this[properties[i]] = parser[properties[i]];
3670        }
3671        this.pathname = (parser.pathname.charAt(0) !== '/' ? '/' : '') + parser.pathname;
3672    }
3673
3674
3675    var setResizeImageFolder = function(w, content_image) {
3676        var magic_type = (PAGE_MODE == 'c') ? SETTINGS.magic_type : property.SETTINGS.magic_type,
3677            check_magic_type = (typeof magic_type != 'undefined' && magic_type == 'webp') ? true : false;
3678        t = (check_magic_type) ? '-rw' : '';
3679
3680        var r = '';
3681        if (content_image && content_image.lastIndexOf('=') > -1) {
3682            var image_index = content_image.lastIndexOf('=');
3683            content_image = content_image.substr(0, image_index);
3684
3685            switch (w) {
3686
3687                case "0":
3688                    r = content_image + '=s0' + t;
3689                    break;
3690                case "60":
3691                    r = content_image + '=w60-h60-n' + t;
3692                    break;
3693                case "250":
3694                    r = content_image + '=w250-h250-n' + t;
3695                    break;
3696                case "300":
3697                    r = content_image + '=w300-h300-n' + t;
3698                    break;
3699                case "600":
3700                    r = content_image + '=w600-h600-n' + t;
3701                    break;
3702                case "650":
3703                    r = content_image + '=w650-h370-n' + t;
3704                    break;
3705                case "670":
3706                    r = content_image + '=w670-h980-n' + t;
3707                    break;
3708                case "700":
3709                    r = content_image + '=w700-h500-n' + t;
3710                    break;
3711                case "800":
3712                    r = content_image + '=w800' + t;
3713                    break;
3714                    //case "1920": break;
3715                default:
3716                    r = content_image;
3717                    break;
3718            }
3719        }
3720
3721        return r;
3722    }
3723
3724    function changeLanguage(code, mode) {
3725        var isSYNC = false;
3726
3727        if (typeof mode != 'undefined' && typeof mode == 'object') isSYNC = false;
3728        else isSYNC = (typeof mode != 'undefined' && mode && mode.match(/^sync_/gi) !== null) ? true : false;
3729        var sid = (typeof SID == 'undefined') ? property.SID : SID;
3730        var type = '';
3731
3732        if (typeof mode == 'undefined') {
3733            type = (typeof property !== 'undefined' && property.LOAD == 'RENDER') ? 'render' : 'publish';
3734        } else if (typeof mode == 'object') {
3735            type = 'board';
3736        } else {
3737            type = 'config';
3738
3739            if (isSYNC) type = mode.replace(/^sync_/gi, '');
3740        }
3741
3742        $.post('/language/' + code, { sid: sid, type: type }, function(data) {
3743            if (isSYNC) {
3744                // console.log('change language');
3745                return false;
3746            } else {
3747                if (typeof mode == 'undefined') {
3748                    if (typeof property !== 'undefined' && property.LOAD == 'RENDER') location.href = '/render';
3749                    else location.href = '/';
3750                } else if (typeof mode == 'object') {
3751                    var url = $(mode).attr('data-url');
3752                    var checkDashboard = '/dashboard';
3753                    if (window.location.href.indexOf(checkDashboard) > -1) { //dashboard         
3754                        window.open(url, '_blank').focus();
3755                    } else {
3756                        location.href = url;
3757                    }
3758                } else {
3759                    if (mode == 'end_config') {
3760                        console.log('change language');
3761                        return false;
3762                    }
3763                    location.href = '/' + CONFIG_URL + 'config';
3764                }
3765            }
3766        }, 'json');
3767    }
3768
3769
3770    $(document).on('click', '.bizcommpop-open', function(e) {
3771        var url = 'http://www.ftc.go.kr/bizCommPop.do?wrkr_no=1148687877';
3772        window.open(url, 'bizCommPop', 'width=750, height=700;');
3773    });
3774
3775
3776    function setMadeWithCreatorlink() {
3777        var s_service = (typeof SERVICE == 'undefined') ? ((typeof property == 'undefined') ? '' : property.SERVICE) : SERVICE,
3778            s_plantype = (typeof VALIDTYPE == 'undefined') ? ((typeof property == 'undefined') ? '' : property.VALIDTYPE) : VALIDTYPE;
3779
3780        var checkGabia = (s_service.indexOf('gabia') > -1) ? true : false,
3781            made_width = (checkGabia && LANG == 'ko') ? 'w-2' : '',
3782            go_to_link = (checkGabia) ? 'http://creatorlink-gabia.com' : 'http://creatorlink.net?utm_source=FreeSite&utm_medium=banner&utm_campaign=powered_by_Creatorlink&utm_term=sitebanner&utm_content=free',
3783            go_to_txt = (checkGabia) ? 'footer.made-mark.description.gabia' : 'footer.made-mark.description',
3784            made_txt = $.lang[LANG]['footer.made-mark.description.title'];
3785        // upgrade_href = (checkGabia) ? 'href="https://www.gabia.com/mygabia/service" target="_blank"' : 'href="/upgrade/site/"';
3786
3787        if ($('.dsgn-body').find('.made-with-creatorlink').length > 0) {
3788            $('.dsgn-body').find('.made-with-creatorlink').show().attr('style', 'display: block!important');
3789        } else {
3790            var svg_logo = '<svg class="made-with-creatorlink-logo logo-b logo-p" alt="Creatorlink logo" role="img" viewBox="0 0 168 38"><path class="st11" d="M70.71 12.36c-3.48 0-5.9 2.19-5.9 5.34v4.11c0 3.34 2.17 5.25 5.96 5.25 2.06 0 3.98-0.58 5.41-1.64l0.14-0.11 -1.03-1.95 -0.2 0.1c-1.67 0.85-2.74 1.15-4.11 1.15 -2.23 0-3.23-0.87-3.23-2.83v-0.94h8.62v-3.08C76.37 14.13 74.52 12.36 70.71 12.36zM73.52 18.45h-5.77v-0.92c0-1.91 1.53-2.78 2.96-2.78 2.02 0 2.81 0.78 2.81 2.78V18.45z"></path><path class="st11" d="M84.38 12.36c-1.52 0-3.34 0.55-4.87 1.47l-0.17 0.1 1.11 1.95 0.19-0.1c1.41-0.69 2.48-0.98 3.59-0.98 2.22 0 2.93 0.51 2.93 2.1v1.29h-3.64c-3.09 0-4.65 1.47-4.65 4.37 0 1.22 0.39 2.33 1.09 3.12 0.76 0.85 1.84 1.3 3.12 1.3 0.09 0 0.18 0 0.26-0.01 1.37-0.06 2.71-0.51 3.97-0.99l0.04 0.79h2.76v-9.76C90.11 13.76 88.39 12.36 84.38 12.36zM87.17 23.79l-0.01 0c-0.83 0.32-1.87 0.72-3.2 0.73h-0.06c-1.46 0-2.08-0.6-2.08-2.01 0-1.37 0.55-1.92 1.89-1.92h3.47V23.79z"></path><path class="st11" d="M101.06 24.31c-0.95 0.23-1.63 0.33-2.26 0.33 -1.16 0-1.27-0.36-1.27-1.31v
3790-8.47h3.9l0-2.22h-3.9V9.26l-2.94 0.01v3.38h-2.56v2.22h2.56v8.86c0 2.31 1.18 3.34 3.82 3.34 1.04 0 2.14-0.18 3.11-0.52l0.17-0.06 -0.4-2.23L101.06 24.31z"></path><path class="st11" d="M109.95 12.36c-3.88 0-6.11 1.96-6.11 5.36v3.97c0 3.41 2.23 5.36 6.11 5.36 3.88 0 6.11-1.96 6.11-5.36v-3.97C116.06 14.32 113.84 12.36 109.95 12.36zM113.12 21.78c0 1.89-1.04 2.8-3.17 2.8 -2.13 0-3.17-0.92-3.17-2.8v-4.14c0-1.89 1.04-2.8 3.17-2.8 2.13 0 3.17 0.92 3.17 2.8V21.78z"></path><path class="st11" d="M59.07 14.72l0.01-2.07H56.3v14.13h2.94v-9.04c1.75-1.89 4.2-3.24 4.2-3.24l-1.4-1.84C62.04 12.65 60.26 13.76 59.07 14.72z"></path><path class="st11" d="M121.93 14.72l0.01-2.07h-2.77v14.13h2.94v-9.04c1.75-1.89 4.2-3.24 4.2-3.24l-1.4-1.84C124.91 12.65 123.12 13.76 121.93 14.72z"></path><path class="st11" d="M51.54 22.93c-0.96 1.11-2.12 1.66-3.56 1.66 -2.13 0-3.17-0.92-3.17-2.8v-4.14c0-1.89 1.04-2.8 3.17-2.8 1.73 0 2.83 0.77 3.68 1.52l0.13 0.12 1.99-1.39 -0.13-0.17c-0.76-0.95-2.5-2.55-5.67-2.55 -3.88 0-6.11 1.96-6.11 5.36v3.97c0 3.41 2.23 5.36 6.11 5.36 3.03 0 4.76-1.58 5.68-2.91l0.13-0.18 -2.13-1.18L51.54 22.93z"></path><rect x="128.71" y="6.68" class="st11" width="1.2" height="20.07"></rect><rect x="134.41" y="12.69" class="st11" width="1.2" height="14.06"></rect><rect x="134.41" y="8.29" class="st11" width="1.2" height="2.18"></rect><path class="st11" d="M148.67 13.44c-1.68-0.98-5.06-0.52-7.21 0.71V12.5h-1.2v14.25h1.2V15.33c1.74-1.3 5.26-1.79 6.61-1 1.38 0.81 1.38 2.37 1.38 2.43v9.99h1.2v-9.99C150.65 16.67 150.63 14.59 148.67 13.44z"></path><polygon class="st11" points="158.27 18.97 164.05 12.69 162.6 12.69 156 19.89 156 6.68 154.8 6.68 154.8 26.75 156 26.75 156 21.44 157.54 19.77 163.6 26.75 165 26.75 "></polygon><path class="st11" d="M3 10.79L3 10.79l0 16.42 14.22 8.21 14.22-8.21V10.79L17.22 2.58 3 10.79zM26.7 13.53L26.7 13.53 26.7 13.53l-4.74 2.74h0l-4.74-2.74 -4.74 2.74v5.47l4.74 2.74 4.74-2.74 4.74 2.74 -9.48 5.47 -9.48-5.47V13.53l9.48-5.47L26.7 13.53 26.7 13.53z"></path></svg>',
3791                svg_logo_m = '<svg class="made-with-creatorlink-logo logo-b logo-m" alt="Creatorlink logo" viewBox="0 0 26 30" width="26" height="30"><path class="st11" d="M1 8.1L1 8.1V22l12 6.9L25 22V8.1L13 1.2 1 8.1zM21 10.5L21 10.5 21 10.5l-4 2.3 0 0 -4-2.3 -4 2.3v4.6l4 2.3 4-2.3 4 2.3 -8 4.6L5 19.7v-9.2l8-4.6L21 10.5 21 10.5z"/></svg>',
3792                str = '\
3793                    <div class="made-with-creatorlink ' + made_width + '" alt="' + made_txt + '" title="' + made_txt + '">\
3794                        <a class="made-creatorlink-link fixed-banner" href="' + go_to_link + '" target="_blank">\
3795                            <div class="inner-logo">' + svg_logo + svg_logo_m + '</div>\
3796                            <div class="inner-txt">\
3797                                <ul>\
3798                                    <li>' + $.lang[LANG][go_to_txt + '.1'] + '</li>\
3799                                    <li>' + $.lang[LANG][go_to_txt + '.2'] + '</li>\
3800                                </ul>\
3801                            </div>\
3802                            <div class="inner-btn"><span>' + $.lang[LANG]['footer.made-mark.btn'] + '</span></div>\
3803                        </a>\
3804                        <div class="rolling-wrapper">\
3805                          <a class="made-creatorlink-link">\
3806                              <div class="inner-logo">' + svg_logo + svg_logo_m + '</div>\
3807                              <div class="inner-txt">\
3808                                  <ul>\
3809                                      <li>' + $.lang[LANG][go_to_txt + '.1'] + '</li>\
3810                                  </ul>\
3811                              </div>\
3812                              <div class="inner-btn"><span>' + $.lang[LANG]['footer.made-mark.btn'] + '</span></div>\
3813                          </a>\
3814                          <a class="made-creatorlink-link blue">\
3815                              <div class="inner-logo">' + svg_logo + svg_logo_m + '</div>\
3816                              <div class="inner-txt">\
3817                                  <ul>\
3818                                      <li>' + $.lang[LANG][go_to_txt + '.2'] + '</li>\
3819                                  </ul>\
3820                              </div>\
3821                              <div class="inner-btn"><span>' + $.lang[LANG]['footer.made-mark.btn'] + '</span></div>\
3822                          </a>\
3823                        </div>\
3824                    </div>\
3825                ';
3826            $('.dsgn-body').append(str);
3827
3828            var mwcRollingId = new Interval(mwcRollingStart, 3000);
3829            mwcRollingId.start();
3830        }
3831    }
3832
3833    function setMadeWithCreatorlinkOld() {
3834        var host = (typeof SERVICE == 'undefined') ? property.SERVICE : SERVICE,
3835            made_width = (host.indexOf('gabia') > -1 && LANG == 'ko') ? 'w-2' : '',
3836            go_to_link = (host.indexOf('gabia') > -1) ? 'http://creatorlink-gabia.com' : 'http://creatorlink.net?utm_source=FreeSite&utm_medium=banner&utm_campaign=p
3836owered_by_Creatorlink&utm_term=sitebanner&utm_content=free',
3837            go_to_txt = (host.indexOf('gabia') > -1) ? 'footer.made-mark.description.gabia' : 'footer.made-mark.description',
3838            made_txt = $.lang[LANG]['footer.made-mark.description.title'];
3839
3840        if ($('.dsgn-body').find('.made-with-creatorlink').length > 0) {
3841            $('.dsgn-body').find('.made-with-creatorlink').show().attr('style', 'display: block!important');
3842        } else {
3843            var svg_logo = '<svg class="made-with-creatorlink-logo" viewBox="0 0 26 30" width="26" height="30"><path class="st11" d="M1 8.1L1 8.1V22l12 6.9L25 22V8.1L13 1.2 1 8.1zM21 10.5L21 10.5 21 10.5l-4 2.3 0 0 -4-2.3 -4 2.3v4.6l4 2.3 4-2.3 4 2.3 -8 4.6L5 19.7v-9.2l8-4.6L21 10.5 21 10.5z"/></svg>',
3844                str = '\
3845                    <div class="made-with-creatorlink ' + made_width + '" alt="' + made_txt + '" title="' + made_txt + '">\
3846                        <a class="made-creatorlink-link" href="' + go_to_link + '" target="_blank">\
3847                            <div class="inner-logo">' + svg_logo + '</div>\
3848                            <div class="inner-txt">\
3849                                <ul>\
3850                                    <li>' + $.lang[LANG][go_to_txt + '.1'] + '</li>\
3851                                    <li>' + $.lang[LANG][go_to_txt + '.2'] + '</li>\
3852                                </ul>\
3853                            </div>\
3854                        </a>\
3855                    </div>\
3856                ';
3857            $('.dsgn-body').append(str);
3858
3859            var mwcRollingId = new Interval(mwcRollingStart, 3000);
3860            mwcRollingId.start();
3861        }
3862    }
3863
3864    // function mwcRollingStart() {
3865    //     var $mwcUl = $('.made-with-creatorlink').find('ul'),
3866    //         $mwcHeight = $mwcUl.children().outerHeight(),
3867    //         $length = $mwcUl.children().length;
3868
3869    //     $mwcUl.css('height', $mwcHeight + 'px');
3870    //     $mwcUl.animate({ top: -$mwcHeight + 'px' }, 1000, 'easeInOutQuart', function() {
3871    //         $(this).append($(this).find('li:first').clone().wrapAll('<li/>').parent().html());
3872
3873    //         $(this).find('li:first').remove();
3874    //         $(this).css('top', 0);
3875    //     });
3876    // }
3877    function mwcRollingStart() {
3878      var $wrap = $('.made-with-creatorlink'),
3879          $inner = $wrap.find('.rolling-wrapper'),
3880          $items = $inner.find('.made-creatorlink-link'),
3881          itemHeight = $items.outerHeight();
3882      $inner.css('position','relative');
3883
3884      var $next = $inner.find('.made-creatorlink-link').eq(1);
3885      setTimeout(function () {
3886          if ($next.hasClass('blue')) {
3887              $wrap.addClass('blue');
3888          } else {
3889              $wrap.removeClass('blue');
3890          }
3891      }, 500);
3892
3893      $inner.animate(
3894          { top: -itemHeight + 'px' },
3895          1000,
3896          'easeInOutQuart',
3897          function () {
3898              $inner.append($inner.find('.made-creatorlink-link:first'));
3899              $inner.css('top', 0);
3900          }
3901      );
3902    }
3903
3904    function Interval(fn, time) {
3905        var timer = false;
3906        this.start = function() {
3907            if (!this.isRunning())
3908                timer = setInterval(fn, time);
3909        };
3910        this.stop = function() {
3911            clearInterval(timer);
3912            timer = false;
3913        };
3914        this.isRunning = function() {
3915            return timer !== false;
3916        };
3917    }
3918
3919    function siteNotice(fn, checkDouble, mode, sidchk) {
3920        var s_service = (typeof SERVICE == 'undefined') ? ((typeof property == 'undefined') ? '' : property.SERVICE) : SERVICE;
3921        var s_plantype = (typeof VALIDTYPE == 'undefined') ? ((typeof property == 'undefined') ? '' : property.VALIDTYPE) : VALIDTYPE;
3922
3923        var mode = (mode) ? mode : 'dashbord';
3924        var checkDouble = (typeof checkDouble != 'undefined' && checkDouble) ? checkDouble : '';
3925        var checkGabia = (s_service.indexOf('gabia') > -1 || (typeof rt_service != 'undefined' && rt_service == 'ga')) ? true : false;
3926        var checkGabiaOther = ['manager', 'shopping', 'nickname', 'language', 'chmod', 'chmod.group', 'chmod.commentLevel', 'siteclone'];
3927        var description_other = (checkGabia) ? (($.inArray(fn, checkGabiaOther) > -1) ? '.GA' : '') : '';
3928        var upgrade_url = (checkGabia) ? 'https://www.gabia.com/mygabia/service" target="_blank' : ((fn == 'shopping') ? '/shoppingevent' : '/upgrade/site/');
3929        var sidchk = (sidchk) ? sidchk : '';
3930
3931        // if(fn == 'gabia.bn.chmod') {
3932        //     fn = 'chmod';
3933        //     description_other = '.GA';
3934        //     upgrade_url = '/manager/member';
3935
3936        var modal_title = $.lang[LANG]['dashbord.upgrade.' + fn + '.title' + description_other];
3937        var modal_description = $.lang[LANG]['dashbord.upgrade.' + fn + '.description' + description_other];
3938        var modal_class = 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0';
3939        var modal_btn = {
3940                'cls': '',
3941                'upgrade': true,
3942                'url': upgrade_url,
3943                'target': '_blank',
3944            };
3945
3946        switch(fn) {
3947            case 'siteclone':
3948                modal_btn.url += sidchk;
3949                modal_btn.target = '';
3950                break;
3951            case 'metaDetail':
3952            case 'metaPlus':
3953            case 'metaOnepage':
3954                modal_title = $.lang[LANG]['dashbord.upgrade.meta.title'];
3955                break;
3956            case 'sitelimit':
3957                modal_title = $.lang[LANG]['dashbord.upgrade.siteclone.title'];
3958                modal_btn.upgrade = false;
3959                modal_btn.cls = 'btn-closeOnly';
3960                break;
3961            case 'chmod.group':
3962                if (s_plantype == 'BN') modal_description = $.lang[LANG]['dashbord.upgrade.chmod.group.description.bn'];
3963                break;
3964            case 'chmod.commentLevel':
3965                if (checkGabia && $('.' + selectEL).is('[data-type="gallery"]')) modal_title = $.lang[LANG]['dashbord.upgrade.chmod.commentLevel.gallery.title.GA'];
3966                break;
3967            case 'cert':
3968                modal_class = 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0 site-not-cert-modal';
3969                break;
3970            case 'menufixbtn':
3971            case 'menufixlang':
3972                modal_title = $.lang[LANG]['config.upgrade.'+fn+'.title'];
3973                modal_description = (checkGabia) ? $.lang[LANG]['config.upgrade.' + fn + '.description.gabia'] : $.lang[LANG]['config.upgrade.' + fn + '.description'];
3974                break;
3975            case 'kakao_onlynumber':
3976                modal_title = $.lang[LANG]['site.delete.process.end.title']; 
3977                modal_description = $.lang[LANG]['shopping.dashboard.kakaoNotice.onlynumber'];
3978                modal_btn.upgrade = false;
3979                modal_btn.cls = 'btn-closeOnly';
3980                break;
3981            case 'kakao_number_length':
3982                modal_title = $.lang[LANG]['site.delete.process.end.title']; 
3983                modal_description = $.lang[LANG]['shopping.dashboard.kakaoNotice.numlength'];
3984                modal_btn.upgrade = false;
3985                modal_btn.cls = 'btn-closeOnly';
3986                break;
3987            case 'kakao_dupnumber':
3988                modal_title = $.lang[LANG]['site.delete.process.end.title']; 
3989                modal_description = $.lang[LANG]['shopping.dashboard.kakaoNotice.dupnumber'];
3990                modal_btn.upgrade = false;
3991                modal_btn.cls = 'btn-closeOnly';
3992                break;
3993            case 'notificationtalkmail':
3994                modal_title = $.lang[LANG]['dashbord.upgrade.kakaoemail.title'];
3995                modal_description = $.lang[LANG]['dashbord.upgrade.kakaoemail.description'];
3996                break;
3997            case 'notificationSmsDisable':
3998                modal_title = $.lang[LANG]['dashbord.upgrade.smsnotification.title'];
3999                modal_description = $.lang[LANG]['dashbord.upgrade.smsnotification.description'];
4000                break;
4001            case 'smsNotificationSettingDisable':
4002                modal_title = $.lang[LANG]['config.smsnotification.setting.disabled.title'];
4003                modal_description = $.lang[LANG]['config.smsnotification.setting.disabled.description'];
4004                break;
4005            case 'notificationKakaoDisable':
4006                modal_title = $.lang[LANG]['dashbord.upgrade.kakaonotification.title'];
4007                modal_description = $.lang[LANG]['dashbord.upgrade.kakaonotification.description'];
4008                break;
4009            case 'notificationtalkmailgabia':
4010                modal_title = $.lang[LANG]['dashbord.upgrade.kakaoemail.title'];
4011                modal_description = $.lang[LANG]['dashbord.upgrade.kakaoemailgabia.description'];
4012                break;
4013            case 'kakaoShoppingDisable':
4014                modal_title = $.lang[LANG]['dashbord.upgrade.kakaodisable.title']; 
4015                modal_description = $.lang[LANG]['dashbord.upgrade.kakaodisable.description'];
4016                modal_btn.target = '';
4017                break;
4018            case 'go_upgradepage':
4019                modal_title = $.lang[LANG]['dashbord.upgrade.transfer.title'];
4020                modal_description = $.lang[LANG]['dashbord.upgrade.transfer.description'];
4021                modal_btn.url += sidchk;
4022                modal_btn.target = '';
4023                break;
4024            case 'calendar':
4025                modal_title = $.lang[LANG]['dashbord.upgrade.calendar.title']; 
4026                modal_description = $.lang[LANG]['dashbord.upgrade.calendar.description'];
4027                break;
4028            case 'smtp-onoff':
4029                modal_title = $.lang[LANG]['dashbord.upgrade.smtp-onoff.title']; 
4030                modal_description = $.lang[LANG]['dashbord.upgrade.smtp-onoff.description'];
4031                modal_class += ' smtp-upgrade-modal';
4032                break;
4033            case 'smtp-gabia-onoff':
4034                modal_title = $.lang[LANG]['dashbord.upgrade.smtp-gabia-onoff.title']; 
4035                modal_description = $.lang[LANG]['dashbord.upgrade.smtp-gabia-onoff.description'];
4036                modal_class += ' smtp-upgrade-modal';
4037                break;
4038            case 'member-smtp-onoff':
4039                modal_title = $.lang[LANG]['dashbord.upgrade.member-smtp-onoff.title'];
4040                modal_description = $.lang[LANG]['dashbord.upgrade.member-smtp-onoff.description'];
4041                modal_class += ' smtp-upgrade-modal';
4042                break;
4043            default:
4044                break;
4045        }
4046
4047        var btn_upgrade = (modal_btn.upgrade) ? `
4048                    <a href="${modal_btn.url}" id="upgrade-usemember-link" class="btn" target="${modal_btn.target}">${clSVG('planupgrade',18,18)}${$.lang[LANG]['dashbord.toolbar.upgrade-site']}</a>
4049            ` : '';
4050        var str = `
4051            <div class="site-upgrade-notice">
4052                <p><span class="text-centermodal">${modal_description}</span></p>
4053                <div class="btn-box ${modal_btn.cls}">
4054                    ${btn_upgrade}
4055                    <button type="button" class="btn btn-default btn-sm close-button-dialog" data-dismiss="modal">${$.lang[LANG]['config.close']}</button>
4056                </div>
4057            </div>
4058        `;
4059
4060        $(this).showModalFlat(modal_title, str,false,false,'','','',modal_class,'','','',function(){
4061            if(checkDouble) {$('.modal.modal-default.fade.in').css('zIndex','');}
4062        });
4063    }
4064
4065    function hideMadeWithCreatorlink() {
4066        $('.goto-top').removeClass('moved');
4067        $('#cl-music-player-icon').removeClass('moved');
4068        $('.made-with-creatorlink').hide();
4069    }
4070
4071    function sites(s) {
4072        var sites_deferred = $.Deferred();
4073        if (typeof s == 'undefined') sites_deferred.reject('sid Undefined :(');
4074        else {
4075            $.ajax({
4076                url: '/template/publishSites',
4077                data: { sid: s },
4078                type: 'POST',
4079                dataType: 'json',
4080                async: true,
4081                cashe: false,
4082                success: function(data) {
4083                    if (typeof data.error != 'undefined' && data.error) {
4084                        sites_deferred.reject(data.error);
4085                        return false;
4086                    }
4087
4088                    sites_deferred.resolve(data);
4089                }
4090            });
4091        }
4092        return sites_deferred.promise();
4093    }
4094
4095    function pbSite(s, onoff) {
4096        var pbSite_deferred = $.Deferred();
4097        if (typeof s == 'undefined') pbSite_deferred.reject('sid Undefined :(');
4098        else {
4099            $.ajax({
4100                url: '/template/publish1',
4101                data: { sid: s, onoff: onoff },
4102                type: 'POST',
4103                dataType: 'json',
4104                async: true,
4105                cashe: false,
4106                success: function(data) {
4107                    if (typeof data.error != 'undefined' && data.error) {
4108                        pbSite_deferred.reject(data.error);
4109                        return false;
4110                    }
4111
4112                    pbSite_deferred.resolve(data);
4113                }
4114            });
4115        }
4116        return pbSite_deferred.promise();
4117    }
4118
4119    function pbGallery(s, onoff, count, p, sCount, i) {
4120        var pbGallery_deferred = $.Deferred();
4121        if (typeof s == 'undefined') pbGallery_deferred.reject('sid Undefined :(');
4122        else {
4123            $.ajax({
4124                url: '/template/publish2',
4125                data: { sid: s, onoff: onoff, count: count, p: p + 1, sCount: sCount, i: i },
4126                type: 'POST',
4127                dataType: 'json',
4128                async: true,
4129                cashe: false,
4130                success: function(data) {
4131                    if (typeof data.error != 'undefined' && data.error) {
4132                        pbGallery_deferred.reject(data.error);
4133                        return false;
4134                    }
4135
4136                    pbGallery_deferred.resolve(data);
4137                }
4138            });
4139        }
4140        return pbGallery_deferred.promise();
4141    }
4142
4143    function pbPages(s, onoff, count, p, sCount, i) {
4144        var pbPages_deferred = $.Deferred();
4145        if (typeof s == 'undefined') pbPages_deferred.reject('sid Undefined :(');
4146        else {
4147            $.ajax({
4148                url: '/template/publish3',
4149                data: { sid: s, onoff: onoff, count: count, p: p + 1, sCount: sCount, i: i },
4150                type: 'POST',
4151                dataType: 'json',
4152                async: true,
4153                cashe: false,
4154                success: function(data) {
4155                    if (typeof data.error != 'undefined' && data.error) {
4156                        pbPages_deferred.reject(data.error);
4157                        return false;
4158                    }
4159
4160                    pbPages_deferred.resolve(data);
4161                }
4162            });
4163        }
4164        return pbPages_deferred.promise();
4165    }
4166
4167    function clearData(type, s, onoff, count, p) {
4168        return $.ajax({
4169            url: '/template/clear',
4170            data: { type: type, sid: s, count: count, p: p + 1, onoff: onoff },
4171            type: 'POST',
4172            dataType: 'json',
4173            async: true,
4174            cashe: false,
4175            success: function(data) {
4176                console.log(data);
4177            }
4178        });
4179    }
4180
4181    function user_location() {
4182        var xhttp = new XMLHttpRequest();
4183        xhttp.onreadystatechange = function() {
4184            if (this.readyState == 4 && this.status == 200) {
4185                var ip = this.responseText,
4186                    sid = (typeof property.SID) ? property.SID : '',
4187                    refer = (typeof property.VIREFER) ? property.VIREFER : '';
4188                if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip) && sid) {
4189                    $.ajax({
4190                        type: 'POST',
4191                        url: '/template/visitor/' + sid,
4192                        data: { ip: ip, refer: refer },
4193                        dataType: 'json',
4194                        async: true,
4195                        cache: false,
4196                        success: function(r) {
4197                            // console.log(r);
4198                        }
4199                    });
4200                }
4201            }
4202        };
4203        xhttp.open('GET', '//api.ip.pe.kr', true);
4204        // xhttp.open('GET', '//api.ipify.org', true);
4205        xhttp.send();
4206    }
4207
4208    function getProgressWidth() {
4209        var $p = $('.progress-bar');
4210        return $p.width() / $p.parent().width() * 100;
4211    }
4212
4213    var checkError = function(data) {
4214        if(typeof data == 'undefined') data = {};
4215
4216        if (typeof data.error != "undefined" && data.error) {
4217            // alert(data.error);
4218            if (data.error == "No user data") {
4219                internalLink = true;
4220                // location.replace('/member/login');
4221                if (CONFIG_URL) location.replace('/_admin');
4222                setTimeout(function() {
4223                    if (typeof hideAllModal == 'function') hideAllModal();
4224                    var modal = $(this).showModalFlat('<img src="https://storage.googleapis.com/i.addblock.net/modal-logo-dark.png" alt="creaotrlink logo"/>', loginForm(), true, true, function() {}, 'cancel', 'w450');
4225                    $('.flat-modal .modal-footer').hide();
4226                    $('.modal-default[id*=flat-modal] .modal-dialog .modal-body').css('margin', '55px 45px 35px');
4227                    $('.modal-default[id*=flat-modal]').css('z-index', '1041');
4228                    $('.flat-modal').next('.modal-backdrop').css('z-index', '1040');
4229                }, 500);
4230            } else {
4231                $.processOFF();
4232                alert(data.error);
4233            }
4234            return false;
4235        } else {
4236            internalLink = false;
4237            return true;
4238        }
4239    }
4240
4241    $(document)
4242        .off('keypress', 'input[expComma]')
4243        .on('keypress', 'input[expComma]', function(e) {
4244            var key = (e.which) ? e.which : e.keyCode;
4245            if (key == 44) return false;
4246    });
4247
4248    $(document)
4249        .off('blur', 'input[numberOnly]')
4250        .on('blur', 'input[numberOnly]', function(e) {
4251            var val = $(this).val();
4252            var r = val.replace(/[^\d,]/g, '');
4253
4254            if ($(this).hasClass('isFloat')) {
4255                r = val.replace(/[^\d.,]/g, '');
4256            } else if ($(this).attr('class') && $(this).attr('class').indexOf('price') > -1) {
4257                r = val.replace(/[^\d.,-]/g, '');
4258            }
4259
4260            $(this).val(r);
4261        });
4262
4263    $(document)
4264        .off('keypress', 'input[numberOnly]')
4265        .on('keypress', 'input[numberOnly]', function(e) {
4266            var key = (e.which) ? e.which : e.keyCode,
4267                sign = ($(this).hasClass('sign')) ? true : false,
4268                float = $(this).hasClass('isFloat') ? true : false;
4269            if (key > 47 && key < 58) {
4270                return true;
4271            } else if (sign && (key == 43 || key == 45)) {
4272                return true;
4273            } else if (float && key == 46 && $(this).val().indexOf('.') == -1) {
4274                return true;
4275            } else {
4276                return false;
4277            }
4278        });
4279
4280    $(document)
4281        .off('keyup', 'input[numberOnly]')
4282        .on('keyup', 'input[numberOnly]', function(e) {
4283            var n = addCommas($(this).val().replace(/[^0-9.+-]/g, ""));
4284            $(this).val(n);
4285        });
4286
4287    function addCommas(x) {
4288        if (x.length == 0) return '';
4289        x = String(x);
4290        var l = x.split(""),
4291            zero = true;
4292        $.each(l, function(i, v) {
4293            if (x.charAt(0) == '+' || x.charAt(0) == '-') {
4294                var sign = x.charAt(0);
4295                if (x.charAt(1) == "0") {
4296                    x = x.substr(2);
4297                    x = sign + x;
4298                } else if (x.charAt(1) == '+' || x.charAt(1) == '-') {
4299                    x = x.substr(1);
4300                }
4301            } else if (x.charAt(0) == "0" && x.length > 1 && x.indexOf('.') == -1) {
4302                x = x.substr(1);
4303            }
4304        });
4305
4306        if (x.length > 0 && x.indexOf('.') > -1) return x;
4307        return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
4308    }
4309
4310    function removeCommas(x) {
4311        if (!x || x.length == 0) return "";
4312        if (x == "0" || x == 0) return 0;
4313        else return x.split(",").join("");
4314    }
4315
4316
4317    function inputNumberFormat(obj) {
4318        obj.value = comma(uncomma(obj.value));
4319    }
4320
4321    function comma(str) {
4322        str = String(str);
4323        return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
4324    }
4325
4326    function uncomma(str) {
4327        str = String(str);
4328        return str.replace(/[^\d]+/g, '');
4329    }
4330
4331
4332    function formTranslate(l) {
4333        if (l != 'ko') {
4334            $('select[form-type="select"] option:selected').text('Select');
4335        }
4336    }
4337
4338    function changeFavicon(src) {
4339        var head = document.head || document.getElementsByTagName('head')[0];
4340        var link = document.createElement('link'),
4341            oldLink = document.getElementById('dynamic-favicon');
4342
4343        if(!head || !src) return;
4344
4345        link.id = 'dynamic-favicon';
4346        link.type = 'image/x-icon';
4347        link.rel = 'icon';
4348        link.href = src;
4349        if (oldLink && oldLink.parentNode) {
4350            oldLink.parentNode.removeChild(oldLink);
4351        }
4352        head.appendChild(link);
4353    }
4354
4355    function occurrences(string, subString, allowOverlapping) {
4356        string += "";
4357        subString += "";
4358        if (subString.length <= 0) return (string.length + 1);
4359
4360        var n = 0,
4361            pos = 0,
4362            step = allowOverlapping ? 1 : subString.length;
4363
4364        while (true) {
4365            pos = string.indexOf(subString, pos);
4366            if (pos >= 0) {
4367                ++n;
4368                pos += step;
4369            } else break;
4370        }
4371        return n;
4372    }
4373
4374    function errorTag(tag) {
4375        var divStart = occurrences(tag, '<div', false),
4376            divEnd = occurrences(tag, '</div>', false);
4377
4378        if (divStart != divEnd) return true;
4379        return false;
4380    }
4381
4382
4383    function errorWorkingEmojisModal(closecallback, showcallback, hidecallback) {
4384        if ($('.cl-cmmodal.error-emoji').length > 0) return false;
4385
4386        if (typeof showcallback == 'undefined' || showcallback == '') {
4387            showcallback = function() {
4388                $('.modal-dialog.error-emoji').closest('.flat-modal').next('.modal-backdrop').attr('style', 'display: block; z-index: 1042!important;');
4389                $('.modal-dialog.error-emoji').closest('.modal').attr('style', 'display: block; z-index: 1043');
4390            }
4391        }
4392
4393        $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['config.working.emoji'], true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70 error-emoji', '', closecallback, showcallback, hidecallback);
4394    }
4395
4396    function errorEmojisModal(modal_zindex, closecallback, showcallback, hidecallback) {
4397        if ($('.cl-cmmodal.error-emoji').length > 0) return false;
4398        var modal_size = (typeof modal_zindex != 'undefined' && modal_zindex) ? 'zindex'+modal_zindex : 'zindex1043';
4399        $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['config.unable.emoji'], true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70 error-emoji '+modal_size, '', closecallback, showcallback, hidecallback);
4400    }
4401
4402    function checkEmojis(str) {
4403        var regex = /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff]|&zwj;)/g;
4404        return regex.test(str);
4405    }
4406
4407    function removeEmojis(str) {
4408        var regex = /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff]|&zwj;)/g;
4409        return str.replace(regex, '');
4410    }
4411
4412
4413
4414    function changeEmoji(str, op, usedDeferred) {
4415        if (typeof op == 'undefined' || (op != 'encode' && op != 'decode')) return str;
4416        if (typeof usedDeferred != 'boolean') usedDeferred = false;
4417
4418        if (usedDeferred) {
4419            var deferred = $.Deferred();
4420            $.post('/template/emoji', { str: str, op: op }, function(data) {
4421                deferred.resolve(data.str);
4422            }, 'json');
4423            return deferred.promise();
4424        } else {
4425            $.post('/template/emoji', { str: str, op: op }, function(data) {
4426                return data.str;
4427            }, 'json');
4428        }
4429    }
4430
4431
4432    function strReplace(str, searchStr, replaceStr) {
4433        return str.split(searchStr).join(replaceStr);
4434    }
4435
4436    function checkBase64Encode(str) {
4437        var regExp = /^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i;
4438        return (str.length % 4 == 0) && regExp.test(str);
4439    }
4440
4441    function number_format(val) {
4442        let parts = val.toString().split("."); 
4443        parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); 
4444        return parts.join(".");
4445    }
4446//
4447    function checkTemplateSite(sid) {
4448        var checkTemp = (PAGE_MODE == 'c') ? CHECKTEMP : property.CHECKTEMP;
4449        if(typeof checkTemp == 'undefined') return false;
4450        if (!sid || !checkTemp) return false;
4451        var templates_lang = ['ko', 'en'],
4452            // 라이브 백업 코드 
4453            // templates_org = ["pardinus","otocyon","fulica","phocoena","tremarctos","mysticetus","nigripes","pteromys","guanicoe","civettina","viverra","simensis", "euryzona", "leopardus", "gryphus", "rubicola", "wintoni", "iliensis", "javan", "acinonyx", "ochotona", "tayra", "fennec", "beluga", "itatsi", "pennantii", "luscinius", "kidogo", "rourei", "graysoni", "pagensis", "lilliae", "inscinius", "diazi", "gerpi", "lutreola", "walie", "gambieri", "saola", "waldeni", "indri", "jefferyi"],        
4454            templates_org = [
4455                "aves","habroptila","vultur","pardinus","otocyon","fulica","phocoena","tremarctos","mysticetus","nigripes","pteromys","guanicoe","civettina","viverra","simensis", "euryzona", "leopardus", "gryphus", "rubicola", "wintoni", "iliensis", "javan", "acinonyx", "ochotona", "tayra", "fennec", "beluga", "itatsi", "pennantii", "luscinius", "kidogo", "rourei", "graysoni", "pagensis", "lilliae", "inscinius", "diazi", "gerpi", "lutreola", "walie", "gambieri", "saola", "waldeni", "indri", "jefferyi", "theropithecus", "pelzelni",
4456                "template001", "template002", "template003", "template004", "template005", "template006", "template007", "template008", "template009",
4457                "plutolabs","smc","cloudia","eunoia","saladly",
4458                "academy02","academy03","academy04","academy05",
4459                "company02","company03","company04","company05","company06","company07",
4460                "beauty01","beauty02","beauty03","beauty04","beauty05","beauty06",
4461                "culture01","culture02","culture03","culture05","culture06","culture07","culture08",
4462                "sports03","sports04",
4463                "cafe04","cafe05",
4464                "house02","house05",
4465                "portfolio16","portfolio06","portfolio22","portfolio23",
4466                "product02","franchise01","franchise02",
4467                "business", "comingsoon", "portfolio", "restaurant", "studio"
4468            ],
4469            // templates_org = ["aves","habroptila","vultur","pardinus","otocyon","fulica","phocoena","tremarctos","mysticetus","nigripes","pteromys","guanicoe","civettina","viverra","simensis", "euryzona", "leopardus", "gryphus", "rubicola", "wintoni", "iliensis", "javan", "acinonyx", "ochotona", "tayra", "fennec", "beluga", "itatsi", "pennantii", "luscinius", "kidogo", "rourei", "graysoni", "pagensis", "lilliae", "inscinius", "diazi", "gerpi", "lutreola", "walie", "gambieri", "saola", "waldeni", "indri", "jefferyi", "theropithecus", "pelzelni",
4470            //                  "template001", "template002", "template003", "template004", "template005", "template006", "template007", "template008", "template009",
4471            //                  "plutolabs","smc","cloudia","eunoia","saladly",
4472            //                  "academy02","academy03","company02","company03","company04","company05","company06","company07",
4473            //                  "beauty01","beauty02","beauty03","beauty04","beauty05","beauty06","sports03","sports04","cafe04","cafe05","academy04","academy05",
4474            //                  "culture01","culture02","culture03","culture05","culture06","culture07","culture08","product02","house02","house05","portfolio06","portfolio16"],
4475            templates = [],
4476            templates_admin = [];
4477
4478
4479        $.each(templates_org, function(i, v) {
4480            $.each(templates_lang, function(a, b) {
4481                templates_admin.push(v + '_' + b);
4482            });
4483        });
4484
4485        templates = templates_admin.concat(templates_org);
4486
4487        var is_templates = ($.inArray(sid.toLowerCase(), templates) > -1) ? true : false;
4488
4489        return is_templates;
4490    }
4491
4492    jQuery.fn.serializeObject = function() {
4493        var obj = null;
4494        try {
4495            if (this[0].tagName && this[0].tagName.toUpperCase() == "FORM") {
4496                var arr = this.serializeArray();
4497                if (arr) {
4498                    obj = {};
4499                    jQuery.each(arr, function() {
4500                        obj[this.name] = this.value;
4501                    });
4502                } //if ( arr ) {
4503            }
4504        } catch (e) {
4505            alert(e.message);
4506        } finally {}
4507        return obj;
4508    }
4509
4510    function errorCss(css) {
4511        css = css.replace(/::/g, '');
4512        var cssStart = occurrences(css, '{', false),
4513            cssEnd = occurrences(css, '}', false),
4514            pStart = occurrences(css, ':', false),
4515            pEnd = occurrences(css, ';', false),
4516            min = occurrences(css, '(min-width', false),
4517            min2 = occurrences(css, '( min-width', false),
4518            max = occurrences(css, '(max-width', false),
4519            max2 = occurrences(css, '( max-width', false),
4520            hover = occurrences(css, ':hover', false),
4521            active = occurrences(css, ':active', false),
4522            focus = occurrences(css, ':focus', false),
4523            before = occurrences(css, ':before', false),
4524            after = occurrences(css, ':after', false),
4525            empty = occurrences(css, ':empty', false),
4526            not = occurrences(css, ':not', false),
4527            css_is = occurrences(css, ':is', false),
4528            checked = occurrences(css, ':checked', false),
4529            first = occurrences(css, ':first-child', false),
4530            last = occurrences(css, ':last-child', false),
4531            first_letter = occurrences(css, ':first-letter', false),
4532            first_line = occurrences(css, ':first-line', false),
4533            first_of_type = occurrences(css, ':first-of-type', false),
4534            nth = occurrences(css, ':nth', false),
4535            nth_even = occurrences(css, ':nth-child(even)', true),
4536            nth_odd = occurrences(css, ':nth-child(odd)', true),
4537            holder1 = occurrences(css, ':-webkit-input-placeholder', false),
4538            holder2 = occurrences(css, ':-moz-placeholder', false),
4539            holder3 = occurrences(css, ':-ms-input-placeholder', false),
4540            media_controls = occurrences(css, ':-webkit-media-controls', false),
4541            select_icon = occurrences(css, ':-ms-expand', false),
4542            scrollbar1 = occurrences(css, ':-webkit-scrollbar', false),
4543            scrollbar2 = occurrences(css, ':-webkit-scrollbar-track', false),
4544            scrollbar3 = occurrences(css, ':-webkit-scrollbar-thumbr', false),
4545            https = occurrences(css, 'https:', false),
4546            http = occurrences(css, 'http:', false);
4547
4548        if (rt_admin == "adm") {
4549            console.log('{', cssStart);
4550            console.log('}', cssEnd);
4551            console.log(':', pStart);
4552            console.log(';', pEnd);
4553            console.log('media css', (min + min2 + max + max2));
4554            console.log('hover', hover);
4555            console.log('active', active);
4556            console.log('focus', focus);
4557            console.log('before', before);
4558            console.log('after', after);
4559            console.log('empty', empty);
4560            console.log('not', not);
4561            console.log('css_is', css_is);
4562            console.log('checked', checked);
4563            console.log('first-child', first);
4564            console.log('last-child', last);
4565            console.log('first-letter', first_letter);
4566            console.log('first-line', first_line);
4567            console.log('first-of-type', first_of_type);
4568            console.log('nth', nth);
4569            console.log('nth-even', nth_even);
4570            console.log('nth-odd', nth_odd);
4571            console.log('holder', (holder1 + holder2 + holder3));
4572            console.log('video-controls(::-webkit-media-controls)', media_controls);
4573            console.log('select-icon(::-ms-expand)', select_icon);
4574            console.log('scrollbar', scrollbar1);
4575            console.log('scrollbar-track', scrollbar2);
4576            console.log('scrollbar-thumb', scrollbar3);
4577            console.log('https:', https);
4578            console.log('http:', http);
4579        }
4580        // if (cssStart != cssEnd) return true;
4581        // if (pStart != (pEnd + min + min2 + max + max2 + hover + active + focus + before + after + empty + not + css_is + checked + first + last + first_letter + first_line + first_of_type + nth + holder1 + holder2 + holder3 + media_controls + select_icon + scrollbar1 + scrollbar2 + scrollbar3 + https + http)) return true;
4582        // return false;
4583
4584        // 중괄호 중첩 체크
4585        let bracesError = checkBracesNested(css);
4586        if (bracesError) return bracesError;
4587
4588        // 주석 닫힘 체크
4589        let commentError = checkCommentClosed(css);
4590        if (commentError) return commentError;
4591        
4592        // 고유 클래스(.userEL숫자) 체크
4593        let errorMsg = hasUserELClass(css);
4594        if(errorMsg) return errorMsg;
4595
4596        return null;
4597    }
4598
4599    if (typeof(MD5_JS) == 'undefined') {
4600        var MD5_JS = true;
4601        var hexcase = 0;
4602        var b64pad = "";
4603        var chrsz = 8;
4604
4605        function hex_md5(s) { return binl2hex(core_md5(str2binl(s), s.length * chrsz)); }
4606
4607        function b64_md5(s) { return binl2b64(core_md5(str2binl(s), s.length * chrsz)); }
4608
4609        function str_md5(s) { return binl2str(core_md5(str2binl(s), s.length * chrsz)); }
4610
4611        function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
4612
4613        function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
4614
4615        function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
4616
4617        function core_md5(x, len) {
4618            x[len >> 5] |= 0x80 << ((len) % 32);
4619            x[(((len + 64) >>> 9) << 4) + 14] = len;
4620            var a = 1732584193;
4621            var b = -271733879;
4622            var c = -1732584194;
4623            var d = 271733878;
4624            for (var i = 0; i < x.length; i += 16) {
4625                var olda = a;
4626                var oldb = b;
4627                var oldc = c;
4628                var oldd = d;
4629                a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
4630                d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
4631                c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
4632                b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
4633                a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
4634                d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
4635                c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
4636                b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
4637                a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
4638                d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
4639                c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
4640                b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
4641                a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
4642                d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
4643                c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
4644                b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
4645                a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
4646                d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
4647                c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
4648                b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
4649                a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
4650                d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
4651                c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
4652                b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
4653                a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
4654                d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
4655                c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
4656                b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
4657                a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
4658                d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
4659                c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
4660                b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
4661                a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
4662                d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
4663                c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
4664                b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
4665                a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
4666                d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
4667                c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
4668                b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
4669                a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
4670                d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
4671                c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
4672                b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
4673                a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
4674                d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
4675                c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
4676                b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
4677                a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
4678                d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
4679                c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
4680                b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
4681                a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
4682                d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
4683                c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
4684                b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
4685                a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
4686                d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
4687                c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
4688                b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
4689                a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
4690                d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
4691                c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
4692                b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
4693                a = safe_add(a, olda);
4694                b = safe_add(b, oldb);
4695                c = safe_add(c, oldc);
4696                d = safe_add(d, oldd);
4697            }
4698            return Array(a, b, c, d);
4699        }
4700
4701        function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); }
4702
4703        function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }
4704
4705        function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }
4706
4707        function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
4708
4709        function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
4710
4711        function SHA256(s) {
4712            var chrsz   = 8;
4713            var hexcase = 0;
4714
4715            function safe_add (x, y) {
4716                var lsw = (x & 0xFFFF) + (y & 0xFFFF);
4717                var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
4718                return (msw << 16) | (lsw & 0xFFFF);
4719            }
4720
4721            function S (X, n) { return ( X >>> n ) | (X << (32 - n)); }
4722            function R (X, n) { return ( X >>> n ); }
4723            function Ch(x, y, z) { return ((x & y) ^ ((~x) & z)); }
4724            function Maj(x, y, z) { return ((x & y) ^ (x & z) ^ (y & z)); }
4725            function Sigma0256(x) { return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); }
4726            function Sigma1256(x) { return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); }
4727            function Gamma0256(x) { return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); }
4728            function Gamma1256(x) { return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); }
4729            function core_sha256(m, l) {
4730                var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 
4731                    0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 
4732                    0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 
4733                    0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 
4734                    0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 
4735                    0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 
4736                    0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 
4737                    0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 
4738                    0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 
4739                    0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 
4740                    0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2);
4741    
4742                var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
4743    
4744                var W = new Array(64);
4745                var a, b, c, d, e, f, g, h, i, j;
4746                var T1, T2;
4747         
4748                m[l >> 5] |= 0x80 << (24 - l % 32);
4749                m[((l + 64 >> 9) << 4) + 15] = l;
4750         
4751                for ( var i = 0; i<m.length; i+=16 ) {
4752                    a = HASH[0];
4753                    b = HASH[1];
4754                    c = HASH[2];
4755                    d = HASH[3];
4756                    e = HASH[4];
4757                    f = HASH[5];
4758                    g = HASH[6];
4759                    h = HASH[7];
4760         
4761                    for ( var j = 0; j<64; j++) {
4762                        if (j < 16) W[j] = m[j + i];
4763                        else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);
4764         
4765                        T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);
4766                        T2 = safe_add(Sigma0256(a), Maj(a, b, c));
4767         
4768                        h = g;
4769                        g = f;
4770                        f = e;
4771                        e = safe_add(d, T1);
4772                        d = c;
4773                        c = b;
4774                        b = a;
4775                        a = safe_add(T1, T2);
4776                    }
4777         
4778                    HASH[0] = safe_add(a, HASH[0]);
4779                    HASH[1] = safe_add(b, HASH[1]);
4780                    HASH[2] = safe_add(c, HASH[2]);
4781                    HASH[3] = safe_add(d, HASH[3]);
4782                    HASH[4] = safe_add(e, HASH[4]);
4783                    HASH[5] = safe_add(f, HASH[5]);
4784                    HASH[6] = safe_add(g, HASH[6]);
4785                    HASH[7] = safe_add(h, HASH[7]);
4786                }
4787                return HASH;
4788            }
4789            function str2binb (str) {
4790                var bin = Array();
4791                var mask = (1 << chrsz) - 1;
4792                for(var i = 0; i < str.length * chrsz; i += chrsz) {
4793                    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
4794                }
4795                return bin;
4796            }
4797         
4798            function Utf8Encode(string) {
4799                string = string.replace(/\r\n/g,"\n");
4800                var utftext = "";
4801         
4802                for (var n = 0; n < string.length; n++) {
4803         
4804                    var c = string.charCodeAt(n);
4805         
4806                    if (c < 128) {
4807                        utftext += String.fromCharCode(c);
4808                    }
4809                    else if((c > 127) && (c < 2048)) {
4810                        utftext += String.fromCharCode((c >> 6) | 192);
4811                        utftext += String.fromCharCode((c & 63) | 128);
4812                    }
4813                    else {
4814                        utftext += String.fromCharCode((c >> 12) | 224);
4815                        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
4816                        utftext += String.fromCharCode((c & 63) | 128);
4817                    }
4818         
4819                }
4820         
4821                return utftext;
4822            }
4823         
4824            function binb2hex (binarray) {
4825                var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
4826                var str = "";
4827                for(var i = 0; i < binarray.length * 4; i++) {
4828                    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
4829                    hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
4830                }
4831                return str;
4832            }
4833            
4834            s = Utf8Encode(s);
4835            return binb2hex(core_sha256(str2binb(s), s.length * chrsz));
4836        }
4837
4838        function core_hmac_md5(key, data) {
4839            var bkey = str2binl(key);
4840            if (bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
4841            var ipad = Array(16),
4842                opad = Array(16);
4843            for (var i = 0; i < 16; i++) {
4844                ipad[i] = bkey[i] ^ 0x36363636;
4845                opad[i] = bkey[i] ^ 0x5C5C5C5C;
4846            }
4847            var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
4848            return core_md5(opad.concat(hash), 512 + 128);
4849        }
4850
4851        function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }
4852
4853        function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
4854
4855        function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for (var i = 0; i < str.length * chrsz; i += chrsz) bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32); return bin; }
4856
4857        function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for (var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask); return str; }
4858
4859        function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for (var i = 0; i < binarray.length * 4; i++) str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); return str; }
4860
4861        function binl2b64(binarray) {
4862            var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
4862+/";
4863            var str = "";
4864            for (var i = 0; i < binarray.length * 4; i += 3) {
4865                var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
4866                for (var j = 0; j < 4; j++) {
4867                    if (i * 8 + j * 6 > binarray.length * 32) str += b64pad;
4868                    else
4869                        str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
4870                }
4871            }
4872            return str;
4873        }
4874    }
4875    var Base64 = {
4876        _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
4877        encode: function(input) {
4878            var output = "";
4879            var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
4880            var i = 0;
4881            input = Base64._utf8_encode(input);
4882            while (i < input.length) {
4883                chr1 = input.charCodeAt(i++);
4884                chr2 = input.charCodeAt(i++);
4885                chr3 = input.charCodeAt(i++);
4886                enc1 = chr1 >> 2;
4887                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
4888                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
4889                enc4 = chr3 & 63;
4890                if (isNaN(chr2)) { enc3 = enc4 = 64 } else if (isNaN(chr3)) { enc4 = 64 }
4891                output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4)
4892            }
4893            return output
4894        },
4895        decode: function(input) {
4896            var output = "";
4897            var chr1, chr2, chr3;
4898            var enc1, enc2, enc3, enc4;
4899            var i = 0;
4900            input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
4901            while (i < input.length) {
4902                enc1 = this._keyStr.indexOf(input.charAt(i++));
4903                enc2 = this._keyStr.indexOf(input.charAt(i++));
4904                enc3 = this._keyStr.indexOf(input.charAt(i++));
4905                enc4 = this._keyStr.indexOf(input.charAt(i++));
4906                chr1 = (enc1 << 2) | (enc2 >> 4);
4907                chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
4908                chr3 = ((enc3 & 3) << 6) | enc4;
4909                output = output + String.fromCharCode(chr1);
4910                if (enc3 != 64) { output = output + String.fromCharCode(chr2) }
4911                if (enc4 != 64) { output = output + String.fromCharCode(chr3) }
4912            }
4913            output = Base64._utf8_decode(output);
4914            return output
4915        },
4916        _utf8_encode: function(string) {
4917            string = string.replace(/\r\n/g, "\n");
4918            var utftext = "";
4919            for (var n = 0; n < string.length; n++) {
4920                var c = string.charCodeAt(n);
4921                if (c < 128) { utftext += String.fromCharCode(c) } else if ((c > 127) && (c < 2048)) {
4922                    utftext += String.fromCharCode((c >> 6) | 192);
4923                    utftext += String.fromCharCode((c & 63) | 128)
4924                } else {
4925                    utftext += String.fromCharCode((c >> 12) | 224);
4926                    utftext += String.fromCharCode(((c >> 6) & 63) | 128);
4927                    utftext += String.fromCharCode((c & 63) | 128)
4928                }
4929            }
4930            return utftext
4931        },
4932        _utf8_decode: function(utftext) {
4933            var string = "";
4934            var i = 0;
4935            var c = c1 = c2 = 0;
4936            while (i < utftext.length) {
4937                c = utftext.charCodeAt(i);
4938                if (c < 128) {
4939                    string += String.fromCharCode(c);
4940                    i++
4941                } else if ((c > 191) && (c < 224)) {
4942                    c2 = utftext.charCodeAt(i + 1);
4943                    string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
4944                    i += 2
4945                } else {
4946                    c2 = utftext.charCodeAt(i + 1);
4947                    c3 = utftext.charCodeAt(i + 2);
4948                    string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
4949                    i += 3
4950                }
4951            }
4952            return string
4953        }
4954    }
4955
4956
4957    /* new code 20240402 */
4958    var clmd5 = {
4959        hexcase: 0,
4960        b64pad: '',
4961        hex_md5: function(s) { return clmd5.rstr2hex(clmd5.rstr_md5(clmd5.str2rstr_utf8(s))); },
4962        b64_md5: function(s) { return clmd5.rstr2b64(clmd5.rstr_md5(clmd5.str2rstr_utf8(s))); },
4963        any_md5: function(s, e) { return clmd5.rstr2any(clmd5.rstr_md5(clmd5.str2rstr_utf8(s)), e); },
4964        hex_hmac_md5: function(k, d) { return clmd5.rstr2hex(clmd5.rstr_hmac_md5(clmd5.str2rstr_utf8(k), clmd5.str2rstr_utf8(d))); },
4965        b64_hmac_md5: function(k, d) { return clmd5.rstr2b64(clmd5.rstr_hmac_md5(clmd5.str2rstr_utf8(k), clmd5.str2rstr_utf8(d))); },
4966        any_hmac_md5: function(k, d, e) { return clmd5.rstr2any(clmd5.rstr_hmac_md5(clmd5.str2rstr_utf8(k), clmd5.str2rstr_utf8(d)), e); },
4967        rstr_md5: function(s) { return clmd5.binl2rstr(clmd5.binl_md5(clmd5.rstr2binl(s), s.length * 8)); },
4968        rstr_hmac_md5: function(key, data) {
4969            var bkey = clmd5.rstr2binl(key);
4970            if(bkey.length > 16) bkey = clmd5.binl_md5(bkey, key.length * 8);
4971
4972            var ipad = Array(16), opad = Array(16);
4973            for(var i = 0; i < 16; i++)
4974            {
4975                ipad[i] = bkey[i] ^ 0x36363636;
4976                opad[i] = bkey[i] ^ 0x5C5C5C5C;
4977            }
4978
4979            var hash = clmd5.binl_md5(ipad.concat(clmd5.rstr2binl(data)), 512 + data.length * 8);
4980            return clmd5.binl2rstr(clmd5.binl_md5(opad.concat(hash), 512 + 128));
4981        },
4982        rstr2hex: function(input) {
4983            try { clmd5.hexcase } catch(e) { clmd5.hexcase=0; }
4984            var hex_tab = clmd5.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
4985            var output = "";
4986            var x;
4987            for(var i = 0; i < input.length; i++)
4988            {
4989              x = input.charCodeAt(i);
4990              output += hex_tab.charAt((x >>> 4) & 0x0F)
4991                     +  hex_tab.charAt( x        & 0x0F);
4992            }
4993            return output;
4994        },
4995        rstr2b64: function(input) {
4996            try { clmd5.b64pad } catch(e) { clmd5.b64pad=''; }
4997            var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
4997+/";
4998            var output = "";
4999            var len = input.length;
5000            for(var i = 0; i < len; i += 3)
5001            {
5002              var triplet = (input.charCodeAt(i) << 16)
5003                          | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
5004                          | (i + 2 < len ? input.charCodeAt(i+2)      : 0);
5005              for(var j = 0; j < 4; j++)
5006              {
5007                if(i * 8 + j * 6 > input.length * 8) output += clmd5.b64pad;
5008                else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
5009              }
5010            }
5011            return output;
5012        },
5013        rstr2any: function(input, encoding) {
5014            var divisor = encoding.length;
5015            var i, j, q, x, quotient;
5016          
5017            /* Convert to an array of 16-bit big-endian values, forming the dividend */
5018            var dividend = Array(Math.ceil(input.length / 2));
5019            for(i = 0; i < dividend.length; i++)
5020            {
5021              dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
5022            }
5023          
5024            /*
5025             * Repeatedly perform a long division. The binary array forms the dividend,
5026             * the length of the encoding is the divisor. Once computed, the quotient
5027             * forms the dividend for the next step. All remainders are stored for later
5028             * use.
5029             */
5030            var full_length = Math.ceil(input.length * 8 /
5031                                              (Math.log(encoding.length) / Math.log(2)));
5032            var remainders = Array(full_length);
5033            for(j = 0; j < full_length; j++)
5034            {
5035              quotient = Array();
5036              x = 0;
5037              for(i = 0; i < dividend.length; i++)
5038              {
5039                x = (x << 16) + dividend[i];
5040                q = Math.floor(x / divisor);
5041                x -= q * divisor;
5042                if(quotient.length > 0 || q > 0)
5043                  quotient[quotient.length] = q;
5044              }
5045              remainders[j] = x;
5046              dividend = quotient;
5047            }
5048          
5049            /* Convert the remainders to the output string */
5050            var output = "";
5051            for(i = remainders.length - 1; i >= 0; i--)
5052              output += encoding.charAt(remainders[i]);
5053          
5054            return output;
5055        },
5056        str2rstr_utf8: function(input) {
5057            var output = "";
5058            var i = -1;
5059            var x, y;
5060          
5061            while(++i < input.length)
5062            {
5063              /* Decode utf-16 surrogate pairs */
5064              x = input.charCodeAt(i);
5065              y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
5066              if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
5067              {
5068                x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
5069                i++;
5070              }
5071          
5072              /* Encode output as utf-8 */
5073              if(x <= 0x7F)
5074                output += String.fromCharCode(x);
5075              else if(x <= 0x7FF)
5076                output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
5077                                              0x80 | ( x         & 0x3F));
5078              else if(x <= 0xFFFF)
5079                output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
5080                                              0x80 | ((x >>> 6 ) & 0x3F),
5081                                              0x80 | ( x         & 0x3F));
5082              else if(x <= 0x1FFFFF)
5083                output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
5084                                              0x80 | ((x >>> 12) & 0x3F),
5085                                              0x80 | ((x >>> 6 ) & 0x3F),
5086                                              0x80 | ( x         & 0x3F));
5087            }
5088            return output;
5089        },
5090        // str2rstr_utf16le: function(input) {
5091        //     var output = "";
5092        //     for(var i = 0; i < input.length; i++)
5093        //       output += String.fromCharCode( input.charCodeAt(i)        & 0xFF,
5094        //                                     (input.charCodeAt(i) >>> 8) & 0xFF);
5095        //     return output;
5096        // },
5097        // str2rstr_utf16be: function(input) {
5098        //     var output = "";
5099        //     for(var i = 0; i < input.length; i++)
5100        //       output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
5101        //                                      input.charCodeAt(i)        & 0xFF);
5102        //     return output;
5103        // },
5104        rstr2binl: function(input) {
5105            var output = Array(input.length >> 2);
5106            for(var i = 0; i < output.length; i++)
5107              output[i] = 0;
5108            for(var i = 0; i < input.length * 8; i += 8)
5109              output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
5110            return output;
5111        },
5112        binl2rstr: function(input) {
5113            var output = "";
5114            for(var i = 0; i < input.length * 32; i += 8)
5115              output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
5116            return output;
5117        },
5118        binl_md5: function(x, len) {
5119            /* append padding */
5120            x[len >> 5] |= 0x80 << ((len) % 32);
5121            x[(((len + 64) >>> 9) << 4) + 14] = len;
5122          
5123            var a =  1732584193;
5124            var b = -271733879;
5125            var c = -1732584194;
5126            var d =  271733878;
5127          
5128            for(var i = 0; i < x.length; i += 16)
5129            {
5130              var olda = a;
5131              var oldb = b;
5132              var oldc = c;
5133              var oldd = d;
5134          
5135              a = clmd5.md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
5136              d = clmd5.md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
5137              c = clmd5.md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
5138              b = clmd5.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
5139              a = clmd5.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
5140              d = clmd5.md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
5141              c = clmd5.md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
5142              b = clmd5.md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
5143              a = clmd5.md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
5144              d = clmd5.md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
5145              c = clmd5.md5_ff(c, d, a, b, x[i+10], 17, -42063);
5146              b = clmd5.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
5147              a = clmd5.md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
5148              d = clmd5.md5_ff(d, a, b, c, x[i+13], 12, -40341101);
5149              c = clmd5.md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
5150              b = clmd5.md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
5151          
5152              a = clmd5.md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
5153              d = clmd5.md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
5154              c = clmd5.md5_gg(c, d, a, b, x[i+11], 14,  643717713);
5155              b = clmd5.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
5156              a = clmd5.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
5157              d = clmd5.md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
5158              c = clmd5.md5_gg(c, d, a, b, x[i+15], 14, -660478335);
5159              b = clmd5.md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
5160              a = clmd5.md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
5161              d = clmd5.md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
5162              c = clmd5.md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
5163              b = clmd5.md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
5164              a = clmd5.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
5165              d = clmd5.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
5166              c = clmd5.md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
5167              b = clmd5.md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
5168          
5169              a = clmd5.md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
5170              d = clmd5.md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
5171              c = clmd5.md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
5172              b = clmd5.md5_hh(b, c, d, a, x[i+14], 23, -35309556);
5173              a = clmd5.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
5174              d = clmd5.md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
5175              c = clmd5.md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
5176              b = clmd5.md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
5177              a = clmd5.md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
5178              d = clmd5.md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
5179              c = clmd5.md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
5180              b = clmd5.md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
5181              a = clmd5.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
5182              d = clmd5.md5_hh(d, a, b, c, x[i+12], 11, -421815835);
5183              c = clmd5.md5_hh(c, d, a, b, x[i+15], 16,  530742520);
5184              b = clmd5.md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
5185          
5186              a = clmd5.md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
5187              d = clmd5.md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
5188              c = clmd5.md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
5189              b = clmd5.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
5190              a = clmd5.md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
5191              d = clmd5.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
5192              c = clmd5.md5_ii(c, d, a, b, x[i+10], 15, -1051523);
5193              b = clmd5.md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
5194              a = clmd5.md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
5195              d = clmd5.md5_ii(d, a, b, c, x[i+15], 10, -30611744);
5196              c = clmd5.md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
5197              b = clmd5.md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
5198              a = clmd5.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
5199              d = clmd5.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
5200              c = clmd5.md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
5201              b = clmd5.md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
5202          
5203              a = clmd5.safe_add(a, olda);
5204              b = clmd5.safe_add(b, oldb);
5205              c = clmd5.safe_add(c, oldc);
5206              d = clmd5.safe_add(d, oldd);
5207            }
5208            return Array(a, b, c, d);
5209        },
5210        md5_cmn: function(q, a, b, x, s, t) { return clmd5.safe_add(clmd5.bit_rol(clmd5.safe_add(clmd5.safe_add(a, q), clmd5.safe_add(x, t)), s),b); },
5211        md5_ff: function(a, b, c, d, x, s, t) { return clmd5.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); },
5212        md5_gg: function(a, b, c, d, x, s, t) { return clmd5.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); },
5213        md5_hh: function(a, b, c, d, x, s, t) { return clmd5.md5_cmn(b ^ c ^ d, a, b, x, s, t); },
5214        md5_ii: function(a, b, c, d, x, s, t) { return clmd5.md5_cmn(c ^ (b | (~d)), a, b, x, s, t); },
5215        safe_add: function(x, y) {
5216            var lsw = (x & 0xFFFF) + (y & 0xFFFF);
5217            var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
5218            return (msw << 16) | (lsw & 0xFFFF);
5219        },
5220        bit_rol: function(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
5221    }
5222
5223    $('.newcheckbox').live('click', function() {
5224        var checkCollection = $(this).parents('.collection-item').length;
5225        if (checkCollection < 1) {
5226            if ($(this).hasClass('disabled')) {
5227                return false;
5228            }
5229        }
5230    });
5231
5232
5233    var setPanelTranslate = function(obj) {
5234        $.each(obj.find('[data-title]'), function(i, v) {
5235            var el_title = $(this).attr('data-title'),
5236                lang_check = /[ㄱ-ㅎㅏ-ㅣ가-힣]/,
5237                el_title_lang = (lang_check.test(el_title)) ? 'ko' : 'en',
5238                arr = $.lang[el_title_lang];
5239            if ($(this).parent().hasClass('gallery-item')) return true;
5240            key = getKeyByValue(arr, el_title);
5241
5242            if (key && el_title_lang != LANG) $(this).attr('data-title', $.lang[LANG][key]);
5243            if (typeof $.lang['en'][key] != 'undefined') $(this).attr('data-subtitle', $.lang['en'][key].toLowerCase().replace(/\s/g, '-'));
5244        });
5245    }
5246
5247    var cutStrInBytes = function(str, limit) {
5248        var size = 0;
5249        for (var i = 0; i < str.length; i++) {
5250            size += (str.charCodeAt(i) > 128) ? 2 : 1;
5251            if (size > limit) return str.substring(0, i) + '...';
5252        }
5253        return str;
5254    }
5255
5256    var initSyncField = function(tmpEL, elsettings) {
5257        if(tmpEL.is('[data-init="true"]')) return true;
5258        tmpEL.attr('data-init','true');
5259
5260        var elviewpage = (tmpEL.is('.el_viewblock')) ? true : false;
5261
5262        var el = tmpEL.attr('data-el'),
5263            elid = tmpEL.attr('data-id'),
5264            elname = tmpEL.attr('data-name'),
5265            elcss = (elviewpage) ? '' : CSSJSON.toJSON($('#'+el+'css').text()),
5266            elstyle = (elviewpage) ? {} : style.get(elcss,`.${elname}`);
5267
5268        if(tmpEL.find('input.sync-option').length > -1) {
5269            if(elviewpage) {
5270                elstyle = {
5271                    __layout_col_p: getComputedStyle(document.querySelector('.el_viewblock')).getPropertyValue('--layout-col-p') || 1,
5272                    __layout_col_t: getComputedStyle(document.querySelector('.el_viewblock')).getPropertyValue('--layout-col-t') || 1,
5273                    __layout_col_m: getComputedStyle(document.querySelector('.el_viewblock')).getPropertyValue('--layout-col-m') || 1,
5274                    __layout_imgh: getComputedStyle(document.querySelector('.el_viewblock')).getPropertyValue('--layout-imgh') || 1,
5275                }
5276            }
5277
5278            tmpEL.find('input.sync-option')
5279                .attr('data-col-p', elstyle.__layout_col_p)
5280                .attr('data-col-t', elstyle.__layout_col_t)
5281                .attr('data-col-m', elstyle.__layout_col_m)
5282                .attr('data-imgh', elstyle.__layout_imgh);
5283        }
5284
5285        var field = [],
5286            field_template = {
5287                'brand': {
5288                    'html_ko': '<div class="brand"></div>',
5289                    'html_en': '<div class="brand"></div>',
5290                },
5291                'name': {
5292                    'html_ko': '<div class="name"></div>',
5293                    'html_en': '<div class="name"></div>',
5294                },
5295                'caption': {
5296                    'html_ko': '<div class="caption"></div>',
5297                    'html_en': '<div class="caption"></div>',
5298                },
5299                'price': {
5300                    'html_ko': '<ul class="price-wrap"><li class="price-sale">40,000원</li><li class="price">34,400원</li><li class="sale">24%</li></ul>',
5301                    'html_en': '<ul class="price-wrap"><li class="price-sale">₩40,000</li><li class="price">₩34,400</li><li class="sale">24%</li></ul>',
5302                },
5303                //script append
5304                'price_unit_pricing': {
5305                    'html_ko': '<li class="price-unit-pricing"></li>',
5306                    'html_en': '<li class="price-unit-pricing"></li>',
5307                },
5308                'price_soldout': {
5309                    'html_ko': '<li class="soldout hidden>품절</li>',
5310                    'html_en': '<li class="soldout hidden">Sold out</li>',
5311                }
5312
5313            };
5314    }
5315    var showHideSyncField = function(elObj, elsettings) {
5316        initSyncField(elObj, elsettings);
5317
5318        var off_field = (typeof elsettings.field_disable != 'undefined') ? elsettings.field_disable : [];
5319        $.each(off_field, function(i,k) {
5320            var tmp_k = k;
5321            if(k == 'title') tmp_k = 'name';
5322            else if(k == 'price') tmp_k += ', .sync-item .sale, .
5322sync-item .price-sale, .sync-item .soldout';
5323
5324            if($.inArray(k, off_field) > -1) {
5325                var sync_field = $(elObj).find(`.sync-item .${tmp_k}`);
5326                sync_field.addClass('hide');
5327                if(typeof PAGE_MODE != 'undefined' && PAGE_MODE != 'c') sync_field.empty();
5328            }
5329        });
5330    }
5331
5332    var initGalleryField = function(tmpEL) {
5333        var initcheck = tmpEL.is('.grid') ? tmpEL.closest('.element').is('[data-init="true"]') : tmpEL.is('[data-init="true"]');
5334        if(initcheck) return true;
5335        tmpEL.is('.grid') ? tmpEL.closest('.element').attr('data-init','true') : tmpEL.attr('data-init','true');
5336
5337        var field = ['comment','like','basket'];
5338        var field_template = {
5339                'title': {
5340                    'html_ko': '<h5 class="figure title">제목을 입력해 주세요.</h5>',
5341                    'html_en': '<h5 class="figure title">Enter a title here.</h5>',
5342                },
5343                'caption': {
5344                    'html_ko': '<p class="figure caption">내용을 입력해 주세요.</p>',
5345                    'html_en': '<p class="figure caption">Enter a content here.</p>',
5346                },
5347                'price': {
5348                    'html_ko': '<ul class="figure price"><li class="price-val">120,000원</li><li class="price-sale hide"></li><li class="price-sale-per hide"></li></ul>',
5349                    'html_en': '<ul class="figure price"><li class="price-val">₩120,000</li><li class="price-sale hide"></li><li class="price-sale-per hide"></li></ul>',
5350                },
5351                'review': {
5352                    'html_ko': '<ul class="figure review"><li class="review-cnt">리뷰 <span class="figure-review-cnt">3</span></li><li class="review-score">평점 <span class="figure-review-score">4.8</span></li></ul>',
5353                    'html_en': '<ul class="figure review"><li class="review-cnt">Review <span class="figure-review-cnt">3</span></li><li class="review-score">Ratings <span class="figure-review-score">4.8</span></li></ul>',
5354                },
5355                'comment': {
5356                    'html_ko': '<div class="figure comment hide" data-style="@iconstyle">@icon<span class="figure-comment-cnt">0</span></div>',
5357                    'html_en': '<div class="figure comment hide" data-style="@iconstyle">@icon<span class="figure-comment-cnt">0</span></div>',
5358                    'iconstyle': {
5359                        'default': clSVG(`field_comment`,16,16,true,`figure-comment-icon`)
5360                    }
5361                },
5362                'like': {
5363                    'html_ko': '<div class="figure like hide" data-style="@iconstyle">@icon<span class="figure-like-cnt">0</span></div>',
5364                    'html_en': '<div class="figure like hide" data-style="@iconstyle">@icon<span class="figure-like-cnt">0</span></div>',
5365                    'iconstyle': {
5366                        'default': clSVG(`field_like`,16,16,true,`figure-like-icon`)
5367                    }
5368                },
5369                'basket': {
5370                    'html_ko': '<div class="figure basket hide"><span class="basket-btn">장바구니 담기</span></div>',
5371                    'html_en': '<div class="figure basket hide"><span class="basket-btn">Add to cart</span></div>',
5372                },
5373
5374            };
5375
5376        var gitem = (tmpEL.is('.grid')) ? tmpEL.eq(0) : tmpEL.find('.grid').eq(0);
5377        var target = gitem.find('.figure').length > 0 ? gitem.find('.figure').last().attr('class').trim().replace(/ /gi,'.') : '';
5378
5379        if(target == 'figure') {
5380            if(gitem.find('.figure').last().is('h5')) target = `h5.figure`;
5381            else if(gitem.find('.figure').last().is('p')) target = `p.figure`;
5382            else target = '';
5383        }
5384        if(target == '') field = [];
5385
5386
5387        $.each(field, function(i,k) {
5388            if(typeof field_template[k] == 'undefined') return true;
5389            var tmp_check = (gitem.find(`.figure.${k}`).length > 0) ? true : false;
5390            var tmp_lang = 'ko';
5391            var tmp_html = (typeof field_template[k]['html_'+tmp_lang] != 'undefined') ? field_template[k]['html_'+tmp_lang] : '';
5392            var tmp_iconstyle = (typeof gitem.find(`.figure.${k}`).attr('data-style') != 'undefined') ? gitem.find(`.figure.${k}`).attr('data-style') : 'default';
5393            var tmp_icon = (typeof field_template[k]['iconstyle'] != 'undefined' && typeof field_template[k]['iconstyle'][tmp_iconstyle] != 'undefined') ? field_template[k]['iconstyle'][tmp_iconstyle] : '';
5394            if(tmp_icon == '') tmp_iconstyle = '';
5395
5396            if(tmp_check) {
5397                if(tmp_icon != '') {
5398                    tmpEL.find(`.figure.${k} > svg, .figure.${k} > .figure-${k}-icon`).remove();
5399                    tmpEL.find(`figcaption:not(.top) .figure.${k}`).attr('data-style',tmp_iconstyle).prepend(tmp_icon);
5400                }
5401            } else {
5402                tmpEL.find(`figcaption:not(.top) .figure.${k}`).remove();
5403                tmpEL.find(`figcaption:not(.top) .${target}`).after(tmp_html.replace(/\@iconstyle/,tmp_iconstyle).replace(/\@icon/,tmp_icon));
5404                target = `figure.${k}`;
5405            }
5406        });
5407    }
5408    var showHideGalleryField = function(elObj, elsettings) {
5409        initGalleryField(elObj);
5410
5411        if (typeof elsettings == 'undefined' ||
5412            $.isEmptyObject(elsettings)
5413        ) {
5414            return false;
5415        }
5416
5417        var gVALIDTYPE = (PAGE_MODE == 'c') ? VALIDTYPE : property.VALIDTYPE;
5418        var gLANG = (PAGE_MODE == 'c') ? LANG : property.LANG;
5419        var gLUX = (PAGE_MODE == 'c') ? LUX : property.LUX;
5420
5421        var el_mode = elObj.attr('data-mode');
5422        var el_seq = elObj.attr('data-id');
5423        var checkPublishMode = (PAGE_MODE != 'c' && typeof property != 'undefined' && property.PUBLISH);
5424        var checkEmpty = elObj.find('[data-loop="true"]').is(':empty');
5425        var checkGalleryField = (elObj.find('h5.figure').eq(0).hasClass('title')) ? true : false;
5426
5427        if(elObj.find('.layout-container').length > 0 && elObj.find('.layout-row').length === 0) elObj.find('[data-loop="true"]').addClass('layout-row');
5428
5429        if(checkEmpty) {
5430            var tmp_description = (el_seq == 'all_products') ? $.lang[LANG]['editor.gallery.product.empty.list'] : $.lang[LANG]['editor.gallery.category.empty.list'];
5431            if(gLUX) tmp_description = $.lang[LANG]['editor.gallery.product.empty.list'];
5432            elObj.find('[data-loop="true"]').removeAttr('style').empty().attr('data-description',tmp_description);
5433            return false;
5434        } else if(!checkGalleryField) {
5435            var $numberField = elObj.find('.figure.number');
5436            var numberDisabled = ($.inArray('number', getOrDefault(elsettings,'field_disable',[])) > -1);
5437            if(numberDisabled) $numberField.addClass('hide');
5438              else $numberField.removeAttr('style').removeClass('hide');
5439            return false;
5440        }
5441
5442        if(checkPublishMode && el_mode != 'shopping' && el_seq != 'all_products') {
5443            elObj.find('.figure.brand, .figure.price, .figure.review, .figure.basket').remove();
5444        }
5445
5446        var gfield_all = ['brand','title','caption','price','review_cnt','review_score','comment','number','basket','like','basket'];
5447        var gfield_oldver = getOrDefault(elsettings,'field_oldver',[]);
5448        var gfield_disable = getOrDefault(elsettings,'field_disable',[]);
5449        var gfield_listSet = (typeof el_mode != 'undefined') ? ['title', 'caption'] : [];
5450        if (typeof el_mode != 'undefined' && el_mode == 'shopping') {
5451            gfield_listSet = ['title', 'caption', 'price', 'review_cnt', 'review_score', 'basket'];
5452            if (typeof LUX != 'undefined' ? LUX : property.LUX) gfield_listSet.push('brand');
5453            if ( elObj.find('.goption[data-basket-disabled="true"]').lenght > 0
5454                || gfield_disable.indexOf('basket') < 0 && gfield_oldver.indexOf('basket') < 0 && elObj.find('.figure.basket:not([data-oldver])').length == 0
5455                || (gVALIDTYPE != 'SM' && gfield_disable.indexOf('basket') < 0)
5456            ) {
5457                gfield_disable.push('basket');
5458            }
5459            if (typeof el_seq != 'undefined' && el_seq == 'all_products') gfield_disable = [];
5460        } else if (typeof el_mode != 'undefined' && el_mode == 'project') {
5461            gfield_listSet = ['title', 'caption', 'comment', 'like'];
5462        } else if (typeof el_mode != 'undefined' && el_mode == 'gallery') {
5463            gfield_listSet = ['title', 'caption', 'like'];
5464        }
5465
5466        if (elObj.find('.figure.number').length > 0) gfield_listSet.push('number');
5467        if (elObj.find('.figure.like').length > 0) elObj.find('.figure.like').addClass('hide');
5468
5469        $.each(gfield_all, function(g_i, g_v) {
5470            var onoff = ($.inArray(g_v, gfield_disable) > -1) ? false : true;
5471            if (onoff && $.inArray(g_v, gfield_listSet) == -1) onoff = false;
5472            if(g_v == 'comment' && !(typeof elsettings.comment_display != 'undefined' && elsettings.comment_display != 'OFF')) onoff = false;
5473            if(g_v == 'like' && !(typeof elsettings.like_display != 'undefined' && elsettings.like_display != 'N')) onoff = false;
5474
5475            var checkReviewField = (g_v.match(/^review_/gi) !== null) ? true : false;
5476            if (checkReviewField) {
5477                elObj.find('.figure.review').attr(`data-${g_v}`, onoff);
5478            } else {
5479                if (onoff) {
5480                    elObj.find(`.figure.${g_v}`).each(function(i, tmp) {
5481                        if (  (g_v == 'comment' && Number($(tmp).find('figure-comment-cnt').text()) == 0) ||
5482                              (g_v == 'basket' && $(this).hasClass('cannotby'))
5483                        ) {
5484                            return true;
5485                        }
5486                        $(this).removeAttr('style');
5487                        $(this).removeClass('hide');
5488                    });
5489                } else {
5490                    elObj.find(`.figure.${g_v}`).each(function() { 
5491                        $(this).addClass('hide'); 
5492                    });
5493                }
5494            }
5495        });
5496
5497        elObj.find('.grid figcaption').each(function() {
5498            if($(this).find('.figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length > 0 && $(this).height() > 0) {
5499                $(this).removeClass('allhide');
5500            } else {
5501                $(this).addClass('allhide');
5502            }
5503        });
5504
5505        if( elObj.is('[data-msny="true"]') 
5506            && typeof elObj.find('[data-loop="true"]').data('masonry') != 'object'
5507            && ($('.dsgn-body').hasClass('mode-config') || elObj.is('.el_viewblock'))
5508        ) {
5509            reloadBlockMasonry('init',elObj);
5510        }
5511
5512        if(elObj.find('.emptyGalleryItem').length > 0) elObj.find('[data-loop]').addClass('sample-loop');
5513
5514        elObj.find('._aosReloadPoint').remove();
5515        elObj.find('.grid').last().prepend('<input type="hidden" class="_aosReloadPoint">');
5516    }
5517
5518    var refreshGallerySwiperHeight = function(el) {
5519        if (typeof el == 'undefined' || !el || $(el).length == 0 || $(el).length > 1) return false;
5520        if ($(el).find('.empty-txt').length > 0 || $(el).find('.grid').length == 0) return false;
5521
5522        var swiper_elname = $(el).attr('data-name'),
5523            swp_h = getComputedStyle(document.querySelector('.' + swiper_elname)).getPropertyValue('--swiper-height');
5524        if (typeof swp_h != 'undefined' && swp_h) {
5525            var gel = $(el).find('.grid').eq(0),
5526                gw = parseFloat(gel[0].getBoundingClientRect().width),
5527                gpl = parseFloat(gel.css('padding-left').replace(/[^0-9]/g, '')),
5528                gpr = parseFloat(gel.css('padding-right').replace(/[^0-9]/g, ''));
5529
5530            if ($(el).is('.reorderBlock')) {
5531                gw = parseFloat(gw * 5);
5532                gpl = parseFloat(gpl * 5);
5533                gpl = parseFloat(gpl * 5);
5534            }
5535            var swp_wrap_h = (gw - (gpl + gpr)) * parseFloat(swp_h);
5536            $(el).find('.swiper-wrapper').css('height', parseFloat(swp_wrap_h) + 'px');
5537        }
5538    }
5539
5540
5541    var getDsgnBodyChild = function(el) {
5542        const nodeEl = (el instanceof jQuery) ? el[0] : el;
5543        if (!nodeEl) return null;
5544
5545        const body = nodeEl.closest('.dsgn-body');
5546        if (!body) return null;
5547
5548        let node = nodeEl;
5549        while (node && node.parentElement !== body) {
5550            node = node.parentElement;
5551        }
5552
5553        return node;
5554    }
5555
5556    $(document).on('click','.cl-gtoolbar .cl-gsort .cl-gsort-btn', function(e) {
5557        $(this).closest('.cl-gsort').toggleClass('open');
5558    });
5559
5560    var getGToolbar = function(el) {
5561        let $el = (el instanceof jQuery) ? el : $(el);
5562
5563        let $gtoolbar = $el.find('.cl-gtoolbar');
5564
5565        if($gtoolbar.length === 0) {
5566            const $parentElem = $el.closest('.elem');
5567            $gtoolbar = $parentElem.find('.cl-gtoolbar');
5568        }
5569
5570        return $gtoolbar;
5571    }
5572
5573    var initGToolbar = function(el, obj) {
5574        const $el = el;
5575        if ($el.length == 0) {
5576            console.log('undefined Target..');
5577            return false;
5578        }
5579
5580        const opts = {
5581            id: $el.attr('data-id'),
5582            total: 0,
5583            settings: {},
5584            ...(obj ?? {})
5585        };
5586
5587        if(!opts.id) {
5588            console.log('undefined Target id..');
5589            return false;
5590        }
5591
5592        var tmp_deferred = $.Deferred();
5593        if (typeof isElviewPage != 'undefined' && isElviewPage === true) {
5594        } else if ($.isEmptyObject(opts.settings)) {
5595            $.getJSON('/template/element/type/get/seq/' + opts.id, function(data) {
5596                checkError(data);
5597                opts.settings = (data[0] && data[0].elsettings) ? JSON.parse(data[0].elsettings) : {};
5598                if(opts.id === 'all_products') opts.total = data[0]?.total?.conf_total ?? 0;
5599                tmp_deferred.resolve(opts);
5600            });
5601        } else {
5602            tmp_deferred.resolve(opts);
5603        }
5604
5605        tmp_deferred.promise().then(function(d) {
5606            if(d.id === 'all_products') setGToolbarAllProducts($el, d.settings, d.total);
5607            else setGToolbarGallery($el, d.id, d.settings);
5608        });
5609    }
5610
5611    var addGToolbar = function(add_target, add_gtoolbar) {
5612        const $addTarget = $(add_target);
5613        if($addTarget.length === 0) return;
5614        else if($addTarget.length > 1) add_gtoolbar = null;
5615
5616        const isAdd = (typeof add_gtoolbar !== 'undefined' && $(ad
5616d_gtoolbar).is('.cl-gtoolbar')) ? true : false;
5617
5618        $addTarget.each(function() {
5619            const $el = $(this);
5620            const el = $el.attr('data-el');
5621            const elname = $el.attr('data-name');
5622            const elfeature = $el.attr('data-feature') || '';
5623            const elcase = $el.attr('data-case') || '';
5624            const elcss_str = $(`#${el}css`).text();
5625            const elcss = CSSJSON.toJSON(elcss_str);
5626            const elselector = `.${elname}`;
5627            const elstyle = style.get(elcss,elselector);
5628
5629            const gtoolbar_selector = `.cl-gtoolbar-${elname}`;
5630            const gtoolbar_style = style.get(elcss,gtoolbar_selector);
5631            const checkLatestVer = !gtoolbar_style.undefined;
5632
5633            if(isAdd) {
5634                const $gtoolbarNow = getGToolbar($el);
5635                $gtoolbarNow.remove();
5636                if(!checkLatestVer) $el.find('.gallery-category-wrap').remove();
5637
5638                const $gtoolbar = $(add_gtoolbar).clone(true);
5639
5640                if(!$gtoolbar.find('.row').is(':empty')) {
5641                    const orgblock_obj = {
5642                        'gallery45': {selector:'.right-wrap', position:'prepend'}
5643                    };
5644                    const custom = getOrDefault(orgblock_obj,elcase,{});
5645                    const checkCustom = (getOrDefault(custom,'selector','') != '' && $el.find(custom.selector).length > 0) ? true : false;
5646
5647                    const space = cssNumber(getElementRootCss($el,'--fullwidth-space','15px'));
5648                    if(space > 0) setElementRootCss($gtoolbar.find('.container'),{'--fullwidth-space':`${space}px`});
5649
5650                    const isFullwidth = ($el.find('.container.full-width').length > 0) ? true: false;
5651                    $gtoolbar.find('.container').toggleClass('full-width', isFullwidth);
5652                    $gtoolbar.find('.container').toggleClass('init-space-on', isFullwidth && space === 0);
5653
5654                    if($gtoolbar.is('[data-sticky="ON"]') 
5655                        && $el.is('[data-aos], [data-parallax="true"][data-parallax-effect="scroll"]')
5656                    ) {
5657                        if($el.closest('.elem').length < 1) console.log('null');
5658
5659                        $el.closest('.elem').prepend($gtoolbar);
5660                    }
5661                    else if(checkCustom) {
5662                        switch(custom.position) {
5663                            case 'prepend':
5664                                $el.find(custom.selector).prepend($gtoolbar);
5665                                break;
5666                            case 'append':
5667                                $el.find(custom.selector).append($gtoolbar);
5668                                break;
5669                            case 'before':
5670                                $el.find(custom.selector).before($gtoolbar);
5671                                break;
5672                            case 'after':
5673                                $el.find(custom.selector).after($gtoolbar);
5674                                break;
5675                            default:
5676                                $el.prepend($gtoolbar);
5677                                break;
5678                        }
5679                    }
5680                    else if($el.is('[data-type2="premium"]') || $el.has('input.gjs').length) {
5681                        const g_name = $el.attr('data-name');
5682                        const gjs_name = $el.find('.gjs').attr('data-js');
5683                        const gjs_code = $el.find('.gjs').attr('data-js-code');
5684                        const gjs = gjs_name + gjs_code;
5685                        let gcate_obj = {
5686                            'touchslider1': '.ts-container',
5687                            'fixedscroll1': '.fixed-wrap',
5688                            'fixedscroll2': '.fixed-wrap',
5689                        };
5690
5691                        if(elfeature) {
5692                            gcate_obj = {
5693                                'touchslider1': '.ts-container',
5694                                'fixedscroll1': '.content-wrap',
5695                                'fixedscroll2': '.content-wrap',
5696                            };
5697                        }
5698
5699                        const gcate_position = getOrDefault(gcate_obj,gjs,'') || $el.find('.gjs').attr('data-js-selector');
5700                        if(gcate_position && $el.find(gcate_position).length > 0) $el.find(gcate_position).before($gtoolbar);
5701                    }
5702                    else if($el.children('input[type="hidden"]').length > 0) {
5703                        $el.children('input[type="hidden"]').last().after($gtoolbar);
5704                    }
5705                    else {
5706                        $el.prepend($gtoolbar);
5707                    }
5708                }
5709            }
5710
5711            const $gtoolbarDom = getGToolbar($el);
5712            const checkUsedElem = ($gtoolbarDom.closest('.elem.elem-visible').length > 0) ? true : false;
5713            if(isAdd && !checkLatestVer) {
5714                const set_style = {};
5715
5716                const gcate_align_init = {left: 'flex-start', center: 'center', right: 'flex-end'};
5717                const old_warp_style = style.get(elcss,`${elselector} .gallery-category-wrap`);
5718                const old_gtoolbar_style = style.get(elcss,`${elselector} .cl-gtoolbar`);
5719                let old_align = 'flex-start';
5720                if(!old_gtoolbar_style.undefined) old_align = getOrDefault(old_gtoolbar_style,'--gcate-align','');
5721                else if(!old_warp_style.undefined) old_align = gcate_align_init?.[old_warp_style.txAlign];
5722                if(getElementRootCss($gtoolbarDom,'--gcate-align','') !== old_align) {
5723                    set_style['--gcate-align'] = old_align;
5724                }
5725
5726                const gcate_bgcolor_init = (elcase == 'gallery43') ? '#abb1b8' : '#ffffff';
5727                const old_bgcolor = getOrDefaultRootcss(elstyle,'__gcate_background',gcate_bgcolor_init,elselector);
5728                set_style['--gtoolbar-bgcolor'] = old_bgcolor;
5729
5730                const old_font_style = style.get(elcss,`${elselector} .gallery-category-nav li a`);
5731                if(!old_font_style.undefined) {
5732                    if(old_font_style?.txName) set_style['--gcate-fname'] = old_font_style.txName;
5733                    if(old_font_style?.txSize) set_style['--gcate-fsize'] = `${old_font_style.txSize}px`;
5734                    if(old_font_style?.txWeight) set_style['--gcate-fweight'] = old_font_style.txWeight;
5735                }
5736
5737                const old_color_style = style.get(elcss,`${elselector} .gallery-category-nav li:not(.active) a,${elselector} .gallery-category-nav li:not(.active):before`);
5738                if(!old_color_style.undefined) {
5739                    if(old_color_style?.txColor) set_style['--gcate-color'] = old_color_style.txColor;
5740                }
5741                const old_color2_style = style.get(elcss,`${elselector} .gallery-category-nav li.active a,${elselector} .gallery-category-nav li a:hover,${elselector} .gallery-category-nav li a:focus,${elselector} .gallery-category-nav li.active:after`);
5742                if(!old_color2_style.undefined) {
5743                    if(old_color2_style?.txColor) set_style['--gcate-color-active'] = old_color2_style.txColor;
5744                }
5745
5746                setElementRootCss($gtoolbarDom,set_style);
5747            }
5748
5749            if(checkUsedElem) {
5750                setElementRootCss($gtoolbarDom.closest('.elem'),{'--gtoolbar-h':`${$gtoolbarDom[0].offsetHeight}px`});
5751            }
5752
5753            if(!$.clnav.check()) {
5754                setElementRootCss('html',{'--header-height':`${$('.dsgn-body').hasClass('sidebar') ? 0 : $('header').outerHeight()}px`});
5755
5756                var is_config = $('body').hasClass('mode-config');
5757                var is_overlap = (typeof property != 'undefined') ? property.HEADER : HEADER;
5758                var is_el0 = $el.is('[data-el="el_0"]');
5759                $gtoolbarDom.toggleClass('top0', (is_config && !(is_overlap && is_el0)) ? true : false);
5760            }
5761
5762            if(PAGE_MODE == 'c' && $('#el-blockConfig.open').length > 0) {
5763                $gtoolbarDom.find('.cl-gsort').toggleClass('open', ($('#el-blockConfig.open #bc-default-config-list .ctrl-btn.active.open[data-list="gallery_sort_product"]').length > 0) ? true : false);
5764            }
5765        });
5766
5767
5768        $('html').toggleClass('gtoolbar-sticky-ON', $('.cl-gtoolbar[data-sticky="ON"]').length > 0 ? true : false);
5769    }
5770
5771    var setGToolbarGallery = function(target, id, s) {
5772        const $el = $(target);
5773        if($el.length === 0) return;
5774
5775        const el = $el.attr('data-el');
5776        const elname = $el.attr('data-name');
5777        const elcss_str = $(`#${el}css`).text();
5778        const elcss = CSSJSON.toJSON(elcss_str);
5779
5780        const gtoolbar_selector = `.cl-gtoolbar-${elname}`;
5781        const gtoolbar_style = style.get(elcss,gtoolbar_selector);
5782        const checkLatestVer = !gtoolbar_style.undefined;
5783
5784        const $gtoolbar = $(`
5785            <div class="cl-gtoolbar cl-gtoolbar-${$el.attr('data-name')}" 
5786                data-mode="gallery"
5787                data-lang="${LANG}"
5788                data-sticky="${getOrDefault(s,'category_sticky','OFF')}"
5789                data-gcate-style="${getOrDefault(gtoolbar_style,'__gcate_style','default')}"
5790            >
5791                <div class="container">
5792                    <div class="row">
5793
5794                        <template class="cl-gcate"></template>
5795                        <template class="cl-gsort"></template>
5796
5797                    </div>
5798                </div>
5799            </div>
5800        `);
5801
5802        // gallery category (gcate)
5803        const gcate_display = getOrDefault(s,'category_display','OFF');
5804        if(gcate_display === 'ON') {
5805            const $gCate = $(`
5806                <div class="cl-gcate">
5807                    <ul class="cl-gcate-list"></ul>
5808                </div>
5809            `);
5810
5811            let gcate_list = getOrDefault(s,'category','').replace(/\|/g, '').replace(/\,/g, ',').split(',').filter(v => v.trim() !== '');
5812            if(gcate_list.length < 1) gcate_list = ['Category1', 'Category2', 'Category3'];
5813            gcate_list.unshift(getOrDefault(s,'category_home','All'));
5814
5815            const gcate_active = $.cookie(`gallery-category-${id}`) || '';
5816            $.each(gcate_list, function(i,k) {
5817                k = k.trim();
5818
5819                const $gcateItem = $(`<li class="cl-gcate-item"><a href="javascript:;" data-idx="${i}">${k}</a></li>`);
5820                $gcateItem.toggleClass('active', k === gcate_active);
5821                if(i === 0 && getOrDefault(s,'category_home_hide',false)) $gcateItem.addClass('hide');
5822
5823                $gCate.find('.cl-gcate-list').append($gcateItem);
5824            });
5825            if($gCate.find('.cl-gcate-item.active').length === 0) $gCate.find('.cl-gcate-item').not('.hide').eq(0).addClass('active');
5826
5827            $gtoolbar.find('template.cl-gcate').replaceWith($gCate);
5828        } else {
5829            $gtoolbar.find('template.cl-gcate').remove();
5830        }
5831
5832        // gallery sort (gsort)
5833        const gsort_init = ['recent','sales','lowprice','highprice','discount','review_cnt'];
5834        const gsort_type = getOrDefault(s,'gallery_sort','default');
5835        const gmode = $el.attr('data-mode');
5836        if(`${gmode}.${gsort_type}` == 'shopping.product') {
5837            const $gSort = $(`
5838                <div class="cl-gsort">
5839                    <div class="cl-gsort-btn-wrap">
5840                        <div class="cl-gsort-btn">
5841                            <span class="cl-gsort-active"></span>
5842                            ${clSVG('caret2',16,16,false)}
5843                        </div>
5844                        <ul class="cl-gsort-list">
5845                        </ul>
5846                    </div>
5847                </div>
5848            `);
5849
5850            const gsort_active = $.cookie('gallery-orderby-' + id) || 'recent';
5851            if($.inArray(gsort_active,gsort_init) < 0) gsort_active = gsort_init[0];
5852
5853            $.each(gsort_init, function(i,k) {
5854                const gsort_label = $.lang[LANG][`gallery.shopping.orderby.${k}`];
5855                const $gsortItem = $(`<li class="cl-gsort-item"><a href="javascript:;" data-idx="${i}" data-orderby="${k}">${gsort_label}</a></li>`);
5856                $gsortItem.find('a').append(clSVG('check2',13,10,false));
5857                if(k === gsort_active) {
5858                    $gsortItem.addClass('active');
5859                    $gSort.find('.cl-gsort-active').html(gsort_label);
5860                }
5861
5862                $gSort.find('ul').append($gsortItem);
5863            });
5864            
5865            $gtoolbar.find('template.cl-gsort').replaceWith($gSort);
5866        } else {
5867            $gtoolbar.find('template.cl-gsort').remove();
5868        }
5869
5870        if(!checkLatestVer) {
5871            $el.attr('data-ver','1');
5872            $gtoolbar.addClass('gallery-category-wrap');
5873            $gtoolbar.find('.cl-gcate-list').addClass('gallery-category-nav').attr('data-category-color',getOrDefault(s,'category_color_type',''));
5874            $gtoolbar.find('.cl-gsort-btn-wrap').addClass('gallery-sort-nav');
5875        }
5876
5877        addGToolbar($el,$gtoolbar);
5878    }
5879
5880    var setGToolbarAllProducts = function(target, s, total) {
5881        const $el = $(target);
5882        if($el.length === 0) return;
5883
5884        const el = $el.attr('data-el');
5885        const elid = $el.attr('data-id');
5886        const elcss_str = $(`#${el}css`).text();
5887        const elcss = CSSJSON.toJSON(elcss_str);
5888
5889        const gtoolbar_selector = `.cl-gtoolbar-userELallProducts`;
5890        const gtoolbar_style = style.get(elcss,gtoolbar_selector);
5891        const checkLatestVer = !gtoolbar_style.undefined;
5892
5893        if(s === null) {
5894            if(PAGE_MODE == 'c') {
5895                s = $.bcModal?.data?.block?.elsettings ?? {};
5896            }
5897            else {
5898                const blockData = property.CONTENTS?.[`el${elid}`]?.element ?? {};
5899                s = $.parseJSON(blockData?.elsettings ?? '{}');
5900                total = blockData?.total?.list_total ?? 0;
5901            }
5902        }
5903
5904        const $gtoolbar = $(`
5905            <div class="cl-gtoolbar cl-gtoolbar-userELallProducts"
5906                data-mode="allproducts"
5907                data-lang="${LANG}"
5908                data-sticky="${getOrDefault(s,'allproducts_sticky','OFF')}"
5909            >
5910                <div class="container">
5911                    <div class="row">
5912
5913                        <div class="cl-gsort pc">
5914                            <ul class="cl-gsort-list"></ul>
5915                        </div>
5916
5917                        <div class="cl-gsort mobile">
5918                            <div class="cl-gsort-btn-wrap">
5919                                <div class="cl-gsort-btn dropdown-toggle">
5920                                    <span class="cl-gsort-active"></span>
5921                                    ${clSVG('caret2',16,16,false)}
5922                                </div>
5923                                <ul class="cl-gsort-list">
5924                                </ul>
5925                            </div>
5926                            <div class="cl-gsort-list-total" data-total="${total}"></div>
5927                        </div>
5928
5929                    </div>
5930                </div>
5931            </div>
5932        `);
5933
5934        const gsort_init = getAllProductsSortList(s);
5935        let gsort_active = $.cookie('gallery-category-all_products') || '';
5936        if(gsort_init?.[gsort_active] === false) gsort_active = getAllProductsSortVal(s);
5937        $.each(gsort_init, function(k,onoff) {
5938            if(onoff === false) return true;
5939
5940            const gsort_label = $.lang[LANG][`config.allproducts.${k}`];
5941            const $gsortItem = $(`<li class="cl-gsort-item"><a href="javascript:;" data-idx="${i}" data-orderby="${k}">${gsort_label}</a></li>`);
5942            if(k === gsort_active) {
5943                $gsortItem.addClass('active');
5944                $gtoolbar.find('.cl-gsort-active').html(gsort_label);
5945            }
5946
5947            $gtoolbar.find('.cl-gsort-list').append($gsortItem);
5948        });
5949
5950        $gtoolbar.find('.cl-gsort.pc .cl-gsort-list').append(`<li class="cl-gsort-item total"><a href="javascript:;"><span class="cl-gsort-list-total" data-total="${total}"></span></a></li>`)
5951
5952        if(!checkLatestVer) {
5953            $gtoolbar.addClass('allProducts-sort-wrap').attr('data-ver','1');
5954            $gtoolbar.find('.cl-gsort.pc .cl-gsort-list').addClass('gallery-category-nav allProducts-sort-list');
5955            $gtoolbar.find('.cl-gsort.mobile').addClass('allProducts-sort-mobile');
5956            $gtoolbar.find('.cl-gsort.mobile .cl-gsort-btn-wrap').addClass('gallery-sort-nav');
5957            $gtoolbar.find('.cl-gsort.mobile .cl-gsort-list').addClass('gallery-category-nav');
5958        }
5959
5960        addGToolbar($el,$gtoolbar);
5961    }
5962
5963    var getAllProductsSortList = function(elsettings) {
5964
5965        var orderby = getOrDefault(elsettings,'orderby','');
5966        var orderby_val = ['recent','lowprice','review_cnt','high_score','sales','hits'];
5967
5968        if(Array.isArray(elsettings?.orderby_val)
5969        ) {
5970            orderby_val = elsettings.orderby_val;
5971        } else if(
5972            elsettings?.orderby_val && 
5973            typeof elsettings.orderby_val === 'object' &&
5974            !Array.isArray(elsettings.orderby_val)
5975        ) {
5976            orderby_val = Object.keys(elsettings.orderby_val);
5977        }
5978
5979        var orderby_init = {};
5980        if(orderby != '') {
5981            orderby.split('||').forEach(function(value, index) {
5982                orderby_init[orderby_val[index]] = (value === 'true') ? true : false;
5983            });  
5984        } else {
5985            orderby_init = {
5986                'lowprice': false,
5987                'review_cnt': false,
5988                'high_score': false,
5989                'recent': true,
5990                'sales': false,
5991                'hits': false,
5992            };
5993        }
5994
5995        return orderby_init;
5996    }
5997    var getAllProductsSortVal = function(elsettings) {
5998        var orderby_list = getAllProductsSortList(elsettings);
5999        var orderby_active = '';
6000        var orderby_cookie = $.cookie('gallery-category-all_products') || '';
6001        if(orderby_list[orderby_active] === true) orderby_active = orderby_cookie;
6002        else {
6003            for (var key in orderby_list) {
6004                if (orderby_list[key]) {
6005                    orderby_active = key;
6006                    break;
6007                }
6008            }
6009        }
6010        $.cookie('gallery-category-all_products', orderby_active, { path: '/', expires: 12 * 60 * 60 * 1000 });
6011
6012        return orderby_active;
6013    }
6014
6015    var getEventObject = function(type, price, quantity, step, explan, lang, href) {
6016        var prod_position = {
6017                "LK": 0,
6018                "BS": 0,
6019                "BN": 1,
6020                "SM": 2
6021            },
6022            prod_type = {
6023                "LK": $.lang[LANG]['pay.plan.LK.name'],
6024                "BS": $.lang[LANG]['pay.plan.BS.name'],
6025                "BN": $.lang[LANG]['pay.plan.BN.name'],
6026                "SM": $.lang[LANG]['pay.plan.SM.name']
6027            },
6028            prod_brand = (lang == 'ko') ? '크리에이터링크' : 'creatorlink',
6029            prod_currency = (lang == 'ko') ? 'KRW' : 'USD',
6030            prod_action = '',
6031            prod_step = 1;
6032
6033        if (explan.length == 0) {
6034            prod_action = '신규결제';
6035        }
6035 else if (explan == type) {
6036            prod_action = '요금제 연장';
6037        } else if ((explan.length && type.length) && (explan != type)) {
6038            prod_action = '요금제 변경';
6039        }
6040
6041        var charge = price + (price * 0.1);
6042        return {
6043            'name': prod_type[type],
6044            'price': charge,
6045            'brand': prod_brand,
6046            'category': prod_action,
6047            'variant': quantity,
6048            'position': prod_position[type],
6049            'explan': explan,
6050            'plan': type,
6051            'step': step,
6052            'currency': prod_currency,
6053            'href': href
6054        }
6055    }
6056
6057
6058    /* 동영상블럭 갤러리타입 **************************************/
6059    var getGalleryVideoType = function(val) {
6060        var videoTypeArray = ['youtube', 'vimeo', 'soundcloud', 'youtu.be'],
6061            videoType = '';
6062
6063        $.each(videoTypeArray, function(i, v) {
6064            if (val.indexOf(v) > -1) {
6065                videoType = v;
6066            }
6067        });
6068
6069        return videoType;
6070    }
6071
6072    var getYoutubeStartSeconds = function(videoUrl) {
6073        var startMatch = videoUrl && videoUrl.match(/[?&](?:t|start)=([^&#]+)/i),
6074            startValue = (startMatch && startMatch[1]) ? decodeURIComponent(startMatch[1]) : '',
6075            timeMatch = null,
6076            seconds = 0;
6077
6078        if (!startValue) return '';
6079        if (/^\d+$/.test(startValue)) return parseInt(startValue, 10);
6080
6081        timeMatch = startValue.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/i);
6082        if (!timeMatch) return '';
6083
6084        seconds += (timeMatch[1]) ? parseInt(timeMatch[1], 10) * 3600 : 0;
6085        seconds += (timeMatch[2]) ? parseInt(timeMatch[2], 10) * 60 : 0;
6086        seconds += (timeMatch[3]) ? parseInt(timeMatch[3], 10) : 0;
6087
6088        return (seconds > 0) ? seconds : '';
6089    }
6090
6091    var getGalleryVideoData = function(videoUrl) {
6092        var videoId = '',
6093            videoThumb = '',
6094            videoType = '',
6095            videoStart = '',
6096            check_video = false;
6097
6098        videoType = getGalleryVideoType(videoUrl);
6099
6100        switch (videoType) {
6101            case 'youtube':
6102            case 'youtu.be':
6103                let ytregExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
6104                let ytsregExp = /^.*(youtube\.com\/shorts\/)([a-zA-Z0-9_-]{11})(\?.*)?$/;
6105                let ytlregExp = /^.*(youtube\.com\/live\/)([a-zA-Z0-9_-]{11})(\?.*)?$/;
6106
6107                let ytmatch = videoUrl.match(ytregExp);
6108                let ytsmatch = videoUrl.match(ytsregExp);
6109                let ytlmatch = videoUrl.match(ytlregExp);
6110
6111                var aType = "text/html",
6112                    src = '';
6113
6114                if (ytmatch && ytmatch[2].length === 11) {
6115                    videoId = ytmatch[2];
6116                } else if (ytsmatch && ytsmatch[2].length === 11) { // shorts
6117                    videoId = ytsmatch[2];
6118                } else if (ytlmatch && ytlmatch[2].length === 11) { // live (새로 추가)
6119                    videoId = ytlmatch[2];
6120                }
6121
6122                if (videoId) {
6123                    videoThumb = '//img.youtube.com/vi/' + videoId + '/maxresdefault.jpg';
6124                    src = '//www.youtube.com/embed/' + videoId;
6125                    videoStart = getYoutubeStartSeconds(videoUrl);
6126                    check_video = true;
6127                }
6128
6129                break;
6130            case 'vimeo':
6131                var regExp = /\/\/(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/,
6132                    match = videoUrl.match(regExp);
6133
6134                if (match && match[3].length > 0) {
6135                    videoId = match[3],
6136                    aType = "text/html",
6137                    src = '//player.vimeo.com/video/' + videoId;
6138
6139                    var vidx = ($('#el-blockConfig .bg-video-wrap .input-group.active').length > 0) ? $('#el-blockConfig .bg-video-wrap .input-group.active').attr('id').replace(/[^0-9]/gi, '') : 0,
6140                        vgrid = $('.'+selectEL).find('.grid').eq(vidx),
6141                        w = (vidx && vgrid.length > 0) ? vgrid.width() + 100 : 1024,
6142                        h = (vidx && vgrid.length > 0) ? vgrid.height() + 100 : 1024,
6143                        size = (w > h) ? '&height='+h : '&width='+w;
6144                    $.getJSON('https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/' + videoId + size, function(data) {
6145                        if (typeof data.thumbnail_url != 'undefined' && data.thumbnail_url) {
6146                            videoThumb = data.thumbnail_url;
6147                        }
6148                    });
6149
6150                    check_video = true;
6151                }
6152
6153
6154                break;
6155
6156            case 'soundcloud':
6157                videoId = '',
6158                aType = "";
6159
6160                videoUrl = (videoUrl.indexOf('https') > -1) ? videoUrl : 'https://' + videoUrl;
6161
6162                $.getJSON('https://soundcloud.com/oembed?format=json&url=' + videoUrl, function(data) {
6163                    if (typeof data.html == 'undefined') { return; }
6164                    $video = $(data.html);
6165                    src = $video.prop('src');
6166                    videoThumb = data.thumbnail_url;
6167                    check_video = true;
6168                }).fail(function(response) {
6169                    console.log(response);
6170                    return;
6171                });
6172
6173                break;
6174            default:
6175
6176                break;
6177        }
6178
6179        var videoData = {
6180            check_video: check_video,
6181            videoType: videoType,
6182            videoId: videoId,
6183            videoStart: videoStart,
6184            videoUrl: videoUrl,
6185            aType: aType,
6186            poster: videoThumb,
6187            iframe_src: src
6188        }
6189
6190        return videoData;
6191    }
6192
6193    var renderVideoThumb = function($target, video_str, videoData, bt_type2) { 
6194        if(typeof bt_type2 == 'undefined') bt_type2 = null;
6195        const $videoContent = $target;
6196
6197        $videoContent.html(video_str);
6198        if (videoData.iframe_src) {
6199            $videoContent.attr('data-url', videoData.iframe_src);
6200        }
6201        if (videoData.videoUrl) {
6202            $videoContent.attr('data-url-orig', videoData.videoUrl);
6203        }
6204
6205        if (bt_type2 === 'shorts') $videoContent.addClass('fitvidsignore');
6206        else $videoContent.removeClass('fitvidsignore');
6207
6208        if (videoData.videoType === 'youtube') {
6209            const testImg = new Image();
6210            testImg.onload = function () {
6211                if (this.width <= 120 && this.height <= 90) {
6212                    const thumb = videoData.poster.replace('maxresdefault', '0');
6213                    $videoContent.find('.video-gallery-url').attr('data-poster', thumb);
6214                    $videoContent.find('.ly-img').css('background-image', 'url(' + thumb + ')');
6215                    saveContentElement(false);
6216                }
6217            };
6218            testImg.src = videoData.poster;
6219        }
6220    }
6221    // $('.video-content > svg').live('click', function() {
6222    //     if($(this).parents('.el_viewblock').length>0) return false;
6223
6224    //     $.loadingOn($(this).parents('.video-content')); 
6225
6226    //     var vd_src = $(this).parents('.video-content').attr('data-url'),
6227    //         vd_height = $(this).parents('.video-content').css('height').replace('px',''),
6228    //         vd_data = getGalleryVideoData(vd_src),
6229    //         vd_mode = $(this).parents('.element').attr('data-mode'),
6230    //         vd_id = $(this).parents('.element').attr('data-id'),
6231    //         vd_mute = (vd_src.indexOf('vimeo')>-1) ? '&muted=1' : '&mute=1',
6232    //         vd_content_new = '<iframe class="video-iframe hide" height="'+vd_height+'" src="'+vd_data.iframe_src+'?wmode=transparent&amp;autoplay=1'+vd_mute+'" allow="autoplay""></iframe>';
6233
6234    //     if(vd_mode!='zoom') {
6235    //         //if(isThumnailv_type) {
6236    //             $(this).parents('.video-content').append(vd_content_new);
6237    //             $(this).parents('.video-content').find('.ly-img').remove();
6238    //             $(this).remove();
6239
6240    //             setTimeout(function(){
6241    //                 $('.video-iframe').removeClass('hide');
6242    //                 $('.dsgn-body').fitVids();
6243    //                 $.loadingOFF();
6244
6245    //             },300);
6246    //         //}
6247    //     }   
6248    // });
6249
6250    function setSnsJoinConvertScript(snstype) {
6251        console.log('setSnsJoinConvertScript');
6252        snstype = (typeof snstype != 'undefined') ? snstype : 'naver';
6253        var scriptStr = '\
6254            <script type="text/javascript" src="https://wcs.naver.net/wcslog.js"></script>\
6255            <script type="text/javascript" class="snsjoin_convert">\
6256            if(typeof(wcs) != "undefined") {\
6257                if(!wcs_add) var wcs_add={};\
6258                wcs_add["wa"]="s_48e853d9cc7e";\
6259                var _nasa={};\
6260                _nasa["cnv"] = wcs.cnv("2","1");\
6261                wcs_do(_nasa);\
6262                console.log("naver 전환");\
6263            }\
6264            </script>\
6265            <script type="text/javascript" charset="UTF-8" src="//t1.daumcdn.net/kas/static/kp.js"></script>\
6266            <script type="text/javascript" class="snsjoin_convert">\
6267                kakaoPixel("6608645775572775786").pageView();\
6268                kakaoPixel("6608645775572775786").completeRegistration();\
6269                console.log("kakao 전환");\
6270            </script>\
6271            <script type="text/javascript" class="snsjoin_convert">\
6272            !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?\
6273                n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;\
6274                n.push=n;n.loaded=!0;n.version="2.0";n.queue=[];t=b.createElement(e);t.async=!0;\
6275                t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,\
6276                document,"script","https://connect.facebook.net/en_US/fbevents.js");\
6277                fbq("init", "256796588050321");\
6278                fbq("track", "PageView");\
6279                fbq("trac", "CompleteRegistration");\
6280                console.log("facebook 전환");\
6281            </script>\
6282        ';
6283
6284        switch (snstype) {
6285            case 'naver':
6286                scriptStr += '\
vendor: 108 bytes, lines 6286-6287
6286
6287                    <script class="snsjoin_convert" async src="https://www.googletagmanager.com/gtag/js?id=
6287G-JT83EQYG01
vendor: 11 bytes, line 6287
6287"></script>
6287\
6288                    <script class="snsjoin_convert">\
6289                    window.dataLayer = window.dataLayer || [];\
6290                        function gtag(){dataLayer.push(arguments);}\
6291                        gtag("js", new Date());\
6292                        gtag("config", "G-JT83EQYG01");\
6293                        gtag("event", "네이버_소셜_회원가입_완료", {\
6294                        "Social_Button" : "네이버 아이콘",\
6295                    });\
6296                    </script>\
6297                ';
6298                break;
6299
6300            case 'kakao':
6301                scriptStr += '\
vendor: 104 bytes, lines 6301-6302
6301
6302                <script class="snsjoin_convert" async src="https://www.googletagmanager.com/gtag/js?id=
6302G-JT83EQYG01
vendor: 11 bytes, line 6302
6302"></script>
6302\
6303                <script class="snsjoin_convert">\
6304                    window.dataLayer = window.dataLayer || [];\
6305                    function gtag(){dataLayer.push(arguments);}\
6306                    gtag("js", new Date());\
6307                    gtag("config", "G-JT83EQYG01");\
6308                    gtag("event", "카카오_소셜_회원가입_완료", {\
6309                    "Social_Button" : "카카오 아이콘",\
6310                    });\
6311                </script>\
6312                ';
6313                break;
6314                
6315            case 'fb':
6316                scriptStr += '\
vendor: 104 bytes, lines 6316-6317
6316
6317                <script class="snsjoin_convert" async src="https://www.googletagmanager.com/gtag/js?id=
6317G-JT83EQYG01
vendor: 11 bytes, line 6317
6317"></script>
6317\
6318                <script class="snsjoin_convert">\
6319                console.log(\'sss\');\
6320                window.dataLayer = window.dataLayer || [];\
6321                    function gtag(){dataLayer.push(arguments);}\
6322                    gtag("js", new Date());\
6323                    gtag("config", "G-JT83EQYG01");\
6324                    gtag("event", "페이스북_소셜_회원가입_완료", {\
6325                    "Social_Button" : "페이스북 아이콘",\
6326                });\
6327                </script>\
6328                ';
6329            break;
6330
6331            case 'google':
6332                scriptStr += '\
vendor: 104 bytes, lines 6332-6333
6332
6333                <script class="snsjoin_convert" async src="https://www.googletagmanager.com/gtag/js?id=
6333G-JT83EQYG01
vendor: 11 bytes, line 6333
6333"></script>
6333\
6334                <script class="snsjoin_convert">\
6335                window.dataLayer = window.dataLayer || [];\
6336                    function gtag(){dataLayer.push(arguments);}\
6337                    gtag("js", new Date());\
6338                    gtag("config", "G-JT83EQYG01");\
6339                    gtag("event", "구글_소셜_회원가입_완료", {\
6340                    "Social_Button" : "구글 아이콘",\
6341                });\
6342                </script>\
6343                ';
6344            break;
6345
6346            default:
6347                break;
6348        }
6349        $('.snsjoin_convert').remove();
6350        $('body').append(scriptStr);
6351    }
6352
6353    function kakaoLogin() {
6354        if(window.Kakao) {
6355            const kakao = window.Kakao;
6356            if(!kakao.isInitialized()) {
6357                kakao.init('85677ffc26b1bca1130b866859031c06');
6358            }
6359
6360            Kakao.Auth.authorize({
6361                redirectUri: document.location.protocol + '//' + getServiceHost() + '/oauth_kakao',
6362                scope: 'account_email,profile',
6363                state: document.getElementById( "modoo_url" ).value
6364            });
6365        }
6366    }
6367
6368    var googleMemberClientId = '388609418061-gv9aogfpi35f69aa0u9uvsn5vg6gm270.apps.googleusercontent.com';
6369    var googleMemberLoginContext = {};
6370    var googleMemberTokenClient = null;
6371
6372    function setSnsLandJoin() {
6373        var landCheckEl = document.getElementById('land_check');
6374        var landPlanEl = document.getElementById('land_plan');
6375
6376        if( typeof $ != 'undefined' && $.cookie &&
6377            landCheckEl && landPlanEl && landPlanEl.value &&
6378            (landCheckEl.value == 'true' || landCheckEl.value == '1')
6379        ) {
6380            $.cookie('land_join', landPlanEl.value, { path : '/' });
6381        }
6382    }
6383
6384    function googleMemberLogin(from) {
6385        var modooUrlEl = document.getElementById('modoo_url');
6386        var landJoin = '';
6387
6388        if(typeof $ != 'undefined' && $.cookie && $.cookie('land_join')) {
6389            landJoin = $.cookie('land_join');
6390            $.removeCookie('land_join', { path: '/' });
6391        }
6392
6393        googleMemberLoginContext = {
6394            from: from || '',
6395            url: (modooUrlEl && modooUrlEl.value) ? modooUrlEl.value : '',
6396            land_join: landJoin
6397        };
6398
6399        if(!(window.google && google.accounts && google.accounts.oauth2)) {
6400            alert('Google 로그인 스크립트를 불러오는 중입니다. 잠시 후 다시 시도해 주세요.');
6401            return;
6402        }
6403
6404        if(!googleMemberTokenClient) {
6405            googleMemberTokenClient = google.accounts.oauth2.initTokenClient({
6406                client_id: googleMemberClientId,
6407                scope: 'openid email profile',
6408                callback: googleMemberLoginCallback,
6409                error_callback: function() {
6410                    alert('Google 로그인을 취소했거나 로그인 창을 열 수 없습니다.');
6411                }
6412            });
6413        }
6414
6415        googleMemberTokenClient.requestAccessToken({prompt: 'select_account'});
6416    }
6417
6418    function googleMemberLoginCallback(response) {
6419        if(!response || response.error) {
6420            alert('Google 계정 정보를 확인할 수 없습니다.');
6421            return;
6422        }
6423
6424        if(!response.access_token) {
6425            alert('Google 계정 정보를 확인할 수 없습니다.');
6426            return;
6427        }
6428
6429        var postData = {
6430            access_token: response.access_token,
6431            from: googleMemberLoginContext.from || '',
6432            url: googleMemberLoginContext.url || ''
6433        };
6434
6435        if(googleMemberLoginContext.land_join) postData.land_join = googleMemberLoginContext.land_join;
6436
6437        $.post('/member/googlelogin', postData, function(data) {
6438            if(typeof data.msg != 'undefined' && data.msg) {
6439                alert(data.msg);
6440                return false;
6441            }
6442
6443            var redirectGoogleMemberLogin = function() {
6444                if(typeof data.url != 'undefined' && data.url) location.href = data.url;
6445                else location.replace('/dashboard');
6446            };
6447
6448            if(data.join) {
6449                try {
6450                    setSnsJoinConvertScript('google');
6451                } catch(e) {
6452                    if(window.console && console.error) console.error(e);
6453                }
6454            }
6455
6456            if(data.login) {
6457                if(data.join) {
6458                    setTimeout(redirectGoogleMemberLogin, 500);
6459                } else {
6460                    redirectGoogleMemberLogin();
6461                }
6462            }
6463        }, 'json').fail(function() {
6464            alert('Google 로그인 처리 중 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.');
6465        });
6466    }
6467
6468    /*
6469    function kakaoLogin(ip) {
6470        Kakao.Auth.login({
6471            success: function(response) {
6472                //사용자 정보 가져오기
6473                Kakao.API.request({
6474                    url: '/v2/user/me', //계정 정보를 가져오는 request url
6475                    success: function(data) {
6476                        var user = data.kakao_account, //카카오 계정 정보
6477                            accessToken = Kakao.Auth.getAccessToken();
6478
6479                        Kakao.Auth.setAccessToken(accessToken);
6480
6481                        var checkObj = { userinfo: data, id: user.email, snsType: 'kakao', ip: ip };
6482                        if (typeof $.cookie('land_join') != 'undefined' && $.cookie('land_join')) {
6483                            checkObj['land_join'] = $.cookie('land_join');
6484                            $.removeCookie('land_join', { path: '/' });
6485                        }
6486                        $.post('/template/snsloginCheck', checkObj, function(data) {
6487                            if (data.login) {
6488                                if (data.join) setSnsJoinConvertScript(); //sns 회원가입 전환 스크립트 
6489
6490                                if (typeof data.url != 'undefined' && data.url) location.href = data.url;
6491                                else location.replace('/');
6492                                self.close();
6493                            } else {
6494                                alert(data.msg);
6495                                opener.location.reload();
6496                                self.close();
6497                            }
6498                        }, 'json');
6499                    },
6500                    fail: function(error) {
6501                        console.log('카카오톡과 연결이 완료되지 않았습니다.');
6502                    },
6503                })
6504            },
6505            fail: function(error) {
6506                console.log('카카오톡과 연결 실패하였습니다.');
6507            },
6508        })
6509    }
6510    */
6511
6512    function snsLogout() {
6513        var sid = (typeof SID != 'undefined' && SID) ? SID : '';
6514
6515        if(window.Kakao) {
6516            Kakao.init('85677ffc26b1bca1130b866859031c06');
6517            Kakao.isInitialized();
6518    
6519            if (Kakao.Auth.getAccessToken()) {
6520                Kakao.Auth.logout()
6521                    .then(function(response) {
6522                        // console.log(Kakao.Auth.getAccessToken());
6523                    })
6524                    .catch(function(error) {
6525                        // console.log('Not logged in.');
6526                    });
6527            }
6528        }
6529
6530        window.fbAsyncInit = function() {
6531            FB.init({
6532                version : 'v19.0',
6533                appId : '590704662264509',		// [ creatorlink ] Facebook App
6534                // appId : '398865637129551',	// [ creatorlinkdev ] Facebook Test App
6535                status	: true,		//check login status
6536                cookie	: true,
6537                xfbml	: true
6538            });
6539
6540            FB.getLoginStatus(function(response) {
6541                if (response.status == 'connected') {
6542                    FB.logout(function(response) {
6543                        FB.Auth.setAuthResponse(null, 'unknown');
6544                        console.log('logged out~');
6545                    });
6546                }
6547            });
6548        };
6549
6550        (function(d, s, id) {
6551            var js, fjs = d.getElementsByTagName(s)[0];
6552            if (d.getElementById(id)) { return; }
6553            js = d.createElement(s);
6554            js.id = id;
6555            js.async = true;
6556            js.src = 'https://connect.facebook.net/en_KR/all.js';
6557            fjs.parentNode.insertBefore(js, fjs);
6558        }(document, 'script', 'facebook-jssdk'));
6559
6560        if (typeof sid != 'undefined' && sid) {
6561            if ($.cookie('domainSet-next-' + sid) !== undefined) $.removeCookie('domainSet-next-' + sid, { path: '/' });
6562        }
6563
6564        location.href = '/member/login/out';
6565    }
6566
6567    function disableScrolling() {
6568        var x = window.scrollX;
6569        var y = window.scrollY;
6570        window.onscroll = function() { window.scrollTo(x, y); };
6571    }
6572
6573    function enableScrolling() {
6574        window.onscroll = function() {};
6575    }
6576
6577    var hexToRgba = function(hex) {
6578        if (hex.lastIndexOf('#') > -1) {
6579            hex = hex.replace(/#/, '0x');
6580        } else {
6581            hex = '0x' + hex;
6582        }
6583        var r = hex >> 16;
6584        var g = (hex & 0x00FF00) >> 8;
6585        var b = hex & 0x0000FF;
6586        return rgb = { r: r, g: g, b: b };
6587    }
6588
6589    function hexToRgba2(hex, alpha = 1) {
6590        hex = hex.replace(/^#/, '');
6591        
6592        if (hex.length === 3) {
6593            hex = hex.split('').map(c => c + c).join('');
6594        }
6595
6596        const bigint = parseInt(hex, 16);
6597        const r = (bigint >> 16) & 255;
6598        const g = (bigint >> 8) & 255;
6599        const b = bigint & 255;
6600
6601        return `rgba(${r}, ${g}, ${b}, ${alpha})`;
6602    }
6603
6604    var rgbaToOpacity = function(rgba) {
6605        if (typeof rgba == 'undefined') rgba = 'rgba(255,255,255,1)';
6606        //rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2}))[\s+]?/i);
6607        var r = [],
6608            rgba = rgba.replace(/^(rgb|rgba)\(/, '').replace(/\)$/, '').replace(/\s/g, '').split(',');
6609
6610        r.r = rgba[0], r.g = rgba[1], r.b = rgba[2], r.a = rgba[3];
6611        return r;
6612    }
6613
6614    var onlyUnique = function(value, index, self) {
6615        return self.indexOf(value) === index;
6616    }
6617
6618    var arrayDuplicates = function(arr) {
6619        var duplicates = {};
6620        for (var i = 0; i < arr.length; i++) {
6621            if (duplicates.hasOwnProperty(arr[i])) {
6622                duplicates[arr[i]].push(i);
6623            }
6623 else if (arr.lastIndexOf(arr[i]) !== i) {
6624                duplicates[arr[i]] = [i];
6625            }
6626        }
6627
6628        return duplicates;
6629    }
6630
6631    var arrayLastItem = function(arr) {
6632        if (Array.isArray(arr))
6633            return arr.pop();
6634        else return "";
6635    }
6636
6637    var getLang = function(selectorTag, SID) {
6638        var ch_lang = '';
6639        if (typeof selectorTag.attr('data-blocklang') != 'undefined') { ch_lang = selectorTag.attr('data-blocklang'); } else {
6640            if ($('.menu-' + SID + ' .siteLANG').length > 0)
6641                ch_lang = ($('.menu-' + SID + ' .siteLANG').find('li.active a').attr('data-code') == 'ko') ? 'ko' : 'en';
6642            else ch_lang = LANG;
6643        }
6644
6645        return ch_lang;
6646    }
6647
6648    function templateModeChange(e) {
6649        $('.template-mode').removeClass('active');
6650        $(e).addClass('active');
6651        $('#template-site .modal-dialog .modal-content').find('.load-template').css('display', 'block');
6652        $.processON();
6653
6654        // var widthSize = ($(e).attr('class').indexOf('desktop') > -1) ? '100%' : '100%';
6655        // widthSize = ($(e).attr('class').indexOf('tablet') > -1) ? ($(e).attr('class').indexOf('mobile') > -1 ? '360px' : '770px') : widthSize;
6656
6657        var widthSize = '';
6658        if($(e).attr('class').indexOf('desktop') > -1) widthSize = '100%';
6659        else if($(e).attr('class').indexOf('tablet') > -1) widthSize = '785px';
6660        else  widthSize = '433px';
6661
6662        $('#template-site .modal-dialog .modal-content').css({
6663            'max-width': 'unset',
6664            'width': widthSize,
6665            'height': '86.5%'
6666        });
6667        setTimeout(function() {
6668            $.processOFF();
6669            $('#template-site .modal-dialog .modal-content').find('.load-template').fadeOut(200);
6670        }, 650);
6671        setTimeout(function() { // aos height resize
6672            $('#template-site .modal-dialog .modal-content').css('height', '86.6%');
6673        }, 800);
6674    }
6675
6676    function previewModeChange1(e) {
6677
6678        var hashId = $(e).attr('id');
6679        location.hash = hashId;
6680
6681        $('.template-mode').removeClass('active');
6682        $(e).addClass('active');
6683        $('#previewmain .modal-content-pre').find('.load-template').css('display', 'block');
6684        $.processON('Loading...');
6685
6686        var widthSize = '';
6687        if ($(e).attr('class').indexOf('desktop') > -1) widthSize = '100%';
6688        else if ($(e).attr('class').indexOf('tablet') > -1) widthSize = '785px';
6689        else widthSize = '431px';
6690        $('#previewmain .modal-content-pre').css({
6691            'max-width': 'unset',
6692            'width': widthSize
6693        });
6694
6695        // setTimeout(function(){          
6696        //     $.processOFF();     
6697        //     $('#previewmain .modal-content-pre').find('.load-template').fadeOut(200);
6698        // },650);  
6699
6700        //0206라이브 업뎃 복원용 
6701        //$("#iframe1").get(0).contentDocument.location.reload();
6702
6703        //0206 업뎃 후 문제 시 삭제 
6704        $("#iframe1").get(0).contentWindow.location.reload();
6705
6706        $("#iframe1").off('load').on('load', function(e) {
6707            var iframe = this;
6708            setTimeout(function() {
6709                var frame = iframe.contentWindow;
6710                if(!frame || !frame.jQuery || typeof frame.tabMotion != 'function') return;
6711
6712                frame.jQuery('.tabs').each(function() {
6713                    var $tabs = frame.jQuery(this),
6714                        el = $tabs.attr('data-name'),
6715                        mobile_tab_line = $tabs.attr('mobile-tab-line'),
6716                        tab_line = (typeof mobile_tab_line != 'undefined' && mobile_tab_line) ? mobile_tab_line : $tabs.attr('tab-line');
6717
6718                    if(!el || tab_line != '1') return;
6719
6720                    var len = $tabs.find('.tab-box .tab:not(.hover)').length,
6721                        motion_style = $tabs.attr('tab-motion-style'),
6722                        tab_counted = $tabs.attr('tab-count'),
6723                        mobile_tab_count = $tabs.attr('mobile-tab-count'),
6724                        tab_count = (typeof mobile_tab_count != 'undefined' && mobile_tab_count) ? mobile_tab_count : ((tab_counted > 4) ? 4 : tab_counted),
6725                        tab_case = $tabs.attr('data-case'),
6726                        motion = Number($tabs.attr('tab-motion')) || 0;
6727
6728                    if(len > Number(tab_count)) frame.tabMotion(el, motion, '', len, motion_style, tab_count, tab_case);
6729                });
6730            }, 300);
6731
6732            $.processOFF();
6733            $('#previewmain .modal-content-pre').find('.load-template').fadeOut(200);
6734        });
6735    }
6736
6737    function templateModeDefault(width) {
6738        var widthSize = '';
6739        if (width > 1199) {
6740            widthSize = '100%';
6741        } else if (width <= 1199 && width >= 768) {
6742            widthSize = '785px';
6743        } else if (width <= 767) {
6744            widthSize = '431px';
6745        }
6746
6747        $('#template-site .modal-dialog .modal-content').css({
6748            'max-width': 'unset',
6749            'width': widthSize
6750        });
6751
6752    }
6753
6754    var initViewPageToolbar = function(option, settings, viewData) {
6755        var deferred = $.Deferred();
6756        if (typeof option == 'undefined') option = '';
6757        if (typeof settings == 'undefined') settings = '';
6758
6759        var this_page = (PAGE_MODE == 'c') ? PAGE : property.PAGE,
6760            eltype = (this_page.match(/^forum\,/) !== null) ? 'forum' : 'gallery',
6761            checkForum = (eltype == 'forum') ? true : false,
6762            checkGallery = (eltype == 'gallery') ? true : false,
6763            checkModoo = (getOrDefault(settings,'forum_type','') == 'modoo') ? true : false;
6764
6765        var view_lang = LANG;
6766        if(checkForum && typeof settings.chlang != 'undefined' && settings.chlang) view_lang = settings.chlang;
6767
6768        var toolbar_html = {back:'', like:'', share:'', bottomnav:''};
6769
6770        var pb_icon_back = '', pb_icon_prev = '', pb_icon_next = '', pb_icon_share, pb_icon_like;
6771        var pb_text_back = '', pb_text_prev = '', pb_text_next = '', pb_text_share;
6772        if(checkGallery) {
6773            pb_icon_back = getOrDefault(settings, 'pb_icon_back', '<svg viewBox="0 0 24 24" width="24" height="24"><path d="M4 5h16v2H4zM4 11h16v2H4zM4 17h16v2H4z"></path></svg>');
6774            pb_icon_prev = getOrDefault(settings, 'pb_icon_prev', '<svg viewBox="0 0 24 24" width="24" height="24"><path d="M13.36 18.64L6.73 12l6.63-6.64 1.28 1.28L9.27 12l5.37 5.36z"/></svg>');
6775            pb_icon_next = getOrDefault(settings, 'pb_icon_next', '<svg viewBox="0 0 24 24" width="24" height="24"><path d="M10.64 18.64l-1.28-1.28L14.73 12 9.36 6.64l1.28-1.28L17.27 12z"/></svg>');
6776            pb_icon_share = getOrDefault(settings, 'pb_icon_share', '<svg viewBox="0 0 28 28" width="28" height="28"><path d="M21 17c-1.24 0-2.33.58-3.07 1.46l-7.05-3.53c.07-.3.12-.61.12-.93s-.05-.63-.12-.93l7.05-3.53c.74.88 1.83 1.46 3.07 1.46 2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4c0 .32.05.63.12.93l-7.05 3.53C9.33 10.58 8.24 10 7 10c-2.21 0-4 1.79-4 4s1.79 4 4 4c1.24 0 2.33-.58 3.07-1.46l7.05 3.53c-.07.3-.12.61-.12.93 0 2.21 1.79 4 4 4s4-1.79 4-4-1.79-4-4-4zm0-12.2c1.21 0 2.2.99 2.2 2.2s-.99 2.2-2.2 2.2-2.2-.99-2.2-2.2.99-2.2 2.2-2.2zM7 16.2c-1.21 0-2.2-.99-2.2-2.2s.99-2.2 2.2-2.2 2.2.99 2.2 2.2-.99 2.2-2.2 2.2zm14 7c-1.21 0-2.2-.99-2.2-2.2s.99-2.2 2.2-2.2 2.2.99 2.2 2.2-.99 2.2-2.2 2.2z"></path></svg>');
6777            pb_icon_like = getOrDefault(settings, 'pb_icon_like', '<svg viewBox="0 0 28 28" width="28" height="28"><path d="m22.76 14.7-8.74 8.97-8.75-8.97m0 0c-2.31-2.32-2.37-6.14-.13-8.53 2.24-2.4 5.93-2.46 8.24-.14.23.23.44.48.63.75 1.93-2.67 5.59-3.2 8.16-1.2s3.09 5.79 1.16 8.45c-.18.24-.37.47-.58.68"></path><path d="M14.01 24.57c-.24 0-.48-.1-.64-.27l-8.74-8.97c-2.64-2.66-2.71-7.04-.15-9.78a6.576 6.576 0 0 1 4.74-2.12c1.79-.01 3.5.67 4.8 1.96a6.576 6.576 0 0 1 3.74-1.86c1.77-.25 3.54.22 4.97 1.34 2.95 2.29 3.55 6.64 1.33 9.69-.2.28-.42.54-.66.78l-.06.06-8.68 8.9c-.17.17-.4.27-.65.27zm-8.1-10.51c0 .01.01.01 0 0l8.1 8.32 8.1-8.31.06-.06c.15-.16.3-.33.43-.52 1.65-2.27 1.21-5.51-.98-7.22a4.723 4.723 0 0 0-3.61-.97c-1.31.2-2.47.91-3.27 2a.91.91 0 0 1-.73.37c-.29 0-.56-.14-.73-.38-.16-.22-.34-.44-.54-.64a4.78 4.78 0 0 0-3.49-1.43A4.83 4.83 0 0 0 5.8 6.78c-1.91 2.04-1.86 5.31.11 7.28z"></path></svg>');
6778            pb_text_back = getOrDefault(settings, 'pb_text_back', '');
6779            pb_text_prev = getOrDefault(settings, 'pb_text_prev', '');
6780            pb_text_next = getOrDefault(settings, 'pb_text_next', '');
6781            pb_text_share = getOrDefault(settings, 'pb_text_share', '');
6782        }
6783
6784        var like = {
6785            id: '', 
6786            active: '', 
6787            cnt: 0,
6788            svg: {
6789                forum: '<svg viewBox="0 0 28 28" width="28" height="28"><path d="m22.76 14.7-8.74 8.97-8.75-8.97m0 0c-2.31-2.32-2.37-6.14-.13-8.53 2.24-2.4 5.93-2.46 8.24-.14.23.23.44.48.63.75 1.93-2.67 5.59-3.2 8.16-1.2s3.09 5.79 1.16 8.45c-.18.24-.37.47-.58.68"></path><path d="M14.01 24.57c-.24 0-.48-.1-.64-.27l-8.74-8.97c-2.64-2.66-2.71-7.04-.15-9.78a6.576 6.576 0 0 1 4.74-2.12c1.79-.01 3.5.67 4.8 1.96a6.576 6.576 0 0 1 3.74-1.86c1.77-.25 3.54.22 4.97 1.34 2.95 2.29 3.55 6.64 1.33 9.69-.2.28-.42.54-.66.78l-.06.06-8.68 8.9c-.17.17-.4.27-.65.27zm-8.1-10.51c0 .01.01.01 0 0l8.1 8.32 8.1-8.31.06-.06c.15-.16.3-.33.43-.52 1.65-2.27 1.21-5.51-.98-7.22a4.723 4.723 0 0 0-3.61-.97c-1.31.2-2.47.91-3.27 2a.91.91 0 0 1-.73.37c-.29 0-.56-.14-.73-.38-.16-.22-.34-.44-.54-.64a4.78 4.78 0 0 0-3.49-1.43A4.83 4.83 0 0 0 5.8 6.78c-1.91 2.04-1.86 5.31.11 7.28z"></path></svg>',
6790                gallery: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m22.76 14.7-8.74 8.97-8.75-8.97m0 0c-2.31-2.32-2.37-6.14-.13-8.53 2.24-2.4 5.93-2.46 8.24-.14.23.23.44.48.63.75 1.93-2.67 5.59-3.2 8.16-1.2s3.09 5.79 1.16 8.45c-.18.24-.37.47-.58.68"></path><path d="M14.01 24.57c-.24 0-.48-.1-.64-.27l-8.74-8.97c-2.64-2.66-2.71-7.04-.15-9.78a6.576 6.576 0 0 1 4.74-2.12c1.79-.01 3.5.67 4.8 1.96a6.576 6.576 0 0 1 3.74-1.86c1.77-.25 3.54.22 4.97 1.34 2.95 2.29 3.55 6.64 1.33 9.69-.2.28-.42.54-.66.78l-.06.06-8.68 8.9c-.17.17-.4.27-.65.27zm-8.1-10.51c0 .01.01.01 0 0l8.1 8.32 8.1-8.31.06-.06c.15-.16.3-.33.43-.52 1.65-2.27 1.21-5.51-.98-7.22a4.723 4.723 0 0 0-3.61-.97c-1.31.2-2.47.91-3.27 2a.91.91 0 0 1-.73.37c-.29 0-.56-.14-.73-.38-.16-.22-.34-.44-.54-.64a4.78 4.78 0 0 0-3.49-1.43A4.83 4.83 0 0 0 5.8 6.78c-1.91 2.04-1.86 5.31.11 7.28z"></path></svg>',
6791            }
6792        };
6793        
6794        if(checkGallery) {
6795            toolbar_html.back = `<div class="toolbar-btn back hide">${pb_icon_back}${pb_text_back ? `<span class="btn-label">${pb_text_back}</span>` : ''}</div>`;
6796            likeData = getLike();
6797            likeData.done(function(data) {
6798                like.cnt = data.cnt;
6799                if (typeof data.own != 'undefined' && data.own) {
6800                    like.id = data.view;
6801                    like.active = 'active';
6802                }
6803            });
6804            toolbar_html.like = `
6805                <div class="toolbar-btn like hide ${like.active}" data-like="${like.id}">
6806                    <button type="button" class="btn">
6807                        ${pb_icon_like}
6808                        <span class="btn-label">${like.cnt}</span>
6809                    </button>
6810                </div>
6811            `;
6812        }
6813        if(checkForum && typeof viewData != 'undefined') {
6814            let fmLikeCnt = (typeof viewData.fm_like_cnt != 'undefined')? viewData.fm_like_cnt : 0;
6815            if(typeof viewData.check_like_own != 'undefined' && viewData.check_like_own) {
6816                like.id = viewData.id;
6817                like.active = 'active';
6818            }
6819            toolbar_html.like = `
6820                <div class="toolbar-btn like hide ${like.active}" data-like="${like.id}">
6821                    <button type="button" class="btn">
6822                        ${like.svg[eltype]}
6823                        <span class="btn-label">${fmLikeCnt}</span>
6824                    </button>
6825                </div>
6826            `;
6827        }
6828        
6829
6830        
6831        var share = {
6832                svg: {
6833                    forum: '',
6834                    gallery: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M21 17c-1.24 0-2.33.58-3.07 1.46l-7.05-3.53c.07-.3.12-.61.12-.93s-.05-.63-.12-.93l7.05-3.53c.74.88 1.83 1.46 3.07 1.46 2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4c0 .32.05.63.12.93l-7.05 3.53C9.33 10.58 8.24 10 7 10c-2.21 0-4 1.79-4 4s1.79 4 4 4c1.24 0 2.33-.58 3.07-1.46l7.05 3.53c-.07.3-.12.61-.12.93 0 2.21 1.79 4 4 4s4-1.79 4-4-1.79-4-4-4zm0-12.2c1.21 0 2.2.99 2.2 2.2s-.99 2.2-2.2 2.2-2.2-.99-2.2-2.2.99-2.2 2.2-2.2zM7 16.2c-1.21 0-2.2-.99-2.2-2.2s.99-2.2 2.2-2.2 2.2.99 2.2 2.2-.99 2.2-2.2 2.2zm14 7c-1.21 0-2.2-.99-2.2-2.2s.99-2.2 2.2-2.2 2.2.99 2.2 2.2-.99 2.2-2.2 2.2z"></path></svg>',
6835                },
6836                label: {
6837                    forum: $.lang[view_lang ]['board.button.share'],
6838                    gallery: '',
6839                }
6840            };
6841        var share_icon = (checkGallery && pb_icon_share) ? pb_icon_share : share.svg[eltype];
6842        var share_label = (checkGallery && pb_text_share) ? pb_text_share : share.label[eltype];
6843        toolbar_html.share = `
6844            <div class="toolbar-btn share hide">
6845                <button type="button" class="btn">
6846                    ${share_icon}
6847                    ${share_label ? '<span class="btn-label">'+share_label+'</span>' : ''}
6848                </button>
6849            </div>
6850        `;
6851
6852        if(checkGallery) {
6853            toolbar_html.bottomnav = `
6854                <div class="toolbar-btn bottomnav hide">
6855                    <div class="btn data-page-back active">${pb_icon_back}</div>
6856                    <div class="btn data-page-prev ${($('.data-page-prev').hasClass('active')) ? 'active' : ''}">${pb_icon_prev}${pb_text_prev ? `<span class="btn-label">${pb_text_prev}</span>` : ''}</div>
6857                    <div class="btn data-page-next ${($('.data-page-next').hasClass('active')) ? 'active' : ''}">${pb_icon_next}${pb_text_next ? `<span class="btn-label">${pb_text_next}</span>` : ''}</div>
6858                </div>
6859            `;
6860        }
6861
6862        var toolbar_str = '',
6863            toolbar_arr = (checkForum) ? ['like','share'] : ['back','share','like','bottomnav'];
6864        $.each(toolbar_arr, function(i,k) {
6865            toolbar_str += toolbar_html[k];
6866        });
6867        var toolbar_html = `
6868            <div class="page-toolbars" data-type="${eltype}" data-page-option="${option}">
6869                <div class="toolbar-wrap">
6870                    ${toolbar_str}
6871                </div>
6872            </div>
6873        `;
6874
6875        if(checkForum) {
6876            if($('.page-toolbars').length == 0) {
6877                if(checkModoo) $('.tpl-forum-modoo-reply').prepend(toolbar_html);
6878                else $('.tpl-forum-list-footer').prepend(toolbar_html);
6879            }
6880        }
6881        if(checkGallery) {
6882            var tmpToolbar = $(toolbar_html);
6883            tmpToolbar.wrapInner('<div class="container"><div class="row"><div class="col-md-12 col-sm-12 col-xs-12"></div></div></div></div>');
6884
6885            var beforePositon = $('.el-footer');
6886            if(PAGE_MODE == 'c') {
6887                if($('.page-comments').length > 0) beforePositon = $('.page-comments');
6888                else if($('.page-bottomlist').length > 0) beforePositon = $('.page-bottomlist');
6889                else if($('.el-footer_ctrl').length > 0) beforePositon = $('.el-footer_ctrl');
6890                else beforePositon = $('.add-footer-information');
6891            }
6892            if(beforePositon.length > 0) beforePositon.before(tmpToolbar.prop('outerHTML'));
6893            else $('.dsgn-body').append(tmpToolbar.prop('outerHTML'));
6894
6895            if(PAGE_MODE == 'c' && $('.el-fixedcontact').length) {
6896                var fixedContactEL = $('.el-fixedcontact').attr('data-el');
6897                $('.el-footer_ctrl').before($('.' + fixedContactEL + '_ctrl'));
6898                $('.el-footer_ctrl').before($('.el-fixedcontact'));
6899            }
6900        }
6901
6902        deferred.resolve($('.page-toolbars'));
6903        return deferred.promise();
6904    }
6905
6906    var setViewPageBottomDefaultSettings = function(settings, parent, eltype) {
6907        if(typeof settings == 'undefined' || !settings || typeof settings != 'object') return settings;
6908
6909        var isGallery = (eltype == 'gallery' && (parent && parent.mode == 'project')) ? true : false;
6910
6911        return settings;
6912    }
6913
6914    var setViewPageToolbar = function(field) {
6915        if(typeof PARENT == 'undefined' && typeof property.PARENT == 'undefined') return false;
6916        
6917        if(typeof field == 'undefined') field = '';
6918
6919        var this_page = (PAGE_MODE == 'c') ? PAGE : property.PAGE,
6920            this_view = (PAGE_MODE == 'c') ? VIEW : property.VIEW,
6921            eltype = (this_page.match(/^forum\,/) !== null) ? 'forum' : 'gallery',
6922            checkConfig = (PAGE_MODE == 'c') ? true : false,
6923            checkForum = (eltype == 'forum') ? true : false,
6924            checkGallery = (eltype == 'gallery') ? true : false,
6925            checkPlan = (checkConfig) ? VALIDPLAN : property.VALIDPLAN,
6926            checkMLock = (checkConfig) ? false : (typeof property.ISLOCK != 'undefined' && property.ISLOCK == 'true') ? true : false,
6927            parent = (checkConfig) ? PARENT : property.PARENT;
6928
6929        if(!this_view
6930            || (checkGallery && !checkConfig && (property.COUNT === 0 || $('.error_404.element[data-name="error_404"]').length === 1))
6931        ) return false;
6932
6933        var option = (parent.settings) ? jQuery.parseJSON(parent.settings) : {};
6934        option = setViewPageBottomDefaultSettings(option, parent, eltype);
6935        var check = {};
6936        if(checkGallery) {
6937            check = (field == '') ? {back:true, share:true, like:true, bottomnav:true, bottomlist:true} : {
6938                bottomlist: (field == 'bottomlist') ? true : false,
6939                share: (field == 'share') ? true : false,
6940                like: (field == 'like') ? true : false,
6941                bottomnav: (field == 'bottomnav') ? true : false,
6942            };
6943        } else {
6944            check = (field == '') ? {share:true, like:true, bottomnav:true, bottomlist:true} : {
6945                bottomlist: (field == 'bottomlist') ? true : false, 
6946                share: (field == 'share') ? true : false, 
6947                like: (field == 'like') ? true : false, 
6948                bottomnav: (field == 'bottomnav') ? true : false, 
6949            };
6950        }
6951        // console.log(option);
6952        if(checkMLock) return false;
6953        $.each(check, function(k,onoff) {
6954            if(!onoff) return true;
6955
6956            switch(k) {
6957                case 'back':
6958                    onoff = (typeof option.bottomNav_display != 'undefined' && option.bottomNav_display == 'ON') ? true : false;
6959                    if(onoff) $('.page-toolbars .toolbar-btn.back').removeClass('hide');
6960                    break
6961    
6962                case 'share':
6963                    onoff = (typeof option.sns_share_display != 'undefined' && option.sns_share_display == 'ON') ? true : false;
6964                    if(onoff) $('.page-toolbars .toolbar-btn.share').removeClass('hide');
6965                    break
6966    
6967                case 'like':
6968                    if(!checkPlan) break;
6969
6970                    onoff = (typeof option.like_display != 'undefined' && option.like_display != 'N') ? true : false;
6971                    // if(checkGallery && typeof option.field_disable != 'undefined' && option.field_disable && $.inArray('like', option.field_disable) > -1) onoff = false;
6972                    if(onoff) $('.page-toolbars .toolbar-btn.like').removeClass('hide');
6973                    break
6974    
6975                case 'bottomnav':
6976                    onoff = (typeof option.bottomNav_display != 'undefined' && option.bottomNav_display == 'ON') ? true : false;
6977                    if(onoff) $('.page-toolbars .toolbar-btn.bottomnav').removeClass('hide');
6978                    break
6979    
6980                case 'bottomlist':
6981                    onoff = (typeof option.bottomlist_display != 'undefined' && option.bottomlist_display == 'ON') ? true : false;
6982                    if(onoff) $.bottomlist.init();
6983                    break
6984    
6985                default:
6986                    break
6987            }
6988
6989        });
6990
6991        var $pbEl = $('[data-type="page_bottom"]').first();
6992        if($pbEl.length > 0) {
6993            var hasVisible = $pbEl.find('.toolbar-btn').not('.hide').length > 0
6994                          || $pbEl.find('.page-comments').length > 0
6995                          || $pbEl.find('.page-bottomlist').not('.hide').length > 0;
6996            $pbEl.toggleClass('empty', !hasVisible);
6997        }
6998    }
6999
7000    var initViewPageBottom = function(option, settings, viewData) { //page bottom
7001        var deferred = $.Deferred();
7002        if (typeof option == 'undefined') option = '';
7003
7004        let checkConfig = (PAGE_MODE == 'c') ? true : false;
7005        let $existingBottomEL = $('[data-type="page_bottom"]').first();
7006        let parent = (checkConfig) ? PARENT : property.PARENT;
7007
7008        if (typeof settings == 'undefined' || !settings) {
7009            settings = (parent && parent.settings) ? (typeof parent.settings == 'string' ? $.parseJSON(parent.settings) : parent.settings) : {};
7010        }
7011        let rawSettings = $.extend(true, {}, settings);
7012        settings = setViewPageBottomDefaultSettings(settings, parent, 'gallery');
7013        let view = (checkConfig) ? VIEW : property.VIEW;
7014        let parentSeq = parent.pid;
7015        let elClass = `el_${$('.element:not(.el-menu):not(.el-footer)').length}`;
7016        let dataCase = (typeof settings.pb_template_elname != 'undefined')? settings.pb_template_elname : '';
7017        if(!dataCase && $existingBottomEL.length > 0) dataCase = $existingBottomEL.attr('data-case');
7018        if(!dataCase) dataCase = 'page-bottom1';
7019        let configEL = `
7020                <div class="${elClass}_ctrl config-element-section" data-id="page_bottom_${parentSeq}"><div class="config-element"><svg viewBox="0 0 19 19" width="23" height="23"><path d="M17.16 8.16l1.41-1.51c-0.2-0.65-0.48-1.28-0.84-1.9 -0.35-0.61-0.77-1.17-1.23-1.67l-2.02 0.46c-0.7-0.58-1.48-1.03-2.32-1.34l-0.61-1.97C10.9 0.08 10.21 0 9.5 0 8.79 0 8.1 0.08 7.44 0.22L6.83 2.2h0C5.98 2.51 5.19 2.97 4.51 3.54L2.5 3.08c-0.46 0.5-0.87 1.06-1.23 1.67S0.64 6 0.44 6.65l1.4 1.52c-0.16 0.89-0.15 1.8 0 2.68l-1.41 1.51c0.2 0.65 0.48 1.28 0.84 1.9s0.77 1.17 1.23 1.67l2.02-0.46c0.7 0.58 1.48 1.03 2.32 1.34l0.61 1.97v0C8.1 18.92 8.79 19 9.5 19c0.71 0 1.4-0.08 2.06-0.22l0.61-1.97c0.85-0.31 1.63-0.77 2.32-1.34l2.01 0.46c0.46-0.5 0.87-1.06 1.23-1.67 0.35-0.61 0.63-1.25 0.84-1.9l-1.4-1.52C17.31 9.94 17.31 9.04 17.16 8.16zM9.5 15.5c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6S12.81 15.5 9.5 15.5z"/></svg></div></div>
7021                `;
7022        let $bottomEL = ($existingBottomEL.length > 0)
7023            ? $existingBottomEL
7024            : $(`<div class="element ${elClass} page_bottom_${parentSeq} page-bottom" data-id="page_bottom_${parentSeq}" data-el="${elClass}" data-parent-id="${parentSeq}" data-case="${dataCase}" data-type="page_bottom"></div>`);
7025        if(dataCase) {
7026            $bottomEL.attr('data-case', dataCase);
7027            $bottomEL.removeClass(function(i, cls) {
7028                return (cls.match(/\bpage-bottom\d+\b/) || []).join(' ');
7029            }).addClass(dataCase);
7030        }
7031
7032        initViewPageToolbar(option, settings, viewData).always(function(pageToolbar) {
7033            if (PAGE_MODE == 'c' && view && settings.comment_display == 'ON') displayComment();
7034            if (typeof setViewPageToolbar == 'function') {
7035                setViewPageToolbar();
7036            }
7037
7038            var attachBottomArea = function() {
7039                let $toolbarEL = $('.page-toolbars').first();
7040                let $commentEL = $('.page-comments').first();
7041                let $bottomlistEL = $('.page-bottomlist').first();
7042                if ($commentEL.length > 0) {
7043                    if (settings.comment_display == 'OFF') $commentEL.addClass('hide');
7044                    else if (settings.comment_display == 'ON') $commentEL.removeClass('hide');
7045                }
7046                let hasVisibleToolbar = ($toolbarEL.length > 0 && $toolbarEL.find('.toolbar-btn').not('.hide').length > 0);
7047                let hasVisibleComment = ($commentEL.length > 0 && !$commentEL.hasClass('hide'));
7048                let hasExplicitPageBottom = (
7049                    $existingBottomEL.length > 0
7050                    || typeof rawSettings.pb_template_seq != 'undefined'
7051                    || typeof rawSettings.pb_template_elname != 'undefined'
7052                    || typeof rawSettings.pb_blockname != 'undefined'
7053                );
7054                let isProjectGallery = (parent && parent.mode == 'project');
7055                let hasExplicitToolbarSetting = (
7056                    isProjectGallery
7057                    || hasExplicitPageBottom
7058                    || typeof rawSettings.bottomNav_display != 'undefined'
7059                    || typeof rawSettings.like_display != 'undefined'
7060                    || typeof rawSettings.sns_share_display != 'undefined'
7061                    || typeof rawSettings.bottomlist_display != 'undefined'
7062                );
7063                let hasExplicitCommentSetting = (isProjectGallery || hasExplicitPageBottom || typeof rawSettings.comment_display != 'undefined');
7064                let hasBottomChildren = (
7065                    (hasVisibleToolbar && hasExplicitToolbarSetting)
7066                    || (hasVisibleComment && hasExplicitCommentSetting)
7067                    || ($bottomlistEL.length > 0 && hasExplicitToolbarSetting)
7068                );
7069                if (!hasBottomChildren && !isProjectGallery) return false;
7070
7071                if ($bottomEL.parent().length === 0) {
7072                    let beforePositon = $('.el-footer').first();
7073                    if (checkConfig) {
7074                        if ($commentEL.length > 0) beforePositon = $commentEL;
7075                        else if ($bottomlistEL.length > 0) beforePositon = $bottomlistEL;
7076                        else if ($('.el-footer_ctrl').length > 0) beforePositon = $('.el-footer_ctrl').first();
7077                        else beforePositon = $('.add-footer-information').first();
7078                    }
7079                    if (beforePositon.length > 0) beforePositon.before($bottomEL);
7080                    else $('.dsgn-body').append($bottomEL);
7081                }
7082
7083                if ($toolbarEL.length > 0 && $toolbarEL.parent()[0] !== $bottomEL[0]) $bottomEL.prepend($toolbarEL);
7084                if ($commentEL.length > 0 && $commentEL.parent()[0] !== $bottomEL[0]) {
7085                    if ($bottomlistEL.length > 0 && $bottomlistEL.parent()[0] === $bottomEL[0]) $bottomlistEL.before($commentEL);
7086                    else $bottomEL.append($commentEL);
7087                }
7088                if ($bottomlistEL.length > 0 && $bottomlistEL.parent()[0] !== $bottomEL[0]) $bottomEL.append($bottomlistEL);
7089                return true;
7090            }
7091
7092            let hasBottomChildren = attachBottomArea();
7093            
7094            var hasVisible = $bottomEL.find('.toolbar-btn').not('.hide').length > 0
7095                          || $bottomEL.find('.page-comments').not('.hide').length > 0
7096                          || $bottomEL.find('.page-bottomlist').not('.hide').length > 0;
7097
7098            $bottomEL.toggleClass('empty', !hasVisible);
7099
7100            var _pb_settings = (typeof settings == 'string') ? $.parseJSON(settings) : settings;
7101            if(typeof setBlockAOS == 'function' && checkConfig == false) setBlockAOS($bottomEL, {block: _pb_settings, skipRefresh: true});
7102            if(typeof setBlockParallax == 'function' && _pb_settings.pb_parallax == 'true') {
7103                $bottomEL.attr({'data-parallax':'true', 'data-parallax-effect': _pb_settings.pb_parallax_effect || 'fixed'});
7104                if(_pb_settings.pb_parallax_media) $bottomEL.attr('data-parallax-media', _pb_settings.pb_parallax_media);
7105                if(typeof setBlockElem == 'function') setBlockElem($bottomEL);
7106                setBlockParallax($bottomEL);
7107            } else if(typeof setBlockParallax == 'function') {
7108                $bottomEL.removeAttr('data-parallax data-parallax-effect data-parallax-media');
7109            }
7110            var _pb_siteSettings = (checkConfig) ? SETTINGS : property.SETTINGS;
7111            var _pbHasBookmark = (parentSeq && _pb_siteSettings && _pb_siteSettings.blockBookmarkList && typeof _pb_siteSettings.blockBookmarkList['bookmarkpb' + parentSeq] != 'undefined');
7112            if(_pbHasBookmark) $bottomEL.attr('data-bookmark', 'pb' + parentSeq);
7113            else $bottomEL.removeAttr('data-bookmark');
7114            var _pb_colorset = (_pb_settings.viewpage_colorset) ? _pb_settings.viewpage_colorset : {};
7115            if(typeof _pb_colorset.__pb_content_wrap_width != 'undefined' && _pb_colorset.__pb_content_wrap_width == '100%') {
7116                $bottomEL.addClass('full-width');
7117            } else {
7118                $bottomEL.removeClass('full-width');
7119            }
7120
7121            if (checkConfig && hasBottomChildren && $('[data-type="page_bottom"].config-element-section').length === 0) {
7122                $bottomEL.before(configEL);
7123            }
7124
7125            deferred.resolve(($bottomEL.length > 0 && hasBottomChildren)
7126                ? $bottomEL
7127                : ((typeof pageToolbar != 'undefined' && pageToolbar) ? pageToolbar : $('.page-toolbars')));
7128        });
7129        return deferred.promise();
7130    }
7131    var setViewPageStyle = function() {
7132        $('body').find('.clViewPageStyle').remove();
7133        if(typeof PAGE_MODE == 'undefined') return false;
7134
7135        var tmp_v = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
7136        var tmp_parent = (PAGE_MODE == 'c') ? PARENT : property.PARENT;
7137        var tmp_page = (PAGE_MODE == 'c') ? PAGE : property.PAGE;
7138        if(!tmp_v) return false;
7139
7140        var checkGalleryView = (tmp_v && tmp_page.match(/^forum,/g) === null) ? true : false;
7141        var checkForumView = !checkGalleryView;
7142
7143        var elid = tmp_parent.pid;
7144        var elname = tmp_parent.element;
7145        var elcss = (typeof tmp_parent.elcss != 'undefined') ? CSSJSON.toJSON(htmlspecialchars_decode(tmp_parent.elcss)) : CSSJSON.toJSON;
7146        var elstyle = style.get(elcss,`.${elname}`);
7147        var elsettings = (typeof tmp_parent.settings != 'undefined') ? $.parseJSON(tmp_parent.settings) : {};
7148        var viewcss = {root:'', body:'', add:''};
7149
7150        var body_selector = (isElview) ? 'body' : 'body > .dsgn-body';
7151        var body_s = {background_image:'none'};
7152        if(!elstyle.undefined) {
7153            if(Coloris.getColorRegex().test(elstyle.bgColor)) body_s.background_color = elstyle.bgColor;
7154            if(elstyle.bgUrl != '') body_s.background_image = elstyle.bgUrl;
7155            if(elstyle.bgPosition != '') body_s.background_position = elstyle.bgPosition;
7156            if(elstyle.bgRepeat != '') body_s.background_repeat = elstyle.bgRepeat;
7157            if(elstyle.bgSize != '') body_s.background_size = elstyle.bgSize;
7158        }
7159
7160        if(checkGalleryView) {
7161            var galproject_style = style.get(elcss,`.${elname} .galProjectBg`);
7162            if(!galproject_style.undefined) {
7163                if(Coloris.getColorRegex().test(galproject_style.bgColor)) body_s.background_color = galproject_style.bgColor;
7164                if(galproject_style.bgUrl != '') body_s.background_image = galproject_style.bgUrl;
7165                if(galproject_style.bgPosition != '') body_s.background_position = galproject_style.bgPosition;
7166                if(galproject_style.bgRepeat != '') body_s.background_repeat = galproject_style.bgRepeat;
7167                if(galproject_style.bgSize != '') body_s.background_size = galproject_style.bgSize;
7168            }
7169        } else {
7170        }
7171
7172        Object.keys(body_s).forEach(function(key) {
7173            viewcss.body += `${key.replace(/_/g, '-')}: ${body_s[key]}; `;
7174        });
7175
7176        if(checkForumView) {
7177            // old version
7178            if(typeof elstyle.__forum_color == 'undefined') {
7179                elstyle.__forum_color = (typeof elsettings.forum_color != 'undefined') ? elsettings.forum_color : '#191919';
7180                if($.inArray(elstyle.__forum_color, ['black','white']) > -1) elstyle.__forum_color = (elstyle.__forum_color == 'white') ? '#ffffff' : '#191919';
7181                elstyle.__forum_color_rgb = Coloris.getChangeColorVal(elstyle.__forum_color,'rgb_str');
7182            }
7183
7184            var f_color = elstyle.__forum_color;
7185            var f_color_rgb = elstyle.__forum_color_rgb;
7186            viewcss.root += `
7187                --forum-color: ${f_color};
7188                --forum-color-rgb: ${f_color_rgb};
7189            `;
7190            viewcss.add += `
7191                .forum-view .forum-write .tpl-forum-title {
7192                    font-size: 2em;
7193                    font-family: 'Noto Sans','Noto Sans Kr';
7194                    height: auto;
7195                    line-height: 1.4;
7196                }
7197                .forum-user-info li.user-ctrl .dropdown-menu {
7198                    ${viewcss.body} 
7199                }
7200            `;
7201        }
7202
7203        if(typeof elsettings.viewpage_colorset !== 'undefined') {
7204            Object.keys(elsettings.viewpage_colorset).forEach(function(key) {
7205                var cssKey = key.replace(/_/g, '-');  // _를 -로 변경
7206                var cssValue = elsettings.viewpage_colorset[key];
7207                if(key == '__pb_background_image_url' && cssValue && cssValue != 'none') cssValue = 'url(' + cssValue + ')';
7208                viewcss.root += `${cssKey}: ${cssValue}; `;
7209
7210                if(checkForumView) {
7211                    var checkColorRgb = ($.inArray(key, ['__like_color','__like_color_active','__share_color','__comment_color']) > -1) ? true : false;
7212                    if(checkColorRgb) {
7213                        viewcss.root += `${cssKey}-rgb: ${Coloris.getChangeColorVal(cssValue,'rgb_str')}; `;
7214                    }
7215                }
7216            });
7217        } else {
7218            var block_color = getOrDefault(elsettings,`${checkForumView ? 'forum' : 'gallery'}_color`,''),
7219                root_color = {
7220                    comment: {default:'#222428', placeholder:'rgba(34,36,40,0.8)', disabled:'rgba(34,36,40,0.05)', line:'rgba(34,36,40,0.2)', radius: '0px', shadow: 'none'},
7221                    like: {default:'#505050', active:'#ee445f'},
7222                    share: '#505050',
7223                    bottomnav: {default:'#505050', disabled:'rgba(80,80,80,0.2)'},
7224                    bottomlist: {default:'#777777', disabled:'rgba(119,119,119,0.2)'},
7225                };
7226            if($.inArray(block_color, ['black','white']) > -1) block_color = (block_color == 'white') ? '#ffffff' : '#191919';
7227            console.log('block_color', block_color);
7228            if(block_color) {
7229                if(checkGalleryView) { // gallery
7230                    root_color.comment = {default:block_color, placeholder:Coloris.getChangeColorVal(block_color,'a',0.8), disabled:Coloris.getChangeColorVal(block_color,'a',0.05), line:root_color.comment.line};
7231                    root_color.share = block_color;
7232                    root_color.bottomnav = {default:block_color, disabled:Coloris.getChangeColorVal(block_color,'a',0.2)};
7233                    root_color.bottomlist = {default:block_color, disabled:Coloris.getChangeColorVal(block_color,'a',0.2)};
7234                } else { // forum
7235                    root_color.comment = {default:block_color, placeholder:Coloris.getChangeColorVal(block_color,'a',0.8), disabled:Coloris.getChangeColorVal(block_color,'a',0.05), line:Coloris.getChangeColorVal(block_color,'a',0.2)};
7236                    root_color.share = block_color;
7237                    root_color.bottomnav = {default:block_color, disabled:Coloris.getChangeColorVal(block_color,'a',0.2)};
7238                    root_color.bottomlist = {default:block_color, disabled:Coloris.getChangeColorVal(block_color,'a',0.2)};
7239                }
7240            }
7241
7242            if(checkGalleryView) {
7243                if(getOrDefault(elsettings,'gl_like_color','') != '') root_color.like.default = elsettings.gl_like_color;
7244                if(getOrDefault(elsettings,'gl_likeActive_color','') != '') root_color.like.active = elsettings.gl_likeActive_color;
7245            }
7246            if(checkForumView) {
7247                if(getOrDefault(elsettings,'fm_like_color','') != '') root_color.like.default = elsettings.fm_like_color;
7248                if(getOrDefault(elsettings,'fm_likeActive_color','') != '') root_color.like.active = elsettings.fm_likeActive_color;
7249            }
7250
7251            viewcss.root += `
7252                --comment-color: ${root_color.comment.default};
7253                --comment-color-placeholder: ${root_color.comment.placeholder};
7254                --comment-color-disabled: ${root_color.comment.disabled};
7255                --comment-line: ${root_color.comment.line};
7256                --comment-radius: ${root_color.comment.radius};
7257                --comment-shadow: ${root_color.comment.shadow};
7258                --like-color: ${root_color.like.default};
7259                --like-color-active: ${root_color.like.active};
7260                --share-color:  ${root_color.share};
7261                --bottomnav-color: ${root_color.bottomnav.default};
7262                --bottomnav-color-disabled': ${root_color.bottomnav.disabled};
7263                --bottomlist-color': ${root_color.bottomlist.default};
7264                --bottomlist-color-disabled': ${root_color.bottomlist.disabled};
7265            `;
7266        }
7267        
7268        var viewcss_str = `
7269            :root { /* Viewpage Root Style */
7270                ${viewcss.root}
7271            }
7272
7273            ${body_selector} {
7274                ${viewcss.body}
7275                height: auto !important;
7276            }
7277            .page-comments .tpl-comment-form { border-radius: var(--comment-radius); box-shadow: var(--comment-shadow); }
7278            ${viewcss.add}
7279        `;
7280
7281        var isElview = ($('.elviewcss').length > 0) ? true : false;
7282        if (isElview) $('.elviewcss').after(`<style class="clViewPageStyle">${viewcss_str}</style>`);
7283        else $('#dsgn-body').after(`<style class="clViewPageStyle">${viewcss_str}</style>`);
7284    }
7285
7286
7287    var appendGalleryFrame = function(tpl,id,type,elsettings) {
7288        if(typeof tpl == 'undefined') return '';
7289        if(typeof id == 'undefined') return tpl;
7290        if(typeof type == 'undefined' || !type) type = 'gallery';
7291
7292        var gframe_selector = (type == 'sync') ? `sframe-${id}` : `gframe-${id}`;
7293        tpl.find('[data-gallery]').attr('data-gallery', `#${gframe_selector}`);
7294
7295        var settings = (typeof elsettings == 'object') ? elsettings : {};
7296        if ($.isEmptyObject(settings)) settings = (typeof elsettings != 'undefined' && elsettings) ? $.parseJSON(elsettings) : {};
7297
7298        var img_onoff = (typeof settings.img_original_display != 'undefined' && settings.img_original_display) ? settings.img_original_display : 'ON',
7299            title_onoff = (typeof settings.gframe_title_visible != 'undefined' && settings.gframe_title_visible == 'OFF') ? 'OFF' : 'ON',
7300            like = (typeof settings.like_display != 'undefined' && settings.like_display) ? settings.like_display : 'N';
7301
7302        tpl.find('[data-gallery]').attr({ 'data-img-original': img_onoff, 'data-gallery-title': title_onoff, 'data-gallery-like': like });
7303        if (!title_onoff) tpl.find('[data-gallery]').attr({ 'data-title': '' });
7304
7305        galleryFrame(id,type,settings);
7306        return tpl;
7307    }
7308    var galleryFrame = function(id,type,settings) {
7309        if(typeof id == 'undefined') id = '';
7310        if(typeof type == 'undefined' || !type) type = 'gallery';
7311        if(typeof settings == 'undefined' || typeof settings != 'object') settings = {};
7312        // console.log(id,type,settings);
7313        var autoplay = (typeof settings.gframe_autoplay != 'undefined' && settings.gframe_autoplay == 'ON') ? true : false,
7314            interval = (typeof settings.gframe_interval != 'undefined' && settings.gframe_interval) ? settings.gframe_interval : 5000,
7315            like_color = (typeof settings.viewpage_colorset != 'undefined' && typeof settings.viewpage_colorset.__like_color != 'undefined' && Coloris.getColorRegex().test(settings.viewpage_colorset.__like_color)) ? settings.viewpage_colorset.__like_color : '#505050',
7316            like_color_active = (typeof settings.viewpage_colorset != 'undefined' && typeof settings.viewpage_colorset.__like_color_active != 'undefined' && Coloris.getColorRegex().test(settings.viewpage_colorset.__like_color_active)) ? settings.viewpage_colorset.__like_color_active : '#ee445f';
7317        var gframe_selector = (type == 'sync') ? `sframe-${id}` : `gframe-${id}`;
7318        let isYoutubeShorts = false;
7319
7320        if(type == 'video') {
7321            let type2 = $('.element[data-id="' + id + '"]').attr('data-type2');
7322            if(type2 == 'shorts') isYoutubeShorts = true;
7323        }
7324        $(`#${gframe_selector}`).remove();
7325        var str = `
7326            <div id="${gframe_selector}" class="blueimp-gallery blueimp-gallery-controls" data-start-slideshow="${(autoplay) ? 'true' : 'false'}" data-slideshow-interval="${interval}" data-yt-shorts="${isYoutubeShorts}">
7327                <div class="slides"></div>
7328                <div class="zoomable hide"></div>
7329                <h3 class="title"></h3>
7330                <a class="prev"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="M31.33 42 12 22 31.33 2l.67.69L13.34 22 32 41.31z"/></svg></a>
7331                <a class="next"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="M12.67 2 32 22 12.67 42l-.67-.69L30.66 22 12 2.69z"/></svg></a>
7332                ${(type == 'gallery') ? '<div class="slide-index"><span class="current-slide"></span>/<span class="total-slide"></span></div>' : ''}
7333                <a class="close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22"><polygon points="22 1.06 20.94 0 11 9.94 1.06 0 0 1.06 9.94 11 0 20.94 1.06 22 11 12.06 20.94 22 22 20.94 12.06 11 "/></svg></a>
7334                <a class="play-pause">
7335                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m5.3 4.08 17 9.92-17 9.92V4.08m-.4-2.1c-.73 0-1.4.58-1.4 1.4v21.24a1.397 1.397 0 0 0 2.1 1.21l18.19-10.62c.93-.54.93-1.88 0-2.42L5.61 2.17c-.23-.13-.47-.19-.71-.19z"/></svg>
7336                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><g><path d="M7.6 25.5c-.77 0-1.4-.63-1.4-1.4V3.9c0-.77.63-1.4 1.4-1.4.77 0 1.4.63 1.4 1.4v20.2c0 .77-.63 1.4-1.4 1.4zM20.4 25.5c-.77 0-1.4-.63-1.4-1.4V3.9c0-.77.63-1.4 1.4-1.4.77 0 1.4.63 1.4 1.4v20.2c0 .77-.63 1.4-1.4 1.4z"/></g></svg>
7337                </a>
7338                <a class="gallery-like"></a>
7339                <ol class="indicator"></ol>
7340            </div>
7341        `;
7342
7343            // https://flow.team/l/1meSh
7344            // $(`.${type}-frame`).append(str);
7345            // document.querySelector(`#${gframe_selector}`).style.setProperty('--like-color', like_color, null);
7346            // document.querySelector(`#${gframe_selector}`).style.setProperty('--like-color-active', like_color_active, null);
7347
7348            $(`.${type}-frame`).append(str);
7349            var gframeEl = document.querySelector(`#${gframe_selector}`);
7350
7351            if (gframeEl) {
7352                gframeEl.style.setProperty('--like-color', like_color, null);
7353                gframeEl.style.setProperty('--like-color-active', like_color_active, null);
7354            } else {
7355                console.log('엘리먼트가 아직 DOM에 없음');
7356                setTimeout(function() {
7357                    var gframeElRetry = document.querySelector(`#${gframe_selector}`);
7358                    if (gframeElRetry) {
7359                        gframeElRetry.style.setProperty('--like-color', like_color, null);
7360                        gframeElRetry.style.setProperty('--like-color-active', like_color_active, null);
7361                    }
7362                }, 0); 
7363            }
7364
7365        // $(`#${gframe_selector}`).on('close', function (event) {
7366        //     console.log('lightbox close');
7367        // });
7368    }
7369
7370    // 인증창 호출 함수
7371    function auth_type_check(outside) {
7372        if (typeof outside === 'undefined' || !outside) outside = false;
7373
7374        var auth_form = document.form_auth;
7375
7376        // if (auth_form.ordr_idxx.value == "") {
7377        //     alert("요청번호는 필수 입니다.");
7378        //     return false;
7379        // } else {
7380        var hostname = window.location.hostname;
7381        var checkDomain = !(hostname.includes('creatorlink') || hostname.includes('addblock'));
7382
7383        if (checkDomain && window.location.protocol == 'http:') {
7384            alert($.lang[LANG]['manager.cert.disable.domain']);
7385            return false
7386        }
7387
7388        if(isMobile()) {
7389            if (window.sessionStorage) {
7390                sessionStorage.removeItem('kcpCertSubmitting');
7391                sessionStorage.setItem('kcpCertReturnUrl', window.location.href);
7392            }
7393            auth_form.target = "_self";
7394        } else { // 스마트폰이 아닌경우
7395            var return_gubun;
7396            var width = 410;
7397            var height = 500;
7398
7399            var leftpos = screen.width / 2 - (width / 2);
7400            var toppos = screen.height / 2 - (height / 2);
7401
7402            var winopts = "width=" + width + ", height=" + height + ", toolbar=no,status=no,statusbar=no,menubar=no,scrollbars=no,resizable=no";
7403            var position = ",left=" + leftpos + ", top=" + toppos;
7404            var AUTH_POP = window.open('', 'auth_popup', winopts + position);
7405
7406            auth_form.target = "auth_popup"; // !!주의 고정값 ( 리턴받을때 사용되는 타겟명입니다.)
7407        }
7408
7409        auth_form.method = "post";
7410
7411        // 인증창 호출 및 결과값 리턴 페이지 주소
7412        if(window.location.pathname.includes('/upgrade') || window.location.pathname.includes('/mypage') || window.location.pathname.includes('/dashboard')) {
7413            auth_form.action = '/upgrade_cert_req';
7414        } else {
7415            auth_form.action = "/cert_req";
7416        }
7417
7418        if (outside) {
7419            auth_form.submit();
7420            return false;
7421        } else {
7422            return true;
7423        }
7424        // }
7425    }
7426
7427    // 요청번호 생성 예제 ( up_hash 생성시 필요 ) 
7428    function init_orderid() {
7429        var today = new Date();
7430        var year = today.getFullYear();
7431        var month = today.getMonth() + 1;
7432        var date = today.getDate();
7433        var time = today.getTime();
7434
7435        if (parseInt(month) < 10) {
7436            month = "0" + month;
7437        }
7438
7439        var vOrderID = year + "" + month + "" + date + "" + time;
7440
7441        if (document.form_auth !== undefined && document.form_auth.ordr_idxx) {
7442            document.form_auth.ordr_idxx.value = vOrderID;
7443        }
7444
7445        return vOrderID;
7446    }
7447
7448    $(function() {
7449        if (!isMobile() || !window.sessionStorage) return;
7450
7451        var certResult = sessionStorage.getItem('kcpCertResult');
7452        if (!certResult) return;
7453
7454        try {
7455            certResult = JSON.parse(certResult);
7456            var retryCount = 0;
7457            var handleCertResult = function() {
7458                if (typeof document.form_auth === 'undefined' || (certResult.start_page == 'myinfo' && $("form[name='myinfo_form']").length == 0)) {
7459                    if (retryCount++ < 50) {
7460                        setTimeout(handleCertResult, 100);
7461                        return;
7462                    }
7463                }
7464
7465                sessionStorage.removeItem('kcpCertResult');
7466                sessionStorage.removeItem('kcpCertReturnUrl');
7467                sessionStorage.removeItem('kcpCertSubmitting');
7468
7469                if (typeof window.call_auth_data === 'function') {
7470                    window.call_auth_data(certResult);
7471                } else if (typeof window.auth_data === 'function') {
7472                    window.auth_data(certResult);
7473                }
7474            };
7475            setTimeout(handleCertResult, 0);
7476        } catch(e) {
7477            alert(e);
7478        }
7479    });
7480 
7481    function slideEffectClassAdd($el) {
7482        $el.find('.cl_caption').addClass('slide-effect-target');
7483        $el.find('.head_title').addClass('slide-effect-target');
7484        $el.find('.figure-title').addClass('slide-effect-target');
7485        
7486        var $target_during = $($el).attr('effect-during');
7487        
7488        if ($target_during) {
7489            // data-slide-effect-during 값(밀리초 단위)을 초 단위로 변환합니다.
7490            $target_during = parseFloat($target_during) / 1000;
7491            $el[0].style.setProperty('--anim-during', $target_during+'s');
7492        }
7493
7494        if($el.attr('data-slide-effect') == 'zoomin' || $el.attr('data-slide-effect') == 'zoomout') {
7495            $el.find('.slide-effect-target').each(function() {
7496                $(this).children().wrapAll('<div class="zoomAnimation" ></div>');
7497            });
7498        }        
7499    }
7500    // JH Animation Slideshow53 블럭 화살표 클릭 시 애니메이션 바로 적용
7501    $('[data-type="showcase"][data-case="slideshow53"] .carousel-control').live('click',function(){
7502        var $target = $(this).closest('[data-slide-effect]');
7503        var originalSlideEffectVal = $target.attr('data-slide-effect');
7504        $target.attr('data-slide-effect', '');
7505        requestAnimationFrame(function () {
7506            $target.attr('data-slide-effect', originalSlideEffectVal);
7507        });      
7508    });
7509    // 인증창 종료후 인증데이터 리턴 함수
7510    function auth_data(frm) {
7511        var auth_form = document.form_auth;
7512        // var nField        = frm.elements.length;
7513        // var response_data = "";
7514
7515        // up_hash 검증 (V2에서는 up_hash 미사용으로 값이 있을 때만 검증)
7516        if (frm.up_hash && auth_form.veri_up_hash && frm.up_hash != auth_form.veri_up_hash.value) {
7517            alert("up_hash 변조 위험있음");
7518        }
7519
7520        /* 리턴 값 모두 찍어보기 (테스트 시에만 사용) */
7521        // var form_value = "";
7522
7523        // for ( i = 0 ; i < frm.length ; i++ )
7524        // {
7525        //     form_value += "["+frm.elements[i].name + "] = [" + frm.elements[i].value + "]\n";
7526        // }
7527        // console.log(form_value);
7528        if (frm.res_cd == '0000' && frm.birth_day !== undefined) {
7529            var yyyy = frm.birth_day.substr(0, 4);
7530            var mm = frm.birth_day.substr(4, 2);
7531            var dd = frm.birth_day.substr(6, 2);
7532        }
7533
7534        switch (frm.start_page) {
7535            case 'register':
7536            case 'myinfo':
7537                if (frm.res_cd == '0000') {
7538                    $('button.btn-cert').text($.lang[LANG]['siteum.regexp.complete.cert']).prop('disabled', true);
7539                    if (frm.start_page == 'register') loadRegisterField();
7540                } else {
7541                    if (frm.res_cd == 'exist') {
7542                        var error_title = '';
7543                        var error_msg = '';
7544                        var find_btn = $.lang[LANG]['siteum.forgot.id.link'];
7545                        if (frm.um_id != '') {
7546                            if (frm.start_page == 'register') {
7547                                error_title = $.lang[LANG]['siteum.cert.already.registered'];
7548                                error_msg = $.lang[LANG]['siteum.cert.already.registered.txt'] + '<div class="user-id">' + frm.um_id + '</div>';
7549                            } else {
7550                                error_title = $.lang[LANG]['siteum.cert.already.cert'];
7551                                error_msg = $.lang[LANG]['siteum.cert.already.cert.txt'] + '<div class="user-id">' + frm.um_id + '</div>';
7552                            }
7553
7554                            find_btn = $.lang[LANG]['siteum.forgot.pw.link'];
7555                        }
7556                        $(this).showModalFlat(error_title, error_msg, true, true, function() {
7557                            $('input[name="sns_key"]').val('');
7558                            console.log($('input[name="sns_key"]'));
7559                            $.getJSON('/umember/login/out', function(r) {
7560                                // if (frm.start_page == 'myinfo') {
7561                                //     if ($.cookie('cert_popup') !== undefined) {
7562                                //         $.removeCookie('cert_popup', true, { path: '/', expires: 12 * 60 * 60 * 1000 });
7563                                //     }
7564                                // }
7565                                location.href = '/_login';
7566                            }, 'json');
7567                        }, 'close', $.lang[LANG]['siteum.cert.login'], 'modal-dialog cl-cmmodal cl-s-btn w560 cl-p70 cl-modal cl-close-btn user-exist-modal', '');
7568                    } else if (frm.res_cd == 'not_adult') {
7569                        $(this).showModalFlat($.lang[LANG]['siteum.cert.adult.cannot.complete'], $.lang[LANG]['siteum.cert.adult.cannot.complete.txt'], true, false, '', 'ok', '', 'modal-dialog cl-cmmodal cl-s-btn w560 cl-p70 cl-modal cl-close-btn');
7570                    }
7571
7572                    return false;
7573                }
7574                var sid = frm.sid;
7575                var gender = (frm.sex_code !== undefined && frm.sex_code) ? ((frm.sex_code == '01') ? '남' : '여') : '';
7576                $('#input-name').val(frm.user_name).addClass('has-value');
7577                $('#input-birth').val(yyyy + '-' + mm + '-' + dd).addClass('has-value');
7578                $('#input-tel').val(frm.phone_no).addClass('has-value');
7579                $('#input-gender').val(frm.sex_code).addClass('has-value');
7580                $('.certified-info .input-name').text(frm.user_name);
7581                $('.certified-info .input-birth').text(yyyy + '. ' + mm + '. ' + dd + '.');
7582                $('.certified-info .input-tel').text(frm.phone_no.replace(/^(\d{3})(\d{3,4})(\d{4})$/, '$1-$2-$3'));
7583                $('.certified-info .input-gender').text(gender);
7584                $('#cert_data').val(frm.cert_data);
7585                // $('#ci_url').val(frm.ci_url);
7586                // $('#di_url').val(frm.di_url);
7587                $('.cl-s-register-btn').removeClass('hide');
7588                $('.cl-s-cert').addClass('hide');
7589                if (frm.start_page == 'myinfo') {
7590                    var formData = $("form[name='myinfo_form']").serializeObject();
7591                    $.ajax({
7592                        url: '/_myinfo_proc',
7593                        data: { sid: sid, data: JSON.stringify(formData) },
7594                        dataType: 'json',
7595                        type: 'POST',
7596                        async: false,
7597                        cache: false,
7598                        success: function(data) {
7599                            // console.log(data);
7600                            location.reload();
7601                        }
7602                    });
7603                }
7604                break;
7605            case 'find_id':
7606                if (frm.res_cd == '0000') {
7607                    $('.cl-s-forgot-box').addClass('hide');
7608                    $('.forgot-result').removeClass('hide');
7609                    $('.forgot-result .user-id').text(frm.um_id);
7610                } else {
7611                    $(this).showModalFlat($.lang[LANG]['siteum.forgot.id.invalid'], $.lang[LANG]['siteum.forgot.id.invalid.txt'], true, true, function() {
7612                        location.href = '/_register';
7613                    }, 'close', $.lang[LANG]['siteum.forgot.id.register'], 'modal-dialog cl-cmmodal cl-s-btn w560 cl-p70 cl-modal cl-close-btn', '');
7614                    return false;
7615                }
7616                break;
7617            case 'sitelock':
7618                break;
7619        }
7620    }
7621
7622    var iconShowHide = function() {
7623        var body_w = $('body').width();
7624        $('.template-mode').removeClass('active');
7625        if (body_w >= 1200) {
7626            $('.template-desktop, .template-tablet, .template-mobile').show();
7627            $('.template-desktop').addClass('active');
7628        } else if (body_w <= 1199 && body_w >= 768) {
7629            $('.template-desktop').hide();
7630            $('.template-tablet, .template-mobile').show();
7631            $('.template-tablet').addClass('active');
7632        } else if (body_w <= 767) {
7633            $('.template-desktop, .template-tablet').hide();
7634            $('.template-mobile').show().addClass('active');
7635        }
7636    }
7637
7638    var checkOS = function() {
7639        var os, ua = navigator.userAgent;
7640        if (ua.match(/Win(dows )?NT 6\.0/)) {
7641            os = "Windows Vista";
7642        } else if (ua.match(/Win(dows )?(NT 5\.1|XP)/)) {
7643            os = "Windows XP";
7644        } else {
7645            if ((ua.indexOf("Windows NT 5.1") != -1) || (ua.indexOf("Windows XP") != -1)) {
7646                os = "Windows XP";
7647            } else if ((ua.indexOf("Windows NT 7.0") != -1) || (ua.indexOf("Windows NT 6.1") != -1)) {
7648                os = "Windows 7";
7649            } else if ((ua.indexOf("Windows NT 8.0") != -1) || (ua.indexOf("Windows NT 6.2") != -1)) {
7650                os = "Windows 8";
7651            } else if ((ua.indexOf("Windows NT 8.1") != -1) || (ua.indexOf("Windows NT 6.3") != -1)) {
7652                os = "Windows 8.1";
7653            } else if ((ua.indexOf("Windows NT 10.0") != -1) || (ua.indexOf("Windows NT 6.4") != -1)) {
7654                os = "Windows 10";
7655            } else if ((ua.indexOf("iPad") != -1) || (ua.indexOf("iPhone") != -1) || (ua.indexOf("iPod") != -1)) {
7656                os = "Apple iOS";
7657            } else if (ua.indexOf("Android") != -1) {
7658                os = "Android OS";
7659            } else if (ua.match(/Win(dows )?NT( 4\.0)?/)) {
7660                os = "Windows NT";
7661            } else if (ua.match(/Mac|PPC/)) {
7662                os = "Mac OS";
7663            } else if (ua.match(/Linux/)) {
7664                os = "Linux";
7665            } else if (ua.match(/(Free|Net|Open)BSD/)) {
7666                os = RegExp.$1 + "BSD";
7667            } else if (ua.match(/SunOS/)) {
7668                os = "Solaris";
7669            }
7670        }
7671        if (os.indexOf("Windows") != -1) {
7672            if (navigator.userAgent.indexOf('WOW64') > -1 || navigator.userAgent.indexOf('Win64') > -1) {
7673                os += ' 64bit';
7674            } else {
7675                os += ' 32bit';
7676            }
7677        }
7678        return os;
7679    }
7680
7681    var checkBrowser = function() {
7682        var agt = navigator.userAgent.toLowerCase();
7683        if (agt.indexOf("chrome") != -1) return 'Chrome';
7684        if (agt.indexOf("opera") != -1) return 'Opera';
7685        if (agt.indexOf("staroffice") != -1) return 'Star Office';
7686        if (agt.indexOf("webtv") != -1) return 'WebTV';
7687        if (agt.indexOf("beonex") != -1) return 'Beonex';
7688        if (agt.indexOf("chimera") != -1) return 'Chimera';
7689        if (agt.indexOf("netpositive") != -1) return 'NetPositive';
7690        if (agt.indexOf("phoenix") != -1) return 'Phoenix';
7691        if (agt.indexOf("firefox") != -1) return 'Firefox';
7692        if (agt.indexOf("safari") != -1) return 'Safari';
7693        if (agt.indexOf("skipstone") != -1) return 'SkipStone';
7694        if (agt.indexOf("netscape") != -1) return 'Netscape';
7695        if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
7696        if (agt.indexOf("msie") != -1) {
7697            let rv = -1;
7698            if (navigator.appName == 'Microsoft Internet Explorer') {
7699                let ua = navigator.userAgent;
7700                var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
7701                if (re.exec(ua) != null)
7702                    rv = parseFloat(RegExp.$1);
7703            }
7704            return 'Internet Explorer ' + rv;
7705        }
7706    }
7707
7708    /**************************************************************************************** Change Profile */
7709    $('.change-profile, .profile_left').live('click', function(e) {
7710        if ($('script[src="/js/jquery.fileupload.js"]').length == 0) $('head').append('<script type="text/javascript" src="/js/jquery.fileupload.js"></script>');
7711
7712        if($(this).hasClass('signinwrap_logo')) return;
7713
7714        var name = ($(this).attr('class').indexOf('change-profile') > -1) ? $('.site-username').attr('data-user-name') : $('.profile_left').find('.m-profile').text().trim(),
7715            img = ($(this).attr('class').indexOf('change-profile') > -1) ? $('svg.change-profile').attr('data-user-img') : $('label.m-profile').attr('data-user-img'),
7716            paid = ($(this).attr('class').indexOf('change-profile') > -1) ? $('svg.change-profile').attr('data-user-plan') : $('label.m-profile').attr('data-user-plan'),
7717            check_um = ($(this).attr('class').indexOf('change-profile') > -1) ? $('svg.change-profile').attr('data-user-um') : $('label.m-profile').attr('data-user-um');
7718        if (check_um == 'um-profile') {
7719            //var mypageModal = $.umember.showMypageModal('<?=$mb["sid"]?>');
7720            var url = '/_myinfo';
7721            location.href = url;
7722        } else if (paid == 'true') {
7723            img = (typeof img == 'undefined' || img == '') ? 'https://storage.googleapis.com/i.addblock.net/member/profile_default.jpg' : img + '?_' + new Date().getTime();
7724            var str = '\
7725                <div class="dashboard-profile">\
7726                    <div class="dashboard-userimg dashboard-user-wrap">\
7727                        <svg viewBox="0 0 110 110" >\
7728                            <pattern id="dashboard-image-popup" patternUnits="userSpaceOnUse" width="120" height="120">\
7729                                <image xlink:href="' + img + '" x="0" width="110" height="110" />\
7730                            </pattern>\
7731                            <circle cx="55" cy="56" r="54" fill="url(#dashboard-image-popup)" stroke="#eeeff0"></circle>\
7732                        </svg>\
7733                    </div>\
7734                    <span class="fileinput-button profile-text-box">\
7735                        <label for="siteProfilefileupload">' + $.lang[LANG]['siteum.mypage.change.image'] + '</label>\
7736                        <input id="siteProfilefileupload" class="modal-upload-button site-profile-upload-btn" type="file" name="files[]">\
7737                    </span>\
7738                    <p class="p-text">' + $.lang[LANG]['dash.siteprofile.modal.nickname'] + $.lang[LANG]['account.modal.edit-image.size'] + '</p>\
7739                    <div class="section-username">\
7740                        <div class="input-group cl-common-form-wrap mypage-cl-form-wrap">\
7741                            <div class="cl-common-form-group cl-userNick-wrap">\
7742                                <input type="text" class="input-userNickname" name="usernick_name" required="required"  value="' + name + '">\
7743                                <label for="input" id="username-label" class="cl-common-control-label change-username-label">' + $.lang[LANG]['account.modal.edit-image.nickname'] + '</label>\
7744                            </div>\
7745                        </div>\
7746                        <p class="siteprofileImg_notice"><span class="profilenotice_icon">※</span><span class="profilenotice_txt">' + $.lang[LANG]['dash.siteprofile.modal.nickname.notice'] + '</span</p>\
7747                    </div>\
7748                    <ul class="hide uploadfiles"></ul>\
7749                </div>\
7750            ';
7751
7752            if ($(this).hasClass('profile_left')) $('.m-header_user.menu, .btn-box.m-headerClose.in ').css('zIndex', '1010');
7753
7754            var modal = $(this).showModalFlat($.lang[LANG]['dash.siteprofile.modal.title'], str, true, true, function() {
7755                var modal_id = $(this).closest('.modal').attr('id'),
7756                    $nick = $('.input-userNickname'),
7757                    org = $('.site-username').attr('data-user-name'),
7758                    sid = SID,
7759                    settings = {
7760                        site_nick: $nick.val().trim()
7761                    },
7762                    special_pattern = /[~!@\#$%<>^&*\()\-=+_\’'"]/gi,
7763                    uploadimg = $('#dashboard-image-popup1 image').attr('xlink:href'),
7764                    nouploadimg = $('#dashboard-image-top image').attr('xlink:href'),
7765                    profileimg = ($('label.change-profile').hasClass('um-profile')) ? 'profileimg_um' : 'profileimg_site';
7766
7767                if ($('#dashboard-image-popup1').length > 0) {
7768                    $.post('/template/resource/upload-saveprofile', { uploadimg: uploadimg, profileimg: profileimg }, function(data) {
7769                        if (typeof data.error != "undefined" && data.error) {
7770                            $(this).showModalFlat('ERROR', data.error, true, false, '', 'ok');
7771                            return false;
7772                        }
7773                        $('svg.change-profile').attr('data-user-img', uploadimg);
7774                        $('label.m-profile').attr('data-user-img', uploadimg);
7775                        $('#dashboard-image-top image').attr('xlink:href', uploadimg);
7776                        $('#m-dashboard-image-top image').attr('xlink:href', uploadimg);
7777
7778                        modal.modal('hide');
7779                    }, 'json');
7780                }
7781
7782                $nick.removeClass('has-error');
7783                if (!$nick.val().trim()) {
7784                    $nick.addClass('has-error');
7785                    alert($.lang[LANG]['dashbord.settings.info.site-nick.edit-info']);
7786                    return false;
7787                } else if ($nick.val().trim() == org) {
7788                    modal.modal('hide');
7789                    return false;
7790                } else if (checkEmojis($nick.val().trim())) {
7791                    errorEmojisModal();
7792                    return false;
7793                }
7794
7795                if ((special_pattern.test($nick.val().trim()) == true)) {
7796                    alert($.lang[LANG]['dashbord.settings.info.site-nick.edit-spec']);
7797                    return false;
7798                }
7799
7800                $.post('/template/settings', {
7801                    'sid': sid,
7802                    'settings': JSON.stringify(settings),
7803                    'el': ''
7804                }, function(data) {
7805                    if (typeof data.error != 'undefined' && data.error) {
7806                        $nick.addClass('has-error');
7807                        alert(data.error);
7808                        return false;
7809                    }
7810
7811                    $('.m-text-size').text(data.data.site_nick).attr('data-user-name', data.data.site_nick);
7812                    $('.site-username').attr('data-user-name', data.data.site_nick);
7813                    $('.mb-nickname').text(data.data.site_nick);
7814                    $('#register-nickname input.edit-input').attr('value', data.data.site_nick);
7815
7816                    $('.cl-changePro-modal ul.uploadfiles').empty();
7817                    modal.modal('hide');
7818                }, 'json');
7819            }, 'cancel', 'config.change', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-changePro-modal', true, function() {
7820                //console.log('showCallback-cancel');
7821                var imgfile = $('.cl-changePro-modal .uploadfiles li').attr('data-source'),
7822                    files = [];
7823
7824                $('.cl-changePro-modal .uploadfiles li').each(function() {
7825                    files.push($(this).attr('data-source'));
7826                });
7827
7828                $('.cl-changePro-modal .uploadfiles').empty();
7829                if ($('#dashboard-image-popup1').length > 0) {
7830                    $.processON($.lang[LANG]['dash.siteprofile.modal.deleteimg']);
7831                    $.ajax({
7832                        type: 'POST',
7833                        url: '/template/resource/delete-gcloud',
7834                        data: { s: files },
7835                        dataType: 'json',
7836                        async: true,
7837                        success: function(data) {
7838                            if (typeof data.error != "undefined" && data.error) {
7839                                $(this).showModalFlat('ERROR', data.error, true, false, '', 'ok');
7840                                return false;
7841                            }
7842                            $.processOFF();
7843                        }
7844                    });
7845                }
7846            }, function() {
7847                $(document).on('click', '.site-profile-upload-btn', function() {
7848                    $(this).fileupload({
7849                            url: '/template/resource/upload-myimage-file',
7850                            dataType: 'json',
7851                            async: true,
7852                            pasteZone: null,
7853                            add: function(e, data) {
7854                                $('#loading').css('left', '-100%');
7855                                $.processON();
7856                                data.submit();
7857                            },
7858                            done: function(e, data) {
7859                                if (typeof data.result.error != 'undefined' && data.result.error) {
7860                                    alert(data.result.error);
7861                                    $('.progress .progress-bar').css('width', '0%');
7862                                    $.processOFF();
7863                                    return;
7864                                }
7865
7866                                if (data.result.src) {
7867                                    var src1 = '<svg viewBox="0 0 110 110" ><pattern id="dashboard-image-popup1" patternUnits="userSpaceOnUse" width="120" height="120"><image xlink:href="' + data.result.src + '" x="0" width="110" height="110"></image></pattern><circle cx="55" cy="56" r="54" fill="url(#dashboard-image-popup1)" stroke="#eeeff0"></circle></svg>\
7868                                    ',
7869                                        src2 = '<svg viewBox="0 0 110 110" ><pattern id="dashboard-image-popup2" patternUnits="userSpaceOnUse" width="120" height="120"><image xlink:href="' + data.result.src + '" x="0" width="110" height="110"></image></pattern><circle cx="55" cy="56" r="54" fill="url(#dashboard-image-popup2)" stroke="#eeeff0"></circle></svg>\
7870                                        ',
7871                                        read_upload_file = '<li data-source="' + data.result.file_name + '"><img src="' + data.result.src + '"></li>';
7872
7873                                    $('.dashboard-userimg').html(src1);
7874                                    $('.cl-changePro-modal ul.uploadfiles').append(read_upload_file);
7875                                    //$('label.change-profile').html(src2).attr('data-user-img',data.result.src);
7876                                    //$('.dashboard-userimg').attr('data-imgsave',data.result.path+'/'+data.result.raw_name);
7877
7878                                }
7879                                $.processOFF();
7880                                $('#loading').css('left', '50%');
7881                            },
7882                            progressall: function(e, data) {
7883                                var progress = parseInt(data.loaded / data.total * 100, 10);
7884                                $('.progress .progress-bar').css(
7885                                    'width',
7886                                    progress + '%'
7887                                );
7888
7889                            },
7890                        }).prop('disabled', !$.support.fileInput)
7891                        .parent().addClass($.support.fileInput ? undefined : 'disabled');
7892                });
7893            }, function() {
7894                $('.m-header_user.menu, .btn-box.m-headerClose.in ').css('zIndex', '');
7895            });
7896        } else {
7897            siteNotice('nickname');
7898        }
7899
7900    });
7901
7902    /***********************************************************************************************************************************************/
7903    
7904    var setLayoutHeight = function(el) {
7905        if(typeof el != 'undefined' && $.inArray(el, ['el-menu','el-footer']) > -1) return false;
7906
7907        var block_selector = (typeof el != 'undefined' && el == 'el_display') ? '#element-display .el_viewblock' : '.element[data-layout]';
7908        if($(block_selector).length == 0) return false;
7909
7910        $(block_selector).each(function() {
7911            var type2 = (typeof $(this).attr('data-type2') != 'undefined' && $(this).attr('data-type2'))? $(this).attr('data-type2') : '';
7912            if($(this).attr('data-mode') == 'thumb' || $(this).find('.layout-grid').length == 0) {
7913                return true;
7914            }
7915            var lyh = (typeof $(this).find('.lyoption').attr('data-lyh') != 'undefined') ? $(this).find('.lyoption').attr('data-lyh') : 0.6;
7916            if (typeof lyh == 'undefined' || lyh == 'auto') return;
7917
7918            var el = $(this).find('.layout-grid').eq(0),
7919                bl_w = Math.round(parseFloat(el[0].offsetWidth)),
7920                bl_pl = (el.css('padding-left')) ? Math.round(parseFloat(el.css('padding-left').replace(/[^0-9]/g, ''))) : 15,
7921                bl_pr = (el.css('padding-right')) ? Math.round(parseFloat(el.css('padding-right').replace(/[^0-9]/g, ''))) : 15,
7922                bl_w_pd = bl_w - (bl_pl + bl_pr),
7923                bl_ly_height = Math.round(bl_w_pd * parseFloat(lyh));
7924
7925            // $(this).find('.row .video-content').css('height', bl_ly_height + 'px');
7926            // $(this).find('.ly-img').css('height', bl_ly_height + 'px');
7927            let ly_height = (type2 == 'shorts')? lyh : lyh - 0.05;
7928            $(this).find('.row .video-content').css('aspect-ratio', `1 / ${ly_height}`);
7929            $(this).find('.ly-img').css('aspect-ratio', `1 / ${lyh - 0.05}`);
7930            // if ($(this).attr('data-mode') == 'thumb' && $(this).attr('data-playtype') == 'true') $(this).find('iframe').css('height', bl_ly_height + 'px');
7931
7932            // var bl_svg_val = (bl_w_pd < 233) ? Math.round(parseFloat(bl_w_pd * 0.25)) : 58;
7933            var bl_svg_val;
7934            if(bl_w_pd > 920) {
7935              bl_svg_val = 58;
7936            } else if(bl_w_pd > 700) {
7937              bl_svg_val = 50;
7938            } else if(bl_w_pd > 500) {
7939              bl_svg_val = 46;
7940            } else if(bl_w_pd > 300) {
7941              bl_svg_val = 42;
7942            } else if(bl_w_pd > 210) {
7943              bl_svg_val = 36;
7944            } else {
7945              bl_svg_val = 30;
7946            }
7947            $(this).find('.playbtn').attr('width', bl_svg_val).attr('height', bl_svg_val);
7948            $(this).css('overflow', 'hidden');
7949        });
7950
7951    }
7952
7953    var getLayoutData = function(tag) {
7954        var tag_ly_arr = [],
7955            tag_pd = (typeof tag.find('.lyoption').attr('data-lypd') != 'undefined' && tag.find('.lyoption').attr('data-lypd')) ? tag.find('.lyoption').attr('data-lypd') : '15',
7956            tag_pc = (typeof tag.find('.lyoption').attr('data-lycol') != 'undefined' && tag.find('.lyoption').attr('data-lycol')) ? tag.find('.lyoption').attr('data-lycol') : '4',
7957            tag_t = (typeof tag.find('.lyoption').attr('data-lycol-t') != 'undefined' && tag.find('.lyoption').attr('data-lycol-t')) ? tag.find('.lyoption').attr('data-lycol-t') : '2',
7958            tag_m = (typeof tag.find('.lyoption').attr('data-lycol-m') != 'undefined' && tag.find('.lyoption').attr('data-lycol-m')) ? tag.find('.lyoption').attr('data-lycol-m') 
7958: '2',
7959            tag_lyw = (typeof tag.find('.lyoption').attr('data-lyw') != 'undefined' && tag.find('.lyoption').attr('data-lyw')) ? tag.find('.lyoption').attr('data-lyw') : (tag_pc == '1' ? '100' : 'auto'),
7960            tag_lyh = (typeof tag.find('.lyoption').attr('data-lyh') != 'undefined' && tag.find('.lyoption').attr('data-lyh')) ? tag.find('.lyoption').attr('data-lyh') : '0.6',
7961            tag_orgw = (typeof tag.find('.lyoption').attr('data-org-width') != 'undefined' && tag.find('.lyoption').attr('data-org-width')) ? tag.find('.lyoption').attr('data-org-width') : ''
7962
7963        var bl_cont = tag.find('.container'),
7964            bl_cont_w = parseFloat(bl_cont[0].offsetWidth),
7965            layout_grid = $('.' + selectEL).find('.layout-grid').eq(0),
7966            bl_w = parseFloat(layout_grid[0].offsetWidth),
7967            bl_pl = (layout_grid.css('padding-left')) ? parseFloat(layout_grid.css('padding-left').replace(/[^0-9]/g, '')) : 15,
7968            bl_pr = (layout_grid.css('padding-right')) ? parseFloat(layout_grid.css('padding-right').replace(/[^0-9]/g, '')) : 15,
7969            bl_lyw = (tag_pc == '1') ? Number(tag_lyw) : '',
7970            bl_lyw_dot = (tag_pc == '1') ? bl_lyw / 100 : '',
7971            bl_cont_w_re = (tag_pc == '1') ? (bl_cont_w - (bl_pl + bl_pr)) * bl_lyw_dot : '';
7972
7973        tag_ly_arr['pc'] = tag_pc;
7974        tag_ly_arr['t'] = tag_t;
7975        tag_ly_arr['m'] = tag_m;
7976        tag_ly_arr['lyw'] = tag_lyw;
7977        tag_ly_arr['pd'] = tag_pd;
7978        tag_ly_arr['lyh'] = tag_lyh;
7979        tag_ly_arr['bl_cont_w'] = bl_cont_w;
7980        tag_ly_arr['bl_w'] = bl_w;
7981        tag_ly_arr['bl_pl'] = bl_pl;
7982        tag_ly_arr['bl_pr'] = bl_pr;
7983        tag_ly_arr['bl_lyw_dot'] = bl_lyw_dot;
7984        tag_ly_arr['bl_cont_w_re'] = bl_cont_w_re;
7985
7986        return tag_ly_arr;
7987    }
7988
7989
7990    $(document).on('click', '.guestbook-fr-35, .btn-ico-right', function(e) {
7991        $(this).prev().click();
7992    });
7993    $(document).on('click', '.page-toolbars .toolbar-btn.share', function(e) {
7994        var option = $(this).closest('.page-toolbars').attr('data-page-option');
7995        if (option == 'S') {
7996            $(this).showModalFlat('INFORMATION', $.lang[LANG]['config.gallery.share.cannot.secret-post'], true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title');
7997            return false;
7998        }
7999        if (typeof MODE == 'undefined' && property.PUBLISH) shareModal();
8000        else $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['config.gallery.share.publish'], true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70');
8001    });
8002
8003    $(document).on('click', '.page-toolbars .toolbar-btn.like', function(e) {
8004        var page = (PAGE_MODE == 'c') ? PAGE : property.PAGE;
8005        if (page.indexOf(',') > -1) {
8006            var page = (PAGE_MODE == 'c') ? PAGE.split(',') : (property.PAGE).split(',');
8007            var npage = (page[0] == 'forum') ? 'forum' : 'project';
8008            setLike($(this), npage);
8009        } else {
8010            return false;
8011        }
8012    });
8013    $(document).on('click', 'a.gallery-like', function(e) {
8014        setLike($(this), 'gallery');
8015    });
8016    $(document).on('click', '.figure.like > *', function(e) {
8017        var $this = $(this).closest('.figure.like');
8018        if ($this.closest('.emptyGallery').length > 0) return false;
8019        setLike($this, 'list');
8020    });
8021    // $(document).on('click','.element[data-type2="qna"] .tpl-forum-list-like, .element[data-type2="faq"] .tpl-forum-list-like, .element[data-type2="guestbook"] .tpl-forum-list-like', function(e) {
8022    //     var $this = $(this);
8023    //     setLike($this, 'flist');
8024    // });
8025    $(document).on('click', '.element a[data-popup][data-popup-name], .clnav-sidemobile a[data-popup][data-popup-name]', function(e){
8026        e.preventDefault();
8027        e.stopPropagation();
8028        var $popupLink = $(this);
8029        if($popupLink.closest('.change-mobile-modal, .change-mobile-design-modal').length > 0) return;
8030
8031        var iVALIDPLAN = (PAGE_MODE == 'c') ? VALIDPLAN : property.VALIDPLAN;
8032        var iVALIDTYPE = (PAGE_MODE == 'c') ? VALIDTYPE : property.VALIDTYPE;
8033        if(iVALIDPLAN && iVALIDTYPE != 'PK') imgPopupFrame($popupLink);
8034    });
8035
8036    var checkUseCommentFunc = function(mode, eltag) {
8037        var check = false;
8038        if (mode == 'project') {
8039            var notUseComment = ['gallery_38', 'gallery_37', 'gallery_36', 'gallery_28', 'gallery_25', 'gallery_22', 'gallery_21', 'gallery_8', 'gallery_6'];
8040            var $eltag = $(htmlspecialchars_decode(eltag, 'ENT_QUOTES'));
8041            var tplImg = $eltag.find('img').attr('src');
8042            var notUseCommentCnt = 0;
8043            $.each(notUseComment, function(i, v) {
8044                if (typeof tplImg !== 'undefined' && tplImg.indexOf(v) > -1) {
8045                    notUseCommentCnt++;
8046                    return false;
8047                }
8048            });
8049            check = ($eltag.find('h5.figure').eq(0).hasClass('only-sh') || !$eltag.find('h5.figure').eq(0).hasClass('title') || !$eltag.find('p.figure').eq(0).hasClass('caption') || notUseCommentCnt > 0) ? false : true;
8050        }
8051
8052        return check;
8053    }
8054
8055    var checkUseLikeFunc = function(mode, eltag) { //like
8056        var check = false;
8057        var notUseLike = ['gallery_38', 'gallery_37', 'gallery_36', 'gallery_28', 'gallery_25', 'gallery_22', 'gallery_21', 'gallery_8', 'gallery_6'];
8058        // var umemberActivate = (PAGE_MODE == 'c')? UMEMBER_ACTIVATE : property.UMEMBER_ACTIVATE;
8059        // if(umemberActivate == 0) {
8060        //     return false;
8061        // }
8062        var lVALIDPLAN = (PAGE_MODE == 'c') ? VALIDPLAN : property.VALIDPLAN;
8063        if (!lVALIDPLAN) return false;
8064        switch (mode) {
8065            case 'project':
8066            case 'gallery':
8067                var $eltag = $(htmlspecialchars_decode(eltag, 'ENT_QUOTES'));
8068                var tplImg = $eltag.find('img').attr('src');
8069                var notUseLikeCnt = 0;
8070                $.each(notUseLike, function(i, v) {
8071                    if (typeof tplImg !== 'undefined' && tplImg.indexOf(v) > -1) {
8072                        notUseLikeCnt++;
8073                        return false;
8074                    }
8075                });
8076                check = ($eltag.find('h5.figure').eq(0).hasClass('only-sh') || !$eltag.find('h5.figure').eq(0).hasClass('title') || !$eltag.find('p.figure').eq(0).hasClass('caption') || notUseLikeCnt > 0) ? false : true;
8077
8078                break;
8079        }
8080
8081        return check;
8082    }
8083
8084    var getRgbaValArray = function(bg_color, opacity_val) {
8085        var bgColorArr = [],
8086            setColorArr = [],
8087            opacity_val = (typeof opacity_val != 'undefined' && opacity_val) ? opacity_val : '';
8088
8089        if (typeof bg_color == 'undefined') return;
8090        if (bg_color == 'transparent' || !bg_color || bg_color == 'none') opacity_val = '0';
8091        bg_color = (bg_color == 'transparent' || !bg_color || bg_color == 'none') ? 'rgba(255,255,255,' + opacity_val + ')' : bg_color;
8092
8093        if (bg_color.indexOf('#') > -1) {
8094            if (bg_color.length < 5) {
8095                var str_color = bg_color.substring(1, bg_color.length);
8096                bg_color += str_color;
8097            }
8098
8099            var bgColorArr_re = Object.values(hexToRgba(bg_color));
8100            setColorArr['r'] = bgColorArr_re['0'].toString();
8101            setColorArr['g'] = bgColorArr_re['1'].toString();
8102            setColorArr['b'] = bgColorArr_re['2'].toString();
8103            setColorArr['a'] = '1';
8104        } else setColorArr = rgbaToOpacity(bg_color);
8105
8106        bg_color = 'rgb(' + setColorArr.r + ',' + setColorArr.g + ',' + setColorArr.b + ')'
8107        if (opacity_val != '' && (setColorArr.a != opacity_val)) setColorArr.a = opacity_val;
8108
8109        bgColorArr['rgba'] = setColorArr;
8110        bgColorArr['val'] = bg_color;
8111        bgColorArr['rgba_txt'] = 'rgba(' + setColorArr.r + ',' + setColorArr.g + ',' + setColorArr.b + ',' + setColorArr.a + ')';
8112
8113        return bgColorArr;
8114    }
8115
8116    var getColorAndOpacity = function(bc_selector, css, css_change_opt, change_color_array) {
8117        var bg_info = {},
8118            bg_opt_color = (typeof change_color_array == 'undefined' && !change_color_array) ? getColor(bc_selector, css, css_change_opt) : change_color_array,
8119            bg_opt_color_val = bg_opt_color['val'],
8120            bg_transparent_class = (bg_opt_color_val == 'transparent' || !bg_opt_color_val) ? ' transparent' : '',
8121            bg_opt_opacity_percent = (bg_opt_color_val == 'transparent' || !bg_opt_color_val) ? 0 : (bg_opt_color['rgba']['a'] * 100),
8122            bg_opt_opacity_dot = (bg_opt_color_val == 'transparent' || !bg_opt_color_val) ? 0 : (bg_opt_opacity_percent / 100);
8123
8124
8125        if (css_change_opt == 'background-color' &&
8126            typeof css['children'][bc_selector] != 'undefined' &&
8127            typeof css['children'][bc_selector]['attributes'] != 'undefined' &&
8128            typeof css['children'][bc_selector]['attributes']['opacity'] != 'undefined'
8129        ) {
8130            var this_opacity = css['children'][bc_selector]['attributes']['opacity'];
8131            if (this_opacity == '1' && css['children'][bc_selector]['attributes']['background-color'] == 'transparent') {
8132                bg_opt_opacity_dot = 0;
8133                bg_opt_opacity_percent = 0;
8134            } else {
8135                if (this_opacity.match(/^[0-9\.]*$/g) !== null) {
8136                    bg_opt_opacity_dot = this_opacity;
8137                    bg_opt_opacity_percent = this_opacity * 100;
8138                }
8139            }
8140
8141        }
8142
8143        bg_info = {
8144            color: bg_opt_color,
8145            trans: bg_transparent_class,
8146            op_percent: bg_opt_opacity_percent,
8147            op_dot: bg_opt_opacity_dot,
8148        }
8149
8150        return bg_info;
8151    }
8152
8153    var getLoadBlockScript = function(blocks) {
8154        if (typeof blocks == 'undefined' || blocks.toString().length == 0) return { total: 0, list: {} };
8155
8156        var script_names = {
8157                'gallery'   : ['comments','bottomlist'],
8158                'forum'     : ['forum','comments','bottomlist'],
8159                'latest'    : ['forum','latest'],
8160                'sns'       : ['socialfeed'],
8161                // 'contact'   : ['jqueryFileupload'],
8162                'countdown' : ['jqueryCountdown'],
8163                'shopping'  : ['shopping'],
8164                'review'    : ['reviewContents'],
8165            },
8166            script_path = {
8167                //'loadScript-???' : 'script path', 
8168                'aos'       : 'https://unpkg.com/[email protected]/dist/aos.js',
8169                'shopping'  : '/js/shopping.js',
8170                'forum'     : '/js/module/forum.js',
8171                'latest'    : '/js/module/latest.js',
8172                'reviewContents'    : '/js/module/review_contents.js',
8173                'comments'  : '/js/module/comments.js',
8174                'bottomlist'    : '/js/module/bottomlist.js',
8175                'socialfeed'    : '/js/feed/socialfeed.js',
8176                // 'jqueryFileupload'  : '/js/jquery.fileupload.js',
8177                'jqueryCountdown'   : '/js/jquery.countdown.js',
8178            },
8179            script_total = 0,
8180            script_result = {};
8181
8182        $.each(blocks, function(i, v) {
8183            if (v === false) return true;
8184
8185            var sct_names = (typeof script_names[i] != 'undefined' && script_names[i]) ? script_names[i] : [];
8186            $.each(sct_names, function(idx, val) {
8187                if (typeof script_path[val] != 'undefined' && script_path[val]) {
8188                    if (typeof script_result[val] == 'undefined') script_total++;
8189                    script_result[val] = script_path[val];
8190                }
8191            })
8192        });
8193
8194        return { total: script_total, list: script_result };
8195    }
8196
8197    var loadingScript = function(r) {
8198        var deferred = $.Deferred();
8199        var script_r = getLoadBlockScript(r),
8200            script_total = (typeof script_r.total != 'undefined') ? script_r.total : 0,
8201            script_load = 0;
8202
8203        if (script_total == 0) deferred.resolve();
8204        $.each(script_r.list, function(s_n, s_p) {
8205            if ($('.loadScript-' + s_n).length == 0) {
8206                $.ajax({
8207                    async: false,
8208                    url: s_p,
8209                    dataType: 'script',
8210                    success: function(data) {
8211                        $('head').append('<input type="hidden" class="loadScript-' + s_n + '" value="' + s_p + '">');
8212                        script_load++;
8213                    },
8214                    error: function(request, status, error) {
8215                        // console.log("code: " + request.status);
8216                        // console.log("message: " + request.responseText);
8217                        // console.log("error: " + error);
8218                    }
8219                }).done(function() {
8220                    if (script_load == script_total) deferred.resolve();
8221                });
8222            } else {
8223                script_load++;
8224                if (script_load == script_total) deferred.resolve();
8225            }
8226        });
8227
8228        return deferred.promise();
8229    }
8230
8231    // lux shopping
8232    var ChooseFilters = function(brand, search, mode) {
8233        var min = (mode == true) ? getProductParams('min_price') : getSearchURL('min_price'),
8234            max = (mode == true) ? getProductParams('max_price') : getSearchURL('max_price'),
8235            price = [10, 30, 50, 70, 100, 150, 200, 300, 500];
8236        s = '';
8237        if (typeof search == 'undefined') {
8238            s = '\
8239            <div class="prod-search-brand"><input type="text" class="search-brand-input" placeHolder="브랜드 검색" enterkeyhint="search">\
8240            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>\
8241            </div>\
8242            ';
8243        }
8244        if (brand) {
8245            s = s + '\
8246            <button type="button" class="btn-v2 recommend-filter brand" data-key="brand" data-val="B00000IP">톰포드</button>\
8247            <button type="button" class="btn-v2 recommend-filter brand" data-key="brand" data-val="B00000DM">마크 제이콥스</button>\
8248            <button type="button" class="btn-v2 recommend-filter brand" data-key="brand" data-val="B00000BO">생로랑</button>\
8249            <button type="button" class="btn-v2 recommend-filter brand" data-key="brand" data-val="B00000BQ">버버리</button>\
8250            <button type="button" class="btn-v2 recommend-filter brand" data-key="brand" data-val="B000000C">구찌</button>\
8251            ';
8252        }
8253
8254        s = s + '\
8255        <div class="filter-buttons">\
8256            <div class="btn-group product_type">\
8257                <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button" data-toggle="dropdown">\
8258                    <span class="type_trend">상품유형</span>\
8259                    <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
8260                        <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
8261                    </svg>\
8262                </button>\
8263                <ul class="dropdown-menu">\
8264                    <li data-key="trend" data-val="T0000000">브랜드홈</li>\
8265                    <li data-key="trend" data-val="T00000CQ">편집샵</li>\
8266                    <li data-key="trend" data-val="T00000CS">국내배송</li>\
8267                    <li data-key="trend" data-val="T00000HO">도매부티크</li>\
8268                </ul>\
8269            </div>\
8270            <div class="btn-group">\
8271                <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button" data-toggle="dropdown">\
8272                    <span class="type_discount_rate">할인율</span>\
8273                    <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
8274                        <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
8275                    </svg>\
8276                </button>\
8277                <ul class="dropdown-menu">\
8278                    <li data-key="discount_rate" data-val="sp">특가세일</li>\
8279                    <li data-key="discount_rate" data-val="10off">10off이하</li>\
8280                    <li data-key="discount_rate" data-val="10n30">10n30off</li>\
8281                    <li data-key="discount_rate" data-val="30n50">30n50off</li>\
8282                    <li data-key="discount_rate" data-val="50off">50off이상</li>\
8283                </ul>\
8284            </div>\
8285            <div class="btn-group">\
8286                <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button" data-toggle="dropdown">\
8287                    <span class="type_min_price">최저가</span>\
8288                    <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
8289                        <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
8290                    </svg>\
8291                </button>\
8292                <ul class="dropdown-menu">\
8293                    <li data-key="min_price" data-val="">선택안함</li>\
8294                    ' + setPriceHtml(price, 'min_price', max) + '\
8295                </ul>\
8296            </div>\
8297            <div class="btn-group">\
8298                <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button" data-toggle="dropdown">\
8299                    <span class="type_max_price">최고가</span>\
8300                    <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
8301                        <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
8302                    </svg>\
8303                </button>\
8304                <ul class="dropdown-menu">\
8305                    ' + setPriceHtml(price, 'max_price', min) + '\
8306                    <li data-key="max_price" data-val="">선택안함</li>\
8307                </ul>\
8308            </div>\
8309        </div>\
8310        ';
8311        return s;
8312    }
8313
8314    var setPriceHtml = function(price, type, selected_price) {
8315        var s = '';
8316        $.each(price, function(i, v) {
8317            var active = '';
8318            if (type == 'min_price') {
8319                if (Number(selected_price) > 0 && v >= Number(selected_price)) {
8320                    active = 'disabled';
8321                }
8322            } else {
8323                if (Number(selected_price) > 0 && v <= Number(selected_price)) active = 'disabled';
8324            }
8325            // if(v == Number(getSearchURL(type))) active = 'active';
8326            s = s + '<li class="' + active + '" data-key="' + type + '" data-val="' + v + '">' + v + '만원</li>';
8327        });
8328        return s;
8329    }
8330
8331    var lux_all_category;
8332    var getAllCategory = function(select, category, list, idx, no) {
8333        $.processON();
8334        $.ajax({
8335            type: 'POST',
8336            url: '/template/lux_category_all',
8337            data: { sid: SID },
8338            dataType: 'json',
8339            async: true,
8340            cache: false,
8341            success: function(r) {
8342                lux_all_category = r.root;
8343                $.processOFF();
8344                var html = setSelectCategoryHTML(r, true);
8345                if (typeof select != 'undefined') {
8346                    var $html = $(html);
8347
8348                    $html.find('li').addClass('disable').css('display', 'none');
8349                    $html.find('li[data-category="' + select + '"]').removeClass('disable').addClass('active').css('display', '').empty().append(category);
8350                    $html.find('li.click-off').removeClass('disable');
8351                    if (Number(select) > 1000000) {
8352                        $html.find('.add-user-category').css('display', '');
8353                        $html.find('.input-user-category').css('display', 'none');
8354                    }
8355                    var s = (list.length == 1) ? displaySubCategoryList(lux_all_category[list[0]]['sub']) : displaySubCategoryList(lux_all_category[list[0]]['sub'][list[1]]['sub'], true);
8356                    $html.find('.add-user-category').before(s);
8357                    html = $html.outerHTML();
8358                }
8359                var modal = $(this).showModalFlat('상품연결', html, true, true, function() {
8360                    var choose = $('.choose-select-category li.active').attr('data-category');
8361                    if (typeof choose == 'undefined') {
8362                        alert('선택된 카테고리가 없습니다');
8363                        return false;
8364                    }
8365                    var s = '<ul class="active" data-sid="' + SID + '" data-no="' + ((typeof no != 'undefined') ? no : '') + '">',
8366                        $items = $('.choose-select-category li.active span'),
8367                        add = [],
8368                        updated = [];
8369                    $.each($items, function(i, v) {
8370                        s += '<li class="' + (($items.length == i + 1) ? 'last' : '') + '" data-category-no="' + $(this).attr('data-category') + '" data-seq="' + ((typeof $(this).attr('data-seq') == 'undefined') ? '' : $(this).attr('data-seq')) + '"><span class="user-category-text">' + $(this).text().trim() + '</span></li>\n';
8371                        add.push($(this).attr('data-category'));
8372                        updated.push((typeof $(this).attr('data-seq') == 'undefined') ? '' : $(this).attr('data-seq'));
8373                    });
8374                    s += '<div class="user-selected-category-delete" data-no=""><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708
8374L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"></path></svg></div>';
8375                    s += '</ul>';
8376
8377                    // 기존 카테고리 
8378                    var selected = [];
8379                    $.each($('#lux-category-text ul'), function(i, v) {
8380                        var sub_selected = [];
8381                        $.each($(this).find('li'), function(a, b) {
8382                            sub_selected.push($(this).attr('data-category-no'));
8383                        });
8384                        selected.push(sub_selected.join());
8385                    });
8386
8387                    var duplicates = false;
8388                    $.each(selected, function(i, v) {
8389                        if (v.indexOf(add.join()) > -1) {
8390                            alert('이미 추가된 카테고리입니다');
8391                            duplicates = true;
8392                        }
8393                        if (duplicates) return false;
8394                    });
8395
8396                    if (duplicates) return false;
8397
8398                    // 상위 카테고리 중복 제거
8399                    var depth_arr = []
8400                    $.each(add, function(i, v) {
8401                        depth_arr.push(v);
8402                        var remove_idx = selected.indexOf(depth_arr.join());
8403                        if (remove_idx > -1) {
8404                            var $remove_category = $('#lux-category-text ul').eq(remove_idx),
8405                                remove_deleted = [];
8406                            $.each($remove_category.find('li'), function(a, b) {
8407                                if (typeof $(this).attr('data-seq') != 'undefined' && $(this).attr('data-seq') != '')
8408                                    remove_deleted.push($(this).attr('data-seq'));
8409                            });
8410                            var d = $('#category-deleted').val(),
8411                                deleted = (d.length) ? (d || '').split(',') : [];
8412
8413                            if (remove_deleted.length) {
8414                                deleted.push(...remove_deleted);
8415                                r = deleted.join();
8416                                $('#category-deleted').val(r);
8417                            }
8418                            $('#lux-category-text ul').eq(remove_idx).remove();
8419                            alert('기존에 선택한 상위 카테고리는 중복으로 제거 됩니다.');
8420                        }
8421                    });
8422
8423                    if (typeof idx != 'undefined') {
8424                        $('#lux-category-text ul').eq(idx).remove();
8425                        idx = idx - 1;
8426                        if (idx > -1) {
8427                            $('#lux-category-text ul').eq(idx).after(s);
8428                        } else {
8429                            $('#lux-category-text').append(s);
8430                        }
8431                    } else {
8432                        $('#lux-category-text').append(s);
8433                    }
8434
8435                    // 삭제된 카테고리 처리
8436                    var prev_category = $('#category-update-deleted').val();
8437                    if (prev_category.length) {
8438                        var prev_arr = prev_category.split(',');
8439                        if (updated.length) {
8440                            $.each(updated, function(i, v) {
8441                                if (v.length) prev_arr = arrayRemove(prev_arr, v);
8442                            });
8443                        }
8444                        $('#category-deleted').val(prev_arr.join());
8445                    }
8446                    modal.modal('hide');
8447                }, 'config.close', 'config.ok', 'cl-cmmodal cl-s-btn w700 cl-p70 cl-p0 noActive-domain-check h800', true, function() {
8448                    // close callback
8449                    $('#category-update-deleted').val('');
8450                });
8451            },
8452            error: function(xhr, status, error) {
8453                $.processOFF();
8454                alert("Error " + xhr.status + " : 관리자에게 문의");
8455            }
8456        });
8457    }
8458
8459    $(document)
8460        .on('touchstart', '.carousel', function(e) {
8461            if(typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c') return false;
8462
8463            const slideshow_xClick = e.originalEvent.touches[0].pageX;
8464            $(this).one('touchmove', function(event){
8465                const slideshow_xMove = event.originalEvent.touches[0].pageX;
8466                const slideshow_sensitivityInPx = 5;
8467
8468                if( Math.floor(slideshow_xClick - slideshow_xMove) > slideshow_sensitivityInPx ){
8469                    $(this).carousel('next');
8470                }
8471                else if( Math.floor(slideshow_xClick - slideshow_xMove) < -slideshow_sensitivityInPx ){
8472                    $(this).carousel('prev');
8473                }
8474            });
8475            $(this).on('touchend', function(){
8476                $(this).off('touchmove');
8477            });
8478        });
8479
8480    $(document)
8481    .on('mousedown', '.carousel[data-drag="true"]', function(e) {
8482        // if(typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c') return false;
8483
8484        const slideshow_xClick = e.pageX;
8485        const $carousel = $(this);
8486
8487        const mouseMoveHandler = function(event){
8488            const slideshow_xMove = event.pageX;
8489            const slideshow_sensitivityInPx = 5;
8490
8491            const diff = slideshow_xClick - slideshow_xMove;
8492
8493            if( Math.floor(diff) > slideshow_sensitivityInPx ){
8494                $carousel.carousel('next');
8495                $(document).off('mousemove', mouseMoveHandler); 
8496                $(document).off('mouseup', mouseUpHandler);
8497            }
8498            else if( Math.floor(diff) < -slideshow_sensitivityInPx ){
8499                $carousel.carousel('prev');
8500                $(document).off('mousemove', mouseMoveHandler);
8501                $(document).off('mouseup', mouseUpHandler);
8502            }
8503        };
8504
8505        $(document).on('mousemove', mouseMoveHandler);
8506
8507        const mouseUpHandler = function(){
8508            $(document).off('mousemove', mouseMoveHandler);
8509            $(document).off('mouseup', mouseUpHandler);
8510        };
8511        
8512        $(document).on('mouseup', mouseUpHandler);
8513
8514        e.preventDefault();
8515    });
8516
8517    $(document)
8518        .off('click', '#lux-category-text ul')
8519        .on('click', '#lux-category-text ul', function(e) {
8520            var $selected = $(this),
8521                s = '',
8522                first = 0,
8523                l = [],
8524                i = $(this).index(),
8525                u = [],
8526                no = $(this).attr('data-no');
8527            if ($(this).attr('data-sid') == 'mlux') return;
8528            if ($selected.find('li').length) {
8529                $.each($selected.find('li'), function(i, v) {
8530                    if (i == 0) first = $(this).attr('data-category-no');
8531                    s += '<span class="selected" data-category="' + $(this).attr('data-category-no') + '" data-seq="' + $(this).attr('data-seq') + '">' + $(this).text() + ' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"></path></svg></span>';
8532                    l.push($(this).attr('data-category-no'));
8533                    u.push($(this).attr('data-seq'));
8534                });
8535            }
8536            $('#category-update-deleted').val(u.join());
8537            getAllCategory(first, s, l, i, no);
8538        });
8539
8540    $(document)
8541        .off('click', '.user-selected-category-delete')
8542        .on('click', '.user-selected-category-delete', function(e) {
8543            e.stopPropagation();
8544            if (confirm('카테고리를 삭제하시겠습니까?')) {
8545                var selected_category = $(this).parent().find('li'),
8546                    user_deleted = [];
8547
8548                $.each(selected_category, function(i, v) {
8549                    if (typeof $(this).attr('data-seq') != 'undefined' && $(this).attr('data-seq') != '')
8550                        user_deleted.push($(this).attr('data-seq'));
8551                });
8552
8553                var unique = [...new Set(user_deleted)],
8554                    d = $('#category-deleted').val(),
8555                    deleted = (d.length) ? (d || '').split(',') : [];
8556                $(this).parents('ul').remove();
8557                if (unique.length) {
8558                    deleted.push(...unique);
8559                    r = deleted.join();
8560                    $('#category-deleted').val(r);
8561                }
8562            }
8563        });
8564
8565    $(document)
8566        .off('click', '.lux-category-add')
8567        .on('click', '.lux-category-add', function(e) {
8568            getAllCategory();
8569        });
8570
8571    $(document)
8572        .off('click', '.choose-select-category.add li .lux-category-modify, .sub-category-item .lux-category-modify')
8573        .on('click', '.choose-select-category.add li .lux-category-modify, .sub-category-item .lux-category-modify', function(e) {
8574            e.stopPropagation();
8575            var category_name = $(this).parent().text().trim(),
8576                seq = $(this).parent().attr('data-category');
8577
8578            $('li.orig').addClass('hide');
8579            $('.sub-category-item').addClass('hide');
8580            $('.input-user-category').addClass('active').css('display', 'block');
8581            $('.modal-footer .ok-button-dialog').addClass('disabled');
8582            $('#input-user-category').val(category_name).attr('data-modify', 'true').attr('data-category', seq);
8583        });
8584
8585    $(document)
8586        .off('click', '.choose-select-category.add li .lux-category-delete, .sub-category-item .lux-category-delete')
8587        .on('click', '.choose-select-category.add li .lux-category-delete, .sub-category-item .lux-category-delete', function(e) {
8588            e.stopPropagation();
8589            var depth = $('.choose-select-category.add li.active .selected').length,
8590                category_no = $(this).parent().attr('data-category'),
8591                parent = $('.choose-select-category.add li.active .selected:nth-child(1)').attr('data-category'),
8592                sub = $('.choose-select-category.add li.active .selected:nth-child(2)').attr('data-category');
8593            var agree = (confirm('선택하신 카테고리를 삭제하시겠습니까?')) ? true : false;
8594            if ($('#lux-category-text').find('[data-category-no="' + category_no + '"]').length && agree == true) {
8595                alert('현재 상품에 적용된 카테고리입니다.');
8596                agree = false;
8597            }
8598            if (agree == false) return;
8599            $.processON();
8600            $.ajax({
8601                type: 'POST',
8602                url: '/template/lux_category_delete',
8603                data: { sid: SID, category_no: category_no, depth: depth },
8604                dataType: 'json',
8605                async: true,
8606                cache: false,
8607                success: function(r) {
8608                    $.processOFF();
8609                    if (typeof r.error != 'undefined' && r.error) {
8610                        alert(r.error);
8611                        return false;
8612                    }
8613                    lux_all_category = r.all_category;
8614                    if (depth == 0) {
8615                        $('.choose-select-category li[data-category="' + r.category_no + '"]').remove();
8616                    } else if (depth == 1) {
8617                        $('.sub-category-item div[data-category="' + r.category_no + '"]').remove();
8618                        displaySubCategoryList(lux_all_category[parent]['sub']);
8619                    } else {
8620                        $('.sub-category-item div[data-category="' + r.category_no + '"]').remove();
8621                        displaySubCategoryList(lux_all_category[parent]['sub'][sub]['sub'], true);
8622                    }
8623                },
8624                error: function(xhr, status, error) {
8625                    $.processOFF();
8626                    $('.input-user-category.active').removeClass('spinner');
8627                    alert("Error " + xhr.status + " : 관리자에게 문의");
8628                }
8629            });
8630        });
8631
8632    $(document)
8633        .off('click', '.choose-select-category.add li')
8634        .on('click', '.choose-select-category.add li', function(e) {
8635            if ($(this).hasClass('click-off')) return;
8636            var id = $(this).attr('data-category'),
8637                selected = $(this).text();
8638            if ($(this).find('.selected').length) return false;
8639            $('.choose-select-category.add li.orig:not([data-category="' + id + '"]').fadeOut(0).addClass('disable');
8640
8641            if (Number(id) > 1000000000) {
8642                if ($('.input-user-category').hasClass('active')) {
8643                    $('.input-user-category').removeClass('active').hide();
8644                    $('.modal-footer .ok-button-dialog').removeClass('disabled');
8645                }
8646                // addInputCategoryClose(0);
8647                enableCategoryButton();
8648            } else addInputCategoryClose(0);
8649
8650            $('.sub-category-item').removeClass('active').remove();
8651            $('.choose-select-category.add li').removeClass('active');
8652            $(this).addClass('active').html('<span class="selected" data-category="' + id + '">' + selected + ' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg></span>');
8653
8654            displaySubCategoryList(lux_all_category[id]['sub']);
8655        })
8656        .off('hover', '.choose-select-category.add li')
8657        .on('hover', '.choose-select-category.add li', function(e) {
8658            var id = $(this).attr('data-category');
8659            if ($(this).find('.selected').length) return;
8660            if (Number(id) > 1000000000 && $(this).find('.lux-category-delete').length == 0) {
8661                $(this).append('<span class="lux-category-delete"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/><path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/></svg></span>');
8662                $(this).append('<span class="lux-category-modify"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16"><path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/></svg></span>');
8663            }
8664        });
8665
8666    $(document)
8667        .off('hover', '.sub-category-item > div')
8668        .on('hover', '.sub-category-item > div', function(e) {
8669            var id = $(this).attr('data-category');
8670            if ($(this).find('.selected').length) return;
8671            if (Number(id) > 1000000 && $(this).find('.lux-category-delete').length == 0) {
8672                $(this).append('<span class="lux-category-delete"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/><path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/></svg></span>');
8673                $(this).append('<span class="lux-category-modify"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16"><path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/></svg></span>');
8674            }
8675        });
8676
8677    $(document)
8678        .off('click', '.choose-select-category.add li.add-user-category')
8679        .on('click', '.choose-select-category.add li.add-user-category', function(e) {
8680            var depth = $('.choose-select-category.add .selected').length,
8681                root = '',
8682                parent = '';
8683
8684            $('#input-user-category').attr('data-category', '').attr('data-modify', '');
8685            if (depth > 0) {
8686                root = $('.choose-select-category.add .selected').first().attr('data-category');
8687                parent = $('.choose-select-category.add .selected').last().attr('data-category');
8688            }
8689            depth++;
8690
8691            $('#input-user-category').attr('data-depth', depth).attr('data-parent', parent).attr('data-root', root);
8692            $(this).fadeOut(0).addClass('disable');
8693            setTimeout(function() {
8694                $('.input-user-category').fadeIn(0).addClass('active');
8695                $('.modal-footer .ok-button-dialog').addClass('disabled');
8696                $('#input-user-category').focus();
8697                $('.sub-category-item').addClass('hide');
8698            }, 0);
8699        });
8700
8701    $(document)
8702        .off('click', '.input-user-category-close svg')
8703        .on('click', '.input-user-category-close svg', function(e) {
8704            if ($(this).parent().prev().attr('data-modify') == 'true') {
8705                $('li.orig').removeClass('hide');
8706                addInputCategoryClose(0);
8707            } else {
8708                addInputCategoryClose(0);
8709            }
8710        });
8711
8712    $(document)
8713        .off('keyup', '#input-user-category')
8714        .on('keyup', '#input-user-category', function(e) {
8715            var key = (e.which) ? e.which : e.keyCode,
8716                category_no = $(this).attr('data-category'),
8717                depth = $(this).attr('data-depth'),
8718                parent = $(this).attr('data-parent'),
8719                root = $(this).attr('data-root'),
8720                full_no = [],
8721                full_name = [],
8722                val = $(this).val().trim();
8723
8724            $.each($('.choose-select-category.add .selected'), function(i, v) {
8725                full_no.push($(this).attr('data-category'));
8726                full_name.push($(this).text().trim());
8727            });
8728
8729            if (key == 13 && val != '') {
8730                $('.input-user-category.active').addClass('spinner');
8731                $.ajax({
8732                    type: 'POST',
8733                    url: '/template/lux_category_add',
8734                    data: { val: val, depth: depth, parent_no: parent, root: root, sid: SID, full_no: full_no, full_name: full_name, category_no: category_no },
8735                    dataType: 'json',
8736                    async: true,
8737                    cache: false,
8738                    success: function(r) {
8739                        $('.input-user-category.active').removeClass('spinner');
8740                        if (typeof r.error != 'undefined' && r.error) {
8741                            alert(r.error);
8742                            return false;
8743                        }
8744                        lux_all_category = r.all_category.all;
8745                        $('.input-user-category > input').val('');
8746                        $('.input-user-category').fadeOut(200).removeClass('active');
8747                        $('.modal-footer .ok-button-dialog').removeClass('disabled');
8748                        $('.sub-category-item').removeClass('hide');
8749                        if (category_no.length) {
8750                            if (r.depth == 1) {
8751                                $('.choose-select-category li.orig[data-category="' + category_no + '"]').html('<span class="user-category-text">' + val + '</span> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"></path><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"></path></svg>');
8752                            } else {
8753                                $('.sub-category-item div[data-category="' + category_no + '"]').html('<span class="user-category-text">' + val + '</span><span class="lux-category-delete"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"></path><path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"></path></svg></span><span class="lux-category-modify"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16"><path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"></path></svg></span>');
8754                            }
8755                            $('li.orig').removeClass('hide');
8756                            $('.sub-category-item').removeClass('hide');
8757                        } else {
8758                            if (depth == 1) {
8759                                $('.add-user-category').before('<li class="orig" data-category="' + r.insert_no + '">' + val + '</li>');
8760                            } else if (depth == 2) {
8761                                $('.sub-category-item').removeClass('active').remove();
8762                                displaySubCategoryList(lux_all_category[parent]['sub']);
8763                            } else {
8764                                $('.sub-category-item').removeClass('active').remove();
8765                                displaySubCategoryList(lux_all_category[root]['sub'][parent]['sub'], true);
8766                            }
8767                            enableCategoryButton();
8768                        }
8769
8770                    },
8771                    error: function(xhr, status, error) {
8772                        $('.input-user-category.active').removeClass('spinner');
8773                        alert("Error " + xhr.status + " : 관리자
8773에게 문의");
8774                    }
8775                });
8776            }
8777        });
8778
8779    $(document)
8780        .off('click', '.sub-category-item div')
8781        .on('click', '.sub-category-item div', function(e) {
8782            var id = $(this).attr('data-category'),
8783                sub = $(this).attr('data-sub'),
8784                selected = $(this).text();
8785
8786            $('.choose-select-category.add li.active').append('<span class="selected" data-category="' + id + '">' + selected + ' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg></span>');
8787            if ($(this).hasClass('last')) {
8788                $('.sub-category-item').removeClass('active').remove();
8789                if ($('.choose-select-category.add .selected').length == 3) $('.add-user-category').addClass('disable');
8790                return;
8791            } else $('.sub-category-item').removeClass('active').remove();
8792
8793            displaySubCategoryList(lux_all_category[sub]['sub'][id]['sub'], true);
8794        });
8795
8796    $(document)
8797        .off('click', '.choose-select-category.add li > .selected')
8798        .on('click', '.choose-select-category.add li > .selected', function(e) {
8799            e.stopPropagation();
8800            if ($('.input-user-category').hasClass('active')) {
8801                $('.input-user-category').removeClass('active').hide();
8802                $('.modal-footer .ok-button-dialog').removeClass('disabled');
8803            }
8804            $('.sub-category-item').removeClass('active').remove();
8805            var category_no = Number($(this).attr('data-category'));
8806            switch ($(this).index()) {
8807                case 0:
8808                    $(this).parent().removeClass('active');
8809                    $(this).parent().text($(this).text());
8810                    // $('.add-user-category').addClass('disable').fadeOut(200);
8811                    // setTimeout(function() {
8812                    $('.choose-select-category.add li.disable').fadeIn(200).removeClass('disable');
8813                    // },200);
8814                    break;
8815                case 1:
8816                    $(this).parent().html($('.choose-select-category.add li > .selected').first().outerHTML());
8817                    var id = $('.choose-select-category.add li > .selected').last().attr('data-category');
8818                    displaySubCategoryList(lux_all_category[id]['sub']);
8819                    if (category_no > 1000000000) setTimeout(function() { enableCategoryButton(); }, 500);
8820                    break;
8821                case 2:
8822                    $(this).remove();
8823                    var id = $('.choose-select-category.add li > .selected').last().attr('data-category'),
8824                        sub = $('.choose-select-category.add li > .selected').first().attr('data-category');
8825                    displaySubCategoryList(lux_all_category[sub]['sub'][id]['sub'], true);
8826                    if (category_no > 1000000000) setTimeout(function() { enableCategoryButton(); }, 500);
8827                    break;
8828            }
8829        });
8830
8831    var addInputCategoryClose = function(out) {
8832        $('.sub-category-item').removeClass('hide');
8833        $('.input-user-category > input').val('');
8834        $('.input-user-category').removeClass('active').fadeOut(out, function() {
8835            if (out > 0) $('.choose-select-category.add li.add-user-category').removeClass('disable');
8836            $('.modal-footer .ok-button-dialog').removeClass('disabled');
8837        });
8838    }
8839
8840    var enableCategoryButton = function() {
8841        $('.choose-select-category.add li.add-user-category').removeClass('disable').show();
8842    }
8843
8844    var displaySubCategoryList = function(o, last, out) {
8845        $('.sub-category-item').remove();
8846        var s = '<div class="sub-category-item">';
8847        $.each(o, function(i, v) {
8848            s += '<div class="' + ((last) ? 'last' : '') + '" data-category="' + v.category_no + '" data-sub="' + v.parent_category_no + '"><span class="user-category-text">' + v.category_name + '</span></div>';
8849        });
8850        s += '</div>';
8851        $('.add-user-category').before(s);
8852        // setTimeout(function() {
8853        $('.sub-category-item').addClass('active');
8854        // },200);
8855        if (typeof out != 'undefined') return s;
8856    }
8857
8858    var setSelectCategoryHTML = function(r, add) {
8859        var category_add = (typeof add != 'undefined' && add == true) ? ' add' : '',
8860            li = '',
8861            active = '',
8862            prev_str = '',
8863            used = [];
8864
8865        $.each(r.use_category, function(i, v) {
8866            used.push(v);
8867        });
8868
8869        $.each(r.root, function(i, v) {
8870            var disabled = (used.indexOf(Number(v.category_no)) > -1) ? ' disabled' : '';
8871            if (typeof r.use_category[Number(selectID)] != 'undifined' && r.use_category[Number(selectID)] == v.category_no) {
8872                disabled = '';
8873            }
8874
8875            active = (v.category_no == r.category_no) ? 'active' : '';
8876            if (active == 'active') prev_str = v.category_no + ',' + v.category_name;
8877            if (v.count == -1) v.count = 0;
8878            li += '<li class="' + active + disabled + ' orig" data-category="' + v.category_no + '"><span class="user-category-text">
8878' + v.category_name + ((add) ? '</span> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>' : '</span><span class="count">' + number_format(v.count) + '</span></li>');
8879        });
8880
8881        var s = '<ul class="choose-select-category' + category_add + '" data-prev="' + prev_str + '">' + li;
8882        if (add == true) {
8883            s += '<li class="click-off add-user-category orig"><svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z"/></svg> 카테고리 추가</li>';
8884            s += '<li class="click-off input-user-category" data-depth="1"><input type="text" id="input-user-category" maxlength="20" placeholder="카테고리명을 입력하세요"><span class="input-user-category-close"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"></path></svg></span></li>';
8885            s += '';
8886        }
8887        s += '</ul>';
8888        return s;
8889    }
8890
8891    var selectShoppingCategory = function(seq, mode, r, replace) {
8892        var modal = $(this).showModalFlat('상품 연결', setSelectCategoryHTML(r), true, true, function() {
8893            modal.modal('hide');
8894
8895            var choose = $('.choose-select-category li.active').attr('data-category');
8896            if (typeof choose == 'undefined') {
8897                alert('선택된 카테고리가 없습니다');
8898                return false;
8899            }
8900            $.modalON();
8901            setTimeout(function() {
8902                $('.gallerytype-choose').modal('hide');
8903                if (replace == true) selectGalleryTypeNreloadList(seq, mode, choose);
8904                else selectGalleryElement(seq, mode, choose);
8905            }, 500);
8906        }, 'config.close', 'config.ok', 'cl-cmmodal cl-s-btn w700 cl-p70 cl-p0 noActive-domain-check,zindex', true, '', '', function() {
8907            $('.flat-modal.zindex').remove();
8908            $('.choose-gallery-type li[data-gallery-type]').attr('style', '');
8909        });
8910    }
8911
8912    $(document).on({
8913        mouseenter: function(e) {
8914            $(this).parent().addClass('show-category');
8915        },
8916        mouseleave: function(e) {
8917            $(this).parent().removeClass('show-category');
8918        }
8919    }, ".cl-s-product-lux-info .lux-category-wrap");
8920
8921    $(document).on('click', '.choose-select-category li:not(.click-off)', function(e) {
8922        if ($(this).hasClass('disabled')) return false;
8923        $('.choose-select-category li').removeClass('active');
8924        $(this).addClass('active');
8925    });
8926
8927    $(document)
8928        .off('click', '.shop-filter-header .recommend-filter ~ .dropdown-menu li, .shop-filter-header .recommend-filter.brand')
8929        .on('click', '.shop-filter-header .recommend-filter ~ .dropdown-menu li, .shop-filter-header .recommend-filter.brand', function(e) {
8930            var key = $(this).attr('data-key'),
8931                val = $(this).attr('data-val'),
8932                selected_param = ($('.gallery-modal').length) ? localStorage.getItem(key) : getSearchURL(key);
8933            if ($(this).hasClass('disabled')) return;
8934
8935            if ($(this).hasClass('active')) {
8936                val = ($('.gallery-modal').length) ? removeParameter(key, val, true) : removeParameter(key, val);
8937            } else {
8938                if (key == 'brand' || key == 'trend' || key == 'discount_rate') {
8939                    if ((selected_param || '').indexOf(val) < 0) {
8940                        val = (selected_param) ? selected_param + ',' + val : val;
8941                    } else {
8942                        val = ($('.gallery-modal').length) ? removeParameter(key, val, true) : removeParameter(key, val);
8943                    }
8944                }
8945            }
8946
8947            if ($('.gallery-modal').length) {
8948                localStorage.setItem(key, val);
8949                $.gallery.show($.gallery.block_id, 1);
8950            } else {
8951                $.processON();
8952                location.href = setSearchURL(key, val);
8953            }
8954        });
8955
8956    $(document)
8957/* head
8958        .off('click', '.shop-filter-header .checked-filters .item-filter .dropdown-menu li')
8959        .on('click', '.shop-filter-header .checked-filters .item-filter .dropdown-menu li', function(e) {
8960            var key = $(this).attr('data-key'),
8961                val = $(this).attr('data-val');
8962
8963            if ($('.gallery-modal').length) {
8964                localStorage.setItem(key, val);
8965                $.gallery.show($.gallery.block_id, 1);
8966            } else {
8967                location.href = setSearchURL(key, val);
8968            }
8969        });
8970
8971    $(document)
8972        .off('click', '.shop-filter-header .checked-filters li svg')
8973        .on('click', '.shop-filter-header .checked-filters li svg', function(e) {
8974            e.stopPropagation();
8975            var key = $(this).parent().attr('data-key'),
8976                val = $(this).parent().attr('data-val');
8977
8978            val = ($('.gallery-modal').length) ? removeParameter(key, val, true) : removeParameter(key, val);
8979            if ($('.gallery-modal').length) {
8980                localStorage.setItem(key, val);
8981                $.gallery.show($.gallery.block_id, 1);
8982            } else {
8983                location.href = setSearchURL(key, val);
8984            }
8985        });
8986================================================================        
8987*/
8988    .off('click','.shop-filter-header .item-filter .dropdown-menu li')
8989    .on ('click','.shop-filter-header .item-filter .dropdown-menu li', function(e) {
8990        var key = $(this).attr('data-key'),
8991            val = $(this).attr('data-val');
8992
8993        if($('.gallery-modal').length) { 
8994            localStorage.setItem(key,val);
8995            $.gallery.show($.gallery.block_id,1);
8996        } else {
8997            location.href = setSearchURL(key,val);
8998        }
8999    });
9000
9001    $(document)
9002    .off('click','.shop-filter-header .checked-filters .user-checked svg')
9003    .on ('click','.shop-filter-header .checked-filters .user-checked svg', function(e) {
9004        e.stopPropagation();
9005        var key = $(this).parent().attr('data-key'),
9006            val = $(this).parent().attr('data-val');
9007
9008        val = ($('.gallery-modal').length) ? removeParameter(key,val,true) : removeParameter(key,val);
9009        if($('.gallery-modal').length) { 
9010            localStorage.setItem(key,val);
9011            $.gallery.show($.gallery.block_id,1);
9012        } else {
9013            location.href = setSearchURL(key,val);
9014        }
9015    });
9016/* ============================================================ */
9017
9018    $(document)
9019        .off('click', '.shop-filter-header .sub-category, .shop-filter-header .selected-category-item')
9020        .on('click', '.shop-filter-header .sub-category, .shop-filter-header .selected-category-item', function(e) {
9021            var key = $(this).attr('data-key'),
9022                val = $(this).attr('data-val');
9023
9024            if ($('.gallery-modal').length) {
9025                localStorage.setItem(key, val);
9026                $.gallery.show($.gallery.block_id, 1);
9027            } else {
9028                location.href = setSearchURL(key, val);
9029            }
9030        });
9031
9032    $(document)
9033        .off('keyup', '.product-name-input')
9034        .on('keyup', '.product-name-input', function(e) {
9035            var key = (e.which) ? e.which : e.keyCode,
9036                search_name = $(this).val().trim();
9037            if (key == 13) {
9038                if (search_name.indexOf(',') > -1 || search_name.indexOf('"') > -1 || search_name.indexOf('%') > -1) {
9039                    alert('\, \% \" 검색어에 포함될 수 없습니다');
9040                    return false;
9041                }
9042                
9043                searchProductName($(this));
9044            }
9045        });
9046
9047    $(document)
9048        .off('click','.search-product-cancel')
9049        .on ('click','.search-product-cancel', function(e) {
9050            if($(this).prev().val().trim() == '') return;
9051            localStorage.removeItem('product_name');
9052            $('.product-name-input').val('');
9053            $.processON();
9054            ($('.gallery-modal').length) ? 
9055                $.gallery.show($.gallery.block_id,1) :
9056                location.href = setSearchURL('product_name','');
9057        });
9058
9059    
9060    let qm_dragging = false, qm_startX = 0, qm_startLeft = 0;
9061    let $qm_active = $(); 
9062
9063    $(document)
9064        .off('click', '.search-product-remove')
9065        .on('click', '.search-product-remove', function(e) {
9066            if ($(this).prev().val().trim() == '') return;
9067            localStorage.removeItem('product_name');
9068            $('.product-name-input').val('');
9069            $.processON();
9070            ($('.gallery-modal').length) ?
9071                $.gallery.show($.gallery.block_id, 1):
9072                location.href = setSearchURL('product_name', '');
9073        });
9074
9075    $(document)
9076        .on('mousedown', '.quickmenu[data-imgtype="bottom_default"]', function (e) {
9077            qm_dragging = true;
9078            $qm_active = $(this).find('ul');
9079            if (!$qm_active.length) {
9080                qm_dragging = false;
9081                return;
9082            }
9083            qm_startX = e.pageX;
9084            qm_startLeft = $qm_active.scrollLeft() || 0;
9085            $qm_active.addClass('is-dragging');
9086            e.preventDefault();
9087        })
9088        .on('mousemove', '.quickmenu[data-imgtype="bottom_default"]', function (e) {
9089            if (!qm_dragging || !$qm_active.length) return;
9090            const dx = e.pageX - qm_startX;
9091            $qm_active.scrollLeft(qm_startLeft - dx); 
9092        })
9093        .on('mouseup mouseleave', '.quickmenu[data-imgtype="bottom_default"]', function () {
9094            if (!qm_dragging) return;
9095            qm_dragging = false;
9096            if ($qm_active.length) $qm_active.removeClass('is-dragging');
9097            $qm_active = $();
9098        })
9099        .on('dragstart', '.quickmenu[data-imgtype="bottom_default"]', function (e) { console.log(12); e.preventDefault(); });
9100    /*
9101        $(document)
9102        .off('keyup','.prod-search-brand .search-brand-input')
9103        .on ('keyup','.prod-search-brand .search-brand-input', function(e) {
9104            var key = (e.which) ? e.which : e.keyCode,
9105                search_brand = $(this).val().trim(),
9106                brand_code = '';
9107            if(key == 13) {
9108                $.each(product_brand_list, function(i,v) {
9109                    if(v.brand_name == search_brand) {
9110                        brand_code = v.brand_code;
9111                        return false;
9112                    }
9113                });
9114                if(brand_code) {
9115                    if($('.gallery-modal').length) {
9116                        localStorage.setItem('brand',brand_code);
9117                        $.gallery.show(selectID,1);
9118                    } else location.href = setSearchURL('brand',brand_code);
9119                }
9120            }
9121        });
9122    */
9123    function searchProductName($input) {
9124        var params = getProductParams(),
9125            stx = $input.val().trim();
9126
9127        if (stx.length) {
9128            if ($('.gallery-modal').length) {
9129                localStorage.setItem('product_name', stx);
9130                $.gallery.show($.gallery.block_id, 1);
9131            } else {
9132                $.processON();
9133                location.href = setSearchURL('product_name', stx);
9134            }
9135        }
9136    }
9137
9138    function removeElementByIndex(array, index) {
9139        if (index > -1) { // 제거할 인덱스가 배열 범위 내에 있는 경우
9140            array.splice(index, 1); // 해당 인덱스의 원소를 제거
9141        }
9142        return array;
9143    }
9144
9145    function getAddSearches() {
9146        var searches = (localStorage.getItem('searches_' + $.lux.select_type) === null || localStorage.getItem('searches_' + $.lux.select_type) == '[null]') ? [] : JSON.parse(localStorage.getItem('searches_' + $.lux.select_type)),
9147            sort = $('.lux-product-search .sort-filter .type_filter').attr('data-val');
9148        sort = (sort) ? sort : 'new';
9149        $.each(searches, function(i,v) {
9150            if(v == null) return true;            
9151            searches[i]['sort'] = sort;
9152        });        
9153               
9154        return searches;
9155    }
9156
9157    function resetAddSearches() {
9158      var s = getAddSearches();
9159      localStorage.removeItem('searches_' + $.lux.select_type);
9160    }
9161
9162    function defaultProductParams() {
9163        return {
9164            'category_no': '',
9165            'brand': '',
9166            'trend': '',
9167            'discount_rate': '',
9168            'min_sale': '',
9169            'max_sale': '',
9170            'min_price': '',
9171            'max_price': '',
9172            'filter': '',
9173            'product_name': '',
9174            'sort': '',
9175            'prod_case': ''
9176        }
9177    }
9178
9179    function getStorageItem(key) {
9180        if(typeof key == 'undefined' || key == '') return '';
9181
9182        $default_val = '';
9183        switch(key) {
9184            case 'gallery-product-filter':  $default_val = 'all'; break;
9185            case 'gallery-product-view':    $default_val = 0; break;
9186            case 'gallery-product-page':    $default_val = 1; break;
9187            default:                        $default_val = ''; break;
9188        }
9189
9190        return (localStorage.getItem(key) === null) ? $default_val : localStorage.getItem(key);
9191    }
9192
9193    function getProductParams(key) {
9194        var r = {
9195            'category_no': (localStorage.getItem('category_no') === null) ? '' : localStorage.getItem('category_no'),
9196            'brand': (localStorage.getItem('brand') === null) ? '' : localStorage.getItem('brand'),
9197            'trend': (localStorage.getItem('trend') === null) ? '' : localStorage.getItem('trend'),
9198            'discount_rate': (localStorage.getItem('discount_rate') === null) ? '' : localStorage.getItem('discount_rate'),
9199            'min_sale': (localStorage.getItem('min_sale') === null) ? '' : localStorage.getItem('min_sale'),
9200            'max_sale': (localStorage.getItem('max_sale') === null) ? '' : localStorage.getItem('max_sale'),
9201            'min_price': (localStorage.getItem('min_price') === null) ? '' : localStorage.getItem('min_price'),
9202            'max_price': (localStorage.getItem('max_price') === null) ? '' : localStorage.getItem('max_price'),
9203            'filter': (localStorage.getItem('filter') === null) ? '' : localStorage.getItem('filter'),
9204            'product_name': (localStorage.getItem('product_name') === null) ? '' : localStorage.getItem('product_name'),
9205            'sort': (localStorage.getItem('sort') === null) ? '' : localStorage.getItem('sort'),
9206            'prod_case': (localStorage.getItem('prod_case') === null) ? '' : localStorage.getItem('prod_case'),
9207        }
9208        if (typeof key != 'undefined') return r[key];
9209        else {
9210            var isNull = true;
9211            $.each(r, function(i, v) {
9212                if (v.length) isNull = false;
9213            });
9214            if (isNull) return null;
9215            else return r;
9216        }
9217    }
9218
9219    function setSearchesIndexValue(key, value) {
9220        var idx = $('.search-list .search-group.active').index(),
9221            searches = getAddSearches();
9222
9223        if (idx < 0 || typeof key == 'undefined') return false;
9224
9225        // var o = searches[idx][key];
9226        // if(o.length) {
9227        //     o+= ',' + value;
9228        // } else o = value;
9229        if (searches.length == 0 || searches === null || searches[0] == null) {
9230            searches = [];
9231            searches.push(defaultProductParams());
9232            searches[idx][key] = value;
9233        } else {
9234            searches[idx][key] = value;
9235        }
9236
9237        // localStorage.setItem('searches', JSON.stringify(searches));
9238        localStorage.setItem('searches_' + $.lux.select_type, JSON.stringify(searches));        
9239        resetLocalStorageSearch();
9240        return true;
9241    }
9242
9243    function setProductParams(params) {
9244        $.each(params, function(k, v) {
9245            if (v.length) {
9246                localStorage.setItem(k, v);
9247            }
9248        });
9249    }
9250
9251    function resetProductParams() {
9252        localStorage.removeItem('category_no');
9253        localStorage.removeItem('brand');
9254        localStorage.removeItem('trend');
9255        localStorage.removeItem('discount_rate');
9256        localStorage.removeItem('min_sale');
9257        localStorage.removeItem('max_sale');
9258        localStorage.removeItem('min_price');
9259        localStorage.removeItem('max_price');
9260        localStorage.removeItem('filter');
9261        localStorage.removeItem('product_name');
9262        localStorage.removeItem('sort');
9263        localStorage.removeItem('prod_case');
9264        localStorage.removeItem('add_search');
9265        localStorage.removeItem('searches');
9266    }
9267
9268    function resetLocalStorageSearch() {
9269        localStorage.removeItem('category_no');
9270        localStorage.removeItem('brand');
9271        localStorage.removeItem('trend');
9272        localStorage.removeItem('discount_rate');
9273        localStorage.removeItem('min_sale');
9274        localStorage.removeItem('max_sale');
9275        localStorage.removeItem('min_price');
9276        localStorage.removeItem('max_price');
9277        localStorage.removeItem('filter');
9278        localStorage.removeItem('product_name');
9279        localStorage.removeItem('sort');
9280        localStorage.removeItem('prod_case');
9281    }
9282
9283    function resetSearches() {
9284        localStorage.removeItem('searches_lux');
9285        localStorage.removeItem('searches_shopping');
9286        localStorage.removeItem('searches_project');
9287        localStorage.removeItem('searches_gallery');
9288    }
9289
9290    function removeParameter(key, remove, mode) {
9291        var param = (mode == true) ? localStorage.getItem(key) : getSearchURL(),
9292            s = (mode == true) ? param : param[key],
9293            val = (s || '').split(',');
9294
9295        var r = arrayRemove(val, remove);
9296        return (r.length) ? r.join(',') : '';
9297    }
9298
9299    function getSearchURL(key) {
9300        var location = window.location.href,
9301            url = new URL(location),
9302            param = url.searchParams;
9303
9304        var r = {};
9305        if(typeof key != 'undefined' && key) {
9306            r[key] = (param.get(key) == null) ? '' : param.get(key);
9307        } else {
9308            r = {
9309                'category_no' : (param.get('category_no') == null) ? '' : param.get('category_no'),
9310                'brand' : (param.get('brand') == null) ? '' : param.get('brand'),
9311                'trend' : (param.get('trend') == null) ? '' : param.get('trend'),
9312                'discount_rate' : (param.get('discount_rate') == null) ? '' : param.get('discount_rate'),
9313                'min_sale' : (param.get('min_sale') == null) ? '' : param.get('min_sale'),
9314                'max_sale' : (param.get('max_sale') == null) ? '' : param.get('max_sale'),
9315                'min_price' : (param.get('min_price') == null) ? '' : param.get('min_price'),
9316                'max_price' : (param.get('max_price') == null) ? '' : param.get('max_price'),
9317                'filter' : (param.get('filter') == null) ? '' : param.get('filter'),
9318                'product_name' : (param.get('product_name') == null) ? '' : param.get('product_name'),
9319                'sort' : (param.get('sort') == null) ? '' : param.get('sort'),
9320            }
9321        }
9322
9323        $.each(r, function(r_k, r_v) {
9324            switch(r_k) {
9325                case 'trend':
9326                    var trend = (r_v) ? r_v.split(',') : [];
9327                    $(trend).each(function(k, v) {
9328                        $('.recommend-filter.list-filter + .dropdown-menu [data-key="trend"][data-val="' + v + '"]').addClass('active');
9329                    });
9330                    break;
9331                case 'min_sale':
9332                case 'max_sale':
9333                    break;
9334                case 'discount_rate':
9335                    var discount_rate = (r_v) ? r_v.split(',') : [];
9336                    $(discount_rate).each(function(k, v) {
9337                        $('.recommend-filter.list-filter + .dropdown-menu [data-key="discount_rate"][data-val="' + v + '"]').addClass('active');
9338                    });
9339                    break;
9340
9341                case 'product_name':
9342                    $('.search-product input.product-name-input').val(r_v);
9343                    break;
9344
9345                case 'sort':
9346                    if(r_v == '') r_v = 'new'; 
9347                    $('.checked-filters li[data-key="sort"][data-val="' + r_v + '"]').addClass('active');
9348                    var sort_active_str = $('.checked-filters li[data-key="sort"].active').eq(0).text();
9349                    $('.checked-filters .type_filter').text(sort_active_str);
9350                    break;
9351
9352                default:
9353                    if($.inArray(r_k, ['min_price', 'max_price']) > -1 && r_v) {
9354                        $('.recommend-filter.list-filter + .dropdown-menu [data-key="' + r_k + '"][data-val="' + r_v + '"]').addClass('active');
9355                    }
9356                    break;
9357            }
9358        });
9359
9360        return (typeof key != 'undefined') ? r[key] : r;
9361    }
9362
9363    function setSearchURL(k, v) {
9364        var param = getSearchURL();
9365        // 초기 category_no
9366        if (param.category_no == '') {
9367            var searches = getAddSearches();
9368            param.category_no = searches[0].category_no;
9369        }
9370        param[k] = v;
9371        setProductParams(param);
9372        var page = (typeof PAGE == 'undefined') ? property.PAGE : PAGE;
9373        if (typeof MODE == 'undefined') { // render
9374            var url = (property.LOAD == 'RENDER') ? '/render/' : '/';
9375            return url + page + 
9376              '?category_no=' + param.category_no + 
9377              '&brand=' + param.brand + 
9378              '&trend=' + param.trend + 
9379              '&discount_rate=' + param.discount_rate + 
9380              '&min_sale=' + param.min_sale + 
9381              '&max_sale=' + param.max_sale + 
9382              '&min_price=' + param.min_price + 
9383              '&max_price=' + param.max_price + 
9384              '&filter=' + param.filter + 
9385              '&product_name=' + param.product_name + 
9386              '&sort=' + param.sort;
9387        } else { // config
9388            return '/config/page/' + page + 
9389              '?category_no=' + param.category_no + 
9390              '&brand=' + param.brand + 
9391              '&trend=' + param.trend + 
9392              '&discount_rate=' + param.discount_rate + 
9393              '&min_sale=' + param.min_sale + 
9394              '&max_sale=' + param.max_sale + 
9395              '&min_price=' + param.min_price + 
9396              '&max_price=' + param.max_price + 
9397              '&filter=' + param.filter + 
9398              '&product_name=' + param.product_name + 
9399              '&sort=' + param.sort;
9400        }
9401    }
9402
9403    var shopHeaderDisplaySkin = function($tag,data) {
9404        if(typeof data.mode == 'undefined' || data.mode != 'shopping') return;
9405        var checkDefaultCall = false;
9406
9407        var shd_skin = $tag.attr('data-skin'),
9408            shd_row_class = 'goption-row',
9409            shd_r = data.category_info;
9410
9411        var $cate_selected_ul = $('<ul class="selected-category-list"></ul>'),
9412            cate_full = (typeof shd_r.selected != 'undefined' && shd_r.selected.full_category_no != null) ? shd_r.selected.full_category_no : [],
9413            cate_last_name = '',
9414            cate_last_val = '';
9415        if(typeof shd_r != 'undefined' && typeof shd_r.selected != 'undefined' && typeof shd_r.selected.full_category_name != 'undefined' && shd_r.selected.full_category_name != null) {
9416            $.each(shd_r.selected.full_category_name, function(i,v) {
9417                if(v != null && i < 3) {
9418                    cate_last_name = v;
9419                    cate_last_val = cate_full[i];
9420                    $cate_selected_ul.append('<li class="selected-category-item hand" data-key="category_no" data-val="' + cate_last_val + '">' + cate_last_name + '</li>');
9421                }
9422            });
9423        }
9424        $cate_selected_ul.find('li:last').addClass('active');
9425
9426        var $cate_h1 = $('<h1 class="selected-category-h1">' + cate_last_name + '</h1>');
9427
9428        var $cate_sub_ul = $('<ul class="sub-category-list"></ul>'),
9429            checkCateSub = false;
9430        $.each(shd_r.sub, function(i,o) {
9431            var cate_sub_active = (shd_r.selected.category_no == o.category_no) ? 'active' : '';
9432            if(cate_sub_active != '') checkCateSub = true;
9433
9434            var cate_sub_name = o.category_name;
9435            if($.inArray(shd_skin, ['000']) > -1) cate_sub_name += '<span class="count">' + number_format(s.count) + '</span>';
9436            if($.inArray(shd_skin, ['001','002','003']) > -1) cate_sub_name = '<span class="sub-category-name">' + cate_sub_name + '</span>';
9437
9438            $cate_sub_ul.append('<li class="sub-category ' + cate_sub_active + '" data-key="category_no" data-val="' + o.category_no + '">' + cate_sub_name + ' </li>');
9439        });
9440        if(typeof shd_r.selected != 'undefined' && typeof shd_r.selected.category_no != 'undefined') {
9441            var all_cate_sub_name = ($.inArray(shd_skin, ['001','002','003']) > -1) ? '<span class="sub-category-name">전체</span>' : '전체';
9442            $cate_sub_ul.prepend('<li class="sub-category all-sub-category ' + ((checkCateSub) ? '' : 'active') + '" data-key="category_no" data-val="' + cate_last_val + '">' + all_cate_sub_name + '</li>');
9443        }
9444
9445        var $search_product = $('<div class="search-product"></div>'),
9446            $search_product_input = $('<input type="text" class="product-name-input form-control" placeholder="상품명 검색" enterkeyhint="search" value="">'),
9447            $search_product_cancel = $('<span class="search-product-cancel">' + clSVG('close_m','16','16',false,'') + '</span>'),
9448            $search_product_search = $('<span class="search-product-btn">' + clSVG('search','16','16',false,'') + '</span>');
9449
9450
9451        var checkBrand = (  typeof data.category_info.uri != 'undefined' && 
9452                            typeof data.category_info.uri.brand != 'undefined' && (data.category_info.uri.brand).length
9453                        ) ? false : (($.inArray(shd_skin, ['001','002','003']) > -1) ? false : true),
9454            $search_filter = $('<div class="filter-wrap">' + ChooseFilters(checkBrand) + '</div>');
9455
9456        var sort_filter_ul = ($.inArray(shd_skin, ['001','002','003']) > -1) ? 'div' : 'ul',
9457            sort_filter_li = ($.inArray(sort_filter_ul, ['div']) > -1) ? sort_filter_ul : 'li',
9458            $sort_filter = $('\
9459                <'+ sort_filter_ul + '>\
9460                    <' + sort_filter_li + ' class="btn-group">\
9461                        <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button item-filter" data-toggle="dropdown">\
9462                            <span class="type_filter">신상품</span>\
9463                            <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>\
9464                        </button>\
9465                        <ul class="dropdown-menu">\
9466                            <li data-key="sort" data-val="new">신상품</li>\
9467                            <li data-key="sort" data-val="name">상품명</li>\
9468                            <li data-key="sort" data-val="low">낮은가격</li>\
9469                            <li data-key="sort" data-val="high">높은가격</li>\
9470                        </ul>\
9471                    </' + sort_filter_li + '>\
9472                </'+ sort_filter_ul + '>\
9473            ');
9474
9475
9476        var checked_filter_ul = ($.inArray(shd_skin, ['001']) > -1) ? 'div' : 'ul',
9477            checked_filter_li = ($.inArray(checked_filter_ul, ['div']) > -1) ? checked_filter_ul : 'li',
9478            $checked_filter_item = $('<' + checked_filter_li + ' class="user-checked"><span></span> ' + clSVG('close_m_thin',16,16,false) + '</' + checked_filter_li + '>'),
9479            $checked_filter = $('<' + checked_filter_ul + ' class="checked-filters"></' + checked_filter_ul + '>');
9480        if(typeof shd_r.checked != 'undefined' && shd_r.checked) {
9481            $.each(shd_r.checked, function(i,o) {
9482                var $tmp_cf = $checked_filter_item.clone();
9483                $tmp_cf.attr({'data-key': o.key, 'data-val': o.val});
9484                $tmp_cf.find(' > span').text(o.str);
9485                $checked_filter.append($tmp_cf);
9486            });
9487        }
9488
9489        var result_total = (typeof data.total != 'undefined' && typeof data.total.list_total != 'undefined' && data.total.list_total) ? data.total.list_total : 0,
9490            result_title = ($.inArray(shd_skin, ['001','002','003']) > -1) ? '<h1>검색결과</h1>' : '',
9491            $result_summary = $('<div class="result-summary">' + result_title + ' <span class="total">' + addCommas(result_total) + '</span><span class="unit">개</span></div>');
9492
9493        switch(shd_skin) {
9494            case '001':
9495                $tag.append($search_product.addClass('clearfix').append($search_product_input.attr('placeholder', '상품 검색')).append($search_product_search))
9496                    .append($cate_selected_ul)
9497                    .append($cate_sub_ul)
9498                    .append('<div class="line-wrap"><hr class="line"/></div>')
9499                    .append($search_filter.addClass('clearfix'))
9500                    .append($checked_filter);
9501                
9502                $sort_filter.find('.type_filter + svg').replaceWith(clSVG('caret',8,4,false));
9503                $sort_filter.find('.btn-group').addClass('pull-right');
9504                $tag.append($sort_filter.addClass('last clearfix').prepend($result_summary));
9505                break;
9506
9507            case '002':
9508                $tag.append($cate_selected_ul.addClass('clearfix'))
9509                    .append($search_product.addClass('clearfix').append($search_product_input.attr('placeholder', '상품 검색')).append($search_product_search))
9510                    .append('<div class="clearfix"></div>')
9511                    .append($cate_h1.addClass('clearfix'))
9512                    .append($cate_sub_ul)
9513                    .append('<div class="line-wrap"><hr class="line"/></div>')
9514                    .append($search_filter.addClass('clearfix'))
9515                    .append($checked_filter);
9516
9517                $sort_filter.find('.type_filter + svg').replaceWith(clSVG('caret',8,4,false));
9518                $sort_filter.find('.btn-group').addClass('pull-right');
9519                $tag.append($sort_filter.addClass('last clearfix').append($result_summary));
9520
9521                if($tag.find('.checked-filters').is(':empty')) $tag.find('.last.clearfix > div').css('margin-right', '8px');
9522                break;
9523
9524            case '003':
9525                $tag.append($cate_selected_ul.addClass('clearfix'))
9526                    .append('<div class="clearfix"></div>')
9527                    .append($cate_h1.addClass('clearfix'))
9528                    .append($cate_sub_ul)
9529                    .append('<div class="line-wrap"><hr class="line"/></div>')
9530                    .append($search_filter.addClass('clearfix'))
9531                    .append($checked_filter);
9532
9533                $sort_filter.find('.type_filter + svg').replaceWith(clSVG('caret',8,4,false));
9534                $sort_filter.find('.btn-group').addClass('pull-right');
9535                $tag.append($sort_filter.addClass('last clearfix').append($result_summary));
9536                $tag.find('h1.selected-category-h1').append('<div class="result-summary"><span class="total">
9536' + addCommas(result_total) + '</span><span class="unit">개 상품</span></div>').wrap('<div></div>');
9537                $tag.find('h1.selected-category-h1').before($search_product.addClass('clearfix').append($search_product_input.attr('placeholder', '상품 검색')).append($search_product_search));
9538
9539                if($tag.find('.checked-filters').is(':empty')) $tag.find('.last.clearfix > div').css('margin-right', '8px');
9540                break;
9541
9542            default:
9543                checkDefaultCall = true;
9544                break;
9545        }
9546
9547        if(checkDefaultCall) {
9548            $tag.removeAttr('data-skin');
9549            shopHeaderDisplay($tag,data);
9550            return;
9551        } else {
9552            getSearchURL();
9553
9554            if($tag.closest('[class*="el_"]').length > 0 && $tag.closest('[class*="el_"]').find('.full-width').length > 0) $tag.addClass('full-width');
9555            else $tag.removeClass('full-width');
9556
9557            $tag.children().addClass('goption-row');
9558        }
9559
9560        var brand_search = (typeof data.brand_search != 'undefined' && typeof data.brand_search.tag != 'undefined' && data.brand_search.tag) ? data.brand_search.tag : '';
9561        shopBrandInputAutocomplete(data.brand_list, brand_search);
9562
9563    }
9564
9565    var shopHeaderDisplay = function($tag,data) {
9566        var checkLUX = typeof LUX != 'undefined' ? LUX : property.LUX;
9567        if(checkLUX && $tag.closest('.element').is('[data-type="gallery"][data-mode="shopping"]')) $tag.closest('.element').addClass('cl-lux-gallery');
9568
9569        var check_only_cate = (typeof data.only_category != 'undefined' && data.only_category === true) ? true : false;
9570        if(!check_only_cate) return;
9571        if(typeof $tag.attr('data-skin') != 'undefined' && $tag.attr('data-skin')) {
9572            shopHeaderDisplaySkin($tag,data);
9573            return;
9574        }
9575        var brandChecked = (typeof data.category_info.uri != 'undefined' && 
9576                            typeof data.category_info.uri.brand != 'undefined' && (data.category_info.uri.brand).length
9577                          ) ? false : true;
9578        $tag.prepend('<ul class="goption-row checked-filters"></ul>');
9579        $tag.prepend('<div class="goption-row filter-wrap">' + ChooseFilters(brandChecked) + '</div>');
9580        $tag.prepend('<ul class="goption-row sub-category-list"></ul>');
9581        $tag.prepend('<ul class="goption-row selected-category-list"></ul>');
9582        selected_category = data.category_info;
9583
9584        // lux shopping selected category
9585        if (typeof selected_category == 'object' && data.mode == 'shopping') {
9586            var $category_nav = $tag.find('.selected-category-list'),
9587                full_category_no = selected_category.selected.full_category_no;
9588            last_category_no = '';
9589            if (selected_category.selected.full_category_name !== null) {
9590                $.each(selected_category.selected.full_category_name, function(c, s) {
9591                    if (s != null && c < 3) {
9592                        $category_nav.append('<li class="selected-category-item hand" data-key="category_no" data-val="' + full_category_no[c] + '">' + s + '</li>');
9593                        last_category_no = full_category_no[c];
9594                    }
9595                });
9596            }
9597            // search 
9598            var product_name_input = ($('.gallery-modal').length) ? getProductParams('product_name') : getSearchURL('product_name');
9599            $category_nav.append('<li class="search-product"><input type="text" class="form-control product-name-input" placeholder="상품명 검색" enterkeyhint="search" value="' + product_name_input + '"><span class="search-product-cancel"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/></svg></span></li>');
9600
9601            var $sub_category = $tag.find('.sub-category-list'),
9602                sub_category_selected = false;
9603            $.each(selected_category.sub, function(c, s) {
9604                var active = (selected_category.selected.category_no == s.c
9604ategory_no) ? 'active' : '';
9605                if (active.length) sub_category_selected = true;
9606
9607                $sub_category.append('<li class="sub-category ' + active + '" data-key="category_no" data-val="' + s.category_no + '">' + s.category_name + ' <span class="count">' + number_format(s.count) + '</span></li>');
9608            });
9609
9610            if (typeof selected_category.selected != 'undefined' && typeof selected_category.selected.category_no != 'undefined') {
9611                $sub_category.prepend('<li class="sub-category all-sub-category ' + ((sub_category_selected) ? '' : 'active') + '" data-key="category_no" data-val="' + last_category_no + '">전체</li>');
9612            }
9613
9614            $.each(selected_category.checked, function(s,l) {
9615                $tag.find('.checked-filters').append('<li class="user-checked" data-key="' + l.key + '" data-val="' + l.val + '">' + l.str + ' ' + clSVG('close_m_thin',16,16,false) + '</li>');
9616            });
9617
9618            if ($tag.find('.checked-filters .list-filter').length == 0) {
9619                var selected = ($('.gallery-modal').length) ? getProductParams('sort') : getSearchURL('sort'),
9620                    filters = {
9621                        'new': '신상품',
9622                        'name': '상품명',
9623                        'low': '낮은가격',
9624                        'high': '높은가격'
9625                    };
9626                if (selected == '') selected = 'new';
9627                var s = '\
9628                <div class="btn-group list-filter">\
9629                    <button type="button" class="dropdown-toggle recommend-filter dropdown-button item-filter" data-toggle="dropdown">\
9630                        <span class="type_filter">' + filters[selected] + '</span>\
9631                        <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
9632                            <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
9633                        </svg>\
9634                    </button>\
9635                    <ul class="dropdown-menu">\
9636                        <li data-key="sort" data-val="new">신상품</li>\
9637                        <li data-key="sort" data-val="name">상품명</li>\
9638                        <li data-key="sort" data-val="low">낮은가격</li>\
9639                        <li data-key="sort" data-val="high">높은가격</li>\
9640                    </ul>\
9641                </div>\
9642                ';
9643                /*
9644                <li data-key="filter" data-val="hot">인기상품</li>\
9645                <li data-key="filter" data-val="review">사용후기</li>\
9646                */
9647
9648                var prod_cases = { 'A': '전체', 'M': '수정상품', 'O': '사입상품', 'H': '숨김상품', 'S': '품절상품' };
9649                var prod_case_value = getProductParams('prod_case');
9650                if (!prod_case_value) prod_case_value = 'A'; 
9651                if ($('.gallery-modal').length) { // 상품관리 모달 열린상태
9652                    s += '<div class="btn-group list-filter">\
9653                            <button type="button" class="dropdown-toggle recommend-filter list-filter dropdown-button" data-toggle="dropdown">\
9654                                <span class="type_prod_case">' + prod_cases[prod_case_value] + '</span>\
9655                                <svg width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">\
9656                                    <path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path>\
9657                                </svg>\
9658                            </button>\
9659                            <ul class="dropdown-menu">\
9660                    ';
9661                    $.each(prod_cases, function(k, v) {
9662                        s += '<li class="" data-key="prod_case" data-val="' + k + '">' + v + '</li>';
9663                    });
9664
9665                    s += '\
9666                            </ul>\
9667                        </div>';
9668                }
9669
9670                $tag.find('.checked-filters').append(s);
9671            }
9672        }
9673
9674        // lux shopping filter active
9675        if(data.mode == 'shopping') {
9676            if($('.gallery-modal').length == 0) var tmp_filter = getSearchURL();
9677            var trend = localStorage.getItem('trend'),
9678                discount_rate = localStorage.getItem('discount_rate'),
9679                min_sale = localStorage.getItem('min_sale'),
9680                max_sale = localStorage.getItem('max_sale'),
9681                min_price = localStorage.getItem('min_price'),
9682                max_price = localStorage.getItem('max_price'),
9683                filter = localStorage.getItem('filter');
9684
9685            $.each((trend || '').split(','), function(s, l) {
9686                $tag.find('.filter-wrap li[data-key="trend"][data-val="' + l + '"]').addClass('active');
9687            });
9688            $.each((discount_rate || '').split(','), function(s, l) {
9689                $tag.find('.filter-wrap li[data-key="discount_rate"][data-val="' + l + '"]').addClass('active');
9690            });
9691            $tag.find('.filter-wrap li[data-key="min_price"][data-val="' + min_price + '"]').addClass('active');
9692            $tag.find('.filter-wrap li[data-key="max_price"][data-val="' + max_price + '"]').addClass('active');
9693            $tag.find('.filter-wrap li[data-key="filter"][data-val="' + filter + '"]').addClass('active');
9694        }
9695        // lux brand
9696        // var tags = [];
9697        // $.each(data.brand_list, function(i,v) {
9698        //     tags.push(v.brand_name);
9699        // });
9700        
9701        var brand_search = (typeof data.brand_search != 'undefined' && typeof data.brand_search.tag != 'undefined' && data.brand_search.tag) ? data.brand_search.tag : '';
9702        shopBrandInputAutocomplete(data.brand_list, brand_search);
9703    }
9704
9705    var shopBrandInputAutocomplete = function(list, search) {
9706        if(typeof search == 'undefined') search = '';
9707
9708        $('.search-brand-input').autocomplete({
9709            source: search,
9710            appendTo: '.prod-search-brand',
9711            focus: function(event, ui) {
9712                $('.ui-autocomplete li').removeClass('active');
9713                if (ui.item.value == '') return false;
9714                $('.ui-autocomplete li a:contains("' + ui.item.value + '")').parent().addClass('active');
9715                return false;
9716            },
9717            select: function(event, ui) {
9718                if (ui.item.value == '') {
9719                    event.preventDefault();
9720                    return false;
9721                }
9722                var selected = ui.item.value,
9723                    val = selected.split(" ["),
9724                    search_brand = '',
9725                    brand_code = '';
9726                ui.item.value = val[0];
9727
9728                search_brand = val[0];
9729                $.each(list, function(i,v) {
9730                    if(v.brand_name == search_brand) {
9731                        brand_code = v.brand_code;
9732                        return false;
9733                    }
9734                });
9735                if (brand_code) {
9736                    if ($('.gallery-modal').length) {
9737                        localStorage.setItem('brand', brand_code);
9738                        $.gallery.show($.gallery.block_id, 1);
9739                    } else {
9740                        $.processON();
9741                        location.href = setSearchURL('brand', brand_code);
9742                    }
9743                }
9744            },
9745            response: function(event, ui) {
9746                if (ui.content.length == 0) {
9747                    ui.content.push({ value: '', label: '검색되는 브랜드가 없습니다.' });
9748                }
9749            }
9750        });
9751    }
9752    var getRecordHtml = function(service) {
9753        var str = '';
9754        switch (service) {
9755            case 'go':
9756                str += '\
9757                <div class="table-wrap">\
9758                    <table>\
9759                        <colgroup>\
9760                            <col width="120px"></col>\
9761                            <col width="75px"></col>\
9762                            <col width="85px"></col>\
9763                            <col width="60px"></col>\
9764                            <col width="*"></col>\
9765                        </colgroup>\
9766                        <thead>\
9767                            <tr><td>' + $.lang[LANG]['domain.connect.record.title.name'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.ttl'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.type'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.priority'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.val'] + '</td></tr>\
9768                        </thead>\
9769                        <tbody>\
9770                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.1'] + '</td><td>3600</td><td>MX</td><td>1</td><td>ASPMX.L.GOOGLE.COM</td></tr>\
9771                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.1'] + '</td><td>3600</td><td>MX</td><td>5</td><td>ALT1.ASPMX.L.GOOGLE.COM</td></tr>\
9772                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.1'] + '</td><td>3600</td><td>MX</td><td>5</td><td>ALT2.ASPMX.L.GOOGLE.COM</td></tr>\
9773                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.1'] + '</td><td>3600</td><td>MX</td><td>10</td><td>ALT3.ASPMX.L.GOOGLE.COM</td></tr>\
9774                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.1'] + '</td><td>3600</td><td>MX</td><td>10</td><td>ALT4.ASPMX.L.GOOGLE.COM</td></tr>\
9775                        </tbody>\
9776                    </table>\
9777                </div>\
9778                </div>';
9779                break;
9780
9781            case 'nv':
9782                str += '\
9783                <div class="table-wrap">\
9784                    <table>\
9785                        <colgroup>\
9786                            <col width="180px"></col>\
9787                            <col width="60px"></col>\
9788                            <col width="*"></col>\
9789                        </colgroup>\
9790                        <thead>\
9791                            <tr><td>' + $.lang[LANG]['domain.connect.record.title.name'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.priority'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.record'] + '</td></tr>\
9792                        </thead>\
9793                        <tbody>\
9794                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>10</td><td>kr1-aspmx1.worksmobile.com.</td></tr>\
9795                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>20</td><td>kr1-aspmx2.worksmobile.com.</td></tr>\
9796                        </tbody>\
9797                    </table>\
9798                </div>\
9799                </div>';
9800                break;
9801
9802            case 'dm':
9803                str += '\
9804                <div class="table-wrap">\
9805                    <table>\
9806                        <colgroup>\
9807                            <col width="160px"></col>\
9808                            <col width="60px"></col>\
9809                            <col width="*"></col>\
9810                        </colgroup>\
9811                        <thead>\
9812                            <tr><td>' + $.lang[LANG]['domain.connect.record.title.name'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.priority'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.record'] + '</td></tr>\
9813                        </thead>\
9814                        <tbody>\
9815                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>10</td><td>ASPMX.daum.net.</td></tr>\
9816                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>20</td><td>ALT.ASPMX.daum.net.</td></tr>\
9817                        </tbody>\
9818                    </table>\
9819                </div>\
9820                </div>';
9821                break;
9822
9823            case 'hi':
9824                str += '\
9825                <div class="table-wrap">\
9826                    <table>\
9827                        <colgroup>\
9828                            <col width="130px"></col>\
9829                            <col width="85px"></col>\
9830                            <col width="60px"></col>\
9831                            <col width="*"></col>\
9832                        </colgroup>\
9833                        <thead>\
9834                            <tr><td>' + $.lang[LANG]['domain.connect.record.title.name'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.type'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.priority'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.val'] + '</td></tr>\
9835                        </thead>\
9836                        <tbody>\
9837                            <tr><td>@</td><td>MX</td><td>10</td><td>mx1.hiworks.com.</td></tr>\
9838                            <tr><td>@</td><td>MX</td><td>20</td><td>
9838mx2.hiworks.com.</td></tr>\
9839                            <tr><td>@</td><td>TXT(SPF)</td><td></td><td>v=spf1 include:_spf.hiworks.co.kr ~all</td></tr>\
9840                        </tbody>\
9841                    </table>\
9842                </div>\
9843                </div>';
9844                break;
9845
9846            case 'mp':
9847                str += '\
9848                <div class="table-wrap">\
9849                    <table>\
9850                        <colgroup>\
9851                            <col width="130px"></col>\
9852                            <col width="85px"></col>\
9853                            <col width="60px"></col>\
9854                            <col width="*"></col>\
9855                        </colgroup>\
9856                        <thead>\
9857                            <tr><td>' + $.lang[LANG]['domain.connect.record.title.name'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.type'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.priority'] + '</td><td>' + $.lang[LANG]['domain.connect.record.title.val'] + '</td></tr>\
9858                        </thead>\
9859                        <tbody>\
9860                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>MX</td><td>10</td><td>mx01.mailplug.com.</td></tr>\
9861                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>MX</td><td>20</td><td>mx02.mailplug.com.</td></tr>\
9862                            <tr><td>mail</td><td>CNAME</td><td></td><td>m79.mailplug.com</td></tr>\
9863                            <tr><td>' + $.lang[LANG]['domain.connect.record.content.blank.2'] + '</td><td>TXT(SPF)</td><td></td><td>v=spf1 mx include:mailplug.com ~all</td></tr>\
9864                        </tbody>\
9865                    </table>\
9866                </div>\
9867                </div>';
9868                break;
9869
9870            case 'etc':
9871                var suadmin = '<?=SU_EADMIN?>',
9872                    url = (suadmin) ? "https://creatorlink.net/help" : "";
9873
9874                str += '\
9875                <div class="etc-info">\
9876                    <p>' + $.lang[LANG]['domain.connect.mx.info.text.1'] + '<a href="' + url + '" target="_blank">' + $.lang[LANG]['domain.connect.mx.info.text.2'] + '</a>' + $.lang[LANG]['domain.connect.mx.info.text.3'] + '</p>\
9877                    <div class="info-text">\
9878                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zm0 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><path d="M6 3h1v5H6zM6 9h1v1H6z"/></svg>' + $.lang[LANG]['domain.connect.mx.info.text.4'] + '\
9879                    </div>\
9880                </div>';
9881                break;
9882        }
9883
9884        return str;
9885    }
9886
9887    var setFixedMenuCss = function(checkEllist) {      
9888        // console.log('setFixedMenuCss :: 로고 / 확장기능 버튼 height,line-height 추가');
9889        var fh_selector = (checkEllist) ? '.elviewhtml header.navbar[data-fixtype]' : 'header.navbar[data-fixtype]',
9890            $fh = $(fh_selector);
9891
9892        if($fh.length == 0) return false;
9893        var fh_type = $fh.attr('data-fh-type'),
9894            fixtypeNum = $fh.attr('data-fixtype').replace(/(top|sidebar)\_/gi, ''),
9895            fixtypeArr = ['01', '02', '03', '08'];
9896        if($fh.find('#fixed-menu').find('.cl-visible').length == 0 && fh_type=='top') {
9897          if(PAGE_MODE == 'c') {
9898            $fh.find('.fh-container').addClass('hide');
9899          } else {
9900            $fh.find('.fh-container').remove();
9901          }
9902        }
9903
9904        var check_color_panel = ($('.elmenu-content').length > 0) ? 60 : 49,
9905            fixed_mn_width = $fh.find('.cl-fixed-menu').width() + check_color_panel,
9906            fixed_mn_height = $fh.find('#tpl-menu li').height(),
9907            navbarHeader_width = $fh.find('.navbar-header').width(),
9908            check_fixed_mn = ($fh.find('.cl-fixed-menu').length>0) ? true : false;
9909
9910        logo_mn_height = ($fh.find('.navbar-brand img').height() > $fh.find('#tpl-menu').height()) ? '' : fixed_mn_height;
9911
9912        if($fh.find('.cl-menu-option').length > 0) {
9913            if($fh.find('.cl-menu-option').is('[data-mwidth="all"]') && $fh.is('[data-fh-type="right"]')) {
9914                var fixed_m_w = $fh.find('.cl-fixed-menu').outerWidth(),
9915                    moption_row_padding = {};
9916
9917                if($fh.find('.cl-menu-option').is('.nfullDrop')) moption_row_padding = {};
9918                else if($fh.is('[data-fixtextalign="center"]')) moption_row_padding = {'padding-left':fixed_m_w+'px','padding-right':fixed_m_w+'px'};
9919                else if($fh.is('[data-fixtextalign="right"]')) moption_row_padding = {'padding-right':fixed_m_w+'px'};
9920
9921                if($.isEmptyObject(moption_row_padding)) {
9922                    document.querySelector(fh_selector+' .moption-row').style.removeProperty('padding-left');
9923                    document.querySelector(fh_selector+' .moption-row').style.removeProperty('padding-right');
9924                } else {
9925                    if($fh.is('[data-fixtextalign="center"]')) $fh.find('#tpl-menu').css('padding-left',fixed_m_w + 'px');
9926                    else document.querySelector(fh_selector+' #tpl-menu').style.removeProperty('padding-left');
9927                    $fh.find('.moption-row').css(moption_row_padding);
9928                }
9929            }
9930        } else {
9931            /* menu width ****************/
9932            $fh.find('#tpl-menu').css({
9933                'width': (fh_type == 'right') ? (($fh.find(' > .container[data-fh-align]').length > 0) ? '100%' : '') : (!check_fixed_mn && (fh_type=='top') ? '100%' : ''),
9934                'max-width': (fh_type == 'right') ? (($fh.find(' > .container[data-fh-align]').length > 0) ? 'calc(100% - ' + fixed_mn_width + 'px)' : '') : (!check_fixed_mn && (fh_type=='top') ? 'calc(100% - ' + navbarHeader_width + 'px)' : '')
9935            });
9936
9937            /* menu 확장기능 ul, li, a => 메뉴 행간별 line-height, height :: 확장기능 행간 조절 ****************/
9938            $fh.find('.cl-fixed-menu#fixed-menu').css('line-height', (fh_type == 'right') ? fixed_mn_height + 'px' : '');
9939            $fh.find('.cl-fixed-menu#fixed-menu li > a:not(.cl-langlist):not(.cl-umMenu):not(.cl-lang)').css('line-height', (fh_type == 'right') ? (fixed_mn_height - 1) + 'px' : '');
9940            $fh.find('.cl-fixed-menu#fixed-menu,.cl-fixed-menu#fixed-menu li > a:not(.cl-langlist):not(.cl-umMenu):not(.cl-lang)').css({
9941                'height': (fh_type == 'right') ? fixed_mn_height + 'px' : '',
9942            });
9943
9944            /* menu 확장기능 ul, li, a => 메뉴 행간별 line-height, height :: 확장기능 다국어 행간 조절  ****************/
9945            $fh.find('.cl-fixed-menu#fixed-menu .cl-visible.siteLANG, .cl-fixed-menu#fixed-menu .cl-visible.siteLANG .slang-active,\
9946                     .cl-fixed-menu#fixed-menu .cl-visible.siteLANG .cl-lang').css({
9947                'line-height': (fh_type == 'right') ? ($fh.find('.cl-fixed-menu li.cl-fixbtn').height() - 1) + 'px' : '',
9948                'height': (fh_type == 'right') ? $fh.find('.cl-fixed-menu li.cl-fixbtn').height() + 'px' : '',
9949            });
9950
9951            /* menu 로고 a => 메뉴 행간별 line-height, height ****************/
9952            if ($('body').width() > 768) {
9953                $fh.find('.navbar-brand').css({
9954                    'line-height': (fh_type == 'sidebar' || (fh_type != 'sidebar' && $fh.find(' > .container[data-fh-align]').length == 0)) ? '' : logo_mn_height + 'px',
9955                });
9956            } else {
9957                $fh.find('.navbar-brand').css('line-height', '');
9958            }
9959        }
9960
9961
9962        if (fh_type == 'sidebar' && window.innerWidth > 768) {
9963            var siteLANG_hght = Number($fh.find('.cl-visible.siteLANG').outerHeight());
9964            siteLANG_hght = (typeof MODE == 'undefined') ? siteLANG_hght : siteLANG_hght + 35;
9965
9966            $fh.find('.menu-inner').css('height', 'calc(100% - ' + siteLANG_hght + 'px)');
9967        }
9968
9969        if (checkEllist) {
9970            if (fh_type == 'right' && $fh.find('.mini-home').length > 0) {
9971                if ($('body').width() > 768) {
9972                    $fh.find('.mini-home').closest('.navbar-collapse').attr('style', 'display: inline-block !important');
9973                } else $fh.find('.mini-home').parent().removeAttr('style');
9974            }
9975        }
9976    }
9977
9978    $(document).on('mouseenter', '.el-menu [data-fixtype^="sidebar_"] .siteLANG.cl-fixbtn, .el-menu [data-fixtype^="sidebar_"] .siteUM.cl-fixbtn, #elmenu-display .siteLANG.cl-fixbtn', function() {
9979        var fixtypeNum = $('.el-menu header.navbar').attr('data-fixtype').replace(/(top|sidebar)\_/gi, ''),
9980            $dropdown = $(this).find('.dropdown-menu'),
9981            checkSiteLang = ($(this).hasClass('siteLANG')) ? 'siteLang' : 'um',
9982            $toggle = (checkSiteLang == 'siteLang') ? $(this).find('.cl-lang.dropdown-toggle') : $(this).find('.cl-logout.dropdown-toggle'),
9983            $dropdown_width = $dropdown.outerWidth(),
9984            $toggle_width = $toggle.outerWidth(),
9985            pos_left = $toggle.offset().left.toFixed(0),
9986            fixedMenu_pdlf = (checkSiteLang == 'um') ? Number($('.el-menu .cl-fixed-menu').css('padding-left').replace(/px/gi, '')) : '',
9987            fixedSiteLang_pdlf = (checkSiteLang == 'siteLang') ? Number($('.el-menu .siteLANG.cl-visible').css('padding-left').replace(/px/gi, '')) : 0,
9988            fixedMenu_textalign = ($('header.navbar[data-fixtype]').attr('data-fixtextalign')) ? $('header.navbar[data-fixtype]').attr('data-fixtextalign') : 'center',
9989            checkSidebar = ($('header.navbar[data-fixtype]').hasClass('sidebar')) ? true : false,
9990            fixtypeArr = ['01', '02', '03', '08'],
9991            check_scroll = (checkSidebar) ? $('header.navbar[data-fixtype] .menu-inner').hasVerticalScrollbar() : false;
9992
9993        pos_left = ($(this).parents('#elmenu-display').hasClass('elmenu-color-edit') && checkSiteLang == 'siteLang') ? $toggle.position().left.toFixed(0) : pos_left;
9994
9995        if (checkSiteLang == 'um') {
9996            if ($.inArray(fixtypeNum, fixtypeArr) > -1) {
9997                var left_val = 0;
9998                pos_left -= fixedMenu_pdlf;
9999                if (fixedMenu_textalign == 'center') {
10000                    var left_val = pos_left - $dropdown_width / 2 + $toggle_width / 2;
10001                    left_val = (check_scroll) ? left_val - 8 : left_val;
10002                    $dropdown.css('left', left_val);
10003                } else if (fixedMenu_textalign == 'left') {
10004                    $dropdown.css('left', 0);
10005                } else $dropdown.css({
10006                    'left': 'auto',
10007                    'right': 0
10008                });
10009            } else {
10010                $dropdown.css('left', -$dropdown_width / 2 + $toggle_width / 2);
10011            }
10012        } else {
10013            var cl_lang_top = Number($(this).find('.cl-lang').position().top.toFixed(0)),
10014                cl_lang_hght = Number($(this).find('.cl-lang').outerHeight());
10015
10016            if (checkSidebar) {
10017                if (fixedMenu_textalign == 'center') {
10018                    $dropdown.css('left', pos_left - $dropdown_width / 2 + $toggle_width / 2);
10019                } else if (fixedMenu_textalign == 'left') {
10020                    $dropdown.css('left', fixedSiteLang_pdlf);
10021                } else $dropdown.css({
10022                    'left': 'auto'
10023                });
10024            } else {
10025                if($('.el-menu header.navbar .cl-menu-option').length == 0)  $dropdown.css('left', pos_left - $dropdown_width / 2 + $toggle_width / 2);
10026            }
10027
10028            if (!$(this).parents('#elmenu-display').hasClass('elmenu-color-edit')) $dropdown.css('bottom', cl_lang_top + cl_lang_hght + 10);
10029        }
10030    });
10031
10032    $.fn.hasVerticalScrollbar = function() {
10033        // This will return true, when the div has vertical scrollbar
10034        if (typeof this.get(0) == 'undefined') return false;
10035        return this.get(0).scrollHeight > this.height();
10036    }
10037
10038    $.contentsSlider = {
10039        ready: function(el_seq) {
10040            return new Promise((resolve, reject) => {
10041                // console.log('contentsSlider ready');
10042                let $swiperEL = $('.element[data-id="' + el_seq + '"]');
10043                let column = ($swiperEL.find('[data-matrix-loop]').length > 0)? Number($swiperEL.find('[data-matrix-loop]').attr('data-matrix-column')) : $swiperEL.find('.item').length;
10044                let eltype = (typeof $swiperEL.attr('data-type') != 'undefined')? $swiperEL.attr('data-type') : '';               
10045
10046                $swiperEL.find('.item').parent().parent().addClass('swiper');
10047                $swiperEL.find('.item').parent().addClass('swiper-wrapper');
10048                $swiperEL.find('.item').addClass('swiper-slide');
10049
10050                let swiperContainer = '.element[data-id="' + el_seq + '"] .swiper';
10051                let container = document.querySelector(swiperContainer);
10052                let wrapper = document.querySelector('.element[data-id="' + el_seq +'"] .swiper-wrapper');
10053                let slides = container.querySelectorAll('.swiper-slide');
10054                let containerWidth = $(swiperContainer).outerWidth();
10055                let slideCnt = slides.length;
10056
10057                if($swiperEL.find('.full-width').length == 0 && containerWidth > 1170) containerWidth = 1170;
10058                let slideWidth = containerWidth / column;
10059                // console.log($swiperEL.attr('data-case'), 'width', containerWidth, $(swiperContainer).width() / column, slideWidth);
10060                if(eltype == 'contents') {
10061                    slides.forEach(function (slide) {
10062                         slide.style.width = `${slideWidth}px`;
10063                    });
10064                }
10065                // if(slideCnt < column + 1 || slideCnt % column > 0) {
10066                //     let totalSlideCnt = slideCnt;
10067                //     let totalPages = Math.ceil(slideCnt / column);
10068                //     if(totalPages == 1) totalPages = 2;
10069                //     let leastSlideCnt = lcm(slideCnt, column);
10070                //     if(leastSlideCnt <= column) leastSlideCnt = leastSlideCnt * 2;
10071                //     // console.log('totalSlideCnt', totalSlideCnt);
10072                //     // console.log('lcm', lcm(slideCnt, column));
10073                //     while (totalSlideCnt < slideCnt * totalPages) {
10074                //         Array.from(slides).forEach((slide, index) => {
10075                //             const clone = slide.cloneNode(true); // 슬라이드 복제
10076                //             clone.classList.add('plus-slide');   // 복제된 슬라이드에 'plus-slide' 클래스 추가
10077                //             clone.setAttribute('data-original-slide-index', index);
10078                //             wrapper.appendChild(clone);       // 컨테이너에 추가
10079                //             totalSlideCnt++;                 // 총 슬라이드 수 증가
10080                //         });
10081                //     }
10082                // } 
10083
10084                // function gcd(a, b) {
10085                //     return b === 0 ? a : gcd(b, a % b);
10086                // }
10087
10088                // function lcm(a, b) {
10089                //     return (a * b) / gcd(a, b);
10090                // }
10091               
10092                resolve(true);
10093            });
10094        },
10095        init: function(el_seq, elsettings, mode) {
10096            if(typeof mode == 'undefined' || !mode) mode = 'r';
10097            
10098            let $swiperEL = $('.element[data-id="' + el_seq + '"]');
10099            // console.log('contents slider init');
10100            // if($swiperEL.find('.item.modify').length > 0) return false;
10101
10102            let blockorg = elsettings.blockorg;
10103            let column = ($swiperEL.find('[data-matrix-loop]').length > 0)? Number($swiperEL.find('[data-matrix-loop]').attr('data-matrix-column')) : $swiperEL.find('.item').length;
10104            let slideCount = $swiperEL.find('.item').length;
10105            let windowWidth = $(window).width();
10106
10107            let elname = $('.element[data-id="' + el_seq + '"]').attr('data-name');
10108            let eltype = $('.element[data-id="' + el_seq + '"]').attr('data-type');               
10109            
10110            if(eltype == 'video') {
10111                column = (typeof $swiperEL.find('.lyoption').attr('data-lycol') != 'undefined' && $swiperEL.find('.lyoption').attr('data-lycol'))? Number($swiperEL.find('.lyoption').attr('data-lycol')) : $swiperEL.find('.item').length;
10112            }
10113
10114            if(typeof blockorg != 'undefined') $swiperEL.attr('data-case', blockorg);
10115
10116            if(mode == 'c') {
10117                $swiperEL.addClass('slider-active');
10118            }
10119
10120            let tabletCol = 4;
10121            let mobileCol = 2;
10122
10123            if(windowWidth < 992) {
10124                if($swiperEL.find('.item').hasClass('col-sm-4')) tabletCol = 3;
10125                if($swiperEL.find('.item').hasClass('col-sm-6')) tabletCol = 2;
10126                if(typeof blockorg != 'undefined') {
10127                    // if(blockorg == 'contents77') tabletCol = 2;
10128                    // if(blockorg == 'contents78') tabletCol = 2;
10129                    // if(blockorg == 'contents79') tabletCol = 2;
10130                    if(blockorg == 'contents134') tabletCol = 2;
10131                    if(blockorg == 'contents137') tabletCol = 2;
10132                    if(blockorg == 'contents138') tabletCol = 1;
10133                }
10134                if(slideCount < tabletCol) tabletCol = 1;
10135                column = tabletCol;
10136            }
10137            if(windowWidth < 768) {
10138                if($swiperEL.find('.item').hasClass('col-xs-6')) mobileCol = 2;
10139                if($swiperEL.find('.item').hasClass('col-xs-12')) mobileCol = 1;
10140                if(typeof blockorg != 'undefined') {
10141                    if(blockorg == 'contents77') mobileCol = 1;
10142                    if(blockorg == 'contents78') mobileCol = 1;
10143                    if(blockorg == 'contents79') mobileCol = 1;
10144                    if(blockorg == 'contents134') mobileCol = 1;
10145                    if(blockorg == 'contents137') mobileCol = 1;
10146                    if(blockorg == 'contents138') mobileCol = 1;
10147                }
10148                if(slideCount < mobileCol) mobileCol = 1;
10149                column = mobileCol;
10150            }
10151            
10152            if($swiperEL.find('.lyoption').length > 0) {
10153                if(windowWidth <= 991) {
10154                    tabletCol = (typeof $swiperEL.find('.lyoption').attr('data-lycol-t') != 'undefined' && $swiperEL.find('.lyoption').attr('data-lycol-t'))? Number($swiperEL.find('.lyoption').attr('data-lycol-t')) : 2;
10155                    column = Number(tabletCol);
10156                }
10157                if(windowWidth <= 768) {
10158                    mobileCol = (typeof $swiperEL.find('.lyoption').attr('data-lycol-m') != 'undefined' && $swiperEL.find('.lyoption').attr('data-lycol-m'))? Number($swiperEL.find('.lyoption').attr('data-lycol-m')) : 2;
10159                    column = Number(mobileCol);
10160                }
10161            }
10162
10163            let swiperContainer = '.element[data-id="' + el_seq + '"] .swiper';
10164    
10165            let slider_nav_style = (typeof elsettings.slider_nav_style != 'undefined' && elsettings.slider_nav_style)? elsettings.slider_nav_style : 1;
10166            let slider_page_style = (typeof elsettings.slider_page_style != 'undefined' && elsettings.slider_page_style)? elsettings.slider_page_style : 1;
10167            let slider_delay = (typeof elsettings.slider_delay != 'undefined' && elsettings.slider_delay)? Number(elsettings.slider_delay) : 1000;
10168            let slider_speed = (typeof elsettings.slider_speed != 'undefined' && elsettings.slider_speed)? Number(elsettings.slider_speed) : 1000;
10169            let slider_nav_size = getComputedStyle(document.querySelector('.' + elname)).getPropertyValue('--slider-nav-size');
10170            let slider_page_size = getComputedStyle(document.querySelector('.' + elname)).getPropertyValue('--slider-page-size');
10171	            let slider_nav_display = (typeof elsettings.slider_nav_display != 'undefined' && elsettings.slider_nav_display)? elsettings.slider_nav_display : ['arrow', 'pagination'];
10172	            let slider_motion = (typeof elsettings.slider_motion != 'undefined' && elsettings.slider_motion)? elsettings.slider_motion : 'space';
10173	            let isSlowSlider = (slider_motion == 'slow');
10174	            let loopAdditionalSlides = (isSlowSlider)? Math.max(slideCount, column * 2) : column;
10175
10176            let useNavigation = (slider_nav_display.indexOf('arrow') > -1)? true : false;
10177            let usePagination = (slider_nav_display.indexOf('pagination') > -1)? true : false;
10178            let paginationType;
10179
10180            let autoplayEnabled = true;
10181
10182            switch (slider_motion) {
10183                case 'slow':
10184                    useNavigation = false;
10185                    usePagination = false;
10186                    break;
10187                case 'space':
10188                    usePagination = false;
10189                    if (slideCount <= column) {
10190                        useNavigation = false;
10191                        autoplayEnabled = false;
10192                    }
10193                    break;
10194                case 'page':
10195                    if (slideCount <= column) {
10196                        useNavigation = false;
10197                        usePagination = false;
10198                        autoplayEnabled = false;
10199                    }
10200                    break;                    
10201                case 'stop':
10202                    if (slideCount <= column) {
10203                        useNavigation = false;
10204                        usePagination = false;
10205                    }
10206                    autoplayEnabled = false;
10207                    break;
10208            }
10209
10210            if(mode == 'c') autoplayEnabled = false;
10211            
10212            if(typeof slider_nav_size == 'undefined' || !slider_nav_size) slider_nav_size = 52;
10213            slider_nav_size = parseInt(slider_nav_size);
10214
10215            if(usePagination) {
10216              switch (true) {
10217                  case [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16, 17, 18].includes(parseInt(slider_page_style)):
10218                      paginationType = 'bullets';
10219                      break;
10220                  case [11, 12, 13].includes(parseInt(slider_page_style)):
10221                      paginationType = 'fraction';
10222                      break;
10223                  case [0].includes(parseInt(slider_page_style)):
10224                      paginationType = 'custom';
10225                      break;
10226                  default:
10227                      paginationType = 'bullets';
10228                      break;
10229              }
10230              if (!slider_page_size) {
10231                  const sizeMap = {
10232                      '28px': [9, 11, 13, 14],
10233                      '40px': [],
10234                      '52px': [1, 2, 3, 8, 17],
10235                      '64px': [12, 15, 16],
10236                      '76px': [5, 7, 6, 10]
10237                  };
10238
10239                  slider_page_size = Object.keys(sizeMap).find(key => sizeMap[key].includes(parseInt(slider_page_style))) || '52px';
10240              }
10241            }
10242
10243            if($swiperEL.find('.slider-nav-btn').length == 0) {
10244                let sliderNav = (useNavigation)? contentsSliderNav(slider_nav_size, slider_nav_style) : '';
10245                let sliderPagination = (usePagination)? '<div class="slider-pagination-' + el_seq + '" data-style="'+slider_page_style+'" data-size="'+slider_page_size+'"></div>' : '';
10246                if(useNavigation) $(swiperContainer).after(sliderNav);
10247                if(usePagination && $swiperEL.find('.slider-pagination-' + el_seq + '').length == 0) $(swiperContainer).after(sliderPagination);
10248            }
10249            
10250            $swiperEL.attr('data-slider-motion', slider_motion);
10251            $swiperEL.attr('data-slider-navsize', slider_nav_size);
10252
10253		            document.querySelector(swiperContainer).addEventListener('focus', function(e) {
10254		                e.preventDefault();
10255		                e.stopImmediatePropagation(); // Swiper 내부 이벤트로 전달되지 않게 막음
10256		                return false;
10257		            }, true);
10258
10259		            function getSlowSliderOriginalSlides() {
10260		                return $swiperEL.find('.swiper-wrapper > .item').not('.cl-slow-slide-clone').toArray();
10261		            }
10262
10263		            function getSlowSliderImages() {
10264		                return $(getSlowSliderOriginalSlides()).find('img').toArray();
10265		            }
10266
10267		            function getSlowSliderContentHeight(container) {
10268		                if(!container) return 0;
10269
10270		                let wrapper = container.querySelector('.swiper-wrapper');
10271		                if(wrapper) {
10272		                    let wrapperHeight = wrapper.getBoundingClientRect().height || 0;
10273		                    if(wrapperHeight > 0) return wrapperHeight;
10274		                }
10275
10276		                let maxHeight = 0;
10277		                getSlowSliderOriginalSlides().forEach(function(slide) {
10278		                    maxHeight = Math.max(maxHeight, slide.getBoundingClientRect().height || 0);
10279		                });
10280
10281		                return maxHeight;
10282		            }
10283
10284		            function getSlowSliderReserveHeight(container) {
10285		                if(!container) return 0;
10286
10287			                let reserveHeight = getSlowSliderContentHeight(container);
10288			                let originalSlides = getSlowSliderOriginalSlides();
10289			                let firstSlide = originalSlides.length > 0 ? originalSlides[0] : null;
10290			                let firstImg = firstSlide ? firstSlide.querySelector('img') : null;
10291
10292			                if(firstSlide && firstImg) {
10293			                    let orgw = parseFloat(firstImg.getAttribute('data-orgw')) || firstImg.naturalWidth || 0;
10294			                    let orgh = parseFloat(firstImg.getAttribute('data-orgh')) || firstImg.naturalHeight || 0;
10295			                    let slideStyle = window.getComputedStyle(firstSlide);
10296			                    let slideWidth = firstSlide.getBoundingClientRect().width || 0;
10297			                    let slidePaddingX = (parseFloat(slideStyle.paddingLeft) || 0) + (parseFloat(slideStyle.paddingRight) || 0);
10298			                    let slidePaddingY = (parseFloat(slideStyle.paddingTop) || 0) + (parseFloat(slideStyle.paddingBottom) || 0);
10299			                    let imageWidth = firstImg.getBoundingClientRect().width || 0;
10300
10301			                    if(!slideWidth) {
10302			                        let containerWidth = container.getBoundingClientRect().width || $(swiperContainer).outerWidth() || 0;
10303			                        slideWidth = containerWidth / Math.max(column, 1);
10304			                    }
10305
10306			                    if(!imageWidth && slideWidth > 0) {
10307			                        imageWidth = Math.max(slideWidth - slidePaddingX, 0);
10308			                        if(orgw > 0) imageWidth = Math.min(imageWidth, orgw);
10309			                    }
10310
10311			                    if(orgw > 0 && orgh > 0 && imageWidth > 0) {
10312			                        reserveHeight = Math.max(reserveHeight, (imageWidth * (orgh / orgw)) + slidePaddingY);
10313			                    }
10314			                }
10315
10316		                return reserveHeight;
10317		            }
10318
10319		            function setSlowSliderPreparing(on) {
10320		                let container = document.querySelector(swiperContainer);
10321		                if(!container) return;
10322
10323			                if(on) {
10324			                    let reserveHeight = getSlowSliderReserveHeight(container);
10325			                    if(!container.hasAttribute('data-cl-slow-original-min-height')) {
10326			                        container.setAttribute('data-cl-slow-original-min-height', container.style.minHeight || '');
10327			                    }
10328			                    if(reserveHeight > 0) {
10329			                        container.style.minHeight = reserveHeight + 'px';
10330			                    }
10331			                    container.style.visibility = 'hidden';
10332			                    container.style.overflowAnchor = 'none';
10333			                    container.setAttribute('data-cl-slow-preparing', 'true');
10334			                    return;
10335			                }
10336
10337			                let stableHeight = getSlowSliderContentHeight(container);
10338			                if(stableHeight > 0) {
10339			                    container.style.minHeight = stableHeight + 'px';
10340			                }
10341			                container.style.visibility = '';
10342			                container.style.overflowAnchor = 'none';
10343			                container.removeAttribute('data-cl-slow-preparing');
10344			                container.setAttribute('data-cl-slow-stable-height', 'true');
10345			            }
10346
10347			            function refreshSlowSliderReserveHeight(actualOnly) {
10348			                let container = document.querySelector(swiperContainer);
10349			                if(!container || !container.hasAttribute('data-cl-slow-preparing')) return;
10350
10351				                let reserveHeight = actualOnly ? getSlowSliderContentHeight(container) : getSlowSliderReserveHeight(container);
10352			                if(reserveHeight > 0) {
10353			                    container.style.minHeight = reserveHeight + 'px';
10354			                }
10355			            }
10356
10357		            function waitSlowSliderImages() {
10358		                let images = getSlowSliderImages();
10359		                if(images.length == 0) return Promise.resolve();
10360
10361		                return new Promise(function(resolve) {
10362		                    let done = false;
10363		                    let remain = images.length;
10364		                    let timer = window.setTimeout(finish, 2500);
10365
10366		                    function finish() {
10367		                        if(done) return;
10368		                        done = true;
10369		                        window.clearTimeout(timer);
10370		                        resolve();
10371		                    }
10372
10373		                    function markImageReady(img) {
10374		                        function mark() {
10375		                            remain--;
10376		                            if(remain <= 0) finish();
10377		                        }
10378
10379		                        if(img && img.complete && img.naturalWidth > 0 && typeof img.decode == 'function') {
10380		                            img.decode().then(mark).catch(mark);
10381		                            return;
10382		                        }
10383
10384		                        mark();
10385		                    }
10386
10387		                    images.forEach(function(img) {
10388		                        if(img.complete) {
10389		                            markImageReady(img);
10390		                            return;
10391		                        }
10392
10393		                        img.addEventListener('load', function() {
10394		                            markImageReady(img);
10395		                        }, {once: true});
10396		                        img.addEventListener('error', function() {
10397		                            markImageReady(img);
10398		                        }, {once: true});
10399		                    });
10400		                });
10401		            }
10402
10403			            function prepareSlowSliderSlides() {
10404			                let wrapper = document.querySelector(swiperContainer + ' .swiper-wrapper');
10405			                if(!wrapper) return;
10406
10407			                $swiperEL.find('.cl-slow-slide-clone').remove();
10408			                wrapper.removeAttribute('data-cl-slow-clone-sets');
10409
10410			                let originalSlides = getSlowSliderOriginalSlides();
10411			                if(originalSlides.length <= column) return;
10412
10413		                let wrapperWidth = wrapper.getBoundingClientRect().width || wrapper.scrollWidth;
10414		                let originalWidth = originalSlides.reduce(function(total, slide) {
10415		                    return total + slide.getBoundingClientRect().width;
10416		                }, 0);
10417		                let cloneSets = Math.ceil(wrapperWidth / Math.max(originalWidth, 1)) + 4;
10418		                cloneSets = Math.max(3, Math.min(cloneSets, 8));
10419		                wrapper.setAttribute('data-cl-slow-clone-sets', cloneSets);
10420
10421		                for(let i = 0; i < cloneSets; i++) {
10422		                    originalSlides.forEach(function(slide) {
10423		                        let clone = slide.cloneNode(true);
10424		                        clone.classList.add('cl-slow-slide-clone');
10425		                        clone.classList.remove('swiper-slide-active', 'swiper-slide-next', 'swiper-slide-prev', 'swiper-slide-duplicate-active', 'swiper-slide-duplicate-next', 'swiper-slide-duplicate-prev');
10426		                        clone.setAttribute('aria-hidden', 'true');
10427		                        wrapper.appendChild(clone);
10428		                    });
10429		                }
10430		            }
10431
10432	            function startSlowSliderMotion(swiper) {
10433	                if(!isSlowSlider || !swiper || !swiper.el) return;
10434
10435	                let wrapper = swiper.wrapperEl || swiper.el.querySelector('.swiper-wrapper');
10436	                if(!wrapper) return;
10437
10438	                if(swiper.el._clSlowFrame) {
10439	                    cancelAnimationFrame(swiper.el._clSlowFrame);
10440	                    swiper.el._clSlowFrame = null;
10441	                }
10442
10443		                let originalSlides = getSlowSliderOriginalSlides();
10444	                if(originalSlides.length <= column) return;
10445
10446		                let firstSlide = originalSlides[0];
10447		                let lastSlide = originalSlides[originalSlides.length - 1];
10448		                let firstRect = firstSlide.getBoundingClientRect();
10449		                let lastRect = lastSlide.getBoundingClientRect();
10450		                let loopDistance = (lastRect.left - firstRect.left) + lastRect.width;
10451		                if(!loopDistance) return;
10452
10453		                let cloneSets = parseInt(wrapper.getAttribute('data-cl-slow-clone-sets'), 10) || 1;
10454		                let resetStart = loopDistance;
10455		                let resetEnd = loopDistance * Math.max(2, cloneSets);
10456		                let resetSpan = Math.max(loopDistance, resetEnd - resetStart);
10457		                let avgSlideWidth = loopDistance / originalSlides.length;
10458		                let pixelsPerMs = avgSlideWidth / Math.max(slider_speed, 1);
10459		                let offset = Math.abs(swiper.translate || 0);
10460		                if(offset >= resetEnd) {
10461		                    offset = resetStart + ((offset - resetStart) % resetSpan);
10462		                }
10463		                let lastTime = 0;
10464
10465	                wrapper.style.transitionDuration = '0ms';
10466	                swiper.el._clSlowPaused = false;
10467
10468	                swiper.autoplay = swiper.autoplay || {};
10469	                swiper.autoplay.stop = function() {
10470	                    swiper.el._clSlowPaused = true;
10471	                    return true;
10472	                };
10473	                swiper.autoplay.start = function() {
10474	                    lastTime = 0;
10475	                    swiper.el._clSlowPaused = false;
10476	                    return true;
10477	                };
10478
10479	                function move(time) {
10480	                    if(!swiper || swiper.destroyed || !document.body.contains(swiper.el)) return;
10481	                    if(!lastTime) lastTime = time;
10482
10483	                    let elapsed = time - lastTime;
10484	                    lastTime = time;
10485
10486		                    if(!swiper.el._clSlowPaused) {
10487		                        offset = offset + (elapsed * pixelsPerMs);
10488		                        if(offset >= resetEnd) {
10489		                            offset = resetStart + ((offset - resetStart) % resetSpan);
10490		                        }
10491		                        wrapper.style.transitionDuration = '0ms';
10492		                        wrapper.style.transform = 'translate3d(' + (-offset) + 'px, 0, 0)';
10493		                        swiper.translate = -offset;
10494		                    }
10495
10496	                    swiper.el._clSlowFrame = requestAnimationFrame(move);
10497	                }
10498
10499	                swiper.el._clSlowFrame = requestAnimationFrame(move);
10500	            }
10501
10502		            requestAnimationFrame(function(){
10503		                function initSwiper() {
10504		                    if(document.querySelector(swiperContainer) && !document.querySelector(swiperContainer).swiper) {
10505		                        if(isSlowSlider) {
10506		                            refreshSlowSliderReserveHeight(true);
10507		                            prepareSlowSliderSlides();
10508		                        }
10509		                        let swiper = new Swiper(swiperContainer, {
10510	                        slidesPerView: 'auto',
10511	                        spaceBetween: 0,
10512	                        slidesPerGroup: ($.inArray(slider_motion, ['page', 'stop']) > -1)? column : 1,
10513	                        slidesPerGroupAuto: ($.inArray(slider_motion, ['page', 'stop']) > -1)? true : false,
10514	                        allowTouchMove: (slider_motion == 'slow' || slideCount <= column)? false : true,
10515	                        simulateTouch: (slider_motion == 'slow' || slideCount <= column)? false : true,
10516	                        loop: (isSlowSlider)? false : true,
10517	                        loopFillGroupWithBlank: (isSlowSlider)? false : true,
10518	                        loopAdditionalSlides: loopAdditionalSlides,
10519                        navigation: (useNavigation)? {
10520                            nextEl: '.element[data-id="' + el_seq + '"] .slider-nav-btn.next',
10521                            prevEl: '.element[data-id="' + el_seq + '"] .slider-nav-btn.prev',
10522                        } : '',
10523                        pagination: (usePagination)? {
10524                            el: '.slider-pagination-' + el_seq,
10525                            clickable: true,
10526                            type: paginationType,
10527                            dynamicBullets: [2, 4].includes(parseInt(slider_page_style)),
10528                            renderFraction: function (currentClass, totalClass) {
10529                              const styleIdx = parseInt(slider_page_style);
10530                              if (styleIdx === 12) {
10531                                const arrowSvg = '<svg viewBox="0 0 20 20" width="20" height="20"><path d="M13.76 18a.47.47 0 0 1-.33-.14L5.9 10.33a.483.483 0 0 1 0-.67l7.53-7.53c.18-.18.48-.18.67 0s.18.48 0 .67L6.9 10l7.2 7.2c.18.18.18.48 0 .67-.09.08-.21.13-.34.13z" /></svg>';
10532
10533                                return '<div class="fraction-capsule">' +
10534                                       '  <div class="fraction-numbers">' +
10535                                       '    <span class="' + currentClass + '"></span>' +
10536                                       '    <span class="separator">/</span>' +
10537                                       '    <span class="' + totalClass + '"></span>' +
10538                                       '  </div>' +
10539                                       '  <div class="fraction-nav">' +
10540                                       '    <div class="custom-nav-btn prev">' + arrowSvg + '</div>' + // 기존 클래스와 구분하기 위해 custom-nav-btn 사용
10541                                       '    <div class="nav-divider"></div>' +
10542                                       '    <div class="custom-nav-btn next">' + arrowSvg + '</div>' +
10543                                       '  </div>' +
10544                                       '</div>';
10545                              }
10546
10547                              return '<div class="fraction-capsule">' +
10548                                     '<span class="' + currentClass + '"></span>' +
10549                                     '<span class="separator">/</span>' +
10550                                     '<span class="' + totalClass + '"></span>' +
10551                                     '</div>';
10552                            },
10553                            renderBullet: function (index, className) {
10554                              const styleIdx = parseInt(slider_page_style);
10555                              let displayNum;
10556
10557                              // 1. 미끄러지는 바(indicator)를 사용하는 스타일들 (10, 18 등)
10558                              if ([10].includes(styleIdx)) {
10559                                  // 첫 번째 불렛 생성 시에만 indicator 추가
10560                                  if (index === 0) {
10561                                      setTimeout(() => {
10562                                          const paginationEl = document.querySelector('.slider-pagination-' + el_seq);
10563                                          if (paginationEl && !paginationEl.querySelector('.nav-indicator')) {
10564                                              const indicator = document.createElement('div');
10565                                              indicator.className = 'nav-indicator';
10566                                              paginationEl.appendChild(indicator);
10567                                              
10568                                              // moveIndicator 또는 $.contentsSlider.moveNavIndicator 호출
10569                                              if (typeof $.contentsSlider !== 'undefined') {
10570                                                  $.contentsSlider.moveNavIndicator(this, el_seq);
10571                                              } else if (typeof moveIndicator === 'function') {
10572                                                  moveIndicator(this);
10573                                              }
10574                                          }
10575                                      }, 0);
10576                                  }
10577                              }
10578
10579                              // 2. 숫자를 표시해야 하는 스타일들 (9, 10, 14)
10580                              if ([9, 10, 14].includes(styleIdx)) {
10581                                  if (styleIdx === 14) {
10582                                      displayNum = index + 1;
10583                                  } else {
10584                                      displayNum = (index + 1).toString().padStart(2, '0');
10585                                  }
10586                                  return '<span class="' + className + '">' + displayNum + '</span>';
10587                              } 
10588                              
10589                              // 3. 그 외 기본 불렛 (18번 포함)
10590                              return '<span class="' + className + '"></span>';
10591                            } 
10592                        } : false,
10593		                        autoplay: {
10594		                            enabled: (isSlowSlider)? false : autoplayEnabled,
10595		                            delay: (isSlowSlider)? 1 : slider_delay,
10596		                            disableOnInteraction: false,
10597		                            pauseOnMouseEnter: false,
10598	                        },
10599                        speed: slider_speed,
10600	                        observer: (isSlowSlider)? false : true,
10601	                        observeParents: (isSlowSlider)? false : true,
10602                        preventClicks: true,
10603                        preventClicksPropagation: true,
10604                        slideToClickedSlide: false,
10605                        // observeSlideChildren: true,
10606                        centeredSlides: false,
10607                        initialSlide: 0,
10608	                        freeMode: false,
10609	                        freeModeMomentum: false,
10610	                        on: {
10611                            init: function() {
10612                                const $paginationEl = $('.slider-pagination-' + el_seq);
10613                                if($swiperEL.find('.container').hasClass('full-width')) $paginationEl.addClass('full-width');
10614                                if (this.params.pagination.dynamicBullets) {
10615                                  $paginationEl.css('opacity','0');
10616                                }
10617                                if (this.params.pagination.type === 'bullets' && (parseInt(slider_page_style) !== 18)) {
10618                                    if (!$paginationEl.find('.swiper-pagination-width').length) {
10619                                        $paginationEl.append('<div class="swiper-pagination-width"></div>');
10620                                    }
10621                                    const $widthWrapper = $paginationEl.find('.swiper-pagination-width');
10622                                    
10623                                    $paginationEl.find('> .swiper-pagination-bullet').appendTo($widthWrapper);
10624                                }
10625
10626                                if (parseInt(slider_page_style) === 12) {
10627                                    const sw = this;
10628
10629                                    $paginationEl.off('click', '.custom-nav-btn').on('click', '.custom-nav-btn.prev', function(e) {
10630                                        e.preventDefault();
10631                                        sw.slidePrev();
10632                                    }).on('click', '.custom-nav-btn.next', function(e) {
10633                                        e.preventDefault();
10634                                        sw.slideNext();
10635                                    });
10636                                }
10637
10638                                // 스타일 18일 때 인디케이터 바 생성
10639                                if (parseInt(slider_page_style) === 18) {
10640                                    if ($paginationEl.length && !$paginationEl.find('.nav-indicator').length) {
10641                                      if(parseInt(slider_page_style) === 10) {
10642                                        //$paginationEl.find('.swiper-pagination-width').append('<div class="nav-indicator"></div>');
10643                                      } else {
10644                                        $paginationEl.append('<div class="nav-indicator"></div>');
10645                                      }
10646                                        
10647                                      setTimeout(() => {
10648                                          $.contentsSlider.moveNavIndicator(this, el_seq);
10649                                      }, 50);
10650                                    }
10651                                }
10652
10653		                                if(!isSlowSlider) this.loopFix();
10654		                                if(isSlowSlider) {
10655		                                    this.update();
10656		                                    refreshSlowSliderReserveHeight(true);
10657		                                    startSlowSliderMotion(this);
10658		                                    requestAnimationFrame(function() {
10659		                                        requestAnimationFrame(function() {
10660		                                            setSlowSliderPreparing(false);
10661		                                        });
10662		                                    });
10663		                                }
10664
10665	                                $.contentsSlider.setSliderNavPosition(el_seq);
10666                                // if(slider_motion == 'stop') $.contentsSlider.updateNavigationState(this);
10667                                if(PAGE_MODE == 'c') {
10668                                    let sw = this;
10669                                    setTimeout(function(){
10670                                        if(typeof sw.el != 'undefined' && sw.el) {
10671                                            if(!sw.el.querySelector('.item.modify')) {
10672                                                sw.update();
10673                                            }
10674                                            if (autoplayEnabled == false) {
10675                                                sw.autoplay.stop();
10676                                                sw.params.autoplay.enabled = false;
10677                                            }
10678                                        }
10679                                    }, 100);
10680                                }
10681                                if(windowWidth < 768) {
10682                                    let bulletCount = this.pagination.bullets.length;
10683                                    if (bulletCount > 10) {
10684                                        document.querySelector(".slider-pagination-" + el_seq).style.display = "none";
10685                                    }
10686                                }
10687                            },
10688		                            resize: function() {
10689		                                $.contentsSlider.setSliderNavPosition(el_seq);
10690		                                if(isSlowSlider) {
10691		                                    prepareSlowSliderSlides();
10692		                                    startSlowSliderMotion(this);
10693		                                }
10694
10695		                                if (parseInt(slider_page_style) === 18) {
10696                                    $.contentsSlider.moveNavIndicator(this, el_seq);
10697                                }
10698                            },
10699                            setTranslate: function() {
10700                              if (this.params.pagination.dynamicBullets) {
10701                                  const sw = this;
10702                                  const $paginationEl = $(sw.pagination.el);
10703                                  const $widthWrapper = $paginationEl.find('.swiper-pagination-width');
10704
10705                                  requestAnimationFrame(() => {
10706                                      const dynamicWidth = sw.pagination.el.style.width;
10707                                      if (dynamicWidth) {
10708                                          $widthWrapper.css('width', dynamicWidth);
10709                                          $paginationEl.removeAttr('style');
10710                                      }
10711                                  });
10712                              }
10713                            },
10714                            slideChangeTransitionStart: function () {
10715                                // console.log('slideChangeTransitionStart', this.el.querySelector('.item.modify'), this.previousIndex);
10716                                if (this.el.querySelector('.item.modify')) {
10717                                    this.slideTo(this.previousIndex, 0, false);
10718                                }
10719                                // 스타일 18일 때 바 이동 실행
10720                                if (parseInt(slider_page_style) === 18) {
10721                                    $.contentsSlider.moveNavIndicator(this, el_seq);
10722                                }
10723                            },
10724                        },
10725                    });
10726
10727                    let lsw = document.querySelector('.element[data-id="' + el_seq + '"] .swiper');
10728                    if(lsw && lsw.swiper) {
10729                        switch (eltype) {
10730                            case 'video':
10731                                $('#gframe-' + el_seq).on('opened', function(event, slide){
10732                                    if(slider_motion != 'stop') lsw.swiper.autoplay.stop();
10733                                }).on('closed', function (event){
10734                                    if(slider_motion != 'stop') lsw.swiper.autoplay.start();
10735                                });
10736                                break;
10737                            case 'sns':
10738                                $(lsw).on({
10739                                    mouseenter: function(e){
10740                                        if(lsw.swiper && slider_motion != 'stop' && $('#el-blockConfig.open').length == 0) lsw.swiper.autoplay.stop();
10741                                    },
10742                                    mousemove: function(e){
10743                                        if(lsw.swiper && slider_motion != 'stop' && $('#el-blockConfig.open').length == 0) lsw.swiper.autoplay.stop();
10744                                    },
10745                                    mouseout: function(e){
10746                                        if(lsw.swiper && slider_motion != 'stop' && $('#el-blockConfig.open').length == 0) lsw.swiper.autoplay.start();
10747                                    },
10748                                });
10749                                
10750                                break;
10751                        }
10752                    }
10753		                    } else {
10754		                        console.log('slide not loaded');
10755		                    }
10756		                }
10757
10758		                if(isSlowSlider) {
10759		                    setSlowSliderPreparing(true);
10760		                    waitSlowSliderImages().then(function() {
10761		                        refreshSlowSliderReserveHeight(true);
10762		                        initSwiper();
10763		                    });
10764		                    return;
10765		                }
10766
10767		                initSwiper();
10768		            });
10769        },
10770	        destroy: function(el_seq) {
10771	            let swiperContainer = '.element[data-id="' + el_seq + '"] .swiper';
10772	            // console.log('swiperContainer', swiperContainer, document.querySelector(swiperContainer).swiper);
10773	            if (swiperContainer && document.querySelector(swiperContainer) && document.querySelector(swiperContainer).swiper) {
10774	                let swiperEl = document.querySelector(swiperContainer);
10775		                if(swiperEl._clSlowFrame) {
10776		                    cancelAnimationFrame(swiperEl._clSlowFrame);
10777		                    swiperEl._clSlowFrame = null;
10778		                }
10779		                swiperEl.swiper.destroy(true, true);
10780		                let originalMinHeight = swiperEl.getAttribute('data-cl-slow-original-min-height');
10781		                if(originalMinHeight !== null) {
10782		                    if(originalMinHeight) {
10783		                        swiperEl.style.minHeight = originalMinHeight;
10784		                    } else {
10785		                        swiperEl.style.removeProperty('min-height');
10786		                    }
10787		                    swiperEl.removeAttribute('data-cl-slow-original-min-height');
10788		                }
10789		                swiperEl.style.visibility = '';
10790		                swiperEl.style.overflowAnchor = '';
10791		                swiperEl.removeAttribute('data-cl-slow-preparing');
10792		                swiperEl.removeAttribute('data-cl-slow-stable-height');
10793
10794		                let $swiperEL = $('.element[data-id="' + el_seq + '"]');
10795	                let $item = $swiperEL.find('.item');
10796
10797	                $swiperEL.find('.plus-slide').remove();
10798	                $swiperEL.find('.cl-slow-slide-clone').remove();
10799	                $swiperEL.find('.slider-pagination-' + el_seq).remove();
10800                $swiperEL.find('.slider-nav-btn').remove();
10801                $swiperEL.removeClass('slider-active');
10802                $swiperEL.removeClass('slider-modify');
10803                $swiperEL.removeClass('slider-centered');
10804
10805                $item.removeClass('swiper-slide-duplicate swiper-slide-duplicate-prev swiper-slide-duplicate-next swiper-slide-duplicate-active modify');
10806                $item.removeClass('swiper-slide').removeAttr('role').removeAttr('aria-label');
10807                $item.parent().removeClass('swiper-wrapper').removeAttr('id').removeAttr('aria-live');
10808                $item.parent().parent().removeClass('swiper swiper-backface-hidden');
10809            }
10810        },
10811        update: function(el_seq, elsettings, mode) {
10812            if(typeof mode == 'undefined' || !mode) mode = 'r';
10813            if(PAGE_MODE == 'c' && localStorage.hasOwnProperty('slider_elsettings')) {
10814                // console.log('mode', mode);
10815                // console.log('update setting', JSON.stringify(elsettings));
10816                localStorage.setItem('slider_elsettings', JSON.stringify(elsettings));
10817            }
10818            $.contentsSlider.destroy(el_seq);
10819            requestAnimationFrame(function() {
10820                $.contentsSlider.ready(el_seq).then(() => {
10821                    $.contentsSlider.init(el_seq, elsettings, mode);
10822                });
10823            });
10824        },
10825        setSliderNavPosition: function(el_seq) {
10826            let $swiperEL = $('.element[data-id="' + el_seq + '"]');
10827            let $firstSlide = $('.element[data-id="' + el_seq + '"] .swiper-slide.item').first();
10828
10829            if(typeof $swiperEL.offset() != 'undefined' && typeof $firstSlide.offset() != 'undefined') {
10830                let sideMargin = $swiperEL.find('.swiper').outerWidth() / 2 + 15;
10831                let offsetTop = $firstSlide.offset().top - $swiperEL.offset().top;
10832                let slideHeight = $firstSlide.height();
10833                let topPos = offsetTop + (slideHeight / 2);
10834                // console.log('offsetTop', offsetTop);
10835                $swiperEL.find('.slider-nav-btn').css('top', `${topPos}px`);
10836
10837                if($swiperEL.find('.full-width').length == 0 && $(window).width() > 767) {
10838                    if($swiperEL.find('.lyoption[data-lypd]').length > 0) {
10839                        let lypd = Number($swiperEL.find('.lyoption').attr('data-lypd'));
10840                        sideMargin -= lypd;
10841                    }
10842                    if($swiperEL.attr('data-type') == 'contents' && $swiperEL.find('[data-matrix-loop="true"]').length > 0) {
10843                        let itemPadLeft = Math.round(parseFloat($firstSlide.css('padding-left').replace(/[^0-9]/g, ''))) || 0;
10844                        sideMargin -= itemPadLeft;
10845                    }
10846
10847                    $('.element[data-id="' + el_seq + '"] .slider-nav-btn.next').css({
10848                        right: `calc(50% - ${sideMargin}px - var(--slider-nav-size))`,
10849                    });
10850
10851                    $('.element[data-id="' + el_seq + '"] .slider-nav-btn.prev').css({
10852                        left: `calc(50% - ${sideMargin}px - var(--slider-nav-size))`,
10853                    });
10854                } else {
10855                    $('.element[data-id="' + el_seq + '"] .slider-nav-btn.next').css('right', '');
10856                    $('.element[data-id="' + el_seq + '"] .slider-nav-btn.prev').css('left', '');
10857                }
10858            }
10859
10860            if($('#el-blockConfig.open').length > 0) {
10861                let selector = $('#select-navigation-style').attr('data-selector');
10862                let bcCSS = getStyleText();
10863                let prevVal = style.getCssProperty(bcCSS, selector, '--slider-nav-color');
10864                if(prevVal == 'initial') {
10865                    let color = $('.bc-slider-nav-ctrl input[data-root="--slider-nav-color"]').val();
10866                    if(typeof color != 'undefined' && color) {
10867                        $( selector + ' .slider-nav-btn svg').css('fill', color);
10868                    }
10869                } else {
10870                    $( selector + ' .slider-nav-btn svg').removeAttr('style');
10871                }
10872            }
10873
10874            $('.element[data-id="' + el_seq + '"] .slider-nav-btn').removeClass('invisible');
10875        },
10876        updateNavigationState: function(swiper) {
10877            let prevButton = swiper.navigation.prevEl;
10878            let nextButton = swiper.navigation.nextEl;
10879            let pagination = $(swiper.pagination.bullets);
10880            
10881            setTimeout(function(){
10882                if(prevButton && nextButton) {
10883                    if(pagination.length <= 1) {
10884                        prevButton.classList.add('swiper-button-disabled', 'swiper-button-hidden');
10885                        nextButton.classList.add('swiper-button-disabled', 'swiper-button-hidden');
10886                        swiper.pagination.el.classList.add('swiper-button-disabled', 'swiper-pagination-hidden');
10887                    } else {
10888                        if (swiper.realIndex === 0) {
10889                            swiper.allowSlidePrev = false;
10890                            prevButton.classList.add('swiper-button-disabled');
10891                            prevButton.setAttribute('aria-disabled', true);
10892                        } else {
10893                            swiper.allowSlidePrev = true;
10894                            prevButton.classList.remove('swiper-button-disabled');
10895                            prevButton.removeAttribute('aria-disabled');
10896                        }
10897
10898                        if (pagination.last().hasClass('swiper-pagination-bullet-active')) {
10899                            swiper.allowSlideNext = false;
10900                            nextButton.classList.add('swiper-button-disabled');
10901                            nextButton.setAttribute('aria-disabled', true);
10902                        } else {
10903                            swiper.allowSlideNext = true;
10904                            nextButton.classList.remove('swiper-button-disabled');
10905                            nextButton.removeAttribute('aria-disabled');
10906                        }
10907                    }
10908                }
10909                swiper.navigation.update();
10910                swiper.pagination.update();
10911            });
10912        },
10913        moveNavIndicator : function(swiper, el_seq) {
10914          const $paginationEl = $('.slider-pagination-' + el_seq);
10915          const $activeBullet = $paginationEl.find('.swiper-pagination-bullet-active');
10916          const $indicator = $paginationEl.find('.nav-indicator');
10917
10918          if ($activeBullet.length && $indicator.length) {
10919              // jQuery의 position()을 사용하면 부모 내부에서의 상대 위치를 쉽게 잡습니다.
10920              const pos = $activeBullet.position();
10921              
10922              $indicator.css({
10923                  'width': $activeBullet.outerWidth() + 'px',
10924                  'height': '2px',
10925                  'transform': `translateX(${pos.left}px)`
10926              });
10927          }
10928      }
10929    }
10930
10931    function contentsSliderNav(size, n) {
10932        let navObj = { //52
10933            1:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m15.06 2-1.41 1.41L36.23 26 13.65 48.59 15.06 50l24-24-24-24z"/></svg>',
10934            2:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M26 2C12.75 2 2 12.75 2 26s10.75 24 24 24 24-10.75 24-24S39.25 2 26 2Zm-3.36 36-.85-.85L32.94 26 21.79 14.85l.85-.85 12 12-12 12Z"/></svg>',
10935            3:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M2 2v48h48V2H2Zm20.64 36-.85-.85L32.94 26 21.79 14.85l.85-.85 12 12-12 12Z"/></svg>',
10936            4:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M50 26 35.86 11.86l-1.42 1.41L46.17 25H2v2h44.17L34.45 38.73l1.41 1.41 12.72-12.73h.01L50 26z"/></svg>',
10937            5:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M26 3c12.68 0 23 10.32 23 23S38.68 49 26 49 3 38.68 3 26 13.32 3 26 3m0-1C12.75 2 2 12.75 2 26s10.75 24 24 24 24-10.75 24-24S39.25 2 26 2Z"/><path d="m22.64 38-.85-.85L32.94 26 21.79 14.85l.85-.85 12 12-12 12z"/></svg>',
10938            6:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M49 3v46H3V3h46m1-1H2v48h48V2Z"/><path d="m22.64 38-.85-.85L32.94 26 21.79 14.85l.85-.85 12 12-12 12z"/></svg>',
10939            7:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M50.04 25.85s0-.06-.01-.09c0-.02-.02-.03-.03-.05-.02-.05-.05-.09-.08-.13-.03-.04-.05-.08-.09-.11a.444.444 0 0 0-.11-.08c-.04-.03-.08-.06-.13-.08-.02 0-.03-.02-.05-.03C38.78 21.69 37.77 13 37.73 12.63a.75.75 0 0 0-.82-.67.75.75 0 0 0-.67.82c.04.36.89 8.04 9.37 12.47H2.69c-.41 0-.75.34-.75.75s.34.75.75.75h42.94c-8.48 4.43-9.34 12.1-9.37 12.47-.04.41.26.78.67.82h.08c.38 0 .71-.29.75-.67.04-.37 1.04-9.06 11.81-12.65 0 0 .01 0 .02-.01a.72.72 0 0 0 .21-.12l.06-.06c.04-.04.08-.09.11-.14.02-.03.03-.06.04-.09 0-.02.02-.03.03-.06 0-.03 0-.06.01-.09.01-.05.02-.1.02-.15 0-.05 0-.1-.02-.15Z"/></svg>',
10940            8:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m3.07 27.82-1 .08c.04.47.09.93.15 1.39v.02c.02.15.04.3.07.45l.99-.16c-.1-.63-.18-1.27-.23-1.9ZM3.12 23.6l-.99-.1c-.07.66-.11 1.32-.12 2l1 .02c.01-.64.05-1.28.12-1.91ZM3.94 19.47l-.96-.28c-.08.28-.16.56-.23.85 0 .01 0 .03-.01.04V20.71l.98.2c.13-.62.28-1.25.47-1.86ZM6.59 40.12c.39.54.81 1.06 1.24 1.57l.76-.65c-.42-.48-.82-.99-1.19-1.5l-.81.59ZM9.94 8.17c-.06.05-.11.1-.17.15l-.01.01-.02.02v.04l-.02.02-.01.01c-.24.23-.47.47-.69.71l.73.68c.44-.46.9-.92 1.37-1.34l-.67-.74ZM3.78 31.97l-.97.26s.02.09.04.14 0 .01 0 .02V32.7c0 .01 0 .03.01.04s0 .01 0 .02v.03c.13.42.26.84.41 1.25l.94-.34c-.22-.6-.41-1.21-.57-1.83ZM7.75 12l-.79-.61c-.29.37-.56.75-.82 1.14s0 0 0 .01-.02.03-.03.04 0 0 0 .01-.01.02-.02.03V12.76c0 .01-.02.02-.02.04 0 .01-.01.02-.02.03l.84.54c.34-.53.72-1.06 1.1-1.57ZM4.34 36.35c.29.6.6 1.19.94 1.77l.86-.51c-.32-.55-.62-1.12-.9-1.69l-.9.43ZM17.75 4.52l-.36-.93c-.4.15-.79.32-1.18.49s0 0-.01 0-.02 0-.03.01h-.09c-.14.06-.28.13-.41.2l.44.9c.57-.28 1.16-.53 1.76-.76ZM35.73 4.05c-.61-.27-1.23-.51-1.86-.73l-.33.94c.6.21 1.2.44 1.78.7l.41-.9
109401ZM48.36 20.6l.97-.23c-.13-.53-.27-1.05-.43-1.57s0 0 0-.01V18.64c0-.01 0-.03-.01-.04 0-.01 0-.02-.01-.04l-.95.31c.2.6.38 1.22.53 1.84ZM39.56 6.2c-.17-.12-.34-.23-.51-.34s-.02-.02-.04-.02H39s-.01 0-.02-.01h-.02s-.01 0-.02-.01h-.07s-.01 0-.02-.01h-.04s-.02-.02-.04-.02l-.3-.18-.5.87c.55.31 1.1.66 1.62 1.02l.57-.82ZM9.49 43.42c.36.34.74.68 1.12 1s.02.01.02.02 0 0 .01 0 0 0 .01.01h.03c.07.06.15.12.22.18l.63-.78c-.5-.4-.98-.82-1.44-1.26l-.69.73ZM48.97 24.76l1-.05v-.03c-.04-.62-.1-1.24-.18-1.85l-.99.14c.09.63.15 1.27.18 1.91ZM31.56 2.65c-.33-.08-.66-.15-.99-.21h-.22c-.2-.04-.41-.07-.61-.1l-.15.99c.63.09 1.26.22 1.88.36l.23-.97ZM21.8 3.38l-.18-.98c-.16.03-.33.06-.49.1s0 0-.01 0H20.93c-.02 0-.03 0-.04.01-.28.06-.57.13-.85.21s-.03 0-.04.01H19.94l.26.96c.61-.17 1.24-.31 1.87-.43ZM26 3c.39 0 .78 0 1.16.03l.05-1c-.15 0-.29-.01-.44-.02H25.99c-.41.01-.82.04-1.22.07l.08 1c.63-.05 1.28-.08 1.92-.08ZM5.5 15.56l-.89-.45c-.26.51-.5 1.02-.72 1.55v.02c0 .01-.01.03-.02.04 0 .01-.01.03-.02.04v.07l.93.38c.24-.59.51-1.17.8-1.74ZM42.94 9c-.13-.13-.26-.25-.38-.38l-.01-.01-.02-.02-.01-.01-.01-.01-.02-.02-.01-.01-.01-.01-.02-.02-.01-.01-.03-.03-.01-.01-.02-.02-.01-.01-.01-.01-.02-.02-.01-.01-.01-.01-.03-.03c-.25-.24-.51-.46-.78-.69l-.64.76c.49.41.96.85 1.41 1.3l.71-.71ZM45.76 12.38v-.03s0-.01-.01-.02v-.02l-.02-.02-.01-.01c-.01-.02-.02-.03-.04-.05a25.6 25.6 0 0 0-1.01-1.32l-.77.63c.4.49.79 1.01 1.15 1.53l.82-.57ZM43.89 40.45l.78.63V40.8s0-.01.01-.02v-.02l.02-.02v-.01c0-.01.02-.02.03-.03v-.01c0-.01.02-.02.03-.04.01-.02.02-.03.04-.05.01-.02.02-.03.04-.05.06-.08.12-.16.17-.24s.02-.02.03-.04c0-.01.02-.02.03-.04v-.02s0-.01.01-.02V40.09s.01-.02.02-.03 0 0 0-.01v-.01l-.83-.56c-.36.53-.74 1.04-1.14 1.54ZM40.96 43.47l.65.76c.51-.43.99-.89 1.46-1.36l-.71-.7c-.45.45-.92.89-1.4 1.31ZM13.46 5.54c-.45.28-.9.57-1.33.88h-.04s-.02.01-.02.02c-.05.04-.1.07-.15.11l.59.81c.51-.38 1.05-.74 1.59-1.07l-.52-.85ZM48.98 27.06c-.03.64-.08 1.28-.17 1.91l.99.13c.02-.12.03-.25.04-.37s0-.01 0-.02v-.05c.05-.49.09-.99.11-1.49l-1-.05ZM46.23 36.95l.88.48c.1-.19.21-.39.3-.58s.02-.04.03-.06.01-.03.02-.04v-.01s0-.02.01-.03 0 0 0-.01v-.01s0-.02.01-.03V36.43s0-.02.01-.02v-.04s0-.02.01-.02v-.05s0-.02.01-.02v-.01c0-.01.01-.03.02-.04v-.02c.03-.06.05-.12.08-.18l-.92-.4c-.26.58-.54 1.16-.84 1.72ZM47.89 33.08l.95.31c.2-.63.38-1.27.53-1.93l-.97-.23c-.14.62-.32 1.24-.51 1.85ZM47.92 16.2c-.22-.49-.45-.96-.7-1.43s0 0 0-.01v-.05c-.04-.08-.08-.15-.12-.22l-.88.48c.31.56.6 1.13.86 1.71l.91-.41ZM16.83 48.19c.28.12.56.23.85.33H17.81s.02 0 .03.01c.22.08.43.15.65.22s0 0 .01 0h.07l.3-.95c-.61-.19-1.21-.41-1.8-.66l-.38.92ZM21.03 49.48c.19.04.38.08.57.11h.02c.41.07.83.14 1.25.19l.12-.99c-.63-.08-1.27-.19-1.89-.32l-.21.98ZM12.94 46.14s.03.02.05.03H13s.01 0 .02.01h.08s.02.01.03.02 0 0 .01 0c.37.23.75.45 1.13.67s.02.01.03.02 0 0 .01 0h.01s.02.01.03.01H14.49l.47-.88c-.56-.3-1.11-.63-1.65-.98l-.54.84ZM37.52 45.91l.5.87c.06-.04.12-.07.18-.11h.01c.01 0 .03-.01.04-.02H38.46s.02-.01.03-.02 0 0 .01 0h.01s.02-.01.03-.02h.01c.01 0 .03-.02.04-.02h.01s.02-.01.03-.02 0 0 .01 0c.28-.18.56-.36.83-.55l-.57-.82c-.52.36-1.07.71-1.62 1.03ZM26 49h-.58l-.02 1H26.1c.26 0 .51-.01.77-.02s.03 0 .05 0h.13l-.06-1c-.44.03-.89.04-1.34.04ZM33.7 47.68l.33.94H34.09c.01 0 .03 0 .04-.01h.06c.01 0 .03-.01.04-.02s.03-.01.04-.02c.03-.01.07-.03.1-.04.01 0 .03-.01.04-.02h.02c.01 0 .03-.01.04-.02H34.68c.01 0 .03-.01.04-.02.28-.11.56-.23.83-.36l-.41-.91c-.58.26-1.18.5-1.78.72ZM29.62 48.72l.16.99c.66-.1 1.32-.24 1.96-.39l-.24-.97c-.62.15-1.25.28-1.88.38ZM29.36 17.36l-.7.71 7.43 7.43H14v1h22.09l-7.43 7.43.7.71L38 26l-8.64-8.64z"/></svg>',
10941            9:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m21.74 2-.91.43L32.16 26 20.83 49.57l.91.43 11.53-24L21.74 2z"/></svg>',
10942            10: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m49.68 25.22-.15-.15-13.86-13.86c-.43-.43-1.12-.43-1.55 0l-.15.15c-.43.43-.43 1.12 0 1.55l11.89 11.88H3.2c-.66 0-1.2.54-1.2 1.2s.54 1.2 1.2 1.2h42.66L33.98 39.07c-.43.43-.43 1.12 0 1.55l.15.15c.43.43 1.12.43 1.55 0l13.86-13.86.15-.15c.21-.21.32-.49.32-.77s-.11-.56-.32-.77Z"/></svg>',
10943            11: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m39.31 24.94-22.5-22.5c-.59-.59-1.54-.59-2.12 0s-.59 1.54 0 2.12L36.13 26 14.69 47.44a1.49 1.49 0 0 0 0 2.12c.29.29.68.44 1.06.44s.77-.15 1.06-.44l22.5-22.5c.59-.59.59-1.54 0-2.12Z"/></svg>', 
10944            12: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M39.76 23.42 19.41 3.07c-1.38-1.38-3.79-1.38-5.17 0-.69.69-1.07 1.61-1.07 2.58s.38 1.9 1.07 2.58L32 25.99 14.24 43.75c-.69.69-1.07 1.61-1.07 2.58a3.655 3.655 0 0 0 3.66 3.66c.98 0 1.89-.38 2.58-1.
1094407l20.34-20.34c.69-.69 1.07-1.61 1.07-2.58s-.38-1.9-1.07-2.58Zm-1.06 4.1L18.36 47.86c-.82.82-2.23.82-3.05 0-.41-.41-.63-.95-.63-1.52s.22-1.12.63-1.52L33.6 26.53c.29-.29.29-.77 0-1.06L15.3 7.18c-.41-.41-.63-.95-.63-1.52s.22-1.12.63-1.52c.42-.42.97-.63 1.52-.63s1.1.21 1.53.63l20.34 20.34c.41.41.63.95.63 1.52s-.22 1.12-.63 1.52Z"/></svg>', 
10945            13: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m50 26-.01-.01-3.9-3.99L32.38 8H22l13.71 14H2v8h33.7L22 44h10.38l12.43-12.7 1.27-1.3L50 26z"/></svg>', 
10946            14: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m46.07 26-.01-.01L22.07 2H7.93l24 24-24 24h14.14L39 33.07 46.07 26z"/></svg>', 
10947            15: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m32.19 26-.01-.01L13.19 7H2l19 19L2 45h11.19L26.6 31.6l5.59-5.6z"/><path d="M49.99 25.99 31 7H19.81l19 19-19 19H31l13.4-13.4L50 26l-.01-.01z"/></svg>', 
10948            16: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M50 26c0-.07-.01-.13-.04-.19-.01-.03-.03-.05-.05-.07-.02-.03-.03-.06-.06-.09L27.23 3.02c-.2-.2-.51-.2-.71 0s-.2.51 0 .71L48.29 25.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h45.79L26.52 48.27c-.2.2-.2.51 0 .71a.485.485 0 0 0 .7 0l22.62-22.62s.09-.1.11-.17c.02-.04.02-.08.02-.12 0-.03.02-.05.02-.08Z"/></svg>', 
10949            17: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m36.74 17.71-.71.71 11.56 11.55H2v1h48L36.74 17.71z"/></svg>', 
10950            18: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M40.48 23.37 18.36 2.95c-2.29-2.11-6-.49-6 2.63v40.84c0 3.11 3.71 4.74 6 2.63l22.12-20.42a3.576 3.576 0 0 0 0-5.25Z"/>', 
10951            19: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M14 2v48l26-24L14 2z"/></svg>', 
10952            20: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M26 2C12.75 2 2 12.75 2 26s10.75 24 24 24 24-10.75 24-24S39.25 2 26 2Zm-4.5 36V14l13 12-13 12Z"/></svg>', 
10953            21: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M2 2v48h48V2H2Zm19.5 36V14l13 12-13 12Z"/></svg>', 
10954            22: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M50 26 32 9v16H2v2h30v16l18-17z"/></svg>', 
10955            23: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M26 3c12.68 0 23 10.32 23 23S38.68 49 26 49 3 38.68 3 26 13.32 3 26 3m0-1C12.75 2 2 12.75 2 26s10.75 24 24 24 24-10.75 24-24S39.25 2 26 2Z"/><path d="m34.5 26-13-12v24l13-12z"/></svg>', 
10956            24: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M49 3v46H3V3h46m1-1H2v48h48V2Z"/><path d="m34.5 26-13-12v24l13-12z"/></svg>', 
10957            25: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M47.18 23.33 42.59 19 32 9v10H2v14h30v10l10.59-10 4.59-4.33L50 26l-2.82-2.67z"/></svg>', 
10958            26: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="m34.5 26-13-12v24l13-12zM26 2H25.67c-.41.01-.82.04-1.22.07l.08 1c.63-.05 1.28-.08 1.92-.08v-1Zm-4.38.4c-.16.03-.33.06-.49.1s0 0-.01 0H20.89c-.28.06-.57.13-.85.21s-.03 0-.04.01H19.94l.26.96c.61-.17 1.24-.31 1.87-.43l-.18-.98Zm-4.23 1.19c-.4.15-.79.32-1.18.49s0 0-.01 0-.02 0-.03.01h-.09c-.14.06-.28.13-.41.2l.44.9c.57-.28 1.16-.53 1.76-.76l-.36-.93Zm-3.93 1.95c-.45.28-.9.57-1.33.88h-.04s-.02.01-.02.02c-.05.04-.1.07-.15.11l.59.81c.51-.38 1.05-.74 1.59-1.07l-.52-.85ZM9.94 8.17c-.06.05-.11.1-.17.15l-.01.01-.02.02-.02.02-.01.01c-.24.23-.47.47-.69.71l.73.68c.44-.46.9-.91 1.37-1.34l-.67-.74Zm-2.99 3.22c-.29.37-.56.75-.82 1.14s0 0 0 .01-.02.03-.03.04 0 0 0 .01-.01.02-.02.03V12.74c0 .01-.02.02-.02.04 0 .01-.01.02-.02.03l.84.54c.34-.53.72-1.06 1.1-1.57l-.79-.61Zm-2.34 3.72c-.26.51-.5 1.02-.72 1.55v.02c0 .01-.01.03-.02.04 0 .01-.01.03-.02.04v.08l.93.38c.24
10958-.59.51-1.17.8-1.74l-.89-.45Zm-1.63 4.08c-.08.28-.16.56-.23.85 0 .01 0 .03-.01.04V20.69l.98.2c.13-.62.28-1.25.47-1.86l-.96-.28Zm-.85 4.31c-.07.66-.11 1.32-.12 2l1 .02c.01-.64.05-1.28.12-1.91l-.99-.1Zm.94 4.32-1 .08c.03.44.08.88.14 1.31v.03c.03.18.05.36.08.54l.99-.16c-.1-.63-.18-1.27-.23-1.9Zm.71 4.15-.97.26c.04.13.07.26.11.39s0 .02 0 .03V33.07c0 .01 0 .03.01.04v.07l.18.51.94-.34c-.22-.6-.41-1.21-.57-1.83Zm1.46 3.95-.9.43c.18.37.36.73.56 1.09.12.23.25.45.38.67l.86-.51c-.32-.55-.62-1.12-.9-1.69Zm2.16 3.61-.81.59v.02s.01.02.02.02 0 0 0 .01.02.03.03.04c.2.27.4.53.61.79v.09l.02.02.01.01c.08.09.15.18.23.27l.76-.65c-.42-.48-.82-.99-1.19-1.5Zm2.78 3.16-.69.73s.08.08.12.11l.01.01.01.01.01.01c.37.35.76.68 1.16 1s0 0 .01 0h.02c.01.01.03.02.04.03l.63-.78c-.5-.4-.98-.82-1.44-1.26Zm3.31 2.61-.54.84c.05.03.1.07.16.1h.01s.02.01.03.02 0 0 .01 0h.01s.02.01.03.02 0 0 .01 0H13.51s.02 0 .03.01h.02s.02.01.03.02h.01l.27.15.47-.88c-.56-.3-1.11-.63-1.65-.98Zm3.72 1.96-.38.92c.21.09.43.17.64.25h.13c.33.12.66.23.99.34l.3-.95c-.61-.19-1.21-.41-1.8-.66Zm4.02 1.25-.21.98c.24.05.47.1.71.14h.08c.35.06.71.11 1.07.16l.12-.99c-.63-.08-1.27-.19-1.89-.32Zm6.11.45c-.44.03-.89.04-1.34.04h-.58l-.02 1H25.97c.26 0 .51-.01.77-.02h.17l-.06-1Zm4.16-.62c-.62.15-1.25.28-1.88.38l.16.99c.66-.1 1.32-.24 1.96-.39l-.24-.97Zm3.98-1.38c-.58.26-1.18.5-1.78.72l.33.94s.02 0 .03-.01.03-.01.04-.02 0 0 .01 0H34.45s.02 0 .03-.01 0 0 .01 0 .03-.01.04-.02c.4-.16.79-.32 1.18-.5l-.41-.91Zm3.66-2.08c-.52.36-1.07.71-1.62 1.03l.5.87c.14-.08.28-.16.42-.25s0 0 .01 0H38.56s.01 0 .02-.01h.02s.01 0 .02-.01h.01c.01 0 .02-.02.04-.02h.01s.01 0 .02-.01h.02c.01 0 .03-.02.04-.02.01 0 .02-.02.04-.02h.01l.09-.06c.19-.12.38-.25.56-.38l-.57-.82Zm3.22-2.71c-.45.45-.92.89-1.4 1.31l.65.76c.12-.1.24-.2.35-.31l.01-.01s.02-.01.02-.02 0 0 .01-.01l.01-.01.02-.02H42.09l.01-.01.01-.01h.01l.02-.02.01-.01.01-.01.02-.02.01-.01.01-.01.02-.02.01-.01.01-.01.02-.02.01-.01.01-.01.02-.02.01-.01.02-.02.02-.02h.01l.15-.15-.71-.7Zm2.67-3.26c-.36.53-.74 1.04-1.14 1.54l.78.63c.42-.52.82-1.05 1.19-1.61l-.83-.56Zm2.04-3.68c-.26.58-.54 1.16-.84 1.72l.88.48s0-.01.01-.02c.05-.1.1-.19.15-.29l.03-.06c.02-.03.03-.06.05-.1 0-.01.01-.03.02-.04v-.01c0-.01.01-.03.02-.04v-.02s0-.02.01-.02v-.01c0-.01.01-.03.02-.04v-.01s0-.02.01-.02v-.04s0-.02.01-.02v-.02s0-.02.01-.02v-.01s0-.01.01-.02v-.02s0-.01.01-.02v-.01s0-.02.01-.02v-.04s0-.02.01-.02v-.02s0-.02.01-.02v-.01s0-.02.01-.02v-.02c0-.01.01-.03.02-.04.08-.18.16-.35.24-.53l-.92-.4Zm1.33-3.99c-.14.62-.32 1.24-.51 1.85l.95.31c.1-.31.19-.62.28-.94s0-.01 0-.02V31.99l.03-.11-.97-.23Zm.58-4.18c-.03.64-.08 1.28-.17 1.91l.99.13c.02-.14.03-.27.05-.41v-.08c.05-.48.09-.97.11-1.46l-1-.05Zm.8-4.34-.99.14c.09.63.15 1.27.18 1.91l1-.05c-.02-.47-.06-.93-.11-1.39s0-.01 0-.02l-.06-.5Zm-.99-4.28-.95.31c.2.6.38 1.22.53 1.84l.97-.23c-.16-.65-.34-1.29-.55-1.92Zm-1.77-4.03-.88.48c.31.56.6 1.13.86 1.71l.91-.41c-.27-.61-.57-1.21-.89-1.79Zm-2.46-3.63-.77.63c.4.49.79 1.01 1.15 1.53l.82-.57c-.14-.2-.28-.39-.42-.59 0 0-.01-.02-.02-.02s0 0 0-.01v-.01s-.01-.02-.02-.02 0 0 0-.01v-.01s-.01-.02-.02-.02V11.4s-.01-.02-.02-.02v-.02s-.01-.02-.02-.02v-.01c0-.01-.02-.02-.03-.04s-.03-.03-.04-.05c-.1-.12-.19-.24-.29-.36Zm-3.09-3.13-.64.76c.49.41.96.85 1.41 1.3l.71-.71c-.47-.47-.96-.92-1.47-1.35Zm-3.6-2.51-.5.87c.55.31 1.1.66 1.62 1.02l.57-.82c-.17-.12-.34-.23-.51-.34-.01 0-.02-.02-.04-.02H39s-.01 0-.02-.01h-.02s-.01 0-.02-.01h-.07s-.01 0-.02-.01h-.04c-.01 0-.02-.01-.04-.02l-.3-.18Zm-4-1.82-.33.94c.6.21 1.2.44 1.78.7l.41-.91h-.02s-.02 0-.03-.01 0 0-.01 0H35.19s-.02 0-.03-.01 0 0-.01 0c-.17-.06-.33-.12-.5-.18ZM29.6 2.27l-.15.99c.63.09 1.26.22 1.88.36l.23-.97s-.07-.02-.1-.02-.03 0-.04-.01H30.9l-.72-.12ZM26 2v1c.39 0 .78 0 1.16.03l.05-1c-.15 0-.29-.01-.44-.02H26.45Z"/></svg>',
10959            27: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="52" height="52"><path d="M10.06 2 8.65 3.41 31.23 26 8.65 48.59 10.06 50l24-24-24-24z"/><path d="m22.06 2-1.41 1.41L43.23 26 20.65 48.59 22.06 50l24-24-24-24z"/></svg>', 
10960        };
10961
10962        switch(size) {
10963            case 28:
10964                navObj = {
10965                    1:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M9.06 2 7.65 3.41 18.23 14 7.65 24.59 9.06 26l12-12-12-12z"/></svg>',
10966                    2:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M14 2C7.37 2 2 7.37 2 14s5.37 12 12 12 12-5.37 12-12S20.63 2 14 2Zm-1.36 18-.85-.85L16.94 14l-5.15-5.15.85-.85 6 6-6 6Z"/></svg>',
10967                    3:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M2 2v24h24V2H2Zm10.64 18-.85-.85L16.94 14l-5.15-5.15.85-.85 6 6-6 6Z"/></svg>',
10968                    4:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m26 14-7.07-7.07-1.42 1.41L22.17 13H2v2h20.17l-4.65 4.66 1.41 1.41 5.65-5.66h.01L26 14z"/></svg>',
10969                    5:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M14 3c6.07 0 11 4.93 11 11s-4.93 11-11 11S3 20.07 3 14 7.93 3 14 3m0-1C7.37 2 2 7.37 2 14s5.37 12 12 12 12-5.37 12-12S20.63 2 14 2Z"/><path d="m12.64 20-.85-.85L16.94 14l-5.15-5.15.85-.85 6 6-6 6z"/></svg>',
10970                    6:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M24.8 3.2v21.6H3.2V3.2h21.6M26 2H2v24h24V2Z"/><path d="m12.64 20-.85-.85L16.94 14l-5.15-5.15.85-.85 6 6-6 6z"/></svg>',
10971                    7:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M25.99 14c0-.05 0-.1-.02-.15 0-.03 0-.06-.01-.09 0-.02-.02-.03-.03-.05-.02-.05-.05-.09-.08-.13-.03-.04-.05-.08-.08-.11a.444.444 0 0 0-.11-.08c-.04-.03-.08-.06-.13-.08-.02 0-.03-.02-.05-.03-5.12-1.71-5.63-5.82-5.65-6.01a.745.745 0 0 0-.82-.67.75.75 0 0 0-.67.82c.02.17.39 3.48 3.72 5.82H2.75c-.41 0-.75.34-.75.75s.34.75.75.75h19.32c-3.33 2.34-3.71 5.65-3.72 5.82-.04.41.26.78.67.82h.08c.38 0 .7-.29.75-.67.02-.17.52-4.3 5.65-6.01 0 0 .01 0 .02-.01a.72.72 0 0 0 .21-.12l.06-.06c.04-.04.08-.09.11-.14.02-.03.03-.06.05-.09 0-.02.02-.03.03-.05 0-.03 0-.06.01-.09.01-.05.02-.1.02-.15Z"/></svg>',
10972                    8:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M3 14c0-.38.02-.77.06-1.15l-.99-.1c0 .07-.01.15-.02.22s0 .02 0 .03c0 .11-.01.22-.02.33s0 .02 0 .02v.15c0 .08 0 .16.01.24l1-.06c-.01-.23-.02-.46-.02-.69ZM4.3 21.06c.39.54.83 1.05 1.31 1.51l.7-.71c-.44-.43-.84-.89-1.2-1.39l-.81.59ZM2.41 17.11c.17.65.4 1.28.68 1.88l.91-.42c-.25-.55-.46-1.13-.62-1.72l-.97.26ZM3.02 9.16s-.01.03-.02.04c0 .01 0 .02-.01.03s0 .01 0 .02v.05c-.12.29-.22.59-.32.89l.95.3c.18-.58.42-1.15.69-1.69l-.89-.45c-.1.2-.2.4-.29.61ZM10.06 3.73 9.7 2.8c-.14.05-.27.11-.41.16s-.01 0-.02 0h-.05c-.01 0-.02 0-.03.01-.01 0-.02.01-.03.02-.35.16-.69.34-1.
1097202.54l.51.86c.53-.31 1.08-.58 1.65-.8ZM24.98 13.41l1-.05c-.02-.35-.05-.71-.1-1.05s0-.02 0-.03v-.14c-.03-.18-.07-.35-.1-.52l-.98.22c.13.59.22 1.2.25 1.81ZM14 3c.19 0 .37 0 .56.01l.05-1c-.15 0-.3-.01-.45-.01H13.66c-.15.02-.31.04-.46.07l.16.99c.6-.1 1.21-.15 1.83-.15ZM24.96 9.1a13 13 0 0 0-.37-.75s-.01-.03-.02-.04-.01-.02-.02-.03 0-.01-.01-.02c0-.01-.01-.02-.02-.03 0-.01-.02-.03-.02-.04-.11-.19-.23-.38-.35-.56l-.83.55c.34.51.64 1.05.89 1.6l.91-.41ZM18.86 3.03c-.23-.1-.46-.19-.69-.28-.02 0-.03-.01-.05-.02-.01 0-.02 0-.04-.01s-.02 0-.03-.01c-.01 0-.02 0-.04-.01h-.34c-.08-.02-.17-.05-.26-.07l-.25.97c.59.15 1.17.35 1.73.6l.41-.91ZM5.97 5.09l-.01.01-.01.01s-.01.02-.02.02l-.03.03c-.29.29-.56.6-.81.92s-.02.02-.03.04l.78.62c.38-.48.8-.93 1.25-1.34l-.67-.74ZM19.51 23.52l.5.87c.36-.21.7-.43 1.03-.67 0 0 .02-.01.02-.02l.01-.01c.15-.11.3-.23.45-.35l-.64-.77c-.47.39-.98.74-1.5 1.05ZM22.56 20.91l.78.63s0-.01.01-.02c0 0 .02-.02.02-.03s.01-.02.02-.02.02-.02.03-.04.07-.09.1-.13.05-.07.07-.1.06-.09.1-.13c0-.01.02-.03.03-.04l.03-.04c0-.01.01-.02.02-.03 0-.01.01-.02.02-.03 0-.01.01-.02.02-.03 0 0 .01-.02.02-.02 0 0 0-.01.01-.02s0 0 0-.01v-.03s0-.01.01-.02v-.02s0-.02.01-.02c0 0 0-.02.01-.02 0 0 0-.02.01-.02 0 0 0-.02.01-.02l-.87-.49c-.3.53-.65 1.04-1.03 1.51ZM24.47 17.39l.95.31c.2-.63.36-1.28.45-1.95l-.99-.14c-.09.6-.23 1.2-.42 1.78ZM22.07 5.12l-.02-.02-.01-.01-.01-.01-.02-.02h-.02v-.01s-.01 0-.02-.01c0 0-.02-.02-.03-.02 0 0-.02-.01-.02-.02s-.02-.01-.02-.02c0 0-.01 0-.02-.01 0 0-.01 0-.02-.01l-.01-.01-.02-.02c-.01 0-.02-.02-.04-.03-.08-.06-.16-.12-.25-.18l-.58.82c.5.35.97.75 1.4 1.18l.71-.71c-.13-.13-.27-.26-.4-.38ZM11.51 25.74c.64.14 1.31.22 1.98.25l.04-1c-.61-.03-1.22-.1-1.82-.23l-.21.98ZM15.73 24.86l.16.99c.16-.03.32-.05.48-.09H16.83c.1-.03.2-.06.3-.1l-.32-.95c-.58.19-1.17.34-1.78.44ZM7.47 24.07c.17.11.33.21.5.31s.02.01.03.02h.01s.02 0 .02.01c.34.19.7.37 1.06.52l.4-.92c-.56-.24-1.1-.53-1.61-.87l-.54.84ZM15.4 9.4l-.7.71 3.39 3.39H8v1h10.09l-3.39 3.39.7.71L20 14l-4.6-4.6z"/></svg>',
10973                    9:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m12.65 2-.91.43L17.25 14l-5.51 11.57.91.43 5.71-12-5.71-12z"/></svg>',
10974                    10: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M25.79 14.56c.05-.07.11-.13.14-.22.09-.22.09-.47 0-.69-.03-.08-.08-.14-.13-.2-.02-.03-.03-.06-.06-.09l-6.51-6.51c-.35-.35-.92-.35-1.27 0s-.35.92 0 1.27l4.97 4.97H2.9c-.5 0-.9.4-.9.9s.4.9.9.9h20.03l-4.97 4.97a.9.9 0 0 0 0 1.27.9.9 0 0 0 1.27 0l6.5-6.51c.02-.02.03-.05.05-.07Z"/></svg>',
10975                    11: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m21.31 12.94-10.5-10.5c-.59-.59-1.54-.59-2.12 0s-.59 1.54 0 2.12L18.13 14l-9.44 9.44a1.49 1.49 0 0 0 0 2.12c.29.29.68.44 1.06.44s.77-.15 1.06-.44l10.5-10.5c.59-.59.59-1.54 0-2.12Z"/></svg>',
10976                    12: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m21.56 12.09-9.29-9.3c-1.05-1.05-2.77-1.05-3.83 0s-1.05 2.77 0 3.83L15.82 14l-7.38 7.38a2.722 2.722 0 0 0 0 3.83c.51.51 1.19.79 1.91.79s1.4-.28 1.91-.79l9.29-9.29a2.722 2.722 0 0 0 0-3.83Zm-1.06 2.76-9.29 9.29c-.46.46-1.25.46-1.71 0-.47-.47-.47-1.24 0-1.71l7.91-7.91c.29-.29.29-.77 0-1.06L9.5 5.55c-.47-.47-.47-1.24 0-1.71.24-.24.54-.35.85-.35s.62.12.85.35l9.29 9.29c.47.47.47 1.24 0 1.71Z"/></svg>',
10977                    13: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M26 14v-.01l-1.87-1.87L17 5h-5.3l7.12 7.12H2v3.76h16.82L11.7 23H17l6.35-6.35.77-.77L26 14z"/></svg>',
10978                    14: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M24.53 14v-.01L12.53 2H5.46l12.01 12-12 12h7.06L21 17.53 24.54 14h-.01z"/></svg>',
10979                    15: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m16.8 14-9-9H2.5l9 9-9 9h5.3l6.35-6.35L16.8 14z" class="cls-1"/><path d="m26 14-9-9h-5.3l9 9-9 9H17l6.35-6.35L26 14z"/></svg>',
10980                    16: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M25.96 14.19c.08-.19.05-.41-.11-.56-.01-.01-.03-.01-.04-.02L15.25 3.04c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l9.75 9.75H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h21.79l-9.75 9.75c-.19.19-.19.5 0 .69.19.2.51.2.71.01l10.61-10.61.01-.01c.03-.04.06-.08.08-.12 0 0 .01-.02.02-.03Z"/></svg>',
10981                    17: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m19.1 10.1-.7.71L23.59 16H2v1h24l-6.9-6.9z"/></svg>',
10982                    18: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M21.74 12.69 10.68 2.48c-1.14-1.06-3-.24-3 1.31v20.42c0 1.56 1.85 2.37 3 1.31l11.06-10.21c.77-.71.77-1.92 0-2.63Z"/>',
10983                    19: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M8.5 2v24l13-12-13-12z"/></svg>',
10984                    20: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M14 2C7.37 2 2 7.37 2 14s5.37 12 12 12 12-5.37 12-12S20.63 2 14 2Zm-2.25 18V8l6.5 6-6.5 6Z"/></svg>',
10985                    21: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M2 2v24h24V2H2Zm9.75 18V8l6.5 6-6.5 6Z"/></svg>',
10986                    22: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m26 14-9-8v7H2v2h15v7l9-8z"/></svg>',
10987                    23: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M14 3c6.07 0 11 4.93 11 11s-4.93 11-11 11S3 20.07 3 14 7.93 3 14 3m0-1C7.37 2 2 7.37 2 14s5.37 12 12 12 12-5.37 12-12S20.63 2 14 2Z"/><path d="m18.25 14-6.5-6v12l6.5-6z"/></svg>',
10988                    24: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M25 3v22H3V3h22m1-1H2v24h24V2Z"/><path d="m18.25 14-6.5-6v12l6.5-6z"/></svg>',
10989                    25: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M24.59 12.75 21.5 10 17 6v4H2v8h15v4l4.5-4 3.09-2.75L26 14l-1.41-1.25z"/></svg>',
10990                    26: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="m18.25 14-6.5-6v12l6.5-6zM14 2H13.55l-.41.06.16.99c.6-.1 1.21-.15 1.83-.15v-1Zm-4.3.79c-.63.24-1.23.53-1.8.87l.51.86c.53-.31 1.08-.58 1.65-.8l-.36-.93ZM5.97 5.08c-.34.3-.66.63-.96.96s-.02.02-.03.03 0 .01-.01.02l-.01.
1099001s-.02.02-.02.03c-.06.07-.12.15-.18.22l.78.62c.38-.48.8-.93 1.25-1.34l-.67-.74ZM3.3 8.55v.04c-.13.26-.24.52-.35.78 0 .01 0 .02-.01.03s0 .02-.01.03v.06s0 .02-.01.03c0 .01 0 .02-.01.04-.06.16-.11.33-.17.49l.95.3c.18-.58.42-1.15.69-1.69l-.89-.45Zm-1.24 4.2c0 .05-.01.1-.01.15V13.11c0 .13-.01.25-.02.38s0 .01 0 .01v.05c0 .09 0 .18.01.26l1-.06c-.01-.23-.02-.46-.02-.69 0-.38.02-.77.06-1.15l-.99-.1Zm1.31 4.1-.97.26.09.32s0 .02.01.04v.04c0 .01 0 .02.01.03.1.32.22.63.34.93 0 0 0 .02.01.02v.02c0 .01.01.02.02.03s.03.07.04.1l.91-.42c-.25-.55-.46-1.13-.62-1.72Zm1.73 3.62-.81.59c.39.54.83 1.05 1.31 1.51l.7-.71c-.44-.43-.84-.89-1.2-1.39Zm2.92 2.76-.54.84c.11.07.23.14.34.21 0 0 .02 0 .02.01 0 0 .02 0 .02.01.01 0 .02.01.03.02.38.21.76.41 1.16.58l.4-.92c-.56-.24-1.1-.53-1.61-.87Zm3.7 1.53-.21.98c.64.14 1.31.22 1.98.25l.04-1c-.61-.03-1.22-.1-1.82-.23Zm5.79-.33c-.58.19-1.17.34-1.78.44l.16.99c.13-.02.26-.04.38-.07h.05c.41-.09.82-.19 1.22-.32h.04c.01 0 .02 0 .03-.01l-.32-.95Zm3.5-1.95c-.47.39-.98.74-1.5 1.05l.5.87s.05-.03.07-.04c0 0 .02 0 .03-.01h.02c.5-.3.97-.64 1.41-1.01l-.64-.77Zm2.58-3.08c-.3.53-.65 1.04-1.03 1.51l.78.63c.12-.14.23-.29.34-.44s.01-.02.02-.03c0 0 0-.01.01-.02l.01-.01s0-.01.01-.02l.02-.02s.01-.02.02-.03c0 0 .01-.02.02-.03 0-.01.02-.02.02-.04 0-.01.02-.02.02-.04s.02-.03.02-.04c0-.01.02-.03.02-.04 0-.01.01-.02.02-.03 0 0 0-.01.01-.02v-.03c0-.01.01-.02.02-.03.05-.08.1-.16.14-.24l-.87-.49Zm1.29-3.8c-.09.6-.23 1.2-.42 1.78l.95.31c.2-.63.36-1.28.45-1.95l-.99-.14Zm.83-4.22-.98.22c.13.59.22 1.2.25 1.81l1-.05c-.04-.68-.13-1.34-.27-1.98Zm-1.72-4.03-.83.55c.34.51.64 1.05.89 1.6l.91-.41c-.27-.61-.6-1.2-.97-1.75Zm-3.04-3.14-.58.82c.5.35.97.75 1.4 1.18l.71-.71-.01-.01-.02-.02-.03-.03c-.01-.01-.03-.02-.04-.04-.27-.25-.56-.49-.85-.72 0 0-.02-.01-.03-.02l-.01-.01s-.01 0-.02-.01-.02-.02-.03-.02l-.11-.08Zm-3.97-1.84-.25.97c.59.15 1.17.35 1.73.6l.41-.91c-.6-.27-1.24-.49-1.89-.65ZM14 2v1c.19 0 .37 0 .56.01l.05-1h-.42Z"/></svg>',
10991                    27: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path d="M6.06 2 4.65 3.41 15.23 14 4.65 24.59 6.06 26l12-12-12-12z"/><path d="m14.06 2-1.41 1.41L23.23 14 12.65 24.59 14.06 26l12-12-12-12z"/></svg>',
10992                }
10993                break;
10994            case 40:
10995                navObj = {
10996                    1:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m13.06 38-1.41-1.41L28.23 20 11.65 3.41 13.06 2l18 18-18 18z"/></svg>',
10997                    2:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M20 2C10.06 2 2 10.06 2 20s8.06 18 18 18 18-8.06 18-18S29.94 2 20 2Zm-2.86 27-.85-.85L24.44 20l-8.15-8.15.85-.85 9 9-9 9Z"/></svg>',
10998                    3:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M2 2v36h36V2H2Zm15.14 27-.85-.85L24.44 20l-8.15-8.15.85-.85 9 9-9 9Z"/></svg>',
10999                    4:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m25.281 29.897 11.31-11.317 1.415 1.414-11.31 11.317z"/><path d="m25.27 10.1 1.415-1.415L38 20l-1.414 1.414z"/><path d="M2 19h34v2H2z"/></svg>',
11000                    5:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M20 3c9.37 0 17 7.63 17 17s-7.63 17-17 17S3 29.37 3 20 10.63 3 20 3m0-1C10.06 2 2 10.06 2 20s8.06 18 18 18 18-8.06 18-18S29.94 2 20 2Z"/><path d="m17.14 29-.85-.85L24.44 20l-8.15-8.15.85-.85 9 9-9 9z"/></svg>',
11001                    6:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m17.14 29-.85-.85L24.44 20l-8.15-8.15.85-.85 9 9-9 9z"/><path d="M37 3v34H3V3h34m1-1H2v36h36V2Z"/></svg>',
11002                    7:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M37.25 19.8c-.08 0-.16-.01-.24-.04C27.54 16.6 26.68 8.82 26.65 8.49a.75.75 0 0 1 .67-.82c.42-.03.78.26.82.67.03.31.84 7.16 9.34 9.99a.75.75 0 0 1-.24 1.46Z"/><path d="M27.4 30.43h-.07a.75.75 0 0 1-.67-.82c.03-.33.9-8.11 10.36-11.27.39-.13.82.08.95.47.13.39-.08.82-.47.95-8.55 2.85-9.34 9.92-9.34 9.99a.75.75 0 0 1-.75.68Z"/><path d="M37.25 19.8H2.75c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h34.5c.41 0 .75.34.75.75s-.34.75-.75.75Z"/></svg>',
11003                    8:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M20 2H19.83c-.5.01-1 .05-1.49.1l.11.99c.62-.07 1.26-.1 1.89-.1v-1Zm-4.36.53c-.65.16-1.29.36-1.91.59l.35.94c.59-.22 1.19-.41 1.8-.56l-.24-.97ZM11.55 4.1c-.33.17-.65.36-.96.55h-.02s-.01 0-.02.01c-.01 0-.02.01-.03.02-.17.11-.35.22-.52.34s0 0-.01 0l.57.82c.52-.35 1.06-.68 1.61-.98l-.47-.88Zm-3.6 2.53-.01.01h-.01l-.01.01h-.01l-.01.01c-.43.4-.84.81-1.22 1.25l.75.66c.42-.47.86-.92 1.33-1.34l-.67-.74ZM5.07 9.94c-.14.2-.27.41-.4.61 0 .02-.02.03-.03.05 0 0-.01.02-.02.03s0 .01-.01.02c0 0 0 .01-.01.02 0 0 0 .01-.01.02 0 0 0 .01-.01.02 0 0 0 .01-.01.02 0 0 0 .01-.01.02 0 .01-.01.02-.02.03-.13.23-.26.46-.38.7l.89.46c.29-.56.62-1.1.97-1.62l-.83-.56Zm-1.99 3.91c-.07.19-.13.37-.19.56s-.01.03-.02.05c0 .02-.01.03-.02.05 0 .03-.02.05-.03.08 0 .01 0 .03-.01.04-.08.27-.16.55-.24.83v.05c0 .02 0 .04-.01.
1100305l.97.23c.15-.61.33-1.22.54-1.81l-.94-.34Zm-.98 4.28s0 .08-.01.13c-.04.44-.06.89-.07 1.34s0 0 0 .01v.13h1v-.12c0-.59.03-1.19.09-1.77l-.99-.1Zm1.06 4.25-.99.14c.04.31.1.62.15.93v.05c.06.28.12.55.19.82l.97-.25c-.16-.61-.28-1.23-.37-1.85Zm1.08 4-.93.38v.04c.24.58.51 1.13.8 1.68l.88-.48c-.3-.55-.57-1.13-.81-1.71ZM6.25 30l-.81.59c.25.35.52.68.79 1.01s.02.02.03.03.02.02.02.03c0 0 0 .01.01.02v.01l.01.01.01.01.02.02.01.01.02.02.02.02.74-.67c-.42-.46-.83-.96-1.19-1.46Zm2.83 3.03-.64.77c.51.43 1.04.83 1.6 1.2l.55-.83c-.52-.35-1.03-.73-1.51-1.13Zm3.48 2.26-.44.9s.06.03.09.04c.01 0 .02 0 .03.01H12.5s.02 0 .03.01c.12.05.24.09.37.14l.34-.94c-.59-.21-1.18-.46-1.74-.73Zm3.92 1.34-.21.98c.6.13 1.21.22 1.82.29h.08l.1-1c-.63-.06-1.25-.16-1.87-.29Zm6.01.19c-.62.09-1.25.15-1.88.17l.04 1c.67-.02 1.34-.08 1.99-.18l-.15-.99Zm4-1.1c-.58.24-1.18.45-1.78.62l.28.96h.02c.47-.14.93-.29 1.38-.46s.02 0 .04-.01.02 0 .03-.01.01 0 .02 0h.03l-.38-.92Zm3.6-2.04c-.5.37-1.04.72-1.58 1.04l.5.87c.07-.04.13-.08.2-.12 0 0 .01 0 .02-.01s.01 0 .02-.01.01 0 .02-.01.03-.02.04-.02c.43-.26.84-.54 1.24-.84l-.59-.8Zm3.02-2.85c-.4.48-.83.95-1.28 1.39l.7.72c.25-.24.5-.49.73-.75l.03-.03.02-.02v-.01l.01-.01v-.01l.02-.02.01-.01.02-.02v-.01l.02-.02s.01-.02.02-.03c.04-.04.07-.09.11-.13l-.77-.64Zm2.23-3.49c-.27.57-.58 1.12-.91 1.65l.85.53c.22-.35.43-.72.63-1.09 0-.01.01-.02.02-.03 0 0 0-.02.01-.02v-.02s0-.01.01-.02.01-.03.02-.04c.06-.11.11-.22.17-.34l-.9-.43Zm1.32-3.93c-.13.61-.29 1.23-.48 1.83l.95.31v-.05c0-.01 0-.02.01-.03.18-.57.32-1.14.44-1.73l-.98-.2Zm1.32-4.18-1 .04a14.813 14.813 0 0 1-.02 1.89l1 .07c0-.08 0-.16.01-.23v-.03c0-.19.02-.38.02-.57v-.89Zm-.71-4.33-.96.28c.18.6.32 
110031.22.43 1.84l.98-.17c-.03-.19-.07-.37-.11-.56s0-.03 0-.04V16.07c0-.02 0-.03-.01-.05l-.12-.44Zm-1.75-4.02-.86.51c.32.54.61 1.11.87 1.68l.91-.41c-.05-.11-.1-.23-.16-.34s0-.01 0-.02v-.02c-.22-.45-.45-.89-.71-1.33Zm-2.67-3.49-.71.7c.44.45.86.93 1.25 1.42l.79-.62c-.41-.52-.85-1.03-1.32-1.5Zm-3.43-2.73-.52.85c.53.33 1.06.69 1.55 1.08l.61-.79c-.51-.39-1.03-.76-1.58-1.09Zm-3.99-1.83-.3.95c.6.19 1.19.41 1.76.67l.41-.91c-.61-.27-1.23-.51-1.87-.71Zm-4.32-.8-.06 1c.63.04 1.26.11 1.88.22l.17-.99c-.65-.11-1.31-.19-1.99-.23Z"/><path d="M11 19.5h17.25v1H11z"/><path d="m22.61 26.57-.71-.71L27.76 20l-5.86-5.86.71-.71L29.18 20l-6.57 6.57z"/></svg>',
11004                    9:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m17.18 38-.9-.43L24.72 20 16.28 2.43l.9-.43 8.65 18-8.65 18z"/></svg>',
11005                    10: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><rect width="17" height="2" x="23.15" y="13.7" rx=".9" ry=".9" transform="rotate(45 31.654 14.692)"/><rect width="17" height="2" x="23.15" y="24.3" rx=".9" ry=".9" transform="rotate(-45 31.662 25.305)"/><path d="M36.69 21H3c-.55 0-1-.45-1-1s.45-1 1-1h33.69c.55 0 1 .45 1 1s-.45 1-1 1Z"/></svg>',
11006                    11: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M12.75 38c-.38 0-.77-.15-1.06-.44a1.49 1.49 0 0 1 0-2.12L27.13 20 11.69 4.56a1.49 1.49 0 0 1 0-2.12 1.49 1.49 0 0 1 2.12 0l16.5 16.5c.59.59.59 1.54 0 2.12l-16.5 16.5c-.29.29-.68.44-1.06.44Z"/></svg>',
11007                    12: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M13.45 38c-.78 0-1.51-.3-2.06-.85s-.85-1.28-.85-2.06.3-1.51.85-2.06l13.04-13.04L11.4 6.96c-.55-.55-.85-1.28-.85-2.06s.3-1.51.85-2.05a2.915 2.915 0 0 1 4.11 0L30.6 17.94c.55.55.85 1.28.85 2.05s-.3 1.51-.85 2.05L15.51 37.13c-.55.55-1.28.85-2.05.85Zm0-34.5c-.36 0-.72.14-1 .41-.27.27-.41.62-.41.99s.15.73.41.99l13.57 13.57a.75.75 0 0 1 0 1.06L12.45 34.09c-.27.27-.41.62-.41.99s.15.73.41.99c.53.53 1.46.53 1.99 0l15.09-15.09c.27-.27.41-.62.41-.99s-.15-.73-.41-.99L14.45 3.91c-.27-.27-.63-.41-.99-.41Z"/></svg>',
11008                    13: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m38 20-.01-.01L35.06 17 24.79 6.5H17L27.28 17H2v6h25.28L17 33.5h7.79l9.32-9.52.95-.98L38 20z"/></svg>',
11009                    14: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m29 25.3 5.3-5.3-.01-.01L16.3 2H5.7l18 18-18 18h10.6L29 25.3z"/></svg>',
11010                    15: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M2 5.75 16.25 20 2 34.25h8.4L20.45 24.2l4.2-4.2L10.4 5.75H2Z"/><path d="M15.35 5.75 29.6 20 15.35 34.25h8.4L33.8 24.2 38 20 23.76 5.75h-8.4Z" data-name="Path_366"/></svg>',
11011                    16: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M38 20c0-.07-.01-.13-.04-.19-.02-.04-.05-.08-.08-.12a.219.219 0 0 1-.03-.05L21 2.8c-.2-.2-.51-.2-.71 0s-.2.51 0 .71l16 16H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h33.79l-16 16c-.2.2-.2.51 0 .71a.485.485 0 0 0 .7 0l16.85-16.85s.09-.1.11-.17c.02-.05.03-.11.03-.16v-.03Z"/></svg>',
11012                    17: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M38.1 25.11h-36v-1h33.59l-8.37-8.37.7-.71L38.1 25.11z"/></svg>',
11013                    18: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M31.13 17.94 14.67 2.75c-1.79-1.66-4.7-.38-4.7 2.06V35.2c0 2.44 2.91 3.71 4.7 2.06l16.46-15.19c1.2-1.11 1.2-3.01 0-4.11Z"/></svg>',
11014                    19: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M30.75 20 11.25 2v36l19.5-18z"/></svg>',
11015                    20: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M20 2C10.06 2 2 10.06 2 20s8.06 18 18 18 18-8.06 18-18S29.94 2 20 2Zm-3.88 27V11l9.75 9-9.75 9Z"/></svg>',
11016                    21: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M2 2v36h36V2H2Zm14.12 27V11l9.75 9-9.75 9Z"/></svg>',
11017                    22: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M38 20 24.5 7.25V19H2v2h22.5v11.75L38 20z"/></svg>',
11018                    23: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M20 3c9.37 0 17 7.63 17 17s-7.63 17-17 17S3 29.37 3 20 10.63 3 20 3m0-1C10.06 2 2 10.06 2 20s8.06 18 18 18 18-8.06 18-18S29.94 2 20 2Z"/><path d="m25.88 20-9.76-9v18l9.76-9z"/></svg>',
11019                    24: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="M37 3v34H3V3h34m1-1H2v36h36V2Z"/><path d="m25.88 20-9.76-9v18l9.76-9z"/></svg>',
11020                    25: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m35.88 18-3.44-3.25-7.94-7.5v7.5H2v10.5h22.5v7.5l7.94-7.5L35.88 22 38 20l-2.12-2z"/></svg>',
11021                    26: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m25.88 20-9.76-9v18l9.76-9zM20 2h-.19c-.5.01-1 .05-1.49.1l.11.99c.62-.07 1.26-.1 1.89-.1v-1Zm-4.36.53c-.23.06-.45.12-.67.18H14.86c-.01 0-.02 0-.03.01-.02 0-.03.01-.05.02-.02 0-.03.01-.05.02-.17.06-.33.11-.49.18l.35.94c.59-.22 1.19-.41 1.8-.56l-.24-.97ZM11.55 4.1s-.07.04-.11.06-.02.01-.03.02c0 0-.02.01-.03.02s-.02.01-.03.02c-.39.23-.77.47-1.14.72l.57.82c.52-.35 1.06-.68 1.61-.98l-.47-.88Zm-3.6 2.53c-.09.08-.18.17-.28.25s-.02.02-.03.03l-.01.01-.02.02H7.6l-.01.01-.01.01h-.01l-.01.01-.01.01h-.02v.05l-.01.01v.02s-.01.02-.02.02-.04.05-.06.07l.75.66c.42-.47.86-.92 1.33-1.34l-.67-.74ZM5.07 9.94s0 .01-.01.02c-.35.52-.67 1.06-.96 1.62l.89.46c.29-.56.62-1.1.97-1.62l-.83-.56Zm-1.99 3.91c-.07.18-.13.37-.19.56v.08s0 .03-.01.04 0 .02 0 .02v.22l-.09.36.97.23c.15-.61.33-1.22.54-1.81l-.94-.34Zm-.98 4.28s0 .07-.01.11c-.04.45-.07.91-.07 1.37v.14h1v-.12c0-.59.03-1.19.09-1.77l-.99-.1Zm1.06 4.25-.99.14c.05.36.11.72.19 1.08s0 .03 0 .04V23.71c.04.2.09.4.14.6l.97-.25c-.16-.61-.28-1.23-.37-1.85Zm1.08 4-.93.38s.03.07.04.11c.18.43.37.85.59 1.26v.02c.05.1.1.2.16.3l.88-.48c-.3-.55-.57-1.13-.81-1.71ZM6.25 30l-.81.59c.34.46.7.91 1.08 1.34.05.05.1.11.15.16l.74-.67c-.42-.46-.83-.96-1.19-1.46Zm2.83 3.03-.64.77c.16.14.33.27.5.41 0 0 .01 0 .02.02.31.24.64.47.96.69l.55-.83c-.52-.35-1.03-.73-1.51-1.13Zm3.48 2.26-.44.9c.6.29 1.21.55 1.84.77l.34-.94c-.59-.21-1.18-.46-1.74-.73Zm3.92 1.34-.21.98.32.06h.03c.5.09 1 .17 1.52.22l.1-1c-.63-.06-1.25-.16-1.87-.29Zm6.01.19c-.62.09-1.25.15-1.88.17l.04 1c.67-.02 1.34-.08 1.99-.18l-.15-.99Zm4-1.1c-.58.24-1.18.45-1.78.62l.28.96c.64-.19 1.27-.41 1.89-.66l-.38-.92Zm3.6-2.04c-.5.37-1.04.72-1.58 1.04l.5.87s.01 0 .02-.01c0 0 .01 0 .02-.01h.01c.53-.31 1.05-.66 1.54-1.02l-.59-.8Zm3.02-2.85c-.4.48-.83.95-1.28 1.39l.7.72c.48-.46.93-.95 1.36-1.47l-.77-.64Zm2.23-3.49c-.27.57-.58 1.12-.91 1.65l.85.53c.18-.3.36-.6.53-.91v-.02s0-.02.01-.03c.12-.23.24-.46.35-.7l-.9-.43Zm1.32-3.93c-.13.61-.29 1.23-.48 1.83l.95.31c.14-.44.27-.89.38-1.34.04-.17.07-.33.11-.5l-.98-.2Zm1.32-4.18-1 .04a14.813 14.813 0 0 1-.02 1.89l1 .07c0-.09.01-.17.02-.26v-.08c0-.17.01-.35.02-.52s0-.01 0-.02v-.88Zm-.71-4.33-.96.28c.18.6.32 
110211.22.43 1.84l.98-.17s-.01-.06-.02-.1v-.02c-.11-.6-.25-1.18-.42-1.76Zm-1.75-4.02-.86.51c.32.54.61 1.11.87 1.68l.91-.41c-.07-.17-.15-.33-.23-.49 0 0 0-.02-.01-.02v-.02s0-.01-.01-.02c0-.01-.01-.03-.02-.04-.07-.14-.14-.28-.22-.42s-.02-.03-.03-.05 0-.02-.01-.03l-.24-.42Zm-2.67-3.49-.71.7c.44.45.86.93 1.25 1.42l.79-.62c-.3-.38-.61-.74-.94-1.1 0 0-.01-.02-.02-.02v-.01l-.02-.02c-.09-.1-.19-.2-.28-.29Zm-3.43-2.73-.52.85c.53.33 1.06.69 1.55 1.08l.61-.79c-.14-.11-.28-.21-.42-.32l-.01-.01s-.01 0-.02-.01c-.37-.27-.75-.52-1.14-.76Zm-3.99-1.83-.3.95c.6.19 1.19.41 1.76.67l.41-.91c-.28-.13-.57-.25-.86-.36-.01 0-.03-.01-.04-.02s-.02 0-.03-.01-.03-.01-.04-.02-.02 0-.03-.01-.02 0-.03-.01 0 0-.01 0-.02 0-.04-.01c-.23-.08-.45-.16-.68-.23Zm-4.32-.8-.06 1c.63.04 1.26.11 1.88.22l.17-.99c-.34-.06-.68-.11-1.03-.15h-.02c-.29-.03-.57-.06-.86-.07Z"/></svg>',
11022                    27: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="m8.61 38-1.42-1.41L23.78 20 7.19 3.41 8.61 2l18 18-18 18z"/><path d="m17.51 38-1.41-1.41L32.69 20 16.1 3.41 17.51 2l18 18-18 18z"/></svg>',
11023                }
11024                
11025                break;
11026            case 52:
11027                break;
11028            case 64:
11029                navObj = {
11030                    1:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m20.06 62-1.41-1.41L47.23 32 18.65 3.41 20.06 2l30 30-30 30z"/></svg>',
11031                    2:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M32 2C15.43 2 2 15.43 2 32s13.43 30 30 30 30-13.43 30-30S48.57 2 32 2Zm-4.86 45-.85-.85L40.44 32 26.29 17.85l.85-.85 15 15-15 15Z"/></svg>',
11032                    3:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M2 2v60h60V2H2Zm25.14 45-.85-.85L40.44 32 26.29 17.85l.85-.85 15 15-15 15Z"/></svg>',
11033                    4:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m40.792 50.555 19.785-19.813 1.415 1.413-19.785 19.813z"/><path d="m40.48 13.459 1.413-1.414 20.11 20.11-1.414 1.414z"/><path d="M2 31h58v2H2z"/></svg>',
11034                    5:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M32 3c15.99 0 29 13.01 29 29S47.99 61 32 61 3 47.99 3 32 16.01 3 32 3m0-1C15.43 2 2 15.43 2 32s13.43 30 30 30 30-13.43 30-30S48.57 2 32 2Z"/><path d="m27.14 47-.85-.85L40.44 32 26.29 17.85l.85-.85 15 15-15 15z"/></svg>',
11035                    6:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m27.14 47-.85-.85L40.44 32 26.29 17.85l.85-.85 15 15-15 15z"/><path d="M61 3v58H3V3h58m1-1H2v60h60V2Z"/></svg>',
11036                    7:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M61.25 32.75c-.08 0-.16-.01-.24-.04-14.59-4.86-15.95-17.19-15.96-17.31a.75.75 0 0 1 .67-.82c.42-.04.78.26.82.67.05.47 1.31 11.49 14.95 16.04a.75.75 0 0 1-.24 1.46Z"/><path d="M45.8 49.42h-.07a.75.75 0 0 1-.67-.82c.01-.12 1.38-12.45 15.96-17.31.39-.13.82.08.95.47.13.39-.08.82-.47.95-13.67 4.56-14.93 15.92-14.94 16.04a.75.75 0 0 1-.75.68Z"/><path d="M60.47 32.75H2.75c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h57.72c.41 0 .75.34.75.75s-.34.75-.75.75Z"/></svg>',
11037                    8:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M32 2H31.56c-.48 0-.96.03-1.43.06l.07 1c.64-.04 1.29-.06 1.93-.06V2Zm-4.38.32c-.36.05-.72.11-1.08.18h-.31c-.13.03-.25.05-.38.08l.21.98c.63-.14 1.27-.25 1.9-.34l-.14-.99Zm-4.3.95c-.37.11-.74.23-1.11.36-.01 0-.03 0-.04.01-.01 0-.02 0-.03.01h-.01s-.02 0-.03.01c0 0-.02 0-.03.01h-.02s-.02 0-.03.01c0 0-.02 0-.03.01 0 0-.02 0-.03.01h-.04c-.01 0-.02 0-.03.01h-.01c-.01 0-.02 0-.03.01-.01 0-.03.01-.04.02-.09.03-.17.06-.25.09l.35.94c.6-.23 1.22-.43 1.83-.62l-.29-.96Zm-4.1 1.58h-.02s-.02 0-.03.01c-.58.28-1.16.57-1.72.89l.49.87c.56-.31 1.14-.61 1.72-.88l-.43-.9Zm-3.83 2.16s-.09.06-.14.09c0 0-.02.01-.03.02 0 0-.02.01-.03.02-.01 0-.02.02-.04.02-.01 0-.02.02-.04.02 0 0-.02.01-.03.02-.43.29-.84.59-1.25.9 0 0-.02.01-.03.02 0 0-.02.01-.02.02l.61.79c.51-.39 1.04-.77 1.57-1.12l-.55-.83Zm-3.47 2.7s-.07.06-.1.09l-.01.01h-.01s-.01.02-.02.02c-.27.25-.53.5-.79.75s-.01.01-.02.02l-.01.
1103701-.01.01-.02.02c-.08.08-.16.16-.23.24l.72.7c.45-.46.92-.91 1.39-1.34l-.67-.74Zm-3.04 3.17c-.09.11-.18.21-.26.32 0 0 0 .01-.01.02v.01s-.01.02-.02.02v.01s-.01.02-.02.02c-.21.26-.41.53-.61.79s0 0 0 .01c0 0-.01.02-.02.02v.02s-.01.02-.02.02c-.04.06-.08.11-.12.17l.81.59c.38-.52.77-1.03 1.18-1.53l-.77-.64Zm-2.55 3.58c-.35.57-.67 1.15-.98 1.74l.89.46c.3-.57.61-1.14.95-1.69l-.86-.52Zm-2 3.92c-.26.61-.5 1.24-.71 1.87l.95.32c.21-.61.44-1.21.69-1.81l-.92-.39Zm-1.4 4.17v.05c-.16.62-.3 1.25-.41 1.89l.98.18c.12-.63.26-1.27.42-1.89l-.97-.25Zm-.77 4.33V29.26c-.03.39-.05.78-.07 1.17l1 .04c.02-.64.07-1.29.14-1.93l-.99-.1Zm.87 4.35-1 .04c0 .21.02.41.03.62v.21l.09 1.02.99-.11c-.07-.64-.12-1.29-.14-1.93Zm.48 4.22-.98.19c.06.3.12.6.19.9V38.75s0 .03.01.05c.05.2.1.4.15.61l.97-.25c-.16-.62-.3-1.25-.42-1.89Zm1.1 4.1-.94.33c.17.48.35.95.54 1.42s0 .02.01.03 0 0 0 .01c0 0 0 .02.01.03v.02s0 .02.01.03c.03.08.07.17.11.25l.92-.39c-.25-.59-.49-1.2-.7-1.8Zm1.69 3.9-.89.46s0 .01.01.02c0 .01.01.02.02.03.3.57.62 1.13.95 1.68l.85-.52c-.34-.55-.66-1.11-.95-1.68Zm2.25 3.61-.81.59s0 .01.01.02c0 0 .01.02.02.03 0 0 .01.02.02.03 0 .01.02.02.03.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.02l.01.02s.01.02.02.03c0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 .01.02.02.03.03 0 0 .01.02.02.03 0 .01.02.02.03.04 0 0 .01.02.02.03 0 .01.02.02.03.04 0 0 .01.02.02.03.02.02.03.04.05.06.03.04.06.08.1.12.04.05.08.11.13.16.15.19.3.38.46.56l.77-.64c-.41-.49-.81-1.01-1.19-1.52Zm2.74 3.24-.71.7v.01l.01.01.02.02.02.02.03.03.02.02.03.03.08.08c.06.06.12.12.18.17s.01.01.02.02l.03.03.02.02.01.01.02.02h.01l.01.01v.01l.02.02h.01l.02.02s.02.01.02.02c.18.17.35.33.54.49l.67-.75c-.48-.43-.95-.88-1.4-1.33Zm3.19 2.81-.6.8c.53.4 1.08.79 1.63 1.16l.55-.83c-.54-.35-1.07-.73-1.58-1.12Zm3.57 2.32-.48.88.12.06s.02.01.03.02c0 0 .02.01.03.02.02.01.05.02.07.04a22.66 22.66 0 0 0 .89.46c.01 0 .03.01.04.02.01 0 .03.01.04.02.01 0 .02 0 .03.01H18.94c.08.04.15.07.23.11l.42-.91a27.7 27.7 0 0 1-1.72-.87Zm3.86 1.77-.35.94H21.75s.02 0 .03.01 0 0 .01 0a22.772 22.772 0 0 0 1.11.37s.02 0 .03 0h.13c.04.01.08.03.13.04l.28-.96c-.62-.18-1.23-.39-1.83-.61Zm4.08 1.18-.21.98.75.15H26.93c.17.03.35.05.52.08l.14-.99c-.64-.09-1.28-.2-1.9-.33Zm4.21.57-.06 1 .55.03H31.18v-1h-.14c-.6 0-1.2-.02-1.8-.05Zm6.17-.28c-.63.1-1.28.17-1.92.23l.08 1c.67-.06 1.33-.13 1.99-.23l-.15-.99Zm4.15-.94c-.61.19-1.24.36-1.87.5l.23.97s.06-.01.09-.02 0 0 .01 0H39.1c.02 0 .03 0 .04-.01.51-.13 1.02-.27 1.53-.42l-.29-.96Zm3.96-1.54c-.58.28-1.18.54-1.77.77l.37.93c.18-.07.35-.14.53-.22.01 0 .02 0 .03-.01 0 0 .02 0 .03-.01 0 0 .02 0 .03-.01h.02s.02 0 .03-.01H43.87s.02 0 .03-.01h.01s.02 0 .03-.01.03-.01.04-.02c.22-.1.44-.2.65-.3 0 0 .02 0 .03-.01s-.43-.9-.43-.9Zm3.69-2.11c-.53.36-1.08.7-1.64 1.03l.5.87c.08-.05.16-.09.24-.14s.02-.01.03-.02 0 0 .01 0h.05s.02-.01.03-.02c0 0 .02-.01.03-.02.4-.24.79-.49 1.18-.75l-.56-.83Zm3.34-2.62c-.47.43-.97.85-1.47 1.25l.62.78c.44-.35.87-.71 1.29-1.09l.02-.02h.01l.01-.01.02-.02v-.01l.02-.02.02-.02-.67-.74Zm2.93-3.09c-.41.5-.84.99-1.27 1.45l.73.68.02-.02.01-.01.02-.02s.01-.02.02-.02 0 0 .01-.01c.4-.43.79-.88 1.16-1.33l-.77-.63Zm2.45-3.47c-.33.55-.68 1.1-1.05 1.62l.82.57c.38-.55.74-1.11 1.09-1.68l-.86-.51Zm1.91-3.79c-.25.59-.51 1.18-.8 1.76l.9.44c.26-.52.5-1.04.72-1.57 0 0 0-.02.01-.03v-.01s0-.02.01-.03v-.02c.01-.03.03-.06.04-.09l-.92-.38Zm1.33-4.04c-.16.62-.34 1.25-.53 1.86l.95.31.06-.18s0-.03.01-.04 0-.01 0-.01v-.12c.12-.41.24-.82.35-1.23v-.08l-.97-.24Zm.73-4.18c-.06.64-.15 1.28-.25 1.92l.99.16V36.39c.01-.12.03-.25.04-.37l-1-.1Zm1.11-4.3-1 .05c.02.45.03.91.03 1.37v.57l1 .02V32.07c0-.4-.01-.79-.03-1.18Zm-.53-4.37-.98.19c.12.63.23 1.27.31 1.91l.99-.13c-.01-.09-.02-.19-.04-.28s0-.01 0-.02V27.31c-.04-.22-.08-.43-.12-.64Zm-1.15-4.24-.94.33c.21.6.41 1.22.58 1.84l.96-.27c-.18-.65-.38-1.28-.6-1.91Zm-1.77-4.02-.88.47c.3.57.59 1.15.85 1.74l.91-.41v-.02s0-.02-.01-.03c-.18-.39-.37-.78-.56-1.17s-.01-.03-.02-.04c0-.01 0-.02-.02-.03 0-.01 0-.02-.01-.03 0 0 0-.02-.01-.03 0 0 0-.02-.01-.03v-.02s0-.02-.01-.03c0 0 0-.02-.01-.03v-.03s0-.02-.01-.03v-.03s0-.01-.01-.02Zm-2.34-3.72-.81.59c.38.52.75 1.05 1.09 1.59l.84-.54c-.1-.16-.21-.33-.32-.49 0 0-.01-.02-.02-.03 0-.01-.02-.02-.02-.04 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.02 0 0 0-.01-.01-.02 0 0-.01-.02-.02-.02 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03s0-.01-.01-.02c0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03l-.45-.63Zm-2.86-3.34-.71.7c.45.46.89.93 1.31 1.42l.76-.65c-.44-.5-.89-.99-1.36-1.47ZM50.01 8l-.6.8c.51.39 1.02.79 1.51 1.21l.65-.76c-.15-.13-.3-.26-.45-.38s-.02-.01-.02-.02 0 0-.01 0-.02-.01-.02-.02h-.01l-.01-.01h-.04s-.01 0-.01-.01c0 0-.02-.01-.02-.02-.01 0-.02-.02-.03-.03-.25-.2-.5-.4-.76-.59Zm-3.7-2.37-.48.88c.56.31 1.12.64 1.67.98l.54-.84s-.06-.04-.08-.05c0 0-.02-.01-.03-.02h-.03s-.02-.01-.03-.02h-.01s-.02-.01-.03-.02c-.35-.22-.7-.43-1.06-.63s-.02-.01-.03-.02h-.05s-.02 0-.03-.01c-.06-.03-.12-.07-.19-.1Zm-4-1.81-.34.94c.6.22 1.21.46 1.79.72l.41-.91c-.06-.03-.11-.05-.17-.08s-.03-.01-.04-.02-.02 0-.03-.01 0 0-.01 0c0 0-.02 0-.03-.01h-.01s-.02 0-.03-.01 0 0-.01 0H43.61s-.02 0-.03-.01h-.01s-.02 0-.03-.01h-.03s-.02 0-.03-.01 0 0-.01 0c-.14-.05-.27-.1-.41-.15Zm-4.23-1.2-.2.98c.63.13 1.26.28 1.88.45l.27-.96c-.64-.18-1.29-.33-1.94-.47Zm-4.36-.57-.06 1c.64.04 1.29.09 1.93.17l.12-.99s-.06 0-.09-.01-.03 0-.05 0h-.34c-.38-.04-.77-.07-1.16-.09Z"/><path d="M18.67 31.5H44.7v1H18.67z"/><path d="m35.89 41.56-.7-.71L44.04 32l-8.85-8.85.7-.71L45.45 32l-9.56 9.56z"/></svg>',
11038                    9:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m27.29 62-.9-.43L40.6 32 26.39 2.43l.9-.43 14.42 30-14.42 30z"/></svg>',
11039                    10: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><rect width="28" height="3" x="37.57" y="21.66" rx="1.5" ry="1.5" transform="rotate(45 51.567 23.16)"/><rect width="28" height="3" x="37.57" y="39.34" rx="1.5" ry="1.5" transform="rotate(-45 51.575 40.837)"/><path d="M60 33.5H4c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5h56c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5Z"/></svg>',
11040                    11: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M19.75 62c-.38 0-.77-.15-1.06-.44a1.49 1.49 0 0 1 0-2.12L46.13 32 18.69 4.56a1.49 1.49 0 0 1 0-2.12 1.49 1.49 0 0 1 2.12 0l28.5 28.5c.59.59.59 1.54 0 2.12l-28.5 28.5c-.29.29-.68.44-1.06.44Z"/></svg>',
11041                    12: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M21.1 62a4.16 4.16 0 0 1-2.96-1.23c-.79-.79-1.23-1.84-1.23-2.96s.44-2.17 1.23-2.96L40.98 32 18.13 9.15c-.79-.79-1.23-1.84-1.23-2.96s.44-2.17 1.23-2.96A4.16 4.16 0 0 1 21.09 2c1.12 0 2.17.44 2.96 1.23l25.81 25.81c.79.79 1.23 1.84 1.23 2.96s-.44 2.17-1.23 2.96L24.05 60.77A4.16 4.16 0 0 1 21.09 62Zm0-58.5c-.72 0-1.4.28-1.9.79-.51.51-.79 1.18-.79 1.9s.28 1.39.79 1.9l23.38 23.38c.29.29.29.77 0 1.06L19.2 55.91c-.51.51-.79 1.18-.79 1.9s.28 1.39.79 1.9c1.02 1.02 2.79 1.02 3.8 0L48.81 33.9c.51-.51.79
11041-1.18.79-1.9s-.28-1.39-.79-1.9L23 4.29c-.51-.51-1.18-.79-1.9-.79Z"/></svg>',
11042                    13: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m62 32-.01-.01L57 27 39.5 9.5H26.24L43.74 27H2v10h41.74l-17.5 17.5H39.5l15.87-15.87L57 37l5-5z"/></svg>',
11043                    14: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M47 40.84 55.84 32l-.02-.02L25.84 2H8.16l30 30-30 30h17.68L47 40.83v.01z"/></svg>',
11044                    15: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M2 8.67 25.33 32 2 55.33h13.75l16.46-16.46L39.08 32h-.01L15.75 8.67H2Z"/><path d="M24.92 8.67 48.25 32 24.92 55.33h13.75l16.46-16.46L62 32h-.01L38.67 8.67H24.92Z" data-name="Path_366"/></svg>',
11045                    16: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M62 32c0-.07-.01-.13-.04-.19-.02-.04-.05-.08-.08-.12a.219.219 0 0 1-.03-.05l-28.5-28.5c-.2-.2-.51-.2-.71 0s-.2.51 0 .71L60.29 31.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h57.79L32.64 60.15c-.2.2-.2.51 0 .71a.485.485 0 0 0 .7 0l28.5-28.5s.09-.1.11-.17c.02-.05.03-.11.03-.16V32Z"/></svg>',
11046                    17: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M62 40.29H2v-1h57.59L44.85 24.56l.71-.71L62 40.29z"/></svg>',
11047                    18: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M50.85 28.77 23.12 3.18c-2.82-2.6-7.38-.6-7.38 3.23v51.18c0 3.84 4.57 5.83 7.38 3.23l27.72-25.59a4.4 4.4 0 0 0 0-6.47Z"/></svg>',
11048                    19: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M50.25 32 17.75 2v60l32.5-30z"/></svg>',
11049                    20: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M32 2C15.43 2 2 15.43 2 32s13.43 30 30 30 30-13.43 30-30S48.57 2 32 2Zm-6.33 45V17l16.67 15-16.67 15Z"/></svg>',
11050                    21: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M2 2v60h60V2H2Zm23.67 45V17l16.67 15-16.67 15Z"/></svg>',
11051                    22: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M62 32 40.33 11.17V31H2v2h38.33v19.83L62 32z"/></svg>',
11052                    23: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M32 3c15.99 0 29 13.01 29 29S47.99 61 32 61 3 47.99 3 32 16.01 3 32 3m0-1C15.43 2 2 15.43 2 32s13.43 30 30 30 30-13.43 30-30S48.57 2 32 2Z"/><path d="M42.33 32 25.67 17v30l16.66-15z"/></svg>',
11053                    24: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M61 3v58H3V3h58m1-1H2v60h60V2Z"/><path d="M42.33 32 25.67 17v30l16.66-15z"/></svg>',
11054                    25: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m58.47 28.61-6-5.78-12.14-11.66v11.66H2v18.34h38.33v11.66l12.14-11.66 6-5.78L62 32l-3.53-3.39z"/></svg>',
11055                    26: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="M42.33 32 25.67 17v30l16.66-15zM32 2H31.55c-.48 0-.96.03-1.43.06l.07 1c.64-.04 1.29-.06 1.93-.06V2Zm-4.38.32c-.36.05-.72.11-1.08.18h-.31c-.13.03-.25.05-.38.08l.21.98c.63-.14 1.27-.25 1.9-.34l-.14-.99Zm-4.3.95c-.37.11-.74.23-1.11.36-.01 0-.03 0-.04.01-.01 0-.02 0-.03.01h-.01s-.02 0-.03.01c0 0-.02 0-.03.01h-.02s-.02 0-.03.01c0 0-.02 0-.03.01 0 0-.02 0-.03.01h-.04c-.01 0-.02 0-.03.01h-.01c-.01 0-.02 0-.03.01-.01 0-.03.01-.04.02-.09.03-.17.06-.25.09l.35.94c.6-.23 1.22-.43 1.83-.62l-.29-.96Zm-4.1 1.58h-.02s-.02 0-.03.01c-.58.28-1.16.57-1.72.89l.49.87c.56-.31 1.14-.61 1.72-.88l-.43-.9Zm-3.83 2.16s-.09.06-.14.09c0 0-.02.01-.03.02 0 0-.02.01-.03.02-.01 0-.02.02-.04.02-.01 0-.02.02-.04.02 0 0-.02.01-.03.02-.43.29-.84.59-1.25.9 0 0-.02.01-.03.02 0 0-.02.01-.02.02l.61.79c.51-.39 1.04-.77 1.57-1.12l-.55-.83Zm-3.47 2.7s-.07.06-.1.09l-.01.01h-.01s-.01.02-.02.02c-.27.25-.53.5-.79.75s-.01.01-.02.02l-.01.
1105501-.01.01-.02.02c-.08.08-.16.16-.23.24l.72.7c.45-.46.92-.91 1.39-1.34l-.67-.74Zm-3.04 3.17c-.09.11-.18.21-.26.32 0 0 0 .01-.01.02s0 .01 0 .01v.01s-.01.02-.02.02v.01s-.01.02-.02.02c-.21.26-.41.53-.61.79s0 0 0 .01c0 0-.01.02-.02.02v.02s-.01.02-.02.02c-.04.06-.08.11-.12.17l.81.59c.38-.52.77-1.03 1.18-1.53l-.77-.64Zm-2.55 3.58c-.35.57-.67 1.15-.98 1.74l.89.46c.3-.57.61-1.14.95-1.69l-.86-.52Zm-2 3.92c-.26.61-.5 1.24-.71 1.87l.95.32c.21-.61.44-1.21.69-1.81l-.92-.39Zm-1.4 4.17v.05c-.16.62-.3 1.25-.41 1.89l.98.18c.12-.63.26-1.27.42-1.89l-.97-.25Zm-.77 4.33V29.27c-.03.39-.05.78-.07 1.17l1 .04c.02-.64.07-1.29.14-1.93l-.99-.1Zm.87 4.35-1 .04c0 .21.02.41.03.62s0 0 0 .01V34.1l.09 1.02.99-.11c-.07-.64-.12-1.29-.14-1.93Zm.48 4.22-.98.19c.06.3.12.6.19.9V38.75s0 .03.01.05c.05.2.1.4.15.61l.97-.25c-.16-.62-.3-1.25-.42-1.89Zm1.1 4.1-.94.33c.17.48.35.95.54 1.42s0 .02.01.03 0 0 0 .01c0 0 0 .02.01.03v.02s0 .02.01.03c.03.08.07.17.11.25l.92-.39c-.25-.59-.49-1.2-.7-1.8Zm1.69 3.9-.89.46s0 .01.01.02c0 .01.01.02.02.03.3.57.62 1.13.95 1.68l.85-.52c-.34-.55-.66-1.11-.95-1.68Zm2.25 3.61-.81.59s0 .01.01.02c0 0 .01.02.02.03 0 0 .01.02.02.03 0 .01.02.02.03.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.02l.01.02s.01.02.02.03c0 0 .01.02.02.03 0 0 .01.02.02.03 0 0 .01.02.02.03 0 .01.02.02.03.03 0 0 .01.02.02.03 0 .01.02.02.03.04 0 0 .01.02.02.03 0 .01.02.02.03.04 0 0 .01.02.02.03.02.02.03.04.05.06.03.04.06.08.1.12.04.05.08.11.13.16.15.19.3.38.46.56l.77-.64c-.41-.49-.81-1.01-1.19-1.52Zm2.74 3.24-.71.7.01.01.02.02.02.02.03.03.02.02.03.03.08.08c.06.06.12.12.18.17s.01.01.02.02l.03.03.02.02.01.01.02.02h.01l.01.01v.01l.02.02h.01l.02.02s.02.01.02.02c.18.17.35.33.54.49l.67-.75c-.48-.43-.95-.88-1.4-1.33Zm3.19 2.81-.6.8c.53.4 1.08.79 1.63 1.16l.55-.83c-.54-.35-1.07-.73-1.58-1.12Zm3.57 2.32-.48.88.12.06s.02.01.03.02c0 0 .02.01.03.02.02.01.05.02.07.04a22.66 22.66 0 0 0 .89.46c.01 0 .03.01.04.02.01 0 .03.01.04.02.01 0 .02 0 .03.01H18.94c.08.04.15.07.23.11l.42-.91a27.7 27.7 0 0 1-1.72-.87Zm3.86 1.77-.35.94H21.75s.02 0 .03.01 0 0 .01 0a22.772 22.772 0 0 0 1.11.37s.02 0 .03 0h.13c.04.01.08.03.13.04l.28-.96c-.62-.18-1.23-.39-1.83-.61Zm4.08 1.18-.21.98.75.15H26.93c.17.03.35.05.52.08l.14-.99c-.64-.09-1.28-.2-1.9-.33Zm4.21.57-.06 1 .55.03H31.23v-1h-.14c-.6 0-1.2-.02-1.8-.05Zm6.17-.28c-.63.1-1.28.17-1.92.23l.08 1c.67-.06 1.33-.13 1.99-.23l-.15-.99Zm4.15-.94c-.61.19-1.24.36-1.87.5l.23.97s.06-.01.09-.02 0 0 .01 0H39.1c.02 0 .03 0 .04-.01.51-.13 1.02-.27 1.53-.42l-.29-.96Zm3.96-1.54c-.58.28-1.18.54-1.77.77l.37.93c.18-.07.35-.14.53-.22.01 0 .02 0 .03-.01 0 0 .02 0 .03-.01 0 0 .02 0 .03-.01h.02s.02 0 .03-.01H43.87s.02 0 .03-.01h.01s.02 0 .03-.01.03-.01.04-.02c.22-.1.44-.2.65-.3 0 0 .02 0 .03-.01s-.43-.9-.43-.9Zm3.69-2.11c-.53.36-1.08.7-1.64 1.02l.5.87c.08-.05.16-.09.24-.14s.02-.01.03-.02 0 0 .01 0h.05s.02-.01.03-.02c0 0 .02-.01.03-.02.4-.24.79-.49 1.18-.75l-.56-.83Zm3.34-2.62c-.47.43-.97.85-1.47 1.25l.62.78c.44-.35.87-.71 1.29-1.09l.02-.02h.01l.01-.01.02-.02.02-.02.02-.02-.67-.74Zm2.93-3.09c-.41.5-.84.99-1.27 1.45l.73.68.02-.02.01-.01.02-.02s.01-.02.02-.02 0 0 .01-.01c.4-.43.79-.88 1.16-1.33l-.77-.63Zm2.45-3.47c-.33.55-.68 1.1-1.05 1.62l.82.57c.38-.55.74-1.11 1.09-1.68l-.86-.51Zm1.91-3.79c-.25.59-.51 1.18-.8 1.76l.9.44c.26-.52.5-1.04.72-1.57 0 0 0-.02.01-.03v-.01s0-.02.01-.03v-.02c.01-.03.03-.06.04-.09l-.92-.38Zm1.33-4.04c-.16.62-.34 1.25-.53 1.86l.95.31.06-.18s0-.03.01-.04 0-.01 0-.01v-.12c.12-.41.24-.82.35-1.23v-.1l-.97-.24Zm.73-4.18c-.06.64-.15 1.28-.25 1.92l.99.16V36.33c.01-.12.03-.25.04-.37l-1-.1Zm1.11-4.3-1 .05c.02.45.03.91.03 1.37v.57l1 .02V32.06c0-.4-.01-.79-.03-1.18Zm-.53-4.37-.98.19c.12.63.23 1.27.31 1.91l.99-.13c-.01-.09-.02-.19-.04-.28s0-.01 0-.02V27.3c-.04-.22-.08-.43-.12-.64Zm-1.15-4.24-.94.33c.21.6.41 1.22.58 1.84l.96-.27c-.18-.65-.38-1.28-.6-1.91Zm-1.77-4.02-.88.47c.3.57.59 1.15.85 1.74l.91-.41v-.02s0-.02-.01-.03c-.18-.39-.37-.78-.56-1.17s-.01-.03-.02-.04c0-.01 0-.02-.02-.03 0-.01 0-.02-.01-.03 0 0 0-.02-.01-.03s0 0 0-.01c0 0 0-.02-.01-.03v-.02s0-.02-.01-.03c0 0 0-.02-.01-.03v-.03s0-.02-.01-.03v-.03s0-.01-.01-.02Zm-2.34-3.72-.81.59c.38.52.75 1.05 1.09 1.59l.84-.54c-.1-.16-.21-.33-.32-.49 0 0-.01-.02-.02-.03 0-.01-.02-.02-.02-.04 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.02 0 0 0-.01-.01-.02 0 0-.01-.02-.02-.02 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03s0-.01-.01-.02c0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03 0 0-.01-.02-.02-.03l-.45-.63Zm-2.86-3.34-.71.7c.45.46.89.93 1.31 1.42l.76-.65c-.44-.5-.89-.99-1.36-1.47ZM50.01 8l-.6.8c.51.39 1.02.79 1.51 1.21l.65-.76c-.15-.13-.3-.26-.45-.38s-.02-.01-.02-.02 0 0-.01 0-.02-.01-.02-.02h-.01l-.01-.01h-.03v-.01h-.01s-.01 0-.01-.01c0 0-.02-.01-.02-.02-.01 0-.02-.02-.03-.03-.25-.2-.5-.4-.76-.59Zm-3.7-2.37-.48.88c.56.31 1.12.64 1.67.98l.54-.84s-.06-.04-.08-.05c0 0-.02-.01-.03-.02h-.03s-.02-.01-.03-.02h-.01s-.02-.01-.03-.02c-.35-.22-.7-.43-1.06-.63s-.02-.01-.03-.02h-.05s-.02 0-.03-.01c-.06-.03-.12-.07-.19-.1Zm-4-1.81-.34.94c.6.22 1.21.46 1.79.72l.41-.91c-.06-.03-.11-.05-.17-.08s-.03-.01-.04-.02-.02 0-.03-.01 0 0-.01 0c0 0-.02 0-.03-.01h-.01s-.02 0-.03-.01 0 0-.01 0H43.61s-.02 0-.03-.01h-.01s-.02 0-.03-.01h-.03s-.02 0-.03-.01 0 0-.01 0c-.14-.05-.27-.1-.41-.15Zm-4.23-1.2-.2.98c.63.13 1.26.28 1.88.45l.27-.96c-.64-.18-1.29-.33-1.94-.47Zm-4.36-.57-.06 1c.64.04 1.29.09 1.93.17l.12-.99s-.06 0-.09-.01-.03 0-.05 0h-.34c-.38-.04-.77-.07-1.16-.09Z"/></svg>',
11056                    27: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path d="m13.42 62-1.41-1.41L40.59 32 12.01 3.41 13.42 2l30 30-30 30z"/><path d="m26.7 62-1.41-1.41L53.87 32 25.29 3.41 26.7 2l30 30-30 30z"/></svg>',
11057                }
11058
11059                break;
11060            case 76:
11061                navObj = {
11062                    1:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m21.06 2-1.41 1.41L54.23 38 19.65 72.59 21.06 74l36-36-36-36z"/></svg>',
11063                    2:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M38 2C18.12 2 2 18.12 2 38s16.12 36 36 36 36-16.12 36-36S57.88 2 38 2Zm-5.36 54-.85-.85L48.94 38 31.79 20.85l.85-.85 18 18-18 18Z"/></svg>',
11064                    3:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M2 2v72h72V2H2Zm30.64 54-.85-.85L48.94 38 31.79 20.85l.85-.85 18 18-18 18Z"/></svg>',
11065                    4:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m74 38-.04-.04-21.17-21.17-1.42 1.41L70.17 37H2v2h68.17L51.38 57.8l1.41 1.41 19.79-19.8h.01L74 38z"/></svg>',
11066                    5:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M38 3c19.3 0 35 15.7 35 35S57.3 73 38 73 3 57.3 3 38 18.7 3 38 3m0-1C18.12 2 2 18.12 2 38s16.12 36 36 36 36-16.12 36-36S57.88 2 38 2Z"/><path d="m32.64 56-.85-.85L48.94 38 31.79 20.85l.85-.85 18 18-18 18z"/></svg>',
11067                    6:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M74.5 74.5h-73v-73h73v73Zm-72-1h71v-71h-71v71Z"/><path d="m32.64 56-.85-.85L48.94 38 31.79 20.85l.85-.85 18 18-18 18z"/></svg>',
11068                    7:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M73.99 38c0-.05 0-.1-.02-.15 0-.03 0-.06-.01-.09 0-.02-.02-.03-.03-.05-.02-.05-.05-.09-.08-.13-.03-.04-.05-.08-.08-.11a.444.444 0 0 0-.11-.08c-.04-.03-.08-.06-.13-.08-.02 0-.03-.02-.05-.03-16.39-5.46-17.91-18.73-17.96-19.3a.75.75 0 0 0-1.49.15c.01.14 1.41 12.65 15.32 19.11H2.75c-.41 0-.75.34-.75.75s.34.75.75.75h66.6c-13.91 6.46-15.3 18.97-15.32 19.11-.04.41.26.78.67.82h.07c.38 0 .71-.29.75-.68.06-.56 1.57-13.83 17.9
110686-19.3 0 0 .01 0 .02-.01a.72.72 0 0 0 .21-.12l.06-.06c.04-.04.08-.09.11-.14.02-.03.03-.06.04-.09 0-.02.02-.03.03-.06 0-.03 0-.06.01-.09.01-.05.02-.1.02-.15Z"/></svg>',
11069                    8:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m3.19 34.35-.99-.1c0 .07-.01.14-.02.21V34.6c-.05.52-.08 1.04-.11 1.56l1 .05c.03-.65.08-1.3.15-1.94ZM3.01 38.63l-1 .02c.01.67.04 1.34.09 2l1-.07c-.05-.64-.08-1.3-.09-1.94ZM3.89 30.14l-.97-.22-.09.41V30.46c-.07.34-.14.69-.2 1.03s0 0 0 .01v.01c0 .03 0 .05-.01.08v.09l.99.17c.11-.64.24-1.28.38-1.91ZM11.69 62.57l.04.04v.02s.01.02.02.02 0 0 .01.01v.02c.09.09.18.19.27.28s.04.04.05.06v.01s.04.04.05.06 0 .01 0 .01l.02.02v.02l.01.01v.04s0 .01.01.02 0 0 0 .01v.03l.03.03.04.04v.01l.05.05.05.05c.01.01.02.02.04.03l.02.02v.01s.01.02.02.02l.69-.72c-.47-.45-.93-.91-1.37-1.38l-.73.68ZM6.8 22.12l-.89-.45c-.08.16-.17.33-.25.5v.03c0 .01-.01.02-.02.03v.04c0 .02-.02.04-.03.06s0 0 0 .01v.02l-.03.06v.02s-.03.06-.04.09 0 0 0 .01v.01c0 .02-.02.04-.03.06s0 0 0 .01v.02s-.01.03-.02.04 0 0 0 .01v.04s-.01.03-.02.05v.02c-.06.14-.13.28-.19.42l.91.4c.26-.59.54-1.18.83-1.76ZM5.1 26.04l-.94-.34c-.16.43-.3.86-.44 1.3s0 .01 0 .01v.04s0 .03-.01.04 0 .01 0 .01v.03c0 .02-.01.03-.02.05v.02c-.02.08-.05.16-.07.23l.96.29c.19-.62.39-1.24.61-1.84ZM9.55 15.93l.79.61c.4-.51.81-1.01 1.23-1.5l-.75-.66c-.44.5-.86 1.02-1.27 1.54ZM8.89 59.18c.37.5.74.99 1.13 1.47s0 0 0 .01v.01s.01.02.02.02v.01l.77-.63c-.41-.5-.81-1.02-1.19-1.54l-.81.59ZM6.52 55.47c.32.58.66 1.16 1.02 1.72l.85-.53c-.34-.55-.68-1.11-.99-1.67l-.87.49ZM4.19 47.08l-.97.26c.07.28.15.55.23.82v.09c.09.31.19.62.29.92l.95-.31c-.2-.61-.39-1.24-.56-1.86ZM4.62 51.51c.13.31.26.62.39.92s0 0 0 .01v.02c.11.25.23.5.34.75l.9-.43c-.28-.58-.54-1.18-.78-1.78l-.93.38ZM3.34 42.89l-.99.14c.04.28.08.55.13.83s0 0 0 .01c.06.38.13.75.2 1.13l.98-.19c-.12-.63-.23-1.28-.32-1.92ZM8.97 18.44l-.83-.56c-.1.14-.19.28-.28.42 0 0 0 .01-.01.02s0 0 0 .01v.01s-.01.02-.02.03v.04s-.01.02-.02.03 0 0 0 .01v.03s-.02.03-.02.04v.03c-.01.02-.02.03-.03.05v.03s-.02.04-.03.05v.02s-.03.04-.04.07c-.12.19-.23.37-.34.56l.86.51c.33-.55.68-1.11 1.04-1.64ZM66.34 15.79v-.02c0-.01-.02-.02-.03-.04s0 0 0-.01v-.02s-.01-.02-.02-.02 0 0 0-.01v-.01s-.01-.02-.02-.03v-.05s-.01-.02-.02-.02V15.5s-.01-.02-.02-.02c0 0-.02-.02-.02-.03v-.01c-.01-.01-.02-.03-.03-.04s-.03-.03-.04-.05c-.02-.02-.03-.04-.05-.06-.1-.12-.21-.25-.32-.37s-.03-.04-.05-.06c-.01-.02-.03-.03-.04-.05l-.75.66c.43.48.84.99 1.24 1.5l.79-.62ZM70.87 23.31c-.16-.37-.33-.73-.51-1.08v-.03c0-.01-.01-.02-.02-.03s0-.01 0-.01v-.01s0-.02-.01-.03 0 0 0-.01v-.02c-.08-.17-.17-.33-.25-.5l-.89.46c.3.57.58 1.16.84 1.75l.91-.41ZM68.84 19.41c-.2-.33-.4-.65-.61-.97s-.03-.05-.05-.08-.03-.05-.05-.08v-.01c-.01-.02-.02-.04-.04-.05v-.01c0-.02-.02-.03-.03-.04v-.02l-.03-.04c-.01-.02-.02-.03-.03-.04v-.01s-.02-.04-.04-.06v-.01c-.01-.02-.03-.04-.04-.06v-.01c0-.01-.01-.02-.02-.03l-.83.56c.36.53.72 1.08 1.05 1.64l.86-.52ZM71.46 27.72l.96-.29c-.1-.31-.19-.62-.3-.92s-.02-.06-.03-.09v-.02s-.02-.05-.02-.07v-.03s-.01-.04-.02-.06 0 0 0-.01v-.03s-.01-.04-.02-.06 0 0 0-.01v-.01c-.06-.18-.13-.35-.19-.53l-.94.35c.22.61.43 1.22.62 1.84ZM72.95 36.12l1-.05c-.01-.28-.03-.56-.05-.84s0-.08 0-.11V34.57l-.99.11c.07.64.12 1.29.16 1.94ZM72.47 31.87l.98-.17c-.12-.66-.25-1.31-.4-1.96l-.97.23c.15.63.28 1.27.39 1.9ZM38 3c.59 0 1.18.01 1.77.04l.05-1c-.45-.02-.91-.04-1.36-.04H37.85c-.24 0-.48.01-.72.02H36.99c-.11 0-.22.01-.33.02l.05 1c.64-.04 1.3-.05 1.94-.05ZM33.73 3.26l-.12-.99c-.26.03-.51.07-.77.1H32.6s-.05 0-.08.01 0 0-.01 0h-.03c-.2.03-.39.06-.58.1l.18.98c.63-.11 1.28-.21 1.92-.29ZM52.59 5.08s-.02 0-.02-.01h-.03c-.59-.26-1.18-.5-1.79-.73l-.35.94c.6.23 1.21.48 1.8.74l.41-.91ZM25.45 5.32l-.36-.93c-.18.07-.37.14-.55.22-.03.01-.06.02-.09.04h-.07s-.02 0-.03.01h-.04c-.02 0-.04.02-.06.02h-.02s-.06.02-.09.04h-.02s-.05.02-.07.03 0 0-.01 0h-.01c-.02.01-.05.02-.07.03h-.04s-.02 0-.03.01h-.02c-.02 0-.03.01-.05.02h-.03c-.05.02-.1.04-.15.07l.41.91c.59-.26 1.19-.52 1.79-.75ZM29.53 4.03l-.24-.97c-.33.08-.67.17-1 .26h-.04s-.03 0-.04.01 0 0-.01 0h-.04s-.04.01-.06.02h-.02c-.18.05-.36.11-.55.16l.3.96c.62-.19 1.25-.37 1.87-.52ZM48.47 3.55c-.26-.08-.52-.16-.79-.23h-.03c-.02 0-.04-.01-.06-.02h-.05c-.01 0-.02 0-.04-.01H47.38c-.01 0-.03 0-.04-.01s0 0-.01 0h-.04s-.03 0-.04-.01 0 0-.01 0h-.04s-.03 0-.05-.01 0 0-.01 0h-.04s-.03 0-.05-.01 0 0-.01 0H47l-.24.97c.63.15 1.26.32 
110691.87.51l.29-.96ZM44.19 2.53h-.05c-.02 0-.04 0-.07-.01h-.02c-.57-.1-1.15-.18-1.74-.25h-.02l-.12.99c.64.07 1.29.17 1.92.28l.17-.99ZM26.3 72.06c.08.03.15.05.23.08h.02c.02 0 .03.01.05.02h.08c.11.04.22.07.33.11s0 0 .01 0c.02 0 .05.02.07.02h.08c.01 0 .03 0 .04.01h.03c.25.08.5.15.76.22l.27-.96c-.62-.17-1.25-.37-1.86-.58l-.32.95ZM59.09 65.93l.6.8h.01v-.01h.02l.02-.02h.02c.01 0 .02-.02.04-.03s0 0 .01 0h.02s.05-.04.07-.06c.39-.31.78-.62 1.16-.95l-.65-.76c-.49.42-1 .83-1.52 1.22ZM65.23 59.99l.78.63V60.43s.01-.02.02-.02v-.03s.01-.02.02-.02c0 0 .01-.02.02-.02s0 0 0-.01v-.01s.01-.02.02-.02 0 0 0-.01v-.01s.02-.03.03-.04 0 0 0-.01v-.01c0-.01.02-.02.03-.04s0 0 0-.01v-.01s.01-.02.02-.03 0 0 0-.01-.81-.59-.81-.59c-.38.52-.77 1.04-1.18 1.55ZM62.34 63.15l.7.72c.31-.3.61-.6.9-.91s0 0 0-.01.01-.02.02-.02c0 0 .02-.02.02-.03.12-.12.23-.25.35-.37l-.73-.68c-.44.47-.9.94-1.36 1.39ZM63.42 12.5l-.21-.21v-.02l-.01-.01c-.37-.36-.75-.72-1.14-1.06l-.67.75c.48.43.96.88 1.41 1.33l.71-.71ZM56.49 7.11c-.16-.1-.33-.19-.49-.29h-.01l-.06-.03h-.01c-.02 0-.03-.02-.05-.03l-.06-.03h-.01l-.06-.03h-.02c-.02-.01-.05-.03-.07-.04h-.01c-.26-.15-.52-.29-.79-.43l-.47.88c.57.3 1.14.62 1.69.95l.51-.86ZM60.12 9.59h-.01c-.3-.24-.61-.47-.92-.69s0 0-.01 0c0 0-.02-.01-.03-.02-.17-.12-.34-.25-.52-.37l-.57.82c.53.37 1.06.76 1.57 1.15l.61-.79ZM55.53 68.3l.5.87c.43-.25.86-.51 1.28-.78s0 0 .01 0 .04-.03.07-.04 0 0 .01 0h.02s.03-.02.04-.03h.02s.02-.01.03-.02c.02-.01.03-.02.05-.03l-.55-.84c-.54.35-1.1.7-1.65 1.02ZM67.71 56.51l.85.53c.05-.08.1-.17.16-.25v-.03s.01-.02.02-.03v-.04s.01-.02.02-.03 0 0 0-.01V56.55s.01-.02.02-.03 0 0 0-.01v-.02s.02-.03.02-.04v-.03c.12-.21.24-.43.36-.64l-.88-.48c-.31.57-.64 1.13-.98 1.68ZM73 38.45c0 .65-.03 1.3-.08 1.94l1 .07c0-.11.01-.23.02-.34s0-.01 0-.01v-.02c.03-.46.04-.92.05-1.38s0 0 0-.01v-.04h-1ZM72.37 44.64l.98.19V44.7l.09-.51v-.04c0-.02 0-.05.01-.07V43.97c.05-.3.09-.6.13-.9l-.99-.13c-.09.64-.19 1.29-.31 1.92ZM71.31 48.78l.95.31c.09-.28.18-.57.26-.86s0 0 0-.01c0-.03.02-.05.02-.08v-.03c0-.01 0-.02.01-.03V48c0-.02 0-.03.01-.05v-.03l.09-.34-.97-.25c-.16.62-.35 1.25-.55 1.87ZM69.75 52.76l.91.42.03-.06v-.07c.16-.35.32-.7.46-1.06s0 0 0-.01v-.03s.01-.03.02-.04v-.18l-.93-.37c-.24.6-.5 1.2-.77 1.78ZM16.7 8.97s-.02.01-.02.02h-.01c-.28.21-.57.43-.84.64l.62.79c.51-.4 1.03-.79 1.56-1.16l-.57-.82c-.22.15-.43.31-.65.46ZM20.23 6.68h-.01c-.02.01-.04.02-.05.03s0 0-.01 0h-.03s-.03.02-.04.02h-.02s-.02.01-.03.02c0 0-.01 0-.02.01s-.01 0-.02.01h-.02s-.03.02-.04.02h-.02s-.04.02-.05.03l.52.85c.55-.33 1.12-.66 1.69-.96l-.47-.88c-.29.15-.58.31-.86.48ZM30.54 73.23l.27.06h.09c.49.1.99.18 1.49.26l.15-.99c-.64-.1-1.28-.21-1.91-.35l-.21.98ZM18.41 68.21l.57.36h.01c.02.01.03.02.05.03s0 0 .01 0h.03s.02.01.03.02h.03s.02.01.03.02c.01 0 .02.01.03.02l.06.03h.02c.14.08.28.16.41.24l.5-.87c-.56-.32-1.12-.66-1.66-1.01l-.54.84ZM14.88 65.59c.2.16.39.33.59.49s0 0 .01 0h.02s.02.02.04.03h.01c.01.01.03.02.04.03.24.19.47.37.71.55l.6-.8c-.52-.39-1.03-.79-1.52-1.21l-.64.77ZM13.29 11.82l-.01.01-.01.01-.03.03-.01.01s-.01.02-.02.02 0 0 0 .01h-.01l-.02.02c-.02.01-.03.03-.05.05-.15.15-.31.3-.46.46l.71.7c.45-.46.93-.91 1.41-1.34l-.67-.74c-.21.19-.42.38-.62.57ZM22.24 70.38c.09.04.18.09.27.13H22.57c.02 0 .03.01.05.02h.03c.44.2.88.4 1.32.59l.39-.92c-.59-.25-1.19-.52-1.77-.8l-.44.9ZM34.89 73.87l.74.06H36.58l.03-1c-.65-.02-1.3-.06-1.94-.11l-.09 1ZM47.68 71.64l.28.96.41-.12H48.43c.02 0 .03-.01.05-.02h.03c.42-.13.83-.26 1.24-.41l-.33-.94c-.61.21-1.23.41-1.85.59ZM51.71 70.21l.39.92c.2-.09.4-.17.6-.26s0 0 .01 0h.04c.35-.16.71-.33 1.05-.5l-.44-.9c-.58.29-1.17.56-1.77.81ZM43.51 72.57l.16.99c.19-.03.39-.06.58-.1s0 0 .01 0h.01c.03 0 .05 0 .08-.01H44.48s.04 0 .06-.01 0 0 .01 0h.03c.27-.05.53-.11.79-.16l-.21-.98c-.63.14-1.27.26-1.91.36ZM39.25 72.98l.04 1c.15 0 .29-.01.44-.02s0 0 .01 0H39.96l.89-.06h.18l-.09-1c-.64.06-1.29.1-1.94.12ZM41.9 27.31 52.09 37.5H22v1h30.09L41.9 48.69l.7.71L54 38 42.6 26.6l-.7.71z"/></svg>',
11070                    9:  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m30.85 2-.9.43L47.04 38 29.95 73.57l.9.43 17.3-36-17.3-36z"/></svg>',
11071                    10: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M74 38c0-.19-.04-.38-.11-.55-.09-.22-.23-.41-.4-.57L53.02 16.41c-.57-.57-1.5-.57-2.08 0l-.04.04c-.57.57-.57 1.5 0 2.08L68.87 36.5H3.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5h65.37L50.9 57.47c-.57.57-.57 1.5 0 2.08l.04.04c.57.57 1.5.57 2.08 0l20.47-20.47c.18-.15.32-.35.41-.57.07-.17.11-.35.11-.55Z"/></svg>',
11072                    11: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m56.31 36.94-34.5-34.5c-.59-.59-1.54-.59-2.12 0s-.59 1.54 0 2.12L53.13 38 19.69 71.44a1.49 1.49 0 0 0 0 2.12c.29.29.68.44 1.06.44s.77-.15 1.06-.44l34.5-34.5c.59-.59.59-1.54 0-2.12Z"/></svg>',
11073                    12: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M58.01 34.54 26.91 3.43C25.99 2.51 24.76 2 23.45 2s-2.54.51-3.46 1.43c-.92.92-1.43 2.15-1.43 3.46s.51 2.54 1.43 3.46l27.64 27.64-27.64 27.64c-.92.92-1.43 2.15-1.43 3.46s.51 2.54 1.43 3.46c.92.92 2.15 1.43 3.46 1.43s2.54-.51 3.46-1.43l31.1-31.1c.92-.92 1.43-2.15 1.43-3.46s-.51-2.54-1.43-3.46Zm-1.06 5.86-31.1 31.1c-1.28 1.28-3.52 1.28-4.8 0-.64-.64-1-1.49-1-2.4s.35-1.76 1-2.4l28.17-28.17c.29-.29.29-.77 0-1.06L21.05 9.3c-.64-.64-1-1.49-1-2.4s.35-1.76 1-2.4 1.49-1 2.4-1 1.76.35 2.4 1l31.1 31.1c.64.64 1 1.49 1 2.4s-.35 1.76-1 2.4Z"/></svg>',
11074                    13: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76">
11074<path d="m74 38-.01-.02L68 32 47 11H31.09l21 21H2v12h50.09l-21 21H47l19.05-19.05L68 44l6-6z"/></svg>',
11075                    14: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m67.6 38-.01-.02L31.6 2H10.39L46.4 38l-36 36h21.2L57 48.6 67.61 38h-.01z"/></svg>',
11076                    15: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m46.5 38-.02-.01L18.5 10H2l28 28L2 66h16.5l19.75-19.75L46.5 38z"/><path d="M73.99 37.99 46 10H29.5l28 28-28 28H46l19.75-19.75L74 38l-.01-.01z"/></svg>',
11077                    16: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M74 38c0-.07-.01-.13-.04-.19 0-.02-.02-.03-.03-.05a.284.284 0 0 0-.08-.11L39.56 3.35c-.2-.2-.51-.2-.71 0s-.2.51 0 .71L72.3 37.51H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h69.79L38.85 71.95c-.2.2-.2.51 0 .71a.485.485 0 0 0 .7 0l34.29-34.29s.09-.11.12-.17c.02-.04.02-.09.03-.13 0-.02.01-.04.01-.06Z"/></svg>',
11078                    17: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m54.38 28.38-.71.7L71.59 47H2v1h72L54.38 28.38z"/></svg>',
11079                    18: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M59.23 34.06 26.04 3.43c-3.43-3.17-8.99-.73-8.99 3.94v61.26c0 4.67 5.56 7.11 8.99 3.94l33.18-30.63c2.3-2.12 2.3-5.75 0-7.88Z"/></svg>',
11080                    19: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M19.5 2v72l39-36-39-36z"/></svg>',
11081                    20: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M38 2C18.12 2 2 18.12 2 38s16.12 36 36 36 36-16.12 36-36S57.88 2 38 2Zm-7 54V20l20 18-20 18Z"/></svg>',
11082                    21: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M2 2v72h72V2H2Zm29 54V20l20 18-20 18Z"/></svg>',
11083                    22: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M74 38 48 13v24H2v2h46v24l26-25z"/></svg>',
11084                    23: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M38 3c19.3 0 35 15.7 35 35S57.3 73 38 73 3 57.3 3 38 18.7 3 38 3m0-1C18.12 2 2 18.12 2 38s16.12 36 36 36 36-16.12 36-36S57.88 2 38 2Z"/><path d="M51 38 31 20v36l20-18z"/></svg>',
11085                    24: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M73 3v70H3V3h70m1-1H2v72h72V2Z"/><path d="M51 38 31 20v36l20-18z"/></svg>',
11086                    25: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M69.76 33.93 62.56 27 48 13v14H2v22h46v14l14.56-14 7.2-6.93L74 38l-4.24-4.07z"/></svg>',
11087                    26: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="M51 38 31 20v36l20-18zM38 2H37.66c-.24 0-.48.01-.72.02H36.8c-.11 0-.22.01-.33.02l.05 1c.64-.04 1.3-.05 1.94-.05v-1Zm-4.39.26c-.26.03-.51.07-.77.1H32.6s-.05 0-.08.01 0 0-.01 0h-.02c-.2.03-.39.06-.58.1l.18.98c.63-.11 1.28-.21 1.92-.29l-.12-.99Zm-4.32.8c-.33.08-.67.17-1 .26h-.04s-.03 0-.04.01 0 0-.01 0h-.03c-.02 0-.04.01-.06.02h-.02c-.18.05-.36.11-.55.16l.3.96c.62-.19 1.25-.37 1.87-.52l-.24-.97Zm-4.2 1.32c-.18.07-.37.14-.55.22s-.06.02-.09.04h-.07s-.02 0-.03.01h-.04c-.02 0-.04.02-.06.02h-.02s-.06.02-.09.04h-.02s-.05.02-.07.03 0 0-.01 0h-.01c-.02.01-.05.02-.07.03h-.04s-.02 0-.03.01h-.02c-.02 0-.03.01-.05.02h-.03c-.05.02-.1.04-.15.07l.41.91c.59-.26 1.19-.52 1.79-.75l-.36-.93Zm-4 1.83c-.29.15-.58.31-.86.48s0 0-.01 0c-.02.01-.04.02-.05.03s0 0-.01 0h-.03s-.03.02-.04.02h-.02s-.02.01-.03.02c0 0-.01 0-.02.01 0 0-.01 0-.02.01h-.02s-.03.02-.04.02h-.02s-.04.02-.05.03l.52.85c.55-.33 1.12-.66 1.69-.96l-.47-.88Zm-3.75 2.3c-.22.15-.43.31-.64.46 0 0-.02.01-.02.02h-.01c-.28.21-.57.43-.84.64l.62.79c.51-.4 1.03-.79 1.56-1.16l-.57-.82Zm-3.43 2.74c-.21.19-.42.38-.62.57s0 0-.01.01l-.01.01-.03.03-.01.01s-.01.02-.02.02h-.01l-.02.02c-.02.01-.03.03-.05.05-.15.15-.31.3-.46.46l.71.7c.45-.46.93-.91 1.41-1.34l-.67-.74Zm-3.09 3.14c-.44.5-.86 1.02-1.27 1.54l.79.61c.4-.51.81-1.01 1.23-1.5l-.75-.66Zm-2.67 3.49c-.1.14-.19.28-.28.42 0 0 0 .01-.01.02v.01s-.01.02-.02.03v.03s-.01.02-.02.03 0 0 0 .01v.03s-.02.03-.02.04v.03c-.01.02-.02.03-.03.05v.03s-.02.04-.03.05 0 .01 0 .01v.01s-.03.04-.04.07c-.12.19-.23.37-.34.56l.86.51c.33-.55.68-1.11 1.04-1.64l-.83-.56Zm-2.24 3.78c-.08.16-.17.33-.25.5v.03c0 .01-.01.02-.02.03v.04c0 .02-.02.04-.03.06s0 0 0 .01v.02l-.03.06v.02s-.03.06-.04.09 0 0 0 .01v.01l-.03.06v.03s-.01.03-.02.04 0 0 0 .01v.04c0 .02-.01.03-.02.05v.02c-.06.14-.13.28-.19.42l.91.4c.26-.59.54-1.18.83-1.76l-.89-.45ZM4.16 25.7c-.16.43-.3.86-.44 1.3s0 .01 0 .01v.04s0 .03-.01.04 0 .01 0 .01v.03c0 .02-.01.03-.02.05v.02c-.02.08-.05.16-.07.23l.96.29c.19-.62.39-1.24.61-1.84l-.94-.34Zm-1.25 4.21-.09.41V30.43c-.07.34-.14.69-.2 
110871.03s0 0 0 .01v.01c0 .03 0 .05-.01.08v.07l.99.17c.11-.64.24-1.28.38-1.91l-.97-.22Zm-.72 4.34c0 .07-.01.14-.02.21v.14c-.05.52-.08 1.04-.11 1.56l1 .05c.03-.65.08-1.3.15-1.94l-.99-.1Zm.82 4.38-1 .02c.01.67.04 1.34.09 2l1-.07c-.05-.64-.08-1.3-.09-1.94Zm.33 4.26-.99.14c.04.28.08.55.13.83s0 0 0 .01c.06.38.13.75.2 1.13l.98-.19c-.12-.63-.23-1.28-.32-1.92Zm.85 4.19-.97.26c.07.28.15.55.23.82v.09c.09.31.19.62.29.92l.95-.31c-.2-.61-.39-1.24-.56-1.86Zm1.36 4.05-.93.38c.13.31.26.62.39.92s0 0 0 .01v.02c.11.25.23.5.34.75l.9-.43c-.28-.58-.54-1.18-.78-1.78Zm1.84 3.86-.87.49c.32.58.66 1.16 1.02 1.72l.85-.53c-.34-.55-.68-1.11-.99-1.67Zm2.3 3.6-.81.59c.37.5.74.99 1.13 1.47s0 0 0 .01v.01s.01.02.02.02v.02l.77-.63c-.41-.5-.81-1.02-1.19-1.54Zm2.73 3.3-.73.68.04.04v.02s.01.02.02.02 0 0 .01.01v.02c.09.09.18.19.27.28s.04.04.05.06v.01s.04.04.05.06.01.02.02.02l.01.01.01.01.03.03.04.04.05.05c.02.01.03.03.05.04.01.01.02.02.04.03l.02.02v.01s.01.02.02.02l.69-.72c-.47-.45-.93-.91-1.37-1.38Zm3.1 2.94-.64.77c.2.16.39.33.59.49s0 0 .01 0h.02s.02.02.04.03h.01c.01.01.03.02.04.03.24.19.47.37.71.55l.6-.8c-.52-.39-1.03-.79-1.52-1.21Zm3.44 2.54-.54.84.57.36H19c.02.01.03.02.05.03s0 0 .01 0h.03s.02.01.03.02h.03s.02.01.03.02c.01 0 .02.01.03.02l.06.03h.02c.14.08.28.16.41.24l.5-.87c-.56-.32-1.12-.66-1.66-1.01Zm3.72 2.11-.44.9c.09.04.18.09.27.13H22.57c.02 0 .03.01.05.02h.03c.44.2.88.4 1.32.59l.39-.92c-.59-.25-1.19-.52-1.77-.8Zm3.95 1.63-.32.95c.08.03.15.05.23.08s0 0 .01 0h.01c.02 0 .03.01.05.02h.08c.11.04.22.07.33.11s0 0 .01 0c.02 0 .05.02.07.02h.08c.01 0 .03 0 .04.01h.03c.25.08.5.15.76.22l.27-.96c-.62-.18-1.25-.37-1.86-.58Zm4.12 1.14-.21.98.27.06h.09c.49.1.99.18 1.49.26l.15-.99c-.64-.1-1.28-.21-1.91-.35Zm4.23.62-.09 1 .74.06H36.58l.03-1c-.65-.02-1.3-.06-1.94-.11Zm6.22-.01c-.64.06-1.29.1-1.94.12l.04 1c.15 0 .29-.01.44-.02s0 0 .01 0h.21l.89-.06h.18l-.09-1Zm4.22-.65c-.63.14-1.27.26-1.91.36l.16.99c.19-.03.39-.06.58-.1s0 0 .01 0h.01c.03 0 .05 0 .08-.01H44.48s.04 0 .06-.01 0 0 .01 0h.03c.27-.05.53-.11.79-.16l-.21-.98Zm4.12-1.16c-.61.21-1.23.41-1.85.59l.28.96.41-.12H48.44c.02 0 .03-.01.05-.02h.03c.42-.13.83-.26 1.24-.41l-.33-.94Zm3.94-1.65c-.58.29-1.17.56-1.77.81l.39.92c.2-.09.4-.17.6-.26s0 0 .01 0h.04c.35-.16.71-.33 1.05-.5l-.44-.9Zm3.71-2.12c-.54.35-1.1.7-1.65 1.02l.5.87c.43-.25.86-.51 1.28-.78s0 0 .01 0 .04-.03.07-.04 0 0 .01 0h.02s.03-.02.04-.03h.02s.02-.01.03-.02c.02-.01.03-.02.05-.03l-.55-.84Zm3.42-2.56c-.49.42-1 .83-1.52 1.22l.6.8h.03s.02-.01.02-.02h.02c.01 0 .02-.02.04-.03s0 0 .01 0h.02s.05-.04.07-.06c.39-.31.78-.62 1.16-.95l-.65-.76Zm3.09-2.96c-.44.47-.9.94-1.36 1.39l.7.72c.31-.3.61-.6.9-.91s0 0 0-.01.01-.02.02-.02c0 0 .02-.02.02-.03.12-.12.23-.25.35-.37l-.73-.68Zm2.71-3.31c-.38.52-.77 1.04-1.18 1.55l.78.63v-.09s.01-.02.02-.02v-.03s.01-.02.02-.02 0-.01 0-.01.01-.02.02-.02 0 0 0-.01v-.01s.01-.02.02-.02 0 0 0-.01v-.01s.02-.03.03-.04 0 0 0-.01v-.01c0-.01.02-.02.03-.04s0 0 0-.01v-.01s.01-.02.02-.03 0 0 0-.01-.81-.59-.81-.59Zm2.28-3.61c-.31.57-.64 1.13-.98 1.68l.85.53c.05-.08.1-.17.16-.25v-.03s.01-.02.02-.03v-.04s.01-.02.02-.03v-.07s.01-.02.02-.03 0 0 0-.01v-.02s.02-.03.02-.04v-.03c.12-.21.24-.43.36-.64l-.88-.48Zm1.83-3.87c-.24.6-.5 1.2-.77 1.78l.91.42.03-.06v-.07c.16-.35.32-.7.46-1.06s0 0 0-.01v-.03s.01-.03.02-.04V51.78l-.93-.37Zm1.34-4.06c-.16.62-.35 1.25-.55 1.87l.95.31c.09-.28.18-.57.26-.86v-.01c0-.03.02-.05.02-.08v-.03c0-.01 0-.02.01-.03v-.07c0-.02 0-.03.01-.05v-.03l.09-.34-.97-.25Zm.82-4.19c-.09.64-.19 1.29-.31 1.92l.98.19v-.12l.09-.51v-.04c0-.02 0-.05.01-.07V44c.05-.3.09-.6.13-.9l-.99-.13Zm.32-4.27c0 .65-.03 1.3-.08 1.94l1 .07c0-.11.01-.23.02-.34s0-.01 0-.01v-.02c.03-.46.04-.92.05-1.38v-.05h-1Zm.79-4.38-.99.11c.07.64.12 1.29.16 1.94l1-.05c-.01-.28-.03-.56-.05-.84V34.58Zm-.74-4.33-.97.23c.15.63.28 1.27.39 1.9l.98-.17c-.12-.66-.25-1.31-.4-1.96Zm-1.27-4.21-.94.35c.22.61.43 1.22.62 1.84l.96-.29c-.1-.31-.19-.62-.3-.92s-.02-.06-.03-.09v-.02c0-.02-.02-.05-.02-.07v-.03c0-.02-.01-.04-.02-.06s0 0 0-.01v-.03s-.01-.04-.02-.06 0 0 0-.01v-.01c-.06-.18-.13-.35-.19-.53Zm-1.77-4.03-.89.46c.3.57.58 1.16.84 1.75l.91-.41c-.16-.37-.33-.73-.51-1.08v-.03c0-.01-.01-.02-.02-.03v-.01s0-.02-.01-.03 0 0 0-.01v-.02
11087c-.08-.17-.17-.33-.25-.5Zm-2.26-3.77-.83.56c.36.53.72 1.08 1.05 1.64l.86-.52c-.2-.33-.4-.65-.61-.97-.02-.03-.03-.05-.05-.08-.02-.03-.03-.05-.05-.08v-.01c-.01-.02-.02-.04-.04-.05v-.01c0-.02-.02-.03-.03-.04v-.02c0-.01-.02-.03-.03-.04s0 0 0-.01c-.01-.02-.02-.03-.03-.04v-.01c-.01-.02-.02-.04-.04-.05v-.01c-.01-.02-.03-.04-.04-.06s0 0 0-.01-.01-.02-.02-.03Zm-2.69-3.48-.75.66c.43.49.84.99 1.24 1.5l.79-.62v-.02s-.02-.02-.03-.04 0 0 0-.01v-.02s-.01-.02-.02-.02 0 0 0-.01-.01-.02-.02-.03v-.05s-.01-.02-.02-.02v-.04s-.01-.02-.02-.02c0 0-.02-.02-.02-.03-.01-.01-.02-.03-.03-.04-.01-.02-.03-.03-.04-.05-.02-.02-.03-.04-.05-.06-.1-.12-.21-.25-.32-.37-.02-.02-.03-.04-.05-.06-.01-.02-.03-.03-.04-.05Zm-3.1-3.12-.67.75c.48.43.96.88 1.41 1.33l.71-.71-.21-.21v-.01l-.01-.01c-.37-.36-.75-.72-1.14-1.06Zm-3.45-2.72-.57.82c.53.37 1.06.76 1.57 1.15l.61-.79h-.01c-.3-.24-.61-.47-.92-.69s0 0-.01 0c0 0-.02-.01-.03-.02-.17-.12-.34-.25-.52-.37Zm-3.76-2.28-.47.88c.57.3 1.14.62 1.69.95l.51-.86c-.16-.1-.33-.19-.49-.29h-.01l-.06-.03h-.01c-.02 0-.03-.02-.05-.03l-.06-.03h-.01l-.06-.03h-.02c-.02-.01-.05-.03-.07-.04h-.01c-.26-.15-.52-.29-.79-.43Zm-4.01-1.81-.35.94c.6.23 1.21.48 1.8.74l.41-.91s-.02 0-.02-.01h-.03c-.59-.26-1.18-.5-1.79-.73Zm-4.2-1.3-.24.97c.63.15 1.26.32 1.87.51l.29-.96c-.26-.08-.52-.16-.79-.23h-.03c-.02 0-.04-.01-.06-.02h-.05c-.01 0-.02 0-.04-.01H47.37c-.01 0-.03 0-.04-.01s0 0-.01 0h-.04s-.03 0-.04-.01 0 0-.01 0h-.04s-.03 0-.05-.01 0 0-.01 0h-.04s-.03 0-.05-.01 0 0-.01 0h-.04Zm-4.33-.78-.12.99c.64.07 1.29.17 1.92.28l.17-.99h-.04c-.02 0-.04 0-.07-.01h-.02c-.57-.1-1.15-.18-1.74-.25h-.02ZM38 2v1c.59 0 1.18.01 1.77.04l.05-1c-.45-.02-.91-.04-1.36-.04H38.3Z"/></svg>',
11088                    27: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 76 76" width="76" height="76"><path d="m14.06 2-1.41 1.41L47.23 38 12.65 72.59 14.06 74l36-36-36-36z"/><path d="m30.06 2-1.41 1.41L63.23 38 28.65 72.59 30.06 74l36-36-36-36z"/></svg>',
11089                }
11090                break;
11091        }
11092        let navigation = '<div class="slider-nav-btn prev invisible navsize'+size+'">' + navObj[n] + '</div><div class="slider-nav-btn next invisible navsize'+size+'">' + navObj[n] + '</div>';
11093        return navigation;
11094    }
11095
11096    function enableContentsSlider(el_seq, type, settings) {
11097        let enableBlocks = {
11098            'contents': ["contents6", "contents7", "contents8", "contents11", "contents12", "contents13", "contents16",
11099                "contents17", "contents18", "contents19", "contents20", "contents21", "contents41", "contents42",
11100                "contents43", "contents44", "contents45", "contents46", "contents47", "contents48", "contents49",
11101                "contents50", "contents51", "contents52", "contents53", "contents54", "contents55", "contents61", "contents62", "contents63",
11102                "contents67","contents68", "contents69", "contents73", "contents74", "contents75", "contents77", "contents78",
11103                "contents79", "contents80", "contents81", "contents82", "contents83", "contents84", "contents85",
11104                "contents97", "contents98", "contents99", "contents102", "contents103", "contents104", "contents106",
11105                "contents107", "contents108", "contents134", "contents137", "contents138"],
11106            'text': ['text1', 'text33', 'text35', 'text36', 'text37', 'text38', 'text40', 'text41', 'text42','text43',
11107                'text44', 'text46', 'text49', 'text51', 'text52', 'text53', 'text57', 'text58', 'text59', 'text60',
11108                'text61', 'text62', 'text63', 'text67', 'text68', 'text70', 'text79', 'text80', 'text82', 'text84',
11109                'text85', 'text86', 'text88', 'text104'],
11110            'image': ['image1', 'image2', 'image3', 'image4', 'image5', 'image6', 'image7', 'image8', 'image9', 'image10',
11111                'image11', 'image12', 'image13', 'image14', 'image15', 'image16', 'image17', 'image18', 'image19', 'image20',
11112                'image21', 'image22', 'image23', 'image24', 'image25', 'image26', 'image27', 'image29', 'image30', 'image31',
11113                'image32', 'image33', 'image34', 'image35', 'image-sample1'],
11114            'video': ['video1', 'video5', 'video7', 'video-grid2', 'video15', 'video16', 'video17', 'video20', 'video21', 'video22'],
11115            'sns': ['social23', 'social24', 'social26', 'social27', 'social28', 'social29', 'social30', 'social31', 'social32', 'social33'],
11116        }
11117
11118        let blockorg = $('.element[data-id="' + el_seq + '"]').attr('data-case');
11119        if(typeof settings != 'undefined' && settings && typeof settings.blockorg != 'undefined' && settings.blockorg) blockorg = settings.blockorg;
11120
11121        let flag = false;
11122        if(typeof enableBlocks[type] != 'undefined' && enableBlocks[type].indexOf(blockorg) > -1) {
11123            flag = true;
11124        }
11125
11126        if(type == 'contents' && $('.element[data-id="' + el_seq + '"]').find('[data-clone-loop]').length > 0) {
11127            flag = false;
11128        }
11129        if(type == 'video' && $('.element[data-id="' + el_seq + '"]').find('.lyoption').length == 0) {
11130            flag = false;
11131        }
11132        if($.inArray(type, ['contents', 'text', 'image', 'sns']) > -1 && $('.element[data-id="' + el_seq + '"]').find('[data-matrix-loop] .item').length == 0) {
11133            flag = false;
11134        }
11135        
11136        return flag;
11137    }
11138
11139    function isObjectEmpty(obj) {
11140        return Object.values(obj).every(value => {
11141            if (typeof value === 'object' && !Array.isArray(value)) {
11142                return isObjectEmpty(value);
11143            }
11144            return value === null || value === undefined || value === '';
11145        });
11146    }
11147
11148    // 이미지/텍스트 슬라이드 함수
11149    function sliderClean(select) {
11150        // console.log(select);
11151        $(select).find('.swiper-slide-duplicate').remove();
11152		$(select).find('.swiper-notification').remove();
11153        $(select).find('.swiper-slide-invisible-blank').remove();
11154        $(select).find('.swiper-slide.delete').remove();
11155    }
11156    
11157    function sliderModify(slide) {
11158        document.querySelector(slide).swiper.destroy();
11159		slider(slide);
11160    }
11161
11162    function sliderUnitModify(slide) {
11163        document.querySelector(slide).swiper.destroy();
11164		sliderUnit(slide);
11165    }
11166
11167    // function textSliderModify(slide) {
11168    //     document.querySelector(slide).swiper.destroy();
11169	// 	textSlider(slide);
11170    // }
11171
11172    //showcase logoSlide
11173    var sswiper;
11174    var uswiper;
11175    var tswiper;
11176
11177    //이미지 / 텍스트 슬라이드 미리보기///////////////////////////
11178    // $(window).resize(function(){
11179    //     slideshow();
11180    //     textslideshow();
11181    // });
11182
11183    function slideshow() {
11184        new Swiper( '.logoSlide', { slidesPerView: 'auto', simulateTouch: false, loop: true, speed: 5000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11185    }
11186    function textslideshow() {
11187        new Swiper( '.reviewSlide', { slidesPerView: 'auto', simulateTouch: false, loop: true, speed: 7000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11188    }
11189    ///////////////////////////////////////////////////////////
11190
11191    //showcase logoSlide(flow)
11192    function slider(t) {
11193        var elem = document.querySelector(t).children[0];
11194        if($(elem).hasClass('cl-ns-wrap')) return false;
11195        let ss = $(elem).attr('data-scroll-speed');
11196        
11197        // let mleft = $(elem).find('.item:eq(0)').css('margin-left').replace(/[^0-9]/g, "");
11198        var w = $(window).width();
11199        // if(w < 991) $(elem).find('.swiper-slide').css('margin-left', (mleft / 3) + 'px');
11200        // if(w < 767) $(elem).find('.swiper-slide').css('margin-left', (mleft / 4) + 'px');
11201        // if(w < 480) $(elem).find('.swiper-slide').css('margin-left', 0 + 'px');
11202        let space = Number($(elem).attr('slide-space'));
11203        if(w < 767) { //모바일버전 간격조정
11204            if(space == 1) $(elem).find('.swiper-slide:not(.bmove)').css('margin-left', '0px');
11205            else $(elem).find('.swiper-slide:not(.bmove)').css('margin-left', (space * 10 - 10) +'px');
11206        }
11207
11208        if (ss == 1000) {
11209            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 1000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11210        } else if (ss == 1500) {
11211            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 1500, autoplay: { delay: 0, disableOnInteraction: false, }, });
11212        } else if (ss == 2200) {
11213            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 2200, autoplay: { delay: 0, disableOnInteraction: false, }, });
11214        } else if (ss == 3000) {
11215            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 3000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11216        } else if (ss == 5000) {
11217            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 5000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11218        } else {
11219            sswiper = new Swiper( t, { slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 7000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11220        }
11221    }
11222
11223    //showcase logoSlide(unit)
11224    function sliderUnit(t) {
11225        if($(t).find('.item').length == 0 || $(t).hasClass('cl-not-supported') || $(t).find('.cl-ns-wrap').length > 0) return false;
11226
11227        var elem = document.querySelector(t).children[0];
11228        $(elem).find('.item').removeAttr('style');
11229        let ss = $(elem).attr('data-scroll-speed');
11230        let unit = Number($(elem).attr('data-page-unit'));
11231        let delay = Number($(elem).attr('data-delay-time'));
11232        let slide_time = Number($(elem).attr('data-slide-time'));
11233        var newTransitionDuration = slide_time;
11234        var option = { slidesPerView : 1, loop : true, slidesPerGroup : 1, loopFillGroupWithBlank : true, allowTouchMove: false, simulateTouch: false, autoplay : { delay : delay, disableOnInteraction : false}};
11235        option['speed'] = newTransitionDuration * 1000;
11236        option['slidesPerView'] = Number(unit);
11237        option['slidesPerGroup'] = Number(unit);
11238        if(unit == 5) {
11239            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 5, slidesPerGroup : 5 }};
11240        } else if(unit == 6) {
11241            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 6, slidesPerGroup : 6 }};
11242        } else if(unit == 7) {
11243            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 7, slidesPerGroup : 7 }};
11244        } else if(unit == 8) {
11245            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 8, slidesPerGroup : 8 }};
11246        } else if(unit == 9) {
11247            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 9, slidesPerGroup : 9 }};
11248        } else if(unit == 10) {
11249            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 10, slidesPerGroup : 10 }};
11250        } else {
11251            option['breakpoints'] = { 320 : { slidesPerView : 4, slidesPerGroup : 4 }, 767 : { slidesPerView : 4, slidesPerGroup : 4 }, 991 : { slidesPerView : 4, slidesPerGroup : 4 }};
11252        }
11253        new Swiper(t, option);
11254
11255    }
11256
11257    //showcase textSlide
11258    function textSlider(t) {
11259        var parent = document.querySelector(t);
11260        if (!parent || parent.children.length === 0) return false;
11261
11262        var elem = parent.children[0];
11263        // if($(elem).hasClass('cl-ns-wrap')) return false;
11264        if($(t).find('.item').length == 0 || $(t).hasClass('cl-not-supported') || $(t).find('.cl-ns-wrap').length > 0) return false;
11265        let ts = $(elem).attr('data-scroll-speed');
11266        if(ts == 3000){
11267            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 3000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11268        } else if(ts == 5000){
11269            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 5000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11270        } else if (ts == 7000) {
11271            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 7000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11272        } else if (ts == 9000) {
11273            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 9000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11274        } else if (ts == 12000) {
11275            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 12000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11276        } else {
11277            tswiper = new Swiper( t, { watchSlidesProgress: true, slidesPerView: 'auto', allowTouchMove: false, simulateTouch: false, loop: true, speed: 8
11277000, autoplay: { delay: 0, disableOnInteraction: false, }, });
11278        }
11279
11280        $(tswiper.$el).data('tswiper', tswiper);
11281    }
11282}
11283
11284function updateTabArrowState(el, motion, tab_len, motion_style, tab_count) {
11285    var $tab = $('.'+el);
11286    if($tab.length == 0) return;
11287
11288    var mobile_tab_line = $tab.attr('mobile-tab-line'),
11289        navi_use = $tab.attr('navigation-use'),
11290        tab_line = ($(window).width() < 991 && typeof mobile_tab_line != 'undefined' && mobile_tab_line) ? mobile_tab_line : $tab.attr('tab-line'),
11291        max_motion = 0;
11292
11293    tab_len = Number(tab_len);
11294    tab_count = Number(tab_count);
11295    motion = Number(motion);
11296    if(isNaN(motion)) motion = 0;
11297
11298    if($(window).width() > 991 && navi_use != "1") {
11299        $tab.find('.left-arrow, .right-arrow, .left-arrow .arrow, .right-arrow .arrow').addClass('hide');
11300        return;
11301    }
11302
11303    if(!tab_len || !tab_count || tab_line != 1 || tab_len <= tab_count) {
11304        $tab.find('.left-arrow, .right-arrow, .left-arrow .arrow, .right-arrow .arrow').addClass('hide');
11305        return;
11306    }
11307
11308    if(motion_style == 1) max_motion = Math.max(tab_len - tab_count, 0);
11309    else max_motion = Math.max(Math.ceil(tab_len / tab_count) - 1, 0);
11310
11311    if(motion < 0) motion = 0;
11312    if(motion > max_motion) motion = max_motion;
11313
11314    $tab.find('.left-arrow, .right-arrow, .left-arrow .arrow, .right-arrow .arrow').removeClass('hide');
11315    $tab.find('.left-arrow, .left-arrow .arrow').toggleClass('hide', motion <= 0);
11316    $tab.find('.right-arrow, .right-arrow .arrow').toggleClass('hide', motion >= max_motion);
11317}
11318
11319function getTabMotionMargin(el, target_index) {
11320    var $tab = $('.'+el),
11321        $tabBox = $tab.find('.tab-box'),
11322        $tabs = $tabBox.find('.tab:not(.hover)'),
11323        $target = $tabs.eq(target_index),
11324        $last = $tabs.last(),
11325        $tabBoxOut = $tab.find('.tab-box-out').eq(0),
11326        left_overlap = 0,
11327        right_overlap = 0;
11328
11329    if($target.length == 0) return 0;
11330    if($tabBoxOut.length == 0) $tabBoxOut = $tabBox.parent();
11331
11332    var box_left = $tabBoxOut.offset().left,
11333        box_right = box_left + $tabBoxOut.outerWidth(),
11334        $leftArrow = $tab.find('.left-arrow:not(.hide)').eq(0),
11335        $rightArrow = $tab.find('.right-arrow:not(.hide)').eq(0);
11336
11337    if($leftArrow.length > 0) {
11338        left_overlap = Math.max(0, ($leftArrow.offset().left + $leftArrow.outerWidth()) - box_left);
11339    }
11340    if($rightArrow.length > 0) {
11341        right_overlap = Math.max(0, box_right - $rightArrow.offset().left);
11342    }
11343
11344    var visible_left = left_overlap,
11345        visible_right = $tabBoxOut.innerWidth() - right_overlap,
11346        content_width = $last.position().left + $last.outerWidth(),
11347        margin = visible_left - $target.position().left,
11348        min_margin = visible_right - content_width,
11349        max_margin = visible_left;
11350
11351    if(content_width > (visible_right - visible_left)) {
11352        margin = Math.max(min_margin, Math.min(max_margin, margin));
11353    }
11354
11355    return margin;
11356}
11357
11358function getTabMotionBounds(el) {
11359    var $tab = $('.'+el),
11360        $tabBox = $tab.find('.tab-box'),
11361        $tabs = $tabBox.find('.tab:not(.hover)'),
11362        $last = $tabs.last(),
11363        $tabBoxOut = $tab.find('.tab-box-out').eq(0),
11364        left_overlap = 0,
11365        right_overlap = 0;
11366
11367    if($tab.length == 0 || $last.length == 0) return {min:0, max:0};
11368    if($tabBoxOut.length == 0) $tabBoxOut = $tabBox.parent();
11369
11370    var box_left = $tabBoxOut.offset().left,
11371        box_right = box_left + $tabBoxOut.outerWidth(),
11372        $leftArrow = $tab.find('.left-arrow:not(.hide)').eq(0),
11373        $rightArrow = $tab.find('.right-arrow:not(.hide)').eq(0);
11374
11375    if($leftArrow.length > 0) {
11376        left_overlap = Math.max(0, ($leftArrow.offset().left + $leftArrow.outerWidth()) - box_left);
11377    }
11378    if($rightArrow.length > 0) {
11379        right_overlap = Math.max(0, box_right - $rightArrow.offset().left);
11380    }
11381
11382    var visible_left = left_overlap,
11383        visible_right = $tabBoxOut.innerWidth() - right_overlap,
11384        content_width = $last.position().left + $last.outerWidth(),
11385        visible_width = visible_right - visible_left,
11386        min_margin = visible_right - content_width,
11387        max_margin = visible_left;
11388
11389    if(content_width <= visible_width) min_margin = max_margin;
11390
11391    return {
11392        min: Math.min(min_margin, max_margin),
11393        max: max_margin
11394    };
11395}
11396
11397function getTabSwipeOption($tab) {
11398    var w = $(window).width(),
11399        mobile_tab_line = $tab.attr('mobile-tab-line'),
11400        mobile_tab_count = $tab.attr('mobile-tab-count'),
11401        tab_counted = $tab.attr('tab-count'),
11402        tab_line = (w < 991 && typeof mobile_tab_line != 'undefined' && mobile_tab_line) ? mobile_tab_line : $tab.attr('tab-line'),
11403        tab_count = (w < 991) ? ((typeof mobile_tab_count != 'undefined' && mobile_tab_count) ? mobile_tab_count : ((tab_counted > 4) ? 4 : tab_counted)) : tab_counted,
11404        tab_len = $tab.find('.tab-box .tab:not(.hover)').length,
11405        motion = Number($tab.attr('tab-motion'));
11406
11407    if(isNaN(motion)) motion = 0;
11408    tab_count = Number(tab_count);
11409
11410    return {
11411        el: $tab.attr('data-name'),
11412        tab_line: tab_line,
11413        tab_count: tab_count,
11414        tab_len: tab_len,
11415        motion: motion,
11416        motion_style: $tab.attr('tab-motion-style') || 1,
11417        tab_case: $tab.attr('data-case')
11418    };
11419}
11420
11421function getTabMotionByMargin(el, margin, motion_style, tab_count, tab_len) {
11422    var $tabs = $('.'+el).find('.tab-box .tab:not(.hover)'),
11423        bounds = getTabMotionBounds(el),
11424        target_left = bounds.max - margin,
11425        motion = 0,
11426        max_motion = 0;
11427
11428    tab_count = Number(tab_count);
11429    tab_len = Number(tab_len);
11430
11431    if(motion_style == 1) max_motion = Math.max(tab_len - tab_count, 0);
11432    else max_motion = Math.max(Math.ceil(tab_len / tab_count) - 1, 0);
11433
11434    if(margin <= bounds.min + 1) return max_motion;
11435    if(margin >= bounds.max - 1) return 0;
11436
11437    $tabs.each(function(i){
11438        if($(this).position().left <= target_left + 1) motion = i;
11439    });
11440
11441    if(motion_style == 1) {
11442        motion = Math.min(motion, max_motion);
11443    } else {
11444        motion = Math.floor(motion / tab_count);
11445        motion = Math.min(motion, max_motion);
11446    }
11447
11448    return Math.max(0, motion);
11449}
11450
11451(function(){
11452    $(document)
11453        .on('touchstart.tabSwipe', '.tabs .tab-box', function(e) {
11454            if($(window).width() >= 991) return;
11455
11456            var touch = e.originalEvent.touches && e.originalEvent.touches[0],
11457                $tab = $(this).closest('.tabs'),
11458                option = getTabSwipeOption($tab);
11459
11460            if(!touch || !option.el || option.tab_line != 1 || !option.tab_count || option.tab_len <= option.tab_count) return;
11461
11462            $(this).stop(true, true);
11463            $tab.data('tabSwipe', {
11464                active: true,
11465                locked: false,
11466                horizontal: false,
11467                moved: false,
11468                el: option.el,
11469                motion: option.motion,
11470                motion_style: option.motion_style,
11471                tab_count: option.tab_count,
11472                tab_len: option.tab_len,
11473                tab_case: option.tab_case,
11474                startX: touch.pageX,
11475                startY: touch.pageY,
11476                startMargin: parseFloat($(this).css('margin-left')) || 0,
11477                lastX: touch.pageX,
11478                lastTime: new Date().getTime(),
11479                velocityX: 0
11480            });
11481        })
11482        .on('touchmove.tabSwipe', '.tabs .tab-box', function(e) {
11483            var touch = e.originalEvent.touches && e.originalEvent.touches[0],
11484                $tab = $(this).closest('.tabs'),
11485                swipe = $tab.data('tabSwipe');
11486
11487            if(!touch || !swipe || !swipe.active) return;
11488
11489            var diff_x = touch.pageX - swipe.startX,
11490                diff_y = touch.pageY - swipe.startY;
11491
11492            if(!swipe.locked && (Math.abs(diff_x) > 8 || Math.abs(diff_y) > 8)) {
11493                swipe.locked = true;
11494                swipe.horizontal = Math.abs(diff_x) > Math.abs(diff_y);
11495            }
11496
11497            if(!swipe.horizontal) return;
11498
11499            e.preventDefault();
11500            swipe.moved = Math.abs(diff_x) > 10;
11501
11502            var bounds = getTabMotionBounds(swipe.el),
11503                margin = swipe.startMargin + diff_x;
11504
11505            margin = Math.max(bounds.min, Math.min(bounds.max, margin));
11506            $(this).css('margin-left', margin+'px');
11507
11508            var now = new Date().getTime(),
11509                time_diff = now - swipe.lastTime;
11510
11511            if(time_diff > 0) swipe.velocityX = (touch.pageX - swipe.lastX) / time_diff;
11512            swipe.lastX = touch.pageX;
11513            swipe.lastTime = now;
11514        })
11515        .on('touchend.tabSwipe touchcancel.tabSwipe', '.tabs .tab-box', function(e) {
11516            var $tab = $(this).closest('.tabs'),
11517                swipe = $tab.data('tabSwipe');
11518
11519            if(!swipe || !swipe.active) return;
11520
11521            if(!swipe.horizontal) {
11522                $tab.removeData('tabSwipe');
11523                return;
11524            }
11525
11526            var bounds = getTabMotionBounds(swipe.el),
11527                margin = parseFloat($(this).css('margin-left'));
11528
11529            if(isNaN(margin)) margin = swipe.startMargin;
11530            margin = Math.max(bounds.min, Math.min(bounds.max, margin));
11531
11532            if(swipe.moved) {
11533                $tab.data('tabSwipeBlockClick', true);
11534                setTimeout(function(){
11535                    $tab.removeData('tabSwipeBlockClick');
11536                }, 300);
11537            }
11538
11539            var glide = (e.type == 'touchcancel') ? 0 : swipe.velocityX * 220,
11540                glide_limit = 240,
11541                end_margin = margin + Math.max(-glide_limit, Math.min(glide_limit, glide)),
11542                duration = Math.min(420, Math.max(160, Math.abs(end_margin - margin) * 1.6));
11543
11544            end_margin = Math.max(bounds.min, Math.min(bounds.max, end_margin));
11545
11546            var motion = getTabMotionByMargin(swipe.el, end_margin, swipe.motion_style, swipe.tab_count, swipe.tab_len);
11547            $('.'+swipe.el).attr('tab-motion', motion);
11548            updateTabArrowState(swipe.el, motion, swipe.tab_len, swipe.motion_style, swipe.tab_count);
11549
11550            if(Math.abs(end_margin - margin) > 2) {
11551                $(this).stop(true, true).animate({marginLeft : end_margin+'px'}, duration);
11552            } else {
11553                $(this).css('margin-left', end_margin+'px');
11554            }
11555            $tab.removeData('tabSwipe');
11556        })
11557        .on('click.tabSwipe', '.tabs .tab-box .tab', function(e) {
11558            if($(this).closest('.tabs').data('tabSwipeBlockClick')) {
11559                e.preventDefault();
11560                e.stopImmediatePropagation();
11561                return false;
11562            }
11563        });
11564})();
11565
11566// var cur = 0;
11567function tabMotion(el, motion, wh, len, motion_style, tab_count, tab_case, tab_counted) {
11568    tab_counted = (typeof tab_counted != 'undefined') ? tab_counted : '';
11569    // console.log('el: '+el+', motion: '+motion+', width: '+wh+', len: '+len+', motion_style: '+motion_style+', tab_count: '+tab_count+', tab_case: '+tab_case+', tab_counted: '+tab_counted);
11570
11571    var mobile_tab_line = $('.'+el).attr('mobile-tab-line');
11572    var tab_line  = ($(window).width() < 991 && typeof mobile_tab_line != 'undefined' && mobile_tab_line) ? mobile_tab_line : $('.'+el).attr('tab-line');
11573    var tab_len = $('.'+el).find('.tab-box .tab:not(.hover)').length,
11574        max_motion = (motion_style == 1) ? Math.max(Number(tab_len) - Number(tab_count), 0) : Math.max(Math.ceil(Number(tab_len) / Number(tab_count)) - 1, 0);
11575
11576    motion = Number(motion);
11577    if(isNaN(motion)) motion = 0;
11578    if(motion < 0) motion = 0;
11579    if(motion > max_motion) motion = max_motion;
11580    $('.'+el).attr('tab-motion', motion);
11581    updateTabArrowState(el, motion, tab_len, motion_style, tab_count);
11582
11583    var cur = 0,
11584        cur = cur + motion;
11585
11586    if(tab_case == 'tab6') {
11587        var num = Number(tab_count) + Number(motion);
11588        $('.'+el).find('.tab-box .tab').removeClass('line');
11589        $('.'+el).find('.tab-box .tab').addClass('line');
11590        if(motion_style == 1) {
11591            $('.'+el).find('.tab-box .tab').removeClass('hide-line');
11592            $('.'+el).find('.tab-box .tab:eq('+ num +')').addClass('hide-line');
11593            $('.'+el).find('.tab-box .tab:eq('+ motion +')').addClass('hide-line');
11594        } else {
11595            var line_r = Number(tab_count) + (Number(motion) * Number(tab_count)),
11596                line_l = Number(tab_count) * Number(motion);
11597            $('.'+el).find('.tab-box .tab').removeClass('hide-line');
11598            $('.'+el).find('.tab-box .tab:eq('+ line_r +')').addClass('hide-line');
11599            $('.'+el).find('.tab-box .tab:eq('+ line_l +')').addClass('hide-line');
11600        }
11601    }
11602    
11603    if(cur >= len) cur = 0;
11604    else if(cur < 0) cur = len - 1;
11605
11606
11607
11608    if(tab_line == 1) {
11609        if(motion_style == 1) {
11610            var margin = getTabMotionMargin(el, motion);
11611            $('.'+el).find('.tab-box').animate({marginLeft : margin+'px'});
11612        } else {
11613            var margin = getTabMotionMargin(el, Number(motion) * Number(tab_count));
11614            $('.'+el).find('.tab-box').animate({marginLeft : margin+'px'});
11615        }
11616    }
11617}
11618
11619function tabArrow(el) {
11620    //resize는 블럭script에서 처음 로드시 실행
11621    var w = $(window).width(),
11622        h = $('.'+el).attr("tab-height"),
11623        h991 = 80 / 100 * h,
11624        h767 = 60 / 100 * h,
11625        navi_use = $('.'+el).attr("navigation-use"),
11626        mobile_tab_line = $('.'+el).attr("mobile-tab-line"),
11627        mobile_tab_count = $('.'+el).attr("mobile-tab-count"),
11628        tab_line = (w < 991 && typeof mobile_tab_line != 'undefined' && mobile_tab_line) ? mobile_tab_line : $('.'+el).attr("tab-line"),
11629        tab_count = (w < 991 && typeof mobile_tab_count != 'undefined' && mobile_tab_count) ? mobile_tab_count : 4,
11630        tab_len = $('.'+el).find(".tab-box .tab:not(.hide)").length,
11631        tab_width = $('.'+el).find(".tab-width");
11632    if(w < 991 && w > 767) {
11633        $('.'+el+' .tab-box').css("min-height", h991 + "px");
11634        $('.'+el+' .tab').css("min-height", h991 + "px");
11635        if(tab_line == "1" && tab_len > Number(tab_count)) {
11636            tab_width.find(".arrow-box").removeClass("hide").find(".arrow").removeClass("hide").find(".before, .after").css({"display":"flex","align-items":"center"});
11637            updateTabArrowState(el, $('.'+el).attr('tab-motion'), tab_len, $('.'+el).attr('tab-motion-style'), tab_count);
11638        } else tab_width.find(".arrow-box").addClass("hide").find(".arrow").addClass("hide").find(".before, .after").css("display", "");
11639    } else if(w <= 767) {
11640        $('.'+el+' .tab-box').css("min-height", h767 + "px");
11641        $('.'+el+' .tab').css("min-height", h767 + "px");
11642        if(tab_line == "1" && tab_len > Number(tab_count)) {
11643            tab_width.find(".arrow-box").removeClass("hide").find(".arrow").removeClass("hide").find(".before, .after").css({"display":"flex","align-items":"center"});
11644            updateTabArrowState(el, $('.'+el).attr('tab-motion'), tab_len, $('.'+el).attr('tab-motion-style'), tab_count);
11645        } else tab_width.find(".arrow-box").addClass("hide").find(".arrow").addClass("hide").find(".before, .after").css("display", "");
11646    } else if(w > 991) {
11647        $('.'+el+' .tab-box').css("min-height", h + "px");
11648        $('.'+el+' .tab').css("min-height", h + "px");
11649        if(navi_use == "0" && tab_len > 4 && tab_line == "1") tab_width.find(".arrow-box").addClass("hide").find(".arrow").addClass("hide").find(".before, .after").css("display", "");
11650        else if(navi_use == "1" && tab_line == "1" && tab_len > Number($('.'+el).attr("tab-count"))) {
11651            tab_width.find(".arrow-box").removeClass("hide").find(".arrow").removeClass("hide").find(".before, .after").css({"display":"flex","align-items":"center"});
11652            updateTabArrowState(el, $('.'+el).attr('tab-motion'), tab_len, $('.'+el).attr('tab-motion-style'), $('.'+el).attr("tab-count"));
11653        }
11654    }
11655}
11656
11657// history-block line align
11658function lineAlign(el) {
11659    var $el = $('.'+el);
11660
11661    if(!$el.length) return;
11662
11663    var $dots = $el.find('.timeline-box > .timeline-dot, .timeline-item .timeline-dot').filter(':visible'),
11664        $firstDot = $dots.first(),
11665        $lastDot = $dots.last(),
11666        $timelineLines = $el.find('.timeline-item .timeline-line'),
11667        $sampleLine = $timelineLines.first(),
11668        $lineWrap = $el.find('.timeline-items').first(),
11669        lineWidth = parseFloat($sampleLine.css('width')) || parseFloat($sampleLine.outerWidth()) || 1,
11670        lineColor = $sampleLine.css('background-color') || $sampleLine.css('border-left-color') || '#b7aa9b',
11671        isSideNav = $('.dsgn-body').hasClass('sidebar')
11672            || $('body').is('[data-clnav-layout="sidenav"]')
11673            || $('.cl-nav[data-layout="sidenav"], header[data-layout="sidenav"]').length > 0;
11674    if(!$lineWrap.length) $lineWrap = $el;
11675    if($lineWrap[0] !== $el[0]) $el.children('.history-timeline-line').remove();
11676
11677    var $line = $lineWrap.children('.history-timeline-line');
11678
11679    if(lineColor == 'rgba(0, 0, 0, 0)' || lineColor == 'transparent') {
11680        lineColor = $sampleLine.css('border-left-color') || '#b7aa9b';
11681    }
11682
11683    if(isSideNav) {
11684        $el.find('.history-timeline-line').remove();
11685        if($el.is('[data-history-line-position="true"]')) $el.removeAttr('data-history-line-position').css('position', '');
11686        $timelineLines.show();
11687        return;
11688    }
11689
11690    $timelineLines.hide();
11691
11692    if($dots.length < 2) {
11693        $line.remove();
11694        return;
11695    }
11696
11697    if(!$line.length) {
11698        $line = $('<div class="history-timeline-line" data-runtime="history-line"></div>').prependTo($lineWrap);
11699    }
11700
11701    if($lineWrap[0] === $el[0] && $el.css('position') == 'static') $el.attr('data-history-line-position', 'true').css('position', 'relative');
11702
11703    var elOffset = $lineWrap.offset(),
11704        firstCenterX = $firstDot.offset().left + ($firstDot.outerWidth() / 2),
11705        firstCenterY = $firstDot.offset().top + ($firstDot.outerHeight() / 2),
11706        lastCenterY = $lastDot.offset().top + ($lastDot.outerHeight() / 2),
11707        left = Math.round(firstCenterX - elOffset.left - (lineWidth / 2)),
11708        top = Math.round(firstCenterY - elOffset.top),
11709        height = Math.max(Math.round(lastCenterY - firstCenterY), 0);
11710
11711    $line.css({
11712        position: 'absolute',
11713        left: left+'px',
11714        top: top+'px',
11715        width: lineWidth+'px',
11716        height: height+'px',
11717        backgroundColor: lineColor,
11718        zIndex: 0,
11719        pointerEvents: 'none'
11720    });
11721}
11722
11723function getHistoryBlockLineAlignName($block) {
11724    var el = $block.attr('data-name'),
11725        match;
11726
11727    if(!el) {
11728        match = ($block.attr('class') || '').match(/(?:^|\s)(userEL\d+)(?:\s|$)/);
11729        el = (match) ? match[1] : '';
11730    }
11731
11732    return el;
11733}
11734
11735function lineAlignHistoryBlocks(scope) {
11736    var $scope = (scope) ? $(scope) : $(document),
11737        selector = '[data-type="contents"][data-type2="history"], .history-block';
11738
11739    $scope.find(selector).addBack(selector).each(function() {
11740        var el = getHistoryBlockLineAlignName($(this));
11741        if(el) lineAlign(el);
11742    });
11743}
11744
11745$(window).on('load resize', function() {
11746    clearTimeout(window._historyLineAlignTimer);
11747    window._historyLineAlignTimer = setTimeout(function() {
11748        lineAlignHistoryBlocks();
11749    }, 100);
11750});
11751
11752$(function() {
11753    setTimeout(function() {
11754        lineAlignHistoryBlocks();
11755    }, 100);
11756    setTimeout(function() {
11757        lineAlignHistoryBlocks();
11758    }, 500);
11759});
11760
11761$(document).on('load', '[data-type="contents"][data-type2="history"] img, .history-block img', function() {
11762    lineAlignHistoryBlocks($(this).closest('[data-type="contents"][data-type2="history"], .history-block'));
11763});
11764
11765$(document).ajaxComplete(function() {
11766    setTimeout(function() {
11767        lineAlignHistoryBlocks();
11768    }, 100);
11769    setTimeout(function() {
11770        lineAlignHistoryBlocks();
11771    }, 500);
11772});
11773
11774function channelTalkHide(isHide) {        
11775    if(isHide) {
11776        $('#ch-plugin, .cl-cts-banner').fadeOut().attr('style','z-index: 1 !important; pointer-events: none !important;');
11777    } else {
11778        $('#ch-plugin, .cl-cts-banner').fadeIn().attr('style','z-index: 10000000 !important; pointer-events: auto !important;');
11779    }
11780}
11781
11782window.onload = function() {
11783    var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false,
11784        scroll_body = '.dashbottom-wrap',
11785        scrollTarget = document.querySelector('.dashbottom-wrap');
11786
11787    switch(this_page) {
11788        case 'plan':
11789        case 'billing':
11790            scroll_body = '.sub.sub-page';
11791            scrollTarget = document.querySelector('.sub.sub-page');
11792            break;
11793        
11794        case 'message':
11795            scroll_body = 'html';
11796            scrollTarget = window;
11797            break;
11798
11799        default:
11800            break;
11801    }
11802
11803    if(scrollTarget != null) {
11804        scrollTarget.addEventListener('scroll', function(e) {
11805            if($('#ch-plugin, .cl-cts-banner').length == 0) return;
11806            var isScrollAtBottom = (($(scroll_body).outerHeight() + $(scroll_body).scrollTop() + (isMobile ? 10 : 0)) >=  $(scroll_body).get(0).scrollHeight) ? true : false;
11807            // $('#popup-title').html('<p style="font-size: 9px;">'+isScrollAtBottom+' = '+($(scroll_body).outerHeight() + $(scroll_body).scrollTop() + (isMobile ? 10 : 0))+' >= '+$(scroll_body).get(0).scrollHeight+'</p>');
11808            if (isScrollAtBottom) {
11809                if(!$('body').is('.channelTalkHide')) {
11810                    $('body').addClass('channelTalkHide');
11811                    channelTalkHide(true);
11812                }
11813            } else {
11814                if($('body').is('.channelTalkHide')) {
11815                    $('body').removeClass('channelTalkHide');
11816                    channelTalkHide(false);
11817                }
11818            }
11819        });
11820    }
11821
11822    if(this_page == 'settings' && typeof faviconPreload == 'function') faviconPreload();
11823
11824    if(this_page == 'manager') {
11825        $('.member_disabled, .dropdown.member_disabled + svg').off('click');
11826        $('.member_disabled, .dropdown.member_disabled + svg').on('click', function(e){
11827            e.preventDefault();
11828            e.stopPropagation();
11829            if(!$('#flat-modal').length) siteNotice('manager');
11830            return false;
11831        });
11832        $('select.member_disabled').off('mousedown');
11833        $('select.member_disabled').on('mousedown', function(e){
11834            e.preventDefault();
11835            e.stopPropagation();
11836            if(!$('#flat-modal').length) siteNotice('manager');
11837            return false;
11838        });
11839        $('.shopping_disabled, .dropdown.shopping_disabled + svg').off('click');
11840        $('.shopping_disabled, .dropdown.shopping_disabled + svg').on('click', function(e){
11841            e.preventDefault();
11842            e.stopPropagation();
11843            if(!$('#flat-modal').length) siteNotice('shopping');
11844            return false;
11845        });        
11846    }
11847    if(this_page == 'shopping') {
11848        $('.shopping_disabled').off('click');
11849        $('.shopping_disabled').on('click', function(e){
11850            e.preventDefault();
11851            e.stopPropagation();
11852            if(!$('#flat-modal').length) siteNotice('shopping');
11853            return false;
11854        });
11855    }
11856}
11857
11858function emojiEncode(text) {
11859    // 이모지만을 포함하는 정규 표현식
11860    var emojiRegex = /[\u{1F300}-\u{1F5FF}\u{1F600}-\u{1F64F}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2B50}\u{2B55}]/gu;
11861    
11862    // 입력 텍스트에서 이모지만을 추출하여 배열로 저장
11863    var emojis = text.match(emojiRegex) || [];
11864
11865    // 이모지를 유니코드 이스케이프로 변환하고, 이를 원래 위치에 대체
11866    emojis.forEach(function(emoji) {
11867        var codePoints = [];
11868        for (var i = 0; i < emoji.length; i++) {
11869            codePoints.push('\\u' + emoji.charCodeAt(i).toString(16));
11870        }
11871        text = text.replace(emoji, codePoints.join(''));
11872    });
11873
11874    return text;
11875}
11876
11877function emojiDecode(escapedString) {
11878    return escapedString.replace(/\\u[\dA-F]{4}/gi, match => String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)));
11879}
11880
11881function focusAtEnd(input) {
11882    input.focus();
11883    var value = input.val();
11884    input.val('');
11885    input.val(value);
11886}
11887
11888function clCheckBrowser(browser) {
11889    if(typeof browser == 'undefined' || !browser) return false;
11890
11891    var is_tablet = /Android|iPad/i.test(navigator.userAgent);
11892    var is_mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
11893    var is_pc = !is_mobile && !is_tablet;
11894    var is_chrome = /Chrome|CriOS/i.test(navigator.userAgent);
11895    var is_safari = /Safari/i.test(navigator.userAgent) && !/Chrome|CriOS/i.test(navigator.userAgent);
11896    var is_firefox = /Firefox/i.test(navigator.userAgent);
11897    var is_edge = /Edg/i.test(navigator.userAgent) || /Edge/i.test(navigator.userAgent);
11898    var is_opera = /OPR/i.test(navigator.userAgent) || /Opera/i.test(navigator.userAgent);
11899    var is_ie = /MSIE/i.test(navigator.userAgent) || /Trident/i.test(navigator.userAgent);
11900    var is_kakao = /KAKAOTALK/i.test(navigator.userAgent);
11901
11902    switch(browser.trim().toLowerCase()) {
11903        case 'tablet': return is_tablet; break;
11904        case 'mobile': return is_mobile; break;
11905        case 'pc': return is_pc; break;
11906
11907        case 'chrome': return is_chrome; break;
11908        case 'safari': return is_safari; break;
11909        case 'firefox': return is_firefox; break;
11910        case 'edge': return is_edge; break;
11911        case 'opera': return is_opera; break;
11912        case 'ie': return is_ie; break;
11913        case 'kakao': return is_kakao; break;
11914
11915        default: return false; break;
11916    }
11917}
11918
11919function hasTouch() {
11920    // Android Phone|iPhone|iPad|Touch-enabled laptop 
11921    return navigator.maxTouchPoints > 0;
11922}
11923function isIOS() {
11924    const ua = navigator.userAgent;
11925    // 기본 iOS 디바이스
11926    const iOSDevice = /iPhone|iPad|iPod/i.test(ua);
11927    // iPadOS 13+ (Mac으로 위장하는 경우)
11928    const iPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
11929    // iPhone Safari | Mac Safari  (iPhone|Android Chrome == false)
11930    // const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
11931    return iOSDevice || iPadOS;
11932}
11933function getScroller() {
11934    var configBody = document.querySelector('.dsgn-body.mode-config');
11935    if (!configBody) return window;
11936    if (typeof $.clnav !== 'undefined' && $.clnav.check()) return window;
11937    return configBody;
11938}
11939var baseParallaxAnimations = {
11940    'horizontal-right': function (layer, el, st) {
11941        return gsap.fromTo(layer, { x: -150 }, { x: 150, ease: 'none', scrollTrigger: st });
11942    },
11943    'horizontal-left': function (layer, el, st) {
11944        return gsap.fromTo(layer, { x: 150 }, { x: -150, ease: 'none', scrollTrigger: st });
11945    },
11946    'zoom-in': function (layer, el, st) {
11947        return gsap.fromTo(layer, { scale: 1 }, {
11948            scale: 1.5,
11949            ease: 'none',
11950            transformOrigin: 'center',
11951            scrollTrigger: st
11952        });
11953    },
11954    'zoom-out': function (layer, el, st) {
11955        return gsap.fromTo(layer, { scale: 1.5 }, {
11956            scale: 1,
11957            ease: 'none',
11958            transformOrigin: 'center',
11959            scrollTrigger: st
11960        });
11961    },
11962    'float-down': function (layer, el, st) {
11963        return gsap.fromTo(layer, { y: 0, opacity: 1 }, {
11964            y: el.offsetHeight,
11965            opacity: 0,
11966            ease: 'none',
11967            scrollTrigger: $.extend({}, st, { end: 'center center' })
11968        });
11969    },
11970    'float-up': function (layer, el, st) {
11971        return gsap.fromTo(layer, { y: el.offsetHeight, opacity: 0 }, {
11972            y: 0,
11973            opacity: 1,
11974            ease: 'power2.out',
11975            scrollTrigger: $.extend({}, st, {
11976                start: 'top 50%',
11977                end: 'center center',
11978                toggleActions: 'play none none reverse'
11979            })
11980        });
11981    },
11982    'scroll': function (layer, el, st) {
11983        return gsap.fromTo(layer, { y: -200 }, {
11984            y: 200,
11985            ease: 'none',
11986            scrollTrigger: st
11987        });
11988    }
11989};
11990var customParallaxAnimations = {
11991    'contents140': function (layer, el, st) {
11992        const pinTarget = layer.parentElement;
11993
11994        gsap.set(pinTarget, {
11995            overflow: 'hidden',
11996            position: 'relative'
11997        });
11998
11999        ScrollTrigger.matchMedia({
12000            "(min-width: 768px)": function () {
12001                gsap.fromTo(layer, {
12002                    scale: 1.5
12003                }, {
12004                    scale: 1,
12005                    ease: "none",
12006                    transformOrigin: "center center",
12007                    scrollTrigger: {
12008                        ...st,
12009                        trigger: pinTarget,
12010                        pin: true,
12011                        pinSpacing: true,
12012                        start: "top top",
12013                        end: "bottom+=50 top",
12014                        scrub: true
12015                    }
12016                });
12017            },
12018            "(max-width: 767px)": function () {
12019                gsap.fromTo(layer, {
12020                    scale: 2
12021                }, {
12022                    scale: 1,
12023                    ease: "none",
12024                    transformOrigin: "center center",
12025                    scrollTrigger: st
12026                });
12027            }
12028        });
12029    }
12030};
12031function resolveAnimationMode(layer, el) {
12032    var mode = layer.dataset.mode || el.getAttribute('data-parallax-effect') || 'scroll';
12033
12034    if (isIOS() && mode === 'fixed') return 'scroll';
12035    return mode;
12036}
12037function setElementRootCss(el, root_set) {
12038    let target;
12039    if(el && el.jquery) {
12040        target = el[0];
12041    } else if(el instanceof Element) {
12042        target = el;
12043    } else if(typeof el === 'string') {
12044        let selector = el;
12045        if(el == 'el-menu' && document.querySelector(`${selector} header`)) selector += ' header';
12046        target = document.querySelector(selector);
12047    }
12048    if(!target) return;
12049
12050    $.each(root_set, function(k, v) {
12051        if(v == null || (typeof v === 'string' && v.trim() === '') || Number.isNaN(v)) {
12052            target.style.removeProperty(k);
12053        } else {
12054            target.style.setProperty(k, v);
12055        }
12056    });
12057}
12058function removeElementRootCss(el, root_key) {
12059    let targets = [];
12060
12061    if(typeof el === 'string') {
12062        let selector = el;
12063        if(document.querySelector(`${selector} header`)) selector += ' header';
12064        targets = Array.from(document.querySelectorAll(selector));
12065    } else if(el instanceof Element) {
12066        targets = [el];
12067    } else if(el && el.jquery) {
12068        targets = el.toArray();
12069    }
12070
12071    const removeKey = (key) => {
12072        if(typeof key !== 'string') return;
12073
12074        targets.forEach((target) => {
12075            if(!target) return;
12076
12077            if(key.endsWith('-')) {
12078                const prefix = key;
12079                Array.from(target.style).forEach(styleName => {
12080                    if(styleName.startsWith(prefix)) target.style.removeProperty(styleName);
12081                });
12082            } else {
12083                target.style.removeProperty(key);
12084            }
12085        });
12086    };
12087
12088    if(Array.isArray(root_key)) root_key.forEach(removeKey);
12089    else removeKey(root_key);
12090}
12091function prepareParallaxDOM(el, media) {
12092    let $el = (el instanceof jQuery) ? el : $(el);
12093    $el = $el.closest('.element');
12094
12095    const parallax_media = media || $el.attr('data-parallax-media') || 'background';
12096    const parallax_mode = $el.attr('data-parallax-effect') || 'fixed';
12097    const $elem = $el.closest('.elem').length > 0 ? $el.closest('.elem') : $el;
12098
12099    if($.inArray(parallax_mode, ['fixed']) > -1) {
12100        $el.find(`.parallax-layer[data-media="${parallax_media}"]`).remove();
12101        if($elem.length > 0) removeElementRootCss($elem, '--parallax-');
12102    }
12103    else if($.inArray(parallax_mode, ['scroll']) > -1) {
12104        if(parallax_media === 'background') {
12105            var bgImage = $el.css('background-image');
12106            if ((!bgImage || bgImage === 'none') && $el.attr('data-type') == 'page_bottom') {
12107                var _pbBgVar = getComputedStyle($el[0]).getPropertyValue('--pb-background-image-url').trim();
12108                if(_pbBgVar && _pbBgVar !== 'none') bgImage = _pbBgVar.match(/^url\(/) ? _pbBgVar : 'url(' + _pbBgVar + ')';
12109            }
12110            if (!bgImage || bgImage === 'none') return;
12111
12112            setElementRootCss($elem, {
12113                '--parallax-bgimg': bgImage,
12114                '--parallax-bgimg-size': 'cover',
12115                '--parallax-bgimg-position': '50% 0',
12116                '--parallax-bgimg-repeat': 'repeat-y',
12117                '--parallax-bgimg-attachment': 'scroll',
12118            });
12119        }
12120
12121        if($el.find(`.parallax-layer[data-media="${parallax_media}"]`).length === 0) {
12122            $el.prepend(`<div class="parallax-layer" data-media="${parallax_media}"></div>`);
12123        }
12124        const $layer = $el.find(`.parallax-layer[data-media="${parallax_media}"]`).last();
12125        $layer.attr({
12126            'data-mode': parallax_mode,
12127        });
12128
12129        $elem.addClass('_parallax_visible');
12130    }
12131}
12132
12133function setBlockParallaxGsap(target, media, retry) {
12134    retry = retry || 0;
12135    if (typeof ScrollTrigger === 'undefined') return;
12136
12137    gsap.registerPlugin(ScrollTrigger);
12138
12139    setTimeout(function () {
12140        var selectors = [];
12141        if (!media) selectors.push('.parallax-layer')
12142        else selectors.push(`.parallax-layer[data-media="${media}"]`);
12143        var layers = [];
12144
12145        if (typeof target === 'string') {
12146            var finalSelector = selectors
12147                .map(function (sel) {
12148                    return target ? '.' + target + ' ' + sel : sel;
12149                })
12150                .join(', ');
12151            layers = gsap.utils.toArray(finalSelector);
12152        } else {
12153            var targetElements = [];
12154            if (target instanceof jQuery) {
12155                targetElements = target.toArray();
12156            } else if (target) {
12157                targetElements = gsap.utils.toArray(target);
12158            }
12159
12160            if (targetElements.length) {
12161                targetElements.forEach(function (targetEl) {
12162                    var $scope = $(targetEl).closest('.elem');
12163                    if (!$scope.length) {
12164                        $scope = $(targetEl);
12165                    }
12166                    selectors.forEach(function (sel) {
12167                        layers = layers.concat($scope.find(sel).toArray());
12168                    });
12169                });
12170            } else if (!target) {
12171                layers = gsap.utils.toArray(selectors.join(', '));
12172            }
12173        }
12174
12175        if (!layers.length && retry < 5) {
12176            return setBlockParallaxGsap(target, media, retry + 1);
12177        }
12178
12179        var scroller = getScroller();
12180
12181        layers.forEach(function (layer) {
12182            var media = layer.dataset.media;
12183            var target_conf = {
12184                background: {
12185                    selector: '[data-parallax]',
12186                    check: function (el) {
12187                        return el.hasAttribute('data-parallax');
12188                    }
12189                },
12190                image: {
12191                    selector: '[data-img-parallax]',
12192                    check: function (el) {
12193                        return el.hasAttribute('data-img-parallax');
12194                    }
12195                }
12196            };
12197            var conf = target_conf[media];
12198            // var target = layer._parallaxTarget || ((layer.dataset.mode === 'fixed') ? layer.nextElementSibling : layer.parentElement);
12199            var target = layer.parentElement;
12200            while (target && conf && !target.matches(conf.selector)) {
12201                target = target.closest(conf.selector);
12202            }
12203            var enabled = false;
12204            if (conf && target) {
12205                enabled = conf.check(target);
12206            }
12207            gsap.killTweensOf(layer);
12208            if (layer._parallaxTrigger) {
12209                layer._parallaxTrigger.kill();
12210                layer._parallaxTrigger = null;
12211            }
12212
12213            if (!enabled) {
12214                gsap.set(layer, { clearProps: 'all' });
12215                return;
12216            }
12217            var animationMode = resolveAnimationMode(layer, target);
12218            if (!animationMode) return;
12219
12220            var stConfig = {
12221                trigger: target,
12222                scroller: scroller,
12223                scrub: true,
12224                start: 'top bottom',
12225                invalidateOnRefresh: true
12226            };
12227
12228            var animate =
12229                    customParallaxAnimations[animationMode] ||
12230                    baseParallaxAnimations[animationMode] ||
12231                    baseParallaxAnimations.scroll;
12232            layer._parallaxTrigger = animate(layer, target, stConfig) || null;
12233        });
12234
12235        ScrollTrigger.refresh();
12236    }, 50);
12237}
12238function setBlockParallax(el, override) {
12239    const $targets = (el instanceof jQuery) ? el : $(el);
12240    if ($targets.length === 0) return false;
12241
12242    const hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
12243    const getOverrideValue = (obj, keys) => {
12244        if (!obj || typeof obj !== 'object') return undefined;
12245
12246        for (let i = 0; i < keys.length; i++) {
12247            if (hasOwn(obj, keys[i])) return obj[keys[i]];
12248        }
12249
12250        return undefined;
12251    };
12252
12253    $targets.each(function () {
12254        const $target = $(this);
12255        const parallax_enabled_raw = getOverrideValue(override, ['enabled', 'parallax', 'data-parallax']);
12256        const parallax_mode_raw = getOverrideValue(override, ['effect', 'mode', 'parallaxEffect', 'data-parallax-effect']);
12257        const parallax_media_raw = getOverrideValue(override, ['media', 'parallaxMedia', 'data-parallax-media']);
12258
12259        const parallax_enabled = (typeof parallax_enabled_raw !== 'undefined')
12260            ? (String(parallax_enabled_raw) === 'true' || parallax_enabled_raw === true)
12261            : $target.is('[data-parallax="true"]');
12262
12263        let parallax_mode = (typeof parallax_mode_raw !== 'undefined' && parallax_mode_raw !== '')
12264            ? String(parallax_mode_raw)
12265            : ($target.attr('data-parallax-effect') || 'fixed');
12266        let parallax_media = (typeof parallax_media_raw !== 'undefined' && parallax_media_raw !== '')
12267            ? String(parallax_media_raw)
12268            : ($target.attr('data-parallax-media') || 'background');
12269
12270        if(!parallax_enabled) {
12271            $target.removeAttr('data-parallax data-parallax-effect data-parallax-media');
12272            $target.find('.parallax-layer').remove();
12273
12274            removeElementRootCss($target,'--parallax-');
12275        }
12276        else {
12277            if(isIOS() && parallax_mode === 'fixed') parallax_mode = 'scroll';
12278
12279            $target.attr('data-parallax','true');
12280            $target.attr('data-parallax-effect',parallax_mode);
12281            $target.attr('data-parallax-media',parallax_media);
12282
12283            prepareParallaxDOM($target, parallax_media);
12284            if($.inArray(parallax_mode, ['scroll']) > -1) setBlockParallaxGsap($target, parallax_media);
12285        }
12286    });
12287}
12288
12289function colorisSetVal(color, target, $context = $('.bc-style')) {
12290    if (!Coloris.getColorRegex().test(color)) return;
12291    const coloris_selector = `.coloris-picker .coloris[data-root="${target.root}"][selector="${target.selector}"]`;
12292    const $elements = $context.find(coloris_selector);
12293
12294    $elements.each(function () {
12295        const $el = $(this);
12296        let finalColor = color;
12297
12298        if ($el.hasClass('clr-alphaoff')) {
12299            finalColor = Coloris.getChangeColorVal(color, 'a', 1);
12300        }
12301
12302        $el.val(finalColor);
12303
12304        const colorInfo = Coloris.getColorInfo(finalColor, 'rgba');
12305        const rgbaString = typeof colorInfo === 'string' ? colorInfo : colorInfo.rgba || '';
12306
12307        $el.closest('.clr-field').css('color', rgbaString);
12308    });
12309}
12310
12311function colorisBind() {
12312    document.querySelector('.coloris-picker input').setAttribute('autocomplete', 'off');
12313    if($('.coloris-picker > .coloris').length > 0) Coloris.wrap('.coloris-picker > .coloris');
12314}
12315
12316function getOrDefaultRootcss(obj, key, def, selector) {
12317    let val;
12318    if(typeof obj == 'object') val = (typeof key == 'string' && key != '') ? obj[key] : obj;
12319    else if(typeof obj == 'string' && key == '') val = obj;
12320    
12321    var root_key = (key != '') ? key.replace(/\_/gi,'-') : '';
12322
12323    if(typeof val === 'undefined') {
12324        if(typeof selector != 'undefined' && selector != '' && document.querySelector(selector)) {
12325            var now_style = getComputedStyle(document.querySelector(selector));
12326            if( typeof now_style.getPropertyValue(root_key) != 'undefined' && 
12327                now_style.getPropertyValue(root_key) != ''
12328            ) {
12329                val = now_style.getPropertyValue(root_key);
12330                // if(/-fsize$/.test(key)) result = Number(cssNumber(result));
12331            }
12332        }
12333    }
12334
12335    if(typeof val === 'undefined') return def;
12336
12337    if (typeof def === 'number') {
12338        val = cssNumber(val);
12339
12340        if (!isNaN(val) && val !== '') return Number(val);
12341        return def;
12342    }
12343
12344    if (typeof def === 'boolean') {
12345        if (typeof val === 'boolean') return val;
12346        if (typeof val === 'string') return val === 'true';
12347        return Boolean(val);
12348    }
12349
12350    return String(val);
12351}
12352function getOrDefault(obj, key, def) {
12353    let val;
12354    if(typeof obj == 'object') val = (typeof key == 'string' && key != '') ? obj[key] : obj;
12355    else if(typeof obj == 'string' && key == '') val = obj;
12356
12357    if(typeof val === 'undefined') return def;
12358
12359    if (typeof def === 'number') {
12360        if (!isNaN(val) && val !== '') return Number(val);
12361        return def;
12362    }
12363
12364    if (typeof def === 'boolean') {
12365        if (typeof val === 'boolean') return val;
12366        if (typeof val === 'string') return val === 'true';
12367        return Boolean(val);
12368    }
12369
12370    if (Array.isArray(def)) {
12371        if(!Array.isArray(val) && val != '') val = val.split(',');
12372        return Array.isArray(val) ? val : def;
12373    }
12374
12375    if (typeof def === 'object') {
12376        return (val && typeof val === 'object' && !Array.isArray(val)) ? val : def;
12377    }
12378
12379    if(val === '') return def;
12380    return String(val);
12381}
12382
12383function setResourceBtn(isOpen,obj) {
12384    if(typeof obj == 'undefined') obj = {};
12385
12386    if(typeof selectCount != 'undefined') selectCount = getOrDefault(obj,'maxcount',0);
12387    if(selectCount > 1) selectCount = 1;
12388
12389    document.querySelectorAll('.resource-useit').forEach(el => {
12390        [...el.attributes].forEach(attr => {
12391            if (attr.name.startsWith('data-')) {
12392                el.removeAttribute(attr.name);
12393            }
12394        });
12395        
12396        for (let key in obj) {
12397            if (obj.hasOwnProperty(key)) {
12398                el.setAttribute(`data-${key}`, obj[key] || '');
12399            }
12400        }
12401    });
12402
12403    var imgtype = (typeof obj.imgtype != 'undefined' && obj.imgtype) ? obj.imgtype : '';
12404    if(imgtype.indexOf('default') > -1 && isOpen) $('#el-iconstorage').modal('show');  
12405    else {
12406        if(isOpen) $('#el-fileupload').modal('show');
12407    }
12408    
12409}
12410
12411function resizeVideoIframe(tag) {
12412    if($(tag).find('iframe').length === 0 || $(tag).find('[data-bg-type="background"]').length == 0) return;
12413    var iframe = $(tag).find('.container'),
12414        width = iframe.width(),
12415        p_height = iframe.height(),
12416        height = (width / 16) * 9;
12417    if(p_height > height) height = p_height;
12418    iframe.find('iframe').height(height);
12419    initBgVimeoIframe(tag);
12420}
12421
12422function initBgVimeoIframe(tag) {
12423    var root = (tag && tag.jquery) ? tag.get(0) : tag;
12424    if(!root || !root.querySelectorAll) return;
12425
12426    var iframes = root.querySelectorAll('[data-bg-video="true"][data-bg-type="background"] iframe[src*="player.vimeo.com"]');
12427    if(!iframes.length) return;
12428
12429    for(var i = 0; i < iframes.length; i++) {
12430        bindBgVimeoIframe(iframes[i]);
12431    }
12432}
12433
12434function bindBgVimeoIframe(iframe) {
12435    if(!iframe || iframe._bgVimeoLoadBound === true) return;
12436    iframe._bgVimeoLoadBound = true;
12437
12438    iframe.classList.remove('loaded');
12439    iframe.removeAttribute('data-ready');
12440    iframe.removeAttribute('data-vimeo-bg-ready');
12441    iframe.removeAttribute('data-vimeo-bg-load-bound');
12442    iframe.setAttribute('data-vimeo-bg-load-bound', 'true');
12443
12444    var shown = false,
12445        fallbackTimer = null;
12446
12447    var showIframe = function() {
12448        if(shown) return;
12449        shown = true;
12450        if(fallbackTimer) window.clearTimeout(fallbackTimer);
12451        iframe.setAttribute('data-vimeo-bg-ready', 'true');
12452        iframe.classList.add('loaded');
12453    };
12454
12455    fallbackTimer = window.setTimeout(showIframe, 4000);
12456
12457    loadBgVimeoApi(function(loaded) {
12458        if(!loaded || !window.Vimeo || !window.Vimeo.Player) {
12459            window.setTimeout(showIframe, 1500);
12460            return;
12461        }
12462
12463        var player;
12464        try {
12465            player = new window.Vimeo.Player(iframe);
12466        } catch(e) {
12467            window.setTimeout(showIframe, 1500);
12468            return;
12469        }
12470
12471        player.ready().then(function() {
12472            player.on('play', function() {
12473                window.setTimeout(showIframe, 300);
12474            });
12475            player.on('timeupdate', function(data) {
12476                if(data && data.seconds > 0.05) showIframe();
12477            });
12478            if(player.getCurrentTime) {
12479                player.getCurrentTime().then(function(seconds) {
12480                    if(seconds > 0.05) showIframe();
12481                });
12482            }
12483        }).catch(function() {
12484            window.setTimeout(showIframe, 1500);
12485        });
12486    });
12487}
12488
12489function loadBgVimeoApi(callback) {
12490    if(window.Vimeo && window.Vimeo.Player) {
12491        callback(true);
12492        return;
12493    }
12494
12495    window._bgVimeoApiCallbacks = window._bgVimeoApiCallbacks || [];
12496    window._bgVimeoApiCallbacks.push(callback);
12497
12498    if(window._bgVimeoApiLoading) return;
12499    window._bgVimeoApiLoading = true;
12500
12501    var script = document.createElement('script');
12502    script.src = 'https://player.vimeo.com/api/player.js';
12503    script.onload = function() {
12504        flushBgVimeoApiCallbacks(true);
12505    };
12506    script.onerror = function() {
12507        flushBgVimeoApiCallbacks(false);
12508    };
12509    document.head.appendChild(script);
12510}
12511
12512function flushBgVimeoApiCallbacks(loaded) {
12513    var callbacks = window._bgVimeoApiCallbacks || [];
12514    window._bgVimeoApiCallbacks = [];
12515    window._bgVimeoApiLoading = false;
12516
12517    for(var i = 0; i < callbacks.length; i++) {
12518        callbacks[i](loaded);
12519    }
12520}
12521
12522if(document.readyState == 'loading') {
12523    document.addEventListener('DOMContentLoaded', function() {
12524        initBgVimeoIframe(document);
12525    });
12526} else {
12527    initBgVimeoIframe(document);
12528}
12529
12530function debounce(func, delay) {
12531  let timer;
12532  return function (...args) {
12533    clearTimeout(timer);
12534    timer = setTimeout(() => func.apply(this, args), delay);
12535  };
12536}
12537
12538window._blockMasonryResizeTargets = window._blockMasonryResizeTargets || [];
12539window._blockMasonryResizeHandler = debounce(() => {
12540    window._blockMasonryResizeTargets.forEach($target => {
12541        if ($target && $target.length > 0) {
12542            reloadBlockMasonry('refresh', $target);
12543        }
12544    });
12545}, 300);
12546
12547function reloadBlockMasonry(fn, msnyEL, items) {
12548    if(typeof fn == 'undefined' || typeof msnyEL == 'undefined' || msnyEL.length === 0) return;
12549
12550    var checkElviewer = msnyEL.hasClass('el_viewblock'),
12551        checkMsny = msnyEL.is('[data-msny="true"]'),
12552        msnyLoop = msnyEL.find('[data-loop="true"]'),
12553        el_type = msnyEL.attr('data-type'),
12554        el_selector = checkElviewer ? '.el_viewblock' : `.${msnyEL.attr('data-name')}`,
12555        item_selector = (el_type === 'gallery') ? '.grid' : '.item';
12556    if(!checkMsny || msnyLoop.is('[data-description]:empty')) {
12557        if(fn != 'init') return;
12558        fn = 'destroy';
12559    }
12560
12561    if(msnyEL.find(`.${el_type}-loading-status`).length == 0)  {
12562        var loadingtag = `<div class="${el_type}-loading-status"><div class="loading-dots"></div></div>`
12563        if(msnyEL.find('[data-loop="true"]').is(':empty')) {
12564            msnyEL.find('[data-loop="true"]').before(loadingtag);
12565        } else {
12566            msnyEL.find('[data-loop="true"]').after(loadingtag);
12567        }
12568    }
12569
12570    if(items) items.hide(); 
12571    var msny_gutter = Number(getComputedStyle(document.querySelector(el_selector)).getPropertyValue('--layout-gap-col')) || 0;
12572    if($('body').outerWidth() <= 787) msny_gutter = msny_gutter * 0.5;
12573    else if($('body').outerWidth() > 787 && $('body').outerWidth() <= 991) msny_gutter = msny_gutter * 0.8;
12574    var msny_opts = {
12575        itemSelector: item_selector,
12576        columnWidth: item_selector,
12577        percentPosition: true,
12578        gutter: msny_gutter,
12579        horizontalOrder: false,
12580        resize: true,
12581        transitionDuration: '0.4s',
12582        stagger: 30
12583    };
12584 
12585    var prevHeight = msnyLoop.outerHeight() || msnyLoop[0].scrollHeight || 200;
12586    msnyLoop.css('min-height', `${prevHeight}px`);
12587
12588    msnyLoop.off('layoutComplete');
12589    msnyLoop.on('layoutComplete', function() {
12590        msnyEL.find(`.${el_type}-loading-status`).remove();
12591        msnyEL.find(item_selector).show();
12592        msnyLoop.css('min-height', '');
12593
12594        //.allhide 다시계산
12595        if(el_type === 'gallery') {
12596            msnyEL.find('.grid figcaption').each(function() {
12597                if($(this).find('.figure:not(.hide, .review[data-review_cnt="false"][data-review_score="false"])').length > 0 && $(this).height() > 0) {
12598                    $(this).removeClass('allhide');
12599                } else {
12600                    $(this).addClass('allhide');
12601                }
12602            });
12603        }
12604    });
12605
12606
12607    function applyMsny(afterinit = false) {
12608        // if(afterinit) console.log('Masonry 초기화 완료!');
12609        msnyLoop.imagesLoaded(function () {
12610            msnyLoop.masonry(msny_opts);
12611        }).progress(function (instance, image) {
12612            $(image.img).closest(item_selector).show();
12613        });
12614    }
12615
12616
12617    if( msnyLoop.data('masonry')
12618        && $.inArray(fn, ['init','destroy']) > -1
12619    ) {
12620        msnyLoop.data('masonry').destroy();
12621        msnyLoop.removeData('masonry');
12622    }
12623
12624    switch(fn) {
12625        case 'destroy':
12626            msnyLoop.css('min-height','');
12627            msnyEL.find(`.${el_type}-loading-status`).remove();
12628            break;
12629
12630        case 'init':
12631            // msnyEL.find(item_selector).hide();
12632            applyMsny(true);
12633
12634            if(typeof window._blockMasonryResizeHandler === 'function') {
12635                window.__masonryResizeTarget = msnyEL;
12636                
12637                if (!window._blockMasonryResizeHandler._registered) {
12638                    window.addEventListener('resize', window._blockMasonryResizeHandler);
12639                    window._blockMasonryResizeHandler._registered = true;
12640                }
12641                
12642                let exists = window._blockMasonryResizeTargets.some($t => $t.is(msnyEL));
12643                if (!exists) {
12644                    window._blockMasonryResizeTargets.push(msnyEL);
12645                }
12646            }
12647            break;
12648
12649        case 'add':
12650            if(items) {
12651                msnyLoop.append(items);
12652                items.imagesLoaded(function () {
12653                    msnyLoop.masonry('appended', items).masonry('layout');
12654                }).progress(function (instance, image) {
12655                    $(image.img).closest(item_selector).show();
12656                });
12657            }
12658            break;
12659
12660        case 'refresh':
12661            msnyLoop.masonry({gutter:msny_opts.gutter});
12662            break;
12663
12664        default:
12665            // console.log(`UNDEFINED fn`,fn);
12666            break;
12667    }
12668}
12669
12670function setOldVerBlockView(viewEL,obj) {
12671    if( typeof viewEL == 'undefined' || $(viewEL).length === 0 
12672        || typeof obj == 'undefined' || $.isEmptyObject(obj) || typeof obj.seq == 'undefined'
12673    ) return false;
12674
12675    var checkElView = (typeof obj.checkElviewer != 'undefined' && obj.checkElviewer === true) ? true : false,
12676        el_selector = `.element[data-id="${obj.seq}"]`;
12677    if(checkElView) el_selector = (typeof obj.elname != 'undefined' && obj.elname) ? `.elviewhtml .${obj.elname}` : '.elviewhtml';
12678
12679    var el_style = getComputedStyle(document.querySelector(el_selector));
12680
12681    var now = new Date();
12682    var check_oldver = '';
12683    switch(obj.type) {
12684        case 'gallery':
12685            if($(viewEL).find('.sh-pcolor').length > 0) $(viewEL).attr('data-ver','1');
12686            if($(viewEL).find('.goption[data-gcol]').length > 0) {
12687                $(viewEL).find('.container').addClass('layout-container');
12688                $(viewEL).find('[data-loop="true"]').addClass('layout-row');
12689
12690                var check_layout = (!el_style.getPropertyValue('--layout-col-p') 
12691                                    && !el_style.getPropertyValue('--layout-gap-row')
12692                                    && !el_style.getPropertyValue('--layout-gap-col')
12693                                    && !el_style.getPropertyValue('--layout-imgh') 
12694                                    && !el_style.getPropertyValue('--layout')
12695                    ) ? true : false;
12696
12697                if(check_layout) {
12698                    if($(viewEL).find('.goption').attr('data-gcol') == '' && $(viewEL).is('[data-case="gallery45"]')) $(viewEL).find('.goption').attr('data-gcol',2);
12699                    var tmp_col = ($(viewEL).find('.goption').is('[data-gcol]')) ? Number($(viewEL).find('.goption').attr('data-gcol') || 1) : 1,
12700                        tmp_col_t = ($(viewEL).find('.goption').is('[data-gcol-t]')) ? Number($(viewEL).find('.goption').attr('data-gcol-t')) : tmp_col ?? 1,
12701                        tmp_col_m = ($(viewEL).find('.goption').is('[data-gcol-m]')) ? Number($(viewEL).find('.goption').attr('data-gcol-m')) : tmp_col_t ?? 1,
12702                        tmp_gap = ($(viewEL).find('.goption').is('[data-gpd]')) ? Number($(viewEL).find('.goption[data-gpd]').attr('data-gpd').trim()) * 2 : 0,
12703                        tmp_imgh = ($(viewEL).find('.goption').is('[data-gh]')) ? $(viewEL).find('.goption').attr('data-gh') : 1;
12704                    if(tmp_imgh == 'auto') tmp_imgh = 1;
12705
12706                    document.querySelectorAll(el_selector).forEach(tmpel=> {
12707                        tmpel.style.setProperty('--layout-col-p', tmp_col, null);
12708                        tmpel.style.setProperty('--layout-col-t', tmp_col_t, null);
12709                        tmpel.style.setProperty('--layout-col-m', tmp_col_m, null);
12710                        tmpel.style.setProperty('--layout-gap-row', tmp_gap, null);
12711                        tmpel.style.setProperty('--layout-gap-col', tmp_gap, null);
12712                        tmpel.style.setProperty('--layout-imgh', tmp_imgh, null);
12713                    });
12714                }
12715            }
12716
12717            var check_gimg = ($(viewEL).find('.grid:eq(0)').find('img.img-responsive').length > 0 
12718                                && $(viewEL).find('.grid:eq(0)').find('.g-img').length > 0
12719                ) ? true : false;
12720            if(check_gimg) $(viewEL).find('.g-img').remove();
12721
12722            var check_basket = (el_style.getPropertyValue('--gallery-figure-title-fname')) ? true : false;
12723            if(check_basket) {
12724                var tmp_basket = {
12725                    __basket_fname: el_style.getPropertyValue('--gallery-figure-title-fname'),
12726                    __basket_fsize: '11px',
12727                    __basket_fweight: 400,
12728                    __basket_color: el_style.getPropertyValue('--gallery-figure-title-color'),
12729                    __basket_color_hover: el_style.getPropertyValue('--gallery-figure-title-color'),
12730                    __basket_bgcolor: 'transparent',
12731                    __basket_bgcolor_hover: 'transparent',
12732                    __basket_line: el_style.getPropertyValue('--gallery-figure-title-color-alpha'),
12733                    __basket_line_hover: el_style.getPropertyValue('--gallery-figure-title-color-alpha2'),
12734                };
12735                $.each(tmp_basket, function(o_rk, o_rv) {
12736                    document.querySelectorAll(el_selector).forEach(tmpel=> {
12737                        tmpel.style.setProperty(o_rk.replace(/\_/gi,'-'), o_rv, null);
12738                    });
12739                });
12740            }
12741
12742            break;
12743        
12744        case 'sync':
12745            var check_option = ($(el_selector).find('input.sync-option').length > 0) ? true : false;
12746            if(check_option) {
12747                
12748                if($(viewEL).find('.container:not(.layout-container)').length > 0) $(viewEL).find('.container').addClass('layout-container');
12749                if($(viewEL).find('.sync-row:not(.layout-row)').length > 0) $(viewEL).find('.sync-row').addClass('layout-row');
12750
12751                var check_gap = (el_style.getPropertyValue('--sync-view')) ? true : false;
12752                if(check_gap) {
12753                    $(viewEL).attr('data-ver','1');
12754
12755                    var tmp_col_p = el_style.getPropertyValue('--sync-view'),
12756                        tmp_col_t = el_style.getPropertyValue('--sync-view-t'),
12757                        tmp_col_m = el_style.getPropertyValue('--sync-view-m'),
12758                        tmp_gap = el_style.getPropertyValue('--sync-space'),
12759                        tmp_gap_top = el_style.getPropertyValue('--sync-space-top'),
12760                        tmp_imgh = el_style.getPropertyValue('--sync-height'),
12761                        tmp_display_cnt = el_style.getPropertyValue('--sync-page-unit');
12762                    document.querySelectorAll(el_selector).forEach(tmpel=> {
12763                        tmpel.style.setProperty('--layout-col-p', tmp_col_p, null);
12764                        tmpel.style.setProperty('--layout-col-t', tmp_col_t, null);
12765                        tmpel.style.setProperty('--layout-col-m', tmp_col_m, null);
12766                        tmpel.style.setProperty('--layout-gap-col', tmp_gap * 2, null);
12767                        tmpel.style.setProperty('--layout-gap-row', tmp_gap * 2 * tmp_gap_top, null);
12768                        tmpel.style.setProperty('--layout-imgh', tmp_imgh, null);
12769                        tmpel.style.setProperty('--display-count', tmp_display_cnt, null);
12770                    });
12771                }
12772            }
12773            break;
12774
12775        case 'forum':
12776            if($(viewEL).is('[data-fcolor]')) $(viewEL).attr('data-ver','1');
12777            break;
12778
12779        default:
12780            break;
12781    }
12782}
12783
12784
12785function getSiteMenuMax(sid, valid_plan, valid_type) {
12786    if(typeof sid == 'undefined' || !sid) return 0;
12787
12788    const custom_group = {
12789        200: ['flowedu'],
12790        300: ['tempmainleather']
12791    };
12792
12793    let result = (valid_plan && valid_type == 'SM') ? 200 : 100;
12794
12795    for (const [limit, group] of Object.entries(custom_group)) {
12796        if (group.includes(sid)) {
12797            result = Number(limit);
12798            break;
12799        }
12800    }
12801
12802    return result;
12803}
12804
12805function setSiteMenuOption() {
12806    var checkConfig = (PAGE_MODE == 'c') ? true : false;
12807    var checkView = (PAGE_MODE == 'c') ? VIEW : property.VIEW;
12808    var checkFroumView = (checkView && /^forum,/.test(checkView)) ? true : false;
12809    var sid = (PAGE_MODE == 'c') ? SID : property.SID;
12810    var page = (PAGE_MODE == 'c') ? PAGE : property.PAGE;
12811    var ppage = (PAGE_MODE == 'c') ? PARENT.ppage : property.PARENT.ppage;
12812    var checkpage = (checkView) ? ppage : page;
12813    var smenu = (PAGE_MODE == 'c') ? SMENU : property.SMENU;
12814    var menuoption = (PAGE_MODE == 'c') ? MENUOPTION : property.MENUOPTION;
12815
12816    $.each(menuoption, function(i,o) {
12817        o.active = '';
12818        if(o.isbookmark === '' && o.isflink === '' && o.isinner === '' 
12819            && o.name.replace(/ /g, '-') === checkpage
12820        ) {
12821            o.active = 'active';
12822        }
12823
12824        $.each(o.children, function(sub_i, sub_o) {
12825            sub_o.active = '';
12826            if(`${o.active}${sub_o.isbookmark}${sub_o.isflink}${sub_o.isinner}${sub_o.name.replace(/ /g, '-')}` === checkpage) {
12827                sub_o.active = 'active';
12828                o.active = 'open';
12829                if(!$.clnav.check() && $('body').width() > 768) o.active = 'active';
12830            }
12831        });
12832    });
12833}
12834
12835function date_string(d) {
12836    const date = new Date(d);
12837    const month = date.getMonth() + 1;
12838    const day = date.getDate();
12839    const weekdayNames = ['일', '월', '화', '수', '목', '금', '토'];
12840    const weekday = weekdayNames[date.getDay()];
12841    return `${month}월 ${day}일 (${weekday})`;
12842}
12843
12844
12845function slideNavigation(n) {
12846    let navObj = {
12847        1: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="m27.65 22-1.4-1.4-8.5-8.5-1.4 1.4 8.5 8.5-8.5 8.5 1.4 1.4 8.5-8.5z"/></svg>',
12848        2: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="m27.65 22-1.4-1.4-8.5-8.5-1.4 1.4 8.5 8.5-8.5 8.5 1.4 1.4 8.5-8.5z"/></svg>',
12849        3: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="M1.96 2v40h40V2h-40zm15.75 29.9-1.4-1.4 8.5-8.5-8.5-8.5 1.4-1.4 8.5 8.5 1.4 1.4-9.9 9.9z"/></svg>',
12850        4: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="m37.6 20.6-8.5-8.5-1.4 1.4 7.5 7.5H5v2h30.2l-7.5 7.5 1.4 1.4 8.5-8.5L39 22z"/></svg>',
12851        5: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><g><path d="M22 2C10.95 2 2 10.95 2 22s8.95 20 20 20 20-8.95 20-20S33.05 2 22 2zm0 38.8C11.63 40.8 3.2 32.37 3.2 22S11.63 3.2 22 3.2 40.8 11.63 40.8 22 32.37 40.8 22 40.8z"/><path d="m25.11 21.15-6.22-6.22-.85.85L24.26 22l-6.22 6.22.85.85 6.22-6.22.85-.85-.85-.85z"/></g></svg>',
12852        6: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><g><path d="m18.89 29.07 6.22-6.22.85-.85-.85-.85-6.22-6.22-.85.85L24.26 22l-6.22 6.22z"/><path d="M2 2v40h40V2H2zm38.8 38.8H3.2V3.2h37.6v37.6z"/></g></svg>',
12853        7: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><path d="m17.69 1.79-.9.42L26.21 22l-9.42 19.79.9.42L27.32 22z"/></svg>',
12854        8: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><g><path d="M10.84 38.6c.08.06.17.11.25.17h.04c.17.11.34.22.52.32l.62-1.03c-.27-.16-.53-.33-.79-.51l-.64 1.05z"/><path d="m4.53 28.96-1.12.44c.01.03.03.06.04.1v.02c.1.25.2.49.31.73v.05c0 .01.01.01.01.02l1.09-.5c-.09-.28-.21-.57-.33-.86z"/><path d="m3.26 23.49-1.2.09c.02.25.04.49.07.73V24.59l1.19-.15c-.01-.33-.04-.64-.06-.95z"/><path d="m3.25 20.67-1.2-.08c-.02.33-.04.66-.05 1l1.2.02c.01-.32.02-.63.05-.94z"/><path d="m3.65 17.88-1.17-.26c-.07.32-.14.65-.19.98l1.18.2c.05-.31.11-.62.18-.92z"/><path d="m8.49 36.74.3.27c.02.02.04.04.06.05l.01.01.01.01.01.01.01.01.01.01s.01 0 .01.01c0 0 .01 0 .01.01 0 0 .01 0 .01.01 0 0 .01 0 .01.01l.01.01.01.01h.01l.01.01.01.01H9l.01.01.01.01.01.01.01.01.01.01.01.01h.01l.01.01.01.01h.01s.01 0 .01.01c0 0 .01 0 .01.01 0 0 .01 0 .01.01 0 0 .01 0 .01.01 0 0 .01 0 .01.01 0 0 .01 0 .01.01 0 0 .01 0 .01.01l.01.01.01.01.01.01.01.01.01.01.01.01.01.01.77-.92c-.24-.2-.48-.41-.71-.62l-.81.87z"/><path d="m4.47 15.18-1.12-.44c-.05.12-.1.25-.14.37v.02s0 .01-.01.01c0 .01-.01.02-.01.03-.01.03-.02.07-.04.1v.03s0 .01-.01.01c0 0 0 .01-.01.01-.04.1-.07.21-.11.31l1.14.38c.09-.24.2-.54.31-.83z"/><path d="M4.73 32.09c.11.18.21.36.32.53v.03l.18.27 1-.66c-.17-.26-.34-.53-.5-.8l-1 .63z"/><path d="m10.71 5.49-.1.07-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01s-.01 0-.01.01c0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01 0 0-.01 0-.01.01l-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01c-.07.05-.13.1-.2.15l.73.95c.25-.19.5-.37.76-.55l-.79-1.02z"/><path d="M6.43 34.56c.21.26.43.51.65.76l.89-.8c-.21-.23-.41-.47-.61-.72l-.93.76z"/><path d="M27.6 2.8c-.21-.06-.43-.12-.65-.18h-.05l-.26-.06-.28 1.17c.31.07.61.15.91.24l.33-1.17z"/><path d="M24.67 2.18c-.04 0-.07-.01-.11-.01-.13-.02-.25-.03-.38-.04H24.03c-.05-.01-.11-.01-.16-.02h-.05c-.05 0-.1-.01-.15-.01l-.1 1.2c.31.03.63.06.93.1l.17-1.22z"/><path d="M39.19 11.77c-.13-.22-.27-.44-.41-.66v-.02l-.01-.01c-.02-.03-.04-.06-.06-.1l-1 .67c.17.26.34.53.5.79l.98-.67z"/><path d="m39.41 14.9 1.11-.45-.06-.15v-.17c-.01-.02-.01-.03-.02-.05-.08-.18-.15-.35-.23-.52l-1.09.51c.05.26.18.54.29.83z"/><path d="m40.28 17.58 1.17-.28c-.02-.07-.03-.13-.05-.2V16.88c-.03-.12-.07-.24-.1-.36l-1.15.34c-.03.11.05.42.13.72z"/><path d="m40.73 20.36 1.2-.1-.03-.29v-.03c-.02-.22-.05-.44-.08-.66l-1.19.16c.04.3.07.61.1.92z"/><path d="m9.19 8.24-.82-.88c-.05.05-.09.09-.14.13l-.01.01-.01.01-.01.01-.01.01s-.01 0-.01.01l-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01c-.16.15-.31.3-.46.46l.86.83c.22-.22.45-.44.68-.66z"/><path d="M22 3.2V2H21.89c-.27 0-.54.01-.8.02l.06 1.2c.22-.01.53-.02.85-.02z"/><path d="m7.27 10.31-.94-.74c-.09.11-.17.22-.26.33l-.01.01v.01l-.01.01v.01l-.01.01v.01l-.01.01v.01l-.01.01v.02l-.01.
1285401v.01s0 .01-.01.01c0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01 0 0 0 .01-.01.01v.02s0 .01-.01.01c0 0 0 .01-.01.01l-.01.01-.01.01-.01.01c-.01.02-.02.03-.03.05l.98.7.57-.75z"/><path d="m5.69 12.64-1.04-.6c-.1.18-.2.36-.3.55v.03l-.15.3 1.07.55c.11-.28.26-.56.42-.83z"/><path d="m19.19 3.41-.18-1.19-.39.06H18.39c-.01 0-.02 0-.03.01-.01 0-.02 0-.03.01H18.06l.24 1.18c.27.03.58-.02.89-.07z"/><path d="m3.69 26.27-1.17.27.06.24v.07c.05.22.11.44.18.66l1.15-.33c-.07-.3-.15-.6-.22-.91z"/><path d="m36.82 33.57.95.74c.01-.01.01-.02.02-.02l.01-.01.01-.01.01-.01s0-.01.01-.01c0 0 0-.01.01-.01l.01-.01v-.01l.01-.01v-.02s0-.01.01-.01l.01-.01.01-.01.01-.01.01-.01.01-.01c.03-.04.06-.08.09-.11l.01-.01.01-.01s0-.01.01-.01c0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01l.01-.01v-.01l.01-.01.01-.01s0-.01.01-.01c0 0 0-.01.01-.01v-.01l.01-.01v-.01l.01-.01v-.01l.01-.01v-.01s0-.01.01-.01c0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01 0 0 0-.01.01-.01v-.04c0-.01 0 0 .01-.01v-.01l.01-.01v-.01l.01-.01s0-.01.01-.01c0 0 0-.01.01-.01 0 0 0-.01.01-.01.02-.02.03-.05.05-.07l-.98-.69c-.21.25-.4.5-.59.75z"/><path d="M37.46 9.31c-.01-.01-.01-.01 0 0l-.01-.01-.01-.01v-.01l-.01-.01c-.01-.01 0 0 0-.01l-.01-.01v-.01l-.01-.01v-.01l-.01-.01-.01-.01v-.01l-.01-.01v-.01s0-.01-.01-.01c0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01l-.01-.01v-.01l-.01-.01v-.01l-.01-.01v-.01l-.01-.01-.01-.01v-.01L37.25 9s0-.01-.01-.01c0 0 0-.01-.01-.01l-.01-.01-.01-.01-.01-.01s0-.01-.01-.01v-.01l-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01v-.01l-.01-.01v-.01l-.01-.01v-.01l-.01-.01s0-.01-.01-.01c0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01 0 0 0-.01-.01-.01l-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01c-.06-.07-.12-.14-.19-.21l-.89.81c.21.23.42.47.61.71l.95-.69z"/><path d="m34.92 35.65.83.87c.09-.09.18-.17.27-.26l.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.01-.01.36-.36-.87-.83c-.22.23-.44.45-.67.66z"/><path d="m32.74 37.43.69.98.01-.01.01-.01.01-.01s.01 0 .01-.01c0 0 .01 0 .01-.01 0 0 .01 0 .01-.01 0 0 .01 0 .01-.01 0 0 .01 0 .01-.01h.01l.01-.01c.01-.01 0 0 .01 0h.01l.01-.01s.01 0 .01-.01c0 0 .01 0 .01-.01 0 0 .01 0 .01-.01 0 0 .01 0 .01-.01.1-.07.2-.15.3-.22l.01-.01.01-.01s.01 0 .01-.01l.01-.01h.01s.01 0 .01-.01c0 0 .01 0 .01-.01 0 0 .01 0 .01-.01 0 0 .01 0 .01-.01l.01-.01c.07-.05.14-.11.21-.16l-.73-.95c-.23.22-.48.4-.74.58z"/><path d="M35.39 7.15c0-.01 0-.01 0 0l-.01-.01-.01-.01-.01-.01-.01-.01a17.4 17.4 0 0 0-.65-.56l-.01-.01-.01-.01-.01-.01-.01-.01-.01-.01-.76.93c.24.2.48.4.71.61l.79-.89z"/><path d="m32.61 5.04-.01-.01-.01-.01H32.53c-.11-.07-.22-.14-.33-.2l-.61 1.03c.27.16.54.33.8.5l.66-1c-.16-.13-.3-.22-.44-.31z"/><path d="m40.38 25.97 1.17.25c.02-.08.03-.16.05-.24v-.05c.04-.18.07-.36.1-.54v-.03c.01-.04.01-.08.02-.12l-1.18-.19c-.04.31-.1.62-.16.92z"/><path d="M40.8 22.24c0 .32-.02.63-.04.94l1.2.07v-.08l.03-.6c0-.11.01-.21.01-.32l-1.2-.01z"/><path d="m39.58 28.68 1.12.43c.07-.19.14-.39.21-.59v-.09c.03-.09.06-.17.08-.26l-1.14-.37c-.05.29-.16.58-.27.88z"/><path d="m38.38 31.23 1.05.59c.05-.09.1-.17.14-.26v-.03c.1-.18.19-.36.28-.54v-.01l-1.
1285407-.54c-.09.24-.24.51-.4.79z"/><path d="M13.3 3.99c-.3.15-.6.3-.89.46l.58 1.05c.27-.15.55-.29.84-.43l-.53-1.08z"/><path d="M19.17 41.8c.2.03.4.05.6.08h.03c.12.01.24.03.36.04l.11-1.2c-.31-.03-.62-.06-.93-.11l-.17 1.19z"/><path d="M16.24 41.16c.13.04.26.08.39.11.01 0 .02 0 .02.01H16.77c.1.03.2.05.3.08l.29-1.17c-.31-.08-.61-.16-.91-.25l-.21 1.22z"/><path d="m22.15 40.8.01 1.2c.34 0 .67-.01 1-.03l-.07-1.2c-.31.02-.62.03-.94.03z"/><path d="M16.09 2.89c-.19.06-.37.12-.56.18-.02.01-.04.01-.06.02l-.33.12.41 1.13c.29-.11.59-.21.89-.3l-.35-1.15z"/><path d="m30.31 38.87.53 1.08c.11-.06.23-.11.34-.17h.01s.01 0 .01-.01h.02c.17-.09.33-.18.49-.27l-.58-1.05c-.26.13-.54.28-.82.42z"/><path d="M13.44 40.08c.1.05.19.09.29.13H13.85c.06.03.11.05.17.08h.07c.09.04.18.08.27.11l.46-1.11c-.29-.12-.58-.25-.86-.38l-.52 1.17z"/><path d="m27.7 39.92.36 1.14.2-.06h.05c.16-.05.33-.11.49-.17.06-.02.13-.05.19-.07l-.42-1.12c-.27.08-.57.19-.87.28z"/><path d="M30.37 3.83c-.01 0-.01-.01-.01-.01h-.02c-.24-.11-.48-.22-.73-.32h-.07c-.01 0-.02-.01-.03-.01l-.45 1.11c.29.12.58.24.86.37l.51-1.09c-.03-.04-.04-.04-.06-.05z"/><path d="m24.96 40.57.19 1.19c.07-.01.14-.02.22-.04H25.43c.12-.02.25-.04.37-.07h.04l.29-.06-.25-1.17c-.3.04-.61.1-.92.15z"/><path d="m29 22-4.24-4.24-.71.7 3.04 3.04H16v1h11.09l-3.04 3.04.71.7 3.53-3.53z"/></g></svg>',
12855        9: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44" width="44" height="44"><g><path d="M8.48 17.6h1.15l3.2 5.55.94 1.81h.06c-.06-.89-.14-1.87-.14-2.78V17.6h1.06v8.8H13.6l-3.2-5.55-.95-1.81H9.4c.05.89.13 1.82.13 2.75v4.62H8.48V17.6z"/><path d="M16.84 17.6h5.07v.95h-3.96v2.76h3.33v.95h-3.33v3.2h4.09v.95h-5.21V17.6z"/><path d="m25.17 21.86-2.4-4.26h1.22l1.2 2.25c.23.41.41.78.7 1.28h.05c.24-.5.41-.88.62-1.28l1.17-2.25h1.16l-2.4 4.32 2.57 4.49h-1.22l-1.3-2.38c-.23-.44-.47-.89-.75-1.42h-.05c-.25.53-.48.97-.71 1.42l-1.27 2.38H22.6l2.57-4.55z"/><path d="M31.74 18.55h-2.66v-.95h6.44v.95h-2.66v7.86h-1.12v-7.86z"/></g></svg>',
12856    };
12857    let navigation = '<div class="slide-nav-btn prev">' + navObj[n] + '</div><div class="slide-nav-btn next">' + navObj[n] + '</div>';
12858    return navigation;
12859}
12860
12861function extractBlocks(css) {
12862    if (!css || typeof css !== 'string') {
12863        return null;
12864    }
12865
12866    css = removeComments(css);
12867
12868    const blocks = [];
12869    let currentBlock = '';
12870    let braceDepth = 0;
12871    let inString = false;
12872    let stringChar = '';
12873    let inComment = false;
12874    let escaped = false;
12875    let isAtRule = false;
12876
12877    for (let i = 0; i < css.length; i++) {
12878        const char = css[i];
12879        const nextChar = css[i + 1];
12880
12881        // 이스케이프 문자 처리
12882        if (escaped) {
12883            currentBlock += char;
12884            escaped = false;
12885            continue;
12886        }
12887
12888        if (char === '\\') {
12889            escaped = true;
12890            currentBlock += char;
12891            continue;
12892        }
12893
12894        // 주석 처리
12895        if (!inString && char === '/' && nextChar === '*') {
12896            inComment = true;
12897            currentBlock += char;
12898            continue;
12899        }
12900
12901        if (inComment && char === '*' && nextChar === '/') {
12902            inComment = false;
12903            currentBlock += char + nextChar;
12904            i++; // nextChar도 건너뛰기
12905            continue;
12906        }
12907
12908        if (inComment) {
12909            currentBlock += char;
12910            continue;
12911        }
12912
12913        // 문자열 처리
12914        if (!inString && (char === '"' || char === "'")) {
12915            inString = true;
12916            stringChar = char;
12917            currentBlock += char;
12918            continue;
12919        }
12920
12921        if (inString && char === stringChar) {
12922            inString = false;
12923            stringChar = '';
12924            currentBlock += char;
12925            continue;
12926        }
12927
12928        if (inString) {
12929            currentBlock += char;
12930            continue;
12931        }
12932
12933        // @ 규칙 시작 감지
12934        if (char === '@' && braceDepth === 0 && currentBlock.trim() === '') {
12935            isAtRule = true;
12936        }
12937
12938        // 중괄호 처리
12939        if (char === '{') {
12940            braceDepth++;
12941            currentBlock += char;
12942            
12943            // @ 규칙의 첫 번째 중괄호인 경우, 내부 규칙들을 개별적으로 처리
12944            if (isAtRule && braceDepth === 1) {
12945                // @ 규칙의 헤더 부분을 저장
12946                const atRuleHeader = currentBlock.trim();
12947
12948                // 선택자 규칙을 포함할 수 있는 @ 규칙들만 재귀적으로 처리
12949                const selectorContainingAtRules = ['@media', '@supports', '@layer', '@container', '@scope', '@starting-style'];
12950                const shouldProcessInner = selectorContainingAtRules.some(rule => atRuleHeader.startsWith(rule));
12951                
12952                
12953                // 내부 CSS 찾기
12954                let innerCss = '';
12955                let innerBraceDepth = 1;
12956                let j = i + 1;
12957                
12958                while (j < css.length && innerBraceDepth > 0) {
12959                    const innerChar = css[j];
12960                    if (innerChar === '{') {
12961                        innerBraceDepth++;
12962                    } else if (innerChar === '}') {
12963                        innerBraceDepth--;
12964                    }
12965                    
12966                    if (innerBraceDepth > 0) {
12967                        innerCss += innerChar;
12968                    }
12969                    j++;
12970                }
12971                
12972                // 선택자 규칙을 포함할 수 있는 @ 규칙만 재귀적으로 처리
12973                if (shouldProcessInner) {
12974                    // 주석을 완전히 제거한 후 재귀 처리
12975                    const cleanedInnerCss = removeComments(innerCss);
12976                    const innerBlocks = extractBlocks(cleanedInnerCss);
12977                    if (innerBlocks) {
12978                        blocks.push(...innerBlocks);
12979                    }
12980                }
12981                
12982                // // @ 규칙 전체를 하나의 블록으로도 추가 (특별 케이스 처리용)
12983                // const fullAtRule = css.substring(css.indexOf(atRuleHeader), j);
12984                // blocks.push(fullAtRule.trim());
12985                
12986                // 인덱스 조정하고 초기화
12987                i = j - 1;
12988                currentBlock = '';
12989                braceDepth = 0;
12990                isAtRule = false;
12991                continue;
12992            }
12993        } else if (char === '}') {
12994            braceDepth--;
12995            currentBlock += char;
12996            
12997            // 일반 블록이 완료되었을 때
12998            if (braceDepth === 0 && !isAtRule) {
12999                const trimmedBlock = currentBlock.trim();
13000                if (trimmedBlock) {
13001                    blocks.push(trimmedBlock);
13002                }
13003                currentBlock = '';
13004            }
13005        } else {
13006            currentBlock += char;
13007        }
13008    }
13009
13010    // 마지막에 남은 블록이 있다면
13011    const trimmedBlock = currentBlock.trim();
13012    if (trimmedBlock && braceDepth === 0) {
13013        blocks.push(trimmedBlock);
13014    }
13015
13016    return blocks.length > 0 ? blocks : null;
13017}
13018
13019function removeComments(css) {
13020    return css.replace(/\/\*[\s\S]*?\*\//g, '');
13021}
13022
13023function navigateToInvalidSelector(css, invalidSelector, selectorIndex, blockStart) {
13024    // 블록 내에서 해당 선택자의 정확한 위치 찾기
13025    let selectorStart = blockStart;
13026    
13027    // 선택자들을 순회하며 해당 인덱스의 위치 찾기
13028    const block = css.substring(blockStart);
13029    const selectorPart = block.split('{')[0];
13030    const selectors = selectorPart.split(',');
13031    
13032    for (let i = 0; i <= selectorIndex; i++) {
13033        if (i === 0) {
13034            // 첫 번째 선택자는 블록 시작부터
13035            selectorStart = blockStart;
13036        } else {
13037            // 이후 선택자들은 이전 쉼표 이후부터 찾기
13038            const prevSelectorEnd = css.indexOf(',', selectorStart);
13039            if (prevSelectorEnd !== -1) {
13040                selectorStart = prevSelectorEnd + 1;
13041                // 공백 및 개행 문자 스킵
13042                while (selectorStart < css.length && /\s/.test(css[selectorStart])) {
13043                    selectorStart++;
13044                }
13045            }
13046        }
13047        
13048        if (i === selectorIndex) {
13049            // 실제 잘못된 선택자의 시작 위치 찾기
13050            const trimmedSelector = selectors[i].trim();
13051            const actualStart = css.indexOf(trimmedSelector, selectorStart);
13052            if (actualStart !== -1) {
13053                selectorStart = actualStart;
13054            }
13055            break;
13056        }
13057    }
13058
13059    const lines = css.substring(0, selectorStart).split('\n');
13060    const line = lines.length - 1;
13061    const ch = lines[lines.length - 1].length;
13062
13063    // 현재 커서 위치 가져오기
13064    const currentCursor = editorCss.getCursor();
13065    const currentLine = currentCursor.line;
13066
13067    // 에러 라인과 현재 라인 비교해서 스크롤 방향 결정
13068    if (line > currentLine) {
13069        // 에러가 아래쪽에 있으면 조금 더 아래로 스크롤
13070        editorCss.scrollIntoView({line: line + 10, ch: 0});
13071    } else if (line < currentLine) {
13072        // 에러가 위쪽에 있으면 조금 더 위로 스크롤  
13073        editorCss.scrollIntoView({line: Math.max(0, line - 10), ch: 0});
13074    } else {
13075        // 같은 라인이면 기본 스크롤
13076        editorCss.scrollIntoView({line: line + 10, ch: ch});
13077    }
13078
13079    // 커서 이동 및 포커스
13080    editorCss.setCursor(line, ch);
13081    editorCss.focus();
13082
13083    console.log(`Invalid selector "${invalidSelector}" highlighted at line ${line + 1}, column ${ch + 1}`);
13084}
13085
13086function startsWithELClassName(selector, ELClassName) {
13087    if (!selector.startsWith(ELClassName)) {
13088        return false;
13089    }
13090    
13091    // ELClassName 다음 문자가 없거나, 공백, ., :, [, > 등의 CSS 선택자 구분자인지 확인
13092    const nextCharIndex = ELClassName.length;
13093    if (nextCharIndex >= selector.length) {
13094        return true;
13095    }
13096    
13097    const nextChar = selector[nextCharIndex];
13098    return /[\s.:#\[>+~,]/.test(nextChar);
13099}
13100
13101function isValidSelector(selector, ELClassName) {
13102    // ELClassName이 selector에 있는지 찾기
13103    const index = selector.indexOf(ELClassName);
13104    
13105    // ELClassName이 아예 없음
13106    const checkClsname = (ELClassName == 'menu') ? false : true;
13107    if (checkClsname && index === -1) {
13108        return $.lang[LANG]['editor.css.userELClassError'].replace("{elClass}", ELClassName);
13109    }
13110    
13111    // ELClassName이 있으면 다음 문자 확인
13112    const nextCharIndex = index + ELClassName.length;
13113    
13114    // 끝까지 일치하거나, 다음 문자가 CSS 구분자인지 확인
13115    if (nextCharIndex >= selector.length || /[\s.:#\[>+~,]/.test(selector[nextCharIndex])) {
13116        return null; // 유효함
13117    } else {
13118        // ELClassName 뒤에 다른 문자가 붙어있음 (예: .userEL939385598인데 .userEL939385598123일때)
13119        return $.lang[LANG]['editor.css.userELClassError'].replace("{elClass}", ELClassName);
13120    }
13121}
13122
13123function hasUserELClass(css) {
13124    // const ELClassName = '.userEL' + $('#el-save').data('seq');
13125    const ELClassName = $('#tpl-prop-name').val();
13126    const blocks = extractBlocks(css);
13127    if (blocks) {
13128        for (const block of blocks) {
13129            const selectorPart = block.split('{')[0].trim();
13130            const selectors = selectorPart.split(',').map(s => s.trim());
13131            
13132            for (let i = 0; i < selectors.length; i++) {
13133                const selector = selectors[i];
13134                const errorMsg = isValidSelector(selector, ELClassName);
13135                if (errorMsg) {
13136                    const blockStart = css.indexOf(block);
13137                    navigateToInvalidSelector(css, selector, i, blockStart);
13138                    return errorMsg;
13139                }
13140            }
13141        }
13142    }
13143    
13144    return null;
13145}
13146
13147function normalizeHtmlRootUserELClass(tag, seq) {
13148    if (!seq || seq === 'menu' || seq === 'footer') return tag;
13149
13150    const rawTag = tag || '';
13151    const requiredClass = 'userEL' + seq;
13152    const $wrap = $('<div>').html(rawTag);
13153    const $root = $wrap.children().first();
13154
13155    if ($root.length === 0) return tag;
13156
13157    if ($root.hasClass(requiredClass)) {
13158        return $wrap.html();
13159    }
13160
13161    return `<div class="${requiredClass}">${$wrap.html()}</div>`;
13162}
13163
13164function checkBracesNested(css) {
13165    let stack = [];
13166    let commentOpen = false;
13167
13168    for (let i = 0; i < css.length; i++) {
13169        if (!commentOpen && css[i] === '/' && css[i+1] === '*') commentOpen = true;
13170        else if (commentOpen && css[i-1] === '*' && css[i] === '/') commentOpen = false;
13171
13172        if (!commentOpen) {
13173            if (css[i] === '{') stack.push('{');
13174            if (css[i] === '}') {
13175                if (stack.length === 0) return $.lang[LANG]['editor.css.openBraceError'];
13176                stack.pop();
13177            }
13178        }
13179    }
13180
13181    if (stack.length > 0) return $.lang[LANG]['editor.css.closeBraceError'];
13182    return null;
13183}
13184
13185function checkCommentClosed(css) {
13186    let commentOpen = false;
13187
13188    for (let i = 0; i < css.length; i++) {
13189        if (!commentOpen && css[i] === '/' && css[i+1] === '*') commentOpen = true;
13190        else if (commentOpen && css[i-1] === '*' && css[i] === '/') commentOpen = false;
13191    }
13192
13193    if (commentOpen) return $.lang[LANG]['editor.css.commentError'];
13194    return null;
13195}
13196
13197function galleryTagSave(pid, sd, len, seq) {
13198
13199    if (sd !== 'd') seq = '';
13200
13201    var limit = 8;
13202    var rootClass = 'userEL' + pid;
13203    var tpl_return = '';
13204    
13205    // 1차: class로 찾기
13206    var $target = $('.' + rootClass).first();
13207
13208    // 2차: 못 찾으면 data-id로 찾기
13209    if (!$target.length) {
13210        $target = $('[data-id="' + pid + '"]').first();
13211    }
13212
13213    // 그래도 없으면 종료
13214    if (!$target.length) {
13215        return;
13216    }
13217
13218    var $root = $target.clone();
13219
13220    if($root.is('[data-ver="1"]')) return;
13221    
13222    $root.find('.cl-gtoolbar, .gallery-category-wrap').remove();
13223
13224    if (len > 0 && sd == 's') {
13225        $root.find('.gallery-item').slice(limit).remove();
13226        tpl_return = $root.prop('outerHTML');
13227    } else if (len > 0 && sd == 'd') {
13228        $root.find('.gallery-item[data-seq="' + seq + '"]').remove();
13229        $root.find('.gallery-item').slice(len).remove();
13230        tpl_return = $root.prop('outerHTML');
13231    }
13232
13233    // ✅ 루트 엘리먼트만: attribute 전부 삭제 + class는 userEL{pid}만 남김
13234    (function () {
13235        if($root.length > 0) {
13236            var el = $root[0];
13237
13238            // class를 제외한 모든 attribute 제거
13239            for (var i = el.attributes.length - 1; i >= 0; i--) {
13240                var name = el.attributes[i].name;
13241                if (name !== 'class') el.removeAttribute(name);
13242            }
13243
13244            // class도 userEL{pid}만 남기기 (기존에 다른 클래스 붙어있으면 제거)
13245            el.setAttribute('class', rootClass);
13246        }
13247    })();
13248
13249    tpl_return = $root.prop('outerHTML');
13250
13251    var paramArr = { tag: tpl_return, sid: SID, pid: pid, len: len };
13252    $.post('/template/galleryTagUpdate', paramArr, function (data) {});
13253}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.