1 2; /* Start:"a:4:{s:4:"full";s:62:"/o-klube/shema-territorii/assets/map.script.js?162342548520232";s:6:"source";s:46:"/o-klube/shema-territorii/assets/map.script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3function ready() { 4 5 var mapItemsList = $(".item-map[id *= 'item-']"); 6 var activeYellowItem = $(".yellow-item[id *= 'item-yellow-']"); 7 var activeMapItem = null; 8 var unactiveMapItem = null; 9 var focusedItem = null; 10 var clickFocusItem = null; 11 var clickFocusLink = null; 12 var oldClick = null; 13 14 var standalone = window.navigator.standalone, 15 userAgent = window.navigator.userAgent.toLowerCase(), 16 safari = /safari/.test( userAgent ), 17 ios = /iphone|ipod|ipad/.test( userAgent ); 18 19 //ФÑнкÑÐ¸Ñ Ð¾ÑкÑÑÑÐ¸Ñ Ð¾Ð±ÑекÑа на каÑÑе 20 function showMapItemCard(item){ 21 leftItemPos = item[0].getBoundingClientRect().left + pageXOffset; 22 topItemPos = item[0].getBoundingClientRect().top + pageYOffset; 23 var SvgPos = $('.map-svg-view')[0].getBoundingClientRect(); 24 25 var cardItem = $(".map-item-popup[data-item-id = '"+ item.attr('data-item-id') +"']"); 26 27 if(getComputedStyle(document.querySelector('.map-svg-mobile')).display == "none") { 28 cardItem.removeClass('map-item-card-hidden'); 29 30 if ((SvgPos.right + pageXOffset) - (item[0].getBoundingClientRect().right + pageXOffset) < 400) { 31 cardItem.css('left', "" + (leftItemPos - 40) + "px") ; 32 } else { 33 cardItem.css('left', "" + (leftItemPos + 350) + "px") ; 34 } 35 36 if((item[0].getBoundingClientRect().top + pageXOffset) - (SvgPos.top + pageXOffset) < 300){ 37 cardItem.css('top', "" + (topItemPos - 160) + "px"); 38 } 39 else{ 40 cardItem.css('top', "" + (topItemPos - 300) + "px"); 41 } 42 } 43 else if(getComputedStyle(document.querySelector('.map-svg-mobile')).display == "block"){ 44 var hcard = (document.body.scrollWidth)/(2.0)+120; 45 46 cardItem.css('left', "" + hcard + "px"); 47 cardItem.css('top', "" + (SvgPos.bottom + pageYOffset + 40) + "px"); 48 49 50 cardItem.removeClass('map-item-card-hidden'); 51 } 52 } 53 54 //ФÑнкÑÐ¸Ñ Ð·Ð°ÐºÑÑÑÐ¸Ñ ÐºÐ°ÑÑоÑки обÑекÑа на каÑÑе 55 function disableMapItemCard(card){ 56 card.addClass('map-item-card-hidden'); 57 } 58 59 //ФÑнкÑÐ¸Ñ ÑÑаÑÑа зÑма ÑлеменÑа на каÑÑе 60 function zoomMapItem(item) { 61 item.removeClass('map-item-shown'); 62 item.addClass('map-item-none'); 63 64 $("[id = 'item-yellow-" + item.attr('data-item-id')).removeClass('map-item-none'); 65 $("[id = 'item-yellow-" + item.attr('data-item-id')).removeClass('ex-map-item-none'); 66 $("[id = 'item-yellow-" + item.attr('data-item-id')).addClass('map-item-shown'); 67 $("[data-link-id = '" + item.attr('data-item-id')).addClass('map-link-outer-change-color'); 68 69 if(window.panZoom != null){ 70 // window.panZoom.zoom(2); 71 } 72 } 73 74 //ФÑнкÑÐ¸Ñ Ð·Ð°Ð²ÐµÑÑÐµÐ½Ð¸Ñ Ð·Ñма ÑлеменÑа на каÑÑе 75 function endZoomMapItem(item) { 76 item.removeClass('map-item-shown'); 77 item.addClass('map-item-none-animate'); 78 item.addClass('ex-map-item-none'); 79 80 $("[id = 'item-" + item.attr('data-item-id')).removeClass('map-item-none'); 81 $("[id = 'item-" + item.attr('data-item-id')).addClass('map-item-shown'); 82 $("[data-link-id = '" + item.attr('data-item-id')).removeClass('map-link-outer-change-color'); 83 } 84 85 //============================================ СобÑÑÐ¸Ñ Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ð¸Ñ ======================================================= 86 87 88 89 //ÐбÑабоÑка ÑобÑÑÐ¸Ñ Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð½Ð° название обÑекÑа в ÑпиÑке 90 91 $(".map-link").on('mouseenter', function() { 92 unactiveMapItem = $("[id = 'item-" + $(this).attr('data-link-id') + "']"); 93 zoomMapItem(unactiveMapItem); 94 focusedItem = $('.yellow-item.map-item-shown'); 95 96 }) 97 98 //ÐбÑабоÑка ÑобÑÑÐ¸Ñ ÑнÑÑÐ¸Ñ ÑказаÑÐµÐ»Ñ Ð¼ÑÑи Ñ Ð¾Ð±ÑекÑа в ÑпиÑке 99 100 $(".map-link").on('mouseleave', function() { 101 activeMapItem = $("[id = 'item-yellow-" + $(this).attr('data-link-id') + "']"); 102 103 if (clickFocusItem == null || activeMapItem[0] != clickFocusItem[0]) { 104 endZoomMapItem(activeMapItem); 105 } 106 107 focusedItem = null; 108 }); 109 110 //============================================ СобÑÑÐ¸Ñ Ð½Ð°Ð¶Ð°ÑÐ¸Ñ ================================================== 111 if ($(window).width() <= 768) { 112 // console.log('clickFocusItem'); 113 114 $('.yellow-item').on("click", function (e) {
115 clickFocusItem = $(this); 116 console.log(clickFocusItem); 117 disableMapItemCard($(".map-item-popup[data-item-id = '" + clickFocusItem.attr('data-item-id') + "']")); 118 endZoomMapItem(clickFocusItem); 119 zoomMapItem($(this)); 120 121 if ($('.card-popup-form-' + clickFocusItem.attr('data-item-id')) != null) { 122 $('.card-popup-form-' + clickFocusItem.attr('data-item-id')).addClass('map-card-tab-form-hidden'); 123 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 124 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").css('dispay',''); 125 } 126 clickFocusItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 127 focusedItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 128 129 showMapItemCard($(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']")); 130 clickFocusLink = $("[data-link-id = '" + $(this).attr('data-item-id') + "']"); 131 }); 132 } 133 134 if( ios ) { 135 if (!standalone && safari) { 136 $.each(mapItemsList, function () { 137 $(this).on("click", function () { 138 if (clickFocusItem != null && clickFocusItem != $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']")) {
139 disableMapItemCard($(".map-item-popup[data-item-id = '" + clickFocusItem.attr('data-item-id') + "']")); 140 endZoomMapItem(clickFocusItem); 141 zoomMapItem($(this)); 142 143 if ($('.card-popup-form-' + clickFocusItem.attr('data-item-id')) != null) { 144 $('.card-popup-form-' + clickFocusItem.attr('data-item-id')).addClass('map-card-tab-form-hidden'); 145 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 146 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").css('dispay',''); 147 } 148 clickFocusItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 149 focusedItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 150 151 showMapItemCard($(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']")); 152 clickFocusLink = $("[data-link-id = '" + $(this).attr('data-item-id') + "']"); 153 154 } else if (clickFocusItem != $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']")) { 155 clickFocusItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 156 focusedItem = $(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']"); 157 clickFocusLink = $("[data-link-id = '" + $(this).attr('data-item-id') + "']"); 158 159 showMapItemCard($(".yellow-item[data-item-id = '" + $(this).attr('data-item-id') + "']")); 160 zoomMapItem($(this)); 161 } 162 }); 163 }); 164 165 //ÐбÑабоÑка нажаÑÐ¸Ñ Ð½Ð° svg изобÑажение, оÑлиÑное Ð¾Ñ Ð¾Ð±ÑекÑов каÑÑÑ 166 $("image[id = 'image0']").on('click', function () { 167 if (focusedItem != clickFocusItem && clickFocusItem != null) {
168 disableMapItemCard($(".map-item-popup[data-item-id = '" + clickFocusItem.attr('data-item-id') + "']")); 169 endZoomMapItem($('.map-item-shown.yellow-item')); 170 if ($('.card-popup-form-' + clickFocusItem.attr('data-item-id')) != null) { 171 $('.card-popup-form-' + clickFocusItem.attr('data-item-id')).addClass('map-card-tab-form-hidden'); 172 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 173 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").css('display',''); 174 } 175 focusedItem = null; 176 clickFocusItem = null; 177 } 178 }); 179 } 180 } 181 else{ 182 $.each(activeYellowItem,function () { 183 $(this).on("click", function() { 184 185 if (clickFocusItem != null && clickFocusItem.attr('data-item-id') != $(this).attr('data-item-id')) {
186 disableMapItemCard($(".map-item-popup[data-item-id = '"+ clickFocusItem.attr('data-item-id') +"']")); 187 endZoomMapItem(clickFocusItem); 188 189 if($('.card-popup-form-' + clickFocusItem.attr('data-item-id')) != null) { 190 $('.card-popup-form-' + clickFocusItem.attr('data-item-id')).addClass('map-card-tab-form-hidden'); 191 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 192 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").css('display', ''); 193 } 194 clickFocusItem = $(this); 195 focusedItem = $(this); 196 197 showMapItemCard($(this)); 198 clickFocusLink = $("[data-link-id = '" + $(this).attr('data-item-id') + "']"); 199 200 } 201 else if(clickFocusItem == null){ 202 clickFocusItem = $(this); 203 focusedItem = $(this); 204 clickFocusLink = $("[data-link-id = '" + $(this).attr('data-item-id') + "']"); 205 206 showMapItemCard($(this)); 207 } 208 }); 209 }); 210 211 //ÐбÑабоÑка нажаÑÐ¸Ñ Ð½Ð° svg изобÑажение, оÑлиÑное Ð¾Ñ Ð¾Ð±ÑекÑов каÑÑÑ 212 $("image[id = 'image0']").on('click', function() { 213 if (focusedItem != clickFocusItem && clickFocusItem!= null) {
214 disableMapItemCard($(".map-item-popup[data-item-id = '" + clickFocusItem.attr('data-item-id') + "']")); 215 endZoomMapItem($('.map-item-shown.yellow-item')); 216 if ($('.card-popup-form-' + clickFocusItem.attr('data-item-id')) != null) { 217 $('.card-popup-form-' + clickFocusItem.attr('data-item-id')).addClass('map-card-tab-form-hidden'); 218 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 219 $(".map-card-submit-button-2.map-card-button[data-item-id='" + clickFocusItem.attr('data-item-id') + "']").css('display', ''); 220 } 221 focusedItem = null; 222 clickFocusItem = null; 223 } 224 }); 225 226 //ÐбÑабоÑка ÑобÑÑÐ¸Ñ Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¼ÑÑи на обÑÐµÐºÑ Ð½Ð° каÑÑе 227 mapItemsList.on('mouseenter', function() { 228 var items = $('.item-map[data-item-id='+$(this).attr('data-item-id')+']'); 229 items.each(function( index, value ) { 230 zoomMapItem($(value)); 231 }); 232 233 234 focusedItem = $('.yellow-item.map-item-shown'); 235 }); 236 237 //ÐбÑабоÑка ÑобÑÑÐ¸Ñ ÑнÑÑÐ¸Ñ Ð¼ÑÑи Ñ Ð¾Ð±ÑекÑа на каÑÑе 238 activeYellowItem.on('mouseleave', function() { 239 if (clickFocusItem != null && clickFocusItem.attr('data-item-id') != $(this).attr('data-item-id')) { 240 console.log("mouseleave"); 241 endZoomMapItem($(this)); 242 } 243 244 $.each(activeYellowItem, function() { 245 if(clickFocusItem == null || clickFocusItem.attr('data-item-id') != $(this).attr('data-item-id')) 246 { 247 endZoomMapItem($(this)) 248 }; 249 }) 250 // $.each(activeYellowItem, function() { 251 // if(clickFocusItem == null || clickFocusItem[0] != this) 252 // { 253 // endZoomMapItem($(this)) 254 // }; 255 // }) 256 focusedItem = null; 257 }); 258 } 259 260 //ÐбÑабоÑка ÑобÑÑÐ¸Ñ Ð½Ð°Ð¶Ð°ÑÐ¸Ñ Ð½Ð° обÑÐµÐºÑ ÐºÐ°ÑÑÑ Ð² ÑпиÑке 261 $.each($(".map-link"), function() { 262 $(this).on('click', function (e) { 263 oldClick = clickFocusLink; 264 clickFocusLink = $(this); 265 266 if (oldClick == null) { 267 clickFocusItem = focusedItem = $("[id = 'item-yellow-" + clickFocusLink.attr('data-link-id') + "']"); 268 clickFocusLink = $(this); 269 oldClick = $(this); 270 if (window.matchMedia("(min-width: 769px)").matches) { 271 showMapItemCard(clickFocusItem); 272 } else { 273 274 var el = document.querySelector("[id = 'item-yellow-" + clickFocusLink.attr('data-link-id') + "']"); 275 var adjust = (document.documentElement.clientWidth/2 - el.getBoundingClientRect().left); 276 277 const view = document.getElementsByClassName('svg-pan-zoom_viewport')[0]; 278 const viewcont = document.getElementsByClassName('map-svg-view')[0]; 279 const elTop = parseInt(el.getBoundingClientRect().top); 280 const viewcontTop = parseInt(viewcont.getBoundingClientRect().top); 281 const viewcontHeight = parseInt(viewcont.clientHeight); 282 var adjustY = viewcontHeight/2 - (elTop - viewcontTop); 283 284 const viewStyle = window.getComputedStyle(view); 285 const viewMatrix = viewStyle.transform || viewStyle.webkitTransform || viewStyle.mozTransform; 286 const viewMatrixValues = viewMatrix.match(/matrix.*\((.+)\)/)[1].split(', '); 287 const viewMatrixValuesZ = viewMatrixValues[3]; 288 const viewMatrixValuesX = viewMatrixValues[4]; 289 const viewMatrixValuesY = viewMatrixValues[5]; 290 291 var viewMatrixValuesYchange = parseInt(viewMatrixValuesY) + parseInt(adjustY); 292 var viewMatrixValuesXchange = parseInt(viewMatrixValuesX) + parseInt(adjust); 293 view.style.transform = "matrix("+viewMatrixValuesZ+", 0, 0, "+viewMatrixValuesZ+", "+viewMatrixValuesXchange+", "+viewMatrixValuesYchange+")"; 294 295 if(window.panZoom != null){ 296 window.panZoom.zoom(2); 297 } 298 $(window).scrollTop( 200 ); 299 300 } 301 } 302 else if (clickFocusLink != oldClick && oldClick != null) { 303
304 clickFocusItem = $("[id = 'item-yellow-" + $(this).attr('data-link-id') + "']"); 305 focusedItem = $("[id = 'item-" + $(this).attr('data-link-id') + "']"); 306 307 endZoomMapItem($("[id = 'item-yellow-" + oldClick.attr('data-link-id') + "']")); 308 if (window.matchMedia("(min-width: 769px)").matches) { 309 zoomMapItem(focusedItem); 310 } else { 311 if(window.panZoom != null){ 312 window.panZoom.zoom(2); 313 } 314 } 315 316 clickFocusLink = $(this); 317 318 disableMapItemCard($(".map-item-popup[data-item-id = '" + oldClick.attr('data-link-id') + "']")); 319 if($('.card-popup-form-' + oldClick.attr('data-link-id')) != null) { 320 $('.card-popup-form-' + oldClick.attr('data-link-id')).addClass('map-card-tab-form-hidden'); 321 $(".map-card-submit-button-2.map-card-button[data-item-id='" + oldClick.attr('data-link-id') + "']").removeClass('map-fake-btn-hidden'); 322 $(".map-card-submit-button-2.map-card-button[data-item-id='" + oldClick.attr('data-link-id') + "']").css('display', ''); 323 } 324 325 if (window.matchMedia("(min-width: 769px)").matches) { 326 showMapItemCard(clickFocusItem); 327 } else { 328 329 var el = document.querySelector("[id = 'item-yellow-" + clickFocusLink.attr('data-link-id') + "']"); 330 var adjust = (document.documentElement.clientWidth/2 - el.getBoundingClientRect().left); 331 332 const view = document.getElementsByClassName('svg-pan-zoom_viewport')[0]; 333 const viewcont = document.getElementsByClassName('map-svg-view')[0]; 334 const elTop = parseInt(el.getBoundingClientRect().top); 335 const viewcontTop = parseInt(viewcont.getBoundingClientRect().top); 336 const viewcontHeight = parseInt(viewcont.clientHeight); 337 var adjustY = viewcontHeight/2 - (elTop - viewcontTop); 338 339 const viewStyle = window.getComputedStyle(view); 340 const viewMatrix = viewStyle.transform || viewStyle.webkitTransform || viewStyle.mozTransform; 341 const viewMatrixValues = viewMatrix.match(/matrix.*\((.+)\)/)[1].split(', '); 342 const viewMatrixValuesZ = viewMatrixValues[3]; 343 const viewMatrixValuesX = viewMatrixValues[4]; 344 const viewMatrixValuesY = viewMatrixValues[5]; 345 346 var viewMatrixValuesYchange = parseInt(viewMatrixValuesY) + parseInt(adjustY); 347 var viewMatrixValuesXchange = parseInt(viewMatrixValuesX) + parseInt(adjust); 348 view.style.transform = "matrix("+viewMatrixValuesZ+", 0, 0, "+viewMatrixValuesZ+", "+viewMatrixValuesXchange+", "+viewMatrixValuesYchange+")"; 349 350 if(window.panZoom != null){ 351 window.panZoom.zoom(2); 352 } 353 $(window).scrollTop( 200 ); 354 } 355 356 } 357 return false; 358 }) 359 360 }); 361 362 //ÐбÑабоÑка нажаÑÐ¸Ñ Ð½Ð° ÐºÐ½Ð¾Ð¿ÐºÑ Ð·Ð°ÐºÑÑÑÐ¸Ñ ÐºÐ°ÑÑоÑки обÑекÑа 363 $.each($('.hide-map-card-simb'), function() { 364 $(this).on('click', function() { 365 endZoomMapItem($("[id = 'item-yellow-" + $(this).attr('data-item-id') + "']")); 366 $(".map-item-popup[data-item-id = '" + $(this).attr('data-item-id') + "']").addClass('map-item-card-hidden'); 367 if($('.card-popup-form-' + $(this).attr('data-item-id')) != null) { 368 $('.card-popup-form-' + $(this).attr('data-item-id')).addClass('map-card-tab-form-hidden'); 369 $(".map-card-submit-button-2.map-card-button[data-item-id='" + $(this).attr('data-item-id') + "']").removeClass('map-fake-btn-hidden'); 370 $(".map-card-submit-button-2.map-card-button[data-item-id='" + $(this).attr('data-item-id') + "']").prev().css('display',''); 371 } 372 clickFocusItem = null; 373 focusedItem = null; 374 clickFocusLink = null; 375 376 return false; 377 }) 378 }); 379 380 //ÐбÑабоÑка нажаÑÐ¸Ñ Ð½Ð° ÐºÐ½Ð¾Ð²ÐºÑ Ð¾ÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑоÑÐ¼Ñ Ð¿Ð¾Ð´Ð°Ñи заÑвки 381 $.each($('.map-card-submit-button-2.map-card-button'), function() { 382 $(this).on('click', function(){ 383 $('.card-popup-form-' + $(this).attr('data-item-id')).removeClass('map-card-tab-form-hidden'); 384 $(this).addClass('map-fake-btn-hidden'); 385 $(this).prev().css('display', 'block'); 386 return false;
vendor: 4,121 bytes, lines 387-466
387 }) 388 }); 389} 390 391document.addEventListener("DOMContentLoaded", ready); 392 393/* End */ 394; 395; /* Start:"a:4:{s:4:"full";s:64:"/o-klube/shema-territorii/assets/svg-pan-zoom.js?160241708291090";s:6:"source";s:48:"/o-klube/shema-territorii/assets/svg-pan-zoom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 396// svg-pan-zoom v3.6.1 397// https://github.com/ariutta/svg-pan-zoom 398(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 399 var SvgUtils = require("./svg-utilities"); 400 401 module.exports = { 402 enable: function(instance) { 403 // Select (and create if necessary) defs 404 var defs = instance.svg.querySelector("defs"); 405 if (!defs) { 406 defs = document.createElementNS(SvgUtils.svgNS, "defs"); 407 instance.svg.appendChild(defs); 408 } 409 410 // Check for style element, and create it if it doesn't exist 411 var styleEl = defs.querySelector("style#svg-pan-zoom-controls-styles"); 412 if (!styleEl) { 413 var style = document.createElementNS(SvgUtils.svgNS, "style"); 414 style.setAttribute("id", "svg-pan-zoom-controls-styles"); 415 style.setAttribute("type", "text/css"); 416 style.textContent = 417 ".svg-pan-zoom-control { cursor: pointer; fill: black; fill-opacity: 0.333; } .svg-pan-zoom-control:hover { fill-opacity: 0.8; } .svg-pan-zoom-control-background { fill: white; fill-opacity: 0.5; } .svg-pan-zoom-control-background { fill-opacity: 0.8; }"; 418 defs.appendChild(style); 419 } 420 421 // Zoom Group 422 var zoomGroup = document.createElementNS(SvgUtils.svgNS, "g"); 423 zoomGroup.setAttribute("id", "svg-pan-zoom-controls"); 424 zoomGroup.setAttribute( 425 "transform", 426 "translate(" + 427 (instance.width - 70) + 428 " " + 429 (instance.height - 76) + 430 ") scale(0.75)" 431 ); 432 zoomGroup.setAttribute("class", "svg-pan-zoom-control"); 433 434 // Control elements 435 zoomGroup.appendChild(this._createZoomIn(instance)); 436 zoomGroup.appendChild(this._createZoomReset(instance)); 437 zoomGroup.appendChild(this._createZoomOut(instance)); 438 439 // Finally append created element 440 instance.svg.appendChild(zoomGroup); 441 442 // Cache control instance 443 instance.controlIcons = zoomGroup; 444 }, 445 446 _createZoomIn: function(instance) { 447 var zoomIn = document.createElementNS(SvgUtils.svgNS, "g"); 448 zoomIn.setAttribute("id", "svg-pan-zoom-zoom-in"); 449 zoomIn.setAttribute("transform", "translate(30.5 5) scale(0.015)"); 450 zoomIn.setAttribute("class", "svg-pan-zoom-control"); 451 zoomIn.addEventListener( 452 "click", 453 function() { 454 instance.getPublicInstance().zoomIn(); 455 }, 456 false 457 ); 458 zoomIn.addEventListener( 459 "touchstart", 460 function() { 461 instance.getPublicInstance().zoomIn(); 462 }, 463 false 464 ); 465 466 var zoomInBackground = document.createElementNS(SvgUtils.svgNS, "rect"); // TODO change these background space fillers to rounded rectangles s
466o they look prettier 467 zoomInBackground.setAttribute("x", "0"); 468 zoomInBackground.setAttribute("y", "0"); 469 zoomInBackground.setAttribute("width", "1500"); // larger than expected because the whole group is transformed to scale down 470 zoomInBackground.setAttribute("height", "1400"); 471 zoomInBackground.setAttribute("class", "svg-pan-zoom-control-background"); 472 zoomIn.appendChild(zoomInBackground); 473 474 var zoomInShape = document.createElementNS(SvgUtils.svgNS, "path"); 475 zoomInShape.setAttribute( 476 "d", 477 "M1280 576v128q0 26 -19 45t-45 19h-320v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-320q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h320v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h320q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" 478 ); 479 zoomInShape.setAttribute("class", "svg-pan-zoom-control-element"); 480 zoomIn.appendChild(zoomInShape); 481 482 return zoomIn; 483 }, 484 485 _createZoomReset: function(instance) { 486 // reset 487 var resetPanZoomControl = document.createElementNS(SvgUtils.svgNS, "g"); 488 resetPanZoomControl.setAttribute("id", "svg-pan-zoom-reset-pan-zoom"); 489 resetPanZoomControl.setAttribute("transform", "translate(5 35) scale(0.4)"); 490 resetPanZoomControl.setAttribute("class", "svg-pan-zoom-control"); 491 resetPanZoomControl.addEventListener( 492 "click", 493 function() { 494 instance.getPublicInstance().reset(); 495 }, 496 false 497 ); 498 resetPanZoomControl.addEventListener( 499 "touchstart", 500 function() { 501 instance.getPublicInstance().reset(); 502 }, 503 false 504 ); 505 506 var resetPanZoomControlBackground = document.createElementNS( 507 SvgUtils.svgNS, 508 "rect" 509 ); // TODO change these background space fillers to rounded rectangles so they look prettier 510 resetPanZoomControlBackground.setAttribute("x", "2"); 511 resetPanZoomControlBackground.setAttribute("y", "2"); 512 resetPanZoomControlBackground.setAttribute("width", "182"); // larger than expected because the whole group is transformed to scale down 513 resetPanZoomControlBackground.setAttribute("height", "58"); 514 resetPanZoomControlBackground.setAttribute( 515 "class", 516 "svg-pan-zoom-control-background" 517 ); 518 resetPanZoomControl.appendChild(resetPanZoomControlBackground); 519 520 var resetPanZoomControlShape1 = document.createElementNS( 521 SvgUtils.svgNS, 522 "path" 523 ); 524 resetPanZoomControlShape1.setAttribute( 525 "d", 526 "M33.051,20.632c-0.742-0.406-1.854-0.609-3.338-0.609h-7.969v9.281h7.769c1.543,0,2.701-0.188,3.473-0.562c1.365-0.656,2.048-1.953,2.048-3.891C35.032,22.757,34.372,21.351,33.051,20.632z" 527 ); 528 resetPanZoomControlShape1.setAttribute( 529 "class", 530 "svg-pan-zoom-control-element" 531 ); 532 resetPanZoomControl.appendChild(resetPanZoomControlShape1); 533 534 var resetPanZoomControlShape2 = document.createElementNS( 535 SvgUtils.svgNS, 536 "path" 537 ); 538 resetPanZoomControlShape2.setAttribute( 539 "d", 540 "M170.231,0.5H15.847C7.102,0.5,0.5,5.708,0.5,11.84v38.861C0.5,56.833,7.102,61.5,15.847,61.5h154.384c8.745,0,15.269-4.667,15.269-10.798V11.84C185.5,5.708,178.976,0.5,170.231,0.5z M42.837,48.569h-7.969c-0.219-0.766-0.375-1.383-0.469-1.852c-0.188-0.969-0.289-1.961-0.305-2.977l-0.047-3.211c-0.03-2.203-0.41-3.672-1.142-4.406c-0.732-0.734-2.103-1.102-4.113-1.102h-7.05v13.547h-7.055V14.022h16.524c2.361,0.047,4.178,0.344,5.45,0.891c1.272,0.547,2.351,1.352,3.234,2.414c0.731,0.875,1.31,1.844,1.737,2.906s0.64,2.273,0.64,3.633c0,1.641-0.414,3.254-1.242,4.84s-2.195,2.707-4.102,3.363c1.594,0.641,2.723,1.551,3.387,2.73s0.996,2.98,0.996,5.402v2.32c0,1.578,0.063,2.648,0.19,3.211c0.19,0.891,0.635,1.547,1.333,1.969V48.569z M75.579,48.569h-26.18V14.022h25.336v6.117H56.454v7.336h16.781v6H56.454v8.883h19.125V48.569z M104.497,46.331c-2.44,2.086-5.887,3.129-10.34,3.129c-4.548,0-8.125-1.027-10.731-3.082s-3.909-4.879-3.909-8.473h6.891c0.224,1.578,0.662,2.758,1.316,3.539c1.196,1.422,3.246,2.133,6.15,2.133c1.739,0,3.151-0.188,4.236-0.562c2.058-0.719,3.087-2.055,3.087-4.008c0-1.141-0.504-2.023-1.512-2.648c-1.008-0.609-2.607-1.148-4.796-1.617l-3.74-0.82c-3.676-0.812-6.201-1.695-7.576-2.648c-2.328-1.594-3.492-4.086-3.492-7.477c0-3.094,1.139-5.664,3.417-7.711s5.623-3.07,10.036-3.07c3.685,0,6.829,0.965,9.431,2.895c2.602,1.93,3.966,4.73,4.093,8.402h-6.938c-0.128-2.078-1.057-3.555-2.787-4.43c-1.154-0.578-2.587-0.867-4.301-0.867c-1.907,0-3.428,0.375-4.565,1.125c-1.138,0.75-1.706,1.797-1.706,3.141c0,1.234,0.561,2.156,1.682,2.766c0.721,0.406,2.25,0.883,4.589,1.43l6.063,1.43c2.657,0.625,4.648,1.461,5.975,2.508c2.059,1.625,3.089,3.977,3.089,7.055C108.157,41.624,106.937,44.245,104.497,46.331z M139.61,48.569h-26.18V14.022h25.336v6.117h-18.281v7.336h16.781v6h-16.781v8.883h19.125V48.569z M170.337,20.14h-10.336v28.43h-7.266V20.14h-10.383v-6.117h27.984V20.14z" 541 ); 542 resetPanZoomControlShape2.setAttribute( 543 "class", 544 "svg-pan-zoom-control-element" 545 ); 546 resetPanZoomControl.appendChild(resetPanZoomControlShape2); 547 548 return resetPanZoomControl; 549 }, 550 551 _createZoomOut: function(instance) { 552 // zoom out 553 var zoomOut = document.createElementNS(SvgUtils.svgNS, "g"); 554 zoomOut.setAttribute("id", "svg-pan-zoom-zoom-out"); 555 zoomOut.setAttribute("transform", "translate(30.5 70) scale(0.015)"); 556 zoomOut.setAttribute("class", "svg-pan-zoom-control"); 557 zoomOut.addEventListener( 558 "click", 559 function() { 560 instance.getPublicInstance().zoomOut(); 561 }, 562 false 563 ); 564 zoomOut.addEventListener( 565 "touchstart", 566 function() { 567 instance.getPublicInstance().zoomOut(); 568 }, 569 false 570 ); 571
vendor: 81,966 bytes, lines 572-2698
572 var zoomOutBackground = document.createElementNS(SvgUtils.svgNS, "rect"); // TODO change these background space fillers to rounded rectangles so they look prettier 573 zoomOutBackground.setAttribute("x", "0"); 574 zoomOutBackground.setAttribute("y", "0"); 575 zoomOutBackground.setAttribute("width", "1500"); // larger than expected because the whole group is transformed to scale down 576 zoomOutBackground.setAttribute("height", "1400"); 577 zoomOutBackground.setAttribute("class", "svg-pan-zoom-control-background"); 578 zoomOut.appendChild(zoomOutBackground); 579 580 var zoomOutShape = document.createElementNS(SvgUtils.svgNS, "path"); 581 zoomOutShape.setAttribute( 582 "d", 583 "M1280 576v128q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h896q26 0 45 19t19 45zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" 584 ); 585 zoomOutShape.setAttribute("class", "svg-pan-zoom-control-element"); 586 zoomOut.appendChild(zoomOutShape); 587 588 return zoomOut; 589 }, 590 591 disable: function(instance) { 592 if (instance.controlIcons) { 593 instance.controlIcons.parentNode.removeChild(instance.controlIcons); 594 instance.controlIcons = null; 595 } 596 } 597 }; 598 599 },{"./svg-utilities":5}],2:[function(require,module,exports){ 600 var SvgUtils = require("./svg-utilities"), 601 Utils = require("./utilities"); 602 603 var ShadowViewport = function(viewport, options) { 604 this.init(viewport, options); 605 }; 606 607 /** 608 * Initialization 609 * 610 * @param {SVGElement} viewport 611 * @param {Object} options 612 */ 613 ShadowViewport.prototype.init = function(viewport, options) { 614 // DOM Elements 615 this.viewport = viewport; 616 this.options = options; 617 618 // State cache 619 this.originalState = { zoom: 1, x: 0, y: 0 }; 620 this.activeState = { zoom: 1, x: 0, y: 0 }; 621 622 this.updateCTMCached = Utils.proxy(this.updateCTM, this); 623 624 // Create a custom requestAnimationFrame taking in account refreshRate 625 this.requestAnimationFrame = Utils.createRequestAnimationFrame( 626 this.options.refreshRate 627 ); 628 629 // ViewBox 630 this.viewBox = { x: 0, y: 0, width: 0, height: 0 }; 631 this.cacheViewBox(); 632 633 // Process CTM 634 var newCTM = this.processCTM(); 635 636 // Update viewport CTM and cache zoom and pan 637 this.setCTM(newCTM); 638 639 // Update CTM in this frame 640 this.updateCTM(); 641 }; 642 643 /** 644 * Cache initial viewBox value 645 * If no viewBox is defined, then use viewport size/position instead for viewBox values 646 */ 647 ShadowViewport.prototype.cacheViewBox = function() { 648 var svgViewBox = this.options.svg.getAttribute("viewBox"); 649 650 if (svgViewBox) { 651 var viewBoxValues = svgViewBox 652 .split(/[\s\,]/) 653 .filter(function(v) { 654 return v; 655 }) 656 .map(parseFloat); 657 658 // Cache viewbox x and y offset 659 this.viewBox.x = viewBoxValues[0]; 660 this.viewBox.y = viewBoxValues[1]; 661 this.viewBox.width = viewBoxValues[2]; 662 this.viewBox.height = viewBoxValues[3]; 663 664 var zoom = Math.min( 665 this.options.width / this.viewBox.width, 666 this.options.height / this.viewBox.height 667 ); 668 669 // Update active state 670 this.activeState.zoom = zoom; 671 this.activeState.x = (this.options.width - this.viewBox.width * zoom) / 2; 672 this.activeState.y = (this.options.height - this.viewBox.height * zoom) / 2; 673 674 // Force updating CTM 675 this.updateCTMOnNextFrame(); 676 677 this.options.svg.removeAttribute("viewBox"); 678 } else { 679 this.simpleViewBoxCache(); 680 } 681 }; 682 683 /** 684 * Recalculate viewport sizes and update viewBox cache 685 */ 686 ShadowViewport.prototype.simpleViewBoxCache = function() { 687 var bBox = this.viewport.getBBox(); 688 689 this.viewBox.x = bBox.x; 690 this.viewBox.y = bBox.y; 691 this.viewBox.width = bBox.width; 692 this.viewBox.height = bBox.height; 693 }; 694 695 /** 696 * Returns a viewbox object. Safe to alter 697 * 698 * @return {Object} viewbox object 699 */ 700 ShadowViewport.prototype.getViewBox = function() { 701 return Utils.extend({}, this.viewBox); 702 }; 703 704 /** 705 * Get initial zoom and pan values. Save them into originalState 706 * Parses viewBox attribute to alter initial sizes 707 * 708 * @return {CTM} CTM object based on options 709 */ 710 ShadowViewport.prototype.processCTM = function() { 711 var newCTM = this.getCTM(); 712 713 if (this.options.fit || this.options.contain) { 714 var newScale; 715 if (this.options.fit) { 716 newScale = Math.min( 717 this.options.width / this.viewBox.width, 718 this.options.height / this.viewBox.height 719 ); 720 } else { 721 newScale = Math.max( 722 this.options.width / this.viewBox.width, 723 this.options.height / this.viewBox.height 724 ); 725 } 726 727 newCTM.a = newScale; //x-scale 728 newCTM.d = newScale; //y-scale 729 newCTM.e = -this.viewBox.x * newScale; //x-transform 730 newCTM.f = -this.viewBox.y * newScale; //y-transform 731 } 732 733 if (this.options.center) { 734 var offsetX = 735 (this.options.width - 736 (this.viewBox.width + this.viewBox.x * 2) * newCTM.a) * 737 0.5, 738 offsetY = 739 (this.options.height - 740 (this.viewBox.height + this.viewBox.y * 2) * newCTM.a) * 741 0.5; 742 743 newCTM.e = offsetX; 744 newCTM.f = offsetY; 745 } 746 747 // Cache initial values. Based on activeState and fix+center opitons 748 this.originalState.zoom = newCTM.a; 749 this.originalState.x = newCTM.e; 750 this.originalState.y = newCTM.f; 751 752 return newCTM; 753 }; 754 755 /** 756 * Return originalState object. Safe to alter 757 * 758 * @return {Object} 759 */ 760 ShadowViewport.prototype.getOriginalState = function() { 761 return Utils.extend({}, this.originalState); 762 }; 763 764 /** 765 * Return actualState object. Safe to alter 766 * 767 * @return {Object} 768 */ 769 ShadowViewport.prototype.getState = function() { 770 return Utils.extend({}, this.activeState); 771 }; 772 773 /** 774 * Get zoom scale 775 * 776 * @return {Float} zoom scale 777 */ 778 ShadowViewport.prototype.getZoom = function() { 779 return this.activeState.zoom; 780 }; 781 782 /** 783 * Get zoom scale for pubilc usage 784 * 785 * @return {Float} zoom scale 786 */ 787 ShadowViewport.prototype.getRelativeZoom = function() { 788 return this.activeState.zoom / this.originalState.zoom; 789 }; 790 791 /** 792 * Compute zoom scale for pubilc usage 793 * 794 * @return {Float} zoom scale 795 */ 796 ShadowViewport.prototype.computeRelativeZoom = function(scale) { 797 return scale / this.originalState.zoom; 798 }; 799 800 /** 801 * Get pan 802 * 803 * @return {Object} 804 */ 805 ShadowViewport.prototype.getPan = function() { 806 return { x: this.activeState.x, y: this.activeState.y }; 807 }; 808 809 /** 810 * Return cached viewport CTM value that can be safely modified 811 * 812 * @return {SVGMatrix} 813 */ 814 ShadowViewport.prototype.getCTM = function() { 815 var safeCTM = this.options.svg.createSVGMatrix(); 816 817 // Copy values manually as in FF they are not itterable 818 safeCTM.a = this.activeState.zoom; 819 safeCTM.b = 0; 820 safeCTM.c = 0; 821 safeCTM.d = this.activeState.zoom; 822 safeCTM.e = this.activeState.x; 823 safeCTM.f = this.activeState.y; 824 825 return safeCTM; 826 }; 827 828 /** 829 * Set a new CTM 830 * 831 * @param {SVGMatrix} newCTM 832 */ 833 ShadowViewport.prototype.setCTM = function(newCTM) { 834 var willZoom = this.isZoomDifferent(newCTM), 835 willPan = this.isPanDifferent(newCTM); 836 837 if (willZoom || willPan) { 838 // Before zoom 839 if (willZoom) { 840 // If returns false then cancel zooming 841 if ( 842 this.options.beforeZoom( 843 this.getRelativeZoom(), 844 this.computeRelativeZoom(newCTM.a) 845 ) === false 846 ) { 847 newCTM.a = newCTM.d = this.activeState.zoom; 848 willZoom = false; 849 } else { 850 this.updateCache(newCTM); 851 this.options.onZoom(this.getRelativeZoom()); 852 } 853 } 854 855 // Before pan 856 if (willPan) { 857 var preventPan = this.options.beforePan(this.getPan(), { 858 x: newCTM.e, 859 y: newCTM.f 860 }), 861 // If prevent pan is an object 862 preventPanX = false, 863 preventPanY = false; 864 865 // If prevent pan is Boolean false 866 if (preventPan === false) { 867 // Set x and y same as before 868 newCTM.e = this.getPan().x; 869 newCTM.f = this.getPan().y; 870 871 preventPanX = preventPanY = true; 872 } else if (Utils.isObject(preventPan)) { 873 // Check for X axes attribute 874 if (preventPan.x === false) { 875 // Prevent panning on x axes 876 newCTM.e = this.getPan().x; 877 preventPanX = true; 878 } else if (Utils.isNumber(preventPan.x)) { 879 // Set a custom pan value 880 newCTM.e = preventPan.x; 881 } 882 883 // Check for Y axes attribute 884 if (preventPan.y === false) { 885 // Prevent panning on x axes 886 newCTM.f = this.getPan().y; 887 preventPanY = true; 888 } else if (Utils.isNumber(preventPan.y)) { 889 // Set a custom pan value 890 newCTM.f = preventPan.y; 891 } 892 } 893 894 // Update willPan flag 895 // Check if newCTM is still different 896 if ((preventPanX && preventPanY) || !this.isPanDifferent(newCTM)) { 897 willPan = false; 898 } else { 899 this.updateCache(newCTM); 900 this.options.onPan(this.getPan()); 901 } 902 } 903 904 // Check again if should zoom or pan 905 if (willZoom || willPan) { 906 this.updateCTMOnNextFrame(); 907 } 908 } 909 }; 910 911 ShadowViewport.prototype.isZoomDifferent = function(newCTM) { 912 return this.activeState.zoom !== newCTM.a; 913 }; 914 915 ShadowViewport.prototype.isPanDifferent = function(newCTM) { 916 return this.activeState.x !== newCTM.e || this.activeState.y !== newCTM.f; 917 }; 918 919 /** 920 * Update cached CTM and active state 921 * 922 * @param {SVGMatrix} newCTM 923 */ 924 ShadowViewport.prototype.updateCache = function(newCTM) { 925 this.activeState.zoom = newCTM.a; 926 this.activeState.x = newCTM.e; 927 this.activeState.y = newCTM.f; 928 }; 929 930 ShadowViewport.prototype.pendingUpdate = false; 931 932 /** 933 * Place a request to update CTM on next Frame 934 */ 935 ShadowViewport.prototype.updateCTMOnNextFrame = function() { 936 if (!this.pendingUpdate) { 937 // Lock 938 this.pendingUpdate = true; 939 940 // Throttle next update 941 this.requestAnimationFrame.call(window, this.updateCTMCached); 942 } 943 }; 944 945 /** 946 * Update viewport CTM with cached CTM 947 */ 948 ShadowViewport.prototype.updateCTM = function() { 949 var ctm = this.getCTM(); 950 951 // Updates SVG element 952 SvgUtils.setCTM(this.viewport, ctm, this.defs); 953 954 // Free the lock 955 this.pendingUpdate = false; 956 957 // Notify about the update 958 if (this.options.onUpdatedCTM) { 959 this.options.onUpdatedCTM(ctm); 960 } 961 }; 962 963 module.exports = function(viewport, options) { 964 return new ShadowViewport(viewport, options); 965 }; 966 967 },{"./svg-utilities":5,"./utilities":7}],3:[function(require,module,exports){ 968 var svgPanZoom = require("./svg-pan-zoom.js"); 969 970// UMD module definition 971 (function(window, document) { 972 // AMD 973 if (typeof define === "function" && define.amd) { 974 define("svg-pan-zoom", function() { 975 return svgPanZoom; 976 }); 977 // CMD 978 } else if (typeof module !== "undefined" && module.exports) { 979 module.exports = svgPanZoom; 980 981 // Browser 982 // Keep exporting globally as module.exports is available because of browserify 983 window.svgPanZoom = svgPanZoom; 984 } 985 })(window, document); 986 987 },{"./svg-pan-zoom.js":4}],4:[function(require,module,exports){ 988 var Wheel = require("./uniwheel"), 989 ControlIcons = require("./control-icons"), 990 Utils = require("./utilities"), 991 SvgUtils = require("./svg-utilities"), 992 ShadowViewport = require("./shadow-viewport"); 993 994 var SvgPanZoom = function(svg, options) { 995 this.init(svg, options); 996 }; 997 998 var optionsDefaults = { 999 viewportSelector: ".svg-pan-zoom_viewport", // Viewport selector. Can be querySelector string or SVGElement 1000 panEnabled: true, // enable or disable panning (default enabled) 1001 controlIconsEnabled: false, // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) 1002 zoomEnabled: true, // enable or disable zooming (default enabled) 1003 dblClickZoomEnabled: true, // enable or disable zooming by double clicking (default enabled) 1004 mouseWheelZoomEnabled: true, // enable or disable zooming by mouse wheel (default enabled) 1005 preventMouseEventsDefault: true, // enable or disable preventDefault for mouse events 1006 zoomScaleSensitivity: 0.1, // Zoom sensitivity 1007 minZoom: 0.5, // Minimum Zoom level 1008 maxZoom: 10, // Maximum Zoom level 1009 fit: true, // enable or disable viewport fit in SVG (default true) 1010 contain: false, // enable or disable viewport contain the svg (default false) 1011 center: true, // enable or disable viewport centering in SVG (default true) 1012 refreshRate: "auto", // Maximum number of frames per second (altering SVG's viewport) 1013 beforeZoom: null, 1014 onZoom: null, 1015 beforePan: null, 1016 onPan: null, 1017 customEventsHandler: null, 1018 eventsListenerElement: null, 1019 onUpdatedCTM: null 1020 }; 1021 1022 var passiveListenerOption = { passive: true }; 1023 1024 SvgPanZoom.prototype.init = function(svg, options) { 1025 var that = this; 1026 1027 this.svg = svg; 1028 this.defs = svg.querySelector("defs"); 1029 1030 // Add default attributes to SVG 1031 SvgUtils.setupSvgAttributes(this.svg); 1032 1033 // Set options 1034 this.options = Utils.extend(Utils.extend({}, optionsDefaults), options); 1035 1036 // Set default state 1037 this.state = "none"; 1038 1039 // Get dimensions 1040 var boundingClientRectNormalized = SvgUtils.getBoundingClientRectNormalized( 1041 svg 1042 ); 1043 this.width = boundingClientRectNormalized.width; 1044 this.height = boundingClientRectNormalized.height; 1045 1046 // Init shadow viewport 1047 this.viewport = ShadowViewport( 1048 SvgUtils.getOrCreateViewport(this.svg, this.options.viewportSelector), 1049 { 1050 svg: this.svg, 1051 width: this.width, 1052 height: this.height, 1053 fit: this.options.fit, 1054 contain: this.options.contain, 1055 center: this.options.center, 1056 refreshRate: this.options.refreshRate, 1057 // Put callbacks into functions as they can change through time 1058 beforeZoom: function(oldScale, newScale) { 1059 if (that.viewport && that.options.beforeZoom) { 1060 return that.options.beforeZoom(oldScale, newScale); 1061 } 1062 }, 1063 onZoom: function(scale) { 1064 if (that.viewport && that.options.onZoom) { 1065 return that.options.onZoom(scale); 1066 } 1067 }, 1068 beforePan: function(oldPoint, newPoint) { 1069 if (that.viewport && that.options.beforePan) { 1070 return that.options.beforePan(oldPoint, newPoint); 1071 } 1072 }, 1073 onPan: function(point) { 1074 if (that.viewport && that.options.onPan) { 1075 return that.options.onPan(point); 1076 } 1077 }, 1078 onUpdatedCTM: function(ctm) { 1079 if (that.viewport && that.options.onUpdatedCTM) { 1080 return that.options.onUpdatedCTM(ctm); 1081 } 1082 } 1083 } 1084 ); 1085 1086 // Wrap callbacks into public API context 1087 var publicInstance = this.getPublicInstance(); 1088 publicInstance.setBeforeZoom(this.options.beforeZoom); 1089 publicInstance.setOnZoom(this.options.onZoom); 1090 publicInstance.setBeforePan(this.options.beforePan); 1091 publicInstance.setOnPan(this.options.onPan); 1092 publicInstance.setOnUpdatedCTM(this.options.onUpdatedCTM); 1093 1094 if (this.options.controlIconsEnabled) { 1095 ControlIcons.enable(this); 1096 } 1097 1098 // Init events handlers 1099 this.lastMouseWheelEventTime = Date.now(); 1100 this.setupHandlers(); 1101 }; 1102 1103 /** 1104 * Register event handlers 1105 */ 1106 SvgPanZoom.prototype.setupHandlers = function() { 1107 var that = this, 1108 prevEvt = null; // use for touchstart event to detect double tap 1109 1110 this.eventListeners = { 1111 // Mouse down group 1112 mousedown: function(evt) { 1113 var result = that.handleMouseDown(evt, prevEvt); 1114 prevEvt = evt; 1115 return result; 1116 }, 1117 touchstart: function(evt) { 1118 var result = that.handleMouseDown(evt, prevEvt); 1119 prevEvt = evt; 1120 return result; 1121 }, 1122 1123 // Mouse up group 1124 mouseup: function(evt) { 1125 return that.handleMouseUp(evt); 1126 }, 1127 touchend: function(evt) { 1128 return that.handleMouseUp(evt); 1129 }, 1130 1131 // Mouse move group 1132 mousemove: function(evt) { 1133 return that.handleMouseMove(evt); 1134 }, 1135 touchmove: function(evt) { 1136 return that.handleMouseMove(evt); 1137 }, 1138 1139 // Mouse leave group 1140 mouseleave: function(evt) { 1141 return that.handleMouseUp(evt); 1142 }, 1143 touchleave: function(evt) { 1144 return that.handleMouseUp(evt); 1145 }, 1146 touchcancel: function(evt) { 1147 return that.handleMouseUp(evt); 1148 } 1149 }; 1150 1151 // Init custom events handler if available 1152 // eslint-disable-next-line eqeqeq 1153 if (this.options.customEventsHandler != null) { 1154 this.options.customEventsHandler.init({ 1155 svgElement: this.svg, 1156 eventsListenerElement: this.options.eventsListenerElement, 1157 instance: this.getPublicInstance() 1158 }); 1159 1160 // Custom event handler may halt builtin listeners 1161 var haltEventListeners = this.options.customEventsHandler 1162 .haltEventListeners; 1163 if (haltEventListeners && haltEventListeners.length) { 1164 for (var i = haltEventListeners.length - 1; i >= 0; i--) { 1165 if (this.eventListeners.hasOwnProperty(haltEventListeners[i])) { 1166 delete this.eventListeners[haltEventListeners[i]]; 1167 } 1168 } 1169 } 1170 } 1171 1172 // Bind eventListeners 1173 for (var event in this.eventListeners) { 1174 // Attach event to eventsListenerElement or SVG if not available 1175 (this.options.eventsListenerElement || this.svg).addEventListener( 1176 event, 1177 this.eventListeners[event], 1178 !this.options.preventMouseEventsDefault ? passiveListenerOption : false 1179 ); 1180 } 1181 1182 // Zoom using mouse wheel 1183 if (this.options.mouseWheelZoomEnabled) { 1184 this.options.mouseWheelZoomEnabled = false; // set to false as enable will set it back to true 1185 this.enableMouseWheelZoom(); 1186 } 1187 }; 1188 1189 /** 1190 * Enable ability to zoom using mouse wheel 1191 */ 1192 SvgPanZoom.prototype.enableMouseWheelZoom = function() { 1193 if (!this.options.mouseWheelZoomEnabled) { 1194 var that = this; 1195 1196 // Mouse wheel listener 1197 this.wheelListener = function(evt) { 1198 return that.handleMouseWheel(evt); 1199 }; 1200 1201 // Bind wheelListener 1202 var isPassiveListener = !this.options.preventMouseEventsDefault; 1203 Wheel.on( 1204 this.options.eventsListenerElement || this.svg, 1205 this.wheelListener, 1206 isPassiveListener 1207 ); 1208 1209 this.options.mouseWheelZoomEnabled = true; 1210 } 1211 }; 1212 1213 /** 1214 * Disable ability to zoom using mouse wheel 1215 */ 1216 SvgPanZoom.prototype.disableMouseWheelZoom = function() { 1217 if (this.options.mouseWheelZoomEnabled) { 1218 var isPassiveListener = !this.options.preventMouseEventsDefault; 1219 Wheel.off( 1220 this.options.eventsListenerElement || this.svg, 1221 this.wheelListener, 1222 isPassiveListener 1223 ); 1224 this.options.mouseWheelZoomEnabled = false; 1225 } 1226 }; 1227 1228 /** 1229 * Handle mouse wheel event 1230 * 1231 * @param {Event} evt 1232 */ 1233 SvgPanZoom.prototype.handleMouseWheel = function(evt) { 1234 if (!this.options.zoomEnabled || this.state !== "none") { 1235 return; 1236 } 1237 1238 if (this.options.preventMouseEventsDefault) { 1239 if (evt.preventDefault) { 1240 evt.preventDefault(); 1241 } else { 1242 evt.returnValue = false; 1243 } 1244 } 1245 1246 // Default delta in case that deltaY is not available 1247 var delta = evt.deltaY || 1, 1248 timeDelta = Date.now() - this.lastMouseWheelEventTime, 1249 divider = 3 + Math.max(0, 30 - timeDelta); 1250 1251 // Update cache 1252 this.lastMouseWheelEventTime = Date.now(); 1253 1254 // Make empirical adjustments for browsers that give deltaY in pixels (deltaMode=0) 1255 if ("deltaMode" in evt && evt.deltaMode === 0 && evt.wheelDelta) { 1256 delta = evt.deltaY === 0 ? 0 : Math.abs(evt.wheelDelta) / evt.deltaY; 1257 } 1258 1259 delta = 1260 -0.3 < delta && delta < 0.3 1261 ? delta 1262 : ((delta > 0 ? 1 : -1) * Math.log(Math.abs(delta) + 10)) / divider; 1263 1264 var inversedScreenCTM = this.svg.getScreenCTM().inverse(), 1265 relativeMousePoint = SvgUtils.getEventPoint(evt, this.svg).matrixTransform( 1266 inversedScreenCTM 1267 ), 1268 zoom = Math.pow(1 + this.options.zoomScaleSensitivity, -1 * delta); // multiplying by neg. 1 so as to make zoom in/out behavior match Google maps behavior 1269 1270 this.zoomAtPoint(zoom, relativeMousePoint); 1271 }; 1272 1273 /** 1274 * Zoom in at a SVG point 1275 * 1276 * @param {SVGPoint} point 1277 * @param {Float} zoomScale Number representing how much to zoom 1278 * @param {Boolean} zoomAbsolute Default false. If true, zoomScale is treated as an absolute value. 1279 * Otherwise, zoomScale is treated as a multiplied (e.g. 1.10 would zoom in 10%) 1280 */ 1281 SvgPanZoom.prototype.zoomAtPoint = function(zoomScale, point, zoomAbsolute) { 1282 var originalState = this.viewport.getOriginalState(); 1283 1284 if (!zoomAbsolute) { 1285 // Fit zoomScale in set bounds 1286 if ( 1287 this.getZoom() * zoomScale < 1288 this.options.minZoom * originalState.zoom 1289 ) { 1290 zoomScale = (this.options.minZoom * originalState.zoom) / this.getZoom(); 1291 } else if ( 1292 this.getZoom() * zoomScale > 1293 this.options.maxZoom * originalState.zoom 1294 ) { 1295 zoomScale = (this.options.maxZoom * originalState.zoom) / this.getZoom(); 1296 } 1297 } else { 1298 // Fit zoomScale in set bounds 1299 zoomScale = Math.max( 1300 this.options.minZoom * originalState.zoom, 1301 Math.min(this.options.maxZoom * originalState.zoom, zoomScale) 1302 ); 1303 // Find relative scale to achieve desired scale 1304 zoomScale = zoomScale / this.getZoom(); 1305 } 1306 1307 var oldCTM = this.viewport.getCTM(), 1308 relativePoint = point.matrixTransform(oldCTM.inverse()), 1309 modifier = this.svg 1310 .createSVGMatrix() 1311 .translate(relativePoint.x, relativePoint.y) 1312 .scale(zoomScale) 1313 .translate(-relativePoint.x, -relativePoint.y), 1314 newCTM = oldCTM.multiply(modifier); 1315 1316 if (newCTM.a !== oldCTM.a) { 1317 this.viewport.setCTM(newCTM); 1318 } 1319 }; 1320 1321 /** 1322 * Zoom at center point 1323 * 1324 * @param {Float} scale 1325 * @param {Boolean} absolute Marks zoom scale as relative or absolute 1326 */ 1327 SvgPanZoom.prototype.zoom = function(scale, absolute) { 1328 this.zoomAtPoint( 1329 scale, 1330 SvgUtils.getSvgCenterPoint(this.svg, this.width, this.height), 1331 absolute 1332 ); 1333 }; 1334 1335 /** 1336 * Zoom used by public instance 1337 * 1338 * @param {Float} scale 1339 * @param {Boolean} absolute Marks zoom scale as relative or absolute 1340 */ 1341 SvgPanZoom.prototype.publicZoom = function(scale, absolute) { 1342 if (absolute) { 1343 scale = this.computeFromRelativeZoom(scale); 1344 } 1345 1346 this.zoom(scale, absolute); 1347 }; 1348 1349 /** 1350 * Zoom at point used by public instance 1351 * 1352 * @param {Float} scale 1353 * @param {SVGPoint|Object} point An object that has x and y attributes 1354 * @param {Boolean} absolute Marks zoom scale as relative or absolute 1355 */ 1356 SvgPanZoom.prototype.publicZoomAtPoint = function(scale, point, absolute) { 1357 if (absolute) { 1358 // Transform zoom into a relative value 1359 scale = this.computeFromRelativeZoom(scale); 1360 } 1361 1362 // If not a SVGPoint but has x and y then create a SVGPoint 1363 if (Utils.getType(point) !== "SVGPoint") { 1364 if ("x" in point && "y" in point) { 1365 point = SvgUtils.createSVGPoint(this.svg, point.x, point.y); 1366 } else { 1367 throw new Error("Given point is invalid"); 1368 } 1369 } 1370 1371 this.zoomAtPoint(scale, point, absolute); 1372 }; 1373 1374 /** 1375 * Get zoom scale 1376 * 1377 * @return {Float} zoom scale 1378 */ 1379 SvgPanZoom.prototype.getZoom = function() { 1380 return this.viewport.getZoom(); 1381 }; 1382 1383 /** 1384 * Get zoom scale for public usage 1385 * 1386 * @return {Float} zoom scale 1387 */ 1388 SvgPanZoom.prototype.getRelativeZoom = function() { 1389 return this.viewport.getRelativeZoom(); 1390 }; 1391 1392 /** 1393 * Compute actual zoom from public zoom 1394 * 1395 * @param {Float} zoom 1396 * @return {Float} zoom scale 1397 */ 1398 SvgPanZoom.prototype.computeFromRelativeZoom = function(zoom) { 1399 return zoom * this.viewport.getOriginalState().zoom; 1400 }; 1401 1402 /** 1403 * Set zoom to initial state 1404 */ 1405 SvgPanZoom.prototype.resetZoom = function() { 1406 var originalState = this.viewport.getOriginalState(); 1407 1408 this.zoom(originalState.zoom, true); 1409 }; 1410 1411 /** 1412 * Set pan to initial state 1413 */ 1414 SvgPanZoom.prototype.resetPan = function() { 1415 this.pan(this.viewport.getOriginalState()); 1416 }; 1417 1418 /** 1419 * Set pan and zoom to initial state 1420 */ 1421 SvgPanZoom.prototype.reset = function() { 1422 this.resetZoom(); 1423 this.resetPan(); 1424 }; 1425 1426 /** 1427 * Handle double click event 1428 * See handleMouseDown() for alternate detection method 1429 * 1430 * @param {Event} evt 1431 */ 1432 SvgPanZoom.prototype.handleDblClick = function(evt) { 1433 if (this.options.preventMouseEventsDefault) { 1434 if (evt.preventDefault) { 1435 evt.preventDefault(); 1436 } else { 1437 evt.returnValue = false; 1438 } 1439 } 1440 1441 // Check if target was a control button 1442 if (this.options.controlIconsEnabled) { 1443 var targetClass = evt.target.getAttribute("class") || ""; 1444 if (targetClass.indexOf("svg-pan-zoom-control") > -1) { 1445 return false; 1446 } 1447 } 1448 1449 var zoomFactor; 1450 1451 if (evt.shiftKey) { 1452 zoomFactor = 1 / ((1 + this.options.zoomScaleSensitivity) * 2); // zoom out when shift key pressed 1453 } else { 1454 zoomFactor = (1 + this.options.zoomScaleSensitivity) * 2; 1455 } 1456 1457 var point = SvgUtils.getEventPoint(evt, this.svg).matrixTransform( 1458 this.svg.getScreenCTM().inverse() 1459 ); 1460 this.zoomAtPoint(zoomFactor, point); 1461 }; 1462 1463 /** 1464 * Handle click event 1465 * 1466 * @param {Event} evt 1467 */ 1468 SvgPanZoom.prototype.handleMouseDown = function(evt, prevEvt) { 1469 if (this.options.preventMouseEventsDefault) { 1470 if (evt.preventDefault) { 1471 evt.preventDefault(); 1472 } else { 1473 evt.returnValue = false; 1474 } 1475 } 1476 1477 Utils.mouseAndTouchNormalize(evt, this.svg); 1478 1479 // Double click detection; more consistent than ondblclick 1480 if (this.options.dblClickZoomEnabled && Utils.isDblClick(evt, prevEvt)) { 1481 this.handleDblClick(evt); 1482 } else { 1483 // Pan mode 1484 this.state = "pan"; 1485 this.firstEventCTM = this.viewport.getCTM(); 1486 this.stateOrigin = SvgUtils.getEventPoint(evt, this.svg).matrixTransform( 1487 this.firstEventCTM.inverse() 1488 ); 1489 } 1490 }; 1491 1492 /** 1493 * Handle mouse move event 1494 * 1495 * @param {Event} evt 1496 */ 1497 SvgPanZoom.prototype.handleMouseMove = function(evt) { 1498 if (this.options.preventMouseEventsDefault) { 1499 if (evt.preventDefault) { 1500 evt.preventDefault(); 1501 } else { 1502 evt.returnValue = false; 1503 } 1504 } 1505 1506 if (this.state === "pan" && this.options.panEnabled) { 1507 // Pan mode 1508 var point = SvgUtils.getEventPoint(evt, this.svg).matrixTransform( 1509 this.firstEventCTM.inverse() 1510 ), 1511 viewportCTM = this.firstEventCTM.translate( 1512 point.x - this.stateOrigin.x, 1513 point.y - this.stateOrigin.y 1514 ); 1515 1516 this.viewport.setCTM(viewportCTM); 1517 } 1518 }; 1519 1520 /** 1521 * Handle mouse button release event 1522 * 1523 * @param {Event} evt 1524 */ 1525 SvgPanZoom.prototype.handleMouseUp = function(evt) { 1526 if (this.options.preventMouseEventsDefault) { 1527 if (evt.preventDefault) { 1528 evt.preventDefault(); 1529 } else { 1530 evt.returnValue = false; 1531 } 1532 } 1533 1534 if (this.state === "pan") { 1535 // Quit pan mode 1536 this.state = "none"; 1537 } 1538 }; 1539 1540 /** 1541 * Adjust viewport size (only) so it will fit in SVG 1542 * Does not center image 1543 */ 1544 SvgPanZoom.prototype.fit = function() { 1545 var viewBox = this.viewport.getViewBox(), 1546 newScale = Math.min( 1547 this.width / viewBox.width, 1548 this.height / viewBox.height 1549 ); 1550 1551 this.zoom(newScale, true); 1552 }; 1553 1554 /** 1555 * Adjust viewport size (only) so it will contain the SVG 1556 * Does not center image 1557 */ 1558 SvgPanZoom.prototype.contain = function() { 1559 var viewBox = this.viewport.getViewBox(), 1560 newScale = Math.max( 1561 this.width / viewBox.width, 1562 this.height / viewBox.height 1563 ); 1564 1565 this.zoom(newScale, true); 1566 }; 1567 1568 /** 1569 * Adjust viewport pan (only) so it will be centered in SVG 1570 * Does not zoom/fit/contain image 1571 */ 1572 SvgPanZoom.prototype.center = function() { 1573 var viewBox = this.viewport.getViewBox(), 1574 offsetX = 1575 (this.width - (viewBox.width + viewBox.x * 2) * this.getZoom()) * 0.5, 1576 offsetY = 1577 (this.height - (viewBox.height + viewBox.y * 2) * this.getZoom()) * 0.5; 1578 1579 this.getPublicInstance().pan({ x: offsetX, y: offsetY }); 1580 }; 1581 1582 /** 1583 * Update content cached BorderBox 1584 * Use when viewport contents change 1585 */ 1586 SvgPanZoom.prototype.updateBBox = function() { 1587 this.viewport.simpleViewBoxCache(); 1588 }; 1589 1590 /** 1591 * Pan to a rendered position 1592 * 1593 * @param {Object} point {x: 0, y: 0} 1594 */ 1595 SvgPanZoom.prototype.pan = function(point) { 1596 var viewportCTM = this.viewport.getCTM(); 1597 viewportCTM.e = point.x; 1598 viewportCTM.f = point.y; 1599 this.viewport.setCTM(viewportCTM); 1600 }; 1601 1602 /** 1603 * Relatively pan the graph by a specified rendered position vector 1604 * 1605 * @param {Object} point {x: 0, y: 0} 1606 */ 1607 SvgPanZoom.prototype.panBy = function(point) { 1608 var viewportCTM = this.viewport.getCTM(); 1609 viewportCTM.e += point.x; 1610 viewportCTM.f += point.y; 1611 this.viewport.setCTM(viewportCTM); 1612 }; 1613 1614 /** 1615 * Get pan vector 1616 * 1617 * @return {Object} {x: 0, y: 0} 1618 */ 1619 SvgPanZoom.prototype.getPan = function() { 1620 var state = this.viewport.getState(); 1621 1622 return { x: state.x, y: state.y }; 1623 }; 1624 1625 /** 1626 * Recalculates cached svg dimensions and controls position 1627 */ 1628 SvgPanZoom.prototype.resize = function() { 1629 // Get dimensions 1630 var boundingClientRectNormalized = SvgUtils.getBoundingClientRectNormalized( 1631 this.svg 1632 ); 1633 this.width = boundingClientRectNormalized.width; 1634 this.height = boundingClientRectNormalized.height; 1635 1636 // Recalculate original state 1637 var viewport = this.viewport; 1638 viewport.options.width = this.width; 1639 viewport.options.height = this.height; 1640 viewport.processCTM(); 1641 1642 // Reposition control icons by re-enabling them 1643 if (this.options.controlIconsEnabled) { 1644 this.getPublicInstance().disableControlIcons(); 1645 this.getPublicInstance().enableControlIcons(); 1646 } 1647 }; 1648 1649 /** 1650 * Unbind mouse events, free callbacks and destroy public instance 1651 */ 1652 SvgPanZoom.prototype.destroy = function() { 1653 var that = this; 1654 1655 // Free callbacks 1656 this.beforeZoom = null; 1657 this.onZoom = null; 1658 this.beforePan = null; 1659 this.onPan = null; 1660 this.onUpdatedCTM = null; 1661 1662 // Destroy custom event handlers 1663 // eslint-disable-next-line eqeqeq 1664 if (this.options.customEventsHandler != null) { 1665 this.options.customEventsHandler.destroy({ 1666 svgElement: this.svg, 1667 eventsListenerElement: this.options.eventsListenerElement, 1668 instance: this.getPublicInstance() 1669 }); 1670 } 1671 1672 // Unbind eventListeners 1673 for (var event in this.eventListeners) { 1674 (this.options.eventsListenerElement || this.svg).removeEventListener( 1675 event, 1676 this.eventListeners[event], 1677 !this.options.preventMouseEventsDefault ? passiveListenerOption : false 1678 ); 1679 } 1680 1681 // Unbind wheelListener 1682 this.disableMouseWheelZoom(); 1683 1684 // Remove control icons 1685 this.getPublicInstance().disableControlIcons(); 1686 1687 // Reset zoom and pan 1688 this.reset(); 1689 1690 // Remove instance from instancesStore 1691 instancesStore = instancesStore.filter(function(instance) { 1692 return instance.svg !== that.svg; 1693 }); 1694 1695 // Delete options and its contents 1696 delete this.options; 1697 1698 // Delete viewport to make public shadow viewport functions uncallable 1699 delete this.viewport; 1700 1701 // Destroy public instance and rewrite getPublicInstance 1702 delete this.publicInstance; 1703 delete this.pi; 1704 this.getPublicInstance = function() { 1705 return null; 1706 }; 1707 }; 1708 1709 /** 1710 * Returns a public instance object 1711 * 1712 * @return {Object} Public instance object 1713 */ 1714 SvgPanZoom.prototype.getPublicInstance = function() { 1715 var that = this; 1716 1717 // Create cache 1718 if (!this.publicInstance) { 1719 this.publicInstance = this.pi = { 1720 // Pan 1721 enablePan: function() { 1722 that.options.panEnabled = true; 1723 return that.pi; 1724 }, 1725 disablePan: function() { 1726 that.options.panEnabled = false; 1727 return that.pi; 1728 }, 1729 isPanEnabled: function() { 1730 return !!that.options.panEnabled; 1731 }, 1732 pan: function(point) { 1733 that.pan(point); 1734 return that.pi; 1735 }, 1736 panBy: function(point) { 1737 that.panBy(point); 1738 return that.pi; 1739 }, 1740 getPan: function() { 1741 return that.getPan(); 1742 }, 1743 // Pan event 1744 setBeforePan: function(fn) { 1745 that.options.beforePan = 1746 fn === null ? null : Utils.proxy(fn, that.publicInstance); 1747 return that.pi; 1748 }, 1749 setOnPan: function(fn) { 1750 that.options.onPan = 1751 fn === null ? null : Utils.proxy(fn, that.publicInstance); 1752 return that.pi; 1753 }, 1754 // Zoom and Control Icons 1755 enableZoom: function() { 1756 that.options.zoomEnabled = true; 1757 return that.pi; 1758 }, 1759 disableZoom: function() { 1760 that.options.zoomEnabled = false; 1761 return that.pi; 1762 }, 1763 isZoomEnabled: function() { 1764 return !!that.options.zoomEnabled; 1765 }, 1766 enableControlIcons: function() { 1767 if (!that.options.controlIconsEnabled) { 1768 that.options.controlIconsEnabled = true; 1769 ControlIcons.enable(that); 1770 } 1771 return that.pi; 1772 }, 1773 disableControlIcons: function() { 1774 if (that.options.controlIconsEnabled) { 1775 that.options.controlIconsEnabled = false; 1776 ControlIcons.disable(that); 1777 } 1778 return that.pi; 1779 }, 1780 isControlIconsEnabled: function() { 1781 return !!that.options.controlIconsEnabled; 1782 }, 1783 // Double click zoom 1784 enableDblClickZoom: function() { 1785 that.options.dblClickZoomEnabled = true; 1786 return that.pi; 1787 }, 1788 disableDblClickZoom: function() { 1789 that.options.dblClickZoomEnabled = false; 1790 return that.pi; 1791 }, 1792 isDblClickZoomEnabled: function() { 1793 return !!that.options.dblClickZoomEnabled; 1794 }, 1795 // Mouse wheel zoom 1796 enableMouseWheelZoom: function() { 1797 that.enableMouseWheelZoom(); 1798 return that.pi; 1799 }, 1800 disableMouseWheelZoom: function() { 1801 that.disableMouseWheelZoom(); 1802 return that.pi; 1803 }, 1804 isMouseWheelZoomEnabled: function() { 1805 return !!that.options.mouseWheelZoomEnabled; 1806 }, 1807 // Zoom scale and bounds 1808 setZoomScaleSensitivity: function(scale) { 1809 that.options.zoomScaleSensitivity = scale; 1810 return that.pi; 1811 }, 1812 setMinZoom: function(zoom) { 1813 that.options.minZoom = zoom; 1814 return that.pi; 1815 }, 1816 setMaxZoom: function(zoom) { 1817 that.options.maxZoom = zoom; 1818 return that.pi; 1819 }, 1820 // Zoom event 1821 setBeforeZoom: function(fn) { 1822 that.options.beforeZoom = 1823 fn === null ? null : Utils.proxy(fn, that.publicInstance); 1824 return that.pi; 1825 }, 1826 setOnZoom: function(fn) { 1827 that.options.onZoom = 1828 fn === null ? null : Utils.proxy(fn, that.publicInstance); 1829 return that.pi; 1830 }, 1831 // Zooming 1832 zoom: function(scale) { 1833 that.publicZoom(scale, true); 1834 return that.pi; 1835 }, 1836 zoomBy: function(scale) { 1837 that.publicZoom(scale, false); 1838 return that.pi; 1839 }, 1840 zoomAtPoint: function(scale, point) { 1841 that.publicZoomAtPoint(scale, point, true); 1842 return that.pi; 1843 }, 1844 zoomAtPointBy: function(scale, point) { 1845 that.publicZoomAtPoint(scale, point, false); 1846 return that.pi; 1847 }, 1848 zoomIn: function() { 1849 this.zoomBy(1 + that.options.zoomScaleSensitivity); 1850 return that.pi; 1851 }, 1852 zoomOut: function() { 1853 this.zoomBy(1 / (1 + that.options.zoomScaleSensitivity)); 1854 return that.pi; 1855 }, 1856 getZoom: function() { 1857 return that.getRelativeZoom(); 1858 }, 1859 // CTM update 1860 setOnUpdatedCTM: function(fn) { 1861 that.options.onUpdatedCTM = 1862 fn === null ? null : Utils.proxy(fn, that.publicInstance); 1863 return that.pi; 1864 }, 1865 // Reset 1866 resetZoom: function() { 1867 that.resetZoom(); 1868 return that.pi; 1869 }, 1870 resetPan: function() { 1871 that.resetPan(); 1872 return that.pi; 1873 }, 1874 reset: function() { 1875 that.reset(); 1876 return that.pi; 1877 }, 1878 // Fit, Contain and Center 1879 fit: function() { 1880 that.fit(); 1881 return that.pi; 1882 }, 1883 contain: function() { 1884 that.contain(); 1885 return that.pi; 1886 }, 1887 center: function() { 1888 that.center(); 1889 return that.pi; 1890 }, 1891 // Size and Resize 1892 updateBBox: function() { 1893 that.updateBBox(); 1894 return that.pi; 1895 }, 1896 resize: function() { 1897 that.resize(); 1898 return that.pi; 1899 }, 1900 getSizes: function() { 1901 return { 1902 width: that.width, 1903 height: that.height, 1904 realZoom: that.getZoom(), 1905 viewBox: that.viewport.getViewBox() 1906 }; 1907 }, 1908 // Destroy 1909 destroy: function() { 1910 that.destroy(); 1911 return that.pi; 1912 } 1913 }; 1914 } 1915 1916 return this.publicInstance; 1917 }; 1918 1919 /** 1920 * Stores pairs of instances of SvgPanZoom and SVG 1921 * Each pair is represented by an object {svg: SVGSVGElement, instance: SvgPanZoom} 1922 * 1923 * @type {Array} 1924 */ 1925 var instancesStore = []; 1926 1927 var svgPanZoom = function(elementOrSelector, options) { 1928 var svg = Utils.getSvg(elementOrSelector); 1929 1930 if (svg === null) { 1931 return null; 1932 } else { 1933 // Look for existent instance 1934 for (var i = instancesStore.length - 1; i >= 0; i--) { 1935 if (instancesStore[i].svg === svg) { 1936 return instancesStore[i].instance.getPublicInstance(); 1937 } 1938 } 1939 1940 // If instance not found - create one 1941 instancesStore.push({ 1942 svg: svg, 1943 instance: new SvgPanZoom(svg, options) 1944 }); 1945 1946 // Return just pushed instance 1947 return instancesStore[ 1948 instancesStore.length - 1 1949 ].instance.getPublicInstance(); 1950 } 1951 }; 1952 1953 module.exports = svgPanZoom; 1954 1955 },{"./control-icons":1,"./shadow-viewport":2,"./svg-utilities":5,"./uniwheel":6,"./utilities":7}],5:[function(require,module,exports){ 1956 var Utils = require("./utilities"), 1957 _browser = "unknown"; 1958 1959// http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser 1960 if (/*@cc_on!@*/ false || !!document.documentMode) { 1961 // internet explorer 1962 _browser = "ie"; 1963 } 1964 1965 module.exports = { 1966 svgNS: "http://www.w3.org/2000/svg", 1967 xmlNS: "http://www.w3.org/XML/1998/namespace", 1968 xmlnsNS: "http://www.w3.org/2000/xmlns/", 1969 xlinkNS: "http://www.w3.org/1999/xlink", 1970 evNS: "http://www.w3.org/2001/xml-events", 1971 1972 /** 1973 * Get svg dimensions: width and height 1974 * 1975 * @param {SVGSVGElement} svg 1976 * @return {Object} {width: 0, height: 0} 1977 */ 1978 getBoundingClientRectNormalized: function(svg) { 1979 if (svg.clientWidth && svg.clientHeight) { 1980 return { width: svg.clientWidth, height: svg.clientHeight }; 1981 } else if (!!svg.getBoundingClientRect()) { 1982 return svg.getBoundingClientRect(); 1983 } else { 1984 throw new Error("Cannot get BoundingClientRect for SVG."); 1985 } 1986 }, 1987 1988 /** 1989 * Gets g element with class of "viewport" or creates it if it doesn't exist 1990 * 1991 * @param {SVGSVGElement} svg 1992 * @return {SVGElement} g (group) element 1993 */ 1994 getOrCreateViewport: function(svg, selector) { 1995 var viewport = null; 1996 1997 if (Utils.isElement(selector)) { 1998 viewport = selector; 1999 } else { 2000 viewport = svg.querySelector(selector); 2001 } 2002 2003 // Check if there is just one main group in SVG 2004 if (!viewport) { 2005 var childNodes = Array.prototype.slice 2006 .call(svg.childNodes || svg.children) 2007 .filter(function(el) { 2008 return el.nodeName !== "defs" && el.nodeName !== "#text"; 2009 }); 2010 2011 // Node name should be SVGGElement and should have no transform attribute 2012 // Groups with transform are not used as viewport because it involves parsing of all transform possibilities 2013 if ( 2014 childNodes.length === 1 && 2015 childNodes[0].nodeName === "g" && 2016 childNodes[0].getAttribute("transform") === null 2017 ) { 2018 viewport = childNodes[0]; 2019 } 2020 } 2021 2022 // If no favorable group element exists then create one 2023 if (!viewport) { 2024 var viewportId = 2025 "viewport-" + new Date().toISOString().replace(/\D/g, ""); 2026 viewport = document.createElementNS(this.svgNS, "g"); 2027 viewport.setAttribute("id", viewportId); 2028 2029 // Internet Explorer (all versions?) can't use childNodes, but other browsers prefer (require?) using childNodes 2030 var svgChildren = svg.childNodes || svg.children; 2031 if (!!svgChildren && svgChildren.length > 0) { 2032 for (var i = svgChildren.length; i > 0; i--) { 2033 // Move everything into viewport except defs 2034 if (svgChildren[svgChildren.length - i].nodeName !== "defs") { 2035 viewport.appendChild(svgChildren[svgChildren.length - i]); 2036 } 2037 } 2038 } 2039 svg.appendChild(viewport); 2040 } 2041 2042 // Parse class names 2043 var classNames = []; 2044 if (viewport.getAttribute("class")) { 2045 classNames = viewport.getAttribute("class").split(" "); 2046 } 2047 2048 // Set class (if not set already) 2049 if (!~classNames.indexOf("svg-pan-zoom_viewport")) { 2050 classNames.push("svg-pan-zoom_viewport"); 2051 viewport.setAttribute("class", classNames.join(" ")); 2052 } 2053 2054 return viewport; 2055 }, 2056 2057 /** 2058 * Set SVG attributes 2059 * 2060 * @param {SVGSVGElement} svg 2061 */ 2062 setupSvgAttributes: function(svg) { 2063 // Setting default attributes 2064 svg.setAttribute("xmlns", this.svgNS); 2065 svg.setAttributeNS(this.xmlnsNS, "xmlns:xlink", this.xlinkNS); 2066 svg.setAttributeNS(this.xmlnsNS, "xmlns:ev", this.evNS); 2067 2068 // Needed for Internet Explorer, otherwise the viewport overflows 2069 if (svg.parentNode !== null) { 2070 var style = svg.getAttribute("style") || ""; 2071 if (style.toLowerCase().indexOf("overflow") === -1) { 2072 svg.setAttribute("style", "overflow: hidden; " + style); 2073 } 2074 } 2075 }, 2076 2077 /** 2078 * How long Internet Explorer takes to finish updating its display (ms). 2079 */ 2080 internetExplorerRedisplayInterval: 300, 2081 2082 /** 2083 * Forces the browser to redisplay all SVG elements that rely on an 2084 * element defined in a 'defs' section. It works globally, for every 2085 * available defs element on the page. 2086 * The throttling is intentionally global. 2087 * 2088 * This is only needed for IE. It is as a hack to make markers (and 'use' elements?) 2089 * visible after pan/zoom when there are multiple SVGs on the page. 2090 * See bug report: https://connect.microsoft.com/IE/feedback/details/781964/ 2091 * also see svg-pan-zoom issue: https://github.com/ariutta/svg-pan-zoom/issues/62 2092 */ 2093 refreshDefsGlobal: Utils.throttle( 2094 function() { 2095 var allDefs = document.querySelectorAll("defs"); 2096 var allDefsCount = allDefs.length; 2097 for (var i = 0; i < allDefsCount; i++) { 2098 var thisDefs = allDefs[i]; 2099 thisDefs.parentNode.insertBefore(thisDefs, thisDefs); 2100 } 2101 }, 2102 this ? this.internetExplorerRedisplayInterval : null 2103 ), 2104 2105 /** 2106 * Sets the current transform matrix of an element 2107 * 2108 * @param {SVGElement} element 2109 * @param {SVGMatrix} matrix CTM 2110 * @param {SVGElement} defs 2111 */ 2112 setCTM: function(element, matrix, defs) { 2113 var that = this, 2114 s = 2115 "matrix(" + 2116 matrix.a + 2117 "," + 2118 matrix.b + 2119 "," + 2120 matrix.c + 2121 "," + 2122 matrix.d + 2123 "," + 2124 matrix.e + 2125 "," + 2126 matrix.f + 2127 ")"; 2128 2129 element.setAttributeNS(null, "transform", s); 2130 if ("transform" in element.style) { 2131 element.style.transform = s; 2132 } else if ("-ms-transform" in element.style) { 2133 element.style["-ms-transform"] = s; 2134 } else if ("-webkit-transform" in element.style) { 2135 element.style["-webkit-transform"] = s; 2136 } 2137 2138 // IE has a bug that makes markers disappear on zoom (when the matrix "a" and/or "d" elements change) 2139 // see http://stackoverflow.com/questions/17654578/svg-marker-does-not-work-in-ie9-10 2140 // and http://srndolha.wordpress.com/2013/11/25/svg-line-markers-may-disappear-in-internet-explorer-11/ 2141 if (_browser === "ie" && !!defs) { 2142 // this refresh is intended for redisplaying the SVG during zooming 2143 defs.parentNode.insertBefore(defs, defs); 2144 // this refresh is intended for redisplaying the other SVGs on a page when panning a given SVG 2145 // it is also needed for the given SVG itself, on zoomEnd, if the SVG contains any markers that 2146 // are located under any other element(s). 2147 window.setTimeout(function() { 2148 that.refreshDefsGlobal(); 2149 }, that.internetExplorerRedisplayInterval); 2150 } 2151 }, 2152 2153 /** 2154 * Instantiate an SVGPoint object with given event coordinates 2155 * 2156 * @param {Event} evt 2157 * @param {SVGSVGElement} svg 2158 * @return {SVGPoint} point 2159 */ 2160 getEventPoint: function(evt, svg) { 2161 var point = svg.createSVGPoint(); 2162 2163 Utils.mouseAndTouchNormalize(evt, svg); 2164 2165 point.x = evt.clientX; 2166 point.y = evt.clientY; 2167 2168 return point; 2169 }, 2170 2171 /** 2172 * Get SVG center point 2173 * 2174 * @param {SVGSVGElement} svg 2175 * @return {SVGPoint} 2176 */ 2177 getSvgCenterPoint: function(svg, width, height) { 2178 return this.createSVGPoint(svg, width / 2, height / 2); 2179 }, 2180 2181 /** 2182 * Create a SVGPoint with given x and y 2183 * 2184 * @param {SVGSVGElement} svg 2185 * @param {Number} x 2186 * @param {Number} y 2187 * @return {SVGPoint} 2188 */ 2189 createSVGPoint: function(svg, x, y) { 2190 var point = svg.createSVGPoint(); 2191 point.x = x; 2192 point.y = y; 2193 2194 return point; 2195 } 2196 }; 2197 2198 },{"./utilities":7}],6:[function(require,module,exports){ 2199// uniwheel 0.1.2 (customized) 2200// A unified cross browser mouse wheel event handler 2201// https://github.com/teemualap/uniwheel 2202 2203 module.exports = (function(){ 2204 2205 //Full details: https://developer.mozilla.org/en-US/docs/Web/Reference/Events/wheel 2206 2207 var prefix = "", _addEventListener, _removeEventListener, support, fns = []; 2208 var passiveOption = {passive: true}; 2209 2210 // detect event model 2211 if ( window.addEventListener ) { 2212 _addEventListener = "addEventListener"; 2213 _removeEventListener = "removeEventListener"; 2214 } else { 2215 _addEventListener = "attachEvent"; 2216 _removeEventListener = "detachEvent"; 2217 prefix = "on"; 2218 } 2219 2220 // detect available wheel event 2221 support = "onwheel" in document.createElement("div") ? "wheel" : // Modern browsers support "wheel" 2222 document.onmousewheel !== undefined ? "mousewheel" : // Webkit and IE support at least "mousewheel" 2223 "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox 2224 2225 2226 function createCallback(element,callback) { 2227 2228 var fn = function(originalEvent) { 2229 2230 !originalEvent && ( originalEvent = window.event ); 2231 2232 // create a normalized event object 2233 var event = { 2234 // keep a ref to the original event object 2235 originalEvent: originalEvent, 2236 target: originalEvent.target || originalEvent.srcElement, 2237 type: "wheel", 2238 deltaMode: originalEvent.type == "MozMousePixelScroll" ? 0 : 1, 2239 deltaX: 0, 2240 delatZ: 0, 2241 preventDefault: function() { 2242 originalEvent.preventDefault ? 2243 originalEvent.preventDefault() : 2244 originalEvent.returnValue = false; 2245 } 2246 }; 2247 2248 // calculate deltaY (and deltaX) according to the event 2249 if ( support == "mousewheel" ) { 2250 event.deltaY = - 1/40 * originalEvent.wheelDelta; 2251 // Webkit also support wheelDeltaX 2252 originalEvent.wheelDeltaX && ( event.deltaX = - 1/40 * originalEvent.wheelDeltaX ); 2253 } else { 2254 event.deltaY = originalEvent.detail; 2255 } 2256 2257 // it's time to fire the callback 2258 return callback( event ); 2259 2260 }; 2261 2262 fns.push({ 2263 element: element, 2264 fn: fn, 2265 }); 2266 2267 return fn; 2268 } 2269 2270 function getCallback(element) { 2271 for (var i = 0; i < fns.length; i++) { 2272 if (fns[i].element === element) { 2273 return fns[i].fn; 2274 } 2275 } 2276 return function(){}; 2277 } 2278 2279 function removeCallback(element) { 2280 for (var i = 0; i < fns.length; i++) { 2281 if (fns[i].element === element) { 2282 return fns.splice(i,1); 2283 } 2284 } 2285 } 2286 2287 function _addWheelListener(elem, eventName, callback, isPassiveListener ) { 2288 var cb; 2289 2290 if (support === "wheel") { 2291 cb = callback; 2292 } else { 2293 cb = createCallback(elem, callback); 2294 } 2295 2296 elem[_addEventListener](prefix + eventName, cb, isPassiveListener ? passiveOption : false); 2297 } 2298 2299 function _removeWheelListener(elem, eventName, callback, isPassiveListener ) { 2300 2301 var cb; 2302 2303 if (support === "wheel") { 2304 cb = callback; 2305 } else { 2306 cb = getCallback(elem); 2307 } 2308 2309 elem[_removeEventListener](prefix + eventName, cb, isPassiveListener ? passiveOption : false); 2310 2311 removeCallback(elem); 2312 } 2313 2314 function addWheelListener( elem, callback, isPassiveListener ) { 2315 _addWheelListener(elem, support, callback, isPassiveListener ); 2316 2317 // handle MozMousePixelScroll in older Firefox 2318 if( support == "DOMMouseScroll" ) { 2319 _addWheelListener(elem, "MozMousePixelScroll", callback, isPassiveListener ); 2320 } 2321 } 2322 2323 function removeWheelListener(elem, callback, isPassiveListener){ 2324 _removeWheelListener(elem, support, callback, isPassiveListener); 2325 2326 // handle MozMousePixelScroll in older Firefox 2327 if( support == "DOMMouseScroll" ) { 2328 _removeWheelListener(elem, "MozMousePixelScroll", callback, isPassiveListener); 2329 } 2330 } 2331 2332 return { 2333 on: addWheelListener, 2334 off: removeWheelListener 2335 }; 2336 2337 })(); 2338 2339 },{}],7:[function(require,module,exports){ 2340 module.exports = { 2341 /** 2342 * Extends an object 2343 * 2344 * @param {Object} target object to extend 2345 * @param {Object} source object to take properties from 2346 * @return {Object} extended object 2347 */ 2348 extend: function(target, source) { 2349 target = target || {}; 2350 for (var prop in source) { 2351 // Go recursively 2352 if (this.isObject(source[prop])) { 2353 target[prop] = this.extend(target[prop], source[prop]); 2354 } else { 2355 target[prop] = source[prop]; 2356 } 2357 } 2358 return target; 2359 }, 2360 2361 /** 2362 * Checks if an object is a DOM element 2363 * 2364 * @param {Object} o HTML element or String 2365 * @return {Boolean} returns true if object is a DOM element 2366 */ 2367 isElement: function(o) { 2368 return ( 2369 o instanceof HTMLElement || 2370 o instanceof SVGElement || 2371 o instanceof SVGSVGElement || //DOM2 2372 (o && 2373 typeof o === "object" && 2374 o !== null && 2375 o.nodeType === 1 && 2376 typeof o.nodeName === "string") 2377 ); 2378 }, 2379 2380 /** 2381 * Checks if an object is an Object 2382 * 2383 * @param {Object} o Object 2384 * @return {Boolean} returns true if object is an Object 2385 */ 2386 isObject: function(o) { 2387 return Object.prototype.toString.call(o) === "[object Object]"; 2388 }, 2389 2390 /** 2391 * Checks if variable is Number 2392 * 2393 * @param {Integer|Float} n 2394 * @return {Boolean} returns true if variable is Number 2395 */ 2396 isNumber: function(n) { 2397 return !isNaN(parseFloat(n)) && isFinite(n); 2398 }, 2399 2400 /** 2401 * Search for an SVG element 2402 * 2403 * @param {Object|String} elementOrSelector DOM Element or selector String 2404 * @return {Object|Null} SVG or null 2405 */ 2406 getSvg: function(elementOrSelector) { 2407 var element, svg; 2408 2409 if (!this.isElement(elementOrSelector)) { 2410 // If selector provided 2411 if ( 2412 typeof elementOrSelector === "string" || 2413 elementOrSelector instanceof String 2414 ) { 2415 // Try to find the element 2416 element = document.querySelector(elementOrSelector); 2417 2418 if (!element) { 2419 throw new Error( 2420 "Provided selector did not find any elements. Selector: " + 2421 elementOrSelector 2422 ); 2423 return null; 2424 } 2425 } else { 2426 throw new Error("Provided selector is not an HTML object nor String"); 2427 return null; 2428 } 2429 } else { 2430 element = elementOrSelector; 2431 } 2432 2433 if (element.tagName.toLowerCase() === "svg") { 2434 svg = element; 2435 } else { 2436 if (element.tagName.toLowerCase() === "object") { 2437 svg = element.contentDocument.documentElement; 2438 } else { 2439 if (element.tagName.toLowerCase() === "embed") { 2440 svg = element.getSVGDocument().documentElement; 2441 } else { 2442 if (element.tagName.toLowerCase() === "img") { 2443 throw new Error( 2444 'Cannot script an SVG in an "img" element. Please use an "object" element or an in-line SVG.' 2445 ); 2446 } else { 2447 throw new Error("Cannot get SVG."); 2448 } 2449 return null; 2450 } 2451 } 2452 } 2453 2454 return svg; 2455 }, 2456 2457 /** 2458 * Attach a given context to a function 2459 * @param {Function} fn Function 2460 * @param {Object} context Context 2461 * @return {Function} Function with certain context 2462 */ 2463 proxy: function(fn, context) { 2464 return function() { 2465 return fn.apply(context, arguments); 2466 }; 2467 }, 2468 2469 /** 2470 * Returns object type 2471 * Uses toString that returns [object SVGPoint] 2472 * And than parses object type from string 2473 * 2474 * @param {Object} o Any object 2475 * @return {String} Object type 2476 */ 2477 getType: function(o) { 2478 return Object.prototype.toString 2479 .apply(o) 2480 .replace(/^\[object\s/, "") 2481 .replace(/\]$/, ""); 2482 }, 2483 2484 /** 2485 * If it is a touch event than add clientX and clientY to event object 2486 * 2487 * @param {Event} evt 2488 * @param {SVGSVGElement} svg 2489 */ 2490 mouseAndTouchNormalize: function(evt, svg) { 2491 // If no clientX then fallback 2492 if (evt.clientX === void 0 || evt.clientX === null) { 2493 // Fallback 2494 evt.clientX = 0; 2495 evt.clientY = 0; 2496 2497 // If it is a touch event 2498 if (evt.touches !== void 0 && evt.touches.length) { 2499 if (evt.touches[0].clientX !== void 0) { 2500 evt.clientX = evt.touches[0].clientX; 2501 evt.clientY = evt.touches[0].clientY; 2502 } else if (evt.touches[0].pageX !== void 0) { 2503 var rect = svg.getBoundingClientRect(); 2504 2505 evt.clientX = evt.touches[0].pageX - rect.left; 2506 evt.clientY = evt.touches[0].pageY - rect.top; 2507 } 2508 // If it is a custom event 2509 } else if (evt.originalEvent !== void 0) { 2510 if (evt.originalEvent.clientX !== void 0) { 2511 evt.clientX = evt.originalEvent.clientX; 2512 evt.clientY = evt.originalEvent.clientY; 2513 } 2514 } 2515 } 2516 }, 2517 2518 /** 2519 * Check if an event is a double click/tap 2520 * TODO: For touch gestures use a library (hammer.js) that takes in account other events 2521 * (touchmove and touchend). It should take in account tap duration and traveled distance 2522 * 2523 * @param {Event} evt 2524 * @param {Event} prevEvt Previous Event 2525 * @return {Boolean} 2526 */ 2527 isDblClick: function(evt, prevEvt) { 2528 // Double click detected by browser 2529 if (evt.detail === 2) { 2530 return true; 2531 } 2532 // Try to compare events 2533 else if (prevEvt !== void 0 && prevEvt !== null) { 2534 var timeStampDiff = evt.timeStamp - prevEvt.timeStamp, // should be lower than 250 ms 2535 touchesDistance = Math.sqrt( 2536 Math.pow(evt.clientX - prevEvt.clientX, 2) + 2537 Math.pow(evt.clientY - prevEvt.clientY, 2) 2538 ); 2539 2540 return timeStampDiff < 250 && touchesDistance < 10; 2541 } 2542 2543 // Nothing found 2544 return false; 2545 }, 2546 2547 /** 2548 * Returns current timestamp as an integer 2549 * 2550 * @return {Number} 2551 */ 2552 now: 2553 Date.now || 2554 function() { 2555 return new Date().getTime(); 2556 }, 2557 2558 // From underscore. 2559 // Returns a function, that, when invoked, will only be triggered at most once 2560 // during a given window of time. Normally, the throttled function will run 2561 // as much as it can, without ever going more than once per `wait` duration; 2562 // but if you'd like to disable the execution on the leading edge, pass 2563 // `{leading: false}`. To disable execution on the trailing edge, ditto. 2564 throttle: function(func, wait, options) { 2565 var that = this; 2566 var context, args, result; 2567 var timeout = null; 2568 var previous = 0; 2569 if (!options) { 2570 options = {}; 2571 } 2572 var later = function() { 2573 previous = options.leading === false ? 0 : that.now(); 2574 timeout = null; 2575 result = func.apply(context, args); 2576 if (!timeout) { 2577 context = args = null; 2578 } 2579 }; 2580 return function() { 2581 var now = that.now(); 2582 if (!previous && options.leading === false) { 2583 previous = now; 2584 } 2585 var remaining = wait - (now - previous); 2586 context = this; // eslint-disable-line consistent-this 2587 args = arguments; 2588 if (remaining <= 0 || remaining > wait) { 2589 clearTimeout(timeout); 2590 timeout = null; 2591 previous = now; 2592 result = func.apply(context, args); 2593 if (!timeout) { 2594 context = args = null; 2595 } 2596 } else if (!timeout && options.trailing !== false) { 2597 timeout = setTimeout(later, remaining); 2598 } 2599 return result; 2600 }; 2601 }, 2602 2603 /** 2604 * Create a requestAnimationFrame simulation 2605 * 2606 * @param {Number|String} refreshRate 2607 * @return {Function} 2608 */ 2609 createRequestAnimationFrame: function(refreshRate) { 2610 var timeout = null; 2611 2612 // Convert refreshRate to timeout 2613 if (refreshRate !== "auto" && refreshRate < 60 && refreshRate > 1) { 2614 timeout = Math.floor(1000 / refreshRate); 2615 } 2616 2617 if (timeout === null) { 2618 return window.requestAnimationFrame || requestTimeout(33); 2619 } else { 2620 return requestTimeout(timeout); 2621 } 2622 } 2623 }; 2624 2625 /** 2626 * Create a callback that will execute after a given timeout 2627 * 2628 * @param {Function} timeout 2629 * @return {Function} 2630 */ 2631 function requestTimeout(timeout) { 2632 return function(callback) { 2633 window.setTimeout(callback, timeout); 2634 }; 2635 } 2636 2637 },{}]},{},[3]); 2638/* End */ 2639; 2640; /* Start:"a:4:{s:4:"full";s:58:"/o-klube/shema-territorii/assets/hammer.js?160241708078529";s:6:"source";s:42:"/o-klube/shema-territorii/assets/hammer.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 2641/*! Hammer.JS - v2.0.4 - 2014-09-28 2642 * http://hammerjs.github.io/ 2643 * 2644 * Copyright (c) 2014 Jorik Tangelder; 2645 * Licensed under the MIT license */ 2646(function(window, document, exportName, undefined) { 2647 'use strict'; 2648 2649 var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o']; 2650 var TEST_ELEMENT = document.createElement('div'); 2651 2652 var TYPE_FUNCTION = 'function'; 2653 2654 var round = Math.round; 2655 var abs = Math.abs; 2656 var now = Date.now; 2657 2658 /** 2659 * set a timeout with a given scope 2660 * @param {Function} fn 2661 * @param {Number} timeout 2662 * @param {Object} context 2663 * @returns {number} 2664 */ 2665 function setTimeoutContext(fn, timeout, context) { 2666 return setTimeout(bindFn(fn, context), timeout); 2667 } 2668 2669 /** 2670 * if the argument is an array, we want to execute the fn on each entry 2671 * if it aint an array we don't want to do a thing. 2672 * this is used by all the methods that accept a single and array argument. 2673 * @param {*|Array} arg 2674 * @param {String} fn 2675 * @param {Object} [context] 2676 * @returns {Boolean} 2677 */ 2678 function invokeArrayArg(arg, fn, context) { 2679 if (Array.isArray(arg)) { 2680 each(arg, context[fn], context); 2681 return true; 2682 } 2683 return false; 2684 } 2685 2686 /** 2687 * walk objects and arrays 2688 * @param {Object} obj 2689 * @param {Function} iterator 2690 * @param {Object} context 2691 */ 2692 function each(obj, iterator, context) { 2693 var i; 2694 2695 if (!obj) { 2696 return; 2697 } 2698
vendor: 19,004 bytes, lines 2699-3329
2699 if (obj.forEach) { 2700 obj.forEach(iterator, context); 2701 } else if (obj.length !== undefined) { 2702 i = 0; 2703 while (i < obj.length) { 2704 iterator.call(context, obj[i], i, obj); 2705 i++; 2706 } 2707 } else { 2708 for (i in obj) { 2709 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); 2710 } 2711 } 2712 } 2713 2714 /** 2715 * extend object. 2716 * means that properties in dest will be overwritten by the ones in src. 2717 * @param {Object} dest 2718 * @param {Object} src 2719 * @param {Boolean} [merge] 2720 * @returns {Object} dest 2721 */ 2722 function extend(dest, src, merge) { 2723 var keys = Object.keys(src); 2724 var i = 0; 2725 while (i < keys.length) { 2726 if (!merge || (merge && dest[keys[i]] === undefined)) { 2727 dest[keys[i]] = src[keys[i]]; 2728 } 2729 i++; 2730 } 2731 return dest; 2732 } 2733 2734 /** 2735 * merge the values from src in the dest. 2736 * means that properties that exist in dest will not be overwritten by src 2737 * @param {Object} dest 2738 * @param {Object} src 2739 * @returns {Object} dest 2740 */ 2741 function merge(dest, src) { 2742 return extend(dest, src, true); 2743 } 2744 2745 /** 2746 * simple class inheritance 2747 * @param {Function} child 2748 * @param {Function} base 2749 * @param {Object} [properties] 2750 */ 2751 function inherit(child, base, properties) { 2752 var baseP = base.prototype, 2753 childP; 2754 2755 childP = child.prototype = Object.create(baseP); 2756 childP.constructor = child; 2757 childP._super = baseP; 2758 2759 if (properties) { 2760 extend(childP, properties); 2761 } 2762 } 2763 2764 /** 2765 * simple function bind 2766 * @param {Function} fn 2767 * @param {Object} context 2768 * @returns {Function} 2769 */ 2770 function bindFn(fn, context) { 2771 return function boundFn() { 2772 return fn.apply(context, arguments); 2773 }; 2774 } 2775 2776 /** 2777 * let a boolean value also be a function that must return a boolean 2778 * this first item in args will be used as the context 2779 * @param {Boolean|Function} val 2780 * @param {Array} [args] 2781 * @returns {Boolean} 2782 */ 2783 function boolOrFn(val, args) { 2784 if (typeof val == TYPE_FUNCTION) { 2785 return val.apply(args ? args[0] || undefined : undefined, args); 2786 } 2787 return val; 2788 } 2789 2790 /** 2791 * use the val2 when val1 is undefined 2792 * @param {*} val1 2793 * @param {*} val2 2794 * @returns {*} 2795 */ 2796 function ifUndefined(val1, val2) { 2797 return (val1 === undefined) ? val2 : val1; 2798 } 2799 2800 /** 2801 * addEventListener with multiple events at once 2802 * @param {EventTarget} target 2803 * @param {String} types 2804 * @param {Function} handler 2805 */ 2806 function addEventListeners(target, types, handler) { 2807 each(splitStr(types), function(type) { 2808 target.addEventListener(type, handler, false); 2809 }); 2810 } 2811 2812 /** 2813 * removeEventListener with multiple events at once 2814 * @param {EventTarget} target 2815 * @param {String} types 2816 * @param {Function} handler 2817 */ 2818 function removeEventListeners(target, types, handler) { 2819 each(splitStr(types), function(type) { 2820 target.removeEventListener(type, handler, false); 2821 }); 2822 } 2823 2824 /** 2825 * find if a node is in the given parent 2826 * @method hasParent 2827 * @param {HTMLElement} node 2828 * @param {HTMLElement} parent 2829 * @return {Boolean} found 2830 */ 2831 function hasParent(node, parent) { 2832 while (node) { 2833 if (node == parent) { 2834 return true; 2835 } 2836 node = node.parentNode; 2837 } 2838 return false; 2839 } 2840 2841 /** 2842 * small indexOf wrapper 2843 * @param {String} str 2844 * @param {String} find 2845 * @returns {Boolean} found 2846 */ 2847 function inStr(str, find) { 2848 return str.indexOf(find) > -1; 2849 } 2850 2851 /** 2852 * split string on whitespace 2853 * @param {String} str 2854 * @returns {Array} words 2855 */ 2856 function splitStr(str) { 2857 return str.trim().split(/\s+/g); 2858 } 2859 2860 /** 2861 * find if a array contains the object using indexOf or a simple polyFill 2862 * @param {Array} src 2863 * @param {String} find 2864 * @param {String} [findByKey] 2865 * @return {Boolean|Number} false when not found, or the index 2866 */ 2867 function inArray(src, find, findByKey) { 2868 if (src.indexOf && !findByKey) { 2869 return src.indexOf(find); 2870 } else { 2871 var i = 0; 2872 while (i < src.length) { 2873 if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { 2874 return i; 2875 } 2876 i++; 2877 } 2878 return -1; 2879 } 2880 } 2881 2882 /** 2883 * convert array-like objects to real arrays 2884 * @param {Object} obj 2885 * @returns {Array} 2886 */ 2887 function toArray(obj) { 2888 return Array.prototype.slice.call(obj, 0); 2889 } 2890 2891 /** 2892 * unique array with objects based on a key (like 'id') or just by the array's value 2893 * @param {Array} src [{id:1},{id:2},{id:1}] 2894 * @param {String} [key] 2895 * @param {Boolean} [sort=False] 2896 * @returns {Array} [{id:1},{id:2}] 2897 */ 2898 function uniqueArray(src, key, sort) { 2899 var results = []; 2900 var values = []; 2901 var i = 0; 2902 2903 while (i < src.length) { 2904 var val = key ? src[i][key] : src[i]; 2905 if (inArray(values, val) < 0) { 2906 results.push(src[i]); 2907 } 2908 values[i] = val; 2909 i++; 2910 } 2911 2912 if (sort) { 2913 if (!key) { 2914 results = results.sort(); 2915 } else { 2916 results = results.sort(function sortUniqueArray(a, b) { 2917 return a[key] > b[key]; 2918 }); 2919 } 2920 } 2921 2922 return results; 2923 } 2924 2925 /** 2926 * get the prefixed property 2927 * @param {Object} obj 2928 * @param {String} property 2929 * @returns {String|Undefined} prefixed 2930 */ 2931 function prefixed(obj, property) { 2932 var prefix, prop; 2933 var camelProp = property[0].toUpperCase() + property.slice(1); 2934 2935 var i = 0; 2936 while (i < VENDOR_PREFIXES.length) { 2937 prefix = VENDOR_PREFIXES[i]; 2938 prop = (prefix) ? prefix + camelProp : property; 2939 2940 if (prop in obj) { 2941 return prop; 2942 } 2943 i++; 2944 } 2945 return undefined; 2946 } 2947 2948 /** 2949 * get a unique id 2950 * @returns {number} uniqueId 2951 */ 2952 var _uniqueId = 1; 2953 function uniqueId() { 2954 return _uniqueId++; 2955 } 2956 2957 /** 2958 * get the window object of an element 2959 * @param {HTMLElement} element 2960 * @returns {DocumentView|Window} 2961 */ 2962 function getWindowForElement(element) { 2963 var doc = element.ownerDocument; 2964 return (doc.defaultView || doc.parentWindow); 2965 } 2966 2967 var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; 2968 2969 var SUPPORT_TOUCH = ('ontouchstart' in window); 2970 var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; 2971 var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); 2972 2973 var INPUT_TYPE_TOUCH = 'touch'; 2974 var INPUT_TYPE_PEN = 'pen'; 2975 var INPUT_TYPE_MOUSE = 'mouse'; 2976 var INPUT_TYPE_KINECT = 'kinect'; 2977 2978 var COMPUTE_INTERVAL = 25; 2979 2980 var INPUT_START = 1; 2981 var INPUT_MOVE = 2; 2982 var INPUT_END = 4; 2983 var INPUT_CANCEL = 8; 2984 2985 var DIRECTION_NONE = 1; 2986 var DIRECTION_LEFT = 2; 2987 var DIRECTION_RIGHT = 4; 2988 var DIRECTION_UP = 8; 2989 var DIRECTION_DOWN = 16; 2990 2991 var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; 2992 var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; 2993 var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; 2994 2995 var PROPS_XY = ['x', 'y']; 2996 var PROPS_CLIENT_XY = ['clientX', 'clientY']; 2997 2998 /** 2999 * create new input type manager 3000 * @param {Manager} manager 3001 * @param {Function} callback 3002 * @returns {Input} 3003 * @constructor 3004 */ 3005 function Input(manager, callback) { 3006 var self = this; 3007 this.manager = manager; 3008 this.callback = callback; 3009 this.element = manager.element; 3010 this.target = manager.options.inputTarget; 3011 3012 // smaller wrapper around the handler, for the scope and the enabled state of the manager, 3013 // so when disabled the input events are completely bypassed. 3014 this.domHandler = function(ev) { 3015 if (boolOrFn(manager.options.enable, [manager])) { 3016 self.handler(ev); 3017 } 3018 }; 3019 3020 this.init(); 3021 3022 } 3023 3024 Input.prototype = { 3025 /** 3026 * should handle the inputEvent data and trigger the callback 3027 * @virtual 3028 */ 3029 handler: function() { }, 3030 3031 /** 3032 * bind the events 3033 */ 3034 init: function() { 3035 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); 3036 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); 3037 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); 3038 }, 3039 3040 /** 3041 * unbind the events 3042 */ 3043 destroy: function() { 3044 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); 3045 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); 3046 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); 3047 } 3048 }; 3049 3050 /** 3051 * create new input type manager 3052 * called by the Manager constructor 3053 * @param {Hammer} manager 3054 * @returns {Input} 3055 */ 3056 function createInputInstance(manager) { 3057 var Type; 3058 var inputClass = manager.options.inputClass; 3059 3060 if (inputClass) { 3061 Type = inputClass; 3062 } else if (SUPPORT_POINTER_EVENTS) { 3063 Type = PointerEventInput; 3064 } else if (SUPPORT_ONLY_TOUCH) { 3065 Type = TouchInput; 3066 } else if (!SUPPORT_TOUCH) { 3067 Type = MouseInput; 3068 } else { 3069 Type = TouchMouseInput; 3070 } 3071 return new (Type)(manager, inputHandler); 3072 } 3073 3074 /** 3075 * handle input events 3076 * @param {Manager} manager 3077 * @param {String} eventType 3078 * @param {Object} input 3079 */ 3080 function inputHandler(manager, eventType, input) { 3081 var pointersLen = input.pointers.length; 3082 var changedPointersLen = input.changedPointers.length; 3083 var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); 3084 var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); 3085 3086 input.isFirst = !!isFirst; 3087 input.isFinal = !!isFinal; 3088 3089 if (isFirst) { 3090 manager.session = {}; 3091 } 3092 3093 // source event is the normalized value of the domEvents 3094 // like 'touchstart, mouseup, pointerdown' 3095 input.eventType = eventType; 3096 3097 // compute scale, rotation etc 3098 computeInputData(manager, input); 3099 3100 // emit secret event 3101 manager.emit('hammer.input', input); 3102 3103 manager.recognize(input); 3104 manager.session.prevInput = input; 3105 } 3106 3107 /** 3108 * extend the data with some usable properties like scale, rotate, velocity etc 3109 * @param {Object} manager 3110 * @param {Object} input 3111 */ 3112 function computeInputData(manager, input) { 3113 var session = manager.session; 3114 var pointers = input.pointers; 3115 var pointersLength = pointers.length; 3116 3117 // store the first input to calculate the distance and direction 3118 if (!session.firstInput) { 3119 session.firstInput = simpleCloneInputData(input); 3120 } 3121 3122 // to compute scale and rotation we need to store the multiple touches 3123 if (pointersLength > 1 && !session.firstMultiple) { 3124 session.firstMultiple = simpleCloneInputData(input); 3125 } else if (pointersLength === 1) { 3126 session.firstMultiple = false; 3127 } 3128 3129 var firstInput = session.firstInput; 3130 var firstMultiple = session.firstMultiple; 3131 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; 3132 3133 var center = input.center = getCenter(pointers); 3134 input.timeStamp = now(); 3135 input.deltaTime = input.timeStamp - firstInput.timeStamp; 3136 3137 input.angle = getAngle(offsetCenter, center); 3138 input.distance = getDistance(offsetCenter, center); 3139 3140 computeDeltaXY(session, input); 3141 input.offsetDirection = getDirection(input.deltaX, input.deltaY); 3142 3143 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; 3144 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; 3145 3146 computeIntervalInputData(session, input); 3147 3148 // find the correct target 3149 var target = manager.element; 3150 if (hasParent(input.srcEvent.target, target)) { 3151 target = input.srcEvent.target; 3152 } 3153 input.target = target; 3154 } 3155 3156 function computeDeltaXY(session, input) { 3157 var center = input.center; 3158 var offset = session.offsetDelta || {}; 3159 var prevDelta = session.prevDelta || {}; 3160 var prevInput = session.prevInput || {}; 3161 3162 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { 3163 prevDelta = session.prevDelta = { 3164 x: prevInput.deltaX || 0, 3165 y: prevInput.deltaY || 0 3166 }; 3167 3168 offset = session.offsetDelta = { 3169 x: center.x, 3170 y: center.y 3171 }; 3172 } 3173 3174 input.deltaX = prevDelta.x + (center.x - offset.x); 3175 input.deltaY = prevDelta.y + (center.y - offset.y); 3176 } 3177 3178 /** 3179 * velocity is calculated every x ms 3180 * @param {Object} session 3181 * @param {Object} input 3182 */ 3183 function computeIntervalInputData(session, input) { 3184 var last = session.lastInterval || input, 3185 deltaTime = input.timeStamp - last.timeStamp, 3186 velocity, velocityX, velocityY, direction; 3187 3188 if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { 3189 var deltaX = last.deltaX - input.deltaX; 3190 var deltaY = last.deltaY - input.deltaY; 3191 3192 var v = getVelocity(deltaTime, deltaX, deltaY); 3193 velocityX = v.x; 3194 velocityY = v.y; 3195 velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; 3196 direction = getDirection(deltaX, deltaY); 3197 3198 session.lastInterval = input; 3199 } else { 3200 // use latest velocity info if it doesn't overtake a minimum period 3201 velocity = last.velocity; 3202 velocityX = last.velocityX; 3203 velocityY = last.velocityY; 3204 direction = last.direction; 3205 } 3206 3207 input.velocity = velocity; 3208 input.velocityX = velocityX; 3209 input.velocityY = velocityY; 3210 input.direction = direction; 3211 } 3212 3213 /** 3214 * create a simple clone from the input used for storage of firstInput and firstMultiple 3215 * @param {Object} input 3216 * @returns {Object} clonedInputData 3217 */ 3218 function simpleCloneInputData(input) { 3219 // make a simple copy of the pointers because we will get a reference if we don't 3220 // we only need clientXY for the calculations 3221 var pointers = []; 3222 var i = 0; 3223 while (i < input.pointers.length) { 3224 pointers[i] = { 3225 clientX: round(input.pointers[i].clientX), 3226 clientY: round(input.pointers[i].clientY) 3227 }; 3228 i++; 3229 } 3230 3231 return { 3232 timeStamp: now(), 3233 pointers: pointers, 3234 center: getCenter(pointers), 3235 deltaX: input.deltaX, 3236 deltaY: input.deltaY 3237 }; 3238 } 3239 3240 /** 3241 * get the center of all the pointers 3242 * @param {Array} pointers 3243 * @return {Object} center contains `x` and `y` properties 3244 */ 3245 function getCenter(pointers) { 3246 var pointersLength = pointers.length; 3247 3248 // no need to loop when only one touch 3249 if (pointersLength === 1) { 3250 return { 3251 x: round(pointers[0].clientX), 3252 y: round(pointers[0].clientY) 3253 }; 3254 } 3255 3256 var x = 0, y = 0, i = 0; 3257 while (i < pointersLength) { 3258 x += pointers[i].clientX; 3259 y += pointers[i].clientY; 3260 i++; 3261 } 3262 3263 return { 3264 x: round(x / pointersLength), 3265 y: round(y / pointersLength) 3266 }; 3267 } 3268 3269 /** 3270 * calculate the velocity between two points. unit is in px per ms. 3271 * @param {Number} deltaTime 3272 * @param {Number} x 3273 * @param {Number} y 3274 * @return {Object} velocity `x` and `y` 3275 */ 3276 function getVelocity(deltaTime, x, y) { 3277 return { 3278 x: x / deltaTime || 0, 3279 y: y / deltaTime || 0 3280 }; 3281 } 3282 3283 /** 3284 * get the direction between two points 3285 * @param {Number} x 3286 * @param {Number} y 3287 * @return {Number} direction 3288 */ 3289 function getDirection(x, y) { 3290 if (x === y) { 3291 return DIRECTION_NONE; 3292 } 3293 3294 if (abs(x) >= abs(y)) { 3295 return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; 3296 } 3297 return y > 0 ? DIRECTION_UP : DIRECTION_DOWN; 3298 } 3299 3300 /** 3301 * calculate the absolute distance between two points 3302 * @param {Object} p1 {x, y} 3303 * @param {Object} p2 {x, y} 3304 * @param {Array} [props] containing x and y keys 3305 * @return {Number} distance 3306 */ 3307 function getDistance(p1, p2, props) { 3308 if (!props) { 3309 props = PROPS_XY; 3310 } 3311 var x = p2[props[0]] - p1[props[0]], 3312 y = p2[props[1]] - p1[props[1]]; 3313 3314 return Math.sqrt((x * x) + (y * y)); 3315 } 3316 3317 /** 3318 * calculate the angle between two coordinates 3319 * @param {Object} p1 3320 * @param {Object} p2 3321 * @param {Array} [props] containing x and y keys 3322 * @return {Number} angle 3323 */ 3324 function getAngle(p1, p2, props) { 3325 if (!props) { 3326 props = PROPS_XY; 3327 } 3328 var x = p2[props[0]] - p1[props[0]], 3329 y = p2[props[1]] - p1[props[1]];
vendor: 12,197 bytes, lines 3330-3721
3330 return Math.atan2(y, x) * 180 / Math.PI; 3331 } 3332 3333 /** 3334 * calculate the rotation degrees between two pointersets 3335 * @param {Array} start array of pointers 3336 * @param {Array} end array of pointers 3337 * @return {Number} rotation 3338 */ 3339 function getRotation(start, end) { 3340 return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY); 3341 } 3342 3343 /** 3344 * calculate the scale factor between two pointersets 3345 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out 3346 * @param {Array} start array of pointers 3347 * @param {Array} end array of pointers 3348 * @return {Number} scale 3349 */ 3350 function getScale(start, end) { 3351 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); 3352 } 3353 3354 var MOUSE_INPUT_MAP = { 3355 mousedown: INPUT_START, 3356 mousemove: INPUT_MOVE, 3357 mouseup: INPUT_END 3358 }; 3359 3360 var MOUSE_ELEMENT_EVENTS = 'mousedown'; 3361 var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; 3362 3363 /** 3364 * Mouse events input 3365 * @constructor 3366 * @extends Input 3367 */ 3368 function MouseInput() { 3369 this.evEl = MOUSE_ELEMENT_EVENTS; 3370 this.evWin = MOUSE_WINDOW_EVENTS; 3371 3372 this.allow = true; // used by Input.TouchMouse to disable mouse events 3373 this.pressed = false; // mousedown state 3374 3375 Input.apply(this, arguments); 3376 } 3377 3378 inherit(MouseInput, Input, { 3379 /** 3380 * handle mouse events 3381 * @param {Object} ev 3382 */ 3383 handler: function MEhandler(ev) { 3384 var eventType = MOUSE_INPUT_MAP[ev.type]; 3385 3386 // on start we want to have the left mouse button down 3387 if (eventType & INPUT_START && ev.button === 0) { 3388 this.pressed = true; 3389 } 3390 3391 if (eventType & INPUT_MOVE && ev.which !== 1) { 3392 eventType = INPUT_END; 3393 } 3394 3395 // mouse must be down, and mouse events are allowed (see the TouchMouse input) 3396 if (!this.pressed || !this.allow) { 3397 return; 3398 } 3399 3400 if (eventType & INPUT_END) { 3401 this.pressed = false; 3402 } 3403 3404 this.callback(this.manager, eventType, { 3405 pointers: [ev], 3406 changedPointers: [ev], 3407 pointerType: INPUT_TYPE_MOUSE, 3408 srcEvent: ev 3409 }); 3410 } 3411 }); 3412 3413 var POINTER_INPUT_MAP = { 3414 pointerdown: INPUT_START, 3415 pointermove: INPUT_MOVE, 3416 pointerup: INPUT_END, 3417 pointercancel: INPUT_CANCEL, 3418 pointerout: INPUT_CANCEL 3419 }; 3420 3421// in IE10 the pointer types is defined as an enum 3422 var IE10_POINTER_TYPE_ENUM = { 3423 2: INPUT_TYPE_TOUCH, 3424 3: INPUT_TYPE_PEN, 3425 4: INPUT_TYPE_MOUSE, 3426 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 3427 }; 3428 3429 var POINTER_ELEMENT_EVENTS = 'pointerdown'; 3430 var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; 3431 3432// IE10 has prefixed support, and case-sensitive 3433 if (window.MSPointerEvent) { 3434 POINTER_ELEMENT_EVENTS = 'MSPointerDown'; 3435 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; 3436 } 3437 3438 /** 3439 * Pointer events input 3440 * @constructor 3441 * @extends Input 3442 */ 3443 function PointerEventInput() { 3444 this.evEl = POINTER_ELEMENT_EVENTS; 3445 this.evWin = POINTER_WINDOW_EVENTS; 3446 3447 Input.apply(this, arguments); 3448 3449 this.store = (this.manager.session.pointerEvents = []); 3450 } 3451 3452 inherit(PointerEventInput, Input, { 3453 /** 3454 * handle mouse events 3455 * @param {Object} ev 3456 */ 3457 handler: function PEhandler(ev) { 3458 var store = this.store; 3459 var removePointer = false; 3460 3461 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); 3462 var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; 3463 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; 3464 3465 var isTouch = (pointerType == INPUT_TYPE_TOUCH); 3466 3467 // get index of the event in the store 3468 var storeIndex = inArray(store, ev.pointerId, 'pointerId'); 3469 3470 // start and mouse must be down 3471 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { 3472 if (storeIndex < 0) { 3473 store.push(ev); 3474 storeIndex = store.length - 1; 3475 } 3476 } else if (eventType & (INPUT_END | INPUT_CANCEL)) { 3477 removePointer = true; 3478 } 3479 3480 // it not found, so the pointer hasn't been down (so it's probably a hover) 3481 if (storeIndex < 0) { 3482 return; 3483 } 3484 3485 // update the event in the store 3486 store[storeIndex] = ev; 3487 3488 this.callback(this.manager, eventType, { 3489 pointers: store, 3490 changedPointers: [ev], 3491 pointerType: pointerType, 3492 srcEvent: ev 3493 }); 3494 3495 if (removePointer) { 3496 // remove from the store 3497 store.splice(storeIndex, 1); 3498 } 3499 } 3500 }); 3501 3502 var SINGLE_TOUCH_INPUT_MAP = { 3503 touchstart: INPUT_START, 3504 touchmove: INPUT_MOVE, 3505 touchend: INPUT_END, 3506 touchcancel: INPUT_CANCEL 3507 }; 3508 3509 var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; 3510 var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; 3511 3512 /** 3513 * Touch events input 3514 * @constructor 3515 * @extends Input 3516 */ 3517 function SingleTouchInput() { 3518 this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; 3519 this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; 3520 this.started = false; 3521 3522 Input.apply(this, arguments); 3523 } 3524 3525 inherit(SingleTouchInput, Input, { 3526 handler: function TEhandler(ev) { 3527 var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; 3528 3529 // should we handle the touch events? 3530 if (type === INPUT_START) { 3531 this.started = true; 3532 } 3533 3534 if (!this.started) { 3535 return; 3536 } 3537 3538 var touches = normalizeSingleTouches.call(this, ev, type); 3539 3540 // when done, reset the started state 3541 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { 3542 this.started = false; 3543 } 3544 3545 this.callback(this.manager, type, { 3546 pointers: touches[0], 3547 changedPointers: touches[1], 3548 pointerType: INPUT_TYPE_TOUCH, 3549 srcEvent: ev 3550 }); 3551 } 3552 }); 3553 3554 /** 3555 * @this {TouchInput} 3556 * @param {Object} ev 3557 * @param {Number} type flag 3558 * @returns {undefined|Array} [all, changed] 3559 */ 3560 function normalizeSingleTouches(ev, type) { 3561 var all = toArray(ev.touches); 3562 var changed = toArray(ev.changedTouches); 3563 3564 if (type & (INPUT_END | INPUT_CANCEL)) { 3565 all = uniqueArray(all.concat(changed), 'identifier', true); 3566 } 3567 3568 return [all, changed]; 3569 } 3570 3571 var TOUCH_INPUT_MAP = { 3572 touchstart: INPUT_START, 3573 touchmove: INPUT_MOVE, 3574 touchend: INPUT_END, 3575 touchcancel: INPUT_CANCEL 3576 }; 3577 3578 var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; 3579 3580 /** 3581 * Multi-user touch events input 3582 * @constructor 3583 * @extends Input 3584 */ 3585 function TouchInput() { 3586 this.evTarget = TOUCH_TARGET_EVENTS; 3587 this.targetIds = {}; 3588 3589 Input.apply(this, arguments); 3590 } 3591 3592 inherit(TouchInput, Input, { 3593 handler: function MTEhandler(ev) { 3594 var type = TOUCH_INPUT_MAP[ev.type]; 3595 var touches = getTouches.call(this, ev, type); 3596 if (!touches) { 3597 return; 3598 } 3599 3600 this.callback(this.manager, type, { 3601 pointers: touches[0], 3602 changedPointers: touches[1], 3603 pointerType: INPUT_TYPE_TOUCH, 3604 srcEvent: ev 3605 }); 3606 } 3607 }); 3608 3609 /** 3610 * @this {TouchInput} 3611 * @param {Object} ev 3612 * @param {Number} type flag 3613 * @returns {undefined|Array} [all, changed] 3614 */ 3615 function getTouches(ev, type) { 3616 var allTouches = toArray(ev.touches); 3617 var targetIds = this.targetIds; 3618 3619 // when there is only one touch, the process can be simplified 3620 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { 3621 targetIds[allTouches[0].identifier] = true; 3622 return [allTouches, allTouches]; 3623 } 3624 3625 var i, 3626 targetTouches, 3627 changedTouches = toArray(ev.changedTouches), 3628 changedTargetTouches = [], 3629 target = this.target; 3630 3631 // get target touches from touches 3632 targetTouches = allTouches.filter(function(touch) { 3633 return hasParent(touch.target, target); 3634 }); 3635 3636 // collect touches 3637 if (type === INPUT_START) { 3638 i = 0; 3639 while (i < targetTouches.length) { 3640 targetIds[targetTouches[i].identifier] = true; 3641 i++; 3642 } 3643 } 3644 3645 // filter changed touches to only contain touches that exist in the collected target ids 3646 i = 0; 3647 while (i < changedTouches.length) { 3648 if (targetIds[changedTouches[i].identifier]) { 3649 changedTargetTouches.push(changedTouches[i]); 3650 } 3651 3652 // cleanup removed touches 3653 if (type & (INPUT_END | INPUT_CANCEL)) { 3654 delete targetIds[changedTouches[i].identifier]; 3655 } 3656 i++; 3657 } 3658 3659 if (!changedTargetTouches.length) { 3660 return; 3661 } 3662 3663 return [ 3664 // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' 3665 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), 3666 changedTargetTouches 3667 ]; 3668 } 3669 3670 /** 3671 * Combined touch and mouse input 3672 * 3673 * Touch has a higher priority then mouse, and while touching no mouse events are allowed. 3674 * This because touch devices also emit mouse events while doing a touch. 3675 * 3676 * @constructor 3677 * @extends Input 3678 */ 3679 function TouchMouseInput() { 3680 Input.apply(this, arguments); 3681 3682 var handler = bindFn(this.handler, this); 3683 this.touch = new TouchInput(this.manager, handler); 3684 this.mouse = new MouseInput(this.manager, handler); 3685 } 3686 3687 inherit(TouchMouseInput, Input, { 3688 /** 3689 * handle mouse and touch events 3690 * @param {Hammer} manager 3691 * @param {String} inputEvent 3692 * @param {Object} inputData 3693 */ 3694 handler: function TMEhandler(manager, inputEvent, inputData) { 3695 var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), 3696 isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); 3697 3698 // when we're in a touch event, so block all upcoming mouse events 3699 // most mobile browser also emit mouseevents, right after touchstart 3700 if (isTouch) { 3701 this.mouse.allow = false; 3702 } else if (isMouse && !this.mouse.allow) { 3703 return; 3704 } 3705 3706 // reset the allowMouse when we're done 3707 if (inputEvent & (INPUT_END | INPUT_CANCEL)) { 3708 this.mouse.allow = true; 3709 } 3710 3711 this.callback(manager, inputEvent, inputData); 3712 }, 3713 3714 /** 3715 * remove the event listeners 3716 */ 3717 destroy: function destroy() { 3718 this.touch.destroy(); 3719 this.mouse.destroy(); 3720 } 3721 });
vendor: 19,696 bytes, lines 3722-4321
3722 3723 var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); 3724 var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; 3725 3726// magical touchAction value 3727 var TOUCH_ACTION_COMPUTE = 'compute'; 3728 var TOUCH_ACTION_AUTO = 'auto'; 3729 var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented 3730 var TOUCH_ACTION_NONE = 'none'; 3731 var TOUCH_ACTION_PAN_X = 'pan-x'; 3732 var TOUCH_ACTION_PAN_Y = 'pan-y'; 3733 3734 /** 3735 * Touch Action 3736 * sets the touchAction property or uses the js alternative 3737 * @param {Manager} manager 3738 * @param {String} value 3739 * @constructor 3740 */ 3741 function TouchAction(manager, value) { 3742 this.manager = manager; 3743 this.set(value); 3744 } 3745 3746 TouchAction.prototype = { 3747 /** 3748 * set the touchAction value on the element or enable the polyfill 3749 * @param {String} value 3750 */ 3751 set: function(value) { 3752 // find out the touch-action by the event handlers 3753 if (value == TOUCH_ACTION_COMPUTE) { 3754 value = this.compute(); 3755 } 3756 3757 if (NATIVE_TOUCH_ACTION) { 3758 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; 3759 } 3760 this.actions = value.toLowerCase().trim(); 3761 }, 3762 3763 /** 3764 * just re-set the touchAction value 3765 */ 3766 update: function() { 3767 this.set(this.manager.options.touchAction); 3768 }, 3769 3770 /** 3771 * compute the value for the touchAction property based on the recognizer's settings 3772 * @returns {String} value 3773 */ 3774 compute: function() { 3775 var actions = []; 3776 each(this.manager.recognizers, function(recognizer) { 3777 if (boolOrFn(recognizer.options.enable, [recognizer])) { 3778 actions = actions.concat(recognizer.getTouchAction()); 3779 } 3780 }); 3781 return cleanTouchActions(actions.join(' ')); 3782 }, 3783 3784 /** 3785 * this method is called on each input cycle and provides the preventing of the browser behavior 3786 * @param {Object} input 3787 */ 3788 preventDefaults: function(input) { 3789 // not needed with native support for the touchAction property 3790 if (NATIVE_TOUCH_ACTION) { 3791 return; 3792 } 3793 3794 var srcEvent = input.srcEvent; 3795 var direction = input.offsetDirection; 3796 3797 // if the touch action did prevented once this session 3798 if (this.manager.session.prevented) { 3799 srcEvent.preventDefault(); 3800 return; 3801 } 3802 3803 var actions = this.actions; 3804 var hasNone = inStr(actions, TOUCH_ACTION_NONE); 3805 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); 3806 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); 3807 3808 if (hasNone || 3809 (hasPanY && direction & DIRECTION_HORIZONTAL) || 3810 (hasPanX && direction & DIRECTION_VERTICAL)) { 3811 return this.preventSrc(srcEvent); 3812 } 3813 }, 3814 3815 /** 3816 * call preventDefault to prevent the browser's default behavior (scrolling in most cases) 3817 * @param {Object} srcEvent 3818 */ 3819 preventSrc: function(srcEvent) { 3820 this.manager.session.prevented = true; 3821 srcEvent.preventDefault(); 3822 } 3823 }; 3824 3825 /** 3826 * when the touchActions are collected they are not a valid value, so we need to clean things up. * 3827 * @param {String} actions 3828 * @returns {*} 3829 */ 3830 function cleanTouchActions(actions) { 3831 // none 3832 if (inStr(actions, TOUCH_ACTION_NONE)) { 3833 return TOUCH_ACTION_NONE; 3834 } 3835 3836 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); 3837 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); 3838 3839 // pan-x and pan-y can be combined 3840 if (hasPanX && hasPanY) { 3841 return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y; 3842 } 3843 3844 // pan-x OR pan-y 3845 if (hasPanX || hasPanY) { 3846 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; 3847 } 3848 3849 // manipulation 3850 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { 3851 return TOUCH_ACTION_MANIPULATION; 3852 } 3853 3854 return TOUCH_ACTION_AUTO; 3855 } 3856 3857 /** 3858 * Recognizer flow explained; * 3859 * All recognizers have the initial state of POSSIBLE when a input session starts. 3860 * The definition of a input session is from the first input until the last input, with all it's movement in it. * 3861 * Example session for mouse-input: mousedown -> mousemove -> mouseup 3862 * 3863 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed 3864 * which determines with state it should be. 3865 * 3866 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to 3867 * POSSIBLE to give it another change on the next cycle. 3868 * 3869 * Possible 3870 * | 3871 * +-----+---------------+ 3872 * | | 3873 * +-----+-----+ | 3874 * | | | 3875 * Failed Cancelled | 3876 * +-------+------+ 3877 * | | 3878 * Recognized Began 3879 * | 3880 * Changed 3881 * | 3882 * Ended/Recognized 3883 */ 3884 var STATE_POSSIBLE = 1; 3885 var STATE_BEGAN = 2; 3886 var STATE_CHANGED = 4; 3887 var STATE_ENDED = 8; 3888 var STATE_RECOGNIZED = STATE_ENDED; 3889 var STATE_CANCELLED = 16; 3890 var STATE_FAILED = 32; 3891 3892 /** 3893 * Recognizer 3894 * Every recognizer needs to extend from this class. 3895 * @constructor 3896 * @param {Object} options 3897 */ 3898 function Recognizer(options) { 3899 this.id = uniqueId(); 3900 3901 this.manager = null; 3902 this.options = merge(options || {}, this.defaults); 3903 3904 // default is enable true 3905 this.options.enable = ifUndefined(this.options.enable, true); 3906 3907 this.state = STATE_POSSIBLE; 3908 3909 this.simultaneous = {}; 3910 this.requireFail = []; 3911 } 3912 3913 Recognizer.prototype = { 3914 /** 3915 * @virtual 3916 * @type {Object} 3917 */ 3918 defaults: {}, 3919 3920 /** 3921 * set options 3922 * @param {Object} options 3923 * @return {Recognizer} 3924 */ 3925 set: function(options) { 3926 extend(this.options, options); 3927 3928 // also update the touchAction, in case something changed about the directions/enabled state 3929 this.manager && this.manager.touchAction.update(); 3930 return this; 3931 }, 3932 3933 /** 3934 * recognize simultaneous with an other recognizer. 3935 * @param {Recognizer} otherRecognizer 3936 * @returns {Recognizer} this 3937 */ 3938 recognizeWith: function(otherRecognizer) { 3939 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { 3940 return this; 3941 } 3942 3943 var simultaneous = this.simultaneous; 3944 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3945 if (!simultaneous[otherRecognizer.id]) { 3946 simultaneous[otherRecognizer.id] = otherRecognizer; 3947 otherRecognizer.recognizeWith(this); 3948 } 3949 return this; 3950 }, 3951 3952 /** 3953 * drop the simultaneous link. it doesnt remove the link on the other recognizer. 3954 * @param {Recognizer} otherRecognizer 3955 * @returns {Recognizer} this 3956 */ 3957 dropRecognizeWith: function(otherRecognizer) { 3958 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { 3959 return this; 3960 } 3961 3962 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3963 delete this.simultaneous[otherRecognizer.id]; 3964 return this; 3965 }, 3966 3967 /** 3968 * recognizer can only run when an other is failing 3969 * @param {Recognizer} otherRecognizer 3970 * @returns {Recognizer} this 3971 */ 3972 requireFailure: function(otherRecognizer) { 3973 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { 3974 return this; 3975 } 3976 3977 var requireFail = this.requireFail; 3978 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3979 if (inArray(requireFail, otherRecognizer) === -1) { 3980 requireFail.push(otherRecognizer); 3981 otherRecognizer.requireFailure(this); 3982 } 3983 return this; 3984 }, 3985 3986 /** 3987 * drop the requireFailure link. it does not remove the link on the other recognizer. 3988 * @param {Recognizer} otherRecognizer 3989 * @returns {Recognizer} this 3990 */ 3991 dropRequireFailure: function(otherRecognizer) { 3992 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { 3993 return this; 3994 } 3995 3996 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3997 var index = inArray(this.requireFail, otherRecognizer); 3998 if (index > -1) { 3999 this.requireFail.splice(index, 1); 4000 } 4001 return this; 4002 }, 4003 4004 /** 4005 * has require failures boolean 4006 * @returns {boolean} 4007 */ 4008 hasRequireFailures: function() { 4009 return this.requireFail.length > 0; 4010 }, 4011 4012 /** 4013 * if the recognizer can recognize simultaneous with an other recognizer 4014 * @param {Recognizer} otherRecognizer 4015 * @returns {Boolean} 4016 */ 4017 canRecognizeWith: function(otherRecognizer) { 4018 return !!this.simultaneous[otherRecognizer.id]; 4019 }, 4020 4021 /** 4022 * You should use `tryEmit` instead of `emit` directly to check 4023 * that all the needed recognizers has failed before emitting. 4024 * @param {Object} input 4025 */ 4026 emit: function(input) { 4027 var self = this; 4028 var state = this.state; 4029 4030 function emit(withState) { 4031 self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input); 4032 } 4033 4034 // 'panstart' and 'panmove' 4035 if (state < STATE_ENDED) { 4036 emit(true); 4037 } 4038 4039 emit(); // simple 'eventName' events 4040 4041 // panend and pancancel 4042 if (state >= STATE_ENDED) { 4043 emit(true); 4044 } 4045 }, 4046 4047 /** 4048 * Check that all the require failure recognizers has failed, 4049 * if true, it emits a gesture event, 4050 * otherwise, setup the state to FAILED. 4051 * @param {Object} input 4052 */ 4053 tryEmit: function(input) { 4054 if (this.canEmit()) { 4055 return this.emit(input); 4056 } 4057 // it's failing anyway 4058 this.state = STATE_FAILED; 4059 }, 4060 4061 /** 4062 * can we emit? 4063 * @returns {boolean} 4064 */ 4065 canEmit: function() { 4066 var i = 0; 4067 while (i < this.requireFail.length) { 4068 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { 4069 return false; 4070 } 4071 i++; 4072 } 4073 return true; 4074 }, 4075 4076 /** 4077 * update the recognizer 4078 * @param {Object} inputData 4079 */ 4080 recognize: function(inputData) { 4081 // make a new copy of the inputData 4082 // so we can change the inputData without messing up the other recognizers 4083 var inputDataClone = extend({}, inputData); 4084 4085 // is is enabled and allow recognizing? 4086 if (!boolOrFn(this.options.enable, [this, inputDataClone])) { 4087 this.reset(); 4088 this.state = STATE_FAILED; 4089 return; 4090 } 4091 4092 // reset when we've reached the end 4093 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { 4094 this.state = STATE_POSSIBLE; 4095 } 4096 4097 this.state = this.process(inputDataClone); 4098 4099 // the recognizer has recognized a gesture 4100 // so trigger an event 4101 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { 4102 this.tryEmit(inputDataClone); 4103 } 4104 }, 4105 4106 /** 4107 * return the state of the recognizer 4108 * the actual recognizing happens in this method 4109 * @virtual 4110 * @param {Object} inputData 4111 * @returns {Const} STATE 4112 */ 4113 process: function(inputData) { }, // jshint ignore:line 4114 4115 /** 4116 * return the preferred touch-action 4117 * @virtual 4118 * @returns {Array} 4119 */ 4120 getTouchAction: function() { }, 4121 4122 /** 4123 * called when the gesture isn't allowed to recognize 4124 * like when another is being recognized or it is disabled 4125 * @virtual 4126 */ 4127 reset: function() { } 4128 }; 4129 4130 /** 4131 * get a usable string, used as event postfix 4132 * @param {Const} state 4133 * @returns {String} state 4134 */ 4135 function stateStr(state) { 4136 if (state & STATE_CANCELLED) { 4137 return 'cancel'; 4138 } else if (state & STATE_ENDED) { 4139 return 'end'; 4140 } else if (state & STATE_CHANGED) { 4141 return 'move'; 4142 } else if (state & STATE_BEGAN) { 4143 return 'start'; 4144 } 4145 return ''; 4146 } 4147 4148 /** 4149 * direction cons to string 4150 * @param {Const} direction 4151 * @returns {String} 4152 */ 4153 function directionStr(direction) { 4154 if (direction == DIRECTION_DOWN) { 4155 return 'down'; 4156 } else if (direction == DIRECTION_UP) { 4157 return 'up'; 4158 } else if (direction == DIRECTION_LEFT) { 4159 return 'left'; 4160 } else if (direction == DIRECTION_RIGHT) { 4161 return 'right'; 4162 } 4163 return ''; 4164 } 4165 4166 /** 4167 * get a recognizer by name if it is bound to a manager 4168 * @param {Recognizer|String} otherRecognizer 4169 * @param {Recognizer} recognizer 4170 * @returns {Recognizer} 4171 */ 4172 function getRecognizerByNameIfManager(otherRecognizer, recognizer) { 4173 var manager = recognizer.manager; 4174 if (manager) { 4175 return manager.get(otherRecognizer); 4176 } 4177 return otherRecognizer; 4178 } 4179 4180 /** 4181 * This recognizer is just used as a base for the simple attribute recognizers. 4182 * @constructor 4183 * @extends Recognizer 4184 */ 4185 function AttrRecognizer() { 4186 Recognizer.apply(this, arguments); 4187 } 4188 4189 inherit(AttrRecognizer, Recognizer, { 4190 /** 4191 * @namespace 4192 * @memberof AttrRecognizer 4193 */ 4194 defaults: { 4195 /** 4196 * @type {Number} 4197 * @default 1 4198 */ 4199 pointers: 1 4200 }, 4201 4202 /** 4203 * Used to check if it the recognizer receives valid input, like input.distance > 10. 4204 * @memberof AttrRecognizer 4205 * @param {Object} input 4206 * @returns {Boolean} recognized 4207 */ 4208 attrTest: function(input) { 4209 var optionPointers = this.options.pointers; 4210 return optionPointers === 0 || input.pointers.length === optionPointers; 4211 }, 4212 4213 /** 4214 * Process the input and return the state for the recognizer 4215 * @memberof AttrRecognizer 4216 * @param {Object} input 4217 * @returns {*} State 4218 */ 4219 process: function(input) { 4220 var state = this.state; 4221 var eventType = input.eventType; 4222 4223 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); 4224 var isValid = this.attrTest(input); 4225 4226 // on cancel input and we've recognized before, return STATE_CANCELLED 4227 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { 4228 return state | STATE_CANCELLED; 4229 } else if (isRecognized || isValid) { 4230 if (eventType & INPUT_END) { 4231 return state | STATE_ENDED; 4232 } else if (!(state & STATE_BEGAN)) { 4233 return STATE_BEGAN; 4234 } 4235 return state | STATE_CHANGED; 4236 } 4237 return STATE_FAILED; 4238 } 4239 }); 4240 4241 /** 4242 * Pan 4243 * Recognized when the pointer is down and moved in the allowed direction. 4244 * @constructor 4245 * @extends AttrRecognizer 4246 */ 4247 function PanRecognizer() { 4248 AttrRecognizer.apply(this, arguments); 4249 4250 this.pX = null; 4251 this.pY = null; 4252 } 4253 4254 inherit(PanRecognizer, AttrRecognizer, { 4255 /** 4256 * @namespace 4257 * @memberof PanRecognizer 4258 */ 4259 defaults: { 4260 event: 'pan', 4261 threshold: 10, 4262 pointers: 1, 4263 direction: DIRECTION_ALL 4264 }, 4265 4266 getTouchAction: function() { 4267 var direction = this.options.direction; 4268 var actions = []; 4269 if (direction & DIRECTION_HORIZONTAL) { 4270 actions.push(TOUCH_ACTION_PAN_Y); 4271 } 4272 if (direction & DIRECTION_VERTICAL) { 4273 actions.push(TOUCH_ACTION_PAN_X); 4274 } 4275 return actions; 4276 }, 4277 4278 directionTest: function(input) { 4279 var options = this.options; 4280 var hasMoved = true; 4281 var distance = input.distance; 4282 var direction = input.direction; 4283 var x = input.deltaX; 4284 var y = input.deltaY; 4285 4286 // lock to axis? 4287 if (!(direction & options.direction)) { 4288 if (options.direction & DIRECTION_HORIZONTAL) { 4289 direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; 4290 hasMoved = x != this.pX; 4291 distance = Math.abs(input.deltaX); 4292 } else { 4293 direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; 4294 hasMoved = y != this.pY; 4295 distance = Math.abs(input.deltaY); 4296 } 4297 } 4298 input.direction = direction; 4299 return hasMoved && distance > options.threshold && direction & options.direction; 4300 }, 4301 4302 attrTest: function(input) { 4303 return AttrRecognizer.prototype.attrTest.call(this, input) && 4304 (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); 4305 }, 4306 4307 emit: function(input) { 4308 this.pX = input.deltaX; 4309 this.pY = input.deltaY; 4310 4311 var direction = directionStr(input.direction); 4312 if (direction) { 4313 this.manager.emit(this.options.event + direction, input); 4314 } 4315 4316 this._super.emit.call(this, input); 4317 } 4318 }); 4319 4320 /** 4321 * Pinch
4322 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). 4323 * @constructor 4324 * @extends AttrRecognizer 4325 */ 4326 function PinchRecognizer() { 4327 AttrRecognizer.apply(this, arguments); 4328 } 4329 4330 inherit(PinchRecognizer, AttrRecognizer, { 4331 /** 4332 * @namespace 4333 * @memberof PinchRecognizer 4334 */ 4335 defaults: { 4336 event: 'pinch', 4337 threshold: 0, 4338 pointers: 2 4339 }, 4340 4341 getTouchAction: function() { 4342 return [TOUCH_ACTION_NONE]; 4343 }, 4344 4345 attrTest: function(input) { 4346 return this._super.attrTest.call(this, input) && 4347 (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); 4348 }, 4349 4350 emit: function(input) { 4351 this._super.emit.call(this, input); 4352 if (input.scale !== 1) { 4353 var inOut = input.scale < 1 ? 'in' : 'out'; 4354 this.manager.emit(this.options.event + inOut, input); 4355 } 4356 } 4357 }); 4358 4359 /** 4360 * Press
vendor: 6,392 bytes, lines 4361-4560
4361 * Recognized when the pointer is down for x ms without any movement. 4362 * @constructor 4363 * @extends Recognizer 4364 */ 4365 function PressRecognizer() { 4366 Recognizer.apply(this, arguments); 4367 4368 this._timer = null; 4369 this._input = null; 4370 } 4371 4372 inherit(PressRecognizer, Recognizer, { 4373 /** 4374 * @namespace 4375 * @memberof PressRecognizer 4376 */ 4377 defaults: { 4378 event: 'press', 4379 pointers: 1, 4380 time: 500, // minimal time of the pointer to be pressed 4381 threshold: 5 // a minimal movement is ok, but keep it low 4382 }, 4383 4384 getTouchAction: function() { 4385 return [TOUCH_ACTION_AUTO]; 4386 }, 4387 4388 process: function(input) { 4389 var options = this.options; 4390 var validPointers = input.pointers.length === options.pointers; 4391 var validMovement = input.distance < options.threshold; 4392 var validTime = input.deltaTime > options.time; 4393 4394 this._input = input; 4395 4396 // we only allow little movement 4397 // and we've reached an end event, so a tap is possible 4398 if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { 4399 this.reset(); 4400 } else if (input.eventType & INPUT_START) { 4401 this.reset(); 4402 this._timer = setTimeoutContext(function() { 4403 this.state = STATE_RECOGNIZED; 4404 this.tryEmit(); 4405 }, options.time, this); 4406 } else if (input.eventType & INPUT_END) { 4407 return STATE_RECOGNIZED; 4408 } 4409 return STATE_FAILED; 4410 }, 4411 4412 reset: function() { 4413 clearTimeout(this._timer); 4414 }, 4415 4416 emit: function(input) { 4417 if (this.state !== STATE_RECOGNIZED) { 4418 return; 4419 } 4420 4421 if (input && (input.eventType & INPUT_END)) { 4422 this.manager.emit(this.options.event + 'up', input); 4423 } else { 4424 this._input.timeStamp = now(); 4425 this.manager.emit(this.options.event, this._input); 4426 } 4427 } 4428 }); 4429 4430 /** 4431 * Rotate 4432 * Recognized when two or more pointer are moving in a circular motion. 4433 * @constructor 4434 * @extends AttrRecognizer 4435 */ 4436 function RotateRecognizer() { 4437 AttrRecognizer.apply(this, arguments); 4438 } 4439 4440 inherit(RotateRecognizer, AttrRecognizer, { 4441 /** 4442 * @namespace 4443 * @memberof RotateRecognizer 4444 */ 4445 defaults: { 4446 event: 'rotate', 4447 threshold: 0, 4448 pointers: 2 4449 }, 4450 4451 getTouchAction: function() { 4452 return [TOUCH_ACTION_NONE]; 4453 }, 4454 4455 attrTest: function(input) { 4456 return this._super.attrTest.call(this, input) && 4457 (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); 4458 } 4459 }); 4460 4461 /** 4462 * Swipe 4463 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. 4464 * @constructor 4465 * @extends AttrRecognizer 4466 */ 4467 function SwipeRecognizer() { 4468 AttrRecognizer.apply(this, arguments); 4469 } 4470 4471 inherit(SwipeRecognizer, AttrRecognizer, { 4472 /** 4473 * @namespace 4474 * @memberof SwipeRecognizer 4475 */ 4476 defaults: { 4477 event: 'swipe', 4478 threshold: 10, 4479 velocity: 0.65, 4480 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, 4481 pointers: 1 4482 }, 4483 4484 getTouchAction: function() { 4485 return PanRecognizer.prototype.getTouchAction.call(this); 4486 }, 4487 4488 attrTest: function(input) { 4489 var direction = this.options.direction; 4490 var velocity; 4491 4492 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { 4493 velocity = input.velocity; 4494 } else if (direction & DIRECTION_HORIZONTAL) { 4495 velocity = input.velocityX; 4496 } else if (direction & DIRECTION_VERTICAL) { 4497 velocity = input.velocityY; 4498 } 4499 4500 return this._super.attrTest.call(this, input) && 4501 direction & input.direction && 4502 input.distance > this.options.threshold && 4503 abs(velocity) > this.options.velocity && input.eventType & INPUT_END; 4504 }, 4505 4506 emit: function(input) { 4507 var direction = directionStr(input.direction); 4508 if (direction) { 4509 this.manager.emit(this.options.event + direction, input); 4510 } 4511 4512 this.manager.emit(this.options.event, input); 4513 } 4514 }); 4515 4516 /** 4517 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur 4518 * between the given interval and position. The delay option can be used to recognize multi-taps without firing 4519 * a single tap. 4520 * 4521 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of 4522 * multi-taps being recognized. 4523 * @constructor 4524 * @extends Recognizer 4525 */ 4526 function TapRecognizer() { 4527 Recognizer.apply(this, arguments); 4528 4529 // previous time and center, 4530 // used for tap counting 4531 this.pTime = false; 4532 this.pCenter = false; 4533 4534 this._timer = null; 4535 this._input = null; 4536 this.count = 0; 4537 } 4538 4539 inherit(TapRecognizer, Recognizer, { 4540 /** 4541 * @namespace 4542 * @memberof PinchRecognizer 4543 */ 4544 defaults: { 4545 event: 'tap', 4546 pointers: 1, 4547 taps: 1, 4548 interval: 300, // max time between the multi-tap taps 4549 time: 250, // max time of the pointer to be down (like finger on the screen) 4550 threshold: 2, // a minimal movement is ok, but keep it low 4551 posThreshold: 10 // a multi-tap can be a bit off the initial position 4552 }, 4553 4554 getTouchAction: function() { 4555 return [TOUCH_ACTION_MANIPULATION]; 4556 }, 4557 4558 process: function(input) { 4559 var options = this.options; 4560
vendor: 12,274 bytes, lines 4561-4899
4561 var validPointers = input.pointers.length === options.pointers; 4562 var validMovement = input.distance < options.threshold; 4563 var validTouchTime = input.deltaTime < options.time; 4564 4565 this.reset(); 4566 4567 if ((input.eventType & INPUT_START) && (this.count === 0)) { 4568 return this.failTimeout(); 4569 } 4570 4571 // we only allow little movement 4572 // and we've reached an end event, so a tap is possible 4573 if (validMovement && validTouchTime && validPointers) { 4574 if (input.eventType != INPUT_END) { 4575 return this.failTimeout(); 4576 } 4577 4578 var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; 4579 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; 4580 4581 this.pTime = input.timeStamp; 4582 this.pCenter = input.center; 4583 4584 if (!validMultiTap || !validInterval) { 4585 this.count = 1; 4586 } else { 4587 this.count += 1; 4588 } 4589 4590 this._input = input; 4591 4592 // if tap count matches we have recognized it, 4593 // else it has began recognizing... 4594 var tapCount = this.count % options.taps; 4595 if (tapCount === 0) { 4596 // no failing requirements, immediately trigger the tap event 4597 // or wait as long as the multitap interval to trigger 4598 if (!this.hasRequireFailures()) { 4599 return STATE_RECOGNIZED; 4600 } else { 4601 this._timer = setTimeoutContext(function() { 4602 this.state = STATE_RECOGNIZED; 4603 this.tryEmit(); 4604 }, options.interval, this); 4605 return STATE_BEGAN; 4606 } 4607 } 4608 } 4609 return STATE_FAILED; 4610 }, 4611 4612 failTimeout: function() { 4613 this._timer = setTimeoutContext(function() { 4614 this.state = STATE_FAILED; 4615 }, this.options.interval, this); 4616 return STATE_FAILED; 4617 }, 4618 4619 reset: function() { 4620 clearTimeout(this._timer); 4621 }, 4622 4623 emit: function() { 4624 if (this.state == STATE_RECOGNIZED ) { 4625 this._input.tapCount = this.count; 4626 this.manager.emit(this.options.event, this._input); 4627 } 4628 } 4629 }); 4630 4631 /** 4632 * Simple way to create an manager with a default set of recognizers. 4633 * @param {HTMLElement} element 4634 * @param {Object} [options] 4635 * @constructor 4636 */ 4637 function Hammer(element, options) { 4638 options = options || {}; 4639 options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); 4640 return new Manager(element, options); 4641 } 4642 4643 /** 4644 * @const {string} 4645 */ 4646 Hammer.VERSION = '2.0.4'; 4647 4648 /** 4649 * default settings 4650 * @namespace 4651 */ 4652 Hammer.defaults = { 4653 /** 4654 * set if DOM events are being triggered. 4655 * But this is slower and unused by simple implementations, so disabled by default. 4656 * @type {Boolean} 4657 * @default false 4658 */ 4659 domEvents: false, 4660 4661 /** 4662 * The value for the touchAction property/fallback. 4663 * When set to `compute` it will magically set the correct value based on the added recognizers. 4664 * @type {String} 4665 * @default compute 4666 */ 4667 touchAction: TOUCH_ACTION_COMPUTE, 4668 4669 /** 4670 * @type {Boolean} 4671 * @default true 4672 */ 4673 enable: true, 4674 4675 /** 4676 * EXPERIMENTAL FEATURE -- can be removed/changed 4677 * Change the parent input target element. 4678 * If Null, then it is being set the to main element. 4679 * @type {Null|EventTarget} 4680 * @default null 4681 */ 4682 inputTarget: null, 4683 4684 /** 4685 * force an input class 4686 * @type {Null|Function} 4687 * @default null 4688 */ 4689 inputClass: null, 4690 4691 /** 4692 * Default recognizer setup when calling `Hammer()` 4693 * When creating a new Manager these will be skipped. 4694 * @type {Array} 4695 */ 4696 preset: [ 4697 // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] 4698 [RotateRecognizer, { enable: false }], 4699 [PinchRecognizer, { enable: false }, ['rotate']], 4700 [SwipeRecognizer,{ direction: DIRECTION_HORIZONTAL }], 4701 [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']], 4702 [TapRecognizer], 4703 [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']], 4704 [PressRecognizer] 4705 ], 4706 4707 /** 4708 * Some CSS properties can be used to improve the working of Hammer. 4709 * Add them to this method and they will be set when creating a new Manager. 4710 * @namespace 4711 */ 4712 cssProps: { 4713 /** 4714 * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. 4715 * @type {String} 4716 * @default 'none' 4717 */ 4718 userSelect: 'none', 4719 4720 /** 4721 * Disable the Windows Phone grippers when pressing an element. 4722 * @type {String} 4723 * @default 'none' 4724 */ 4725 touchSelect: 'none', 4726 4727 /** 4728 * Disables the default callout shown when you touch and hold a touch target. 4729 * On iOS, when you touch and hold a touch target such as a link, Safari displays 4730 * a callout containing information about the link. This property allows you to disable that callout. 4731 * @type {String} 4732 * @default 'none' 4733 */ 4734 touchCallout: 'none', 4735 4736 /** 4737 * Specifies whether zooming is enabled. Used by IE10> 4738 * @type {String} 4739 * @default 'none' 4740 */ 4741 contentZooming: 'none', 4742 4743 /** 4744 * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. 4745 * @type {String} 4746 * @default 'none' 4747 */ 4748 userDrag: 'none', 4749 4750 /** 4751 * Overrides the highlight color shown when the user taps a link or a JavaScript 4752 * clickable element in iOS. This property obeys the alpha value, if specified. 4753 * @type {String} 4754 * @default 'rgba(0,0,0,0)' 4755 */ 4756 tapHighlightColor: 'rgba(0,0,0,0)' 4757 } 4758 }; 4759 4760 var STOP = 1; 4761 var FORCED_STOP = 2; 4762 4763 /** 4764 * Manager 4765 * @param {HTMLElement} element 4766 * @param {Object} [options] 4767 * @constructor 4768 */ 4769 function Manager(element, options) { 4770 options = options || {}; 4771 4772 this.options = merge(options, Hammer.defaults); 4773 this.options.inputTarget = this.options.inputTarget || element; 4774 4775 this.handlers = {}; 4776 this.session = {}; 4777 this.recognizers = []; 4778 4779 this.element = element; 4780 this.input = createInputInstance(this); 4781 this.touchAction = new TouchAction(this, this.options.touchAction); 4782 4783 toggleCssProps(this, true); 4784 4785 each(options.recognizers, function(item) { 4786 var recognizer = this.add(new (item[0])(item[1])); 4787 item[2] && recognizer.recognizeWith(item[2]); 4788 item[3] && recognizer.requireFailure(item[3]); 4789 }, this); 4790 } 4791 4792 Manager.prototype = { 4793 /** 4794 * set options 4795 * @param {Object} options 4796 * @returns {Manager} 4797 */ 4798 set: function(options) { 4799 extend(this.options, options); 4800 4801 // Options that need a little more setup 4802 if (options.touchAction) { 4803 this.touchAction.update(); 4804 } 4805 if (options.inputTarget) { 4806 // Clean up existing event listeners and reinitialize 4807 this.input.destroy(); 4808 this.input.target = options.inputTarget; 4809 this.input.init(); 4810 } 4811 return this; 4812 }, 4813 4814 /** 4815 * stop recognizing for this session. 4816 * This session will be discarded, when a new [input]start event is fired. 4817 * When forced, the recognizer cycle is stopped immediately. 4818 * @param {Boolean} [force] 4819 */ 4820 stop: function(force) { 4821 this.session.stopped = force ? FORCED_STOP : STOP; 4822 }, 4823 4824 /** 4825 * run the recognizers! 4826 * called by the inputHandler function on every movement of the pointers (touches) 4827 * it walks through all the recognizers and tries to detect the gesture that is being made 4828 * @param {Object} inputData 4829 */ 4830 recognize: function(inputData) { 4831 var session = this.session; 4832 if (session.stopped) { 4833 return; 4834 } 4835 4836 // run the touch-action polyfill 4837 this.touchAction.preventDefaults(inputData); 4838 4839 var recognizer; 4840 var recognizers = this.recognizers; 4841 4842 // this holds the recognizer that is being recognized. 4843 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED 4844 // if no recognizer is detecting a thing, it is set to `null` 4845 var curRecognizer = session.curRecognizer; 4846 4847 // reset when the last recognizer is recognized 4848 // or when we're in a new session 4849 if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { 4850 curRecognizer = session.curRecognizer = null; 4851 } 4852 4853 var i = 0; 4854 while (i < recognizers.length) { 4855 recognizer = recognizers[i]; 4856 4857 // find out if we are allowed try to recognize the input for this one. 4858 // 1. allow if the session is NOT forced stopped (see the .stop() method) 4859 // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one 4860 // that is being recognized. 4861 // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. 4862 // this can be setup with the `recognizeWith()` method on the recognizer. 4863 if (session.stopped !== FORCED_STOP && ( // 1 4864 !curRecognizer || recognizer == curRecognizer || // 2 4865 recognizer.canRecognizeWith(curRecognizer))) { // 3 4866 recognizer.recognize(inputData); 4867 } else { 4868 recognizer.reset(); 4869 } 4870 4871 // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the 4872 // current active recognizer. but only if we don't already have an active recognizer 4873 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { 4874 curRecognizer = session.curRecognizer = recognizer; 4875 } 4876 i++; 4877 } 4878 }, 4879 4880 /** 4881 * get a recognizer by its event name. 4882 * @param {Recognizer|String} recognizer 4883 * @returns {Recognizer|Null} 4884 */ 4885 get: function(recognizer) { 4886 if (recognizer instanceof Recognizer) { 4887 return recognizer; 4888 } 4889 4890 var recognizers = this.recognizers; 4891 for (var i = 0; i < recognizers.length; i++) { 4892 if (recognizers[i].options.event == recognizer) { 4893 return recognizers[i]; 4894 } 4895 } 4896 return null; 4897 }, 4898 4899 /**
4900 * add a recognizer to the manager 4901 * existing recognizers with the same event name will be removed 4902 * @param {Recognizer} recognizer 4903 * @returns {Recognizer|Manager} 4904 */ 4905 add: function(recognizer) { 4906 if (invokeArrayArg(recognizer, 'add', this)) { 4907 return this; 4908 } 4909 4910 // remove existing 4911 var existing = this.get(recognizer.options.event); 4912 if (existing) { 4913 this.remove(existing); 4914 } 4915 4916 this.recognizers.push(recognizer); 4917 recognizer.manager = this; 4918 4919 this.touchAction.update(); 4920 return recognizer; 4921 }, 4922 4923 /** 4924 * remove a recognizer by name or instance 4925 * @param {Recognizer|String} recognizer 4926 * @returns {Manager} 4927 */ 4928 remove: function(recognizer) { 4929 if (invokeArrayArg(recognizer, 'remove', this)) { 4930 return this; 4931 } 4932 4933 var recognizers = this.recognizers; 4934 recognizer = this.get(recognizer); 4935 recognizers.splice(inArray(recognizers, recognizer), 1); 4936 4937 this.touchAction.update(); 4938 return this; 4939 }, 4940 4941 /** 4942 * bind event 4943 * @param {String} events 4944 * @param {Function} handler 4945 * @returns {EventEmitter} this 4946 */ 4947 on: function(events, handler) { 4948 var handlers = this.handlers; 4949 each(splitStr(events), function(event) { 4950 handlers[event] = handlers[event] || []; 4951 handlers[event].push(handler); 4952 }); 4953 return this; 4954 }, 4955 4956 /** 4957 * unbind event, leave emit blank to remove all handlers 4958 * @param {String} events 4959 * @param {Function} [handler] 4960 * @returns {EventEmitter} this 4961 */ 4962 off: function(events, handler) { 4963 var handlers = this.handlers; 4964 each(splitStr(events), function(event) { 4965 if (!handler) { 4966 delete handlers[event]; 4967 } else { 4968 handlers[event].splice(inArray(handlers[event], handler), 1); 4969 } 4970 }); 4971 return this; 4972 }, 4973 4974 /** 4975 * emit event to the listeners 4976 * @param {String} event 4977 * @param {Object} data 4978 */ 4979 emit: function(event, data) { 4980 // we also want to trigger dom events 4981 if (this.options.domEvents) { 4982 triggerDomEvent(event, data); 4983 } 4984 4985 // no handlers, so skip it all 4986 var handlers = this.handlers[event] && this.handlers[event].slice(); 4987 if (!handlers || !handlers.length) { 4988 return; 4989 } 4990 4991 data.type = event; 4992 data.preventDefault = function() { 4993 data.srcEvent.preventDefault(); 4994 }; 4995 4996 var i = 0; 4997 while (i < handlers.length) { 4998 handlers[i](data); 4999 i++; 5000 } 5001 }, 5002 5003 /** 5004 * destroy the manager and unbinds all events 5005 * it doesn't unbind dom events, that is the user own responsibility 5006 */ 5007 destroy: function() { 5008 this.element && toggleCssProps(this, false); 5009 5010 this.handlers = {}; 5011 this.session = {}; 5012 this.input.destroy(); 5013 this.element = null; 5014 } 5015 }; 5016 5017 /** 5018 * add/remove the css properties as defined in manager.options.cssProps 5019 * @param {Manager} manager 5020 * @param {Boolean} add 5021 */ 5022 function toggleCssProps(manager, add) { 5023 var element = manager.element; 5024 each(manager.options.cssProps, function(value, name) { 5025 element.style[prefixed(element.style, name)] = add ? value : ''; 5026 }); 5027 } 5028 5029 /** 5030 * trigger dom event 5031 * @param {String} event 5032 * @param {Object} data 5033 */ 5034 function triggerDomEvent(event, data) { 5035 var gestureEvent = document.createEvent('Event'); 5036 gestureEvent.initEvent(event, true, true); 5037 gestureEvent.gesture = data; 5038 data.target.dispatchEvent(gestureEvent); 5039 } 5040 5041 extend(Hammer, { 5042 INPUT_START: INPUT_START, 5043 INPUT_MOVE: INPUT_MOVE, 5044 INPUT_END: INPUT_END, 5045 INPUT_CANCEL: INPUT_CANCEL, 5046 5047 STATE_POSSIBLE: STATE_POSSIBLE, 5048 STATE_BEGAN: STATE_BEGAN, 5049 STATE_CHANGED: STATE_CHANGED, 5050 STATE_ENDED: STATE_ENDED, 5051 STATE_RECOGNIZED: STATE_RECOGNIZED, 5052 STATE_CANCELLED: STATE_CANCELLED, 5053 STATE_FAILED: STATE_FAILED, 5054 5055 DIRECTION_NONE: DIRECTION_NONE, 5056 DIRECTION_LEFT: DIRECTION_LEFT, 5057 DIRECTION_RIGHT: DIRECTION_RIGHT, 5058 DIRECTION_UP: DIRECTION_UP, 5059 DIRECTION_DOWN: DIRECTION_DOWN, 5060 DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, 5061 DIRECTION_VERTICAL: DIRECTION_VERTICAL, 5062 DIRECTION_ALL: DIRECTION_ALL, 5063 5064 Manager: Manager, 5065 Input: Input, 5066 TouchAction: TouchAction, 5067 5068 TouchInput: TouchInput, 5069 MouseInput: MouseInput, 5070 PointerEventInput: PointerEventInput, 5071 TouchMouseInput: TouchMouseInput, 5072 SingleTouchInput: SingleTouchInput, 5073 5074 Recognizer: Recognizer, 5075 AttrRecognizer: AttrRecognizer, 5076 Tap: TapRecognizer, 5077 Pan: PanRecognizer, 5078 Swipe: SwipeRecognizer, 5079 Pinch: PinchRecognizer, 5080 Rotate: RotateRecognizer, 5081 Press: PressRecognizer, 5082 5083 on: addEventListeners, 5084 off: removeEventListeners, 5085 each: each, 5086 merge: merge, 5087 extend: extend, 5088 inherit: inherit, 5089 bindFn: bindFn, 5090 prefixed: prefixed 5091 });
vendor: 27,551 bytes, lines 5092-5107
5092 5093 if (typeof define == TYPE_FUNCTION && define.amd) { 5094 define(function() { 5095 return Hammer; 5096 }); 5097 } else if (typeof module != 'undefined' && module.exports) { 5098 module.exports = Hammer; 5099 } else { 5100 window[exportName] = Hammer; 5101 } 5102 5103})(window, document, 'Hammer'); 5104/* End */ 5105; 5106; /* Start:"a:4:{s:4:"full";s:79:"/o-klube/shema-territorii/assets/jquery.inputmask.bundle.min.js?160753368676009";s:6:"source";s:63:"/o-klube/shema-territorii/assets/jquery.inputmask.bundle.min.js";s:3:"min";s:63:"/o-klube/shema-territorii/assets/jquery.inputmask.bundle.min.js";s:3:"map";s:67:"/o-klube/shema-territorii/assets/jquery.inputmask.bundle.min.js.map";}"*/ 5107!function(e){function t(a,n){return this instanceof t?(e.isPlainObject(a)?n=a:(n=n||{},n.alias=a),this.el=void 0,this.opts=e.extend(!0,{},this.defaults,n),this.maskset=void 0,this.noMasksCache=n&&void 0!==n.definitions,this.userOptions=n||{},this.events={},this.dataAttribute="data-inputmask",this.isRTL=this.opts.numericInput,void i(this.opts.alias,n,this.opts)):new t(a,n)}function i(t,a,n){var r=n.aliases[t];return r?(r.alias&&i(r.alias,void 0,n),e.extend(!0,n,r),e.extend(!0,n,a),!0):(null===n.mask&&(n.mask=t),!1)}function a(i,a){function n(i,n,r){if(null!==i&&""!==i){if(1===i.length&&r.greedy===!1&&0!==r.repeat&&(r.placeholder=""),r.repeat>0||"*"===r.repeat||"+"===r.repeat){var o="*"===r.repeat?0:"+"===r.repeat?1:r.repeat;i=r.groupmarker.start+i+r.groupmarker.end+r.quantifiermarker.start+o+","+r.repeat+r.quantifiermarker.end}var s;return void 0===t.prototype.masksCache[i]||a===!0?(s={mask:i,maskToken:t.prototype.analyseMask(i,r),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:n,maskLength:void 0},a!==!0&&(t.prototype.masksCache[r.numericInput?i.split("").reverse().join(""):i]=s,s=e.extend(!0,{},t.prototype.masksCache[r.numericInput?i.split("").reverse().join(""):i]))):s=e.extend(!0,{},t.prototype.masksCache[r.numericInput?i.split("").reverse().join(""):i]),s}}var r;if(e.isFunction(i.mask)&&(i.mask=i.mask(i)),e.isArray(i.mask)){if(i.mask.length>1){i.keepStatic=null===i.keepStatic||i.keepStatic;var o=i.groupmarker.start;return e.each(i.numericInput?i.mask.reverse():i.mask,function(t,a){o.length>1&&(o+=i.groupmarker.end+i.alternatormarker+i.groupmarker.start),o+=void 0===a.mask||e.isFunction(a.mask)?a:a.mask}),o+=i.groupmarker.end,n(o,i.mask,i)}i.mask=i.mask.pop()}return i.mask&&(r=void 0===i.mask.mask||e.isFunction(i.mask.mask)?n(i.mask,i.mask,i):n(i.mask.mask,i.mask,i)),r}function n(i,a,r){function c(e,t,i){t=t||0;var a,n,o,s=[],l=0,u=f();V=void 0!==W?W.maxLength:void 0,V===-1&&(V=void 0);do e===!0&&p().validPositions[l]?(o=p().validPositions[l],n=o.match,a=o.locator.slice(),s.push(i===!0?o.input:i===!1?n.nativeDef:_(l,n))):(o=v(l,a,l-1),n=o.match,a=o.locator.slice(),(r.jitMasking===!1||l<u||"number"==typeof r.jitMasking&&isFinite(r.jitMasking)&&r.jitMasking>l)&&s.push(i===!1?n.nativeDef:_(l,n))),l++;while((void 0===V||l<V)&&(null!==n.fn||""!==n.def)||t>l);return""===s[s.length-1]&&s.pop(),p().maskLength=l+1,s}function p(){return a}function d(e){var t=p();t.buffer=void 0,e!==!0&&(t._buffer=void 0,t.validPositions={},t.p=0)}function f(e,t,i){var a=-1,n=-1,r=i||p().validPositions;void 0===e&&(e=-1);for(var o in r){var s=parseInt(o);r[s]&&(t||null!==r[s].match.fn)&&(s<=e&&(a=s),s>=e&&(n=s))}return a!==-1&&e-a>1||n<e?a:n}function m(t,i,a,n){function o(e){var t=p().validPositions[e];if(void 0!==t&&null===t.match.fn){var i=p().validPositions[e-1],a=p().validPositions[e+1];return void 0!==i&&void 0!==a}return!1}var s,l=t,u=e.extend(!0,{},p().validPositions),c=!1;for(p().p=t,s=i-1;s>=l;s--)void 0!==p().validPositions[s]&&(a!==!0&&(!p().validPositions[s].match.optionality&&o(s)||r.canClearPosition(p(),s,f(),n,r)===!1)||delete p().validPositions[s]);for(d(!0),s=l+1;s<=f();){for(;void 0!==p().validPositions[l];)l++;if(s<l&&(s=l+1),void 0===p().validPositions[s]&&E(s))s++;else{var m=v(s);c===!1&&u[l]&&u[l].match.def===m.match.def?(p().validPositions[l]=e.extend(!0,{},u[l]),p().validPositions[l].input=m.input,delete p().validPositions[s],s++):y(l,m.match.def)?A(l,m.input||_(s),!0)!==!1&&(delete p().validPositions[s],s++,c=!0):E(s)||(s++,l--),l++}}d(!0)}function h(e,t){for(var i,a=e,n=f(),o=p().validPositions[n]||k(0)[0],s=void 0!==o.alternation?o.locator[o.alternation].toString().split(","):[],l=0;l<a.length&&(i=a[l],!(i.match&&(r.greedy&&i.match.optionalQuantifier!==!0||(i.match.optionality===!1||i.match.newBlockMarker===!1)&&i.match.optionalQuantifier!==!0)&&(void 0===o.alternation||o.alternation!==i.alternation||void 0!==i.locator[o.alternation]&&S(i.locator[o.alternation].toString().split(","),s)))||t===!0&&(null!==i.match.fn||/[0-9a-bA-Z]/.test(i.match.def)));l++);return i}function v(e,t,i){return p().validPositions[e]||h(k(e,t?t.slice():t,i))}function g(e){return p().validPositions[e]?p().validPositions[e]:k(e)[0]}function y(e,t){for(var i=!1,a=k(e),n=0;n<a.length;n++)if(a[n].match&&a[n].match.def===t){i=!0;break}return i}function k(t,i,a){function n(i,a,o,s){function u(o,s,d){function h(t,i){var a=0===e.inArray(t,i.matches);return a||e.each(i.matches,function(e,n){if(n.isQuantifier===!0&&(a=h(t,i.matches[e-1])))return!1}),a}function g(t,i,a){var n,r;return(p().tests[t]||p().validPositions[t])&&e.each(p().tests[t]||[p().validPositions[t]],function(e,t){var o=void 0!==a?a:t.alternation,s=void 0!==t.locator[o]?t.locator[o].toString().indexOf(i):-1;(void 0===r||s<r)&&s!==-1&&(n=t,r=s)}),n?n.locator.slice((void 0!==a?a:n.alternation)+1):void 0!==a?g(t,i):void 0}function y(e,i){return null===e.match.fn&&null!==i.match.fn&&i.match.fn.test(e.match.def,p(),t,!1,r,!1)}if(c>1e4)throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+p().mask;if(c===t&&void 0===o.matches)return f.push({match:o,locator:s.reverse(),cd:v}),!0;if(void 0!==o.matches){if(o.isGroup&&d!==o){if(o=u(i.matches[e.inArray(o,i.matches)+1],s))return!0}else if(o.isOptional){var k=o;if(o=n(o,a,s,d)){if(l=f[f.length-1].match,!h(l,k))return!0;m=!0,c=t}}else if(o.isAlternator){var x,b=o,P=[],w=f.slice(),S=s.length,A=a.length>0?a.shift():-1;if(A===-1||"string"==typeof A){var E,C=c,R=a.slice(),M=[];if("string"==typeof A)M=A.split(",");else for(E=0;E<b.matches.length;E++)M.push(E);for(var O=0;O<M.length;O++){if(E=parseInt(M[O]),f=[],a=g(c,E,S)||R.slice(),o=u(b.matches[E]||i.matches[E],[E].concat(s),d)||o,o!==!0&&void 0!==o&&M[M.length-1]<b.matches.length){var _=e.inArray(o,i.matches)+1;i.matches.length>_&&(o=u(i.matches[_],[_].concat(s.slice(1,s.length)),d),o&&(M.push(_.toString()),e.each(f,function(e,t){t.alternation=s.length-1})))}x=f.slice(),c=C,f=[];for(var I=0;I<x.length;I++){var j=x[I],D=!1;j.alternation=j.alternation||S;for(var F=0;F<P.length;F++){var N=P[F];if(("string"!=typeof A||e.inArray(j.locator[j.alternation].toString(),M)!==-1)&&(j.match.def===N.match.def||y(j,N))){D=j.match.nativeDef===N.match.nativeDef,j.alternation==N.alternation&&N.locator[N.alternation].toString().indexOf(j.locator[j.alternation])===-1&&(N.locator[N.alternation]=N.locator[N.alternation]+","+j.locator[j.alternation],N.alternation=j.alternation,null==j.match.fn&&(N.na=N.na||j.locator[j.alternation].toString(),N.na.indexOf(j.locator[j.alternation])===-1&&(N.na=N.na+","+j.locator[j.alternation])));break}}D||P.push(j)}}"string"==typeof A&&(P=e.map(P,function(t,i){if(isFinite(i)){var a,n=t.alternation,r=t.locator[n].toString().split(",");t.locator[n]=void 0,t.alternation=void 0;for(var o=0;o<r.length;o++)a=e.inArray(r[o],M)!==-1,a&&(void 0!==t.locator[n]?(t.locator[n]+=",",t.locator[n]+=r[o]):t.locator[n]=parseInt(r[o]),t.alternation=n);if(void 0!==t.locator[n])return t}})),f=w.concat(P),c=t,m=f.length>0,a=R.slice()}else o=u(b.matches[A]||i.matches[A],[A].concat(s),d);if(o)return!0}else if(o.isQuantifier&&d!==i.matches[e.inArray(o,i.matches)-1])for(var T=o,G=a.length>0?a.shift():0;G<(isNaN(T.quantifier.max)?G+1:T.quantifier.max)&&c<=t;G++){var B=i.matches[e.inArray(T,i.matches)-1];if(o=u(B,[G].concat(s),B)){if(l=f[f.length-1].match,l.optionalQuantifier=G>T.quantifier.min-1,h(l,B)){if(G>T.quantifier.min-1){m=!0,c=t;break}return!0}return!0}}else if(o=n(o,a,s,d))return!0}else c++}for(var d=a.length>0?a.shift():0;d<i.matches.length;d++)if(i.matches[d].isQuantifier!==!0){var h=u(i.matches[d],[d].concat(o),s);if(h&&c===t)return h;if(c>t)break}}function o(t){var i=[];return e.isArray(t)||(t=[t]),t.length>0&&(void 0===t[0].alternation?(i=h(t.slice()).locator.slice(),0===i.length&&(i=t[0].locator.slice())):e.each(t,function(e,t){if(""!==t.def)if(0===i.length)i=t.locator.slice();else for(var a=0;a<i.length;a++)t.locator[a]&&i[a].toString().indexOf(t.locator[a])===-1&&(i[a]+=","+t.locator[a])})),i}function s(e){return r.keepStatic&&t>0&&e.length>1+(""===e[e.length-1].match.def?1:0)&&e[0].match.optionality!==!0&&e[0].match.optionalQuantifier!==!0&&null===e[0].match.fn&&!/[0-9a-bA-Z]/.test(e[0].match.def)?[h(e)]:e}var l,u=p().maskToken,c=i?a:0,d=i?i.slice():[0],f=[],m=!1,v=i?i.join(""):"";if(t>-1){if(void 0===i){for(var g,y=t-1;void 0===(g=p().validPositions[y]||p().tests[y])&&y>-1;)y--;void 0!==g&&y>-1&&(d=o(g),v=d.join(""),c=y)}if(p().tests[t]&&p().tests[t][0].cd===v)return s(p().tests[t]);for(var k=d.shift();k<u.length;k++){var x=n(u[k],d,[k]);if(x&&c===t||c>t)break}}return(0===f.length||m)&&f.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:"",placeholder:""},locator:[],cd:v}),void 0!==i&&p().tests[t]?s(e.extend(!0,[],f)):(p().tests[t]=e.extend(!0,[],f),s(p().tests[t]))}function x(){return void 0===p()._buffer&&(p()._buffer=c(!1,1),void 0===p().buffer&&p()._buffer.slice()),p()._buffer}function b(e){return void 0!==p().buffer&&e!==!0||(p().buffer=c(!0,f(),!0)),p().buffer}function P(e,t,i){var a;if(e===!0)d(),e=0,t=i.length;else for(a=e;a<t;a++)delete p().validPositions[a];for(a=e;a<t;a++)d(!0),i[a]!==r.skipOptionalPartCharacter&&A(a,i[a],!0,!0)}function w(e,i,a){switch(r.casing||i.casing){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break;case"title":var n=p().validPositions[a-1];e=0===a||n&&n.input===String.fromCharCode(t.keyCode.SPACE)?e.toUpperCase():e.toLowerCase()}return e}function S(t,i){for(var a=r.greedy?i:i.slice(0,1),n=!1,o=0;o<t.length;o++)if(e.inArray(t[o],a)!==-1){n=!0;break}return n}function A(i,a,n,o,s){function l(e){var t=q?e.begin-e.end>1||e.begin-e.end===1&&r.insertMode:e.end-e.begin>1||e.end-e.begin===1&&r.insertMode;return t&&0===e.begin&&e.end===p().maskLength?"full":t}function u(t,a,n){var s=!1;return e.each(k(t),function(u,c){for(var h=c.match,v=a?1:0,g="",y=h.cardinality;y>v;y--)g+=M(t-(y-1));if(a&&(g+=a),b(!0),s=null!=h.fn?h.fn.test(g,p(),t,n,r,l(i)):(a===h.def||a===r.skipOptionalPartCharacter)&&""!==h.def&&{c:h.placeholder||h.def,pos:t},s!==!1){var k=void 0!==s.c?s.c:a;k=k===r.skipOptionalPartCharacter&&null===h.fn?h.placeholder||h.def:k;var S=t,E=b();if(void 0!==s.remove&&(e.isArray(s.remove)||(s.remove=[s.remove]),e.each(s.remove.sort(function(e,t){return t-e}),function(e,t){m(t,t+1,!0)})),void 0!==s.insert&&(e.isArray(s.insert)||(s.insert=[s.insert]),e.each(s.insert.sort(function(e,t){return e-t}),function(e,t){A(t.pos,t.c,!0,o)})),s.refreshFromBuffer){var C=s.refreshFromBuffer;if(n=!0,P(C===!0?C:C.start,C.end,E),void 0===s.pos&&void 0===s.c)return s.pos=f(),!1;if(S=void 0!==s.pos?s.pos:t,S!==t)return s=e.extend(s,A(S,k,!0,o)),!1}else if(s!==!0&&void 0!==s.pos&&s.pos!==t&&(S=s.pos,P(t,S,b().slice()),S!==t))return s=e.extend(s,A(S,k,!0)),!1;return(s===!0||void 0!==s.pos||void 0!==s.c)&&(u>0&&d(!0),x(S,e.extend({},c,{input:w(k,h,S)}),o,l(i))||(s=!1),!1)}}),s}function c(t,i,a){var n,s,l,u,c,m,h,v,g=e.extend(!0,{},p().validPositions),y=!1,x=f();for(u=p().validPositions[x];x>=0;x--)if(l=p().validPositions[x],l&&void 0!==l.alternation){if(n=x,s=p().validPositions[n].alternation,u.locator[l.alternation]!==l.locator[l.alternation])break;u=l}if(void 0!==s){v=parseInt(n);var b=void 0!==u.locator[u.alternation||s]?u.locator[u.alternation||s]:h[0];b.length>0&&(b=b.split(",")[0]);var P=p().validPositions[v],w=p().validPositions[v-1];e.each(k(v,w?w.locator:void 0,v-1),function(n,l){h=l.locator[s]?l.locator[s].toString().split(","):[];for(var u=0;u<h.length;u++){var k=[],x=0,w=0,S=!1;if(b<h[u]&&(void 0===l.na||e.inArray(h[u],l.na.split(","))===-1)){p().validPositions[v]=e.extend(!0,{},l);var E=p().validPositions[v].locator;for(p().validPositions[v].locator[s]=parseInt(h[u]),null==l.match.fn?(P.input!==l.match.def&&(S=!0,P.generatedInput!==!0&&k.push(P.input)),w++,p().validPositions[v].generatedInput=!/[0-9a-bA-Z]/.test(l.match.def),p().validPositions[v].input=l.match.def):p().validPositions[v].input=P.input,c=v+1;c<f(void 0,!0)+1;c++)m=p().validPositions[c],m&&m.generatedInput!==!0&&/[0-9a-bA-Z]/.test(m.input)?k.push(m.input):c<t&&x++,delete p().validPositions[c];for(S&&k[0]===l.match.def&&k.shift(),d(!0),y=!0;k.length>0;){var C=k.shift();if(C!==r.skipOptionalPartCharacter&&!(y=A(f(void 0,!0)+1,C,!1,o,!0)))break}if(y){p().validPositions[v].locator=E;var R=f(t)+1;for(c=v+1;c<f()+1;c++)m=p().validPositions[c],(void 0===m||null==m.match.fn)&&c<t+(w-x)&&w++;t+=w-x,y=A(t>R?R:t,i,a,o,!0)}if(y)return!1;d(),p().validPositions=e.extend(!0,{},g)}}})}return y}function g(t,i){var a=p().validPositions[i];if(a)for(var n=a.locator,r=n.length,o=t;o<i;o++)if(void 0===p().validPositions[o]&&!E(o,!0)){var s=k(o),l=s[0],u=-1;e.each(s,function(e,t){for(var i=0;i<r&&void 0!==t.locator[i]&&S(t.locator[i].toString().split(","),n[i].toString().split(","));i++)u<i&&(u=i,l=t)}),x(o,e.extend({},l,{input:l.match.placeholder||l.match.def}),!0)}}function x(t,i,a,n){if(n||r.insertMode&&void 0!==p().validPositions[t]&&void 0===a){var o,s=e.extend(!0,{},p().validPositions),l=f(void 0,!0);for(o=t;o<=l;o++)delete p().validPositions[o];p().validPositions[t]=e.extend(!0,{},i);var u,c=!0,m=p().validPositions,h=!1,v=p().maskLength;for(o=u=t;o<=l;o++){var g=s[o];if(void 0!==g)for(var k=u;k<p().maskLength&&(null===g.match.fn&&m[o]&&(m[o].match.optionalQuantifier===!0||m[o].match.optionality===!0)||null!=g.match.fn);){if(k++,h===!1&&s[k]&&s[k].match.def===g.match.def)p().validPositions[k]=e.extend(!0,{},s[k]),p().validPositions[k].input=g.input,R(k),u=k,c=!0;else if(y(k,g.match.def)){var x=A(k,g.input,!0,!0);c=x!==!1,u=x.caret||x.insert?f():k,h=!0}else c=g.generatedInput===!0;if(p().maskLength<v&&(p().maskLength=v),c)break}if(!c)break}if(!c)return p().validPositions=e.extend(!0,{},s),d(!0),!1}else p().validPositions[t]=e.extend(!0,{},i);return d(!0),!0}function R(t){for(var i=t-1;i>-1&&!p().validPositions[i];i--);var a,n;for(i++;i<t;i++)void 0===p().validPositions[i]&&(r.jitMasking===!1||r.jitMasking>i)&&(n=k(i,v(i-1).locator,i-1).slice(),""===n[n.length-1].match.def&&n.pop(),a=h(n),a&&(a.match.def===r.radixPointDefinitionSymbol||!E(i,!0)||e.inArray(r.radixPoint,b())<i&&a.match.fn&&a.match.fn.test(_(i),p(),i,!1,r))&&(I=u(i,a.match.placeholder||(null==a.match.fn?a.match.def:""!==_(i)?_(i):b()[i]),!0),I!==!1&&(p().validPositions[I.pos||i].generatedInput=!0)))}n=n===!0;var O=i;void 0!==i.begin&&(O=q&&!l(i)?i.end:i.begin);var I=!1,j=e.extend(!0,{},p().validPositions);if(R(O),l(i)&&(G(void 0,t.keyCode.DELETE,i),O=p().p),O<p().maskLength&&(I=u(O,a,n),(!n||o===!0)&&I===!1)){var D=p().validPositions[O];if(!D||null!==D.match.fn||D.match.def!==a&&a!==r.skipOptionalPartCharacter){if((r.insertMode||void 0===p().validPositions[C(O)])&&!E(O,!0)){var F=k(O).slice();""===F[F.length-1].match.def&&F.pop();var N=h(F,!0);N&&null===N.match.fn&&(N=N.match.placeholder||N.match.def,u(O,N,n),p().validPositions[O].generatedInput=!0);for(var T=O+1,B=C(O);T<=B;T++)if(I=u(T,a,n),I!==!1){g(O,void 0!==I.pos?I.pos:T),O=T;break}}}else I={caret:C(O)}}return I===!1&&r.keepStatic&&!n&&s!==!0&&(I=c(O,a,n)),I===!0&&(I={pos:O}),e.isFunction(r.postValidation)&&I!==!1&&!n&&o!==!0&&(I=!!r.postValidation(b(!0),I,r)&&I),void 0===I.pos&&(I.pos=O),I===!1&&(d(!0),p().validPositions=e.extend(!0,{},j)),I}function E(e,t){var i;if(t?(i=v(e).match,""===i.def&&(i=g(e).match)):i=g(e).match,null!=i.fn)return i.fn;if(t!==!0&&e>-1){var a=k(e);return a.length>1+(""===a[a.length-1].match.def?1:0)}return!1}function C(e,t){var i=p().maskLength;if(e>=i)return i;for(var a=e;++a<i&&(t===!0&&(g(a).match.newBlockMarker!==!0||!E(a))||t!==!0&&!E(a)););return a}function R(e,t){var i,a=e;if(a<=0)return 0;for(;--a>0&&(t===!0&&g(a).match.newBlockMarker!==!0||t!==!0&&!E(a)&&(i=k(a),i.length<2||2===i.length&&""===i[1].match.def)););return a}function M(e){return void 0===p().validPositions[e]?_(e):p().validPositions[e].input}function O(t,i,a,n,o){if(n&&e.isFunction(r.onBeforeWrite)){var s=r.onBeforeWrite(n,i,a,r);if(s){if(s.refreshFromBuffer){var l=s.refreshFromBuffer;P(l===!0?l:l.start,l.end,s.buffer||i),i=b(!0)}void 0!==a&&(a=void 0!==s.caret?s.caret:a)}}t.inputmask._valueSet(i.join("")),void 0===a||void 0!==n&&"blur"===n.type?L(t,i,a):D(t,a),o===!0&&(Y=!0,e(t).trigger("input"))}function _(e,t){if(t=t||g(e).match,void 0!==t.placeholder)return t.placeholder;if(null===t.fn){if(e>-1&&void 0===p().validPositions[e]){var i,a=k(e),n=[];if(a.length>1+(""===a[a.length-1].match.def?1:0))for(var o=0;o<a.length;o++)if(a[o].match.optionality!==!0&&a[o].match.optionalQuantifier!==!0&&(null===a[o].match.fn||void 0===i||a[o].match.fn.test(i.match.def,p(),e,!0,r)!==!1)&&(n.push(a[o]),null===a[o].match.fn&&(i=a[o]),n.length>1&&/[0-9a-bA-Z]/.test(n[0].match.def)))return r.placeholder.charAt(e%r.placeholder.length)}return t.def}return r.placeholder.charAt(e%r.placeholder.length)}function I(i,a,n,o,s,l){function u(){var e=!1,t=x().slice(h,C(h)).join("").indexOf(m);if(t!==-1&&!E(h)){e=!0;for(var i=x().slice(h,h+t),a=0;a<i.length;a++)if(" "!==i[a]){e=!1;break}}return e}var c=o.slice(),m="",h=0,g=void 0;if(d(),p().p=C(-1),!n)if(r.autoUnmask!==!0){var y=x().slice(0,C(-1)).join(""),k=c.join("").match(new RegExp("^"+t.escapeRegex(y),"g"));k&&k.length>0&&(c.splice(0,k.length*y.length),h=C(h))}else h=C(h);if(e.each(c,function(t,a){if(void 0!==a){var o=new e.Event("keypress");o.which=a.charCodeAt(0),m+=a;var s=f(void 0,!0),l=p().validPositions[s],c=v(s+1,l?l.locator.slice():void 0,s);if(!u()||n||r.autoUnmask){var y=n?t:null==c.match.fn&&c.match.optionality&&s+1<p().p?s+1:p().p;g=ee.keypressEvent.call(i,o,!0,!1,n,y),h=y+1,m=""}else g=ee.keypressEvent.call(i,o,!0,!1,!0,s+1);if(!n&&e.isFunction(r.onBeforeWrite)&&(g=r.onBeforeWrite(o,b(),g.forwardPosition,r),g&&g.refreshFromBuffer)){var k=g.refreshFromBuffer;P(k===!0?k:k.start,k.end,g.buffer),d(!0),g.caret&&(p().p=g.caret)}}}),a){var w=void 0,S=f();document.activeElement===i&&(s||g)&&(w=D(i).begin,s&&g===!1&&(w=C(f(w))),g&&l!==!0&&(w<S+1||S===-1)&&(w=r.numericInput&&void 0===g.caret?R(g.forwardPosition):g.forwardPosition)),O(i,b(),w,s||new e.Event("checkval"))}}function j(t){if(t&&void 0===t.inputmask)return t.value;var i=[],a=p().validPositions;for(var n in a)a[n].match&&null!=a[n].match.fn&&i.push(a[n].input);var o=0===i.length?"":(q?i.reverse():i).join("");if(e.isFunction(r.onUnMask)){var s=(q?b().slice().reverse():b()).join("");o=r.onUnMask(s,o,r)||o}return o}function D(e,t,i,a){function n(e){if(a!==!0&&q&&"number"==typeof e&&(!r.greedy||""!==r.placeholder)){var t=b().join("").length;e=t-e}return e}var s;if("number"!=typeof t)return e.setSelectionRange?(t=e.selectionStart,i=e.selectionEnd):window.getSelection?(s=window.getSelection().getRangeAt(0),s.commonAncestorContainer.parentNode!==e&&s.commonAncestorContainer!==e||(t=s.startOffset,i=s.endOffset)):document.selection&&document.selection.createRange&&(s=document.selection.createRange(),t=0-s.duplicate().moveStart("character",-e.inputmask._valueGet().length),i=t+s.text.length),{begin:n(t),end:n(i)};t=n(t),i=n(i),i="number"==typeof i?i:t;var l=parseInt(((e.ownerDocument.defaultView||window).getComputedStyle?(e.ownerDocument.defaultView||window).getComputedStyle(e,null):e.currentStyle).fontSize)*i;if(e.scrollLeft=l>e.scrollWidth?l:0,o||r.insertMode!==!1||t!==i||i++,e.setSelectionRange)e.selectionStart=t,e.selectionEnd=i;else if(window.getSelection){if(s=document.createRange(),void 0===e.firstChild||null===e.firstChild){var u=document.createTextNode("");e.appendChild(u)}s.setStart(e.firstChild,t<e.inputmask._valueGet().length?t:e.inputmask._valueGet().length),s.setEnd(e.firstChild,i<e.inputmask._valueGet().length?i:e.inputmask._valueGet().length),s.collapse(!0);var c=window.getSelection();c.removeAllRanges(),c.addRange(s)}else e.createTextRange&&(s=e.createTextRange(),s.collapse(!0),s.moveEnd("character",i),s.moveStart("character",t),s.select());L(e,void 0,{begin:t,end:i})}function F(t){var i,a,n=b(),r=n.length,o=f(),s={},l=p().validPositions[o],u=void 0!==l?l.locator.slice():void 0;for(i=o+1;i<n.length;i++)a=v(i,u,i-1),u=a.locator.slice(),s[i]=e.extend(!0,{},a);var c=l&&void 0!==l.alternation?l.locator[l.alternation]:void 0;for(i=r-1;i>o&&(a=s[i],(a.match.optionality||a.match.optionalQuantifier||c&&(c!==s[i].locator[l.alternation]&&null!=a.match.fn||null===a.match.fn&&a.locator[l.alternation]&&S(a.locator[l.alternation].toString().split(","),c.toString().split(","))&&""!==k(i)[0].def))&&n[i]===_(i,a.match));i--)r--;return t?{l:r,def:s[r]?s[r].match:void 0}:r}function N(e){for(var t=F(),i=e.length-1;i>t&&!E(i);i--);return e.splice(t,i+1-t),e}function T(t){if(e.isFunction(r.isComplete))return r.isComplete(t,r);if("*"!==r.repeat){var i=!1,a=F(!0),n=R(a.l);if(void 0===a.def||a.def.newBlockMarker||a.def.optionality||a.def.optionalQuantifier){i=!0;for(var o=0;o<=n;o++){var s=v(o).match;if(null!==s.fn&&void 0===p().validPositions[o]&&s.optionality!==!0&&s.optionalQuantifier!==!0||null===s.fn&&t[o]!==_(o,s)){i=!1;break}}}return i}}function G(i,a,n,o){function s(){if(r.keepStatic){for(var t=[],a=f(-1,!0),n=e.extend(!0,{},p().validPositions),o=p().validPositions[a];a>=0;a--){var s=p().validPositions[a];if(s){if(s.generatedInput!==!0&&/[0-9a-bA-Z]/.test(s.input)&&t.push(s.input),delete p().validPositions[a],void 0!==s.alternation&&s.locator[s.alternation]!==o.locator[s.alternation])break;o=s}}if(a>-1)for(p().p=C(f(-1,!0));t.length>0;){var l=new e.Event("keypress");l.which=t.pop().charCodeAt(0),ee.keypressEvent.call(i,l,!0,!1,!1,p().p)}else p().validPositions=e.extend(!0,{},n)}}if((r.numericInput||q)&&(a===t.keyCode.BACKSPACE?a=t.keyCode.DELETE:a===t.keyCode.DELETE&&(a=t.keyCode.BACKSPACE),q)){var l=n.end;n.end=n.begin,n.begin=l}a===t.keyCode.BACKSPACE&&(n.end-n.begin<1||r.insertMode===!1)?(n.begin=R(n.begin),void 0===p().validPositions[n.begin]||p().validPositions[n.begin].input!==r.groupSeparator&&p().validPositions[n.begin].input!==r.radixPoint||n.begin--):a===t.keyCode.DELETE&&n.begin===n.end&&(n.end=E(n.end,!0)?n.end+1:C(n.end)+1,void 0===p().validPositions[n.begin]||p().validPositions[n.begin].input!==r.groupSeparator&&p().validPositions[n.begin].input!==r.radixPoint||n.end++),m(n.begin,n.end,!1,o),o!==!0&&s();var u=f(n.begin,!0);u<n.begin?p().p=C(u):o!==!0&&(p().p=n.begin)}function B(t){function i(e){var i,a=document.createElement("span");for(var n in o)isNaN(n)&&n.indexOf("font")!==-1&&(a.style[n]=o[n]);a.style.textTransform=o.textTransform,a.style.letterSpacing=o.letterSpacing,a.style.position="absolute",a.style.height="auto",a.style.width="auto",a.style.visibility="hidden",a.style.whiteSpace="nowrap",document.body.appendChild(a);var r,s=t.inputmask._valueGet(),l=0;for(i=0,r=s.length;i<=r;i++){if(a.innerHTML+=s.charAt(i)||"_",a.offsetWidth>=e){var u=e-l,c=a.offsetWidth-e;a.innerHTML=s.charAt(i),u-=a.offsetWidth/3,i=u<c?i-1:i;break}l=a.offsetWidth}return document.body.removeChild(a),i}function a(){z.style.position="absolute",z.style.top=n.top+"px",z.style.left=n.left+"px",z.style.width=parseInt(t.offsetWidth)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth)+"px",z.style.height=parseInt(t.offsetHeight)-parseInt(o.paddingTop)-parseInt(o.paddingBottom)-parseInt(o.borderTopWidth)-parseInt(o.borderBottomWidth)+"px",z.style.lineHeight=z.style.height,z.style.zIndex=isNaN(o.zIndex)?-1:o.zIndex-1,z.style.webkitAppearance="textfield",z.style.mozAppearance="textfield",z.style.Appearance="textfield"}var n=e(t).position(),o=(t.ownerDocument.defaultView||window).getComputedStyle(t,null);t.parentNode,z=document.createElement("div"),document.body.appendChild(z);for(var s in o)isNaN(s)&&"cssText"!==s&&s.indexOf("webkit")==-1&&(z.style[s]=o[s]);t.style.backgroundColor="transparent",t.style.color="transparent",t.style.webkitAppearance="caret",t.style.mozAppearance="caret",t.style.Appearance="caret",a(),e(window).on("resize",function(i){n=e(t).position(),o=(t.ownerDocument.defaultView||window).getComputedStyle(t,null),a()}),e(t).on("click",function(e){return D(t,i(e.clientX)),ee.clickEvent.call(this,[e])}),e(t).on("keydown",function(e){e.shiftKey||r.insertMode===!1||setTimeout(function(){L(t)},0)})}function L(e,t,i){function a(){o||null!==l.fn&&void 0!==u.input?o&&null!==l.fn&&void 0!==u.input&&(o=!1,n+="</span>"):(o=!0,n+="<span class='im-static''>")}if(void 0!==z){t=t||b(),void 0===i?i=D(e):void 0===i.begin&&(i={begin:i,end:i});var n="",o=!1;if(""!=t){var s,l,u,c=0,d=f();do c===i.begin&&document.activeElement===e&&(n+="<span class='im-caret' style='border-right-width: 1px;border-right-style: solid;'></span>"),p().validPositions[c]?(u=p().validPositions[c],l=u.match,s=u.locator.slice(),a(),n+=u.input):(u=v(c,s,c-1),l=u.match,s=u.locator.slice(),(r.jitMasking===!1||c<d||"number"==typeof r.jitMasking&&isFinite(r.jitMasking)&&r.jitMasking>c)&&(a(),n+=_(c,l))),c++;while((void 0===V||c<V)&&(null!==l.fn||""!==l.def)||d>c)}z.innerHTML=n}}function H(t){function i(t,i){function a(t){function a(t){if(e.valHooks&&(void 0===e.valHooks[t]||e.valHooks[t].inputmaskpatch!==!0)){var a=e.valHooks[t]&&e.valHooks[t].get?e.valHooks[t].get:function(e){return e.value},n=e.valHooks[t]&&e.valHooks[t].set?e.valHooks[t].set:function(e,t){return e.value=t,e};e.valHooks[t]={get:function(e){if(e.inputmask){if(e.inputmask.opts.autoUnmask)return e.inputmask.unmaskedvalue();var t=a(e);return f(void 0,void 0,e.inputmask.maskset.validPositions)!==-1||i.nullable!==!0?t:""}return a(e)},set:function(t,i){var a,r=e(t);return a=n(t,i),t.inputmask&&r.trigger("setvalue"),a},inputmaskpatch:!0}}}function n(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():f()!==-1||i.nullable!==!0?document.activeElement===this&&i.clearMaskOnLostFocus?(q?N(b().slice()).reverse():N(b().slice())).join(""):s.call(this):"":s.call(this)}function r(t){l.call(this,t),this.inputmask&&e(this).trigger("setvalue")}function o(t){J.on(t,"mouseenter",function(t){var i=e(this),a=this,n=a.inputmask._valueGet();n!==b().join("")&&i.trigger("setvalue")})}var s,l;if(!t.inputmask.__valueGet){if(i.noValuePatching!==!0){if(Object.getOwnPropertyDescriptor){"function"!=typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"==typeof"test".__proto__?function(e){return e.__proto__}:function(e){return e.constructor.prototype});var u=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value"):void 0;u&&u.get&&u.set?(s=u.get,l=u.set,Object.defineProperty(t,"value",{get:n,set:r,configurable:!0})):"INPUT"!==t.tagName&&(s=function(){return this.textContent},l=function(e){this.textContent=e},Object.defineProperty(t,"value",{get:n,set:r,configurable:!0}))}else document.__lookupGetter__&&t.__lookupGetter__("value")&&(s=t.__lookupGetter__("value"),l=t.__lookupSetter__("value"),t.__defineGetter__("value",n),t.__defineSetter__("value",r));t.inputmask.__valueGet=s,t.inputmask.__valueSet=l}
vendor: 5,132 bytes, line 5107
5107t.inputmask._valueGet=function(e){return q&&e!==!0?s.call(this.el).split("").reverse().join(""):s.call(this.el)},t.inputmask._valueSet=function(e,t){l.call(this.el,null===e||void 0===e?"":t!==!0&&q?e.split("").reverse().join(""):e)},void 0===s&&(s=function(){return this.value},l=function(e){this.value=e},a(t.type),o(t))}}var n=t.getAttribute("type"),r="INPUT"===t.tagName&&e.inArray(n,i.supportsInputType)!==-1||t.isContentEditable||"TEXTAREA"===t.tagName;if(!r)if("INPUT"===t.tagName){var o=document.createElement("input");o.setAttribute("type",n),r="text"===o.type,o=null}else r="partial";return r!==!1&&a(t),r}var a=i(t,r);if(a!==!1&&(W=t,U=e(W),("rtl"===W.dir||r.rightAlign)&&(W.style.textAlign="right"),("rtl"===W.dir||r.numericInput)&&(W.dir="ltr",W.removeAttribute("dir"),W.inputmask.isRTL=!0,q=!0),r.colorMask===!0&&B(W),u&&(W.hasOwnProperty("inputmode")&&(W.inputmode=r.inputmode,W.setAttribute("inputmode",r.inputmode)),"rtfm"===r.androidHack&&(r.colorMask!==!0&&B(W),W.type="password")),J.off(W),a===!0&&(J.on(W,"submit",ee.submitEvent),J.on(W,"reset",ee.resetEvent),J.on(W,"mouseenter",ee.mouseenterEvent),J.on(W,"blur",ee.blurEvent),J.on(W,"focus",ee.focusEvent),J.on(W,"mouseleave",ee.mouseleaveEvent),r.colorMask!==!0&&J.on(W,"click",ee.clickEvent),J.on(W,"dblclick",ee.dblclickEvent),J.on(W,"paste",ee.pasteEvent),J.on(W,"dragdrop",ee.pasteEvent),J.on(W,"drop",ee.pasteEvent),J.on(W,"cut",ee.cutEvent),J.on(W,"complete",r.oncomplete),J.on(W,"incomplete",r.onincomplete),J.on(W,"cleared",r.oncleared),r.inputEventOnly!==!0&&(J.on(W,"keydown",ee.keydownEvent),J.on(W,"keypress",ee.keypressEvent)),J.on(W,"compositionstart",e.noop),J.on(W,"compositionupdate",e.noop),J.on(W,"compositionend",e.noop),J.on(W,"keyup",e.noop),J.on(W,"input",ee.inputFallBackEvent)),J.on(W,"setvalue",ee.setValueEvent),x(),""!==W.inputmask._valueGet()||r.clearMaskOnLostFocus===!1||document.activeElement===W)){var n=e.isFunction(r.onBeforeMask)?r.onBeforeMask(W.inputmask._valueGet(),r)||W.inputmask._valueGet():W.inputmask._valueGet();I(W,!0,!1,n.split(""));var o=b().slice();K=o.join(""),T(o)===!1&&r.clearIncomplete&&d(),r.clearMaskOnLostFocus&&document.activeElement!==W&&(f()===-1?o=[]:N(o)),O(W,o),document.activeElement===W&&D(W,C(f()))}}a=a||this.maskset,r=r||this.opts;var K,U,V,z,Q,W=this.el,q=this.isRTL,Z=!1,Y=!1,$=!1,X=!1,J={on:function(i,a,n){var o=function(i){if(void 0===this.inputmask&&"FORM"!==this.nodeName){var a=e.data(this,"_inputmask_opts");a?new t(a).mask(this):J.off(this)}else{if("setvalue"===i.type||!(this.disabled||this.readOnly&&!("keydown"===i.type&&i.ctrlKey&&67===i.keyCode||r.tabThrough===!1&&i.keyCode===t.keyCode.TAB))){switch(i.type){case"input":if(Y===!0)return Y=!1,i.preventDefault();break;case"keydown":Z=!1,Y=!1;break;case"keypress":if(Z===!0)return i.preventDefault();Z=!0;break;case"click":if(s||l){var o=this,u=arguments;return setTimeout(function(){n.apply(o,u)},0),!1}}var c=n.apply(this,arguments);return c===!1&&(i.preventDefault(),i.stopPropagation()),c}i.preventDefault()}};i.inputmask.events[a]=i.inputmask.events[a]||[],i.inputmask.events[a].push(o),e.inArray(a,["submit","reset"])!==-1?null!=i.form&&e(i.form).on(a,o):e(i).on(a,o)},off:function(t,i){if(t.inputmask&&t.inputmask.events){var a;i?(a=[],a[i]=t.inputmask.events[i]):a=t.inputmask.events,e.each(a,function(i,a){for(;a.length>0;){var n=a.pop();e.inArray(i,["submit","reset"])!==-1?null!=t.form&&e(t.form).off(i,n):e(t).off(i,n)}delete t.inputmask.events[i]})}}},ee={keydownEvent:function(i){function a(e){var t=document.createElement("input"),i="on"+e,a=i in t;return a||(t.setAttribute(i,"return;"),a="function"==typeof t[i]),t=null,a}var n=this,o=e(n),s=i.keyCode,u=D(n);if(s===t.keyCode.BACKSPACE||s===t.keyCode.DELETE||l&&s===t.keyCode.BACKSPACE_SAFARI||i.ctrlKey&&s===t.keyCode.X&&!a("cut"))i.preventDefault(),G(n,s,u),O(n,b(!0),p().p,i,n.inputmask._valueGet()!==b().join("")),n.inputmask._valueGet()===x().join("")?o.trigger("cleared"):T(b())===!0&&o.trigger("complete");else if(s===t.keyCode.END||s===t.keyCode.PAGE_DOWN){i.preventDefault();var c=C(f());r.insertMode||c!==p().maskLength||i.shiftKey||c--,D(n,i.shiftKey?u.begin:c,c,!0)}else s===t.keyCode.HOME&&!i.shiftKey||s===t.keyCode.PAGE_UP?(i.preventDefault(),D(n,0,i.shiftKey?u.begin:0,!0)):(r.undoOnEscape&&s===t.keyCode.ESCAPE||90===s&&i.ctrlKey)&&i.altKey!==!0?(I(n,!0,!1,K.split("")),o.trigger("click")):s!==t.keyCode.INSERT||i.shiftKey||i.ctrlKey?r.tabThrough===!0&&s===t.keyCode.TAB?(i.shiftKey===!0?(null===g(u.begin).match.fn&&(u.begin=C(u.begin)),u.end=R(u.begin,!0),u.begin=R(u.end,!0)):(u.begin=C(u.begin,!0),u.end=C(u.begin,!0),u.end<p().maskLength&&u.end--),u.begin<p().maskLength&&(i.preventDefault(),D(n,u.begin,u.end))):i.shiftKey||r.insertMode===!1&&(s===t.keyCode.RIGHT?setTimeout(function(){var e=D(n);D(n,e.begin)},0):s===t.keyCode.LEFT&&setTimeout(function(){var e=D(n);D(n,q?e.begin+1:e.begin-1)},0)):(r.insertMode=!r.insertMode,D(n,r.insertMode||u.begin!==p().maskLength?u.begin:u.begin-1));r.onKeyDown.call(this,i,b(),D(n).begin,r),$=e.inArray(s,r.ignorables)!==-1},keypressEvent:function(i,a,n,o,s){var l=this,u=e(l),c=i.which||i.charCo
vendor: 10,864 bytes, lines 5107-5108
5107de||i.keyCode;if(!(a===!0||i.ctrlKey&&i.altKey)&&(i.ctrlKey||i.metaKey||$))return c===t.keyCode.ENTER&&K!==b().join("")&&(K=b().join(""), 5108setTimeout(function(){u.trigger("change")},0)),!0;if(c){46===c&&i.shiftKey===!1&&","===r.radixPoint&&(c=44);var f,m=a?{begin:s,end:s}:D(l),h=String.fromCharCode(c);p().writeOutBuffer=!0;var v=A(m,h,o);if(v!==!1&&(d(!0),f=void 0!==v.caret?v.caret:a?v.pos+1:C(v.pos),p().p=f),n!==!1){var g=this;if(setTimeout(function(){r.onKeyValidation.call(g,c,v,r)},0),p().writeOutBuffer&&v!==!1){var y=b();O(l,y,r.numericInput&&void 0===v.caret?R(f):f,i,a!==!0),a!==!0&&setTimeout(function(){T(y)===!0&&u.trigger("complete")},0)}}if(i.preventDefault(),a)return v.forwardPosition=f,v}},pasteEvent:function(t){var i,a=this,n=t.originalEvent||t,o=e(a),s=a.inputmask._valueGet(!0),l=D(a);q&&(i=l.end,l.end=l.begin,l.begin=i);var u=s.substr(0,l.begin),c=s.substr(l.end,s.length);if(u===(q?x().reverse():x()).slice(0,l.begin).join("")&&(u=""),c===(q?x().reverse():x()).slice(l.end).join("")&&(c=""),q&&(i=u,u=c,c=i),window.clipboardData&&window.clipboardData.getData)s=u+window.clipboardData.getData("Text")+c;else{if(!n.clipboardData||!n.clipboardData.getData)return!0;s=u+n.clipboardData.getData("text/plain")+c}var p=s;if(e.isFunction(r.onBeforePaste)){if(p=r.onBeforePaste(s,r),p===!1)return t.preventDefault();p||(p=s)}return I(a,!1,!1,q?p.split("").reverse():p.toString().split("")),O(a,b(),C(f()),t,K!==b().join("")),T(b())===!0&&o.trigger("complete"),t.preventDefault()},inputFallBackEvent:function(i){var a=this,n=a.inputmask._valueGet();if(b().join("")!==n){var r=D(a);if(n=n.replace(new RegExp("("+t.escapeRegex(x().join(""))+")*"),""),s){var o=n.replace(b().join(""),"");if(1===o.length){var l=new e.Event("keypress");return l.which=o.charCodeAt(0),ee.keypressEvent.call(a,l,!0,!0,!1,p().validPositions[r.begin-1]?r.begin:r.begin-1),!1}}if(r.begin>n.length&&(D(a,n.length),r=D(a)),b().length-n.length!==1||n.charAt(r.begin)===b()[r.begin]||n.charAt(r.begin+1)===b()[r.begin]||E(r.begin)){for(var u=f()+1,c=x().join("");null===n.match(t.escapeRegex(c)+"$");)c=c.slice(1);n=n.replace(c,""),n=n.split(""),I(a,!0,!1,n,i,r.begin<u),T(b())===!0&&e(a).trigger("complete")}else i.keyCode=t.keyCode.BACKSPACE,ee.keydownEvent.call(a,i);i.preventDefault()}},setValueEvent:function(t){var i=this,a=i.inputmask._valueGet();I(i,!0,!1,(e.isFunction(r.onBeforeMask)?r.onBeforeMask(a,r)||a:a).split("")),K=b().join(""),(r.clearMaskOnLostFocus||r.clearIncomplete)&&i.inputmask._valueGet()===x().join("")&&i.inputmask._valueSet("")},focusEvent:function(e){var t=this,i=t.inputmask._valueGet();r.showMaskOnFocus&&(!r.showMaskOnHover||r.showMaskOnHover&&""===i)&&(t.inputmask._valueGet()!==b().join("")?O(t,b(),C(f())):X===!1&&D(t,C(f()))),r.positionCaretOnTab===!0&&ee.clickEvent.apply(t,[e,!0]),K=b().join("")},mouseleaveEvent:function(e){var t=this;if(X=!1,r.clearMaskOnLostFocus&&document.activeElement!==t){var i=b().slice(),a=t.inputmask._valueGet();a!==t.getAttribute("placeholder")&&""!==a&&(f()===-1&&a===x().join("")?i=[]:N(i),O(t,i))}},clickEvent:function(t,i){function a(t){if(""!==r.radixPoint){var i=p().validPositions;if(void 0===i[t]||i[t].input===_(t)){if(t<C(-1))return!0;var a=e.inArray(r.radixPoint,b());if(a!==-1){for(var n in i)if(a<n&&i[n].input!==_(n))return!1;return!0}}}return!1}var n=this;setTimeout(function(){if(document.activeElement===n){var t=D(n);if(i&&(t.begin=t.end),t.begin===t.end)switch(r.positionCaretOnClick){case"none":break;case"radixFocus":if(a(t.begin)){var o=e.inArray(r.radixPoint,b().join(""));D(n,r.numericInput?C(o):o);break}default:var s=t.begin,l=f(s,!0),u=C(l);if(s<u)D(n,E(s)||E(s-1)?s:C(s));else{var c=_(u);(""!==c&&b()[u]!==c&&g(u).match.optionalQuantifier!==!0||!E(u)&&g(u).match.def===c)&&(u=C(u)),D(n,u)}}}},0)},dblclickEvent:function(e){var t=this;setTimeout(function(){D(t,0,C(f()))},0)},cutEvent:function(i){var a=this,n=e(a),r=D(a),o=i.originalEvent||i,s=window.clipboardData||o.clipboardData,l=q?b().slice(r.end,r.begin):b().slice(r.begin,r.end);s.setData("text",q?l.reverse().join(""):l.join("")),document.execCommand&&document.execCommand("copy"),G(a,t.keyCode.DELETE,r),O(a,b(),p().p,i,K!==b().join("")),a.inputmask._valueGet()===x().join("")&&n.trigger("cleared")},blurEvent:function(t){var i=e(this),a=this;if(a.inputmask){var n=a.inputmask._valueGet(),o=b().slice();K!==o.join("")&&setTimeout(function(){i.trigger("change"),K=o.join("")},0),""!==n&&(r.clearMaskOnLostFocus&&(f()===-1&&n===x().join("")?o=[]:N(o)),T(o)===!1&&(setTimeout(function(){i.trigger("incomplete")},0),r.clearIncomplete&&(d(),o=r.clearMaskOnLostFocus?[]:x().slice())),O(a,o,void 0,t))}},mouseenterEvent:function(e){var t=this;X=!0,document.activeElement!==t&&r.showMaskOnHover&&t.inputmask._valueGet()!==b().join("")&&O(t,b())},submitEvent:function(e){K!==b().join("")&&U.trigger("change"),r.clearMaskOnLostFocus&&f()===-1&&W.inputmask._valueGet&&W.inputmask._valueGet()===x().join("")&&W.inputmask._valueSet(""),r.removeMaskOnSubmit&&(W.inputmask._valueSet(W.inputmask.unmaskedvalue(),!0),setTimeout(function(){O(W,b())},0))},resetEvent:function(e){setTimeout(function(){U.trigger("setvalue")},0)}};if(void 0!==i)switch(i.action){case"isComplete":return W=i.el,T(b());case"unmaskedvalue":return void 0!==W&&void 0===i.value||(Q=i.value,Q=(e.isFunction(r.onBeforeMask)?r.onBeforeMask(Q,r)||Q:Q).split(""),I(void 0,!1,!1,q?Q.reverse():Q),e.isFunction(r.onBeforeWrite)&&r.onBeforeWrite(void 0,b(),0,r)),j(W);case"mask":H(W);break;case"format":return Q=(e.isFunction(r.onBeforeMask)?r.onBeforeMask(i.value,r)||i.value:i.value).split(""),I(void 0,!1,!1,q?Q.reverse():Q),e.isFunction(r.onBeforeWrite)&&r.onBeforeWrite(void 0,b(),0,r),i.metadata?{value:q?b().slice().reverse().join(""):b().join(""),metadata:n.call(this,{action:"getmetadata"},a,r)}:q?b().slice().reverse().join(""):b().join("");case"isValid":i.value?(Q=i.value.split(""),I(void 0,!1,!0,q?Q.reverse():Q)):i.value=b().join("");for(var te=b(),ie=F(),ae=te.length-1;ae>ie&&!E(ae);ae--);return te.splice(ie,ae+1-ie),T(te)&&i.value===b().join("");case"getemptymask":return x().join("");case"remove":if(W){U=e(W),W.inputmask._valueSet(j(W)),J.off(W);var ne;Object.getOwnPropertyDescriptor&&Object.getPrototypeOf?(ne=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(W),"value"),ne&&W.inputmask.__valueGet&&Object.defineProperty(W,"value",{get:W.inputmask.__valueGet,set:W.inputmask.__valueSet,configurable:!0})):document.__lookupGetter__&&W.__lookupGetter__("value")&&W.inputmask.__valueGet&&(W.__defineGetter__("value",W.inputmask.__valueGet),W.__defineSetter__("value",W.inputmask.__valueSet)),W.inputmask=void 0}return W;case"getmetadata":if(e.isArray(a.metadata)){var re=c(!0,0,!1).join("");return e.each(a.metadata,function(e,t){if(t.mask===re)return re=t,!1}),re}return a.metadata}}var r=navigator.userAgent,o=/mobile/i.test(r),s=/iemobile/i.test(r),l=/iphone/i.test(r)&&!s,u=/android/i.test(r)&&!s;return t.prototype={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyDown:e.noop,onBeforeMask:null,onBeforePaste:function(t,i){return e.isFunction(i.onBeforeMask)?i.onBeforeMask(t,i):t},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixPointDefinitionSymbol:void 0,groupSeparator:"",keepStatic:null,positionCaretOnTab:!0,tabThrough:!1,supportsInputType:["text","tel","password"],definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-zÐ-ÑÐÑÃ-ÿµ]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-zÐ-ÑÐÑÃ-ÿµ]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:null,canClearPosition:e.noop,postValidation:null,staticDefinitionSymbol:void 0,jitMasking:!1,nullable:!0,inputEventOnly:!1,noValuePatching:!1,positionCaretOnClick:"lvp",casing:null,inputmode:"verbatim",colorMask:!1,androidHack:!1},masksCache:{},mask:function(r){function o(t,a,n,r){function o(e,i){i=void 0!==i?i:t.getAttribute(r+"-"+e),null!==i&&("string"==typeof i&&(0===e.indexOf("on")?i=window[i]:"false"===i?i=!1:"true"===i&&(i=!0)),n[e]=i)}var s,l,u,c,p=t.getAttribute(r);if(p&&""!==p&&(p=p.replace(new RegExp("'","g"),'"'),l=JSON.parse("{"+p+"}")),l){u=void 0;for(c in l)if("alias"===c.toLowerCase()){u=l[c];break}}o("alias",u),n.alias&&i(n.alias,n,a);for(s in a){if(l){u=void 0;for(c in l)if(c.toLowerCase()===s.toLowerCase()){u=l[c];break}}o(s,u)}return e.extend(!0,a,n),a}var s=this;return"string"==typeof r&&(r=document.getElementById(r)||document.querySelectorAll(r)),r=r.nodeName?[r]:r,e.each(r,function(i,r){var l=e.extend(!0,{},s.opts);o(r,l,e.extend(!0,{},s.userOptions),s.dataAttribute);var u=a(l,s.noMasksCache);void 0!==u&&(void 0!==r.inputmask&&r.inputmask.remove(),r.inputmask=new t,r.inputmask.opts=l,r.inputmask.noMasksCache=s.noMasksCache,r.inputmask.userOptions=e.extend(!0,{},s.userOptions),r.inputmask.el=r,r.inputmask.maskset=u,e.data(r,"_inputmask_opts",l),n.call(r.inputmask,{action:"mask"}))}),r&&r[0]?r[0].inputmask||this:this},option:function(t,i){return"string"==typeof t?this.opts[t]:"object"==typeof t?(e.extend(this.userOptions,t),this.el&&i!==!0&&this.mask(this.el),this):void 0},unmaskedvalue:function(e){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"unmaskedvalue",value:e})},remove:function(){return n.call(this,{action:"remove"})},getemptymask:function(){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"getemptymask"})},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"isComplete"})},getmetadata:function(){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"getmetadata"})},isValid:function(e){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"isValid",value:e})},format:function(e,t){return this.maskset=this.maskset||a(this.opts,this.noMasksCache),n.call(this,{action:"format",value:e,metadata:t})},analyseMask:function(t,i){function a(e,t,i,a){this.matches=[],this.openGroup=e||!1,this.isGroup=e||!1,this.isOptional=t||!1,this.isQuantifier=i||!1,this.isAlternator=a||!1,this.quantifier={min:1,max:1}}function n(t,a,n){var r=i.definitions[a];n=void 0!==n?n:t.matches.length;var o=t.matches[n-1];if(r&&!v){r.placeholder=e.isFunction(r.placeholder)?r.placeholder(i):r.placeholder;
5108for(var s=r.prevalidator,l=s?s.length:0,u=1;u<r.cardinality;u++){var c=l>=u?s[u-1]:[],p=c.validator,d=c.cardinality;t.matches.splice(n++,0,{fn:p?"string"==typeof p?new RegExp(p):new function(){this.test=p}:new RegExp("."),cardinality:d?d:1,optionality:t.isOptional,newBlockMarker:void 0===o||o.def!==(r.definitionSymbol||a),casing:r.casing,def:r.definitionSymbol||a,placeholder:r.placeholder,nativeDef:a}),o=t.matches[n-1]}t.matches.splice(n++,0,{fn:r.validator?"string"==typeof r.validator?new RegExp(r.validator):new function(){this.test=r.validator}:new RegExp("."),cardinality:r.cardinality,optionality:t.isOptional,newBlockMarker:void 0===o||o.def!==(r.definitionSymbol||a),casing:r.casing,def:r.definitionSymbol||a,placeholder:r.placeholder,nativeDef:a})}else t.matches.splice(n++,0,{fn:null,cardinality:0,optionality:t.isOptional,newBlockMarker:void 0===o||o.def!==a,casing:null,def:i.staticDefinitionSymbol||a,placeholder:void 0!==i.staticDefinitionSymbol?a:void 0,nativeDef:a}),v=!1}function r(t){t&&t.matches&&e.each(t.matches,function(e,a){var o=t.matches[e+1];(void 0===o||void 0===o.matches||o.isQuantifier===!1)&&a&&a.isGroup&&(a.isGroup=!1,n(a,i.groupmarker.start,0),a.openGroup!==!0&&n(a,i.groupmarker.end)),r(a)})}function o(){if(y.length>0){if(p=y[y.length-1],n(p,u),p.isAlternator){d=y.pop();for(var e=0;e<d.matches.length;e++)d.matches[e].isGroup=!1;y.length>0?(p=y[y.length-1],p.matches.push(d)):g.matches.push(d)}}else n(g,u)}function s(e){function t(e){return e===i.optionalmarker.start?e=i.optionalmarker.end:e===i.optionalmarker.end?e=i.optionalmarker.start:e===i.groupmarker.start?e=i.groupmarker.end:e===i.groupmarker.end&&(e=i.groupmarker.start),e}e.matches=e.matches.reverse();for(var a in e.matches){var n=parseInt(a);if(e.matches[a].isQuantifier&&e.matches[n+1]&&e.matches[n+1].isGroup){var r=e.matches[a];e.matches.splice(a,1),e.matches.splice(n+1,0,r)}void 0!==e.matches[a].matches?e.matches[a]=s(e.matches[a]):e.matches[a]=t(e.matches[a])}return e}for(var l,u,c,p,d,f,m,h=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,v=!1,g=new a,y=[],k=[];l=h.exec(t);)if(u=l[0],v)o();else switch(u.charAt(0)){case i.escapeChar:v=!0;break;case i.optionalmarker.end:case i.groupmarker.end:if(c=y.pop(),c.openGroup=!1,void 0!==c)if(y.length>0){if(p=y[y.length-1],p.matches.push(c),p.isAlternator){d=y.pop();for(var x=0;x<d.matches.length;x++)d.matches[x].isGroup=!1;y.length>0?(p=y[y.length-1],p.matches.push(d)):g.matches.push(d)}}else g.matches.push(c);else o();break;case i.optionalmarker.start:y.push(new a(!1,!0));break;case i.groupmarker.start:y.push(new a(!0));break;case i.quantifiermarker.start:var b=new a(!1,!1,!0);u=u.replace(/[{}]/g,"");var P=u.split(","),w=isNaN(P[0])?P[0]:parseInt(P[0]),S=1===P.length?w:isNaN(P[1])?P[1]:parseInt(P[1]);if("*"!==S&&"+"!==S||(w="*"===S?0:1),b.quantifier={min:w,max:S},y.length>0){var A=y[y.length-1].matches;l=A.pop(),l.isGroup||(m=new a(!0),m.matches.push(l),l=m),A.push(l),A.push(b)}else l=g.matches.pop(),l.isGroup||(m=new a(!0),m.matches.push(l),l=m),g.matches.push(l),g.matches.push(b);break;case i.alternatormarker:y.length>0?(p=y[y.length-1],f=p.matches.pop()):f=g.matches.pop(),f.isAlternator?y.push(f):(d=new a(!1,!1,!1,!0),d.matches.push(f),y.push(d));break;default:o()}for(;y.length>0;)c=y.pop(),g.matches.push(c);return g.matches.length>0&&(r(g),k.push(g)),i.numericInput&&s(k[0]),k}},t.extendDefaults=function(i){e.extend(!0,t.prototype.defaults,i)},t.extendDefinitions=function(i){e.extend(!0,t.prototype.defaults.definitions,i)},t.extendAliases=function(i){e.extend(!0,t.prototype.defaults.aliases,i)},t.format=function(e,i,a){return t(i).format(e,a)},t.unmask=function(e,i){return t(i).unmaskedvalue(e)},t.isValid=function(e,i){return t(i).isValid(e)},t.remove=function(t){e.each(t,function(e,t){t.inputmask&&t.inputmask.remove()})},t.escapeRegex=function(e){var t=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];return e.replace(new RegExp("(\\"+t.join("|\\")+")","gim"),"\\$1")},t.keyCode={ALT:18,BACKSPACE:8,BACKSPACE_SAFARI:127,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91,X:88},window.Inputmask=t,t}(jQuery),function(e,t){return void 0===e.fn.inputmask&&(e.fn.inputmask=function(i,a){var n,r=this[0];if(void 0===a&&(a={}),"string"==typeof i)switch(i){case"unmaskedvalue":return r&&r.inputmask?r.inputmask.unmaskedvalue():e(r).val();case"remove":return this.each(function(){this.inputmask&&this.inputmask.remove()});case"getemptymask":return r&&r.inputmask?r.inputmask.getemptymask():"";case"hasMaskedValue":return!(!r||!r.inputmask)&&r.inputmask.hasMaskedValue();case"isComplete":return!r||!r.inputmask||r.inputmask.isComplete();case"getmetadata":return r&&r.inputmask?r.inputmask.getmetadata():void 0;case"setvalue":e(r).val(a),r&&void 0===r.inputmask&&e(r).triggerHandler("setvalue");break;case"option":if("string"!=typeof a)return this.each(function(){if(void 0!==this.inputmask)return this.inputmask.option(a)});if(r&&void 0!==r.inputmask)return r.inputmask.option(a);break;default:return a.alias=i,n=new t(a),this.each(function(){n.mask(this)})}else{if("object"==typeof i)return n=new t(i),void 0===i.mask&&void 0===i.alias?this.each(function(){return void 0!==this.inputmask?this.inputmask.option(i):void n.mask(this)}):this.each(function(){n.mask(this)});if(void 0===i)return this.each(function(){n=new t(a),n.mask(this)})}}),e.fn.inputmask}(jQuery,Inputmask),function(e,t){}(jQuery,Inputmask),function(e,t){function i(e){return isNaN(e)||29===new Date(e,2,0).getDate()}return t.extendAliases({"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[
51081-9]|[12][0-9]|3[01]"),val2pre:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+i+"[01])")},val2:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9])"+i+"(0[1-9]|1[012]))|(30"+i+"(0[13-9]|1[012]))|(31"+i+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(e,t,i){if(isNaN(e))return!1;var a=parseInt(e.concat(t.toString().slice(e.length))),n=parseInt(e.concat(i.toString().slice(e.length)));return!isNaN(a)&&t<=a&&a<=i||!isNaN(n)&&t<=n&&n<=i},determinebaseyear:function(e,t,i){var a=(new Date).getFullYear();if(e>a)return e;if(t<a){for(var n=t.toString().slice(0,2),r=t.toString().slice(2,4);t<n+i;)n--;var o=n+r;return e>o?e:o}if(e<=a&&a<=t){for(var s=a.toString().slice(0,2);t<s+i;)s--;var l=s+i;return l<e?e:l}return a},onKeyDown:function(i,a,n,r){var o=e(this);if(i.ctrlKey&&i.keyCode===t.keyCode.RIGHT){var s=new Date;o.val(s.getDate().toString()+(s.getMonth()+1).toString()+s.getFullYear().toString()),o.trigger("setvalue")}},getFrontValue:function(e,t,i){for(var a=0,n=0,r=0;r<e.length&&"2"!==e.charAt(r);r++){var o=i.definitions[e.charAt(r)];o?(a+=n,n=o.cardinality):n++}return t.join("").substr(a,n)},postValidation:function(e,t,a){var n,r,o=e.join("");return 0===a.mask.indexOf("y")?(r=o.substr(0,4),n=o.substr(4,11)):(r=o.substr(6,11),n=o.substr(0,6)),t&&(n!==a.leapday||i(r))},definitions:{1:{validator:function(e,t,i,a,n){var r=n.regex.val1.test(e);return a||r||e.charAt(1)!==n.separator&&"-./".indexOf(e.charAt(1))===-1||!(r=n.regex.val1.test("0"+e.charAt(0)))?r:(t.buffer[i-1]="0",{refreshFromBuffer:{start:i-1,end:i},pos:i,c:e.charAt(0)})},cardinality:2,prevalidator:[{validator:function(e,t,i,a,n){var r=e;isNaN(t.buffer[i+1])||(r+=t.buffer[i+1]);var o=1===r.length?n.regex.val1pre.test(r):n.regex.val1.test(r);if(!a&&!o){if(o=n.regex.val1.test(e+"0"))return t.buffer[i]=e,t.buffer[++i]="0",{pos:i,c:"0"};if(o=n.regex.val1.test("0"+e))return t.buffer[i]="0",i++,{pos:i}}return o},cardinality:1}]},2:{validator:function(e,t,i,a,n){var r=n.getFrontValue(t.mask,t.buffer,n);r.indexOf(n.placeholder[0])!==-1&&(r="01"+n.separator);var o=n.regex.val2(n.separator).test(r+e);return a||o||e.charAt(1)!==n.separator&&"-./".indexOf(e.charAt(1))===-1||!(o=n.regex.val2(n.separator).test(r+"0"+e.charAt(0)))?o:(t.buffer[i-1]="0",{refreshFromBuffer:{start:i-1,end:i},pos:i,c:e.charAt(0)})},cardinality:2,prevalidator:[{validator:function(e,t,i,a,n){isNaN(t.buffer[i+1])||(e+=t.buffer[i+1]);var r=n.getFrontValue(t.mask,t.buffer,n);r.indexOf(n.placeholder[0])!==-1&&(r="01"+n.separator);var o=1===e.length?n.regex.val2pre(n.separator).test(r+e):n.regex.val2(n.separator).test(r+e);return a||o||!(o=n.regex.val2(n.separator).test(r+"0"+e))?o:(t.buffer[i]="0",i++,{pos:i})},cardinality:1}]},y:{validator:function(e,t,i,a,n){return n.isInYearRange(e,n.yearrange.minyear,n.yearrange.maxyear)},cardinality:4,prevalidator:[{validator:function(e,t,i,a,n){var r=n.isInYearRange(e,n.yearrange.minyear,n.yearrange.maxyear);if(!a&&!r){var o=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,e+"0").toString().slice(0,1);if(r=n.isInYearRange(o+e,n.yearrange.minyear,n.yearrange.maxyear))return t.buffer[i++]=o.charAt(0),{pos:i};if(o=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,e+"0").toString().slice(0,2),r=n.isInYearRange(o+e,n.yearrange.minyear,n.yearrange.maxyear))return t.buffer[i++]=o.charAt(0),t.buffer[i++]=o.charAt(1),{pos:i}}return r},cardinality:1},{validator:function(e,t,i,a,n){var r=n.isInYearRange(e,n.yearrange.minyear,n.yearrange.maxyear);if(!a&&!r){var o=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,e).toString().slice(0,2);if(r=n.isInYearRange(e[0]+o[1]+e[1],n.yearrange.minyear,n.yearrange.maxyear))return t.buffer[i++]=o.charAt(1),{pos:i};if(o=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,e).toString().slice(0,2),r=n.isInYearRange(o+e,n.yearrange.minyear,n.yearrange.maxyear))return t.buffer[i-1]=o.charAt(0),t.buffer[i++]=o.charAt(1),t.buffer[i++]=e.charAt(0),{refreshFromBuffer:{start:i-3,end:i},pos:i}}return r},cardinality:2},{validator:function(e,t,i,a,n){return n.isInYearRange(e,n.yearrange.minyear,n.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[13-9]|1[012])"+i+"[0-3])|(02"+i+"[0-2])")},val2:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+i+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+i+"30)|((0[13578]|1[02])"+i+"31)")}
vendor: 4,298 bytes, line 5108
5108,val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(i,a,n,r){var o=e(this);if(i.ctrlKey&&i.keyCode===t.keyCode.RIGHT){var s=new Date;o.val((s.getMonth()+1).toString()+s.getDate().toString()+s.getFullYear().toString()),o.trigger("setvalue")}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyDown:function(i,a,n,r){var o=e(this);if(i.ctrlKey&&i.keyCode===t.keyCode.RIGHT){var s=new Date;o.val(s.getFullYear().toString()+(s.getMonth()+1).toString()+s.getDate().toString()),o.trigger("setvalue")}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(e,t,i,a,n){if("24"===n.hourFormat&&24===parseInt(e,10))return t.buffer[i-1]="0",t.buffer[i]="0",{refreshFromBuffer:{start:i-1,end:i},c:"0"};var r=n.regex.hrs.test(e);if(!a&&!r&&(e.charAt(1)===n.timeseparator||"-.:".indexOf(e.charAt(1))!==-1)&&(r=n.regex.hrs.test("0"+e.charAt(0))))return t.buffer[i-1]="0",t.buffer[i]=e.charAt(0),i++,{refreshFromBuffer:{start:i-2,end:i},pos:i,c:n.timeseparator};if(r&&"24"!==n.hourFormat&&n.regex.hrs24.test(e)){var o=parseInt(e,10);return 24===o?(t.buffer[i+5]="a",t.buffer[i+6]="m"):(t.buffer[i+5]="p",t.buffer[i+6]="m"),o-=12,o<10?(t.buffer[i]=o.toString(),t.buffer[i-1]="0"):(t.buffer[i]=o.toString().charAt(1),t.buffer[i-1]=o.toString().charAt(0)),{refreshFromBuffer:{start:i-1,end:i+6},c:t.buffer[i]}}return r},cardinality:2,prevalidator:[{validator:function(e,t,i,a,n){var r=n.regex.hrspre.test(e);return a||r||!(r=n.regex.hrs.test("0"+e))?r:(t.buffer[i]="0",i++,{pos:i})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(e,t,i,a,n){var r=n.regex.mspre.test(e);return a||r||!(r=n.regex.ms.test("0"+e))?r:(t.buffer[i]="0",i++,{pos:i})},cardinality:1}]},t:{validator:function(e,t,i,a,n){return n.regex.ampm.test(e+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"mm/dd/yyyy hh:mm xm":{mask:"1/2/y h:s t\\m",placeholder:"mm/dd/yyyy hh:mm xm",alias:"datetime12",regex:{val2pre:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[13-9]|1[012])"+i+"[0-3])|(02"+i+"[0-2])")},val2:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+i+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+i+"30)|((0[13578]|1[02])"+i+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(i,a,n,r){var o=e(this);if(i.ctrlKey&&i.keyCode===t.keyCode.RIGHT){var s=new Date;o.val((s.getMonth()+1).toString()+s.getDate().toString()+s.getFullYear().toString()),o.trigger("setvalue")}}},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"},shamsi:{regex:{val2pre:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+i+"[0-3])")},val2:function(e){var i=t.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+i+"(0[1-9]|[12][0-9]))|((0[1-9]|1[012])"+i+"30)|((0[1-6])"+i+"31)")}
vendor: 4,918 bytes, line 5108
5108,val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},yearrange:{minyear:1300,maxyear:1499},mask:"y/1/2",leapday:"/12/30",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",clearIncomplete:!0}}),t}(jQuery,Inputmask),function(e,t){return t.extendDefinitions({A:{validator:"[A-Za-zÐ-ÑÐÑÃ-ÿµ]",cardinality:1,casing:"upper"},"&":{validator:"[0-9A-Za-zÐ-ÑÐÑÃ-ÿµ]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Fa-f]",cardinality:1,casing:"upper"}}),t.extendAliases({url:{definitions:{i:{validator:".",cardinality:1}},mask:"(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",insertMode:!1,autoUnmask:!1,inputmode:"url"},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(e,t,i,a,n){return i-1>-1&&"."!==t.buffer[i-1]?(e=t.buffer[i-1]+e,e=i-2>-1&&"."!==t.buffer[i-2]?t.buffer[i-2]+e:"0"+e):e="00"+e,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(e)},cardinality:1}},onUnMask:function(e,t,i){return e},inputmode:"numeric"},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",greedy:!1,onBeforePaste:function(e,t){return e=e.toLowerCase(),e.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"},"-":{validator:"[0-9A-Za-z-]",cardinality:1,casing:"lower"}},onUnMask:function(e,t,i){return e},inputmode:"email"},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{13}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",cardinality:1,casing:"upper"}},clearIncomplete:!0,autoUnmask:!0}}),t}(jQuery,Inputmask),function(e,t){return t.extendAliases({numeric:{mask:function(e){function i(t){for(var i="",a=0;a<t.length;a++)i+=e.definitions[t.charAt(a)]||e.optionalmarker.start===t.charAt(a)||e.optionalmarker.end===t.charAt(a)||e.quantifiermarker.start===t.charAt(a)||e.quantifiermarker.end===t.charAt(a)||e.groupmarker.start===t.charAt(a)||e.groupmarker.end===t.charAt(a)||e.alternatormarker===t.charAt(a)?"\\"+t.charAt(a):t.charAt(a);return i}if(0!==e.repeat&&isNaN(e.integerDigits)&&(e.integerDigits=e.repeat),e.repeat=0,e.groupSeparator===e.radixPoint&&("."===e.radixPoint?e.groupSeparator=",":","===e.radixPoint?e.groupSeparator=".":e.groupSeparator="")," "===e.groupSeparator&&(e.skipOptionalPartCharacter=void 0),e.autoGroup=e.autoGroup&&""!==e.groupSeparator,e.autoGroup&&("string"==typeof e.groupSize&&isFinite(e.groupSize)&&(e.groupSize=parseInt(e.groupSize)),isFinite(e.integerDigits))){var a=Math.floor(e.integerDigits/e.groupSize),n=e.integerDigits%e.groupSize;e.integerDigits=parseInt(e.integerDigits)+(0===n?a-1:a),e.integerDigits<1&&(e.integerDigits="*")}e.placeholder.length>1&&(e.placeholder=e.placeholder.charAt(0)),"radixFocus"===e.positionCaretOnClick&&""===e.placeholder&&e.integerOptional===!1&&(e.positionCaretOnClick="lvp"),e.definitions[";"]=e.definitions["~"],e.definitions[";"].definitionSymbol="~",e.numericInput===!0&&(e.positionCaretOnClick="radixFocus"===e.positionCaretOnClick?"lvp":e.positionCaretOnClick,e.digitsOptional=!1,isNaN(e.digits)&&(e.digits=2),e.decimalProtect=!1);var r="[+]";if(r+=i(e.prefix),r+=e.integerOptional===!0?"~{1,"+e.integerDigits+"}":"~{"+e.integerDigits+"}",void 0!==e.digits){e.decimalProtect&&(e.radixPointDefinitionSymbol=":");var o=e.digits.toString().split(",");isFinite(o[0]&&o[1]&&isFinite(o[1]))?r+=(e.decimalProtect?":":e.radixPoint)+";{"+e.digits+"}":(isNaN(e.digits)||parseInt(e.digits)>0)&&(r+=e.digitsOptional?"["+(e.decimalProtect?":":e.radixPoint)+";{1,"+e.digits+"}]":(e.decimalProtect?":":e.radixPoint)+";{"+e.digits+"}")}return r+=i(e.suffix),r+="[-]",e.greedy=!1,null!==e.min&&(e.min=e.min.toString().replace(new RegExp(t.escapeRegex(e.groupSeparator),"g"),""),","===e.radixPoint&&(e.min=e.min.replace(e.radixPoint,"."))),null!==e.max&&(e.max=e.max.toString().replace(new RegExp(t.escapeRegex(e.groupSeparator),"g"),""),","===e.radixPoint&&(e.max=e.max.replace(e.radixPoint,"."))),r},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,radixPoint:".",positionCaretOnClick:"radixFocus",groupSize:3,groupSeparator:"",autoGroup:!1,allowPlus:!0,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",integerOptional:!0,prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:null,max:null,step:1,insertMode:!0,autoUnmask:!1,unmaskAsNumber:!1,inputmode:"numeric",postFormat:function(i,a,n){n.numericInput===!0&&(i=i.reverse(),isFinite(a)&&(a=i.join("").length-a-1));var r,o;a=a>=i.length?i.length-1:a<0?0:a;var s=i[a],l=i.slice();s===n.groupSeparator&&(l.splice(a--,1),s=l[a]);var u=l.join("").match(new RegExp("^"+t.escapeRegex(n.negationSymbol.front)));u=null!==u&&1===u.length,a>(u?n.negationSymbol.front.length:0)+n.prefix.length&&a<l.length-n.suffix.length&&(l[a]="!");var c=l.join(""),p=l.join();if(u&&(c=c.replace(new RegExp("^"+t.escapeRegex(n.negationSymbol.front)),""),c=c.replace(new RegExp(t.escapeRegex(n.negationSymbol.back)+"$"),"")),c=c.replace(new RegExp(t.escapeRegex(n.suffix
vendor: 9,024 bytes, lines 5108-5109
5108)+"$"),""),c=c.replace(new RegExp("^"+t.escapeRegex(n.prefix)),""),c.length>0&&n.autoGroup||c.indexOf(n.groupSeparator)!==-1){var d=t.escapeRegex(n.groupSeparator);c=c.replace(new RegExp(d,"g"),"");var f=c.split(s===n.radixPoint?"!":n.radixPoint);if(c=""===n.radixPoint?c:f[0],s!==n.negationSymbol.front&&(c=c.replace("!","?")),c.length>n.groupSize)for(var m=new RegExp("([-+]?[\\d?]+)([\\d?]{"+n.groupSize+"})");m.test(c)&&""!==n.groupSeparator;)c=c.replace(m,"$1"+n.groupSeparator+"$2"),c=c.replace(n.groupSeparator+n.groupSeparator,n.groupSeparator);c=c.replace("?","!"),""!==n.radixPoint&&f.length>1&&(c+=(s===n.radixPoint?"!":n.radixPoint)+f[1])}c=n.prefix+c+n.suffix,u&&(c=n.negationSymbol.front+c+n.negationSymbol.back);var h=p!==c.split("").join(),v=e.inArray("!",c);if(v===-1&&(v=a),h){for(i.length=c.length,r=0,o=c.length;r<o;r++)i[r]=c.charAt(r);i[v]=s}return v=n.numericInput&&isFinite(a)?i.join("").length-v-1:v,n.numericInput&&(i=i.reverse(),e.inArray(n.radixPoint,i)<v&&i.join("").length-n.suffix.length!==v&&(v-=1)),{pos:v,refreshFromBuffer:h,buffer:i,isNegative:u}},onBeforeWrite:function(i,a,n,r){var o;if(i&&("blur"===i.type||"checkval"===i.type||"keydown"===i.type)){var s=r.numericInput?a.slice().reverse().join(""):a.join(""),l=s.replace(r.prefix,"");l=l.replace(r.suffix,""),l=l.replace(new RegExp(t.escapeRegex(r.groupSeparator),"g"),""),","===r.radixPoint&&(l=l.replace(r.radixPoint,"."));var u=l.match(new RegExp("[-"+t.escapeRegex(r.negationSymbol.front)+"]","g"));if(u=null!==u&&1===u.length,l=l.replace(new RegExp("[-"+t.escapeRegex(r.negationSymbol.front)+"]","g"),""), 5109l=l.replace(new RegExp(t.escapeRegex(r.negationSymbol.back)+"$"),""),isNaN(r.placeholder)&&(l=l.replace(new RegExp(t.escapeRegex(r.placeholder),"g"),"")),l=l===r.negationSymbol.front?l+"0":l,""!==l&&isFinite(l)){var c=parseFloat(l),p=u?c*-1:c;if(null!==r.min&&isFinite(r.min)&&p<parseFloat(r.min)?(c=Math.abs(r.min),u=r.min<0,s=void 0):null!==r.max&&isFinite(r.max)&&p>parseFloat(r.max)&&(c=Math.abs(r.max),u=r.max<0,s=void 0),l=c.toString().replace(".",r.radixPoint).split(""),isFinite(r.digits)){var d=e.inArray(r.radixPoint,l),f=e.inArray(r.radixPoint,s);d===-1&&(l.push(r.radixPoint),d=l.length-1);for(var m=1;m<=r.digits;m++)r.digitsOptional||void 0!==l[d+m]&&l[d+m]!==r.placeholder.charAt(0)?f!==-1&&void 0!==s[f+m]&&(l[d+m]=l[d+m]||s[f+m]):l[d+m]="0";l[l.length-1]===r.radixPoint&&delete l[l.length-1]}if(c.toString()!==l&&c.toString()+"."!==l||u)return l=(r.prefix+l.join("")).split(""),!u||0===c&&"blur"===i.type||(l.unshift(r.negationSymbol.front),l.push(r.negationSymbol.back)),r.numericInput&&(l=l.reverse()),o=r.postFormat(l,r.numericInput?n:n-1,r),o.buffer&&(o.refreshFromBuffer=o.buffer.join("")!==a.join("")),o}}if(r.autoGroup)return o=r.postFormat(a,r.numericInput?n:n-1,r),o.caret=n<(o.isNegative?r.negationSymbol.front.length:0)+r.prefix.length||n>o.buffer.length-(o.isNegative?r.negationSymbol.back.length:0)?o.pos:o.pos+1,o},regex:{integerPart:function(e){return new RegExp("["+t.escapeRegex(e.negationSymbol.front)+"+]?\\d+")},integerNPart:function(e){return new RegExp("[\\d"+t.escapeRegex(e.groupSeparator)+t.escapeRegex(e.placeholder.charAt(0))+"]+")}},signHandler:function(e,t,i,a,n){if(!a&&n.allowMinus&&"-"===e||n.allowPlus&&"+"===e){var r=t.buffer.join("").match(n.regex.integerPart(n));if(r&&r[0].length>0)return t.buffer[r.index]===("-"===e?"+":n.negationSymbol.front)?"-"===e?""!==n.negationSymbol.back?{pos:0,c:n.negationSymbol.front,remove:0,caret:i,insert:{pos:t.buffer.length-1,c:n.negationSymbol.back}}:{pos:0,c:n.negationSymbol.front,remove:0,caret:i}:""!==n.negationSymbol.back?{pos:0,c:"+",remove:[0,t.buffer.length-1],caret:i}:{pos:0,c:"+",remove:0,caret:i}:t.buffer[0]===("-"===e?n.negationSymbol.front:"+")?"-"===e&&""!==n.negationSymbol.back?{remove:[0,t.buffer.length-1],caret:i-1}:{remove:0,caret:i-1}:"-"===e?""!==n.negationSymbol.back?{pos:0,c:n.negationSymbol.front,caret:i+1,insert:{pos:t.buffer.length,c:n.negationSymbol.back}}:{pos:0,c:n.negationSymbol.front,caret:i+1}:{pos:0,c:e,caret:i+1}}return!1},radixHandler:function(t,i,a,n,r){if(!n&&r.numericInput!==!0&&t===r.radixPoint&&void 0!==r.digits&&(isNaN(r.digits)||parseInt(r.digits)>0)){var o=e.inArray(r.radixPoint,i.buffer),s=i.buffer.join("").match(r.regex.integerPart(r));if(o!==-1&&i.validPositions[o])return i.validPositions[o-1]?{caret:o+1}:{pos:s.index,c:s[0],caret:o+1};if(!s||"0"===s[0]&&s.index+1!==a)return i.buffer[s?s.index:a]="0",{pos:(s?s.index:a)+1,c:r.radixPoint}}return!1},leadingZeroHandler:function(t,i,a,n,r,o){if(!n){var s=i.buffer.slice("");if(s.splice(0,r.prefix.length),s.splice(s.length-r.suffix.length,r.suffix.length),r.numericInput===!0){var s=s.reverse(),l=s[0];if("0"===l&&void 0===i.validPositions[a-1])return{pos:a,remove:s.length-1}}else{a-=r.prefix.length;var u=e.inArray(r.radixPoint,s),c=s.slice(0,u!==-1?u:void 0).join("").match(r.regex.integerNPart(r));if(c&&(u===-1||a<=u)){var p=u===-1?0:parseInt(s.slice(u+1).join(""));if(0===c[0].indexOf(""!==r.placeholder?r.placeholder.charAt(0):"0")&&(c.index+1===a||o!==!0&&0===p))return i.buffer.splice(c.index+r.prefix.length,1),{pos:c.index+r.prefix.length,remove:c.index+r.prefix.length};if("0"===t&&a<=c.index&&c[0]!==r.groupSeparator)return!1}}}return!0},definitions:{"~":{validator:function(i,a,n,r,o,s){var l=o.signHandler(i,a,n,r,o);if(!l&&(l=o.radixHandler(i,a,n,r,o),!l&&(l=r?new RegExp("[0-9"+t.escapeRegex(o.groupSeparator)+"]").test(i):new RegExp("[0-9]").test(i),l===!0&&(l=o.leadingZeroHandler(i,a,n,r,o,s),l===!0)))){var u=e.inArray(o.radixPoint,a.buffer);l=u!==-1&&(o.digitsOptional===!1||a.validPositions[n])&&o.numericInput!==!0&&n>u&&!r?{pos:n,remove:n}:{pos:n}}return l},cardinality:1},"+":{validator:function(e,t,i,a,n){var r=n.signHandler(e,t,i,a,n);return!r&&(a&&n.allowMinus&&e===n.negationSymbol.front||n.allowMinus&&"-"===e||n.allowPlus&&"+"===e)&&(r=!(!a&&"-"===e)||(""!==n.negationSymbol.back?{pos:i,c:"-"===e?n.negationSymbol.front:"+",caret:i+1,insert:{pos:t.buffer.length,c:n.negationSymbol.back}}:{pos:i,c:"-"===e?n.negationSymbol.front:"+",caret:i+1})),r},cardinality:1,placeholder:""},"-":{validator:function(e,t,i,a,n){var r=n.signHandler(e,t,i,a,n);return!r&&a&&n.allowMinus&&e===n.negationSymbol.back&&(r=!0),r},cardinality:1,placeholder:""},":":{validator:function(e,i,a,n,r){var o=r.signHandler(e,i,a,n,r);if(!o){var s="["+t.escapeRegex(r.radixPoint)+"]";o=new RegExp(s).test(e),o&&i.validPositions[a]&&i.validPositions[a].match.placeholder===r.radixPoint&&(o={caret:a+1})}return o},cardinality:1,placeholder:function(e){return e.radixPoint}}},onUnMask:function(e,i,a){if(""===i&&a.nullable===!0)return i;var n=e.replace(a.prefix,"");return n=n.replace(a.suffix,""),n=n.replace(new RegExp(t.escapeRegex(a.groupSeparator),"g"),""),a.unmaskAsNumber?(""!==a.radixPoint&&n.indexOf(a.radixPoint)!==-1&&(n=n.replace(t.escapeRegex.call(this,a.radixPoint),".")),Number(n)):n},isComplete:function(e,i){var a=e.join(""),n=e.slice();if(i.postFormat(n,0,i),n.join("")!==a)return!1;var r=a.replace(i.prefix,"");return r=r.replace(i.suffix,""),r=r.replace(new RegExp(t.escapeRegex(i.groupSeparator),"g"),""),","===i.radixPoint&&(r=r.replace(t.escapeRegex(i.radixPoint),".")),isFinite(r)},onBeforeMask:function(e,i){if(i.numericInput===!0&&(e=e.split("").reverse().join("")),""!==i.radixPoint&&isFinite(e)){var a=e.split("."),n=""!==i.groupSeparator?parseInt(i.groupSize):0;2===a.length&&(a[0].length>n||a[1].length>n)&&(e=e.toString().replace(".",i.radixPoint))}var r=e.match(/,/g),o=e.match(/\./g);if(o&&r?o.length>r.length?(e=e.replace(/\./g,""),e=e.replace(",",i.radixPoint)):r.length>o.length?(e=e.replace(/,/g,""),e=e.replace(".",i.radixPoint)):e=e.indexOf(".")<e.indexOf(",")?e.replace(/\./g,""):e=e.replace(/,/g,""):e=e.replace(new RegExp(t.escapeRegex(i.groupSeparator),"g"),""),0===i.digits&&(e.indexOf(".")!==-1?e=e.substring(0,e.indexOf(".")):e.indexOf(",")!==-1&&(e=e.substring(0,e.indexOf(",")))),""!==i.radixPoint&&isFinite(i.digits)&&e.indexOf(i.radixPoint)!==-1){var s=e.split(i.radixPoint),l=s[1].match(new RegExp("\\d*"))[0];if(parseInt(i.digits)<l.toString().length){var u=Math.pow(10,parseInt(i.digits));e=e.replace(t.escapeRegex(i.radixPoint),"."),e=Math.round(parseFloat(e)*u)/u,e=e.toString().replace(".",i.radixPoint)}}return i.numericInput===!0&&(e=e.split("").reverse().join("")),e.toString()},canClearPosition:function(e,t,i,a,n){var r=e.validPositions[t].input,o=r!==n.radixPoint||null!==e.validPositions[t].match.fn&&n.decimalProtect===!1||isFinite(r)||t===i||r===n.groupSeparator||r===n.negationSymbol.front||r===n.negationSymbol.back;return o},onKeyDown:function(i,a,n,r){var o=e(this);if(i.ctrlKey)switch(i.keyCode){case t.keyCode.UP:o.val(parseFloat(this.inputmask.unmaskedvalue())+parseInt(r.step)),o.trigger("setvalue");break;case t.keyCode.DOWN:o.val(parseFloat(this.inputmask.unmaskedvalue())-parseInt(r.step)),o.trigger("setvalue")}}},currency:{prefix:"$ ",groupSeparator:",",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1}
5109,decimal:{alias:"numeric"},integer:{alias:"numeric",digits:0,radixPoint:""},percentage:{alias:"numeric",digits:2,radixPoint:".",placeholder:"0",autoGroup:!1,min:0,max:100,suffix:" %",allowPlus:!1,allowMinus:!1}}),t}(jQuery,Inputmask),function(e,t){function i(e,t){var i=(e.mask||e).replace(/#/g,"9").replace(/\)/,"9").replace(/[+()#-]/g,""),a=(t.mask||t).replace(/#/g,"9").replace(/\)/,"9").replace(/[+()#-]/g,""),n=(e.mask||e).split("#")[0],r=(t.mask||t).split("#")[0];return 0===r.indexOf(n)?-1:0===n.indexOf(r)?1:i.localeCompare(a)}var a=t.prototype.analyseMask;return t.prototype.analyseMask=function(t,i){function n(e,i,a){i=i||"",a=a||o,""!==i&&(a[i]={});for(var r="",s=a[i]||a,l=e.length-1;l>=0;l--)t=e[l].mask||e[l],r=t.substr(0,1),s[r]=s[r]||[],s[r].unshift(t.substr(1)),e.splice(l,1);for(var u in s)s[u].length>500&&n(s[u].slice(),u,s)}function r(t){var a="",n=[];for(var o in t)e.isArray(t[o])?1===t[o].length?n.push(o+t[o]):n.push(o+i.groupmarker.start+t[o].join(i.groupmarker.end+i.alternatormarker+i.groupmarker.start)+i.groupmarker.end):n.push(o+r(t[o]));return a+=1===n.length?n[0]:i.groupmarker.start+n.join(i.groupmarker.end+i.alternatormarker+i.groupmarker.start)+i.groupmarker.end}var o={};i.phoneCodes&&i.phoneCodes.length>1e3&&(t=t.substr(1,t.length-2),n(t.split(i.groupmarker.end+i.alternatormarker+i.groupmarker.start)),t=r(o));var s=a.call(this,t,i);return s},t.extendAliases({abstractphone:{groupmarker:{start:"<",end:">"},countrycode:"",phoneCodes:[],mask:function(e){return e.definitions={"#":e.definitions[9]},e.phoneCodes.sort(i)},keepStatic:!0,onBeforeMask:function(e,t){var i=e.replace(/^0{1,2}/,"").replace(/[\s]/g,"");return(i.indexOf(t.countrycode)>1||i.indexOf(t.countrycode)===-1)&&(i="+"+t.countrycode+i),i},onUnMask:function(e,t,i){return t},inputmode:"tel"}}),t}(jQuery,Inputmask),function(e,t){return t.extendAliases({Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(e,t){return new RegExp(t.regex).test(e.join(""))},definitions:{r:{validator:function(t,i,a,n,r){function o(e,t){this.matches=[],this.isGroup=e||!1,this.isQuantifier=t||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function s(){var e,t,i=new o,a=[];for(r.regexTokens=[];e=r.tokenizer.exec(r.regex);)switch(t=e[0],t.charAt(0)){case"(":a.push(new o(!0));break;case")":c=a.pop(),a.length>0?a[a.length-1].matches.push(c):i.matches.push(c);break;case"{":case"+":case"*":var n=new o(!1,!0);t=t.replace(/[{}]/g,"");var s=t.split(","),l=isNaN(s[0])?s[0]:parseInt(s[0]),u=1===s.length?l:isNaN(s[1])?s[1]:parseInt(s[1]);if(n.quantifier={min:l,max:u},a.length>0){var p=a[a.length-1].matches;e=p.pop(),e.isGroup||(c=new o(!0),c.matches.push(e),e=c),p.push(e),p.push(n)}else e=i.matches.pop(),e.isGroup||(c=new o(!0),c.matches.push(e),e=c),i.matches.push(e),i.matches.push(n);break;default:a.length>0?a[a.length-1].matches.push(t):i.matches.push(t)}i.matches.length>0&&r.regexTokens.push(i)}function l(t,i){var a=!1;i&&(d+="(",m++);for(var n=0;n<t.matches.length;n++){var r=t.matches[n];if(r.isGroup===!0)a=l(r,!0);else if(r.isQuantifier===!0){var o=e.inArray(r,t.matches),s=t.matches[o-1],c=d;if(isNaN(r.quantifier.max)){for(;r.repeaterPart&&r.repeaterPart!==d&&r.repeaterPart.length>d.length&&!(a=l(s,!0)););a=a||l(s,!0),a&&(r.repeaterPart=d),d=c+r.quantifier.max}else{for(var p=0,f=r.quantifier.max-1;p<f&&!(a=l(s,!0));p++);d=c+"{"+r.quantifier.min+","+r.quantifier.max+"}"}}else if(void 0!==r.matches)for(var h=0;h<r.length&&!(a=l(r[h],i));h++);else{var v;if("["==r.charAt(0)){v=d,v+=r;for(var g=0;g<m;g++)v+=")";var y=new RegExp("^("+v+")$");a=y.test(u)}else for(var k=0,x=r.length;k<x;k++)if("\\"!==r.charAt(k)){v=d,v+=r.substr(0,k+1),v=v.replace(/\|$/,"");for(var g=0;g<m;g++)v+=")";var y=new RegExp("^("+v+")$");if(a=y.test(u))break}d+=r}if(a)break}return i&&(d+=")",m--),a}var u,c,p=i.buffer.slice(),d="",f=!1,m=0;null===r.regexTokens&&s(),p.splice(a,0,t),u=p.join("");for(var h=0;h<r.regexTokens.length;h++){var v=r.regexTokens[h];if(f=l(v,v.isGroup))break}return f},cardinality:1}}}}),t}(jQuery,Inputmask); 5110/* End */ 5111; 5112; /* Start:"a:4:{s:4:"full";s:62:"/o-klube/shema-territorii/assets/remodal.min.js?16075336867821";s:6:"source";s:47:"/o-klube/shema-territorii/assets/remodal.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5113/* 5114 * Remodal - v1.1.1 5115 * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. 5116 * http://vodkabears.github.io/remodal/ 5117 * 5118 * Made by Ilya Makarov 5119 * Under MIT License 5120 */ 5121 5122!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof exports?b(a,require("jquery")):b(a,a.jQuery||a.Zepto)}(this,function(a,b){"use strict";function c(a){if(w&&"none"===a.css("animation-name")&&"none"===a.css("-webkit-animation-name")&&"none"===a.css("-moz-animation-name")&&"none"===a.css("-o-animation-name")&&"none"===a.css("-ms-animation-name"))return 0;var b,c,d,e,f=a.css("animation-duration")||a.css("-webkit-animation-duration")||a.css("-moz-animation-duration")||a.css("-o-animation-duration")||a.css("-ms-animation-duration")||"0s",g
vendor: 7,380 bytes, lines 5122-5130
5122=a.css("animation-delay")||a.css("-webkit-animation-delay")||a.css("-moz-animation-delay")||a.css("-o-animation-delay")||a.css("-ms-animation-delay")||"0s",h=a.css("animation-iteration-count")||a.css("-webkit-animation-iteration-count")||a.css("-moz-animation-iteration-count")||a.css("-o-animation-iteration-count")||a.css("-ms-animation-iteration-count")||"1";for(f=f.split(", "),g=g.split(", "),h=h.split(", "),e=0,c=f.length,b=Number.NEGATIVE_INFINITY;e<c;e++)d=parseFloat(f[e])*parseInt(h[e],10)+parseFloat(g[e]),d>b&&(b=d);return b}function d(){if(b(document).height()<=b(window).height())return 0;var a,c,d=document.createElement("div"),e=document.createElement("div");return d.style.visibility="hidden",d.style.width="100px",document.body.appendChild(d),a=d.offsetWidth,d.style.overflow="scroll",e.style.width="100%",d.appendChild(e),c=e.offsetWidth,d.parentNode.removeChild(d),a-c}function e(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)||(c=b(document.body),a=parseInt(c.css("padding-right"),10)+d(),c.css("padding-right",a+"px"),e.addClass(f))}}function f(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)&&(c=b(document.body),a=parseInt(c.css("padding-right"),10)-d(),c.css("padding-right",a+"px"),e.removeClass(f))}}function g(a,b,c,d){var e=k("is",b),f=[k("is",u.CLOSING),k("is",u.OPENING),k("is",u.CLOSED),k("is",u.OPENED)].join(" ");a.$bg.removeClass(f).addClass(e),a.$overlay.removeClass(f).addClass(e),a.$wrapper.removeClass(f).addClass(e),a.$modal.removeClass(f).addClass(e),a.state=b,!c&&a.$modal.trigger({type:b,reason:d},[{reason:d}])}function h(a,d,e){var f=0,g=function(a){a.target===this&&f++},h=function(a){a.target===this&&0===--f&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())};b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].on(r,g).on(s,h)}),a(),0===c(e.$bg)&&0===c(e.$overlay)&&0===c(e.$wrapper)&&0===c(e.$modal)&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())}function i(a){a.state!==u.CLOSED&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(b,c){a[c].off(r+" "+s)}),a.$bg.removeClass(a.settings.modifier),a.$overlay.removeClass(a.settings.modifier).hide(),a.$wrapper.hide(),f(),g(a,u.CLOSED,!0))}function j(a){var b,c,d,e,f={};for(a=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),b=a.split(","),e=0,c=b.length;e<c;e++)b[e]=b[e].split(":"),d=b[e][1],("string"==typeof d||d instanceof String)&&(d="true"===d||"false"!==d&&d),("string"==typeof d||d instanceof String)&&(d=isNaN(d)?d:+d),f[b[e][0]]=d;return f}function k(){for(var a=q,b=0;b<arguments.length;++b)a+="-"+arguments[b];return a}function l(){var a,c,d=location.hash.replace("#","");if(d){try{c=b('[data-remodal-id="'+d+'"]')}catch(e){}c&&c.length&&(a=b[p].lookup[c.data(p)],a&&a.settings.hashTracking&&a.open())}else n&&n.state===u.OPENED&&n.settings.hashTracking&&n.close()}function m(a,c){var d=b(document.body),e=d,f=this;f.settings=b.extend({},t,c),f.index=b[p].lookup.push(f)-1,f.state=u.CLOSED,f.$overlay=b("."+k("overlay")),null!==f.settings.appendTo&&f.settings.appendTo.length&&(e=b(f.settings.appendTo)),f.$overlay.length||(f.$overlay=b("<div>").addClass(k("overlay")+" "+k("is",u.CLOSED)).hide(),e.append(f.$overlay)),f.$bg=b("."+k("bg")).addClass(k("is",u.CLOSED)),f.$modal=a.addClass(q+" "+k("is-initialized")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).attr("tabindex","-1"),f.$wrapper=b("<div>").addClass(k("wrapper")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).hide().append(f.$modal),e.append(f.$wrapper),f.$wrapper.on("click."+q,'[data-remodal-action="close"]',function(a){a.preventDefault(),f.close()}),f.$wrapper.on("click."+q,'[data-remodal-action="cancel"]',function(a){a.preventDefault(),f.$modal.trigger(v.CANCELLATION),f.settings.closeOnCancel&&f.close(v.CANCELLATION)}),f.$wrapper.on("click."+q,'[data-remodal-action="confirm"]',function(a){a.preventDefault(),f.$modal.trigger(v.CONFIRMATION),f.settings.closeOnConfirm&&f.close(v.CONFIRMATION)}),f.$wrapper.on("click."+q,function(a){var c=b(a.target);c.hasClass(k("wrapper"))&&f.settings.closeOnOutsideClick&&f.close()})}var n,o,p="remodal",q=a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.NAMESPACE||p,r=b.map(["animationstart","webkitAnimationStart","MSAnimationStart","oAnimationStart"],function(a){return a+"."+q}).join(" "),s=b.map(["animationend","webkitAnimationEnd","MSAnimationEnd","oAnimationEnd"],function(a){return a+"."+q}).join(" "),t=b.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:"",appendTo:null},a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.DEFAULTS),u={CLOSING:"closing",CLOSED:"closed",OPENING:"opening",OPENED:"opened"},v={CONFIRMATION:"confirmation",CANCELLATION:"cancellation"},w=function(){var a=document.createElement("div").style;return void 0!==a.animationName||void 0!==a.WebkitAnimationName||void 0!==a.MozAnimationName||void 0!==a.msAnimationName||void 0!==a.OAnimationName}(),x=/iPad|iPhone|iPod/.test(navigator.platform);m.prototype.open=function(){var a,c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(a=c.$modal.attr("data-remodal-id"),a&&c.settings.hashTracking&&(o=b(window).scrollTop(),location.hash=a),n&&n!==c&&i(n),n=c,e(),c.$bg.addClass(c.settings.modifier),c.$overlay.addClass(c.settings.modifier).show(),c.$wrapper.show().scrollTop(0),c.$modal.focus(),h(function(){g(c,u.OPENING)},function(){g(c,u.OPENED)},c))},m.prototype.close=function(a){var c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&c.state!==u.CLOSED&&(c.settings.hashTracking&&c.$modal.attr("data-remodal-id")===location.hash.substr(1)&&(location.hash="",b(window).scrollTop(o)),h(function(){g(c,u.CLOSING,!1,a)},function(){c.$bg.removeClass(c.settings.modifier),c.$overlay.removeClass(c.settings.modifier).hide(),c.$wrapper.hide(),f(),g(c,u.CLOSED,!1,a)},c))},m.prototype.getState=function(){return this.state},m.prototype.destroy=function(){var a,c=b[p].lookup;i(this),this.$wrapper.remove(),delete c[this.index],a=b.grep(c,function(a){return!!a}).length,0===a&&(this.$overlay.remove(),this.$bg.removeClass(k("is",u.CLOSING)+" "+k("is",u.OPENING)+" "+k("is",u.CLOSED)+" "+k("is",u.OPENED)))},b[p]={lookup:[]},b.fn[p]=function(a){var c,d;return this.each(function(e,f){d=b(f),null==d.data(p)?(c=new m(d,a),d.data(p,c.index),c.settings.hashTracking&&d.attr("data-remodal-id")===location.hash.substr(1)&&c.open()):c=b[p].lookup[d.data(p)]}),c},b(document).ready(function(){b(document).on("click","[data-remodal-target]",function(a){a.preventDefault();var c=a.currentTarget,d=c.getAttribute("data-remodal-target"),e=b('[data-remodal-id="'+d+'"]');b[p].lookup[e.data(p)].open()}),b(document).find("."+q).each(function(a,c){var d=b(c),e=d.data("remodal-options");e?("string"==typeof e||e instanceof String)&&(e=j(e)):e={},d[p](e)}),b(document).on("keydown."+q,function(a){n&&n.settings.closeOnEscape&&n.state===u.OPENED&&27===a.keyCode&&n.close()}),b(window).on("hashchange."+q,l)})}); 5123/* End */ 5124;; /* /o-klube/shema-territorii/assets/map.script.js?162342548520232*/ 5125; /* /o-klube/shema-territorii/assets/svg-pan-zoom.js?160241708291090*/ 5126; /* /o-klube/shema-territorii/assets/hammer.js?160241708078529*/ 5127; /* /o-klube/shema-territorii/assets/jquery.inputmask.bundle.min.js?160753368676009*/ 5128; /* /o-klube/shema-territorii/assets/remodal.min.js?16075336867821*/ 5129 5130//# sourceMappingURL=page_9abc38bfd01492cee139d10fa8390fe6.map.js
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.