PageSourceSearch

https://www.carolinalemke.co.il/pub/static/version1775977593/front…/Carolina/Theme/he_IL/js/bundle/bundle5.js

js carolinalemke.co.il collected 2026-09-25 00:08:57 UTC 976,125 bytes, 3 lines download raw bytes

1require.config({"config": {
2        "jsbuild":{"Idus_Search/js/autocomplete.js":"/**\n * Copyright \u00a9 2016 Idus. All rights reserved.\n * See LICENSE.txt for license details.\n */\n\n define([\n    'jquery',\n    'Idus_Core/js/idus',\n    'Idus_Core/js/url',\n    'uiComponent',\n    'ko'\n], function ($, idus, url, Component, ko) {\n    'use strict';\n\n    return Component.extend({\n        options: {\n            ajaxCall : false,\n            ajaxUrl : url.getUrl('search/ajax/autocomplete'),\n            minimum_length : 2,\n            delay : 1500,\n            autocomplete_element : '.search_autocomplete',\n            input_element : '#header-search-input',\n        },\n\n        initialize: function () {\n            // stop\n            // return false;\n\n            var self = this;\n            var autocomplete = $(self.options.autocomplete_element);\n            var delay = autocomplete.attr('delay') ? autocomplete.attr('delay')*1000 : self.options.delay;\n\n            $(self.options.input_element).on('keyup',function(e){\n                if (e.which === 13 || e.keyCode === 13 || e.key === 'Enter') $(this).closest('form#header-search-form').submit();\n                $(self.options.autocomplete_element).addClass('search_typing');                \n                self.setData(false);\n                var query = $(this).val();\n                if(window.searchTimeout) clearTimeout(window.searchTimeout);\n                if(query.length < self.options.minimum_length) return false;\n                window.searchTimeout = setTimeout(function(){\n                    $(self.options.autocomplete_element).removeClass('search_typing');\n                    self.search(query);\n                },delay);\n            });\n\n            $(document).on('click', self.options.autocomplete_element + ' [target=\"idus_popup\"]', function (e) {\n\n                $('.header-search-close').trigger('click');\n                if ($('body').hasClass('page-header-navigation-open')) {\n\n                    $('.page-header-navigation-toggle').prop('checked', false);\n                    $('body').removeClass('page-header-navigation-open');\n                }\n            });\n\n            $(document).on('click', '.search_autocomplete_close', function () {\n\n                var content = $(self.options.autocomplete_element + '_wrap');\n                var wrapper = $(self.options.autocomplete_element);\n                var empty = $(self.options.autocomplete_element + '_empty');\n                content.addClass('search_hide');\n                empty.addClass('search_hide');\n                wrapper.removeClass('search_done').removeClass('search_typing').removeClass('search_working');\n                $('body').removeClass('search-open');\n            });\n\n            if (idus.isMobile()) {\n\n                var searchInput = document.getElementById('header-search-input');\n                searchInput.addEventListener('focus', function() {\n                    document.addEventListener('touchstart', self.blurInputOnDocumentClick, false);\n                }, false);\n                \n                searchInput.addEventListener('blur', function() {\n                    document.removeEventListener('touchstart', self.blurInputOnDocumentClick, false);\n                }, false);\n            }\n        },\n\n        loader: function (action){\n            var self = this;\n            if(action){\n                $('.idus_loader_search').addClass('active');\n                $(self.options.autocomplete_element).removeClass('search_done');\n                $(self.options.autocomplete_element).addClass('search_working');\n            }
2else{\n                $('.idus_loader_search').removeClass('active');\n                $(self.options.autocomplete_element).removeClass('search_working');                \n                $(self.options.autocomplete_element).addClass('search_done');\n            }\n        },\n\n        search: function (query) {\n            var self = this;\n            var ajaxUrl = url.addParamUrl(self.options.ajaxUrl,'q',encodeURIComponent(query));\n            if(self.options.ajaxCall) self.options.ajaxCall.abort();\n            self.options.ajaxCall = $.ajax({\n                dataType: 'json',\n                method: 'get',\n                cache: true,\n                url: ajaxUrl,\n                /** @inheritdoc */\n                beforeSend: function () {\n                    self.setData(false);\n                    self.loader(true);\n                },\n\n                success: function(response){\n\n                    self.loader(false);\n                    if(response.success){\n                        self.setData(response.data);\n                    }
2else{\n                        if (response.no_results) {\n                            self.updateNoResults(response.no_results);\n                        }\n                        self.emptyData('empty');\n                    }\n                }\n            });\n        },\n\n        setData: function (data) {\n            var self = this;\n            self.emptyData(data);\n\n            var content = $(self.options.autocomplete_element+'_wrap');            \n            content.addClass('search_hide').children().addClass('search_hide');\n            content.children('.title').children('.count').addClass('hide');\n            var empty = false;\n            if(data){\n                empty = true;\n                content.removeClass('search_hide');                \n                $.each(data,function(){\n\n                    var element = $(self.options.autocomplete_element+'_'+this.code).addClass('search_hide');\n                    element.children('.content').html('');\n\n                    var order = this.order;\n                    var html = '';\n\n                    if (order && order.length) {\n\n                        for (var i = 0; i < order.length; i++) {\n\n                            var item = this.data[order[i]];\n                            if (item) html += item;\n                        }\n                    } else {\n                        \n                        $.each(this.data,function(){\n    \n                            html += this;\n                        });\n                    }\n\n                    if(html){\n                        empty = false;\n                        $(self.options.autocomplete_element+'_block').removeClass('search_hide');\n                        element.removeClass('search_hide').children('.content').html(html).trigger('contentUpdated');\n                        element.children('.title').children('.count').html($.mage.__('%1 Results').replace('%1', this.size)).removeClass('hide');\n                        $('span.title', element).each(function () {\n                            var el = $(this);\n                            el.html(el.html().replace($(self.options.input_element).val(), '<b>'+$(self.options.input_element).val()+'</b>'));\n                        });\n                    }\n\n                    if (this.code === 'product' && this.size > 0) {\n\n                        $('.search_autocomplete_actions').removeClass('search_hide');\n                        \n                        $('[data-role=tocart-form]').mage('validation', {\n                            radioCheckboxClosest: '.nested',\n                            submitHandler: function (form) {\n                                var widget = $(form).catalogAddToCart({\n                                    bindSubmit: false\n                                });\n                                widget.catalogAddToCart('submitForm', $(form));\n                                return false;\n                            }\n                        });\n                    }\n                });\n            }\n\n            if(empty) self.emptyData('empty');\n        },\n\n        emptyData: function (data){\n            var self = this;\n\n            var empty = $(self.options.autocomplete_element+'_empty');\n            var content = $(self.options.autocomplete_element+'_wrap');\n\n            if(data === false){\n                empty.addClass('search_hide');\n                content.addClass('search_hide');                \n            }else if(data === 'empty'){        \n                empty.removeClass('search_hide');\n                content.addClass('search_hide');          \n            }else{                \n                empty.addClass('search_hide');\n            }\n        }
2,\n\n        updateNoResults: function (data) {\n            \n            var self = this;\n            var empty = $(self.options.autocomplete_element+'_empty');\n            empty.html(data);\n            $.mage.init();\n        },\n\n        blurInputOnDocumentClick: function (event) {\n            var searchInput = document.getElementById('header-search-input');\n            \n            // Check if the click was outside 'searchInput'\n            if (event.target !== searchInput) {\n                searchInput.blur();\n            }\n        }\n    });\n});","Idus_Search/js/dynamsoft.js":"/*!\n* Dynamsoft JavaScript Library\n* @product Dynamsoft Barcode Reader JS Edition Bundle\n* @website http://www.dynamsoft.com\n* @copyright Copyright 2025, Dynamsoft Corporation\n* @author Dynamsoft\n* @version 10.4.3100\n* @fileoverview Dynamsoft JavaScript Library for Barcode Reader\n* More info on dbr JS: https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/\n*/\n!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],e):e((t=\"undefined\"!=typeof globalThis?globalThis:t||self).Dynamsoft=t.Dynamsoft||{})}(this,(function(t){\"use strict\";const e=t=>t&&\"object\"==typeof t&&\"function\"==typeof t.then,i=(async()=>{})().constructor;let r=class extends i{get status(){return this._s}get isPending(){return\"pending\"===this._s}get isFulfilled(){return\"fulfilled\"===this._s}get isRejected(){return\"rejected\"===this._s}get task(){return this._task}set task(t){let r;this._task=t,e(t)?r=t:\"function\"==typeof t&&(r=new i(t)),r&&(async()=>{try{const e=await r;t===this._task&&this.resolve(e)}catch(e){t===this._task&&this.reject(e)}})()}get isEmpty(){return null==this._task}constructor(t){let i,r;super(((t,e)=>{i=t,r=e})),this._s=\"pending\",this.resolve=t=>{this.isPending&&(e(t)?this.task=t:(this._s=\"fulfilled\",i(t)))},this.reject=t=>{this.isPending&&(this._s=\"rejected\",r(t))},this.task=t}};function n(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}function s(t,e,i,r,n){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!n)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof e?t!==e||!n:!e.has(t))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}var o,a,h;\"function\"==typeof SuppressedError&&SuppressedError,function(t){t[t.BOPM_BLOCK=0]=\"BOPM_BLOCK\",t[t.BOPM_UPDATE=1]=\"BOPM_UPDATE\"}(o||(o={})),function(t){t[t.CCUT_AUTO=0]=\"CCUT_AUTO\",t[t.CCUT_FULL_CHANNEL=1]=\"CCUT_FULL_CHANNEL\",t[t.CCUT_Y_CHANNEL_ONLY=2]=\"CCUT_Y_CHANNEL_ONLY\",t[t.CCUT_RGB_R_CHANNEL_ONLY=3]=\"CCUT_RGB_R_CHANNEL_ONLY\",t[t.CCUT_RGB_G_CHANNEL_ONLY=4]=\"CCUT_RGB_G_CHANNEL_ONLY\",t[t.CCUT_RGB_B_CHANNEL_ONLY=5]=\"CCUT_RGB_B_CHANNEL_ONLY\"}(a||(a={})),function(t){t[t.IPF_BINARY=0]=\"IPF_BINARY\",t[t.IPF_BINARYINVERTED=1]=\"IPF_BINARYINVERTED\",t[t.IPF_GRAYSCALED=2]=\"IPF_GRAYSCALED\",t[t.IPF_NV21=3]=\"IPF_NV21\",t[t.IPF_RGB_565=4]=\"IPF_RGB_565\",t[t.IPF_RGB_555=5]=\"IPF_RGB_555\",t[t.IPF_RGB_888=6]=\"IPF_RGB_888\",t[t.IPF_ARGB_8888=7]=\"IPF_ARGB_8888\",t[t.IPF_RGB_161616=8]=\"IPF_RGB_161616\",t[t.IPF_ARGB_16161616=9]=\"IPF_ARGB_16161616\",t[t.IPF_ABGR_8888=10]=\"IPF_ABGR_8888\",t[t.IPF_ABGR_16161616=11]=\"IPF_ABGR_16161616\",t[t.IPF_BGR_888=12]=\"IPF_BGR_888\",t[t.IPF_BINARY_8=13]=\"IPF_BINARY_8\",t[t.IPF_NV12=14]=\"IPF_NV12\",t[t.IPF_BINARY_8_INVERTED=15]=\"IPF_BINARY_8_INVERTED\"}(h||(h={}));const l=\"undefined\"==typeof self,c=\"function\"==typeof importScripts,u=(()=>{if(!c){if(!l&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})(),d=t=>{if(null==t&&(t=\"./\"),l||c);else{let e=document.createElement(\"a\");e.href=t,t=e.href}return t.endsWith(\"/\")||(t+=\"/\"),t},f=t=>Object.prototype.toString.call(t),g=t=>Array.isArray?Array.isArray(t):\"[object Array]\"===f(t),m=t=>\"[object Boolean]\"===f(t),p=t=>\"number\"==typeof t&&!Number.isNaN(t),_=t=>null!==t&&\"object\"==typeof t&&!Array.isArray(t),v=t=>!(!_(t)||!p(t.width)||t.width<=0||!p(t.height)||t.height<=0||!p(t.stride)||t.stride<=0||!(\"format\"in t)||\"tag\"in t&&!C(t.tag)),y=t=>!!v(t)&&t.bytes instanceof Uint8Array,w=t=>
2!(!_(t)||!p(t.left)||t.left<0||!p(t.top)||t.top<0||!p(t.right)||t.right<0||!p(t.bottom)||t.bottom<0||t.left>=t.right||t.top>=t.bottom||!m(t.isMeasuredInPercentage)),C=t=>null===t||!!_(t)&&!!p(t.imageId)&&\"type\"in t,E=t=>!(!_(t)||!T(t.startPoint)||!T(t.endPoint)||t.startPoint.x==t.endPoint.x&&t.startPoint.y==t.endPoint.y),T=t=>!!_(t)&&!!p(t.x)&&!!p(t.y),S=t=>!!_(t)&&!!g(t.points)&&0!=t.points.length&&!t.points.some((t=>!T(t))),b=t=>!!_(t)&&!!g(t.points)&&0!=t.points.length&&4==t.points.length&&!t.points.some((t=>!T(t))),I=t=>!(!_(t)||!p(t.x)||!p(t.y)||!p(t.width)||t.width<0||!p(t.height)||t.height<0||\"isMeasuredInPercentage\"in t&&!m(t.isMeasuredInPercentage)),x=async(t,e)=>await new Promise(((i,r)=>{let n=new XMLHttpRequest;n.open(\"GET\",t,!0),n.responseType=e,n.send(),n.onloadend=async()=>{n.status<200||n.status>=300?r(new Error(t+\" \"+n.status)):i(n.response)},n.onerror=()=>{r(new Error(\"Network Error: \"+n.statusText))}})),O=(t,e)=>{let i=t.split(\".\"),r=e.split(\".\");for(let t=0;t<i.length&&t<r.length;++t){let e=i[t],n=r[t];if(e===n)continue;let s=parseInt(i[t]),o=parseInt(r[t]);return s===o||Number.isNaN(s)&&Number.isNaN(o)?e<n?-1:1:s<o||Number.isNaN(s)&&Number.isInteger(o)?-1:1}return i.length===r.length?0:i.length<r.length?-1:1},A=t=>{const e={},i={std:\"dynamsoft-capture-vision-std\",dip:\"dynamsoft-image-processing\",core:\"dynamsoft-core\",dnn:\"dynamsoft-capture-vision-dnn\",license:\"dynamsoft-license\",utility:\"dynamsoft-utility\",cvr:\"dynamsoft-capture-vision-router\",dbr:\"dynamsoft-barcode-reader\",dlr:\"dynamsoft-label-recognizer\",ddn:\"dynamsoft-document-normalizer\",dcp:\"dynamsoft-code-parser\",dcpd:\"dynamsoft-code-parser\",dlrData:\"dynamsoft-label-recognizer-data\",dce:\"dynamsoft-camera-enhancer\",ddv:\"dynamsoft-document-viewer\"};for(let r in t){if(\"rootDirectory\"===r)continue;let n=r,s=t[n],o=s&&\"object\"==typeof s&&s.path?s.path:s,a=t.rootDirectory;if(a&&!a.endsWith(\"/\")&&(a+=\"/\"),\"object\"==typeof s&&s.isInternal)a&&(o=t[n].version?`${a}${i[n]}@${t[n].version}/dist/${\"ddv\"===n?\"engine\":\"\"}`:`${a}${i[n]}/dist/${\"ddv\"===n?\"engine\":\"\"}`);else{const i=/^@engineRootDirectory(\\/?)/;if(\"string\"==typeof o&&(o=o.replace(i,a||\"\")),\"object\"==typeof o&&\"dwt\"===n){const r=t[n].resourcesPath,s=t[n].serviceInstallerLocation;e[n]={resourcesPath:r.replace(i,a||\"\"),serviceInstallerLocation:s.replace(i,a||\"\")};continue}}e[n]=d(o)}return e},R=async(t,e,i)=>await new Promise((async(r,n)=>{try{const n=e.split(\".\");let s=n[n.length-1];const o=await L(`image/${s}`,t);n.length<=1&&(s=\"png\");const a=new File([o],e,{type:`image/${s}`});if(i){const t=URL.createObjectURL(a),i=document.createElement(\"a\");i.href=t,i.download=e,i.click()}return r(a)}catch(t){return n()}})),D=t=>{y(t)&&(t=M(t));const e=document.createElement(\"canvas\");return e.width=t.width,e.height=t.height,e.getContext(\"2d\",{willReadFrequently:!0}).putImageData(t,0,0),e},L=async(t,e)=>{y(e)&&(e=M(e));const i=D(e);return new Promise(((e,r)=>{i.toBlob((t=>e(t)),t)}))},M=t=>{let e,i=t.bytes;if(!(i&&i instanceof Uint8Array))throw Error(\"Parameter type error\");if(Number(t.format)===h.IPF_BGR_888){const t=i.length/3;e=new Uint8ClampedArray(4*t);for(let r=0;r<t;++r)e[4*r]=i[3*r],e[4*r+1]=i[3*r+1],e[4*r+2]=i[3*r+2],e[4*r+3]=255}else if(Number(t.format)===h.IPF_RGB_888){const t=i.length/3;e=new Uint8ClampedArray(4*t);for(let r=0;r<t;++r)e[4*r]=i[3*r+2],e[4*r+1]=i[3*r+1],e[4*r+2]=i[3*r],e[4*r+3]=255}else if(Number(t.format)===h.IPF_GRAYSCALED){const t=i.length;e=new Uint8ClampedArray(4*t);for(let r=0;r<t;r++)e[4*r]=e[4*r+1]=e[4*r+2]=i[r],e[4*r+3]=255}else if(Number(t.format)===h.IPF_BINARY_8){const r=i.length,n=t.width,s=t.height,o=t.stride;e=new Uint8ClampedArray(n*s*4);for(let t=0;t<r;t++){let r=i[t],s=t%o,a=Math.floor(t/o);for(let t=0;t<8;t++){let i=s+t,o=4*(a*n+i);if(i>=n)break;e[o]=e[o+1]=e[o+2]=(128&r)/128*255,e[o+3]=255,r<<=1}}}else if(Number(t.format)===h.IPF_ABGR_8888){const t=i.length/4;e=new Uint8ClampedArray(i.length);for(let r=0;r<t;++r)e[4*r]=i[4*r],e[4*r+1]=i[4*r+1],e[4*r+2]=i[4*r+2],e[4*r+3]=i[4*r+3]}else if(Number(t.format)===h.IPF_ARGB_8888){const t=i.length/4;e=new Uint8ClampedArray(i.length);for(let r=0;r<t;++r)e[4*r]=i[4*r+2],e[4*r+1]=i[4*r+1],e[4*r+2]=i[4*r],e[4*r+3]=i[4*r+3]}else if(Number(t.format)===h.IPF_BINARY_8_INVERTED){const r=i.length,n=t.width,s=t.height,o=t.stride;e=new Uint8ClampedArray(n*s*4);for(let t=0;t<r;t++){let r=i[t],s=t%o,a=Math.floor(t/o);for(let t=0;t<8;t++){let i=s+t,o=4*(a*n+i);if(i>=n)break;e[o]=e[o+1]=e[o+2]=128&r?0:255,e[o+3]=255,r<<=1}}}return new ImageData(e,t.width,t.height)};var F,P,k,B,N,j,U,V;let G,W,Y,H,X,z=class t{get _isFetchingStarted(){return n(this,N,\"f\")}constructor(){F.add(this),P.set(this,[]),k.set(this,1),B.set(this,o.BOPM_BLOCK),N.set(this,!1),j.set(this,void 0),U.set(this,a.CCUT_AUTO)}setErrorListener(t){}addImageToBuffer(t){var e;if(!y(t))throw new TypeError(\"Invalid 'image'.\");if((null===(e=t.tag)||void 0===e?void 0:e.hasOwnProperty(\"imageId\"))&&\"number\"==typeof t.tag.imageId&&this.hasImage(t.tag.imageId))throw new Error(\"Existed imageId.\");if(n(this,P,\"f\").length>=n(this,k,\"f\"))switch(n(this,B,\"f\")){case o.BOPM_BLOCK:break;case o.BOPM_UPDATE:if(n(this,P,\"f\").push(t),_(n(this,j,\"f\"))&&p(n(this,j,\"f\").imageId)&&1==n(this,j,\"f\").keepInBuffer)for(;n(this,P,\"f\").length>n(this,k,\"f\");){const t=n(this,P,\"f\").findIndex((t=>{var e;return(null===(e=t.tag)||void 0===e?void 0:e.imageId)!==n(this,j,\"f\").imageId}));n(this,P,\"f\").splice(t,1)}else n(this,P,\"f\").splice(0,n(this,P,\"f\").length-n(this,k,\"f\"))}else n(this,P,\"f\").push(t)}getImage(){if(0===n(this,P,\"f\").length)return null;let e;if(n(this,j,\"f\")&&p(n(this,j,\"f\").imageId)){const t=n(this,F,\"m\",V).call(this,n(this,j,\"f\").imageId);if(t<0)throw new Error(`Image with id ${n(this,j,\"f\").imageId} doesn't exist.`);e=n(this,P,\"f\").slice(t,t+1)[0]}else e=n(this,P,\"f\").pop();if([h.IPF_RGB_565,h.IPF_RGB_555,h.IPF_RGB_888,h.IPF_ARGB_8888,h.IPF_RGB_161616,h.IPF_ARGB_16161616,h.IPF_ABGR_8888,h.IPF_ABGR_16161616,h.IPF_BGR_888].includes(e.format)){if(n(this,U,\"f\")===a.CCUT_RGB_R_CHANNEL_ONLY){t._onLog&&t._onLog(\"only get R channel data.\");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case h.IPF_RGB_565:case h.IPF_RGB_555:case h.IPF_RGB_888:case h.IPF_RGB_161616:i[t]=e.bytes[3*t+2];break;case h.IPF_ARGB_8888:case h.IPF_ARGB_16161616:i[t]=e.bytes[4*t+2];break;case h.IPF_BGR_888:i[t]=e.bytes[3*t];break;case h.IPF_ABGR_8888:case h.IPF_ABGR_16161616:i[t]=e.bytes[4*t]}e.bytes=i,e.stride=e.width,e.format=h.IPF_GRAYSCALED}else if(n(this,U,\"f\")===a.CCUT_RGB_G_CHANNEL_ONLY){t._onLog&&t._onLog(\"only get G channel data.\");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case h.IPF_RGB_565:case h.IPF_RGB_555:case h.IPF_RGB_888:case h.IPF_RGB_161616:case h.IPF_BGR_888:i[t]=e.bytes[3*t+1];break;case h.IPF_ARGB_8888:case h.IPF_ARGB_16161616:case h.IPF_ABGR_8888:case h.IPF_ABGR_16161616:i[t]=e.bytes[4*t+1]}e.bytes=i,e.stride=e.width,e.format=h.IPF_GRAYSCALED}else if(n(this,U,\"f\")===a.CCUT_RGB_B_CHANNEL_ONLY){t._onLog&&t._onLog(\"only get B channel data.\");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case h.IPF_RGB_565:case h.IPF_RGB_555:case h.IPF_RGB_888:case h.IPF_RGB_161616:i[t]=e.bytes[3*t];break;case h.IPF_ARGB_8888:case h.IPF_ARGB_16161616:i[t]=e.bytes[4*t];break;case h.IPF_BGR_888:i[t]=e.bytes[3*t+2];break;case h.IPF_ABGR_8888:case h.IPF_ABGR_16161616:i[t]=e.bytes[4*t+2]}e.bytes=i,e.stride=e.width,e.format=h.IPF_GRAYSCALED}}else[h.IPF_NV21,h.IPF_NV12].includes(e.format)&&t._onLog&&t._onLog(\"NV21 or NV12 is not supported.\");return e}setNextImageToReturn(t,e){if(!((...t)=>0!==t.length&&t.every((t=>p(t))))(t))throw new TypeError(\"Invalid 'imageId'.\");if(void 0!==e&&!m(e))throw new TypeError(\"Invalid 'keepInBuffer'.\");s(this,j,{imageId:t,keepInBuffer:e},\"f\")}_resetNextReturnedImage(){s(this,j,null,\"f\")}hasImage(t){return n(this,F,\"m\",V).call(this,t)>=0}startFetching(){s(this,N,!0,\"f\")}stopFetching(){s(this,N,!1,\"f\")}setMaxImageCount(t){if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'count'.\");if(t<1||Math.round(t)!==t)throw new Error(\"Invalid 'count'.\");for(s(this,k,t,\"f\");n(this,P,\"f\")&&n(this,P,\"f\").length>t;)n(this,P,\"f\").shift()}getMaxImageCount(){return n(this,k,\"f\")}getImageCount(){return n(this,P,\"f\").length}clearBuffer(){n(this,P,\"f\").length=0}isBufferEmpty(){return 0===n(this,P,\"f\").length}setBufferOverflowProtectionMode(t){s(this,B,t,\"f\")}getBufferOverflowProtectionMode(){return n(this,B,\"f\")}setColourChannelUsageType(t){s(this,U,t,\"f\")}getColourChannelUsageType(){return n(this,U,\"f\")}};P=new WeakMap,k=new WeakMap,B=new WeakMap,N=new WeakMap,j=new WeakMap,U=new WeakMap,F=new WeakSet,V=function(t){if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'imageId'.\");return n(this,P,\"f\").findIndex((e=>{var i;return(null===(i=e.tag)||void 0===i?void 0:i.imageId)===t}))},\"undefined\"!=typeof navigator&&(G=navigator,W=G.userAgent,Y=G.platform,H=G.mediaDevices),function(){if(!l){const t={Edge:{search:\"Edg\",verSearch:\"Edg\"},OPR:null,Chrome:null,Safari:{str:G.vendor,search:\"Apple\",verSearch:[\"Version\",\"iPhone OS\",\"CPU OS\"]},Firefox:null,Explorer:{search:\"MSIE\",verSearch:\"MSIE\"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:Y,search:\"Win\"},Mac:{str:Y},Linux:{str:Y}};let i=\"unknownBrowser\",r=0,n=\"unknownOS\";for(let e in t){const n=t[e]||{};let s=n.str||W,o=n.search||e,a=n.verStr||W,h=n.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){r=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let r=i.str||W,s=i.search||t;if(-1!=r.indexOf(s)){n=t;break}}\"Linux\"==n&&-1!=W.indexOf(\"Windows NT\")&&(n=\"HarmonyOS\"),X={browser:i,version:r,OS:n}}l&&(X={browser:\"ssr\",version:0,OS:\"ssr\"})}();const Z=\"undefined\"!=typeof WebAssembly&&W&&!(/Safari/.test(W)&&!/Chrome/.test(W)&&/\\(.+\\s11_2_([2-6]).*\\)/.test(W)),q=!(\"undefined\"==typeof Worker),K=!(!H||!H.getUserMedia),J=async()=>{let t=!1;if(K)try{(await H.getUserMedia({video:!0}
2)).getTracks().forEach((t=>{t.stop()})),t=!0}catch(t){}return t};\"Chrome\"===X.browser&&X.version>66||\"Safari\"===X.browser&&X.version>13||\"OPR\"===X.browser&&X.version>43||\"Edge\"===X.browser&&X.version;const Q={},$=async t=>{let e=\"string\"==typeof t?[t]:t,i=[];for(let t of e)i.push(Q[t]=Q[t]||new r);await Promise.all(i)},tt=async(t,e)=>{let i,n=\"string\"==typeof t?[t]:t,s=[];for(let t of n){let n;s.push(n=Q[t]=Q[t]||new r(i=i||e())),n.isEmpty&&(n.task=i=i||e())}await Promise.all(s)};let et,it=0;const rt=()=>it++,nt={};let st;const ot=t=>{st=t,et&&et.postMessage({type:\"setBLog\",body:{value:!!t}})};let at=!1;const ht=t=>{at=t,et&&et.postMessage({type:\"setBDebug\",body:{value:!!t}})},lt={},ct={},ut={dip:{wasm:!0}},dt={std:{version:\"1.4.21\",path:d(u+\"../../[email protected]/dist/\"),isInternal:!0},core:{version:\"3.4.31\",path:u,isInternal:!0}},ft=async t=>{let e;t instanceof Array||(t=t?[t]:[]);let i=Q.core;e=!i||i.isEmpty;let n=new Map;const s=t=>{if(\"std\"==(t=t.toLowerCase())||\"core\"==t)return;if(!ut[t])throw Error(\"The '\"+t+\"' module cannot be found.\");let e=ut[t].deps;if(null==e?void 0:e.length)for(let t of e)s(t);let i=Q[t];n.has(t)||n.set(t,!i||i.isEmpty)};for(let e of t)s(e);let o=[];e&&o.push(\"core\"),o.push(...n.keys());const a=[...n.entries()].filter((t=>!t[1])).map((t=>t[0]));await tt(o,(async()=>{const t=[...n.entries()].filter((t=>t[1])).map((t=>t[0]));await $(a);const i=A(dt),s={};for(let e of t)s[e]=ut[e];const o={engineResourcePaths:i,autoResources:s,names:t};let h=new r;if(e){o.needLoadCore=!0;let t=i.core+gt._workerName;t.startsWith(location.origin)||(t=await fetch(t).then((t=>t.blob())).then((t=>URL.createObjectURL(t)))),et=new Worker(t),et.onerror=t=>{let e=new Error(t.message);h.reject(e)},et.addEventListener(\"message\",(t=>{let e=t.data?t.data:t,i=e.type,r=e.id,n=e.body;switch(i){case\"log\":st&&st(e.message);break;case\"task\":try{nt[r](n),delete nt[r]}catch(t){throw delete nt[r],t}break;case\"event\":try{nt[r](n)}catch(t){throw t}break;default:console.log(t)}})),o.bLog=!!st,o.bd=at,o.dm=location.origin.startsWith(\"http\")?location.origin:\"https://localhost\"}else await $(\"core\");let l=it++;nt[l]=t=>{if(t.success)Object.assign(lt,t.versions),\"{}\"!==JSON.stringify(t.versions)&&(gt._versions=t.versions),h.resolve(void 0);else{const e=Error(t.message);t.stack&&(e.stack=t.stack),h.reject(e)}},et.postMessage({type:\"loadWasm\",body:o,id:l}),await h}))};class gt{static get engineResourcePaths(){return dt}static set engineResourcePaths(t){Object.assign(dt,t)}static get bSupportDce4Module(){return this._bSupportDce4Module}static get bSupportIRTModule(){return this._bSupportIRTModule}static get versions(){return this._versions}static get _onLog(){return st}static set _onLog(t){ot(t)}static get _bDebug(){return at}static set _bDebug(t){ht(t)}static isModuleLoaded(t){return t=(t=t||\"core\").toLowerCase(),!!Q[t]&&Q[t].isFulfilled}static async loadWasm(t){return await ft(t)}static async detectEnvironment(){return await(async()=>({wasm:Z,worker:q,getUserMedia:K,camera:await J(),browser:X.browser,version:X.version,OS:X.OS}))()}static async getModuleVersion(){return await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success)return t(i.versions);{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"getModuleVersion\",id:i})}))}static getVersion(){return`3.4.31(Worker: ${lt.core&&lt.core.worker||\"Not Loaded\"}, Wasm: ${lt.core&&lt.core.wasm||\"Not Loaded\"})`}static enableLogging(){z._onLog=console.log,gt._onLog=console.log}static disableLogging(){z._onLog=null,gt._onLog=null}static async cfd(t){return await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success)return e();{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cfd\",id:r,body:{count:t}})}))}}var mt,pt,_t,vt,yt,wt,Ct,Et,Tt;gt._bSupportDce4Module=-1,gt._bSupportIRTModule=-1,gt._versions=null,gt._workerName=\"core.worker.js\",gt.browserInfo=X,function(t){t[t.CRIT_ORIGINAL_IMAGE=1]=\"CRIT_ORIGINAL_IMAGE\",t[t.CRIT_BARCODE=2]=\"CRIT_BARCODE\",t[t.CRIT_TEXT_LINE=4]=\"CRIT_TEXT_LINE\",t[t.CRIT_DETECTED_QUAD=8]=\"CRIT_DETECTED_QUAD\",t[t.CRIT_NORMALIZED_IMAGE=16]=\"CRIT_NORMALIZED_IMAGE\",t[t.CRIT_PARSED_RESULT=32]=\"CRIT_PARSED_RESULT\"}(mt||(mt={})),function(t){t[t.CT_NORMAL_INTERSECTED=0]=\"CT_NORMAL_INTERSECTED\",t[t.CT_T_INTERSECTED=1]=\"CT_T_INTERSECTED\",t[t.CT_CROSS_INTERSECTED=2]=\"CT_CROSS_INTERSECTED\",t[t.CT_NOT_INTERSECTED=3]=\"CT_NOT_INTERSECTED\"}(pt||(pt={})),function(t){t[t.EC_OK=0]=\"EC_OK\",t[t.EC_UNKNOWN=-1e4]=\"EC_UNKNOWN\",t[t.EC_NO_MEMORY=-10001]=\"EC_NO_MEMORY\",t[t.EC_NULL_POINTER=-10002]=\"EC_NULL_POINTER\",t[t.EC_LICENSE_INVALID=-10003]=\"EC_LICENSE_INVALID\",t[t.EC_LICENSE_EXPIRED=-10004]=\"EC_LICENSE_EXPIRED\",t[t.EC_FILE_NOT_FOUND=-10005]=\"EC_FILE_NOT_FOUND\",t[t.EC_FILE_TYPE_NOT_SUPPORTED=-10006]=\"EC_FILE_TYPE_NOT_SUPPORTED\",t[t.EC_BPP_NOT_SUPPORTED=-10007]=\"EC_BPP_NOT_SUPPORTED\",t[t.EC_INDEX_INVALID=-10008]=\"EC_INDEX_INVALID\",t[t.EC_CUSTOM_REGION_INVA
2LID=-10010]=\"EC_CUSTOM_REGION_INVALID\",t[t.EC_IMAGE_READ_FAILED=-10012]=\"EC_IMAGE_READ_FAILED\",t[t.EC_TIFF_READ_FAILED=-10013]=\"EC_TIFF_READ_FAILED\",t[t.EC_DIB_BUFFER_INVALID=-10018]=\"EC_DIB_BUFFER_INVALID\",t[t.EC_PDF_READ_FAILED=-10021]=\"EC_PDF_READ_FAILED\",t[t.EC_PDF_DLL_MISSING=-10022]=\"EC_PDF_DLL_MISSING\",t[t.EC_PAGE_NUMBER_INVALID=-10023]=\"EC_PAGE_NUMBER_INVALID\",t[t.EC_CUSTOM_SIZE_INVALID=-10024]=\"EC_CUSTOM_SIZE_INVALID\",t[t.EC_TIMEOUT=-10026]=\"EC_TIMEOUT\",t[t.EC_JSON_PARSE_FAILED=-10030]=\"EC_JSON_PARSE_FAILED\",t[t.EC_JSON_TYPE_INVALID=-10031]=\"EC_JSON_TYPE_INVALID\",t[t.EC_JSON_KEY_INVALID=-10032]=\"EC_JSON_KEY_INVALID\",t[t.EC_JSON_VALUE_INVALID=-10033]=\"EC_JSON_VALUE_INVALID\",t[t.EC_JSON_NAME_KEY_MISSING=-10034]=\"EC_JSON_NAME_KEY_MISSING\",t[t.EC_JSON_NAME_VALUE_DUPLICATED=-10035]=\"EC_JSON_NAME_VALUE_DUPLICATED\",t[t.EC_TEMPLATE_NAME_INVALID=-10036]=\"EC_TEMPLATE_NAME_INVALID\",t[t.EC_JSON_NAME_REFERENCE_INVALID=-10037]=\"EC_JSON_NAME_REFERENCE_INVALID\",t[t.EC_PARAMETER_VALUE_INVALID=-10038]=\"EC_PARAMETER_VALUE_INVALID\",t[t.EC_DOMAIN_NOT_MATCH=-10039]=\"EC_DOMAIN_NOT_MATCH\",t[t.EC_RESERVED_INFO_NOT_MATCH=-10040]=\"EC_RESERVED_INFO_NOT_MATCH\",t[t.EC_LICENSE_KEY_NOT_MATCH=-10043]=\"EC_LICENSE_KEY_NOT_MATCH\",t[t.EC_REQUEST_FAILED=-10044]=\"EC_REQUEST_FAILED\",t[t.EC_LICENSE_INIT_FAILED=-10045]=\"EC_LICENSE_INIT_FAILED\",t[t.EC_SET_MODE_ARGUMENT_ERROR=-10051]=\"EC_SET_MODE_ARGUMENT_ERROR\",t[t.EC_LICENSE_CONTENT_INVALID=-10052]=\"EC_LICENSE_CONTENT_INVALID\",t[t.EC_LICENSE_KEY_INVALID=-10053]=\"EC_LICENSE_KEY_INVALID\",t[t.EC_LICENSE_DEVICE_RUNS_OUT=-10054]=\"EC_LICENSE_DEVICE_RUNS_OUT\",t[t.EC_GET_MODE_ARGUMENT_ERROR=-10055]=\"EC_GET_MODE_ARGUMENT_ERROR\",t[t.EC_IRT_LICENSE_INVALID=-10056]=\"EC_IRT_LICENSE_INVALID\",t[t.EC_FILE_SAVE_FAILED=-10058]=\"EC_FILE_SAVE_FAILED\",t[t.EC_STAGE_TYPE_INVALID=-10059]=\"EC_STAGE_TYPE_INVALID\",t[t.EC_IMAGE_ORIENTATION_INVALID=-10060]=\"EC_IMAGE_ORIENTATION_INVALID\",t[t.EC_CONVERT_COMPLEX_TEMPLATE_ERROR=-10061]=\"EC_CONVERT_COMPLEX_TEMPLATE_ERROR\",t[t.EC_CALL_REJECTED_WHEN_CAPTURING=-10062]=\"EC_CALL_REJECTED_WHEN_CAPTURING\",t[t.EC_NO_IMAGE_SOURCE=-10063]=\"EC_NO_IMAGE_SOURCE\",t[t.EC_READ_DIRECTORY_FAILED=-10064]=\"EC_READ_DIRECTORY_FAILED\",t[t.EC_MODULE_NOT_FOUND=-10065]=\"EC_MODULE_NOT_FOUND\",t[t.EC_MULTI_PAGES_NOT_SUPPORTED=-10066]=\"EC_MULTI_PAGES_NOT_SUPPORTED\",t[t.EC_FILE_ALREADY_EXISTS=-10067]=\"EC_FILE_ALREADY_EXISTS\",t[t.EC_CREATE_FILE_FAILED=-10068]=\"EC_CREATE_FILE_FAILED\",t[t.EC_IMGAE_DATA_INVALID=-10069]=\"EC_IMGAE_DATA_INVALID\",t[t.EC_IMAGE_SIZE_NOT_MATCH=-10070]=\"EC_IMAGE_SIZE_NOT_MATCH\",t[t.EC_IMAGE_PIXEL_FORMAT_NOT_MATCH=-10071]=\"EC_IMAGE_PIXEL_FORMAT_NOT_MATCH\",t[t.EC_SECTION_LEVEL_RESULT_IRREPLACEABLE=-10072]=\"EC_SECTION_LEVEL_RESULT_IRREPLACEABLE\",t[t.EC_AXIS_DEFINITION_INCORRECT=-10073]=\"EC_AXIS_DEFINITION_INCORRECT\",t[t.EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE=-10074]=\"EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE\",t[t.EC_PDF_LIBRARY_LOAD_FAILED=-10075]=\"EC_PDF_LIBRARY_LOAD_FAILED\",t[t.EC_NO_LICENSE=-2e4]=\"EC_NO_LICENSE\",t[t.EC_HANDSHAKE_CODE_INVALID=-20001]=\"EC_HANDSHAKE_CODE_INVALID\",t[t.EC_LICENSE_BUFFER_FAILED=-20002]=\"EC_LICENSE_BUFFER_FAILED\",t[t.EC_LICENSE_SYNC_FAILED=-20003]=\"EC_LICENSE_SYNC_FAILED\",t[t.EC_DEVICE_NOT_MATCH=-20004]=\"EC_DEVICE_NOT_MATCH\",t[t.EC_BIND_DEVICE_FAILED=-20005]=\"EC_BIND_DEVICE_FAILED\",t[t.EC_INSTANCE_COUNT_OVER_LIMIT=-20008]=\"EC_INSTANCE_COUNT_OVER_LIMIT\",t[t.EC_LICENSE_INIT_SEQUENCE_FAILED=-20009]=\"EC_LICENSE_INIT_SEQUENCE_FAILED\",t[t.EC_TRIAL_LICENSE=-20010]=\"EC_TRIAL_LICENSE\",t[t.EC_FAILED_TO_REACH_DLS=-20200]=\"EC_FAILED_TO_REACH_DLS\",t[t.EC_LICENSE_CACHE_USED=-20012]=\"EC_LICENSE_CACHE_USED\",t[t.EC_BARCODE_FORMAT_INVALID=-30009]=\"EC_BARCODE_FORMAT_INVALID\",t[t.EC_QR_LICENSE_INVALID=-30016]=\"EC_QR_LICENSE_INVALID\",t[t.EC_1D_LICENSE_INVALID=-30017]=\"EC_1D_LICENSE_INVALID\",t[t.EC_PDF417_LICENSE_INVALID=-30019]=\"EC_PDF417_LICENSE_INVALID\",t[t.EC_DATAMATRIX_LICENSE_INVALID=-30020]=\"EC_DATAMATRIX_LICENSE_INVALID\",t[t.EC_CUSTOM_MODULESIZE_INVALID=-30025]=\"EC_CUSTOM_MODULESIZE_INVALID\",t[t.EC_AZTEC_LICENSE_INVALID=-30041]=\"EC_AZTEC_LICENSE_INVALID\",t[t.EC_PATCHCODE_LICENSE_INVALID=-30046]=\"EC_PATCHCODE_LICENSE_INVALID\",t[t.EC_POSTALCODE_LICENSE_INVALID=-30047]=\"EC_POSTALCODE_LICENSE_INVALID\",t[t.EC_DPM_LICENSE_INVALID=-30048]=\"EC_DPM_LICENSE_INVALID\",t[t.EC_FRAME_DECODING_THREAD_EXISTS=-30049]=\"EC_FRAME_DECODING_THREAD_EXISTS\",t[t.EC_STOP_DECODING_THREAD_FAILED=-30050]=\"EC_STOP_DECODING_THREAD_FAILED\",t[t.EC_MAXICODE_LICENSE_INVALID=-30057]=\"EC_MAXICODE_LICENSE_INVALID\",t[t.EC_GS1_DATABAR_LICENSE_INVALID=-30058]=\"EC_GS1_DATABAR_LICENSE_INVALID\",t[t.EC_GS1_COMPOSITE_LICENSE_INVALID=-30059]=\"EC_GS1_COMPOSITE_LICENSE_INVALID\",t[t.EC_DOTCODE_LICENSE_INVALID=-30061]=\"EC_DOTCODE_LICENSE_INVALID\",t[t.EC_PHARMACODE_LICENSE_INVALID=-30062]=\"EC_PHARMACODE_LICENSE_INVALID\",t[t.EC_CHARACTER_MODEL_FILE_NOT_FOUND=-40100]=\"EC_CHARACTER_MODEL_FILE_NOT_FOUND\",t[t.EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT=-40101]=\"EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT\",t[t.EC_TEXT_LINE_GROUP_REGEX_CONFLICT=-40102]=\"EC_TEXT_LINE_GROUP_REGEX_CONFLICT\",t[t.EC_QUADRILATERAL_INVALID=-50057]=\"EC_QUADRILATERAL_INVALID\",t[t.EC_PANORAMA_LICENSE_INVALID=-70060]=\"EC_PANORAMA_LICENSE_INVALID\",t[t.EC_RESOURCE_PATH_NOT_EXIST=-90001]=\"EC_RESOURCE_PATH_NOT_EXIST\",t[t.EC_RESOURCE_LOAD_FAILED=-90002]=\"EC_RESOURCE_LOAD_FAILED\",t[t.EC_CODE_SPECIFICATION_NOT_FOUND=-90003]=\"EC_CODE_SPECIFICATION_NOT_FOUND\",t[t.EC_FULL_CODE_EMPTY=-90004]=\"EC_FULL_CODE_EMPTY\",t[t.EC_FULL_CODE_PREPROCESS_FAILED=-90005]=\"EC_FULL_CODE_PREPROCESS_FAILED\",t[t.EC_ZA_DL_LICENSE_INVALID=-90006]=\"EC_ZA_DL_LICENSE_INVALID\",t[t.EC_AAMVA_DL_ID_LICENSE_INVALID=-90007]=\"EC_AAMVA_DL_ID_LICENSE_INVALID\",t[t.EC_AADHAAR_LICENSE_INVALID=-90008]=\"EC_AADHAAR_LICENSE_INVALID\",t[t.EC_MRTD_LICENSE_INVALID=-90009]=\"EC_MRTD_LICENSE_INVALID\",t[t.EC_VIN_LICENSE_INVALID=-90010]=\"EC_VIN_LICENSE_INVALID\",t[t.EC_CUSTOMIZED_CODE_TYPE_LICENSE_INVALID=-90011]=\"EC_CUSTOMIZED_CODE_TYPE_LICENSE_INVALID\",t[t.EC_LICENSE_WARNING=-10076]=\"EC_LICENSE_WARNING\",t[t.EC_BARCODE_READER_LICENSE_NOT_FOUND=-30063]=\"EC_BARCODE_READER_LICENSE_NOT_FOUND\",t[t.EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND=-40103]=\"EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND\",t[t.EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND=-50058]=\"EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND\",t[t.EC_CODE_PARSER_LICENSE_NOT_FOUND=-90012]=\"EC_CODE_PARSER_LICENSE_NOT_FOUND\"}(_t||(_t={})),function(t){t[t.GEM_SKIP=0]=\"GEM_SKIP\",t[t.GEM_AUTO=1]=\"GEM_AUTO\",t[t.GEM_GENERAL=2]=\"GEM_GENERAL\",t[t.GEM_GRAY_EQUALIZE=4]=\"GEM_GRAY_EQUALIZE\",t[t.GEM_GRAY_SMOOTH=8]=\"GEM_GRAY_SMOOTH\",t[t.GEM_SHARPEN_SMOOTH=16]=\"GEM_SHARPEN_SMOOTH\",t[t.GEM_REV=-2147483648]=\"GEM_REV\"}(vt||(vt={})),function(t){t[t.GTM_SKIP=0]=\"GTM_SKIP\",t[t.GTM_INVERTED=1]=\"GTM_INVERTED\",t[t.GTM_ORIGINAL=2]=\"GTM_ORIGINAL\",t[t.GTM_AUTO=4]=\"GTM_AUTO\",t[t.GTM_REV=-2147483648]=\"GTM_REV\"}(yt||(yt={})),function(t){t[t.ITT_FILE_IMAGE=0]=\"ITT_FILE_IMAGE\",t[t.ITT_VIDEO_FRAME=1]=\"ITT_VIDEO_FRAME\"}(wt||(wt={})),function(t){t[t.PDFRM_VECTOR=1]=\"PDFRM_VECTOR\",t[t.PDFRM_RASTER=2]=\"PDFRM_RASTER\",t[t.PDFRM_REV=-2147483648]=\"PDFRM_REV\"}(Ct||(Ct={})),function(t){t[t.RDS_RASTERIZED_PAGES=0]=\"RDS_RASTERIZED_PAGES\",t[t.RDS_EXTRACTED_IMAGES=1]=\"RDS_EXTRACTED_IMAGES\"}(Et||(Et={})),function(t){t[t.CVS_NOT_VERIFIED=0]=\"CVS_NOT_VERIFIED\",t[t.CVS_PASSED=1]=\"CVS_PASSED\",t[t.CVS_FAILED=2]=\"CVS_FAILED\"}(Tt||(Tt={}));const St={IRUT_NULL:BigInt(0),IRUT_COLOUR_IMAGE:BigInt(1),IRUT_SCALED_DOWN_COLOUR_IMAGE:BigInt(2),IRUT_GRAYSCALE_IMAGE:BigInt(4),IRUT_TRANSOFORMED_GRAYSCALE_IMAGE:BigInt(8),IRUT_ENHANCED_GRAYSCALE_IMAGE:BigInt(16),IRUT_PREDETECTED_REGIONS:BigInt(32),IRUT_BINARY_IMAGE:BigInt(64),IRUT_TEXTURE_DETECTION_RESULT:BigInt(128),IRUT_TEXTURE_REMOVED_GRAYSCALE_IMAGE:BigInt(256),IRUT_TEXTURE_REMOVED_BINARY_IMAGE:BigInt(512),IRUT_CONTOURS:BigInt(1024),IRUT_LINE_SEGMENTS:BigInt(2048),IRUT_TEXT_ZONES:BigInt(4096),IRUT_TEXT_REMOVED_BINARY_IMAGE:BigInt(8192),IRUT_CANDIDATE_BARCODE_ZONES:BigInt(16384),IRUT_LOCALIZED_BARCODES:BigInt(32768),IRUT_SCALED_UP_BARCODE_IMAGE:BigInt(65536),IRUT_DEFORMATION_RESISTED_BARCODE_IMAGE:BigInt(1<<17),IRUT_COMPLEMENTED_BARCODE_IMAGE:BigInt(1<<18),IRUT_DECODED_BARCODES:BigInt(1<<19),IRUT_LONG_LINES:BigInt(1<<20),IRUT_CORNERS:BigInt(1<<21),IRUT_CANDIDATE_QUAD_EDGES:BigInt(1<<22),IRUT_DETECTED_QUADS:BigInt(1<<23),IRUT_LOCALIZED_TEXT_LINES:BigInt(1<<24),IRUT_RECOGNIZED_TEXT_LINES:BigInt(1<<25),IRUT_NORMALIZED_IMAGES:BigInt(1<<26),IRUT_SHORT_LINES:BigInt(1<<27),IRUT_RAW_TEXT_LINES:BigInt(1<<28),IRUT_LOGIC_LINES:BigInt(1<<29),IRUT_ALL:BigInt(\"0xFFFFFFFFFFFFFFFF\")};var bt,It;!function(t){t[t.ROET_PREDETECTED_REGION=0]=\"ROET_PREDETECTED_REGION\",t[t.ROET_LOCALIZED_BARCODE=1]=\"ROET_LOCALIZED_BARCODE\",t[t.ROET_DECODED_BARCODE=2]=\"ROET_DECODED_BARCODE\",t[t.ROET_LOCALIZED_TEXT_LINE=3]=\"ROET_LOCALIZED_TEXT_LINE\",t[t.ROET_RECOGNIZED_TEXT_LINE=4]=\"ROET_RECOGNIZED_TEXT_LINE\",t[t.ROET_DETECTED_QUAD=5]=\"ROET_DETECTED_QUAD\",t[t.ROET_NORMALIZED_IMAGE=6]=\"ROET_NORMALIZED_IMAGE\",t[t.ROET_SOURCE_IMAGE=7]=\"ROET_SOURCE_IMAGE\",t[t.ROET_TARGET_ROI=8]=\"ROET_TARGET_ROI\"}(bt||(bt={})),function(t){t[t.ST_NULL=0]=\"ST_NULL\",t[t.ST_REGION_PREDETECTION=1]=\"ST_REGION_PREDETECTION\",t[t.ST_BARCODE_LOCALIZATION=2]=\"ST_BARCODE_LOCALIZATION\",t[t.ST_BARCODE_DECODING=3]=\"ST_BARCODE_DECODING\",t[t.ST_TEXT_LINE_LOCALIZATION=4]=\"ST_TEXT_LINE_LOCALIZATION\",t[t.ST_TEXT_LINE_RECOGNITION=5]=\"ST_TEXT_LINE_RECOGNITION\",t[t.ST_DOCUMENT_DETECTION=6]=\"ST_DOCUMENT_DETECTION\",t[t.ST_DOCUMENT_NORMALIZATION=7]=\"ST_DOCUMENT_NORMALIZATION\"}(It||(It={}));var xt=Object.freeze({__proto__:null,CoreModule:gt,get EnumBufferOverflowProtectionMode(){return o},get EnumCapturedResultItemType(){return mt},get EnumColourChannelUsageType(){return a},get EnumCornerType(){return pt},get EnumCrossVerificationStatus(){return Tt},get EnumErrorCode(){return _t},get EnumGrayscaleEnhancementMode(){return vt},get EnumGrayscaleTransformationMode(){return yt},get EnumImagePixelFormat(){return h},get EnumImageTagType(){return wt},EnumIntermediateResultUnitType:St,get EnumPDFReadingMode(){return Ct},get EnumRasterDataSource(){return Et},get EnumRegionObjectElementType(){return bt},get EnumSectionType(){return It}
2,ImageSourceAdapter:z,_getNorImageData:M,_saveToFile:R,_toBlob:L,_toCanvas:D,_toImage:(t,e)=>{y(e)&&(e=M(e));const i=D(e);let r=new Image,n=i.toDataURL(t);return r.src=n,r},get bDebug(){return at},checkIsLink:t=>/^(https:\\/\\/www\\.|http:\\/\\/www\\.|https:\\/\\/|http:\\/\\/)|^[a-zA-Z0-9]{2,}(\\.[a-zA-Z0-9]{2,})(\\.[a-zA-Z0-9]{2,})?/.test(t),compareVersion:O,doOrWaitAsyncDependency:tt,getNextTaskID:rt,handleEngineResourcePaths:A,innerVersions:lt,isArc:t=>!(!_(t)||!p(t.x)||!p(t.y)||!p(t.radius)||t.radius<0||!p(t.startAngle)||!p(t.endAngle)),isContour:t=>!!_(t)&&!!g(t.points)&&0!=t.points.length&&!t.points.some((t=>!T(t))),isDSImageData:y,isDSRect:w,isImageTag:C,isLineSegment:E,isObject:_,isOriginalDsImageData:t=>!(!v(t)||!p(t.bytes.length)&&!p(t.bytes.ptr)),isPoint:T,isPolygon:S,isQuad:b,isRect:I,loadWasm:ft,mapAsyncDependency:Q,mapPackageRegister:ct,mapTaskCallBack:nt,get onLog(){return st},requestResource:x,setBDebug:ht,setOnLog:ot,waitAsyncDependency:$,get worker(){return et},workerAutoResources:ut});let Ot=\"./\";if(document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}Ot=t.substring(0,t.lastIndexOf(\"/\")+1)}function At(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}function Rt(t,e,i,r,n){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!n)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof e?t!==e||!n:!e.has(t))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}gt.engineResourcePaths={rootDirectory:(t=>{null==t&&(t=\"./\");let e=document.createElement(\"a\");return e.href=t,(t=e.href).endsWith(\"/\")||(t+=\"/\"),t})(Ot+\"../../\")},\"function\"==typeof SuppressedError&&SuppressedError;const Dt=t=>t&&\"object\"==typeof t&&\"function\"==typeof t.then,Lt=(async()=>{})().constructor;class Mt extends Lt{get status(){return this._s}get isPending(){return\"pending\"===this._s}get isFulfilled(){return\"fulfilled\"===this._s}get isRejected(){return\"rejected\"===this._s}get task(){return this._task}set task(t){let e;this._task=t,Dt(t)?e=t:\"function\"==typeof t&&(e=new Lt(t)),e&&(async()=>{try{const i=await e;t===this._task&&this.resolve(i)}catch(e){t===this._task&&this.reject(e)}})()}get isEmpty(){return null==this._task}constructor(t){let e,i;super(((t,r)=>{e=t,i=r})),this._s=\"pending\",this.resolve=t=>{this.isPending&&(Dt(t)?this.task=t:(this._s=\"fulfilled\",e(t)))},this.reject=t=>{this.isPending&&(this._s=\"rejected\",i(t))},this.task=t}}class Ft{constructor(t){this._cvr=t}async getMaxBufferedItems(){return await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success)return t(i.count);{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_getMaxBufferedItems\",id:i,instanceID:this._cvr._instanceID})}))}async setMaxBufferedItems(t){return await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success)return e();{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cvr_setMaxBufferedItems\",id:r,instanceID:this._cvr._instanceID,body:{count:t}})}))}async getBufferedCharacterItemSet(){return await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success)return t(i.itemSet);{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_getBufferedCharacterItemSet\",id:i,instanceID:this._cvr._instanceID})}))}}var Pt={onTaskResultsReceived:!1,onTaskResultsReceivedForDce:!1,onPredetectedRegionsReceived:!1,onLocalizedBarcodesReceived:!1,onDecodedBarcodesReceived:!1,onLocalizedTextLinesReceived:!1,onRecognizedTextLinesReceived:!1,onDetectedQuadsReceived:!1,onNormalizedImagesReceived:!1,onColourImageUnitReceived:!1,onScaledDownColourImageUnitReceived:!1,onGrayscaleImageUnitReceived:!1,onTransformedGrayscaleImageUnitReceived:!1,onEnhancedGrayscaleImageUnitReceived:!1,onBinaryImageUnitReceived:!1,onTextureDetectionResultUnitReceived:!1,onTextureRemovedGrayscaleImageUnitReceived:!1,onTextureRemovedBinaryImageUnitReceived:!1,onContoursUnitReceived:!1,onLineSegmentsUnitReceived:!1,onTextZonesUnitReceived:!1,onTextRemovedBinaryImageUnitReceived:!1,onRawTextLinesReceived:!1,onLongLinesUnitReceived:!1,onCornersUnitReceived:!1,onCandidateQuadEdgesUnitReceived:!1,onCandidateBarcodeZonesUnitReceived:!1,onScaledUpBarcodeImageUnitReceived:!1,onDeformationResistedBarcodeImageUnitReceived:!1,onComplementedBarcodeImageUnitReceived:!1,onShortLinesUnitReceived:!1,onLogicLinesReceived:!1};const kt=t=>{for(let e in t._irrRegistryState)t._irrRegistryState[e]=!1;for(let e of t._intermediateResultReceiverSet)if(e.isDce||e.isFilter)t._irrRegistryState.onTaskResultsReceivedForDce=!0;else for(let i in e)t._irrRegistryState[i]||(t._irrRegistryState[i]=!!e[i])};class Bt{constructor(t){this._irrRegistryState=Pt,this._intermediateResultReceiverSet=new Set,this._cvr=t}async addResultReceiver(t){if(\"object\"!=typeof t)throw new Error(\"Invalid receiver.\");this._intermediateResultReceiverSet.add(t),kt(this);let e=-1,i={};if(!t.isDce&&!t.isFilter){if(!t._observedResultUnitTypes||!t._observedTaskMap)throw new Error(\"Invalid Intermediate Result Receiver.\");
vendor: 4,859 bytes, line 2
2e=t._observedResultUnitTypes,t._observedTaskMap.forEach(((t,e)=>{i[e]=t})),t._observedTaskMap.clear()}return await new Promise(((t,r)=>{let n=rt();nt[n]=async e=>{if(e.success)return t();{let t=new Error(e.message);return t.stack=e.stack+\"\\n\"+t.stack,r(t)}},et.postMessage({type:\"cvr_setIrrRegistry\",id:n,instanceID:this._cvr._instanceID,body:{receiverObj:this._irrRegistryState,observedResultUnitTypes:e.toString(),observedTaskMap:i}})}))}async removeResultReceiver(t){return this._intermediateResultReceiverSet.delete(t),kt(this),await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success)return t();{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_setIrrRegistry\",id:i,instanceID:this._cvr._instanceID,body:{receiverObj:this._irrRegistryState}})}))}getOriginalImage(){return this._cvr._dsImage}}const Nt=\"undefined\"==typeof self,jt=\"function\"==typeof importScripts,Ut=(()=>{if(!jt){if(!Nt&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})(),Vt=t=>{if(null==t&&(t=\"./\"),Nt||jt);else{let e=document.createElement(\"a\");e.href=t,t=e.href}return t.endsWith(\"/\")||(t+=\"/\"),t};var Gt;gt.engineResourcePaths.cvr={version:\"2.4.33\",path:Ut,isInternal:!0},ut.cvr={js:!0,wasm:!0,deps:[\"license\",\"dip\"]},ct.cvr={};const Wt=\"1.4.21\";\"string\"!=typeof gt.engineResourcePaths.std&&O(gt.engineResourcePaths.std.version,Wt)<0&&(gt.engineResourcePaths.std={version:Wt,path:Vt(Ut+`../../dynamsoft-capture-vision-std@${Wt}/dist/`),isInternal:!0});const Yt=\"2.4.31\";(!gt.engineResourcePaths.dip||\"string\"!=typeof gt.engineResourcePaths.dip&&O(gt.engineResourcePaths.dip.version,Yt)<0)&&(gt.engineResourcePaths.dip={version:Yt,path:Vt(Ut+`../../dynamsoft-image-processing@${Yt}/dist/`),isInternal:!0});class Ht{static getVersion(){return this._version}}Ht._version=`2.4.33(Worker: ${null===(Gt=lt.cvr)||void 0===Gt?void 0:Gt.worker}, Wasm: loading...`;const Xt={barcodeResultItems:{type:mt.CRIT_BARCODE,reveiver:\"onDecodedBarcodesReceived\",isNeedFilter:!0},textLineResultItems:{type:mt.CRIT_TEXT_LINE,reveiver:\"onRecognizedTextLinesReceived\",isNeedFilter:!0},detectedQuadResultItems:{type:mt.CRIT_DETECTED_QUAD,reveiver:\"onDetectedQuadsReceived\",isNeedFilter:!1},normalizedImageResultItems:{type:mt.CRIT_NORMALIZED_IMAGE,reveiver:\"onNormalizedImagesReceived\",isNeedFilter:!1},parsedResultItems:{type:mt.CRIT_PARSED_RESULT,reveiver:\"onParsedResultsReceived\",isNeedFilter:!1}};var zt,Zt,qt,Kt,Jt,Qt,$t,te,ee,ie,re,ne,se;function oe(t,e){if(t&&t.location){const i=t.location.points;for(let t of i)t.x=t.x/e,t.y=t.y/e;oe(t.referencedItem,e)}}function ae(t){if(t.disposed)throw new Error('\"CaptureVisionRouter\" instance has been disposed')}!function(t){t[t.ISS_BUFFER_EMPTY=0]=\"ISS_BUFFER_EMPTY\",t[t.ISS_EXHAUSTED=1]=\"ISS_EXHAUSTED\"}(zt||(zt={}));const he={onTaskResultsReceived:()=>{},isFilter:!0};class le{constructor(){this.maxImageSideLength=[\"iPhone\",\"Android\",\"HarmonyOS\"].includes(gt.browserInfo.OS)?2048:4096,this._instanceID=void 0,this._dsImage=null,this._isPauseScan=!0,this._isOutputOriginalImage=!1,this._isOpenDetectVerify=!1,this._isOpenNormalizeVerify=!1,this._isOpenBarcodeVerify=!1,this._isOpenLabelVerify=!1,this._minImageCaptureInterval=0,this._averageProcessintTimeArray=[],this._averageFetchImageTimeArray=[],this._currentSettings=null,this._averageTime=999,Zt.set(this,null),qt.set(this,null),Kt.set(this,null),Jt.set(this,null),Qt.set(this,null),$t.set(this,new Set),te.set(this,new Set),ee.set(this,new Set),ie.set(this,0),re.set(this,!1),ne.set(this,!1),se.set(this,!1),this._singleFrameModeCallbackBind=this._singleFrameModeCallback.bind(this)}get disposed(){return At(this,se,\"f\")}static async createInstance(){if(!ct.license)throw Error(\"Module `license` is not existed.\");await ct.license.dynamsoft(),await ft([\"cvr\"]);const t=new le,e=new Mt;let i=rt();return nt[i]=async i=>{var r;if(i.success)t._instanceID=i.instanceID,t._currentSettings=JSON.parse(JSON.parse(i.outputSettings).data),Ht._version=`2.4.33(Worker: ${null===(r=lt.cvr)||void 0===r?void 0:r.worker}, Wasm: ${i.version})`,Rt(t,ne,!0,\"f\"),Rt(t,Jt,t.getIntermediateResultManager(),\"f\"),Rt(t,ne,!1,\"f\"),e.resolve(t);else{const t=Error(i.message);i.stack&&(t.stack=i.stack),e.reject(t)}},et.postMessage({type:\"cvr_createInstance\",id:i}),e}async _singleFrameModeCallback(t){for(let e of At(this,$t,\"f\"))this._isOutputOriginalImage&&e.onOriginalImageResultReceived&&e.onOriginalImageResultReceived({imageData:t});const e={bytes:new Uint8Array(t.bytes),width:t.width,height:t.height,stride:t.stride,format:t.format,tag:t.tag};this._templateName||(this._templateName=this._currentSettings.Capture
2VisionTemplates[0].Name);const i=await this.capture(e,this._templateName);i.originalImageTag=t.tag;const r={originalImageHashId:i.originalImageHashId,originalImageTag:i.originalImageTag,errorCode:i.errorCode,errorString:i.errorString};for(let t of At(this,$t,\"f\"))if(t.isDce)t.onCapturedResultReceived(i,{isDetectVerifyOpen:!1,isNormalizeVerifyOpen:!1,isBarcodeVerifyOpen:!1,isLabelVerifyOpen:!1});else{for(let e in Xt){const n=e,s=Xt[n];t[s.reveiver]&&i[n]&&t[s.reveiver](Object.assign(Object.assign({},r),{[n]:i[n]}))}t.onCapturedResultReceived&&t.onCapturedResultReceived(i)}}setInput(t){if(ae(this),t){if(Rt(this,Zt,t,\"f\"),t.isCameraEnhancer){At(this,Jt,\"f\")&&(At(this,Zt,\"f\")._intermediateResultReceiver.isDce=!0,At(this,Jt,\"f\").addResultReceiver(At(this,Zt,\"f\")._intermediateResultReceiver));const t=At(this,Zt,\"f\").getCameraView();if(t){const e=t._capturedResultReceiver;e.isDce=!0,At(this,$t,\"f\").add(e)}}}else Rt(this,Zt,null,\"f\")}getInput(){return At(this,Zt,\"f\")}addImageSourceStateListener(t){if(ae(this),\"object\"!=typeof t)return console.warn(\"Invalid ISA state listener.\");t&&Object.keys(t)&&At(this,te,\"f\").add(t)}removeImageSourceStateListener(t){return ae(this),At(this,te,\"f\").delete(t)}addResultReceiver(t){if(ae(this),\"object\"!=typeof t)throw new Error(\"Invalid receiver.\");t&&Object.keys(t).length&&(At(this,$t,\"f\").add(t),this._setCrrRegistry())}removeResultReceiver(t){ae(this),At(this,$t,\"f\").delete(t),this._setCrrRegistry()}async _setCrrRegistry(){const t={onCapturedResultReceived:!1,onDecodedBarcodesReceived:!1,onRecognizedTextLinesReceived:!1,onDetectedQuadsReceived:!1,onNormalizedImagesReceived:!1,onParsedResultsReceived:!1};for(let e of At(this,$t,\"f\"))e.isDce||(t.onCapturedResultReceived=!!e.onCapturedResultReceived,t.onDecodedBarcodesReceived=!!e.onDecodedBarcodesReceived,t.onRecognizedTextLinesReceived=!!e.onRecognizedTextLinesReceived,t.onDetectedQuadsReceived=!!e.onDetectedQuadsReceived,t.onNormalizedImagesReceived=!!e.onNormalizedImagesReceived,t.onParsedResultsReceived=!!e.onParsedResultsReceived);const e=new Mt;let i=rt();return nt[i]=async t=>{if(t.success)e.resolve();else{let i=new Error(t.message);i.stack=t.stack+\"\\n\"+i.stack,e.reject()}},et.postMessage({type:\"cvr_setCrrRegistry\",id:i,instanceID:this._instanceID,body:{receiver:JSON.stringify(t)}}),e}async addResultFilter(t){if(ae(this),!t||\"object\"!=typeof t||!Object.keys(t).length)return console.warn(\"Invalid filter.\");At(this,ee,\"f\").add(t),t._dynamsoft(),await this._handleFilterUpdate()}async removeResultFilter(t){ae(this),At(this,ee,\"f\").delete(t),await this._handleFilterUpdate()}async _handleFilterUpdate(){if(At(this,Jt,\"f\").removeResultReceiver(he),0===At(this,ee,\"f\").size){this._isOpenBarcodeVerify=!1,this._isOpenLabelVerify=!1,this._isOpenDetectVerify=!1,this._isOpenNormalizeVerify=!1;const t={[mt.CRIT_BARCODE]:!1,[mt.CRIT_TEXT_LINE]:!1,[mt.CRIT_DETECTED_QUAD]:!1,[mt.CRIT_NORMALIZED_IMAGE]:!1},e={[mt.CRIT_BARCODE]:!1,[mt.CRIT_TEXT_LINE]:!1,[mt.CRIT_DETECTED_QUAD]:!1,[mt.CRIT_NORMALIZED_IMAGE]:!1};return await ce(this,t),void await ue(this,e)}for(let t of At(this,ee,\"f\")){if(this._isOpenBarcodeVerify=t.isResultCrossVerificationEnabled(mt.CRIT_BARCODE),this._isOpenLabelVerify=t.isResultCrossVerificationEnabled(mt.CRIT_TEXT_LINE),this._isOpenDetectVerify=t.isResultCrossVerificationEnabled(mt.CRIT_DETECTED_QUAD),this._isOpenNormalizeVerify=t.isResultCrossVerificationEnabled(mt.CRIT_NORMALIZED_IMAGE),t.isLatestOverlappingEnabled(mt.CRIT_BARCODE)){[...At(this,Jt,\"f\")._intermediateResultReceiverSet.values()].find((t=>t.isFilter))||At(this,Jt,\"f\").addResultReceiver(he)}await ce(this,t.verificationEnabled),await ue(this,t.duplicateFilterEnabled),await de(this,t.duplicateForgetTime)}}async startCapturing(t){var e,i;if(ae(this),!this._isPauseScan)return;if(!At(this,Zt,\"f\"))throw new Error(\"'ImageSourceAdapter' is not set. call 'setInput' before 'startCapturing'\");t||(t=le._defaultTemplate);const r=await this.containsTask(t);await ft(r);for(let t of At(this,ee,\"f\"))await this.addResultFilter(t);if(r.includes(\"dlr\")&&!(null===(e=ct.dlr)||void 0===e?void 0:e.bLoadConfusableCharsData)){const t=A(gt.engineResourcePaths);await(null===(i=ct.dlr)||void 0===i?void 0:i.loadRecognitionData(\"ConfusableChars\",t.dlr))}if(At(this,Zt,\"f\").isCameraEnhancer&&(r.includes(\"ddn\")?At(this,Zt,\"f\").setPixelFormat(h.IPF_ABGR_8888):At(this,Zt,\"f\").setPixelFormat(h.IPF_GRAYSCALED)),void 0!==At(this,Zt,\"f\").singleFrameMode&&\"disabled\"!==At(this,Zt,\"f\").singleFrameMode)return this._templateName=t,void At(this,Zt,\"f\").on(\"singleFrameAcquired\",this._singleFrameModeCallbackBind);return At(this,Zt,\"f\").getColourChannelUsageType()===a.CCUT_AUTO&&At(this,Zt,\"f\").setColourChannelUsageType(r.includes(\"ddn\")?a.CCUT_FULL_CHANNEL:a.CCUT_Y_CHA
2NNEL_ONLY),At(this,Kt,\"f\")&&At(this,Kt,\"f\").isPending?At(this,Kt,\"f\"):(Rt(this,Kt,new Mt(((e,i)=>{if(this.disposed)return;let r=rt();nt[r]=async r=>{if(At(this,Kt,\"f\")&&!At(this,Kt,\"f\").isFulfilled){if(!r.success){let t=new Error(r.message);return t.stack=r.stack+\"\\n\"+t.stack,i(t)}this._isPauseScan=!1,this._isOutputOriginalImage=r.isOutputOriginalImage,this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((async()=>{-1!==this._minImageCaptureInterval&&At(this,Zt,\"f\").startFetching(),this._loopReadVideo(t),e()}),0)}},et.postMessage({type:\"cvr_startCapturing\",id:r,instanceID:this._instanceID,body:{templateName:t}})})),\"f\"),await At(this,Kt,\"f\"))}stopCapturing(){ae(this),At(this,Zt,\"f\")&&(At(this,Zt,\"f\").isCameraEnhancer&&void 0!==At(this,Zt,\"f\").singleFrameMode&&\"disabled\"!==At(this,Zt,\"f\").singleFrameMode?At(this,Zt,\"f\").off(\"singleFrameAcquired\",this._singleFrameModeCallbackBind):(!async function(t){let e=rt();const i=new Mt;nt[e]=async t=>{if(t.success)return i.resolve();{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i.reject(e)}},et.postMessage({type:\"cvr_clearVerifyList\",id:e,instanceID:t._instanceID})}(this),At(this,Zt,\"f\").stopFetching(),this._averageProcessintTimeArray=[],this._averageTime=999,this._isPauseScan=!0,Rt(this,Kt,null,\"f\"),At(this,Zt,\"f\").setColourChannelUsageType(a.CCUT_AUTO)))}async containsTask(t){return ae(this),await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success)return e(JSON.parse(t.tasks));{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cvr_containsTask\",id:r,instanceID:this._instanceID,body:{templateName:t}})}))}async _loopReadVideo(t){if(this.disposed||this._isPauseScan)return;if(Rt(this,re,!0,\"f\"),At(this,Zt,\"f\").isBufferEmpty())if(At(this,Zt,\"f\").hasNextImageToFetch())for(let t of At(this,te,\"f\"))t.onImageSourceStateReceived&&t.onImageSourceStateReceived(zt.ISS_BUFFER_EMPTY);else if(!At(this,Zt,\"f\").hasNextImageToFetch())for(let t of At(this,te,\"f\"))t.onImageSourceStateReceived&&t.onImageSourceStateReceived(zt.ISS_EXHAUSTED);if(-1===this._minImageCaptureInterval||At(this,Zt,\"f\").isBufferEmpty())try{At(this,Zt,\"f\").isBufferEmpty()&&le._onLog&&le._onLog(\"buffer is empty so fetch image\"),le._onLog&&le._onLog(`DCE: start fetching a frame: ${Date.now()}`),this._dsImage=At(this,Zt,\"f\").fetchImage(),le._onLog&&le._onLog(`DCE: finish fetching a frame: ${Date.now()}`),At(this,Zt,\"f\").setImageFetchInterval(this._averageTime)}catch(e){return void this._reRunCurrnetFunc(t)}else if(At(this,Zt,\"f\").setImageFetchInterval(this._averageTime-(this._dsImage&&this._dsImage.tag?this._dsImage.tag.timeSpent:0)),this._dsImage=At(this,Zt,\"f\").getImage(),this._dsImage.tag&&Date.now()-this._dsImage.tag.timeStamp>200)return void this._reRunCurrnetFunc(t);if(!this._dsImage)return void this._reRunCurrnetFunc(t);for(let t of At(this,$t,\"f\"))this._isOutputOriginalImage&&t.onOriginalImageResultReceived&&t.onOriginalImageResultReceived({imageData:this._dsImage});const e=Date.now();this._captureDsimage(this._dsImage,t).then((async i=>{if(le._onLog&&le._onLog(\"no js handle time: \"+(Date.now()-e)),this._isPauseScan)return void this._reRunCurrnetFunc(t);i.originalImageTag=this._dsImage.tag?this._dsImage.tag:null;const r={originalImageHashId:i.originalImageHashId,originalImageTag:i.originalImageTag,errorCode:i.errorCode,errorString:i.errorString};for(let t of At(this,$t,\"f\"))if(t.isDce){const e=Date.now();if(t.onCapturedResultReceived(i,{isDetectVerifyOpen:this._isOpenDetectVerify,isNormalizeVerifyOpen:this._isOpenNormalizeVerify,isBarcodeVerifyOpen:this._isOpenBarcodeVerify,isLabelVerifyOpen:this._isOpenLabelVerify}),le._onLog){const t=Date.now()-e;t>10&&le._onLog(`draw result time: ${t}`)}}else{for(let e in Xt){const n=e,s=Xt[n];t[s.reveiver],t[s.reveiver]&&i[n]&&t[s.reveiver](Object.assign(Object.assign({},r),{[n]:i[n].filter((t=>!s.isNeedFilter||!t.isFilter))})),i[n]&&(i[n]=i[n].filter((t=>!s.isNeedFilter||!t.isFilter)))}t.onCapturedResultReceived&&(i.items=i.items.filter((t=>[mt.CRIT_DETECTED_QUAD,mt.CRIT_NORMALIZED_IMAGE].includes(t.type)||!t.isFilter)),t.onCapturedResultReceived(i))}const n=Date.now();if(this._minImageCaptureInterval>-1&&(5===this._averageProcessintTimeArray.length&&this._averageProcessintTimeArray.shift(),5===this._averageFetchImageTimeArray.length&&this._averageFetchImageTimeArray.shift(),this._averageProcessintTimeArray.push(Date.now()-e),this._averageFetchImageTimeArray.push(this._dsImage&&this._dsImage.tag?this._dsImage.tag.timeSpent:0),this._averageTime=Math.min(...this._averageProcessintTimeArray)-Math.max(...this._averageFetchImageTimeArray),this._averageTime=this._averageTime>0?this._averageTime:0,le._onLog&&(le._onLog(`minImageCaptureInterval: ${this._minImageCaptureInterval}`),le._onLog(`averageProcessintTimeArray: ${this._averageProcessintTimeArray}`),le._onLog(`averageFetchImageTimeArray: ${this._averageFetchImageTimeArray}`),le._onLog(`averageTime: ${this._averageTime}`))),le._onLog){const t=Date.now()-n;t>10&&le._onLog(`fetch image calculate time: ${t}`)}le._onLog&&le._onLog(`time finish decode: ${Date.now()}`),le._onLog&&le._onLog(\"main time: \"+(Date.now()-e)),le._onLog&&le._onLog(\"====================================================\"),this._loopReadVideoT
2imeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._minImageCaptureInterval>0&&this._minImageCaptureInterval>=this._averageTime?this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo(t)}),this._minImageCaptureInterval-this._averageTime):this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo(t)}),Math.max(this._minImageCaptureInterval,0))})).catch((e=>{At(this,Zt,\"f\").stopFetching(),e.errorCode&&0===e.errorCode&&(this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((()=>{At(this,Zt,\"f\").startFetching(),this._loopReadVideo(t)}),Math.max(this._minImageCaptureInterval,1e3))),\"platform error\"!==e.message&&setTimeout((()=>{throw e}),0)}))}_reRunCurrnetFunc(t){this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo(t)}),0)}async capture(t,e){var i,r;ae(this),e||(e=le._defaultTemplate);const n=await this.containsTask(e);if(await ft(n),n.includes(\"dlr\")&&!(null===(i=ct.dlr)||void 0===i?void 0:i.bLoadConfusableCharsData)){const t=A(gt.engineResourcePaths);await(null===(r=ct.dlr)||void 0===r?void 0:r.loadRecognitionData(\"ConfusableChars\",t.dlr))}let s;if(Rt(this,re,!1,\"f\"),y(t))s=await this._captureDsimage(t,e);else if(\"string\"==typeof t)s=\"data:image/\"==t.substring(0,11)?await this._captureBase64(t,e):await this._captureUrl(t,e);else if(t instanceof Blob)s=await this._captureBlob(t,e);else if(t instanceof HTMLImageElement)s=await this._captureImage(t,e);else if(t instanceof HTMLCanvasElement)s=await this._captureCanvas(t,e);else{if(!(t instanceof HTMLVideoElement))throw new TypeError(\"'capture(imageOrFile, templateName)': Type of 'imageOrFile' should be 'DSImageData', 'Url', 'Base64', 'Blob', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement'.\");s=await this._captureVideo(t,e)}return s}async _captureDsimage(t,e){return await this._captureInWorker(t,e)}async _captureUrl(t,e){let i=await x(t,\"blob\");return await this._captureBlob(i,e)}async _captureBase64(t,e){t=t.substring(t.indexOf(\",\")+1);let i=atob(t),r=i.length,n=new Uint8Array(r);for(;r--;)n[r]=i.charCodeAt(r);return await this._captureBlob(new Blob([n]),e)}async _captureBlob(t,e){let i=null,r=null;if(\"undefined\"!=typeof createImageBitmap)try{i=await createImageBitmap(t)}catch(t){}i||(r=await async function(t){return await new Promise(((e,i)=>{let r=URL.createObjectURL(t),n=new Image;n.src=r,n.onload=()=>{URL.revokeObjectURL(n.dbrObjUrl),e(n)},n.onerror=t=>{i(new Error(\"Can't convert blob to image : \"+(t instanceof Event?t.type:t)))}}))}(t));let n=await this._captureImage(i||r,e);return i&&i.close(),n}async _captureImage(t,e){let i,r,n=t instanceof HTMLImageElement?t.naturalWidth:t.width,s=t instanceof HTMLImageElement?t.naturalHeight:t.height,o=Math.max(n,s);o>this.maxImageSideLength?(Rt(this,ie,this.maxImageSideLength/o,\"f\"),i=Math.round(n*At(this,ie,\"f\")),r=Math.round(s*At(this,ie,\"f\"))):(i=n,r=s),At(this,qt,\"f\")||Rt(this,qt,document.createElement(\"canvas\"),\"f\");const a=At(this,qt,\"f\");a.width===i&&a.height===r||(a.width=i,a.height=r),a.ctx2d||(a.ctx2d=a.getContext(\"2d\",{willReadFrequently:!0}));return a.ctx2d.drawImage(t,0,0,n,s,0,0,i,r),t.dbrObjUrl&&URL.revokeObjectURL(t.dbrObjUrl),await this._captureCanvas(a,e)}async _captureCanvas(t,e){if(t.crossOrigin&&\"anonymous\"!=t.crossOrigin)throw\"cors\";if([t.width,t.height].includes(0))throw Error(\"The width or height of the 'canvas' is 0.\");const i=t.ctx2d||t.getContext(\"2d\",{willReadFrequently:!0}),r={bytes:Uint8Array.from(i.getImageData(0,0,t.width,t.height).data),width:t.width,height:t.height,stride:4*t.width,format:10};return await this._captureInWorker(r,e)}async _captureVideo(t,e){if(t.crossOrigin&&\"anonymous\"!=t.crossOrigin)throw\"cors\";let i,r,n=t.videoWidth,s=t.videoHeight,o=Math.max(n,s);o>this.maxImageSideLength?(Rt(this,ie,this.maxImageSideLength/o,\"f\"),i=Math.round(n*At(this,ie,\"f\")),r=Math.round(s*At(this,ie,\"f\"))):(i=n,r=s),At(this,qt,\"f\")||Rt(this,qt,document.createElement(\"canvas\"),\"f\");const a=At(this,qt,\"f\");a.width===i&&a.height===r||(a.width=i,a.height=r),a.ctx2d||(a.ctx2d=a.getContext(\"2d\",{willReadFrequently:!0}));return a.ctx2d.drawImage(t,0,0,n,s,0,0,i,r),await this._captureCanvas(a,e)}async _captureInWorker(t,e){const{bytes:i,width:r,height:n,stride:s,format:o}=t;let a=rt();const h=new Mt;return nt[a]=async e=>{var i,r;if(!e.success){let t=new Error(e.message);return t.stack=e.stack+\"\\n\"+t.stack,h.reject(t)}{const n=Date.now();le._onLog&&(le._onLog(`get result time from worker: ${n}`),le._onLog(\"worker to main time consume: \"+(n-e.workerReturnMsgTime)));try{const n=e.captureResult;if(0!==n.errorCode){let t=new Error(n.errorString);return t.errorCode=n.errorCode,h.reject(t)}t.bytes=e.bytes;for(let e of n.items)0!==At(this,ie,\"f\")&&oe(e,At(this,ie,\"f\")),e.type===mt.CRIT_ORIGINAL_IMAGE?e.imageData=t:e.type===mt.CRIT_NORMALIZED_IMAGE?null===(i=ct.ddn)||void 0===i||i.handleNormalizedImageResultItem(e):e.type===mt.CRIT_PARSED_RESULT&&(null===(r=ct.dcp)||void 0===r||r.handleParsedResultItem(e));if(At(this,re,\"f\"))for(let t of At(this,ee,\"f\"))t.onDecodedBarcodesReceived(n),t.onRecognizedTextLinesReceived(n),t.onDetectedQuadsReceived(n),t.onNormalizedImagesReceived(n);for(let t in Xt){const e=t,i=n.items.filter((t=>t.type===Xt[e].type));i.length&&(n[t]=i)}if(!this._isPauseScan||!At(this,re,\"f\")){const e=n.intermediateResult;if(e){let i=0;for(let r of At(this,Jt,\"f\")._intermediateResultReceiverSet){i++;for(let n of e){if(\"onTaskResultsReceived\"===n.info.callbackName){for(let e of n.intermediateResultUnits)e.originalImageTag=t.tag?t.tag:null;r[n.info.callbackName]&&r[n.info.callbackName]({intermediateResultUnits:n.intermediateResultUnits},n.info)}else r[n.info.callbackName]&&r[n.info.callbackName](n.result,n.info);i===At(this,Jt,\"f\")._intermediateResultReceiverSet.size&&delete n.info.callbackName}}}}return n&&n.hasOwnProperty(\"intermediateResult\")&&delete n.intermediateResult,Rt(this,ie,0,\"f\"),h.resolve(n)}catch(t){return h.reject(t)}}},le._onLog&&le._onLog(`send buffer to worker: ${Date.now()}`),et.postMessage({type:\"cvr_capture\",id:a,instanceID:this._instanceID,body:{bytes:i,width:r,height:n,stride:s,format:o,templateName:e||\"\",isScanner:At(this,re,\"f\")}},[i.buffer]),h}async initSettings(t){return ae(this),t&&[\"string\",\"object\"].includes(typeof t)?(\"string\"
2==typeof t?t.trimStart().startsWith(\"{\")||(t=await x(t,\"text\")):\"object\"==typeof t&&(t=JSON.stringify(t)),await new Promise(((e,i)=>{let r=rt();nt[r]=async r=>{if(r.success){const n=JSON.parse(r.response);if(0!==n.errorCode){let t=new Error(n.errorString?n.errorString:\"Init Settings Failed.\");return t.errorCode=n.errorCode,i(t)}const s=JSON.parse(t);this._currentSettings=s;let o=[],a=s.CaptureVisionTemplates;for(let t=0;t<a.length;t++){let e=await this.containsTask(a[t].Name);o=o.concat(e)}return await ft([...new Set(o)]),this._isOutputOriginalImage=1===this._currentSettings.CaptureVisionTemplates[0].OutputOriginalImage,le._defaultTemplate=this._currentSettings.CaptureVisionTemplates[0].Name,e(n)}{let t=new Error(r.message);return t.stack=r.stack+\"\\n\"+t.stack,i(t)}},et.postMessage({type:\"cvr_initSettings\",id:r,instanceID:this._instanceID,body:{settings:t}})}))):console.error(\"Invalid template.\")}async outputSettings(t){return ae(this),await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success){const r=JSON.parse(t.response);if(0!==r.errorCode){let t=new Error(r.errorString);return t.errorCode=r.errorCode,i(t)}return e(JSON.parse(r.data))}{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cvr_outputSettings\",id:r,instanceID:this._instanceID,body:{templateName:t||\"*\"}})}))}async outputSettingsToFile(t,e,i){const r=await this.outputSettings(t),n=new Blob([JSON.stringify(r,null,2,(function(t,e){return e instanceof Array?JSON.stringify(e):e}),2)],{type:\"application/json\"});if(i){const t=document.createElement(\"a\");t.href=URL.createObjectURL(n),e.endsWith(\".json\")&&(e=e.replace(\".json\",\"\")),t.download=`${e}.json`,t.onclick=()=>{setTimeout((()=>{URL.revokeObjectURL(t.href)}),500)},t.click()}return n}async getTemplateNames(){return ae(this),await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success){const r=JSON.parse(i.response);if(0!==r.errorCode){let t=new Error(r.errorString);return t.errorCode=r.errorCode,e(t)}return t(JSON.parse(r.data))}{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_getTemplateNames\",id:i,instanceID:this._instanceID})}))}async getSimplifiedSettings(t){ae(this),t||(t=this._currentSettings.CaptureVisionTemplates[0].Name);const e=await this.containsTask(t);return await ft(e),await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success){const r=JSON.parse(t.response);if(0!==r.errorCode){let t=new Error(r.errorString);return t.errorCode=r.errorCode,i(t)}const n=JSON.parse(r.data,((t,e)=>\"barcodeFormatIds\"===t?BigInt(e):e));return n.minImageCaptureInterval=this._minImageCaptureInterval,e(n)}{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cvr_getSimplifiedSettings\",id:r,instanceID:this._instanceID,body:{templateName:t}})}))}async updateSettings(t,e){ae(this);const i=await this.containsTask(t);return await ft(i),await new Promise(((i,r)=>{let n=rt();nt[n]=async t=>{if(t.success){const n=JSON.parse(t.response);if(e.minImageCaptureInterval&&e.minImageCaptureInterval>=-1&&(this._minImageCaptureInterval=e.minImageCaptureInterval),this._isOutputOriginalImage=t.isOutputOriginalImage,0!==n.errorCode){let t=new Error(n.errorString?n.errorString:\"Update Settings Failed.\");return t.errorCode=n.errorCode,r(t)}return this._currentSettings=await this.outputSettings(\"*\"),i(n)}{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,r(e)}},et.postMessage({type:\"cvr_updateSettings\",id:n,instanceID:this._instanceID,body:{settings:e,templateName:t}})}))}async resetSettings(){return ae(this),await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success){const r=JSON.parse(i.response);if(0!==r.errorCode){let t=new Error(r.errorString?r.errorString:\"Reset Settings Failed.\");return t.errorCode=r.errorCode,e(t)}return this._currentSettings=await this.outputSettings(\"*\"),t(r)}{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_resetSettings\",id:i,instanceID:this._instanceID})}))}getBufferedItemsManager(){return At(this,Qt,\"f\")||Rt(this,Qt,new Ft(this),\"f\"),At(this,Qt,\"f\")}getIntermediateResultManager(){if(ae(this),!At(this,ne,\"f\")&&0!==gt.bSupportIRTModule)throw new Error(\"The current license does not support the use of intermediate results.\");return At(this,Jt,\"f\")||Rt(this,Jt,new Bt(this),\"f\"),At(this,Jt,\"f\")}async parseRequiredResources(t){return ae(this),await new Promise(((e,i)=>{let r=rt();nt[r]=async t=>{if(t.success)return e(JSON.parse(t.resources));{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,i(e)}},et.postMessage({type:\"cvr_parseRequiredResources\",id:r,instanceID:this._instanceID,body:{templateName:t}})}))}async dispose(){ae(this),At(this,Kt,\"f\")&&this.stopCapturing(),Rt(this,Zt,null,\"f\"),At(this,$t,\"f\").clear(),At(this,te,\"f\").clear(),At(this,ee,\"f\").clear(),At(this,Jt,\"f\")._intermediateResultReceiverSet.clear(),Rt(this,se,!0,\"f\");let t=rt();nt[t]=t=>{if(!t.success){let e=new Error(t.message);throw e.stack=t.stack+\"\\n\"+e.stack,e}},et.postMessage({type:\"cvr_dispose\",id:t,instanceID:this._instanceID})}_getInternalData(){return{isa:At(this,Zt,\"f\"),promiseStartScan:At(this,Kt,\"f\"),intermediateResultManager:At(this,Jt,\"f\"),bufferdItemsManager:At(this,Qt,\"f\"),resultReceiverSet:At(this,$t,\"f\"),isaStateListenerSet:At(this,te,\"f\"),resultFilterSet:At(this,ee,\"f\"),compressRate:At(this,ie,\"f\"),canvas:At(this,qt,\"f\"),isScanner:At(this,re,\"f\"),innerUseTag:At(this,ne,\"f\"),isDestroyed:At(this,se,\"f\")}}async _getWasmFilterState(){return await new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success){const e=JSON.parse(i.response);return t(e)}{let t=new Error(i.message);return t.stack=i.stack+\"\\n\"+t.stack,e(t)}},et.postMessage({type:\"cvr_getWasmFilterState\",id:i,instanceID:this._instanceID})}))}}async function ce(t,e){return ae(t),await new Promise(((i,r)=>{let n=rt();nt[n]=async t=>{if(t.success)return i(t.result);{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,r(e)}},et.postMessage({type:\"cvr_enableResultCrossVerification\",id:n,instanceID:t._instanceID,body:{verificationEnabled:e}})}
2))}async function ue(t,e){return ae(t),await new Promise(((i,r)=>{let n=rt();nt[n]=async t=>{if(t.success)return i(t.result);{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,r(e)}},et.postMessage({type:\"cvr_enableResultDeduplication\",id:n,instanceID:t._instanceID,body:{duplicateFilterEnabled:e}})}))}async function de(t,e){return ae(t),await new Promise(((i,r)=>{let n=rt();nt[n]=async t=>{if(t.success)return i(t.result);{let e=new Error(t.message);return e.stack=t.stack+\"\\n\"+e.stack,r(e)}},et.postMessage({type:\"cvr_setDuplicateForgetTime\",id:n,instanceID:t._instanceID,body:{duplicateForgetTime:e}})}))}Zt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,$t=new WeakMap,te=new WeakMap,ee=new WeakMap,ie=new WeakMap,re=new WeakMap,ne=new WeakMap,se=new WeakMap,le._defaultTemplate=\"Default\";var fe;!function(t){t.PT_DEFAULT=\"Default\",t.PT_READ_BARCODES=\"ReadBarcodes_Default\",t.PT_RECOGNIZE_TEXT_LINES=\"RecognizeTextLines_Default\",t.PT_DETECT_DOCUMENT_BOUNDARIES=\"DetectDocumentBoundaries_Default\",t.PT_DETECT_AND_NORMALIZE_DOCUMENT=\"DetectAndNormalizeDocument_Default\",t.PT_NORMALIZE_DOCUMENT=\"NormalizeDocument_Default\",t.PT_READ_BARCODES_SPEED_FIRST=\"ReadBarcodes_SpeedFirst\",t.PT_READ_BARCODES_READ_RATE_FIRST=\"ReadBarcodes_ReadRateFirst\",t.PT_READ_BARCODES_BALANCE=\"ReadBarcodes_Balance\",t.PT_READ_SINGLE_BARCODE=\"ReadBarcodes_Balanced\",t.PT_READ_DENSE_BARCODES=\"ReadDenseBarcodes\",t.PT_READ_DISTANT_BARCODES=\"ReadDistantBarcodes\",t.PT_RECOGNIZE_NUMBERS=\"RecognizeNumbers\",t.PT_RECOGNIZE_LETTERS=\"RecognizeLetters\",t.PT_RECOGNIZE_NUMBERS_AND_LETTERS=\"RecognizeNumbersAndLetters\",t.PT_RECOGNIZE_NUMBERS_AND_UPPERCASE_LETTERS=\"RecognizeNumbersAndUppercaseLetters\",t.PT_RECOGNIZE_UPPERCASE_LETTERS=\"RecognizeUppercaseLetters\"}(fe||(fe={}));var ge=Object.freeze({__proto__:null,CaptureVisionRouter:le,CaptureVisionRouterModule:Ht,CapturedResultReceiver:class{constructor(){this.onCapturedResultReceived=null,this.onOriginalImageResultReceived=null}},get EnumImageSourceState(){return zt},get EnumPresetTemplate(){return fe},IntermediateResultReceiver:class{constructor(){this._observedResultUnitTypes=St.IRUT_ALL,this._observedTaskMap=new Map,this._parameters={setObservedResultUnitTypes:t=>{this._observedResultUnitTypes=t},getObservedResultUnitTypes:()=>this._observedResultUnitTypes,isResultUnitTypeObserved:t=>!!(t&this._observedResultUnitTypes),addObservedTask:t=>{this._observedTaskMap.set(t,!0)},removeObservedTask:t=>{this._observedTaskMap.set(t,!1)},isTaskObserved:t=>0===this._observedTaskMap.size||!!this._observedTaskMap.get(t)},this.onTaskResultsReceived=null,this.onPredetectedRegionsReceived=null,this.onColourImageUnitReceived=null,this.onScaledDownColourImageUnitReceived=null,this.onGrayscaleImageUnitReceived=null,this.onTransformedGrayscaleImageUnitReceived=null,this.onEnhancedGrayscaleImageUnitReceived=null,this.onBinaryImageUnitReceived=null,this.onTextureDetectionResultUnitReceived=null,this.onTextureRemovedGrayscaleImageUnitReceived=null,this.onTextureRemovedBinaryImageUnitReceived=null,this.onContoursUnitReceived=null,this.onLineSegmentsUnitReceived=null,this.onTextZonesUnitReceived=null,this.onTextRemovedBinaryImageUnitReceived=null,this.onShortLinesUnitReceived=null}getObservationParameters(){return this._parameters}}});const me=\"undefined\"==typeof self,pe=me?{}:self,_e=\"function\"==typeof importScripts,ve=(()=>{if(!_e){if(!me&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})(),ye=t=>t&&\"object\"==typeof t&&\"function\"==typeof t.then,we=(async()=>{})().constructor;let Ce=class extends we{get status(){return this._s}get isPending(){return\"pending\"===this._s}get isFulfilled(){return\"fulfilled\"===this._s}get isRejected(){return\"rejected\"===this._s}get task(){return this._task}set task(t){let e;this._task=t,ye(t)?e=t:\"function\"==typeof t&&(e=new we(t)),e&&(async()=>{try{const i=await e;t===this._task&&this.resolve(i)}catch(e){t===this._task&&this.reject(e)}})()}get isEmpty(){return null==this._task}constructor(t){let e,i;super(((t,r)=>{e=t,i=r})),this._s=\"pending\",this.resolve=t=>{this.isPending&&(ye(t)?this.task=t:(this._s=\"fulfilled\",e(t)))},this.reject=t=>{this.isPending&&(this._s=\"rejected\",i(t))},this.task=t}};const Ee=\" is not allowed to change after `createInstance` or `loadWasm` is called.\",Te=!me&&document.currentScript&&(document.currentScript.getAttribute(\"data-license\")||document.currentScript.getAttribute(\"data-productKeys\")||document.currentScript.getAttribute(\"data-licenseKey\")||document.currentScript.getAttribute(\"data-handshakeCode\")||document.currentScript.getAttribute(\"data-organizationID\"))||\"\",Se=(t,e)=>{const i=t;if(i._license!==e){if(!i._pLoad.isEmpty)throw new Error(\"`license`\"+Ee);i._license=e}};!me&&document.currentScript&&document.currentScript.getAttribute(\"data-sessionPassword\");const be=t=>{if(null==t)t=[];else{t=t instanceof Array?[...t]:[t];for(let e=0;e<t.length;++e){if(!me){let i=document.createElement(\"a\");i.href=t[e],t[e]=i.href}t[e].endsWith(\"/\")||(t[e]+=\"/\")}}return t},Ie=(t,e)=>{e=be(e);const i=t;if(i._licenseServer!==e){if(!i._pLoad.isEmpty)throw new Error(\"`licenseServer`\"+Ee);i._licenseServer=e}},xe=(t,e)=>{e=e||\"\";const i=t;if(i._deviceFriendlyName!==e){if(!i._pLoad.isEmpty)throw new Error(\"`deviceFriendlyName`\"+Ee);i._deviceFriendlyName=e}};let Oe,Ae,Re,De,Le;\"undefined\"!=typeof navigator&&(Oe=navigator,Ae=Oe.userAgent,Re=Oe.platform,De=Oe.mediaDevices),function(){if(!me){const t={Edge:{search:\"Edg\",verSearch:\"Edg\"},OPR:null,Chrome:null,Safari:{str:Oe.vendor,search:\"Apple\",verSearch:[\"Version\",\"iPhone OS\",\"CPU OS\"]},Firefox:null,Explorer:{search:\"MSIE\",verSearch:\"MSIE\"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:Re,search:\"Win\"},Mac:{str:Re},Linux:{str:Re}};let i=\"unknownBrowser\",r=0,n=\"unknownOS\";for(let e in t){const n=t[e]||{};let s=n.str||Ae,o=n.search||e,a=n.verStr||Ae,h=n.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){r=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let r=i.str||Ae,s=i.search||t;if(-1!=r.indexOf(s)){n=t;break}}\"Linux\"==n&&-1!=Ae.indexOf(\"Windows NT\")&&(n=\"HarmonyOS\"),Le={browser:i,version:r,OS:n}}me&&(Le={browser:\"ssr\",version:0,OS:\"ssr\"})}(),De&&De.getUserMedia,\"Chrome\"===Le.browser&&Le.version>66||\"Safari\"===Le.browser&&Le.version>13||\"OPR\"===Le.browser&&Le.version>43||\"Edge\"===Le.browser&&Le.version;const Me=()=>(ft(\"license\"),tt(\"dynamsoft_inited\",(async()=>{let{lt:t,l:e,ls:i,sp:r,rmk:n,cv:s}=((t,e=!1)=>{const i=t;if(i._pLoad.isEmpty){let r,n,s,o=i._license||\"\",a=JSON.parse(JSON.stringify(i._licenseServer)),h=i._sessionPassword,l=0;if(o.startsWith(\"t\")||o.startsWith(\"f\"))l=0;else if(0===o.length||o.startsWith(\"P\")||o.startsWith(\"L\")||o.startsWith(\"Y\")||o.startsWith(\"A\"))l=1;else{l=2;
2const e=o.indexOf(\":\");-1!=e&&(o=o.substring(e+1));const i=o.indexOf(\"?\");if(-1!=i&&(n=o.substring(i+1),o=o.substring(0,i)),o.startsWith(\"DLC2\"))l=0;else{if(o.startsWith(\"DLS2\")){let e;try{let t=o.substring(4);t=atob(t),e=JSON.parse(t)}catch(t){throw new Error(\"Format Error: The license string you specified is invalid, please check to make sure it is correct.\")}if(o=e.handshakeCode?e.handshakeCode:e.organizationID?e.organizationID:\"\",\"number\"==typeof o&&(o=JSON.stringify(o)),0===a.length){let t=[];e.mainServerURL&&(t[0]=e.mainServerURL),e.standbyServerURL&&(t[1]=e.standbyServerURL),a=be(t)}!h&&e.sessionPassword&&(h=e.sessionPassword),r=e.remark}o&&\"200001\"!==o&&!o.startsWith(\"200001-\")||(l=1)}}if(l&&(e||(pe.crypto||(s=\"Please upgrade your browser to support online key.\"),pe.crypto.subtle||(s=\"Require https to use online key in this browser.\"))),s)throw new Error(s);return 1===l&&(o=\"\",console.warn(\"Applying for a public trial license ...\")),{lt:l,l:o,ls:a,sp:h,rmk:r,cv:n}}throw new Error(\"Can't preprocess license again\"+Ee)})(Pe),o=new Ce;Pe._pLoad.task=o,(async()=>{try{await Pe._pLoad}catch(t){}})();let a=rt();nt[a]=e=>{if(e.message&&Pe._onAuthMessage){let t=Pe._onAuthMessage(e.message);null!=t&&(e.message=t)}let i,r=!1;if(1===t&&(r=!0),e.success?(st&&st(\"init license success\"),e.message&&console.warn(e.message),gt._bSupportIRTModule=e.bSupportIRTModule,gt._bSupportDce4Module=e.bSupportDce4Module,Pe.bPassValidation=!0,[0,-10076].includes(e.initLicenseInfo.errorCode)?[-10076].includes(e.initLicenseInfo.errorCode)&&console.warn(e.initLicenseInfo.errorString):o.reject(new Error(e.initLicenseInfo.errorString))):(i=Error(e.message),e.stack&&(i.stack=e.stack),e.ltsErrorCode&&(i.ltsErrorCode=e.ltsErrorCode),r||111==e.ltsErrorCode&&-1!=e.message.toLowerCase().indexOf(\"trial license\")&&(r=!0)),r){const t=A(gt.engineResourcePaths);(async(t,e,i)=>{if(!t._bNeverShowDialog)try{let r=await fetch(t.engineResourcePath+\"dls.license.dialog.html\");if(!r.ok)throw Error(\"Get license dialog fail. Network Error: \"+r.statusText);let n=await r.text();if(!n.trim().startsWith(\"<\"))throw Error(\"Get license dialog fail. Can't get valid HTMLElement.\");let s=document.createElement(\"div\");s.innerHTML=n;let o=[];for(let t=0;t<s.childElementCount;++t){let e=s.children[t];e instanceof HTMLStyleElement&&(o.push(e),document.head.append(e))}let a=1==s.childElementCount?s.children[0]:s;a.remove();let h,l,c,u,d,f=[a],g=a.children;for(let t of g)f.push(t);for(let t=0;t<f.length;++t)for(let e of f[t].children)f.push(e);for(let t of f)if(!h&&t.classList.contains(\"dls-license-mask\"))h=t,t.addEventListener(\"click\",(e=>{if(t==e.target){a.remove();for(let t of o)t.remove()}}));else if(!l&&t.classList.contains(\"dls-license-icon-close\"))l=t,t.addEventListener(\"click\",(()=>{a.remove();for(let t of o)t.remove()}));else if(!c&&t.classList.contains(\"dls-license-icon-error\"))c=t,\"error\"!=e&&t.remove();else if(!u&&t.classList.contains(\"dls-license-icon-warn\"))u=t,\"warn\"!=e&&t.remove();else if(!d&&t.classList.contains(\"dls-license-msg-content\")){d=t;let e=i;for(;e;){let i=e.indexOf(\"[\"),r=e.indexOf(\"]\",i),n=e.indexOf(\"(\",r),s=e.indexOf(\")\",n);if(-1==i||-1==r||-1==n||-1==s){t.appendChild(new Text(e));break}i>0&&t.appendChild(new Text(e.substring(0,i)));let o=document.createElement(\"a\"),a=e.substring(i+1,r);o.innerText=a;let h=e.substring(n+1,s);o.setAttribute(\"href\",h),o.setAttribute(\"target\",\"_blank\"),t.appendChild(o),e=e.substring(s+1)}}document.body.appendChild(a)}catch(e){t._onLog&&t._onLog(e.message||e)}})({_bNeverShowDialog:Pe._bNeverShowDialog,engineResourcePath:t.license,_onLog:st},e.success?\"warn\":\"error\",e.message)}e.success?o.resolve(void 0):o.reject(i)},await $(\"core\"),et.postMessage({type:\"license_dynamsoft\",body:{v:\"3.4.31\",brtk:!!t,bptk:1===t,l:e,os:Le,fn:Pe.deviceFriendlyName,ls:i,sp:r,rmk:n,cv:s},id:a}),Pe.bCallInitLicense=!0,await o})));let Fe;ct.license={},ct.license.dynamsoft=Me,ct.license.getAR=async()=>{{let t=Q.dynamsoft_inited;t&&t.isRejected&&await t}return et?new Promise(((t,e)=>{let i=rt();nt[i]=async i=>{if(i.success){delete i.success;{let t=Pe.license;t&&(t.startsWith(\"t\")||t.startsWith(\"f\"))&&(i.pk=t)}if(Object.keys(i).length){if(i.lem){let t=Error(i.lem);t.ltsErrorCode=i.lec,delete i.lem,delete i.lec,i.ae=t}t(i)}else t(null)}else{let t=Error(i.message);i.stack&&(t.stack=i.stack),e(t)}},et.postMessage({type:\"license_getAR\",id:i})})):null};let Pe=class t{static setLicenseServer(e){Ie(t,e)}static get license(){return this._license}static set license(e){Se(t,e)}static get licenseServer(){return this._licenseServer}static set licenseServer(e){Ie(t,e)}static get deviceFriendlyName(){return this._deviceFriendlyName}static set deviceFriendlyName(e){xe(t,e)}
2static initLicense(e,i){if(Se(t,e),t.bCallInitLicense=!0,\"boolean\"==typeof i&&i||\"object\"==typeof i&&i.executeNow)return Me()}static setDeviceFriendlyName(e){xe(t,e)}static getDeviceFriendlyName(){return t._deviceFriendlyName}static getDeviceUUID(){return(async()=>(await tt(\"dynamsoft_uuid\",(async()=>{await ft();let t=new Ce,e=rt();nt[e]=e=>{if(e.success)t.resolve(e.uuid);else{const i=Error(e.message);e.stack&&(i.stack=e.stack),t.reject(i)}},et.postMessage({type:\"license_getDeviceUUID\",id:e}),Fe=await t})),Fe))()}};Pe._pLoad=new Ce,Pe.bPassValidation=!1,Pe.bCallInitLicense=!1,Pe._license=Te,Pe._licenseServer=[],Pe._deviceFriendlyName=\"\",gt.engineResourcePaths.license={version:\"3.4.31\",path:ve,isInternal:!0},ut.license={wasm:!0,js:!0},ct.license.LicenseManager=Pe;const ke=\"1.4.21\";\"string\"!=typeof gt.engineResourcePaths.std&&O(gt.engineResourcePaths.std.version,ke)<0&&(gt.engineResourcePaths.std={version:ke,path:(t=>{if(null==t&&(t=\"./\"),me||_e);else{let e=document.createElement(\"a\");e.href=t,t=e.href}return t.endsWith(\"/\")||(t+=\"/\"),t})(ve+`../../dynamsoft-capture-vision-std@${ke}/dist/`),isInternal:!0});var Be=Object.freeze({__proto__:null,LicenseManager:Pe,LicenseModule:class{static getVersion(){return`3.4.31(Worker: ${lt.license&&lt.license.worker||\"Not Loaded\"}, Wasm: ${lt.license&&lt.license.wasm||\"Not Loaded\"})`}}});const Ne=\"undefined\"==typeof self,je=\"function\"==typeof importScripts,Ue=(()=>{if(!je){if(!Ne&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})();gt.engineResourcePaths.dce={version:\"4.1.1\",path:Ue,isInternal:!0},ut.dce={wasm:!1,js:!1},ct.dce={};let Ve,Ge,We,Ye,He;function Xe(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}function ze(t,e,i,r,n){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!n)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof e?t!==e||!n:!e.has(t))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}\"function\"==typeof SuppressedError&&SuppressedError,\"undefined\"!=typeof navigator&&(Ve=navigator,Ge=Ve.userAgent,We=Ve.platform,Ye=Ve.mediaDevices),function(){if(!Ne){const t={Edge:{search:\"Edg\",verSearch:\"Edg\"},OPR:null,Chrome:null,Safari:{str:Ve.vendor,search:\"Apple\",verSearch:[\"Version\",\"iPhone OS\",\"CPU OS\"]},Firefox:null,Explorer:{search:\"MSIE\",verSearch:\"MSIE\"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:We,search:\"Win\"},Mac:{str:We},Linux:{str:We}};let i=\"unknownBrowser\",r=0,n=\"unknownOS\";for(let e in t){const n=t[e]||{};let s=n.str||Ge,o=n.search||e,a=n.verStr||Ge,h=n.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){r=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let r=i.str||Ge,s=i.search||t;if(-1!=r.indexOf(s)){n=t;break}}\"Linux\"==n&&-1!=Ge.indexOf(\"Windows NT\")&&(n=\"HarmonyOS\"),He={browser:i,version:r,OS:n}}Ne&&(He={browser:\"ssr\",version:0,OS:\"ssr\"})}();const Ze=\"undefined\"!=typeof WebAssembly&&Ge&&!(/Safari/.test(Ge)&&!/Chrome/.test(Ge)&&/\\(.+\\s11_2_([2-6]).*\\)/.test(Ge)),qe=!(\"undefined\"==typeof Worker),Ke=!(!Ye||!Ye.getUserMedia),Je=async()=>{let t=!1;if(Ke)try{(await Ye.getUserMedia({video:!0})).getTracks().forEach((t=>{t.stop()})),t=!0}catch(t){}return t};\"Chrome\"===He.browser&&He.version>66||\"Safari\"===He.browser&&He.version>13||\"OPR\"===He.browser&&He.version>43||\"Edge\"===He.browser&&He.version;var Qe={653:(t,e,i)=>{var r,n,s,o,a,h,l,c,u,d,f,g,m,p,_,v,y,w,C,E,T,S=S||{version:\"5.2.1\"};if(e.fabric=S,\"undefined\"!=typeof document&&\"undefined\"!=typeof window)document instanceof(\"undefined\"!=typeof HTMLDocument?HTMLDocument:Document)?S.document=document:S.document=document.implementation.createHTMLDocument(\"\"),S.window=window;else{var b=new(i(192).JSDOM)(decodeURIComponent(\"%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E\"),{features:{FetchExternalResources:[\"img\"]},resources:\"usable\"}).window;S.document=b.document,S.jsdomImplForWrapper=i(898).implForWrapper,S.nodeCanvas=i(245).Canvas,S.window=b,DOMParser=S.window.DOMParser}function I(t,e){var i=t.canvas,r=e.targetCanvas,n=r.getContext(\"2d\");
2n.translate(0,r.height),n.scale(1,-1);var s=i.height-r.height;n.drawImage(i,0,s,r.width,r.height,0,0,r.width,r.height)}function x(t,e){var i=e.targetCanvas.getContext(\"2d\"),r=e.destinationWidth,n=e.destinationHeight,s=r*n*4,o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,r,n,t.RGBA,t.UNSIGNED_BYTE,o);var h=new ImageData(a,r,n);i.putImageData(h,0,0)}S.isTouchSupported=\"ontouchstart\"in S.window||\"ontouchstart\"in S.document||S.window&&S.window.navigator&&S.window.navigator.maxTouchPoints>0,S.isLikelyNode=\"undefined\"!=typeof Buffer&&\"undefined\"==typeof window,S.SHARED_ATTRIBUTES=[\"display\",\"transform\",\"fill\",\"fill-opacity\",\"fill-rule\",\"opacity\",\"stroke\",\"stroke-dasharray\",\"stroke-linecap\",\"stroke-dashoffset\",\"stroke-linejoin\",\"stroke-miterlimit\",\"stroke-opacity\",\"stroke-width\",\"id\",\"paint-order\",\"vector-effect\",\"instantiated_by_use\",\"clip-path\"],S.DPI=96,S.reNum=\"(?:[-+]?(?:\\\\d+|\\\\d*\\\\.\\\\d+)(?:[eE][-+]?\\\\d+)?)\",S.commaWsp=\"(?:\\\\s+,?\\\\s*|,\\\\s*)\",S.rePathCommand=/([-+]?((\\d+\\.\\d+)|((\\d+)|(\\.\\d+)))(?:[eE][-+]?\\d+)?)/gi,S.reNonWord=/[ \\n\\.,;!\\?\\-]/,S.fontPaths={},S.iMatrix=[1,0,0,1,0,0],S.svgNS=\"http://www.w3.org/2000/svg\",S.perfLimitSizeTotal=2097152,S.maxCacheSideLimit=4096,S.minCacheSideLimit=256,S.charWidthsCache={},S.textureSize=2048,S.disableStyleCopyPaste=!1,S.enableGLFiltering=!0,S.devicePixelRatio=S.window.devicePixelRatio||S.window.webkitDevicePixelRatio||S.window.mozDevicePixelRatio||1,S.browserShadowBlurConstant=1,S.arcToSegmentsCache={},S.boundsOfCurveCache={},S.cachesBoundsOfCurve=!0,S.forceGLPutImageData=!1,S.initFilterBackend=function(){return S.enableGLFiltering&&S.isWebglSupported&&S.isWebglSupported(S.textureSize)?(console.log(\"max texture size: \"+S.maxTextureSize),new S.WebglFilterBackend({tileSize:S.textureSize})):S.Canvas2dFilterBackend?new S.Canvas2dFilterBackend:void 0},\"undefined\"!=typeof document&&\"undefined\"!=typeof window&&(window.fabric=S),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:S.util.array.fill(i,!1)}}function e(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);this.on(t,i)}S.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var r=0,n=i.length;r<n;r++)i[r]&&i[r].call(this,e||{});return this.__eventListeners[t]=i.filter((function(t){return!1!==t})),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,i){if(1===arguments.length)for(var r in t)e.call(this,r,t[r]);else e.call(this,t,i);return this},off:function(e,i){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&\"object\"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}}}(),S.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,i){var r=this._objects;return i?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,r=0,n=arguments.length;r<n;r++)-1!==(t=e.indexOf(arguments[r]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),r=0,n=i.length;r<n;r++)t.call(e,i[r],r,i);return this},getObjects:function(t){return void 0===t?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return\"function\"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+(e.complexity?e.complexity():0)}),0)}},S.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof S.Gradient||this.set(e,new S.Gradient(t))}
2,_initPattern:function(t,e,i){!t||!t.source||t instanceof S.Pattern?i&&i():this.set(e,new S.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return\"object\"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return\"boolean\"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},r=e,n=Math.sqrt,s=Math.atan2,o=Math.pow,a=Math.PI/180,h=Math.PI/2,S.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/h){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/h){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*a},radiansToDegrees:function(t){return t/a},rotatePoint:function(t,e,i){var r=new S.Point(t.x-e.x,t.y-e.y),n=S.util.rotateVector(r,i);return new S.Point(n.x,n.y).addEquals(e)},rotateVector:function(t,e){var i=S.util.sin(e),r=S.util.cos(e);return{x:t.x*r-t.y*i,y:t.x*i+t.y*r}},createVector:function(t,e){return new S.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new S.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,i){var r=S.util.createVector(t,e),n=S.util.createVector(t,i),s=S.util.calcAngleBetweenVectors(r,n),o=s*(0===S.util.calcAngleBetweenVectors(S.util.rotateVector(r,s),n)?1:-1)/2;return{vector:S.util.getHatVector(S.util.rotateVector(r,o)),angle:s}},projectStrokeOnPoints:function(t,e,i){var r=[],n=e.strokeWidth/2,s=e.strokeUniform?new S.Point(1/e.scaleX,1/e.scaleY):new S.Point(1,1),o=function(t){var e=n/Math.hypot(t.x,t.y);return new S.Point(t.x*e*s.x,t.y*e*s.y)};return t.length<=1||t.forEach((function(a,h){var l,c,u=new S.Point(a.x,a.y);0===h?(c=t[h+1],l=i?o(S.util.createVector(c,u)).addEquals(u):t[t.length-1]):h===t.length-1?(l=t[h-1],c=i?o(S.util.createVector(l,u)).addEquals(u):t[0]):(l=t[h-1],c=t[h+1]);var d,f,g=S.util.getBisector(u,l,c),m=g.vector,p=g.angle;if(\"miter\"===e.strokeLineJoin&&(d=-n/Math.sin(p/2),f=new S.Point(m.x*d*s.x,m.y*d*s.y),Math.hypot(f.x,f.y)/n<=e.strokeMiterLimit))return r.push(u.add(f)),void r.push(u.subtract(f));d=-n*Math.SQRT2,f=new S.Point(m.x*d*s.x,m.y*d*s.y),r.push(u.add(f)),r.push(u.subtract(f))})),r},transformPoint:function(t,e,i){return i?new S.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new S.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=S.util.transformPoint(t[i],e);var r=[t[0].x,t[1].x,t[2].x,t[3].x],n=S.util.array.min(r),s=S.util.array.max(r)-n,o=[t[0].y,t[1].y,t[2].y,t[3].y],a=S.util.array.min(o);return{left:n,top:a,width:s,height:S.util.array.max(o)-a}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),i=[e*t[3],-e*t[1],-e*t[2],e*t[0]],r=S.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-r.x,i[5]=-r.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\\D{0,2}$/.exec(t),r=parseFloat(t);switch(e||(e=S.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case\"mm\":return r*S.DPI/25.4;case\"cm\":return r*S.DPI/2.54;case\"in\":return r*S.DPI;case\"pt\":return r*S.DPI/72;case\"pc\":return r*S.DPI/72*12;case\"em\":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=S.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),S.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=[\"instantiated_by_use\",\"style\",\"id\",\"class\"];switch(t){case\"linearGradient\":e=e.concat([\"x1\",\"y1\",\"x2\",\"y2\",\"gradientUnits\",\"gradientTransform\"]);break;case\"radialGradient\":e=e.concat([\"gradientUnits\",\"gradientTransform\",\"cx\",\"cy\",\"r\",\"fx\",\"fy\",\"fr\"]);break;case\"stop\":e=e.concat([\"offset\",\"stop-color\",\"stop-opacity\"])}return e},resolveNamespace:function(t){if(!t)return S;var e,i=t.split(\".\"),n=i.length,s=r||S.window;for(e=0;e<n;++e)s=s[i[e]];return s}
2,loadImage:function(t,e,i,r){if(t){var n=S.util.createImage(),s=function(){e&&e.call(i,n,!1),n=n.onload=n.onerror=null};n.onload=s,n.onerror=function(){S.log(\"Error loading \"+n.src),e&&e.call(i,null,!0),n=n.onload=n.onerror=null},0!==t.indexOf(\"data\")&&null!=r&&(n.crossOrigin=r),\"data:image/svg\"===t.substring(0,14)&&(n.onload=null,S.util.loadImageInDom(n,s)),n.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=S.document.createElement(\"div\");i.style.width=i.style.height=\"1px\",i.style.left=i.style.top=\"-100%\",i.style.position=\"absolute\",i.appendChild(t),S.document.querySelector(\"body\").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,i,r){var n=[],s=0,o=(t=t||[]).length;function a(){++s===o&&e&&e(n.filter((function(t){return t})))}o?t.forEach((function(t,e){t&&t.type?S.util.getKlass(t.type,i).fromObject(t,(function(i,s){s||(n[e]=i),r&&r(t,i,s),a()})):a()})):e&&e(n)},enlivenObjectEnlivables:function(t,e,i){var r=S.Object.ENLIVEN_PROPS.filter((function(e){return!!t[e]}));S.util.enlivenObjects(r.map((function(e){return t[e]})),(function(t){var n={};r.forEach((function(i,r){n[i]=t[r],e&&(e[i]=t[r])})),i&&i(n)}))},enlivenPatterns:function(t,e){function i(){++n===s&&e&&e(r)}var r=[],n=0,s=(t=t||[]).length;s?t.forEach((function(t,e){t&&t.source?new S.Pattern(t,(function(t){r[e]=t,i()})):(r[e]=t,i())})):e&&e(r)},groupSVGElements:function(t,e,i){var r;return t&&1===t.length?t[0]:(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),r=new S.Group(t,e),void 0!==i&&(r.sourcePath=i),r)},populateWithProperties:function(t,e,i){if(i&&Array.isArray(i))for(var r=0,n=i.length;r<n;r++)i[r]in t&&(e[i[r]]=t[i[r]])},createCanvasElement:function(){return S.document.createElement(\"canvas\")},copyCanvasElement:function(t){var e=S.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext(\"2d\").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL(\"image/\"+e,i)},createImage:function(){return S.document.createElement(\"img\")},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=s(t[1],t[0]),i=o(t[0],2)+o(t[1],2),r=n(i),h=(t[0]*t[3]-t[2]*t[1])/r,l=s(t[0]*t[2]+t[1]*t[3],i);return{angle:e/a,scaleX:r,scaleY:h,skewX:l/a,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return S.iMatrix.concat();var e=S.util.degreesToRadians(t.angle),i=S.util.cos(e),r=S.util.sin(e);return[i,r,-r,i,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,r=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],n=S.util.multiplyTransformMatrices,s=S.util.degreesToRadians;return t.skewX&&(r=n(r,[1,0,Math.tan(s(t.skewX)),1],!0)),t.skewY&&(r=n(r,[1,Math.tan(s(t.skewY)),0,1],!0)),r},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=S.util.multiplyTransformMatrices;return t.angle&&(e=i(e,S.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,S.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,i,r){r>0&&(e>r?e-=r:e=0,i>r?i-=r:i=0);var n,s=!0,o=t.getImageData(e,i,2*r||1,2*r||1),a=o.data.length;for(n=3;n<a&&0!=(s=o.data[n]<=0);n+=4);return o=null,s},parsePreserveAspectRatioAttribute:function(t){var e,i=\"meet\",r=t.split(\" \");return r&&r.length&&(\"meet\"!==(i=r.pop())&&\"slice\"!==i?(e=i,i=\"meet\"):r.length&&(e=r.pop())),{meetOrSlice:i,alignX:\"none\"!==e?e.slice(1,4):\"none\",alignY:\"none\"!==e?e.slice(5,8):\"none\"}},clearFabricFontCache:function(t){(t=(t||\"\").toLowerCase())?S.charWidthsCache[t]&&delete S.charWidthsCache[t]:S.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),r=Math.floor(e/i);return{x:Math.floor(i),y:r}}
2,capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return\"matrix(\"+t.map((function(t){return S.util.toFixed(t,S.Object.NUM_FRACTION_DIGITS)})).join(\" \")+\")\"},removeTransformFromObject:function(t,e){var i=S.util.invertTransform(e),r=S.util.multiplyTransformMatrices(i,t.calcOwnMatrix());S.util.applyTransformToObject(t,r)},addTransformToObject:function(t,e){S.util.applyTransformToObject(t,S.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=S.util.qrDecompose(e),r=new S.Point(i.translateX,i.translateY);t.flipX=!1,t.flipY=!1,t.set(\"scaleX\",i.scaleX),t.set(\"scaleY\",i.scaleY),t.skewX=i.skewX,t.skewY=i.skewY,t.angle=i.angle,t.setPositionByOrigin(r,\"center\",\"center\")},sizeAfterTransform:function(t,e,i){var r=t/2,n=e/2,s=[{x:-r,y:-n},{x:r,y:-n},{x:-r,y:n},{x:r,y:n}],o=S.util.calcDimensionsMatrix(i),a=S.util.makeBoundingBoxFromPoints(s,o);return{x:a.width,y:a.height}},mergeClipPaths:function(t,e){var i=t,r=e;i.inverted&&!r.inverted&&(i=e,r=t),S.util.applyTransformToObject(r,S.util.multiplyTransformMatrices(S.util.invertTransform(i.calcTransformMatrix()),r.calcTransformMatrix()));var n=i.inverted&&r.inverted;return n&&(i.inverted=r.inverted=!1),new S.Group([i],{clipPath:r,inverted:n})}},function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i={m:\"l\",M:\"L\"};function r(t,e,i,r,n,s,o,a,h,l,c){var u=S.util.cos(t),d=S.util.sin(t),f=S.util.cos(e),g=S.util.sin(e),m=i*n*f-r*s*g+o,p=r*n*f+i*s*g+a;return[\"C\",l+h*(-i*n*d-r*s*u),c+h*(-r*n*d+i*s*u),m+h*(i*n*g+r*s*f),p+h*(r*n*g-i*s*f),m,p]}function n(t,e,i,r){var n=Math.atan2(e,t),s=Math.atan2(r,i);return s>=n?s-n:2*Math.PI-(n-s)}function s(t,e,i){for(var s=i[1],o=i[2],a=i[3],h=i[4],l=i[5],c=function(t,e,i,s,o,a,h){var l=Math.PI,c=h*l/180,u=S.util.sin(c),d=S.util.cos(c),f=0,g=0,m=-d*t*.5-u*e*.5,p=-d*e*.5+u*t*.5,_=(i=Math.abs(i))*i,v=(s=Math.abs(s))*s,y=p*p,w=m*m,C=_*v-_*y-v*w,E=0;if(C<0){var T=Math.sqrt(1-C/(_*v));i*=T,s*=T}else E=(o===a?-1:1)*Math.sqrt(C/(_*y+v*w));var b=E*i*p/s,I=-E*s*m/i,x=d*b-u*I+.5*t,O=u*b+d*I+.5*e,A=n(1,0,(m-b)/i,(p-I)/s),R=n((m-b)/i,(p-I)/s,(-m-b)/i,(-p-I)/s);0===a&&R>0?R-=2*l:1===a&&R<0&&(R+=2*l);for(var D=Math.ceil(Math.abs(R/l*2)),L=[],M=R/D,F=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),P=A+M,k=0;k<D;k++)L[k]=r(A,P,d,u,i,s,x,O,F,f,g),f=L[k][5],g=L[k][6],A=P,P+=M;return L}(i[6]-t,i[7]-e,s,o,h,l,a),u=0,d=c.length;u<d;u++)c[u][1]+=t,c[u][2]+=e,c[u][3]+=t,c[u][4]+=e,c[u][5]+=t,c[u][6]+=e;return c}function o(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}function a(t,e,i,r,n,s,o,a){return function(h){var l,c=(l=h)*l*l,u=function(t){return 3*t*t*(1-t)}(h),d=function(t){return 3*t*(1-t)*(1-t)}(h),f=function(t){return(1-t)*(1-t)*(1-t)}(h);return{x:o*c+n*u+i*d+t*f,y:a*c+s*u+r*d+e*f}}}function h(t,e,i,r,n,s,o,a){return function(h){var l=1-h,c=3*l*l*(i-t)+6*l*h*(n-i)+3*h*h*(o-n),u=3*l*l*(r-e)+6*l*h*(s-r)+3*h*h*(a-s);return Math.atan2(u,c)}}function l(t,e,i,r,n,s){return function(o){var a,h=(a=o)*a,l=function(t){return 2*t*(1-t)}(o),c=function(t){return(1-t)*(1-t)}(o);return{x:n*h+i*l+t*c,y:s*h+r*l+e*c}}}function c(t,e,i,r,n,s){return function(o){var a=1-o,h=2*a*(i-t)+2*o*(n-i),l=2*a*(r-e)+2*o*(s-r);return Math.atan2(l,h)}}function u(t,e,i){var r,n,s={x:e,y:i},a=0;for(n=1;n<=100;n+=1)r=t(n/100),a+=o(s.x,s.y,r.x,r.y),s=r;return a}function d(t){for(var e,i,r,n,s=0,d=t.length,f=0,g=0,m=0,p=0,_=[],v=0;v<d;v++){switch(r={x:f,y:g,command:(e=t[v])[0]},e[0]){case\"M\":r.length=0,m=f=e[1],p=g=e[2];break;case\"L\":r.length=o(f,g,e[1],e[2]),f=e[1],g=e[2];break;case\"C\":i=a(f,g,e[1],e[2],e[3],e[4],e[5],e[6]),n=h(f,g,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=i,r.angleFinder=n,r.length=u(i,f,g),f=e[5],g=e[6];break;case\"Q\":i=l(f,g,e[1],e[2],e[3],e[4]),n=c(f,g,e[1],e[2],e[3],e[4]),r.iterator=i,r.angleFinder=n,r.length=u(i,f,g),f=e[3],g=e[4];break;case\"Z\":case\"z\":r.destX=m,r.destY=p,r.length=o(f,g,m,p),f=m,g=p}s+=r.length,_.push(r)}return _.push({length:s,x:f,y:g}),_}S.util.joinPath=function(t){return t.map((function(t){return t.join(\" \")})).join(\" \")},S.util.parsePath=function(t){var r,n,s,o,a,h=[],l=[],c=S.rePathCommand,u=\"[-+
2]?(?:\\\\d*\\\\.\\\\d+|\\\\d+\\\\.?)(?:[eE][-+]?\\\\d+)?\\\\s*\",d=\"(\"+u+\")\"+S.commaWsp,f=\"([01])\"+S.commaWsp+\"?\",g=new RegExp(d+\"?\"+d+\"?\"+d+f+f+d+\"?(\"+u+\")\",\"g\");if(!t||!t.match)return h;for(var m,p=0,_=(a=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;p<_;p++){o=(r=a[p]).slice(1).trim(),l.length=0;var v=r.charAt(0);if(m=[v],\"a\"===v.toLowerCase())for(var y;y=g.exec(o);)for(var w=1;w<y.length;w++)l.push(y[w]);else for(;s=c.exec(o);)l.push(s[0]);w=0;for(var C=l.length;w<C;w++)n=parseFloat(l[w]),isNaN(n)||m.push(n);var E=e[v.toLowerCase()],T=i[v]||v;if(m.length-1>E)for(var b=1,I=m.length;b<I;b+=E)h.push([v].concat(m.slice(b,b+E))),v=T;else h.push(m)}return h},S.util.makePathSimpler=function(t){var e,i,r,n,o,a,h=0,l=0,c=t.length,u=0,d=0,f=[];for(i=0;i<c;++i){switch(r=!1,(e=t[i].slice(0))[0]){case\"l\":e[0]=\"L\",e[1]+=h,e[2]+=l;case\"L\":h=e[1],l=e[2];break;case\"h\":e[1]+=h;case\"H\":e[0]=\"L\",e[2]=l,h=e[1];break;case\"v\":e[1]+=l;case\"V\":e[0]=\"L\",l=e[1],e[1]=h,e[2]=l;break;case\"m\":e[0]=\"M\",e[1]+=h,e[2]+=l;case\"M\":h=e[1],l=e[2],u=e[1],d=e[2];break;case\"c\":e[0]=\"C\",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l,e[5]+=h,e[6]+=l;case\"C\":o=e[3],a=e[4],h=e[5],l=e[6];break;case\"s\":e[0]=\"S\",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case\"S\":\"C\"===n?(o=2*h-o,a=2*l-a):(o=h,a=l),h=e[3],l=e[4],e[0]=\"C\",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=a,o=e[3],a=e[4];break;case\"q\":e[0]=\"Q\",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case\"Q\":o=e[1],a=e[2],h=e[3],l=e[4];break;case\"t\":e[0]=\"T\",e[1]+=h,e[2]+=l;case\"T\":\"Q\"===n?(o=2*h-o,a=2*l-a):(o=h,a=l),e[0]=\"Q\",h=e[1],l=e[2],e[1]=o,e[2]=a,e[3]=h,e[4]=l;break;case\"a\":e[0]=\"A\",e[6]+=h,e[7]+=l;case\"A\":r=!0,f=f.concat(s(h,l,e)),h=e[6],l=e[7];break;case\"z\":case\"Z\":h=u,l=d}r||f.push(e),n=e[0]}return f},S.util.getSmoothPathFromPoints=function(t,e){var i,r=[],n=new S.Point(t[0].x,t[0].y),s=new S.Point(t[1].x,t[1].y),o=t.length,a=1,h=0,l=o>2;for(e=e||0,l&&(a=t[2].x<s.x?-1:t[2].x===s.x?0:1,h=t[2].y<s.y?-1:t[2].y===s.y?0:1),r.push([\"M\",n.x-a*e,n.y-h*e]),i=1;i<o;i++){if(!n.eq(s)){var c=n.midPointFrom(s);r.push([\"Q\",n.x,n.y,c.x,c.y])}n=t[i],i+1<t.length&&(s=t[i+1])}return l&&(a=n.x>t[i-2].x?1:n.x===t[i-2].x?0:-1,h=n.y>t[i-2].y?1:n.y===t[i-2].y?0:-1),r.push([\"L\",n.x+a*e,n.y+h*e]),r},S.util.getPathSegmentsInfo=d,S.util.getBoundsOfCurve=function(e,i,r,n,s,o,a,h){var l;if(S.cachesBoundsOfCurve&&(l=t.call(arguments),S.boundsOfCurveCache[l]))return S.boundsOfCurveCache[l];var c,u,d,f,g,m,p,_,v=Math.sqrt,y=Math.min,w=Math.max,C=Math.abs,E=[],T=[[],[]];u=6*e-12*r+6*s,c=-3*e+9*r-9*s+3*a,d=3*r-3*e;for(var b=0;b<2;++b)if(b>0&&(u=6*i-12*n+6*o,c=-3*i+9*n-9*o+3*h,d=3*n-3*i),C(c)<1e-12){if(C(u)<1e-12)continue;0<(f=-d/u)&&f<1&&E.push(f)}else(p=u*u-4*d*c)<0||(0<(g=(-u+(_=v(p)))/(2*c))&&g<1&&E.push(g),0<(m=(-u-_)/(2*c))&&m<1&&E.push(m));for(var I,x,O,A=E.length,R=A;A--;)I=(O=1-(f=E[A]))*O*O*e+3*O*O*f*r+3*O*f*f*s+f*f*f*a,T[0][A]=I,x=O*O*O*i+3*O*O*f*n+3*O*f*f*o+f*f*f*h,T[1][A]=x;T[0][R]=e,T[1][R]=i,T[0][R+1]=a,T[1][R+1]=h;var D=[{x:y.apply(null,T[0]),y:y.apply(null,T[1])},{x:w.apply(null,T[0]),y:w.apply(null,T[1])}];return S.cachesBoundsOfCurve&&(S.boundsOfCurveCache[l]=D),D},S.util.getPointOnPath=function(t,e,i){i||(i=d(t));for(var r=0;e-i[r].length>0&&r<i.length-2;)e-=i[r].length,r++;var n,s=i[r],a=e/s.length,h=s.command,l=t[r];switch(h){case\"M\":return{x:s.x,y:s.y,angle:0};case\"Z\":case\"z\":return(n=new S.Point(s.x,s.y).lerp(new S.Point(s.destX,s.destY),a)).angle=Math.atan2(s.destY-s.y,s.destX-s.x),n;case\"L\":return(n=new S.Point(s.x,s.y).lerp(new S.Point(l[1],l[2]),a)).angle=Math.atan2(l[2]-s.y,l[1]-s.x),n;case\"C\":case\"Q\":return function(t,e){for(var i,r,n,s=0,a=0,h=t.iterator,l={x:t.x,y:t.y},c=.01,u=t.angleFinder;a<e&&c>1e-4;)i=h(s),n=s,(r=o(l.x,l.y,i.x,i.y))+a>e?(s-=c,c/=2):(l=i,s+=c,a+=r);return i.angle=u(n),i}(s,e)}},S.util.transformPath=function(t,e,i){return i&&(e=S.util.multiplyTransformMatrices(e,[1,0,0,1,-i.x,-i.y])),t.map((function(t){for(var i=t.slice(0),r={},n=1;n<t.length-1;n+=2)r.x=t[n],r.y=t[n+1],r=S.util.transformPoint(r,e),i[n]=r.x,i[n+1]=r.y;return i}))}}(),function(){var t=Array.prototype.slice;function e(t,e,i){if(t&&0!==t.length){var r=t.length-1,n=e?t[r][e]:t[r];if(e)for(;r--;)i(t[r][e],n)&&(n=t[r][e]);else for(;r--;)i(t[r],n)&&(n=t[r]);return n}}S.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(e,i){for(var r=t.call(arguments,2),n=[],s=0,o=e.length;s<o;s++)n[s]=r.length?e[s][i].apply(e[s],r):e[s][i].call(e[s]);return n},min:function(t,i){return e(t,i,(function(t,e){return t<e}))},max:function(t,i){return e(t,i,(function(t,e){return t>=e}))}}}(),function(){function t(e,i,r){if(r)if(!S.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var n=0,s=i.length;n<s;n++)e[n]=t({},i[n],r)}else if(i&&\"object\"==typeof i)for(var o in i)\"canvas\"===o||\"group\"===o?e[o]=null:i.hasOwnProperty(o)&&(e[o]=t({},i[o],r));else e=i;else for(var o in i)e[o]=i[o];return e}S.util.object={extend:t,clone:function(e,i){return t({},e,i)}},S.util.object.extend(S.util,S.Observable)}(),function(){function t(t,e){var i=t.charCodeAt(e);if(isNaN(i))return\"\";if(i<55296||i>57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw\"High surrogate without following low surrogate\";var r=t.charCodeAt(e+1);if(56320>r||r>57343)throw\"High surrogate without following low surrogate\";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw\"Low surrogate without preceding high surrogate\";var n=t.charCodeAt(e-1);if(55296>n||n>56319)throw\"Low surrogate without preceding high surrogate\";return!1}S.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():\"\"}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,\"&amp;\").replace(/\"/g,\"&quot;\").replace(/'/g,\"&apos;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")},graphemeSplit:function(e){var i,r=0,n=[];for(r=0;r<e.length;r++)!1!==(i=t(e,r))&&n.push(i);return n}}}(),function(){var t=Array.prototype.slice,e=function(){},i=function(){for(var t in{toString:1})if(\"toString\"===t)return!1;return!0}(),r=function(t,e,r){for(var n in e)n in t.prototype&&\"function\"==typeof t.prototype[n]&&(e[n]+\"\").indexOf(\"callSuper\")>
2-1?t.prototype[n]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=r;var n=e[t].apply(this,arguments);if(this.constructor.superclass=i,\"initialize\"!==t)return n}}(n):t.prototype[n]=e[n],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function n(){}function s(e){for(var i=null,r=this;r.constructor.superclass;){var n=r.constructor.superclass.prototype[e];if(r[e]!==n){i=n;break}r=r.constructor.superclass.prototype}return i?arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this):console.log(\"tried to callSuper \"+e+\", method not found in prototype chain\",this)}S.util.createClass=function(){var i=null,o=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}\"function\"==typeof o[0]&&(i=o.shift()),a.superclass=i,a.subclasses=[],i&&(n.prototype=i.prototype,a.prototype=new n,i.subclasses.push(a));for(var h=0,l=o.length;h<l;h++)r(a,o[h],i);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=s,a}}(),l=!!S.document.createElement(\"div\").attachEvent,c=[\"touchstart\",\"touchmove\",\"touchend\"],S.util.addListener=function(t,e,i,r){t&&t.addEventListener(e,i,!l&&r)},S.util.removeListener=function(t,e,i,r){t&&t.removeEventListener(e,i,!l&&r)},S.util.getPointer=function(t){var e=t.target,i=S.util.getScrollLeftTop(e),r=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:r.clientX+i.left,y:r.clientY+i.top}},S.util.isTouchEvent=function(t){return c.indexOf(t.type)>-1||\"touch\"===t.pointerType},d=\"string\"==typeof(u=S.document.createElement(\"div\")).style.opacity,f=\"string\"==typeof u.style.filter,g=/alpha\\s*\\(\\s*opacity\\s*=\\s*([^\\)]+)\\)/,m=function(t){return t},d?m=function(t,e){return t.style.opacity=e,t}:f&&(m=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),g.test(i.filter)?(e=e>=.9999?\"\":\"alpha(opacity=\"+100*e+\")\",i.filter=i.filter.replace(g,e)):i.filter+=\" alpha(opacity=\"+100*e+\")\",t}),S.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if(\"string\"==typeof e)return t.style.cssText+=\";\"+e,e.indexOf(\"opacity\")>-1?m(t,e.match(/opacity:\\s*(\\d?\\.?\\d*)/)[1]):t;for(var r in e)\"opacity\"===r?m(t,e[r]):i[\"float\"===r||\"cssFloat\"===r?void 0===i.styleFloat?\"cssFloat\":\"styleFloat\":r]=e[r];return t},function(){var t,e,i,r,n=Array.prototype.slice,s=function(t){return n.call(t,0)};try{t=s(S.document.childNodes)instanceof Array}catch(t){}function o(t,e){var i=S.document.createElement(t);for(var r in e)\"class\"===r?i.className=e[r]:\"for\"===r?i.htmlFor=e[r]:i.setAttribute(r,e[r]);return i}function a(t){for(var e=0,i=0,r=S.document.documentElement,n=S.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===S.document?(e=n.scrollLeft||r.scrollLeft||0,i=n.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||\"fixed\"!==t.style.position););return{left:e,top:i}}t||(s=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),e=S.document.defaultView&&S.document.defaultView.getComputedStyle?function(t,e){var i=S.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},i=S.document.documentElement.style,r=\"userSelect\"in i?\"userSelect\":\"MozUserSelect\"in i?\"MozUserSelect\":\"WebkitUserSelect\"in i?\"WebkitUserSelect\":\"KhtmlUserSelect\"in i?\"KhtmlUserSelect\":\"\",S.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=S.util.falseFunction),r?t.style[r]=\"none\":\"string\"==typeof t.unselectable&&(t.unselectable=\"on\"),t},S.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]=\"\":\"string\"==typeof t.unselectable&&(t.unselectable=\"\"),t},S.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e}
2,S.util.getById=function(t){return\"string\"==typeof t?S.document.getElementById(t):t},S.util.toArray=s,S.util.addClass=function(t,e){t&&-1===(\" \"+t.className+\" \").indexOf(\" \"+e+\" \")&&(t.className+=(t.className?\" \":\"\")+e)},S.util.makeElement=o,S.util.wrapElement=function(t,e,i){return\"string\"==typeof e&&(e=o(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},S.util.getScrollLeftTop=a,S.util.getElementOffset=function(t){var i,r,n=t&&t.ownerDocument,s={left:0,top:0},o={left:0,top:0},h={borderLeftWidth:\"left\",borderTopWidth:\"top\",paddingLeft:\"left\",paddingTop:\"top\"};if(!n)return o;for(var l in h)o[h[l]]+=parseInt(e(t,l),10)||0;return i=n.documentElement,void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect()),r=a(t),{left:s.left+r.left-(i.clientLeft||0)+o.left,top:s.top+r.top-(i.clientTop||0)+o.top}},S.util.getNodeCanvas=function(t){var e=S.jsdomImplForWrapper(t);return e._canvas||e._image},S.util.cleanUpJsdomNode=function(t){if(S.isLikelyNode){var e=S.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}S.util.request=function(e,i){i||(i={});var r=i.method?i.method.toUpperCase():\"GET\",n=i.onComplete||function(){},s=new S.window.XMLHttpRequest,o=i.body||i.parameters;return s.onreadystatechange=function(){4===s.readyState&&(n(s),s.onreadystatechange=t)},\"GET\"===r&&(o=null,\"string\"==typeof i.parameters&&(e=function(t,e){return t+(/\\?/.test(t)?\"&\":\"?\")+e}(e,i.parameters))),s.open(r,e,!0),\"POST\"!==r&&\"PUT\"!==r||s.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),s.send(o),s}}(),S.log=console.log,S.warn=console.warn,function(){var t=S.util.object.extend,e=S.util.object.clone,i=[];function r(){return!1}function n(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e}S.util.object.extend(i,{cancelAll:function(){var t=this.splice(0);return t.forEach((function(t){t.cancel()})),t},cancelByCanvas:function(t){if(!t)return[];var e=this.filter((function(e){return\"object\"==typeof e.target&&e.target.canvas===t}));return e.forEach((function(t){t.cancel()})),e},cancelByTarget:function(t){var e=this.findAnimationsByTarget(t);return e.forEach((function(t){t.cancel()})),e},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(t){return this.find((function(e){return e.cancel===t}))},findAnimationsByTarget:function(t){return t?this.filter((function(e){return e.target===t})):[]}});var s=S.window.requestAnimationFrame||S.window.webkitRequestAnimationFrame||S.window.mozRequestAnimationFrame||S.window.oRequestAnimationFrame||S.window.msRequestAnimationFrame||function(t){return S.window.setTimeout(t,1e3/60)},o=S.window.cancelAnimationFrame||S.window.clearTimeout;function a(){return s.apply(S.window,arguments)}S.util.animate=function(i){i||(i={});var s,o=!1,h=function(){var t=S.runningAnimations.indexOf(s);return t>-1&&S.runningAnimations.splice(t,1)[0]};return s=t(e(i),{cancel:function(){return o=!0,h()},currentValue:\"startValue\"in i?i.startValue:0,completionRate:0,durationRate:0}),S.runningAnimations.push(s),a((function(t){var e,l=t||+new Date,c=i.duration||500,u=l+c,d=i.onChange||r,f=i.abort||r,g=i.onComplete||r,m=i.easing||n,p=\"startValue\"in i&&i.startValue.length>0,_=\"startValue\"in i?i.startValue:0,v=\"endValue\"in i?i.endValue:100,y=i.byValue||(p?_.map((function(t,e){return v[e]-_[e]})):v-_);i.onStart&&i.onStart(),function t(i){var r=(e=i||+new Date)>u?c:e-l,n=r/c,w=p?_.map((function(t,e){return m(r,_[e],y[e],c)})):m(r,_,y,c),C=p?Math.abs((w[0]-_[0])/y[0]):Math.abs((w-_)/y);if(s.currentValue=p?w.slice():w,s.completionRate=C,s.durationRate=n,!o){if(!f(w,C,n))return e>u?(s.currentValue=p?v.slice():v,s.completionRate=1,s.durationRate=1,d(p?v.slice():v,1,1),g(v,1,1),void h()):(d(w,C,n),void a(t));h()}}(l)})),s.cancel},S.util.requestAnimFrame=a,S.util.cancelAnimFrame=function(){return o.apply(S.window,arguments)},S.runningAnimations=i}(),function(){function t(t,e,i){var r=\"rgba(\"+parseInt(t[0]+i*(e[0]-t[0]),10)+\",\"+parseInt(t[1]+i*(e[1]-t[1]),10)+\",\"+parseInt(t[2]+i*(e[2]-t[2]),10);return(r+=\",\"+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1))+\")\"}S.util.animateColor=function(e,i,r,n){var s=new S.Color(e).getSource(),o=new S.Color(i).getSource(),a=n.onComplete,h=n.onChange;return n=n||{},S.util.animate(S.util.object.extend(n,{duration:r||500,startValue:s,endValue:o,byValue:o,easing:function(e,i,r,s){return t(i,r,n.colorEasing?n.colorEasing(e,s):1-Math.cos(e/s*(Math.PI/2)))}
vendor: 3,604 bytes, line 2
2,onComplete:function(e,i,r){if(a)return a(t(o,o,0),i,r)},onChange:function(e,i,r){if(h){if(Array.isArray(e))return h(t(e,e,0),i,r);h(e,i,r)}}}))}}(),function(){function t(t,e,i,r){return t<Math.abs(e)?(t=e,r=i/4):r=0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:r}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function i(t,e,i,n){return i-r(n-t,0,i,n)+e}function r(t,e,i,r){return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}S.util.ease={easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:function(t,e,i,r){return i*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,r){return i*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,r){return i*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,i,r){return t===r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,i,r){return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(i,r,n,s){var o=0;return 0===i?r:1==(i/=s)?r+n:(o||(o=.3*s),-e(t(n,n,o,1.70158),i,s)+r)},easeOutElastic:function(e,i,r,n){var s=0;if(0===e)return i;if(1==(e/=n))return i+r;s||(s=.3*n);var o=t(r,r,s,1.70158);return o.a*Math.pow(2,-10*e)*Math.sin((e*n-o.s)*(2*Math.PI)/o.p)+o.c+i},easeInOutElastic:function(i,r,n,s){var o=0;if(0===i)return r;if(2==(i/=s/2))return r+n;o||(o=s*(.3*1.5));var a=t(n,n,o,1.70158);return i<1?-.5*e(a,i,s)+r:a.a*Math.pow(2,-10*(i-=1))*Math.sin((i*s-a.s)*(2*Math.PI)/a.p)*.5+a.c+r},easeInBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*(t/=r)*t*((n+1)*t-n)+e},easeOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*((t=t/r-1)*t*((n+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInBounce:i,easeOutBounce:r,easeInOutBounce:function(t,e,n,s){return t<s/2?.5*i(2*t,0,n,s)+e:.5*r(2*t-s,0,n,s)+.5*n+e}}}(),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n=e.util.toFixed,s=e.util.parseUnit,o=e.util.multiplyTransformMatrices,a={cx:\"left\",x:\"left\",r:\"radius\",cy:\"top\",y:\"top\",display:\"visible\",visibility:\"visible\",transform:\"transformMatrix\",\"fill-opacity\":\"fillOpacity\",\"fill-rule\":\"fillRule\",\"font-family\":\"fontFamily\",\"font-size\":\"fontSize\",\"font-style\":\"fontStyle\",\"font-weight\"
2:\"fontWeight\",\"letter-spacing\":\"charSpacing\",\"paint-order\":\"paintFirst\",\"stroke-dasharray\":\"strokeDashArray\",\"stroke-dashoffset\":\"strokeDashOffset\",\"stroke-linecap\":\"strokeLineCap\",\"stroke-linejoin\":\"strokeLineJoin\",\"stroke-miterlimit\":\"strokeMiterLimit\",\"stroke-opacity\":\"strokeOpacity\",\"stroke-width\":\"strokeWidth\",\"text-decoration\":\"textDecoration\",\"text-anchor\":\"textAnchor\",opacity:\"opacity\",\"clip-path\":\"clipPath\",\"clip-rule\":\"clipRule\",\"vector-effect\":\"strokeUniform\",\"image-rendering\":\"imageSmoothing\"},h={stroke:\"strokeOpacity\",fill:\"fillOpacity\"},l=\"font-size\",c=\"clip-path\";function u(t){return t in a?a[t]:t}function d(t,i,r,n){var a,h=Array.isArray(i);if(\"fill\"!==t&&\"stroke\"!==t||\"none\"!==i){if(\"strokeUniform\"===t)return\"non-scaling-stroke\"===i;if(\"strokeDashArray\"===t)i=\"none\"===i?null:i.replace(/,/g,\" \").split(/\\s+/).map(parseFloat);else if(\"transformMatrix\"===t)i=r&&r.transformMatrix?o(r.transformMatrix,e.parseTransformAttribute(i)):e.parseTransformAttribute(i);else if(\"visible\"===t)i=\"none\"!==i&&\"hidden\"!==i,r&&!1===r.visible&&(i=!1);else if(\"opacity\"===t)i=parseFloat(i),r&&void 0!==r.opacity&&(i*=r.opacity);else if(\"textAnchor\"===t)i=\"start\"===i?\"left\":\"end\"===i?\"right\":\"center\";else if(\"charSpacing\"===t)a=s(i,n)/n*1e3;else if(\"paintFirst\"===t){var l=i.indexOf(\"fill\"),c=i.indexOf(\"stroke\");i=\"fill\",(l>-1&&c>-1&&c<l||-1===l&&c>-1)&&(i=\"stroke\")}else{if(\"href\"===t||\"xlink:href\"===t||\"font\"===t)return i;if(\"imageSmoothing\"===t)return\"optimizeQuality\"===i;a=h?i.map(s):s(i,n)}}else i=\"\";return!h&&isNaN(a)?i:a}function f(t){return new RegExp(\"^(\"+t.join(\"|\")+\")\\\\b\",\"i\")}function g(t,e){var i,r,n,s,o=[];for(n=0,s=e.length;n<s;n++)i=e[n],r=t.getElementsByTagName(i),o=o.concat(Array.prototype.slice.call(r));return o}function m(t,e){var i,r=!0;return(i=p(t,e.pop()))&&e.length&&(r=function(t,e){for(var i,r=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(i=e.pop()),r=p(t=t.parentNode,i);return 0===e.length}(t,e)),i&&r&&0===e.length}function p(t,e){var i,r,n=t.nodeName,s=t.getAttribute(\"class\"),o=t.getAttribute(\"id\");if(i=new RegExp(\"^\"+n,\"i\"),e=e.replace(i,\"\"),o&&e.length&&(i=new RegExp(\"#\"+o+\"(?![a-zA-Z\\\\-]+)\",\"i\"),e=e.replace(i,\"\")),s&&e.length)for(r=(s=s.split(\" \")).length;r--;)i=new RegExp(\"\\\\.\"+s[r]+\"(?![a-zA-Z\\\\-]+)\",\"i\"),e=e.replace(i,\"\");return 0===e.length}function _(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var r,n,s,o=t.getElementsByTagName(\"*\");for(n=0,s=o.length;n<s;n++)if(e===(r=o[n]).getAttribute(\"id\"))return r}e.svgValidTagNamesRegEx=f([\"path\",\"circle\",\"polygon\",\"polyline\",\"ellipse\",\"rect\",\"line\",\"image\",\"text\"]),e.svgViewBoxElementsRegEx=f([\"symbol\",\"image\",\"marker\",\"pattern\",\"view\",\"svg\"]),e.svgInvalidAncestorsRegEx=f([\"pattern\",\"defs\",\"symbol\",\"metadata\",\"clipPath\",\"mask\",\"desc\"]),e.svgValidParentsRegEx=f([\"symbol\",\"g\",\"a\",\"svg\",\"clipPath\",\"defs\"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,i,r){t[r]=Math.tan(e.util.degreesToRadians(i[0]))}var i=e.iMatrix,r=e.reNum,n=e.commaWsp,s=\"(?:(?:(matrix)\\\\s*\\\\(\\\\s*(\"+r+\")\"+n+\"(\"+r+\")\"+n+\"(\"+r+\")\"+n+\"(\"+r+\")\"+n+\"(\"+r+\")\"+n+\"(\"+r+\")\\\\s*\\\\))|(?:(translate)\\\\s*\\\\(\\\\s*(\"+r+\")(?:\"+n+\"(\"+r+\"))?\\\\s*\\\\))|(?:(scale)\\\\s*\\\\(\\\\s*(\"+r+\")(?:\"+n+\"(\"+r+\"))?\\\\s*\\\\))|(?:(rotate)\\\\s*\\\\(\\\\s*(\"+r+\")(?:\"+n+\"(\"+r+\")\"+n+\"(\"+r+\"))?\\\\s*\\\\))|(?:(skewX)\\\\s*\\\\(\\\\s*(\"+r+\")\\\\s*\\\\))|(?:(skewY)\\\\s*\\\\(\\\\s*(\"+r+\")\\\\s*\\\\)))\",o=new RegExp(\"^\\\\s*(?:(?:\"+s+\"(?:\"+n+\"*\"+s+\")*)?)\\\\s*$\"),a=new RegExp(s,\"g\");return function(r){var n=i.concat(),h=[];if(!r||r&&!o.test(r))return n;r.replace(a,(function(r){var o=new RegExp(s).exec(r).filter((function(t){return!!t})),a=o[1],l=o.slice(2).map(parseFloat);switch(a){case\"translate\":!function(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}(n,l);break;case\"rotate\":l[0]=e.util.degreesToRadians(l[0]),function(t,i){var r=e.util.cos(i[0]),n=e.util.sin(i[0]),s=0,o=0;3===i.length&&(s=i[1],o=i[2]),t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=s-(r*s-n*o),t[5]=o-(n*s+r*o)}(n,l);break;case\"scale\":!function(t,e){var i=e[0],r=2===e.length?e[1]:e[0];t[0]=i,t[3]=r}(n,l);break;case\"skewX\":t(n,l,2);break;case\"skewY\":t(n,l,1);break;case\"matrix\":n=l}h.push(n.concat()),n=i.concat()}));for(var l=h[0];h.length>1;)h.shift(),l=e.util.multiplyTransformMatrices(l,h[0]);return l}}();var v=new RegExp(\"^\\\\s*(\"+e.reNum+\"+)\\\\s*,?\\\\s*(\"+e.reNum+\"+)\\\\s*,?\\\\s*(\"+e.reNum+\"+)\\\\s*,?\\\\s*(\"+e.reNum+\"+)\\\\s*$\");
2function y(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var i,r,n,o,a,h,l=t.getAttribute(\"viewBox\"),c=1,u=1,d=t.getAttribute(\"width\"),f=t.getAttribute(\"height\"),g=t.getAttribute(\"x\")||0,m=t.getAttribute(\"y\")||0,p=t.getAttribute(\"preserveAspectRatio\")||\"\",_=!l||!(l=l.match(v)),y=!d||!f||\"100%\"===d||\"100%\"===f,w=_&&y,C={},E=\"\",T=0,S=0;if(C.width=0,C.height=0,C.toBeParsed=w,_&&(g||m)&&t.parentNode&&\"#document\"!==t.parentNode.nodeName&&(E=\" translate(\"+s(g)+\" \"+s(m)+\") \",a=(t.getAttribute(\"transform\")||\"\")+E,t.setAttribute(\"transform\",a),t.removeAttribute(\"x\"),t.removeAttribute(\"y\")),w)return C;if(_)return C.width=s(d),C.height=s(f),C;if(i=-parseFloat(l[1]),r=-parseFloat(l[2]),n=parseFloat(l[3]),o=parseFloat(l[4]),C.minX=i,C.minY=r,C.viewBoxWidth=n,C.viewBoxHeight=o,y?(C.width=n,C.height=o):(C.width=s(d),C.height=s(f),c=C.width/n,u=C.height/o),\"none\"!==(p=e.util.parsePreserveAspectRatioAttribute(p)).alignX&&(\"meet\"===p.meetOrSlice&&(u=c=c>u?u:c),\"slice\"===p.meetOrSlice&&(u=c=c>u?c:u),T=C.width-n*c,S=C.height-o*c,\"Mid\"===p.alignX&&(T/=2),\"Mid\"===p.alignY&&(S/=2),\"Min\"===p.alignX&&(T=0),\"Min\"===p.alignY&&(S=0)),1===c&&1===u&&0===i&&0===r&&0===g&&0===m)return C;if((g||m)&&\"#document\"!==t.parentNode.nodeName&&(E=\" translate(\"+s(g)+\" \"+s(m)+\") \"),a=E+\" matrix(\"+c+\" 0 0 \"+u+\" \"+(i*c+T)+\" \"+(r*u+S)+\") \",\"svg\"===t.nodeName){for(h=t.ownerDocument.createElementNS(e.svgNS,\"g\");t.firstChild;)h.appendChild(t.firstChild);t.appendChild(h)}else(h=t).removeAttribute(\"x\"),h.removeAttribute(\"y\"),a=h.getAttribute(\"transform\")+a;return h.setAttribute(\"transform\",a),C}function w(t,e){var i=\"xlink:href\",r=_(t,e.getAttribute(i).slice(1));if(r&&r.getAttribute(i)&&w(t,r),[\"gradientTransform\",\"x1\",\"x2\",\"y1\",\"y2\",\"gradientUnits\",\"cx\",\"cy\",\"r\",\"fx\",\"fy\"].forEach((function(t){r&&!e.hasAttribute(t)&&r.hasAttribute(t)&&e.setAttribute(t,r.getAttribute(t))})),!e.children.length)for(var n=r.cloneNode(!0);n.firstChild;)e.appendChild(n.firstChild);e.removeAttribute(i)}e.parseSVGDocument=function(t,i,n,s){if(t){!function(t){for(var i=g(t,[\"use\",\"svg:use\"]),r=0;i.length&&r<i.length;){var n=i[r],s=n.getAttribute(\"xlink:href\")||n.getAttribute(\"href\");if(null===s)return;var o,a,h,l,c=s.slice(1),u=n.getAttribute(\"x\")||0,d=n.getAttribute(\"y\")||0,f=_(t,c).cloneNode(!0),m=(f.getAttribute(\"transform\")||\"\")+\" translate(\"+u+\", \"+d+\")\",p=i.length,v=e.svgNS;if(y(f),/^svg$/i.test(f.nodeName)){var w=f.ownerDocument.createElementNS(v,\"g\");for(a=0,l=(h=f.attributes).length;a<l;a++)o=h.item(a),w.setAttributeNS(v,o.nodeName,o.nodeValue);for(;f.firstChild;)w.appendChild(f.firstChild);f=w}for(a=0,l=(h=n.attributes).length;a<l;a++)\"x\"!==(o=h.item(a)).nodeName&&\"y\"!==o.nodeName&&\"xlink:href\"!==o.nodeName&&\"href\"!==o.nodeName&&(\"transform\"===o.nodeName?m=o.nodeValue+\" \"+m:f.setAttribute(o.nodeName,o.nodeValue));f.setAttribute(\"transform\",m),f.setAttribute(\"instantiated_by_use\",\"1\"),f.removeAttribute(\"id\"),n.parentNode.replaceChild(f,n),i.length===p&&r++}}(t);var o,a,h=e.Object.__uid++,l=y(t),c=e.util.toArray(t.getElementsByTagName(\"*\"));if(l.crossOrigin=s&&s.crossOrigin,l.svgUid=h,0===c.length&&e.isLikelyNode){var u=[];for(o=0,a=(c=t.selectNodes('//*[name(.)!=\"svg\"]')).length;o<a;o++)u[o]=c[o];c=u}var d=c.filter((function(t){return y(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace(\"svg:\",\"\"))&&!function(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace(\"svg:\",\"\"))&&!t.getAttribute(\"instantiated_by_use\"))return!0;return!1}(t,e.svgInvalidAncestorsRegEx)}));if(!d||d&&!d.length)i&&i([],{});else{var f={};c.filter((function(t){return\"clipPath\"===t.nodeName.replace(\"svg:\",\"\")})).forEach((function(t){var i=t.getAttribute(\"id\");f[i]=e.util.toArray(t.getElementsByTagName(\"*\")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace(\"svg:\",\"\"))}))})),e.gradientDefs[h]=e.getGradientDefs(t),e.cssRules[h]=e.getCSSRules(t),e.clipPaths[h]=f,e.parseElements(d,(function(t,r){i&&(i(t,l,r,c),delete e.gradientDefs[h],delete e.cssRules[h],delete e.clipPaths[h])}),r(l),n,s)}}};var C=new RegExp(\"(normal|italic)?\\\\s*(normal|small-caps)?\\\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\\\s*(\"+e.reNum+\"(?:px|cm|mm|em|pt|pc|in)
2*)(?:\\\\/(normal|\"+e.reNum+\"))?\\\\s+(.*)\");i(e,{parseFontDeclaration:function(t,e){var i=t.match(C);if(i){var r=i[1],n=i[3],o=i[4],a=i[5],h=i[6];r&&(e.fontStyle=r),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),o&&(e.fontSize=s(o)),h&&(e.fontFamily=h),a&&(e.lineHeight=\"normal\"===a?1:a)}},getGradientDefs:function(t){var e,i=g(t,[\"linearGradient\",\"radialGradient\",\"svg:linearGradient\",\"svg:radialGradient\"]),r=0,n={};for(r=i.length;r--;)(e=i[r]).getAttribute(\"xlink:href\")&&w(t,e),n[e.getAttribute(\"id\")]=e;return n},parseAttributes:function(t,r,o){if(t){var a,f,g,p={};void 0===o&&(o=t.getAttribute(\"svgUid\")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(p=e.parseAttributes(t.parentNode,r,o));var _=r.reduce((function(e,i){return(a=t.getAttribute(i))&&(e[i]=a),e}),{}),v=i(function(t,i){var r={};for(var n in e.cssRules[i])if(m(t,n.split(\" \")))for(var s in e.cssRules[i][n])r[s]=e.cssRules[i][n][s];return r}(t,o),e.parseStyleAttribute(t));_=i(_,v),v[c]&&t.setAttribute(c,v[c]),f=g=p.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,_[l]&&(_[l]=f=s(_[l],g));var y,w,C={};for(var E in _)w=d(y=u(E),_[E],p,f),C[y]=w;C&&C.font&&e.parseFontDeclaration(C.font,C);var T=i(p,C);return e.svgValidParentsRegEx.test(t.nodeName)?T:function(t){for(var i in h)if(void 0!==t[h[i]]&&\"\"!==t[i]){if(void 0===t[i]){if(!e.Object.prototype[i])continue;t[i]=e.Object.prototype[i]}if(0!==t[i].indexOf(\"url(\")){var r=new e.Color(t[i]);t[i]=r.setAlpha(n(r.getAlpha()*t[h[i]],2)).toRgba()}}return t}(T)}},parseElements:function(t,i,r,n,s){new e.ElementsParser(t,i,r,n,s).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute(\"style\");return i?(\"string\"==typeof i?function(t,e){var i,r;t.replace(/;\\s*$/,\"\").split(\";\").forEach((function(t){var n=t.split(\":\");i=n[0].trim().toLowerCase(),r=n[1].trim(),e[i]=r}))}(i,e):function(t,e){var i,r;for(var n in t)void 0!==t[n]&&(i=n.toLowerCase(),r=t[n],e[i]=r)}(i,e),e):e},parsePointsAttribute:function(t){if(!t)return null;var e,i,r=[];for(e=0,i=(t=(t=t.replace(/,/g,\" \").trim()).split(/\\s+/)).length;e<i;e+=2)r.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return r},getCSSRules:function(t){var i,r,n=t.getElementsByTagName(\"style\"),s={};for(i=0,r=n.length;i<r;i++){var o=n[i].textContent;\"\"!==(o=o.replace(/\\/\\*[\\s\\S]*?\\*\\//g,\"\")).trim()&&o.split(\"}\").filter((function(t){return t.trim()})).forEach((function(t){var n=t.split(\"{\"),o={},a=n[1].trim().split(\";\").filter((function(t){return t.trim()}));for(i=0,r=a.length;i<r;i++){var h=a[i].split(\":\"),l=h[0].trim(),c=h[1].trim();o[l]=c}(t=n[0].trim()).split(\",\").forEach((function(t){\"\"!==(t=t.replace(/^svg/i,\"\").trim())&&(s[t]?e.util.object.extend(s[t],o):s[t]=e.util.object.clone(o))}))}))}return s},loadSVGFromURL:function(t,i,r,n){t=t.replace(/^\\n\\s*/,\"\").trim(),new e.util.request(t,{method:\"get\",onComplete:function(t){var s=t.responseXML;if(!s||!s.documentElement)return i&&i(null),!1;e.parseSVGDocument(s.documentElement,(function(t,e,r,n){i&&i(t,e,r,n)}),r,n)}})},loadSVGFromString:function(t,i,r,n){var s=(new e.window.DOMParser).parseFromString(t.trim(),\"text/xml\");e.parseSVGDocument(s.documentElement,(function(t,e,r,n){i(t,e,r,n)}),r,n)}})}(e),S.ElementsParser=function(t,e,i,r,n,s){this.elements=t,this.callback=e,this.options=i,this.reviver=r,this.svgUid=i&&i.svgUid||0,this.parsingOptions=n,this.regexUrl=/^url\\(['\"]?#([^'\"]+)['\"]?\\)/g,this.doc=s},(p=S.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},p.createObjects=function(){var t=this;this.elements.forEach((function(e,i){e.setAttribute(\"svgUid\",t.svgUid),t.createObject(e,i)}))},p.findTag=function(t){return S[S.util.string.capitalize(t.tagName.replace(\"svg:\",\"\"))]},p.createObject=function(t,e){var i=this.findTag(t);if(i&&i.fromElement)try{i.fromElement(t,this.createCallback(e,t),this.options)}catch(t){S.log(t)}else this.checkIfDone()},p.createCallback=function(t,e){var i=this;return function(r){var n;i.resolveGradient(r,e,\"fill\"),i.resolveGradient(r,e,\"stroke\"),r instanceof S.Image&&r._originalElement&&(n=r.parsePreserveAspectRatioAttribute(e)),r._removeTransformMatrix(n),i.resolveClipPath(r,e),i.reviver&&i.reviver(e,r),i.instances[t]=r,i.checkIfDone()}}
2,p.extractPropertyDefinition=function(t,e,i){var r=t[e],n=this.regexUrl;if(n.test(r)){n.lastIndex=0;var s=n.exec(r)[1];return n.lastIndex=0,S[i][this.svgUid][s]}},p.resolveGradient=function(t,e,i){var r=this.extractPropertyDefinition(t,i,\"gradientDefs\");if(r){var n=e.getAttribute(i+\"-opacity\"),s=S.Gradient.fromElement(r,t,n,this.options);t.set(i,s)}},p.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},p.resolveClipPath=function(t,e){var i,r,n,s,o=this.extractPropertyDefinition(t,\"clipPath\",\"clipPaths\");if(o){n=[],r=S.util.invertTransform(t.calcTransformMatrix());for(var a=o[0].parentNode,h=e;h.parentNode&&h.getAttribute(\"clip-path\")!==t.clipPath;)h=h.parentNode;h.parentNode.appendChild(a);for(var l=0;l<o.length;l++)i=o[l],this.findTag(i).fromElement(i,this.createClipPathCallback(t,n),this.options);o=1===n.length?n[0]:new S.Group(n),s=S.util.multiplyTransformMatrices(r,o.calcTransformMatrix()),o.clipPath&&this.resolveClipPath(o,h);var c=S.util.qrDecompose(s);o.flipX=!1,o.flipY=!1,o.set(\"scaleX\",c.scaleX),o.set(\"scaleY\",c.scaleY),o.angle=c.angle,o.skewX=c.skewX,o.skewY=0,o.setPositionByOrigin({x:c.translateX,y:c.translateY},\"center\",\"center\"),t.clipPath=o}else delete t.clipPath},p.checkIfDone=function(){0==--this.numElements&&(this.instances=this.instances.filter((function(t){return null!=t})),this.callback(this.instances,this.elements))},function(t){var e=t.fabric||(t.fabric={});function i(t,e){this.x=t,this.y=e}e.Point?e.warn(\"fabric.Point is already defined\"):(e.Point=i,i.prototype={type:\"point\",constructor:i,add:function(t){return new i(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new i(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new i(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new i(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new i(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new i(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return void 0===e&&(e=.5),e=Math.max(Math.min(1,e),0),new i(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new i(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new i(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+\",\"+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i},clone:function(){return new i(this.x,this.y)}})}(e),function(t){var e=t.fabric||(t.fabric={});function i(t){this.status=t,this.points=[]}e.Intersection?e.warn(\"fabric.Intersection is already defined\"):(e.Intersection=i,e.Intersection.prototype={constructor:i,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,r,n,s){var o,a=(s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x),h=(r.x-t.x)*(t.y-n.y)-(r.y-t.y)*(t.x-n.x),l=(s.y-n.y)*(r.x-t.x)-(s.x-n.x)*(r.y-t.y);if(0!==l){var c=a/l,u=h/l;0<=c&&c<=1&&0<=u&&u<=1?(o=new i(\"Intersection\")).appendPoint(new e.Point(t.x+c*(r.x-t.x),t.y+c*(r.y-t.y))):o=new i}else o=new i(0===a||0===h?\"Coincident\":\"Parallel\");return o},e.Intersection.intersectLinePolygon=function(t,e,r){var n,s,o,a,h=new i,l=r.length;for(a=0;a<l;a++)n=r[a],s=r[(a+1)%l],o=i.intersectLineLine(t,e,n,s),h.appendPoints(o.points);return h.points.length>0&&(h.status=\"Intersection\"),h},e.Intersection.intersectPolygonPolygon=function(t,e){var r,n=new i,s=t.length;for(r=0;r<s;r++){var o=t[r],a=t[(r+1)%s],h=i.intersectLinePolygon(o,a,e);n.appendPoints(h.points)}return n.points.length>0&&(n.status=\"Intersection\"),n},e.Intersection.intersectPolygonRectangle=function(t,r,n){var s=r.min(n),o=r.max(n),a=new e.Point(o.x,s.y),h=new e.Point(s.x,o.y),l=i.intersectLinePolygon(s,a,t),c=i.intersectLinePolygon(a,o,t),u=i.intersectLinePolygon(o,h,t),d=i.intersectLinePolygon(h,s,t),f=new i;return f.appendPoints(l.points),f.appendPoints(c.points),f.appendPoints(u.points),f.appendPoints(d.points),f.points.length>0&&(f.status=\"Intersection\"),f})}(e),function(t){var e=t.fabric||(t.fabric={});function i(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function r(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}e.Color?e.warn(\"fabric.Color is already defined.\"):(e.Color=i,e.Color.prototype={_tryParsingColor:function(t){var e;t in i.colorNameMap&&(t=i.colorNameMap[t]),\"transparent\"===t&&(e=[255,255,255,0]),e||(e=i.sourceFromHex(t)),e||(e=i.sourceFromRgb(t)),e||(e=i.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,i,r){t/=255,i/=255,r/=255;var n,s,o,a=e.util.array.max([t,i,r]),h=e.util.array.min([t,i,r]);if(o=(a+h)/2,a===h)n=s=0;else{var l=a-h;switch(s=o>.5?l/(2-a-h):l/(a+h),a){case t:n=(i-r)/l+(i<r?6:0);break;case i:n=(r-t)/l+2;break;case r:n=(t-i)/l+4}n/=6}return[Math.round(360*n),Math.round(100*s),Math.round(100*o)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return\"rgb(\"+t[0]+\",\"+t[1]+\",\"+t[2]+\")\"},toRgba:function(){var t=this.getSource();return\"rgba(\"+t[0]+\",\"+t[1]+\",\"+t[2]+\",\"+t[3]+\")\"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return\"hsl(\"+e[0]+\",\"+e[1]+\"%,\"+e[2]+\"%)\"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return\"hsla(\"+e[0]+\",\"+e[1]+\"%,\"+e[2]+\"%,\"+t[3]+\")\"},toHex:function(){var t,e,i,r=this.getSource();return t=1===(t=r[0].toString(16)).length?\"0\"+t:t,e=1===(e=r[1].toString(16)).length?\"0\"+e:e,i=1===(i=r[2].toString(16)).length?\"0\"+i:i,t.toUpperCase()+e.toUpperCase()+i.toUpperCase()},toHexa:function(){var t,e=this.getSource();return t=1===(t=(t=Math.round(255*e[3])).toString(16)).length?\"0\"+t:t,this.toHex()+t.toUpperCase()}
vendor: 1,334 bytes, line 2
2,getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),r=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,r]),this},overlayWith:function(t){t instanceof i||(t=new i(t));var e,r=[],n=this.getAlpha(),s=this.getSource(),o=t.getSource();for(e=0;e<3;e++)r.push(Math.round(.5*s[e]+.5*o[e]));return r[3]=n,this.setSource(r),this}},e.Color.reRGBa=/^rgba?\\(\\s*(\\d{1,3}(?:\\.\\d+)?\\%?)\\s*,\\s*(\\d{1,3}(?:\\.\\d+)?\\%?)\\s*,\\s*(\\d{1,3}(?:\\.\\d+)?\\%?)\\s*(?:\\s*,\\s*((?:\\d*\\.?\\d+)?)\\s*)?\\)$/i,e.Color.reHSLa=/^hsla?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3}\\%)\\s*,\\s*(\\d{1,3}\\%)\\s*(?:\\s*,\\s*(\\d+(?:\\.\\d+)?)\\s*)?\\)$/i,e.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,e.Color.colorNameMap={aliceblue:\"#F0F8FF\",antiquewhite:\"#FAEBD7\",aqua:\"#00FFFF\",aquamarine:\"#7FFFD4\",azure:\"#F0FFFF\",beige:\"#F5F5DC\",bisque:\"#FFE4C4\",black:\"#000000\",blanchedalmond:\"#FFEBCD\",blue:\"#0000FF\",blueviolet:\"#8A2BE2\",brown:\"#A52A2A\",burlywood:\"#DEB887\",cadetblue:\"#5
2F9EA0\",chartreuse:\"#7FFF00\",chocolate:\"#D2691E\",coral:\"#FF7F50\",cornflowerblue:\"#6495ED\",cornsilk:\"#FFF8DC\",crimson:\"#DC143C\",cyan:\"#00FFFF\",darkblue:\"#00008B\",darkcyan:\"#008B8B\",darkgoldenrod:\"#B8860B\",darkgray:\"#A9A9A9\",darkgrey:\"#A9A9A9\",darkgreen:\"#006400\",darkkhaki:\"#BDB76B\",darkmagenta:\"#8B008B\",darkolivegreen:\"#556B2F\",darkorange:\"#FF8C00\",darkorchid:\"#9932CC\",darkred:\"#8B0000\",darksalmon:\"#E9967A\",darkseagreen:\"#8FBC8F\",darkslateblue:\"#483D8B\",darkslategray:\"#2F4F4F\",darkslategrey:\"#2F4F4F\",darkturquoise:\"#00CED1\",darkviolet:\"#9400D3\",deeppink:\"#FF1493\",deepskyblue:\"#00BFFF\",dimgray:\"#696969\",dimgrey:\"#696969\",dodgerblue:\"#1E90FF\",firebrick:\"#B22222\",floralwhite:\"#FFFAF0\",forestgreen:\"#228B22\",fuchsia:\"#FF00FF\",gainsboro:\"#DCDCDC\",ghostwhite:\"#F8F8FF\",gold:\"#FFD700\",goldenrod:\"#DAA520\",gray:\"#808080\",grey:\"#808080\",green:\"#008000\",greenyellow:\"#ADFF2F\",honeydew:\"#F0FFF0\",hotpink:\"#FF69B4\",indianred:\"#CD5C5C\",indigo:\"#4B0082\",ivory:\"#FFFFF0\",khaki:\"#F0E68C\",lavender:\"#E6E6FA\",lavenderblush:\"#FFF0F5\",lawngreen:\"#7CFC00\",lemonchiffon:\"#FFFACD\",lightblue:\"#ADD8E6\",lightcoral:\"#F08080\",lightcyan:\"#E0FFFF\",lightgoldenrodyellow:\"#FAFAD2\",lightgray:\"#D3D3D3\",lightgrey:\"#D3D3D3\",lightgreen:\"#90EE90\",lightpink:\"#FFB6C1\",lightsalmon:\"#FFA07A\",lightseagreen:\"#20B2AA\",lightskyblue:\"#87CEFA\",lightslategray:\"#778899\",lightslategrey:\"#778899\",lightsteelblue:\"#B0C4DE\",lightyellow:\"#FFFFE0\",lime:\"#00FF00\",limegreen:\"#32CD32\",linen:\"#FAF0E6\",magenta:\"#FF00FF\",maroon:\"#800000\",mediumaquamarine:\"#66CDAA\",mediumblue:\"#0000CD\",mediumorchid:\"#BA55D3\",mediumpurple:\"#9370DB\",mediumseagreen:\"#3CB371\",mediumslateblue:\"#7B68EE\",mediumspringgreen:\"#00FA9A\",mediumturquoise:\"#48D1CC\",mediumvioletred:\"#C71585\",midnightblue:\"#191970\",mintcream:\"#F5FFFA\",mistyrose:\"#FFE4E1\",moccasin:\"#FFE4B5\",navajowhite:\"#FFDEAD\",navy:\"#000080\",oldlace:\"#FDF5E6\",olive:\"#808000\",olivedrab:\"#6B8E23\",orange:\"#FFA500\",orangered:\"#FF4500\",orchid:\"#DA70D6\",palegoldenrod:\"#EEE8AA\",palegreen:\"#98FB98\",paleturquoise:\"#AFEEEE\",palevioletred:\"#DB7093\",papayawhip:\"#FFEFD5\",peachpuff:\"#FFDAB9\",peru:\"#CD853F\",pink:\"#FFC0CB\",plum:\"#DDA0DD\",powderblue:\"#B0E0E6\",purple:\"#800080\",rebeccapurple:\"#663399\",red:\"#FF0000\",rosybrown:\"#BC8F8F\",royalblue:\"#4169E1\",saddlebrown:\"#8B4513\",salmon:\"#FA8072\",sandybrown:\"#F4A460\",seagreen:\"#2E8B57\",seashell:\"#FFF5EE\",sienna:\"#A0522D\",silver:\"#C0C0C0\",skyblue:\"#87CEEB\",slateblue:\"#6A5ACD\",slategray:\"#708090\",slategrey:\"#708090\",snow:\"#FFFAFA\",springgreen:\"#00FF7F\",steelblue:\"#4682B4\",tan:\"#D2B48C\",teal:\"#008080\",thistle:\"#D8BFD8\",tomato:\"#FF6347\",turquoise:\"#40E0D0\",violet:\"#EE82EE\",wheat:\"#F5DEB3\",white:\"#FFFFFF\",whitesmoke:\"#F5F5F5\",yellow:\"#FFFF00\",yellowgreen:\"#9ACD32\"},e.Color.fromRgb=function(t){return i.fromSource(i.sourceFromRgb(t))},e.Color.sourceFromRgb=function(t){var e=t.match(i.reRGBa);if(e){var r=parseInt(e[1],10)/(/%$/.test(e[1])?100:1)*(/%$/.test(e[1])?255:1),n=parseInt(e[2],10)/(/%$/.test(e[2])?100:1)*(/%$/.test(e[2])?255:1),s=parseInt(e[3],10)/(/%$/.test(e[3])?100:1)*(/%$/.test(e[3])?255:1);return[parseInt(r,10),parseInt(n,10),parseInt(s,10),e[4]?parseFloat(e[4]):1]}},e.Color.fromRgba=i.fromRgb,e.Color.fromHsl=function(t){return i.fromSource(i.sourceFromHsl(t))},e.Color.sourceFromHsl=function(t){var e=t.match(i.reHSLa);if(e){var n,s,o,a=(parseFloat(e[1])%360+360)%360/360,h=parseFloat(e[2])/(/%$/.test(e[2])?100:1),l=parseFloat(e[3])/(/%$/.test(e[3])?100:1);if(0===h)n=s=o=l;else{var c=l<=.5?l*(h+1):l+h-l*h,u=2*l-c;n=r(u,c,a+1/3),s=r(u,c,a),o=r(u,c,a-1/3)}return[Math.round(255*n),Math.round(255*s),Math.round(255*o),e[4]?parseFloat(e[4]):1]}},e.Color.fromHsla=i.fromHsl,e.Color.fromHex=function(t){return i.fromSource(i.sourceFromHex(t))},e.Color.sourceFromHex=function(t){if(t.match(i.reHex)){var e=t.slice(t.indexOf(\"#\")+1),r=3===e.length||4===e.length,n=8===e.length||4===e.length,s=r?e.charAt(0)+e.charAt(0):e.substring(0,2),o=r?e.charAt(1)+e.charAt(1):e.substring(2,4),a=r?e.charAt(2)+e.charAt(2):e.substring(4,6),h=n?r?e.charAt(3)+e.charAt(3):e.substring(6,8):\"FF\";return[parseInt(s,16),parseInt(o,16),parseInt(a,16),parseFloat((parseInt(h,16)/255).toFixed(2))]}},e.Color.fromSource=function(t){var e=new i;return e.setSource(t),e})}(e),function(t){var e=t.fabric||(t.fabric={}),i=[\"e\",\"se\",\"s\",\"sw\",\"w\",\"nw\",\"n\",\"ne\",\"e\"],r=[\"ns\",\"nesw\",\"ew\",\"nwse\"],n={},s=\"left\",o=\"top\",a=\"right\",h=\"bottom\",l=\"center\",c={top:h,bottom:o,left
2:a,right:s,center:l},u=e.util.radiansToDegrees,d=Math.sign||function(t){return(t>0)-(t<0)||+t};function f(t,e){var i=t.angle+u(Math.atan2(e.y,e.x))+360;return Math.round(i%360/45)}function g(t,i){var r=i.transform.target,n=r.canvas,s=e.util.object.clone(i);s.target=r,n&&n.fire(\"object:\"+t,s),r.fire(t,i)}function m(t,e){var i=e.canvas,r=t[i.uniScaleKey];return i.uniformScaling&&!r||!i.uniformScaling&&r}function p(t){return t.originX===l&&t.originY===l}function _(t,e,i){var r=t.lockScalingX,n=t.lockScalingY;return!((!r||!n)&&(e||!r&&!n||!i)&&(!r||\"x\"!==e)&&(!n||\"y\"!==e))}function v(t,e,i,r){return{e:t,transform:e,pointer:{x:i,y:r}}}function y(t){return function(e,i,r,n){var s=i.target,o=s.getCenterPoint(),a=s.translateToOriginPoint(o,i.originX,i.originY),h=t(e,i,r,n);return s.setPositionByOrigin(a,i.originX,i.originY),h}}function w(t,e){return function(i,r,n,s){var o=e(i,r,n,s);return o&&g(t,v(i,r,n,s)),o}}function C(t,i,r,n,s){var o=t.target,a=o.controls[t.corner],h=o.canvas.getZoom(),l=o.padding/h,c=o.toLocalPoint(new e.Point(n,s),i,r);return c.x>=l&&(c.x-=l),c.x<=-l&&(c.x+=l),c.y>=l&&(c.y-=l),c.y<=l&&(c.y+=l),c.x-=a.offsetX,c.y-=a.offsetY,c}function E(t){return t.flipX!==t.flipY}function T(t,e,i,r,n){if(0!==t[e]){var s=n/t._getTransformedDimensions()[r]*t[i];t.set(i,s)}}function S(t,e,i,r){var n,l=e.target,c=l._getTransformedDimensions(0,l.skewY),d=C(e,e.originX,e.originY,i,r),f=Math.abs(2*d.x)-c.x,g=l.skewX;f<2?n=0:(n=u(Math.atan2(f/l.scaleX,c.y/l.scaleY)),e.originX===s&&e.originY===h&&(n=-n),e.originX===a&&e.originY===o&&(n=-n),E(l)&&(n=-n));var m=g!==n;if(m){var p=l._getTransformedDimensions().y;l.set(\"skewX\",n),T(l,\"skewY\",\"scaleY\",\"y\",p)}return m}function b(t,e,i,r){var n,l=e.target,c=l._getTransformedDimensions(l.skewX,0),d=C(e,e.originX,e.originY,i,r),f=Math.abs(2*d.y)-c.y,g=l.skewY;f<2?n=0:(n=u(Math.atan2(f/l.scaleY,c.x/l.scaleX)),e.originX===s&&e.originY===h&&(n=-n),e.originX===a&&e.originY===o&&(n=-n),E(l)&&(n=-n));var m=g!==n;if(m){var p=l._getTransformedDimensions().x;l.set(\"skewY\",n),T(l,\"skewX\",\"scaleX\",\"x\",p)}return m}function I(t,e,i,r,n){n=n||{};var s,o,a,h,l,u,f=e.target,g=f.lockScalingX,v=f.lockScalingY,y=n.by,w=m(t,f),E=_(f,y,w),T=e.gestureScale;if(E)return!1;if(T)o=e.scaleX*T,a=e.scaleY*T;else{if(s=C(e,e.originX,e.originY,i,r),l=\"y\"!==y?d(s.x):1,u=\"x\"!==y?d(s.y):1,e.signX||(e.signX=l),e.signY||(e.signY=u),f.lockScalingFlip&&(e.signX!==l||e.signY!==u))return!1;if(h=f._getTransformedDimensions(),w&&!y){var S=Math.abs(s.x)+Math.abs(s.y),b=e.original,I=S/(Math.abs(h.x*b.scaleX/f.scaleX)+Math.abs(h.y*b.scaleY/f.scaleY));o=b.scaleX*I,a=b.scaleY*I}else o=Math.abs(s.x*f.scaleX/h.x),a=Math.abs(s.y*f.scaleY/h.y);p(e)&&(o*=2,a*=2),e.signX!==l&&\"y\"!==y&&(e.originX=c[e.originX],o*=-1,e.signX=l),e.signY!==u&&\"x\"!==y&&(e.originY=c[e.originY],a*=-1,e.signY=u)}var x=f.scaleX,O=f.scaleY;return y?(\"x\"===y&&f.set(\"scaleX\",o),\"y\"===y&&f.set(\"scaleY\",a)):(!g&&f.set(\"scaleX\",o),!v&&f.set(\"scaleY\",a)),x!==f.scaleX||O!==f.scaleY}n.scaleCursorStyleHandler=function(t,e,r){var n=m(t,r),s=\"\";if(0!==e.x&&0===e.y?s=\"x\":0===e.x&&0!==e.y&&(s=\"y\"),_(r,s,n))return\"not-allowed\";var o=f(r,e);return i[o]+\"-resize\"},n.skewCursorStyleHandler=function(t,e,i){var n=\"not-allowed\";if(0!==e.x&&i.lockSkewingY)return n;if(0!==e.y&&i.lockSkewingX)return n;var s=f(i,e)%4;return r[s]+\"-resize\"},n.scaleSkewCursorStyleHandler=function(t,e,i){return t[i.canvas.altActionKey]?n.skewCursorStyleHandler(t,e,i):n.scaleCursorStyleHandler(t,e,i)},n.rotationWithSnapping=w(\"rotating\",y((function(t,e,i,r){var n=e,s=n.target,o=s.translateToOriginPoint(s.getCenterPoint(),n.originX,n.originY);if(s.lockRotation)return!1;var a,h=Math.atan2(n.ey-o.y,n.ex-o.x),l=Math.atan2(r-o.y,i-o.x),c=u(l-h+n.theta);if(s.snapAngle>0){var d=s.snapAngle,f=s.snapThreshold||d,g=Math.ceil(c/d)*d,m=Math.floor(c/d)*d;Math.abs(c-m)<f?c=m:Math.abs(c-g)<f&&(c=g)}return c<0&&(c=360+c),c%=360,a=s.angle!==c,s.angle=c,a}))),n.scalingEqually=w(\"scaling\",y((function(t,e,i,r){return I(t,e,i,r)}))),n.scalingX=w(\"scaling\",y((function(t,e,i,r){return I(t,e,i,r,{by:\"x\"})}
2))),n.scalingY=w(\"scaling\",y((function(t,e,i,r){return I(t,e,i,r,{by:\"y\"})}))),n.scalingYOrSkewingX=function(t,e,i,r){return t[e.target.canvas.altActionKey]?n.skewHandlerX(t,e,i,r):n.scalingY(t,e,i,r)},n.scalingXOrSkewingY=function(t,e,i,r){return t[e.target.canvas.altActionKey]?n.skewHandlerY(t,e,i,r):n.scalingX(t,e,i,r)},n.changeWidth=w(\"resizing\",y((function(t,e,i,r){var n=e.target,s=C(e,e.originX,e.originY,i,r),o=n.strokeWidth/(n.strokeUniform?n.scaleX:1),a=p(e)?2:1,h=n.width,l=Math.abs(s.x*a/n.scaleX)-o;return n.set(\"width\",Math.max(l,0)),h!==l}))),n.skewHandlerX=function(t,e,i,r){var n,h=e.target,c=h.skewX,u=e.originY;return!h.lockSkewingX&&(0===c?n=C(e,l,l,i,r).x>0?s:a:(c>0&&(n=u===o?s:a),c<0&&(n=u===o?a:s),E(h)&&(n=n===s?a:s)),e.originX=n,w(\"skewing\",y(S))(t,e,i,r))},n.skewHandlerY=function(t,e,i,r){var n,a=e.target,c=a.skewY,u=e.originX;return!a.lockSkewingY&&(0===c?n=C(e,l,l,i,r).y>0?o:h:(c>0&&(n=u===s?o:h),c<0&&(n=u===s?h:o),E(a)&&(n=n===o?h:o)),e.originY=n,w(\"skewing\",y(b))(t,e,i,r))},n.dragHandler=function(t,e,i,r){var n=e.target,s=i-e.offsetX,o=r-e.offsetY,a=!n.get(\"lockMovementX\")&&n.left!==s,h=!n.get(\"lockMovementY\")&&n.top!==o;return a&&n.set(\"left\",s),h&&n.set(\"top\",o),(a||h)&&g(\"moving\",v(t,e,i,r)),a||h},n.scaleOrSkewActionName=function(t,e,i){var r=t[i.canvas.altActionKey];return 0===e.x?r?\"skewX\":\"scaleY\":0===e.y?r?\"skewY\":\"scaleX\":void 0},n.rotationStyleHandler=function(t,e,i){return i.lockRotation?\"not-allowed\":e.cursorStyle},n.fireEvent=g,n.wrapWithFixedAnchor=y,n.wrapWithFireEvent=w,n.getLocalPoint=C,e.controlsUtils=n}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.degreesToRadians,r=e.controlsUtils;r.renderCircleControl=function(t,e,i,r,n){r=r||{};var s,o=this.sizeX||r.cornerSize||n.cornerSize,a=this.sizeY||r.cornerSize||n.cornerSize,h=void 0!==r.transparentCorners?r.transparentCorners:n.transparentCorners,l=h?\"stroke\":\"fill\",c=!h&&(r.cornerStrokeColor||n.cornerStrokeColor),u=e,d=i;t.save(),t.fillStyle=r.cornerColor||n.cornerColor,t.strokeStyle=r.cornerStrokeColor||n.cornerStrokeColor,o>a?(s=o,t.scale(1,a/o),d=i*o/a):a>o?(s=a,t.scale(o/a,1),u=e*a/o):s=o,t.lineWidth=1,t.beginPath(),t.arc(u,d,s/2,0,2*Math.PI,!1),t[l](),c&&t.stroke(),t.restore()},r.renderSquareControl=function(t,e,r,n,s){n=n||{};var o=this.sizeX||n.cornerSize||s.cornerSize,a=this.sizeY||n.cornerSize||s.cornerSize,h=void 0!==n.transparentCorners?n.transparentCorners:s.transparentCorners,l=h?\"stroke\":\"fill\",c=!h&&(n.cornerStrokeColor||s.cornerStrokeColor),u=o/2,d=a/2;t.save(),t.fillStyle=n.cornerColor||s.cornerColor,t.strokeStyle=n.cornerStrokeColor||s.cornerStrokeColor,t.lineWidth=1,t.translate(e,r),t.rotate(i(s.angle)),t[l+\"Rect\"](-u,-d,o,a),c&&t.strokeRect(-u,-d,o,a),t.restore()}}(e),function(t){var e=t.fabric||(t.fabric={});e.Control=function(t){for(var e in t)this[e]=t[e]},e.Control.prototype={visible:!0,actionName:\"scale\",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:\"crosshair\",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){var i=t._controlsVisibility;return i&&void 0!==i[e]?i[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,i){return e.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},i)},calcCornerCoords:function(t,i,r,n,s){var o,a,h,l,c=s?this.touchSizeX:this.sizeX,u=s?this.touchSizeY:this.sizeY;if(c&&u&&c!==u){var d=Math.atan2(u,c),f=Math.sqrt(c*c+u*u)/2,g=d-e.util.degreesToRadians(t),m=Math.PI/2-d-e.util.degreesToRadians(t);o=f*e.util.cos(g),a=f*e.util.sin(g),h=f*e.util.cos(m),l=f*e.util.sin(m)}else f=.7071067812*(c&&u?c:i),g=e.util.degreesToRadians(45-t),o=h=f*e.util.cos(g),a=l=f*e.util.sin(g);return{tl:{x:r-l,y:n-h},tr:{x:r+o,y:n-a},bl:{x:r-o,y:n+a},br:{x:r+l,y:n+h}}},render:function(t,i,r,n,s){\"circle\"===((n=n||{}).cornerStyle||s.cornerStyle)?e.controlsUtils.renderCircleControl.call(this,t,i,r,n,s):e.controlsUtils.renderSquareControl.call(this,t,i,r,n,s)}}}(e),function(){function t(t,e){var i,r,n,s,o=t.getAttribute(\"style\"),a=t.getAttribute(\"offset\")||
20;if(a=(a=parseFloat(a)/(/%$/.test(a)?100:1))<0?0:a>1?1:a,o){var h=o.split(/\\s*;\\s*/);for(\"\"===h[h.length-1]&&h.pop(),s=h.length;s--;){var l=h[s].split(/\\s*:\\s*/),c=l[0].trim(),u=l[1].trim();\"stop-color\"===c?i=u:\"stop-opacity\"===c&&(n=u)}}return i||(i=t.getAttribute(\"stop-color\")||\"rgb(0,0,0)\"),n||(n=t.getAttribute(\"stop-opacity\")),r=(i=new S.Color(i)).getAlpha(),n=isNaN(parseFloat(n))?1:parseFloat(n),n*=r*e,{offset:a,color:i.toRgb(),opacity:n}}var e=S.util.object.clone;S.Gradient=S.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:\"pixels\",type:\"linear\",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,i=this;Object.keys(t).forEach((function(e){i[e]=t[e]})),this.id?this.id+=\"_\"+S.Object.__uid++:this.id=S.Object.__uid++,e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},\"radial\"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice()},addColorStop:function(t){for(var e in t){var i=new S.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(t){var e={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return S.util.populateWithProperties(this,e,t),e},toSVG:function(t,i){var r,n,s,o,a=e(this.coords,!0),h=(i=i||{},e(this.colorStops,!0)),l=a.r1>a.r2,c=this.gradientTransform?this.gradientTransform.concat():S.iMatrix.concat(),u=-this.offsetX,d=-this.offsetY,f=!!i.additionalTransform,g=\"pixels\"===this.gradientUnits?\"userSpaceOnUse\":\"objectBoundingBox\";if(h.sort((function(t,e){return t.offset-e.offset})),\"objectBoundingBox\"===g?(u/=t.width,d/=t.height):(u+=t.width/2,d+=t.height/2),\"path\"===t.type&&\"percentage\"!==this.gradientUnits&&(u-=t.pathOffset.x,d-=t.pathOffset.y),c[4]-=u,c[5]-=d,o='id=\"SVGID_'+this.id+'\" gradientUnits=\"'+g+'\"',o+=' gradientTransform=\"'+(f?i.additionalTransform+\" \":\"\")+S.util.matrixToSVG(c)+'\" ',\"linear\"===this.type?s=[\"<linearGradient \",o,' x1=\"',a.x1,'\" y1=\"',a.y1,'\" x2=\"',a.x2,'\" y2=\"',a.y2,'\">\\n']:\"radial\"===this.type&&(s=[\"<radialGradient \",o,' cx=\"',l?a.x1:a.x2,'\" cy=\"',l?a.y1:a.y2,'\" r=\"',l?a.r1:a.r2,'\" fx=\"',l?a.x2:a.x1,'\" fy=\"',l?a.y2:a.y1,'\">\\n']),\"radial\"===this.type){if(l)for((h=h.concat()).reverse(),r=0,n=h.length;r<n;r++)h[r].offset=1-h[r].offset;var m=Math.min(a.r1,a.r2);if(m>0){var p=m/Math.max(a.r1,a.r2);for(r=0,n=h.length;r<n;r++)h[r].offset+=p*(1-h[r].offset)}}for(r=0,n=h.length;r<n;r++){var _=h[r];s.push(\"<stop \",'offset=\"',100*_.offset+\"%\",'\" style=\"stop-color:',_.color,void 0!==_.opacity?\";stop-opacity: \"+_.opacity:\";\",'\"/>\\n')}return s.push(\"linear\"===this.type?\"</linearGradient>\\n\":\"</radialGradient>\\n\"),s.join(\"\")},toLive:function(t){var e,i,r,n=S.util.object.clone(this.coords);if(this.type){for(\"linear\"===this.type?e=t.createLinearGradient(n.x1,n.y1,n.x2,n.y2):\"radial\"===this.type&&(e=t.createRadialGradient(n.x1,n.y1,n.r1,n.x2,n.y2,n.r2)),i=0,r=this.colorStops.length;i<r;i++){var s=this.colorStops[i].color,o=this.colorStops[i].opacity,a=this.colorStops[i].offset;void 0!==o&&(s=new S.Color(s).setAlpha(o).toRgba()),e.addColorStop(a,s)}return e}}}),S.util.object.extend(S.Gradient,{fromElement:function(e,i,r,n){var s=parseFloat(r)/(/%$/.test(r)?100:1);s=s<0?0:s>1?1:s,isNaN(s)&&(s=1);var o,a,h,l,c=e.getElementsByTagName(\"stop\"),u=\"userSpaceOnUse\"===e.getAttribute(\"gradientUnits\")?\"pixels\":\"percentage\",d=e.getAttribute(\"gradientTransform\")||\"\",f=[],g=0,m=0;for(\"linearGradient\"===e.nodeName||\"LINEARGRADIENT\"===e.nodeName?(o=\"linear\",a=function(t){return{x1:t.getAttribute(\"x1\")||0,y1:t.getAttribute(\"y1\")||0,x2:t.getAttribute(\"x2\")||\"100%\",y2:t.getAttribute(\"y2\")||0}}(e)):(o=\"radial\",a=function(t){return{x1:t.getAttribute(\"fx\")||t.getAttribute(\"cx\")||\"50%\",y1:t.getAttribute(\"fy\")||t.getAttribute(\"cy\")||\"50%\",r1:0,x2:t.getAttribute(\"cx\")||\"50%\",y2:t.getAttribute(\"cy\")||\"50%\",r2:t.getAttribute(\"r\")||\"50%\"}}(e)),h=c.length;h--;)f.push(t(c[h],s));
2return l=S.parseTransformAttribute(d),function(t,e,i,r){var n,s;Object.keys(e).forEach((function(t){\"Infinity\"===(n=e[t])?s=1:\"-Infinity\"===n?s=0:(s=parseFloat(e[t],10),\"string\"==typeof n&&/^(\\d+\\.\\d+)%|(\\d+)%$/.test(n)&&(s*=.01,\"pixels\"===r&&(\"x1\"!==t&&\"x2\"!==t&&\"r2\"!==t||(s*=i.viewBoxWidth||i.width),\"y1\"!==t&&\"y2\"!==t||(s*=i.viewBoxHeight||i.height)))),e[t]=s}))}(0,a,n,u),\"pixels\"===u&&(g=-i.left,m=-i.top),new S.Gradient({id:e.getAttribute(\"id\"),type:o,coords:a,colorStops:f,gradientUnits:u,gradientTransform:l,offsetX:g,offsetY:m})}})}(),_=S.util.toFixed,S.Pattern=S.util.createClass({repeat:\"repeat\",offsetX:0,offsetY:0,crossOrigin:\"\",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=S.Object.__uid++,this.setOptions(t),!t.source||t.source&&\"string\"!=typeof t.source)e&&e(this);else{var i=this;this.source=S.util.createImage(),S.util.loadImage(t.source,(function(t,r){i.source=t,e&&e(i,r)}),null,this.crossOrigin)}},toObject:function(t){var e,i,r=S.Object.NUM_FRACTION_DIGITS;return\"string\"==typeof this.source.src?e=this.source.src:\"object\"==typeof this.source&&this.source.toDataURL&&(e=this.source.toDataURL()),i={type:\"pattern\",source:e,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:_(this.offsetX,r),offsetY:_(this.offsetY,r),patternTransform:this.patternTransform?this.patternTransform.concat():null},S.util.populateWithProperties(this,i,t),i},toSVG:function(t){var e=\"function\"==typeof this.source?this.source():this.source,i=e.width/t.width,r=e.height/t.height,n=this.offsetX/t.width,s=this.offsetY/t.height,o=\"\";return\"repeat-x\"!==this.repeat&&\"no-repeat\"!==this.repeat||(r=1,s&&(r+=Math.abs(s))),\"repeat-y\"!==this.repeat&&\"no-repeat\"!==this.repeat||(i=1,n&&(i+=Math.abs(n))),e.src?o=e.src:e.toDataURL&&(o=e.toDataURL()),'<pattern id=\"SVGID_'+this.id+'\" x=\"'+n+'\" y=\"'+s+'\" width=\"'+i+'\" height=\"'+r+'\">\\n<image x=\"0\" y=\"0\" width=\"'+e.width+'\" height=\"'+e.height+'\" xlink:href=\"'+o+'\"></image>\\n</pattern>\\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e=this.source;if(!e)return\"\";if(void 0!==e.src){if(!e.complete)return\"\";if(0===e.naturalWidth||0===e.naturalHeight)return\"\"}return t.createPattern(e,this.repeat)}}),function(t){var e=t.fabric||(t.fabric={}),i=e.util.toFixed;e.Shadow?e.warn(\"fabric.Shadow is already defined.\"):(e.Shadow=e.util.createClass({color:\"rgb(0,0,0)\",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(t){for(var i in\"string\"==typeof t&&(t=this._parseShadow(t)),t)this[i]=t[i];this.id=e.Object.__uid++},_parseShadow:function(t){var i=t.trim(),r=e.Shadow.reOffsetsAndBlur.exec(i)||[];return{color:(i.replace(e.Shadow.reOffsetsAndBlur,\"\")||\"rgb(0,0,0)\").trim(),offsetX:parseFloat(r[1],10)||0,offsetY:parseFloat(r[2],10)||0,blur:parseFloat(r[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join(\"px \")},toSVG:function(t){var r=40,n=40,s=e.Object.NUM_FRACTION_DIGITS,o=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),a=new e.Color(this.color);return t.width&&t.height&&(r=100*i((Math.abs(o.x)+this.blur)/t.width,s)+20,n=100*i((Math.abs(o.y)+this.blur)/t.height,s)+20),t.flipX&&(o.x*=-1),t.flipY&&(o.y*=-1),'<filter id=\"SVGID_'+this.id+'\" y=\"-'+n+'%\" height=\"'+(100+2*n)+'%\" x=\"-'+r+'%\" width=\"'+(100+2*r)+'%\" >\\n\\t<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"'+i(this.blur?this.blur/2:0,s)+'\"></feGaussianBlur>\\n\\t<feOffset dx=\"'+i(o.x,s)+'\" dy=\"'+i(o.y,s)+'\" result=\"oBlur\" ></feOffset>\\n\\t<feFlood flood-color=\"'+a.toRgb()+'\" flood-opacity=\"'+a.getAlpha()+'\"/>\\n\\t<feComposite in2=\"oBlur\" operator=\"in\" />\\n\\t<feMerge>\\n\\t\\t<feMergeNode></feMergeNode>\\n\\t\\t<feMergeNode in=\"SourceGraphic\"></feMergeNode>\\n\\t</feMerge>\\n</filter>\\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var t={},i=e.Shadow.prototype;return[\"color\",\"blur\",\"offsetX\",\"offsetY\",\"affectStroke\",\"nonScaling\"].forEach((function(e){this[e]!==i[e]&&(t[e]=this[e])}),this),t}}),e.Shadow.reOffsetsAndBlur=/(?:\\s|^)(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?(\\d+(?:\\.\\d*)?(?:px)?)?(?:\\s?|$)(?:$|\\s)/)}(e),function(){if(S.StaticCanvas)S.warn(\"fabric.StaticCanvas is already defined.\");else{var t=S.util.object.extend,e=S.util.getElementOffset,i=S.util.removeFromArray,r=S.util.toFixed,n=S.util.transformPoint,s=S.util.invertTransform,o=S.util.getNodeCanvas,a=S.util.createCanvasElement,h=new Error(\"Could not initialize `canvas` element\");S.StaticCanvas=S.util.createClass(S.CommonMethods,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:\"\",backgroundImage:null,overlayColor:\"\",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,
vendor: 11,015 bytes, line 2
2controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:S.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var i=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,i),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,i),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,i),e.overlayColor&&this.setOverlayColor(e.overlayColor,i),this.calcOffset()},_isRetinaScaling:function(){return S.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,S.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=S.devicePixelRatio;this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(t,e,i){e.setAttribute(\"width\",this.width*t),e.setAttribute(\"height\",this.height*t),i.scale(t,t)},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage(\"overlayImage\",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage(\"backgroundImage\",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor(\"overlayColor\",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor(\"backgroundColor\",t,e)},__setBgOverlayImage:function(t,e,i,r){return\"string\"==typeof e?S.util.loadImage(e,(function(e,n){if(e){var s=new S.Image(e,r);this[t]=s,s.canvas=this}i&&i(e,n)}),this,r&&r.crossOrigin):(r&&e.setOptions(r),this[t]=e,e&&(e.canvas=this),i&&i(e,!1)),this},__setBgOverlayColor:function(t,e,i){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,i),this},_createCanvasElement:function(){var t=a();if(!t)throw h;if(t.style||(t.style={}),void 0===t.getContext)throw h;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+\"px\",e.style.height=this.height+\"px\",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=S.util.getById(t)||this._createCanvasElement(),S.util.addClass(this.lowerCanvasEl,\"lower-canvas\"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext(\"2d\")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i;for(var r in e=e||{},t)i=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),i+=\"px\",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,i);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,i,r,n=this._activeObject,s=this.backgroundImage,o=this.overlayImage;for(this.viewportTransform=t,i=0,r=this._objects.length;i<r;i++)(e=this._objects[i]).group||e.setCoords(!0);return n&&n.setCoords(),s&&s.setCoords(!0),o&&o.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var i=t,r=this.viewportTransform.slice(0);t=n(t,s(this.viewportTransform)),r[0]=e,r[3]=e;var o=n(t,r);return r[4]+=i.x-o.x,r[5]+=i.y-o.y,this.setViewportTransform(r)},setZoom:function(t){return this.zoomToPoint(new S.Point(0,0),t),this},absolutePan:function(t){var e=this.viewportTransform.slice(0);return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)},relativePan:function(t){return this.absolutePan(new S.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(t){this.stateful&&t.setupState(),t._set(\"canvas\",this),t.setCoords(),this.fire(\"object:added\",{target:t}),t.fire(\"added\")},_onObjectRemoved:function(t){this.fire(\"object:removed\",{target:t}),t.fire(\"removed\"),delete t.canvas},clearContext:function(t){return t.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor=\"\",this.overlayColor=\"\",this._hasITextHandlers&&(this.off(\"mouse:up\",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire(\"canvas:cleared\"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=S.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var t={},e=this.width,i=this.height,r=s(this.viewportTransform);return t.tl=n({x:0,y:0},r),t.br=n({x:e,y:i},r),t.tr=new S.Point(t.br.x,t.tl.y),t.bl=new S.Point(t.tl.x,t.br.y),this.vptCoords=t,t},cancelRequestedRender:function(){this.isRendering&&(S.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(t,e){var i=this.viewportTransform,r=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(t),S.util.setImageSmoothing(t,this.imageSmoothingEnabled),this.fire(\"before:render\",{ctx:t}),this._renderBackground(t),t.save(),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),r&&(r.canvas=this,r.shouldCache(),r._transformDone=!0,r.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t)),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire(\"after:render\",{ctx:t})},drawClipPathOnCanvas:function(t){var e=this.viewportTransform,i=this.clipPath;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.globalCompositeOperation=\"destination-in\",i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},_renderObjects:function(t,e){var i,r;for(i=0,r=e.length;i<r;++i)e[i]&&e[i].render(t)},_renderBackgroundOrOverlay:function(t,e){var i=this[e+\"Color\"],r=this[e+\"Image\"],n=this.viewportTransform,s=this[e+\"Vpt\"];if(i||r){if(i){t.save(),t.beginPath(),t.moveTo(0,0),t.lineTo(this.width,0),t.lineTo(this.width,this.height),t.lineTo(0,this.height),t.closePath(),t.fillStyle=i.toLive?i.toLive(t,this):i,s&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),t.transform(1,0,0,1,i.offsetX||0,i.offsetY||0);var o=i.gradientTransform||i.patternTransform;o&&t.transform(o[0],o[1],o[2],o[3],o[4],o[5]),t.fill(),t.restore()}r&&(t.save(),s&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r.render(t),t.restore())}},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,\"background\")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,\"overlay\")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new S.Point(this.width/2,this.height/2)},centerObjectH:function(t){return this._centerObject(t,new S.Point(this.getCenterPoint().x,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new S.Point(t.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(t){var e=this.getCenterPoint();return this._centerObject(t,e)},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new S.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new S.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenterPoint(),e=s(this.viewportTransform);return n(t,e)},_centerObject:function(t,e){return t.setPositionByOrigin(e,\"center\",\"center\"),t.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod(\"toObject\",t)},toDatalessObject:function(t){return this._toObjectMethod(\"toDatalessObject\",t)},_toObjectMethod:function(e,i){var r=this.clipPath,n={version:S.version,objects:this._toObjects(e,i)};return r&&!r.excludeFromExport&&(n.clipPath=this._toObject(this.clipPath,e,i)),t(n,this.__serializeBgOverlay(e,i)),S.util.populateWithProperties(this,n,i),n},_toObjects:function(t,e){return this._objects.filter((function(t){return!t.excludeFromExport})).map((function(i){return this._toObject(i,t,e)}),this)},_toObject:function(t,e,i){var r;this.includeDefaultValues||(r=t.includeDefaultValues,t.includeDefaultValues=!1);var n=t[e](i);return this.includeDefaultValues||(t.includeDefaultValues=r),n},__serializeBgOverlay:function(t,e){var i={},r=this.backgroundImage,n=this.overlayImage,s=this.backgroundColor,o=this.overlayColor;return s&&s.toObject?s.excludeFromExport||(i.background=s.toObject(e)):s&&(i.background=s),o&&o.toObject?o.excludeFromExport||(i.overlay=o.toObject(e)):o&&(i.overlay=o),r&&!r.excludeFromExport&&(i.backgroundImage=this._toObject(r,t,e)),n&&!n.excludeFromExport&&(i.overlayImage=this._toObject(n,t,e)),i},svgViewportTransformation:!0,toSVG:function(t,e){t||(t={}),t.reviver=e;var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this.clipPath&&i.push('<g clip-path=\"url(#'+this.clipPath.clipPathId+')\" >\\n'),this._setSVGBgOverlayColor(i,\"background\"),this._setSVGBgOverlayImage(i,\"backgroundImage\",e),this._setSVGObjects(i,e),this.clipPath&&i.push(\"</g>\\n\"),this._setSVGBgOverlayColor(i,\"overlay\"),this._setSVGBgOverlayImage(i,\"overlayImage\",e),i.push(\"</svg>\"),i.join(\"\")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version=\"1.0\" encoding=\"',e.encoding||\"UTF-8\",'\" standalone=\"no\" ?>\\n','<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ','\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\\n')}
2,_setSVGHeader:function(t,e){var i,n=e.width||this.width,s=e.height||this.height,o='viewBox=\"0 0 '+this.width+\" \"+this.height+'\" ',a=S.Object.NUM_FRACTION_DIGITS;e.viewBox?o='viewBox=\"'+e.viewBox.x+\" \"+e.viewBox.y+\" \"+e.viewBox.width+\" \"+e.viewBox.height+'\" ':this.svgViewportTransformation&&(i=this.viewportTransform,o='viewBox=\"'+r(-i[4]/i[0],a)+\" \"+r(-i[5]/i[3],a)+\" \"+r(this.width/i[0],a)+\" \"+r(this.height/i[3],a)+'\" '),t.push(\"<svg \",'xmlns=\"http://www.w3.org/2000/svg\" ','xmlns:xlink=\"http://www.w3.org/1999/xlink\" ','version=\"1.1\" ','width=\"',n,'\" ','height=\"',s,'\" ',o,'xml:space=\"preserve\">\\n',\"<desc>Created with Fabric.js \",S.version,\"</desc>\\n\",\"<defs>\\n\",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),\"</defs>\\n\")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId=\"CLIPPATH_\"+S.Object.__uid++,'<clipPath id=\"'+e.clipPathId+'\" >\\n'+this.clipPath.toClipPathSVG(t.reviver)+\"</clipPath>\\n\"):\"\"},createSVGRefElementsMarkup:function(){var t=this;return[\"background\",\"overlay\"].map((function(e){var i=t[e+\"Color\"];if(i&&i.toLive){var r=t[e+\"Vpt\"],n=t.viewportTransform,s={width:t.width/(r?n[0]:1),height:t.height/(r?n[3]:1)};return i.toSVG(s,{additionalTransform:r?S.util.matrixToSVG(n):\"\"})}})).join(\"\")},createSVGFontFacesMarkup:function(){var t,e,i,r,n,s,o,a,h=\"\",l={},c=S.fontPaths,u=[];for(this._objects.forEach((function t(e){u.push(e),e._objects&&e._objects.forEach(t)})),o=0,a=u.length;o<a;o++)if(e=(t=u[o]).fontFamily,-1!==t.type.indexOf(\"text\")&&!l[e]&&c[e]&&(l[e]=!0,t.styles))for(n in i=t.styles)for(s in r=i[n])!l[e=r[s].fontFamily]&&c[e]&&(l[e]=!0);for(var d in l)h+=[\"\\t\\t@font-face {\\n\",\"\\t\\t\\tfont-family: '\",d,\"';\\n\",\"\\t\\t\\tsrc: url('\",c[d],\"');\\n\",\"\\t\\t}\\n\"].join(\"\");return h&&(h=['\\t<style type=\"text/css\">',\"<![CDATA[\\n\",h,\"]]>\",\"</style>\\n\"].join(\"\")),h},_setSVGObjects:function(t,e){var i,r,n,s=this._objects;for(r=0,n=s.length;r<n;r++)(i=s[r]).excludeFromExport||this._setSVGObject(t,i,e)},_setSVGObject:function(t,e,i){t.push(e.toSVG(i))},_setSVGBgOverlayImage:function(t,e,i){this[e]&&!this[e].excludeFromExport&&this[e].toSVG&&t.push(this[e].toSVG(i))},_setSVGBgOverlayColor:function(t,e){var i=this[e+\"Color\"],r=this.viewportTransform,n=this.width,s=this.height;if(i)if(i.toLive){var o=i.repeat,a=S.util.invertTransform(r),h=this[e+\"Vpt\"]?S.util.matrixToSVG(a):\"\";t.push('<rect transform=\"'+h+\" translate(\",n/2,\",\",s/2,')\"',' x=\"',i.offsetX-n/2,'\" y=\"',i.offsetY-s/2,'\" ','width=\"',\"repeat-y\"===o||\"no-repeat\"===o?i.source.width:n,'\" height=\"',\"repeat-x\"===o||\"no-repeat\"===o?i.source.height:s,'\" fill=\"url(#SVGID_'+i.id+')\"',\"></rect>\\n\")}else t.push('<rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" ','fill=\"',i,'\"',\"></rect>\\n\")},sendToBack:function(t){if(!t)return this;var e,r,n,s=this._activeObject;if(t===s&&\"activeSelection\"===t.type)for(e=(n=s._objects).length;e--;)r=n[e],i(this._objects,r),this._objects.unshift(r);else i(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,r,n,s=this._activeObject;if(t===s&&\"activeSelection\"===t.type)for(n=s._objects,e=0;e<n.length;e++)r=n[e],i(this._objects,r),this._objects.push(r);else i(this._objects,t),this._objects.push(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(t,e){if(!t)return this;var r,n,s,o,a,h=this._activeObject,l=0;if(t===h&&\"activeSelection\"===t.type)for(a=h._objects,r=0;r<a.length;r++)n=a[r],(s=this._objects.indexOf(n))>0+l&&(o=s-1,i(this._objects,n),this._objects.splice(o,0,n)),l++;else 0!==(s=this._objects.indexOf(t))&&(o=this._findNewLowerIndex(t,s,e),i(this._objects,t),this._objects.splice(o,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,i){var r,n;if(i){for(r=e,n=e-1;n>=0;--n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e-1;return r},bringForward:function(t,e){if(!t)return this;var r,n,s,o,a,h=this._activeObject,l=0;if(t===h&&\"activeSelection\"===t.type)for(r=(a=h._objects).length;r--;)n=a[r],(s=this._objects.indexOf(n))<this._objects.length-1-l&&(o=s+1,i(this._objects,n),this._objects.splice(o,0,n)),l++;else(s=this._objects.indexOf(t))!==this._objects.length-1&&(o=this._findNewUpperIndex(t,s,e),i(this._objects,t),this._objects.splice(o,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this}
vendor: 20,097 bytes, line 2
2,_findNewUpperIndex:function(t,e,i){var r,n,s;if(i){for(r=e,n=e+1,s=this._objects.length;n<s;++n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e+1;return r},moveTo:function(t,e){return i(this._objects,t),this._objects.splice(e,0,t),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(S.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove(\"lower-canvas\"),S.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute(\"width\",this.width),this.lowerCanvasEl.setAttribute(\"height\",this.height),S.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return\"#<fabric.Canvas (\"+this.complexity()+\"): { objects: \"+this._objects.length+\" }>\"}}),t(S.StaticCanvas.prototype,S.Observable),t(S.StaticCanvas.prototype,S.Collection),t(S.StaticCanvas.prototype,S.DataURLExporter),t(S.StaticCanvas,{EMPTY_JSON:'{\"objects\": [], \"background\": \"white\"}',supports:function(t){var e=a();if(!e||!e.getContext)return null;var i=e.getContext(\"2d\");return i&&\"setLineDash\"===t?void 0!==i.setLineDash:null}}),S.StaticCanvas.prototype.toJSON=S.StaticCanvas.prototype.toObject,S.isLikelyNode&&(S.StaticCanvas.prototype.createPNGStream=function(){var t=o(this.lowerCanvasEl);return t&&t.createPNGStream()},S.StaticCanvas.prototype.createJPEGStream=function(t){var e=o(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),S.BaseBrush=S.util.createClass({color:\"rgb(0, 0, 0)\",width:1,shadow:null,strokeLineCap:\"round\",strokeLineJoin:\"round\",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){if(this.shadow){var t=this.canvas,e=this.shadow,i=t.contextTop,r=t.getZoom();t&&t._isRetinaScaling()&&(r*=S.devicePixelRatio),i.shadowColor=e.color,i.shadowBlur=e.blur*r,i.shadowOffsetX=e.offsetX*r,i.shadowOffsetY=e.offsetY*r}},needsFullRender:function(){return new S.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor=\"\",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},_isOutSideCanvas:function(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}}),S.PencilBrush=S.util.createClass(S.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:\"shiftKey\",initialize:function(t){this.canvas=t,this._points=[]},needsFullRender:function(){return this.callSuper(\"needsFullRender\")||this._hasStraightLine},_drawSegment:function(t,e,i){var r=e.midPointFrom(i);return t.quadraticCurveTo(e.x,e.y,r.x,r.y),r},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._captureDrawingPath(t)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var i=this._points,r=i.length,n=this.canvas.contextTop;this._saveAndTransform(n),this.oldEnd&&(n.beginPath(),n.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(n,i[r-2],i[r-1],!0),n.stroke(),n.restore()}},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new S.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1])||(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),0))},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(t){var e=new S.Point(t.x,t.y);return this._addPoint(e)},_render:function(t){var e,i,r=this._points[0],n=this._points[1];if(t=t||this.canvas.contextTop,this._saveAndTransform(t),t.beginPath(),2===this._points.length&&r.x===n.x&&r.y===n.y){var s=this.width/1e3;r=new S.Point(r.x,r.y),n=new S.Point(n.x,n.y),r.x-=s,n.x+=s}for(t.moveTo(r.x,r.y),e=1,i=this._points.length;e<i;e++)this._drawSegment(t,r,n),r=this._points[e],n=this._points[e+1];t.lineTo(r.x,r.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return S.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return\"M 0 0 Q 0 0 0 0 L 0 0\"===S.util.joinPath(t)},createPath:function(t){var e=new S.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,e.shadow=new S.Shadow(this.shadow)),e},decimatePoints:function(t,e){if(t.length<=2)return t;var i,r=this.canvas.getZoom(),n=Math.pow(e/r,2),s=t.length-1,o=t[0],a=[o];for(i=1;i<s-1;i++)Math.pow(o.x-t[i].x,2)+Math.pow(o.y-t[i].y,2)>=n&&(o=t[i],a.push(o));return a.push(t[s]),a},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(t))this.canvas.requestRenderAll();else{var e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire(\"before:path:created\",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire(\"path:created\",{path:e})}}}),S.CircleBrush=S.util.createClass(S.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),i=this.canvas.contextTop;this._saveAndTransform(i),this.dot(i,e),i.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,i=this.canvas.contextTop,r=this.points;for(this._saveAndTransform(i),t=0,e=r.length;t<e;t++)this.dot(i,r[t]);i.restore()},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(t),this._render()):this.drawDot(t))},onMouseUp:function(){var t,e,i=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var r=[];for(t=0,e=this.points.length;t<e;t++){var n=this.points[t],s=new S.Circle({radius:n.radius,left:n.x,top:n.y,originX:\"center\",originY:\"center\",fill:n.fill});this.shadow&&(s.shadow=new S.Shadow(this.shadow)),r.push(s)}var o=new S.Group(r);o.canvas=this.canvas,this.canvas.fire(\"before:path:created\",{path:o}),this.canvas.add(o),this.canvas.fire(\"path:created\",{path:o}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=i,this.canvas.requestRenderAll()},addPoint:function(t){var e=new S.Point(t.x,t.y),i=S.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,r=new S.Color(this.color).setAlpha(S.util.getRandomInt(0,100)/100).toRgba();return e.radius=i,e.fill=r,this.points.push(e),e}}),S.SprayBrush=S.util.createClass(S.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render(this.sprayChunkPoints)},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.addSprayChunk(t),this.render(this.sprayChunkPoints))},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],i=0,r=this.sprayChunks.length;i<r;i++)for(var n=this.sprayChunks[i],s=0,o=n.length;s<o;s++){var a=new S.Rect({width:n[s].width,height:n[s].width,left:n[s].x+1,top:n[s].y+1,originX:\"center\",originY:\"center\",fill:this.color});e.push(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var h=new S.Group(e);this.shadow&&h.set(\"shadow\",new S.Shadow(this.shadow)),this.canvas.fire(\"before:path:created\",{path:h}),this.canvas.add(h),this.canvas.fire(\"path:created\",{path:h}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.requestRenderAll()},_getOptimizedRects:function(t){var e,i,r,n={};for(i=0,r=t.length;i<r;i++)n[e=t[i].left+\"\"+t[i].top]||(n[e]=t[i]);var s=[];for(e in n)s.push(n[e]);return s},render:function(t){var e,i,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,i=t.length;e<i;e++){var n=t[e];void 0!==n.opacity&&(r.globalAlpha=n.opacity),r.fillRect(n.x,n.y,n.width,n.width)}r.restore()},_render:function(){var t,e,i=this.canvas.contextTop;for(i.fillStyle=this.color,this._saveAndTransform(i),t=0,e=this.sprayChunks.length;t<e;t++)this.render(this.sprayChunks[t]);i.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];var e,i,r,n,s=this.width/2;for(n=0;n<this.density;n++){e=S.util.getRandomInt(t.x-s,t.x+s),i=S.util.getRandomInt(t.y-s,t.y+s),r=this.dotWidthVariance?S.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var o=new S.Point(e,i);o.width=r,this.randomOpacity&&(o.opacity=S.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(o)}this.sprayChunks.push(this.sprayChunkPoints)}}),S.PatternBrush=S.util.createClass(S.PencilBrush,{getPatternSrc:function(){var t=S.util.createCanvasElement(),e=t.getContext(\"2d\");return t.width=t.height=25,e.fillStyle=this.color,e.beginPath(),e.arc(10,10,10,0,2*Math.PI,!1),e.closePath(),e.fill(),t},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace(\"this.color\",'\"'+this.color+'\"')},getPattern:function(t){return t.createPattern(this.source||this.getPatternSrc(),\"repeat\")},_setBrushStyles:function(t){this.callSuper(\"_setBrushStyles\",t),t.strokeStyle=this.getPattern(t)},createPath:function(t){var e=this.callSuper(\"createPath\",t),i=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2);return e.stroke=new S.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-i.x,offsetY:-i.y}),e}}),function(){var t=S.util.getPointer,e=S.util.degreesToRadians,i=S.util.isTouchEvent;for(var r in S.Canvas=S.util.createClass(S.StaticCanvas,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:\"shiftKey\",centeredScaling:!1,centeredRotation:!1,centeredKey:\"altKey\",altActionKey:\"shiftKey\",interactive:!0,selection:!0,selectionKey:\"shiftKey\",altSelectionKey:null,selectionColor:\"rgba(100, 100, 255, 0.3)\",selectionDashArray:[],selectionBorderColor:\"rgba(255, 255, 255, 0.3)\",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:\"move\",moveCursor:\"move\",defaultCursor:\"default\",freeDrawingCursor:\"crosshair\",notAllowedCursor:\"not-allowed\",containerClass:\"canvas-container\",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=S.PencilBrush&&new S.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e,i,r=this.getActiveObjects();if(r.length>0&&!this.preserveObjectStacking){e=[],i=[];for(var n=0,s=this._objects.length;n<s;n++)t=this._objects[n],-1===r.indexOf(t)?e.push(t):i.push(t);r.length>1&&(this._activeObject._objects=i),e.push.apply(e,i)}else e=this._objects;return e},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire(\"after:render\"),this},_normalizePointer:function(t,e){var i=t.calcTransformMatrix(),r=S.util.invertTransform(i),n=this.restorePointerVpt(e);return S.util.transformPoint(n,r)},isTargetTransparent:function(t,e,i){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var r=this._normalizePointer(t,{x:e,y:i}),n=Math.max(t.cacheTranslationX+r.x*t.zoomX,0),s=Math.max(t.cacheTranslationY+r.y*t.zoomY,0);return S.util.isTransparent(t._cacheContext,Math.round(n),Math.round(s),this.targetFindTolerance)}var o=this.contextCache,a=t.selectionBackgroundColor,h=this.viewportTransform;return t.selectionBackgroundColor=\"\",this.clearContext(o),o.save(),o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),t.render(o),o.restore(),t.selectionBackgroundColor=a,S.util.isTransparent(o,e,i,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return Array.isArray(this.selectionKey)?!!this.selectionKey.find((function(e){return!0===t[e]})):t[this.selectionKey]},_shouldClearSelection:function(t,e){var i=this.getActiveObjects(),r=this._activeObject;return!e||e&&r&&i.length>1&&-1===i.indexOf(e)&&r!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&r&&r!==e},_shouldCenterTransform:function(t,e,i){var r;if(t)return\"scale\"===e||\"scaleX\"===e||\"scaleY\"===e||\"resizing\"===e?r=this.centeredScaling||t.centeredScaling:\"rotate\"===e&&(r=this.centeredRotation||t.centeredRotation),r?!i:i},_getOriginFromCorner:function(t,e){var i={x:t.originX,y:t.originY};return\"ml\"===e||\"tl\"===e||\"bl\"===e?i.x=\"right\":\"mr\"!==e&&\"tr\"!==e&&\"br\"!==e||(i.x=\"left\"),\"tl\"===e||\"mt\"===e||\"tr\"===e?i.y=\"bottom\":\"bl\"!==e&&\"mb\"!==e&&\"br\"!==e||(i.y=\"top\"),i},_getActionFromCorner:function(t,e,i,r){if(!e||!t)return\"drag\";var n=r.controls[e];return n.getActionName(i,n,r)},_setupCurrentTransform:function(t,i,r){if(i){var n=this.getPointer(t),s=i.__corner,o=i.controls[s],a=r&&s?o.getActionHandler(t,i,o):S.controlsUtils.dragHandler,h=this._getActionFromCorner(r,s,t,i),l=this._getOriginFromCorner(i,s),c=t[this.centeredKey],u={target:i,action:h,actionHandler:a,corner:s,scaleX:i.scaleX,scaleY:i.scaleY,skewX:i.skewX,skewY:i.skewY,offsetX:n.x-i.left,offsetY:n.y-i.top,originX:l.x,originY:l.y,ex:n.x,ey:n.y,lastX:n.x,lastY:n.y,theta:e(i.angle),width:i.width*i.scaleX,shiftKey:t.shiftKey,altKey:c,original:S.util.saveObjectTransform(i)};this._shouldCenterTransform(i,h,c)&&(u.originX=\"center\",u.originY=\"center\"),u.original.originX=l.x,u.original.originY=l.y,this._currentTransform=u,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,i=new S.Point(e.ex,e.ey),r=S.util.transformPoint(i,this.viewportTransform),n=new S.Point(e.ex+e.left,e.ey+e.top),s=S.util.transformPoint(n,this.viewportTransform),o=Math.min(r.x,s.x),a=Math.min(r.y,s.y),h=Math.max(r.x,s.x),l=Math.max(r.y,s.y),c=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(o,a,h-o,l-a)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,o+=c,a+=c,h-=c,l-=c,S.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(o,a,h-o,l-a))},findTarget:function(t,e){if(!this.skipTargetFind){var r,n,s=this.getPointer(t,!0),o=this._activeObject,a=this.getActiveObjects(),h=i(t),l=a.length>1&&!e||1===a.length;if(this.targets=[],l&&o._findTargetCorner(s,h))return o;if(a.length>1&&!e&&o===this._searchPossibleTargets([o],s))return o;if(1===a.length&&o===this._searchPossibleTargets([o],s)){if(!this.preserveObjectStacking)return o;r=o,n=this.targets,this.targets=[]}var c=this._searchPossibleTargets(this._objects,s);return t[this.altSelectionKey]&&c&&r&&c!==r&&(c=r,this.targets=n),c}},_checkTarget:function(t,e,i){if(e&&e.visible&&e.evented&&e.containsPoint(t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;if(!this.isTargetTransparent(e,i.x,i.y))return!0}},_searchPossibleTargets:function(t,e){for(var i,r,n=t.length;n--;){var s=t[n],o=s.group?this._normalizePointer(s.group,e):e;if(this._checkTarget(o,s,e)){(i=t[n]).subTargetCheck&&i instanceof S.Group&&(r=this._searchPossibleTargets(i._objects,e))&&this.targets.push(r);break}}return i},restorePointerVpt:function(t){return S.util.transformPoint(t,S.util.invertTransform(this.viewportTransform))},getPointer:function(e,i){if(this._absolutePointer&&!i)return this._absolutePointer;if(this._pointer&&i)return this._pointer;var r,n=t(e),s=this.upperCanvasEl,o=s.getBoundingClientRect(),a=o.width||0,h=o.height||0;a&&h||(\"top\"in o&&\"bottom\"in o&&(h=Math.abs(o.top-o.bottom)),\"right\"in o&&\"left\"in o&&(a=Math.abs(o.right-o.left))),this.calcOffset(),n.x=n.x-this._offset.left,n.y=n.y-this._offset.top,i||(n=this.restorePointerVpt(n));var l=this.getRetinaScaling();return 1!==l&&(n.x/=l,n.y/=l),r=0===a||0===h?{width:1,height:1}:{width:s.width/a,height:s.height/h},{x:n.x*r.width,y:n.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\\s*lower-canvas\\s*/,\"\"),e=this.lowerCanvasEl,i=this.upperCanvasEl;i?i.className=\"\":(i=this._createCanvasElement(),this.upperCanvasEl=i),S.util.addClass(i,\"upper-canvas \"+t),this.wrapperEl.appendChild(i),this._copyCanvasStyle(e,i),this._applyCanvasStyle(i),this.contextTop=i.getContext(\"2d\")},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute(\"width\",this.width),this.cacheCanvasEl.setAttribute(\"height\",this.height),this.contextCache=this.cacheCanvasEl.getContext(\"2d\")},_initWrapperElement:function(){this.wrapperEl=S.util.wrapElement(this.lowerCanvasEl,\"div\",{class:this.containerClass}),S.util.setStyle(this.wrapperEl,{width:this.width+\"px\",height:this.height+\"px\",position:\"relative\"}),S.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,i=this.height||t.height;S.util.setStyle(t,{position:\"absolute\",width:e+\"px\",height:i+\"px\",left:0,top:0,\"touch-action\":this.allowTouchScrolling?\"manipulation\":\"none\",\"-ms-touch-action\":this.allowTouchScrolling?\"manipulation\":\"none\"}),t.width=e,t.height=i,S.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop}
2,getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?\"activeSelection\"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire(\"before:selection:cleared\",{target:t}),this._discardActiveObject(),this.fire(\"selection:cleared\",{target:t}),t.fire(\"deselected\")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper(\"_onObjectRemoved\",t)},_fireSelectionEvents:function(t,e){var i=!1,r=this.getActiveObjects(),n=[],s=[];t.forEach((function(t){-1===r.indexOf(t)&&(i=!0,t.fire(\"deselected\",{e:e,target:t}),s.push(t))})),r.forEach((function(r){-1===t.indexOf(r)&&(i=!0,r.fire(\"selected\",{e:e,target:r}),n.push(r))})),t.length>0&&r.length>0?i&&this.fire(\"selection:updated\",{e:e,selected:n,deselected:s}):r.length>0?this.fire(\"selection:created\",{e:e,selected:n}):t.length>0&&this.fire(\"selection:cleared\",{e:e,deselected:s})},setActiveObject:function(t,e){var i=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(i,e),this},_setActiveObject:function(t,e){return this._activeObject!==t&&!!this._discardActiveObject(e,t)&&!t.onSelect({e:e})&&(this._activeObject=t,!0)},_discardActiveObject:function(t,e){var i=this._activeObject;if(i){if(i.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),i=this.getActiveObject();return e.length&&this.fire(\"before:selection:cleared\",{target:i,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,[\"upperCanvasEl\",\"cacheCanvasEl\"].forEach(function(t){S.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,S.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper(\"clear\")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(t),n=this.callSuper(\"_toObject\",t,e,i);return this._unwindGroupTransformOnObject(t,r),n},_realizeGroupTransformOnObject:function(t){if(t.group&&\"activeSelection\"===t.group.type&&this._activeObject===t.group){var e={};return[\"angle\",\"flipX\",\"flipY\",\"left\",\"scaleX\",\"scaleY\",\"skewX\",\"skewY\",\"top\"].forEach((function(i){e[i]=t[i]})),S.util.addTransformToObject(t,this._activeObject.calcOwnMatrix()),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(e);this.callSuper(\"_setSVGObject\",t,e,i),this._unwindGroupTransformOnObject(e,r)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),S.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),S.StaticCanvas)\"prototype\"!==r&&(S.Canvas[r]=S.StaticCanvas[r])}(),function(){var t=S.util.addListener,e=S.util.removeListener,i={passive:!1};function r(t,e){return t.button&&t.button===e-1}S.util.object.extend(S.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(t,\"add\")},_getEventPrefix:function(){return this.enablePointerEvents?\"pointer\":\"mouse\"},addOrRemove:function(t,e){var r=this.upperCanvasEl,n=this._getEventPrefix();t(S.window,\"resize\",this._onResize),t(r,n+\"down\",this._onMouseDown),t(r,n+\"move\",this._onMouseMove,i),t(r,n+\"out\",this._onMouseOut),t(r,n+\"enter\",this._onMouseEnter),t(r,\"wheel\",this._onMouseWheel),t(r,\"contextmenu\",this._onContextMenu),t(r,\"dblclick\",this._onDoubleClick),t(r,\"dragover\",this._onDragOver),t(r,\"dragenter\",this._onDragEnter),t(r,\"dragleave\",this._onDragLeave),t(r,\"drop\",this._onDrop),this.enablePointerEvents||t(r,\"touchstart\",this._onTouchStart,i
2),\"undefined\"!=typeof eventjs&&e in eventjs&&(eventjs[e](r,\"gesture\",this._onGesture),eventjs[e](r,\"drag\",this._onDrag),eventjs[e](r,\"orientation\",this._onOrientationChange),eventjs[e](r,\"shake\",this._onShake),eventjs[e](r,\"longpress\",this._onLongPress))},removeListeners:function(){this.addOrRemove(e,\"remove\");var t=this._getEventPrefix();e(S.document,t+\"up\",this._onMouseUp),e(S.document,\"touchend\",this._onTouchEnd,i),e(S.document,t+\"move\",this._onMouseMove,i),e(S.document,\"touchmove\",this._onMouseMove,i)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,\"dragenter\"),this._onDragLeave=this._simpleEventHandler.bind(this,\"dragleave\"),this._onDrop=this._onDrop.bind(this),this.eventsBound=!0)},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire(\"mouse:out\",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire(\"mouseout\",{e:t});var i=this;this._hoveredTargets.forEach((function(r){i.fire(\"mouse:out\",{target:e,e:t}),r&&e.fire(\"mouseout\",{e:t})})),this._hoveredTargets=[],this._iTextInstances&&this._iTextInstances.forEach((function(t){t.isEditing&&t.hiddenTextarea.focus()}))},_onMouseEnter:function(t){this._currentTransform||this.findTarget(t)||(this.fire(\"mouse:over\",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler(\"dragover\",t);this._fireEnterLeaveEvents(e,t)},_onDrop:function(t){return this._simpleEventHandler(\"drop:before\",t),this._simpleEventHandler(\"drop\",t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,\"dblclick\"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&(\"touchend\"===t.type&&0===t.touches.length||!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId)},_onTouchStart:function(r){r.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(r)),this.__onMouseDown(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();t(S.document,\"touchend\",this._onTouchEnd,i),t(S.document,\"touchmove\",this._onMouseMove,i),e(n,s+\"down\",this._onMouseDown)},_onMouseDown:function(r){this.__onMouseDown(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();e(n,s+\"move\",this._onMouseMove,i),t(S.document,s+\"up\",this._onMouseUp),t(S.document,s+\"move\",this._onMouseMove,i)},_onTouchEnd:function(r){if(!(r.touches.length>0)){this.__onMouseUp(r),this._resetTransformEventData(),this.mainTouchId=null;var n=this._getEventPrefix();e(S.document,\"touchend\",this._onTouchEnd,i),e(S.document,\"touchmove\",this._onMouseMove,i);var s=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout((function(){t(s.upperCanvasEl,n+\"down\",s._onMouseDown),s._willAddMouseDown=0}),400)}},_onMouseUp:function(r){this.__onMouseUp(r),this._resetTransformEventData();var n=this.upperCanvasEl,s=this._getEventPrefix();this._isMainEvent(r)&&(e(S.document,s+\"up\",this._onMouseUp),e(S.document,s+\"move\",this._onMouseMove,i),t(n,s+\"move\",this._onMouseMove,i))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,i=this._currentTransform,n=this._groupSelector,s=!1,o=!n||0===n.left&&0===n.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,\"up:before\"),r(t,3))this.fireRightClick&&this._handleEvent(t,\"up\",3,o);else{if(r(t,2))return this.fireMiddleClick&&this._handleEvent(t,\"up\",2,o),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(i&&(this._finalizeCurrentTransform(t),s=i.actionPerformed),!o){var a=e===this._activeObject;this._maybeGroupObjects(t),s||(s=this._shouldRender(e)||!a&&e===this._activeObject)}var h,l;if(e){if(h=e._findTargetCorner(this.getPointer(t,!0),S.util.isTouchEvent(t)),e.selectable&&e!==this._activeObject&&\"up\"===e.activeOn)this.setActiveObject(e,t),s=!0;
vendor: 4,909 bytes, line 2
2else{var c=e.controls[h],u=c&&c.getMouseUpHandler(t,e,c);u&&u(t,i,(l=this.getPointer(t)).x,l.y)}e.isMoving=!1}if(i&&(i.target!==e||i.corner!==h)){var d=i.target&&i.target.controls[i.corner],f=d&&d.getMouseUpHandler(t,e,c);l=l||this.getPointer(t),f&&f(t,i,l.x,l.y)}this._setCursorFromEvent(t,e),this._handleEvent(t,\"up\",1,o),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),s?this.requestRenderAll():o||this.renderTop()}}},_simpleEventHandler:function(t,e){var i=this.findTarget(e),r=this.targets,n={e:e,target:i,subTargets:r};if(this.fire(t,n),i&&i.fire(t,n),!r)return i;for(var s=0;s<r.length;s++)r[s].fire(t,n);return i},_handleEvent:function(t,e,i,r){var n=this._target,s=this.targets||[],o={e:t,target:n,subTargets:s,button:i||1,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};\"up\"===e&&(o.currentTarget=this.findTarget(t),o.currentSubTargets=this.targets),this.fire(\"mouse:\"+e,o),n&&n.fire(\"mouse\"+e,o);for(var a=0;a<s.length;a++)s[a].fire(\"mouse\"+e,o)},_finalizeCurrentTransform:function(t){var e=this._currentTransform,i=e.target,r={e:t,target:i,transform:e,action:e.action};i._scaling&&(i._scaling=!1),i.setCoords(),(e.actionPerformed||this.stateful&&i.hasStateChanged())&&this._fire(\"modified\",r)},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(t).requestRenderAll();var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e,{e:t,pointer:e}),this._handleEvent(t,\"down\")},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=this.getPointer(t);this.freeDrawingBrush.onMouseMove(e,{e:t,pointer:e})}this.setCursor(this.freeDrawingCursor),this._handleEvent(t,\"move\")},_onMouseUpInDrawingMode:function(t){var e=this.getPointer(t);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:t,pointer:e}),this._handleEvent(t,\"up\")},__onMouseDown:function(t){this._cacheTransformEventData(t),this._handleEvent(t,\"down:before\");var e=this._target;if(r(t,3))this.fireRightClick&&this._handleEvent(t,\"down\",3);else if(r(t,2))this.fireMiddleClick&&this._handleEvent(t,\"down\",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(t);else if(this._isMainEvent(t)&&!this._currentTransform){var i=this._pointer;this._previousPointer=i;var n=this._shouldRender(e),s=this._shouldGroup(t,e);if(this._shouldClearSelection(t,e)?this.discardActiveObject(t):s&&(this._handleGrouping(t,e),e=this._activeObject),!this.selection||e&&(e.selectable||e.isEditing||e===this._activeObject)||(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),e){var o=e===this._activeObject;e.selectable&&\"down\"===e.activeOn&&this.setActiveObject(e,t);var a=e._findTargetCorner(this.getPointer(t,!0),S.util.isTouchEvent(t));if(e.__corner=a,e===this._activeObject&&(a||!s)){this._setupCurrentTransform(t,e,o);var h=e.controls[a],l=(i=this.getPointer(t),h&&h.getMouseDownHandler(t,e,h));l&&l(t,this._currentTransform,i.x,i.y)}}this._handleEvent(t,\"down\"),(n||s)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(t){this._resetTransformEventData(),this._pointer=this.getPointer(t,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(t)||null},_beforeTransform:function(t){var e=this._currentTransform;this.stateful&&e.target.saveState(),this.fire(\"before:transform\",{e:t,transform:e})},__onMouseMove:function(t){var e,i;if(this._handleEvent(t,\"move:before\"),this._cacheTransformEventData(t),this.isDrawingMode)this._onMouseMoveInDrawingMode(t);else if(this._isMainEvent(t)){var r=this._groupSelector;r?(i=this._absolutePointer,r.left=i.x-r.ex,r.top=i.y-r.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t)||null,this._setCursorFromEvent(t,e),this._fireOverOutEvents(e,t)),this._handleEvent(t,\"move\"),this._resetTransformEventData()}},_fireOverOutEvents:function(t,e){var i=this._hoveredTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:\"mouseout\",canvasEvtOut:\"mouse:out\",evtIn:\"mouseover\",canvasEvtIn:\"mouse:over\"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:\"mouseout\",evtIn:\"mouseover\"});this._hoveredTarget=t,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(t,e){var i=this._draggedoverTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:\"dragleave\",evtIn:\"dragenter\"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:\"dragleave\",evtIn:\"dragenter\"});this._draggedoverTarget=t}
2,fireSyntheticInOutEvents:function(t,e,i){var r,n,s,o=i.oldTarget,a=o!==t,h=i.canvasEvtIn,l=i.canvasEvtOut;a&&(r={e:e,target:t,previousTarget:o},n={e:e,target:o,nextTarget:t}),s=t&&a,o&&a&&(l&&this.fire(l,n),o.fire(i.evtOut,n)),s&&(h&&this.fire(h,r),t.fire(i.evtIn,r))},__onMouseWheel:function(t){this._cacheTransformEventData(t),this._handleEvent(t,\"wheel\"),this._resetTransformEventData()},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.shiftKey=t.shiftKey,i.altKey=t[this.centeredKey],this._performTransformAction(t,i,e),i.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(t,e,i){var r=i.x,n=i.y,s=e.action,o=!1,a=e.actionHandler;a&&(o=a(t,e,r,n)),\"drag\"===s&&o&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||o},_fire:S.controlsUtils.fireEvent,_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var i=e.hoverCursor||this.hoverCursor,r=this._activeObject&&\"activeSelection\"===this._activeObject.type?this._activeObject:null,n=(!r||!r.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));n?this.setCursor(this.getCornerCursor(n,e,t)):(e.subTargetCheck&&this.targets.concat().reverse().map((function(t){i=t.hoverCursor||i})),this.setCursor(i))},getCornerCursor:function(t,e,i){var r=e.controls[t];return r.cursorStyleHandler(i,r,e)}})}(),v=Math.min,y=Math.max,S.util.object.extend(S.Canvas.prototype,{_shouldGroup:function(t,e){var i=this._activeObject;return i&&this._isSelectionKeyPressed(t)&&e&&e.selectable&&this.selection&&(i!==e||\"activeSelection\"===i.type)&&!e.onSelect({e:t})},_handleGrouping:function(t,e){var i=this._activeObject;i.__corner||(e!==i||(e=this.findTarget(t,!0))&&e.selectable)&&(i&&\"activeSelection\"===i.type?this._updateActiveSelection(e,t):this._createActiveSelection(e,t))},_updateActiveSelection:function(t,e){var i=this._activeObject,r=i._objects.slice(0);i.contains(t)?(i.removeWithUpdate(t),this._hoveredTarget=t,this._hoveredTargets=this.targets.concat(),1===i.size()&&this._setActiveObject(i.item(0),e)):(i.addWithUpdate(t),this._hoveredTarget=i,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(r,e)},_createActiveSelection:function(t,e){var i=this.getActiveObjects(),r=this._createGroup(t);this._hoveredTarget=r,this._setActiveObject(r,e),this._fireSelectionEvents(i,e)},_createGroup:function(t){var e=this._objects,i=e.indexOf(this._activeObject)<e.indexOf(t)?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new S.ActiveSelection(i,{canvas:this})},_groupSelectedObjects:function(t){var e,i=this._collectObjects(t);1===i.length?this.setActiveObject(i[0],t):i.length>1&&(e=new S.ActiveSelection(i.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(t){for(var e,i=[],r=this._groupSelector.ex,n=this._groupSelector.ey,s=r+this._groupSelector.left,o=n+this._groupSelector.top,a=new S.Point(v(r,s),v(n,o)),h=new S.Point(y(r,s),y(n,o)),l=!this.selectionFullyContained,c=r===s&&n===o,u=this._objects.length;u--&&!((e=this._objects[u])&&e.selectable&&e.visible&&(l&&e.intersectsWithRect(a,h,!0)||e.isContainedWithinRect(a,h,!0)||l&&e.containsPoint(a,null,!0)||l&&e.containsPoint(h,null,!0))&&(i.push(e),c)););return i.length>1&&(i=i.filter((function(e){return!e.onSelect({e:t})}))),i},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}}),S.util.object.extend(S.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||\"png\",i=t.quality||1,r=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),n=this.toCanvasElement(r,t);return S.util.toDataURL(n,e,i)},toCanvasElement:function(t,e){t=t||1;var i=((e=e||{}).width||this.width)*t,r=(e.height||this.height)*t,n=this.getZoom(),s=this.width,o=this.height,a=n*t,h=this.viewportTransform,l=(h[4]-(e.left||0))*t,c=(h[5]-(e.top||0))*t,u=this.interactive,d=[a,0,0,a,l,c],f=this.enableRetinaScaling,g=S.util.createCanvasElement(),m=this.contextTop;return g.width=i,g.height=r,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=d,this.width=i,this.height=r,this.calcViewportBoundaries(),this.renderCanvas(g.getContext(\"2d\"),this._objects),this.viewportTransform=h,this.width=s,this.height=o,this.calcViewportBoundaries(),this.interactive=u,this.enableRetinaScaling=f,this.contextTop=m,g}}),S.util.object.extend(S.StaticCanvas.prototype,{loadFromJSON:function(t,e,
2i){if(t){var r=\"string\"==typeof t?JSON.parse(t):S.util.object.clone(t),n=this,s=r.clipPath,o=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete r.clipPath,this._enlivenObjects(r.objects,(function(t){n.clear(),n._setBgOverlay(r,(function(){s?n._enlivenObjects([s],(function(i){n.clipPath=i[0],n.__setupCanvas.call(n,r,t,o,e)})):n.__setupCanvas.call(n,r,t,o,e)}))}),i),this}},__setupCanvas:function(t,e,i,r){var n=this;e.forEach((function(t,e){n.insertAt(t,e)})),this.renderOnAddRemove=i,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),r&&r()},_setBgOverlay:function(t,e){var i={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(t.backgroundImage||t.overlayImage||t.background||t.overlay){var r=function(){i.backgroundImage&&i.overlayImage&&i.backgroundColor&&i.overlayColor&&e&&e()};this.__setBgOverlay(\"backgroundImage\",t.backgroundImage,i,r),this.__setBgOverlay(\"overlayImage\",t.overlayImage,i,r),this.__setBgOverlay(\"backgroundColor\",t.background,i,r),this.__setBgOverlay(\"overlayColor\",t.overlay,i,r)}else e&&e()},__setBgOverlay:function(t,e,i,r){var n=this;if(!e)return i[t]=!0,void(r&&r());\"backgroundImage\"===t||\"overlayImage\"===t?S.util.enlivenObjects([e],(function(e){n[t]=e[0],i[t]=!0,r&&r()})):this[\"set\"+S.util.string.capitalize(t,!0)](e,(function(){i[t]=!0,r&&r()}))},_enlivenObjects:function(t,e,i){t&&0!==t.length?S.util.enlivenObjects(t,(function(t){e&&e(t)}),null,i):e&&e([])},_toDataURL:function(t,e){this.clone((function(i){e(i.toDataURL(t))}))},_toDataURLWithMultiplier:function(t,e,i){this.clone((function(r){i(r.toDataURLWithMultiplier(t,e))}))},clone:function(t,e){var i=JSON.stringify(this.toJSON(e));this.cloneWithoutData((function(e){e.loadFromJSON(i,(function(){t&&t(e)}))}))},cloneWithoutData:function(t){var e=S.util.createCanvasElement();e.width=this.width,e.height=this.height;var i=new S.Canvas(e);this.backgroundImage?(i.setBackgroundImage(this.backgroundImage.src,(function(){i.renderAll(),t&&t(i)})),i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch):t&&t(i)}}),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n=e.util.toFixed,s=e.util.string.capitalize,o=e.util.degreesToRadians,a=!e.isLikelyNode;e.Object||(e.Object=e.util.createClass(e.CommonMethods,{type:\"object\",originX:\"left\",originY:\"top\",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:\"rgb(178,204,255)\",borderDashArray:null,cornerColor:\"rgb(178,204,255)\",cornerStrokeColor:null,cornerStyle:\"rect\",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:\"rgb(0,0,0)\",fillRule:\"nonzero\",globalCompositeOperation:\"source-over\",backgroundColor:\"\",selectionBackgroundColor:\"\",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:\"butt\",strokeLineJoin:\"miter\",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:a,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:\"fill\",activeOn:\"down\",stateProperties:\"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform\".split(\" \"),cacheProperties:\"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath\".split(\" \"),colorProperties:\"fill stroke backgroundColor\".split(\" \"),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=e.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext(\"2d\"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var i=e.perfLimitSizeTotal,r=t.width,n=t.height,s=e.maxCacheSideLimit,o=e.minCacheSideLimit;
vendor: 5,312 bytes, line 2
2if(r<=s&&n<=s&&r*n<=i)return r<o&&(t.width=o),n<o&&(t.height=o),t;var a=r/n,h=e.util.limitDimsByArea(a,i),l=e.util.capValue,c=l(o,h.x,s),u=l(o,h.y,s);return r>c&&(t.zoomX/=r/c,t.width=c,t.capped=!0),n>u&&(t.zoomY/=n/u,t.height=u,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),i=e.x*t.scaleX/this.scaleX,r=e.y*t.scaleY/this.scaleY;return{width:i+2,height:r+2,zoomX:t.scaleX,zoomY:t.scaleY,x:i,y:r}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var i=t._currentTransform.target,r=t._currentTransform.action;if(this===i&&r.slice&&\"scale\"===r.slice(0,5))return!1}var n,s,o=this._cacheCanvas,a=this._limitCacheSize(this._getCacheCanvasDimensions()),h=e.minCacheSideLimit,l=a.width,c=a.height,u=a.zoomX,d=a.zoomY,f=l!==this.cacheWidth||c!==this.cacheHeight,g=this.zoomX!==u||this.zoomY!==d,m=f||g,p=0,_=0,v=!1;if(f){var y=this._cacheCanvas.width,w=this._cacheCanvas.height,C=l>y||c>w;v=C||(l<.9*y||c<.9*w)&&y>h&&w>h,C&&!a.capped&&(l>h||c>h)&&(p=.1*l,_=.1*c)}return this instanceof e.Text&&this.path&&(m=!0,v=!0,p+=this.getHeightOfLine(0)*this.zoomX,_+=this.getHeightOfLine(0)*this.zoomY),!!m&&(v?(o.width=Math.ceil(l+p),o.height=Math.ceil(c+_)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,o.width,o.height)),n=a.x/2,s=a.y/2,this.cacheTranslationX=Math.round(o.width/2-n)+n,this.cacheTranslationY=Math.round(o.height/2-s)+s,this.cacheWidth=l,this.cacheHeight=c,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(u,d),this.zoomX=u,this.zoomY=d,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,\"fill\"),this._initGradient(t.stroke,\"stroke\"),this._initPattern(t.fill,\"fill\"),this._initPattern(t.stroke,\"stroke\")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,i=this.calcTransformMatrix(!e);t.transform(i[0],i[1],i[2],i[3],i[4],i[5])},toObject:function(t){var i=e.Object.NUM_FRACTION_DIGITS,r={type:this.type,version:e.version,originX:this.originX,originY:this.originY,left:n(this.left,i),top:n(this.top,i),width:n(this.width,i),height:n(this.height,i),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:n(this.strokeWidth,i),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:n(this.strokeMiterLimit,i),scaleX:n(this.scaleX,i),scaleY:n(this.scaleY,i),angle:n(this.angle,i),flipX:this.flipX,flipY:this.flipY,opacity:n(this.opacity,i),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:n(this.skewX,i),skewY:n(this.skewY,i)};return this.clipPath&&!this.clipPath.excludeFromExport&&(r.clipPath=this.clipPath.toObject(t),r.clipPath.inverted=this.clipPath.inverted,r.clipPath.absolutePositioned=this.clipPath.absolutePositioned),e.util.populateWithProperties(this,r,t),this.includeDefaultValues||(r=this._removeDefaultValues(r)),r},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var i=e.util.getKlass(t.type).prototype;return i.stateProperties.forEach((function(e){\"left\"!==e&&\"top\"!==e&&(t[e]===i[e]&&delete t[e],Array.isArray(t[e])&&Array.isArray(i[e])&&0===t[e].length&&0===i[e].length&&delete t[e])})),t},toString:function(){return\"#<fabric.\"+s(this.type)+\">\"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=e.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,i=t.scaleY;if(this.canvas){var r=this.canvas.getZoom(),n=this.canvas.getRetinaScaling();e*=r*n,i*=r*n}return{scaleX:e,scaleY:i}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,i){var r=\"scaleX\"===t||\"scaleY\"===t,n=this[t]!==i,s=!1;return r&&(i=this._constrainScale(i)),\"scaleX\"===t&&i<0?(this.flipX=!this.flipX,i*=-1):\"scaleY\"===t&&i<0?(this.flipY=!this.flipY,i*=-1):\"shadow\"!==t||!i||i instanceof e.Shadow?\"dirty\"===t&&this.group&&this.group.set(\"dirty\",i):i=new e.Shadow(i),this[t]=i,n&&(s=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,s&&this.group.set(\"dirty\",!0)):s&&this.stateProperties.indexOf(t)>-1&&this.group.set(\"dirty\",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:e.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackgroun
2d(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:\"cacheProperties\"})),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas&&this._cacheContext||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:\"cacheProperties\"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&\"transparent\"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&\"transparent\"!==this.fill},needsItsOwnCache:function(){return!(\"stroke\"!==this.paintFirst||!this.hasFill()||!this.hasStroke()||\"object\"!=typeof this.shadow)||!!this.clipPath},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t,i){if(t.save(),i.inverted?t.globalCompositeOperation=\"destination-out\":t.globalCompositeOperation=\"destination-in\",i.absolutePositioned){var r=e.util.invertTransform(this.calcTransformMatrix());t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},drawObject:function(t,e){var i=this.fill,r=this.stroke;e?(this.fill=\"black\",this.stroke=\"\",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t,this.clipPath),this.fill=i,this.stroke=r},_drawClipPath:function(t,e){e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t,e))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged(\"cacheProperties\")){if(this._cacheCanvas&&this._cacheContext&&!t){var e=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-i/2,e,i)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var i=e.stroke;i&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,i.toLive?\"percentage\"===i.gradientUnits||i.gradientTransform||i.patternTransform?this._applyPatternForTransformedGradient(t,i):(t.strokeStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var i=e.fill;i&&(i.toLive?(t.fillStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=i)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle=\"transparent\",t.fillStyle=\"#000000\"},_setLineDash:function(t,e){e&&0!==e.length&&(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,i){var r,n,s,a=this.getViewportTransform(),h=this.calcTransformMatrix();n=void 0!==(i=i||{}).hasBorders?i.hasBorders:this.hasBorders,s=void 0!==i.hasControls?i.hasControls:this.hasControls,h=e.util.multiplyTransformMatrices(a,h),r=e.util.qrDecompose(h),t.save(),t.translate(r.translateX,r.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(r.angle-=180),t.rotate(o(this.group?r.angle:this.angle)),i.forActiveSelection||this.group?n&&this.drawBordersInGroup(t,r,i):n&&this.drawBorders(t,i),s&&this.drawControls(t,i),t.restore(
vendor: 5,867 bytes, line 2
2)},_setShadow:function(t){if(this.shadow){var i,r=this.shadow,n=this.canvas,s=n&&n.viewportTransform[0]||1,o=n&&n.viewportTransform[3]||1;i=r.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),n&&n._isRetinaScaling()&&(s*=e.devicePixelRatio,o*=e.devicePixelRatio),t.shadowColor=r.color,t.shadowBlur=r.blur*e.browserShadowBlurConstant*(s+o)*(i.scaleX+i.scaleY)/4,t.shadowOffsetX=r.offsetX*s*i.scaleX,t.shadowOffsetY=r.offsetY*o*i.scaleY}},_removeShadow:function(t){this.shadow&&(t.shadowColor=\"\",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var i=e.gradientTransform||e.patternTransform,r=-this.width/2+e.offsetX||0,n=-this.height/2+e.offsetY||0;return\"percentage\"===e.gradientUnits?t.transform(this.width,0,0,this.height,r,n):t.transform(1,0,0,1,r,n),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),{offsetX:r,offsetY:n}},_renderPaintInOrder:function(t){\"stroke\"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._setFillStyles(t,this),\"evenodd\"===this.fillRule?t.fill(\"evenodd\"):t.fill(),t.restore())},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,i){var r,n=this._limitCacheSize(this._getCacheCanvasDimensions()),s=e.util.createCanvasElement(),o=this.canvas.getRetinaScaling(),a=n.x/this.scaleX/o,h=n.y/this.scaleY/o;s.width=a,s.height=h,(r=s.getContext(\"2d\")).beginPath(),r.moveTo(0,0),r.lineTo(a,0),r.lineTo(a,h),r.lineTo(0,h),r.closePath(),r.translate(a/2,h/2),r.scale(n.zoomX/this.scaleX/o,n.zoomY/this.scaleY/o),this._applyPatternGradientTransform(r,i),r.fillStyle=i.toLive(t),r.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(o*this.scaleX/n.zoomX,o*this.scaleY/n.zoomY),t.strokeStyle=r.createPattern(s,\"no-repeat\")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var t=e.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set(\"scaleX\",t.scaleX),this.set(\"scaleY\",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var i=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),i=e.util.transformPoint(i,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,i.x+=t.offsetLeft,i.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(i,\"center\",\"center\")},clone:function(t,i){var r=this.toObject(i);this.constructor.fromObject?this.constructor.fromObject(r,t):e.Object._fromObject(\"Object\",r,t)},cloneAsImage:function(t,i){var r=this.toCanvasElement(i);return t&&t(new e.Image(r)),this},toCanvasElement:function(t){t||(t={});var i=e.util,r=i.saveObjectTransform(this),n=this.group,s=this.shadow,o=Math.abs,a=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&i.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var h,l,c,u,d=e.util.createCanvasElement(),f=this.getBoundingRect(!0,!0),g=this.shadow,m={x:0,y:0};g&&(l=g.blur,h=g.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),m.x=2*Math.round(o(g.offsetX)+l)*o(h.scaleX),m.y=2*Math.round(o(g.offsetY)+l)*o(h.scaleY)),c=f.width+m.x,u=f.height+m.y,d.width=Math.ceil(c),d.height=Math.ceil(u);var p=new e.StaticCanvas(d,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});\"jpeg\"===t.format&&(p.backgroundColor=\"#fff\"),this.setPositionByOrigin(new e.Point(p.width/2,p.height/2),\"center\",\"center\");var _=this.canvas;p.add(this);var v=p.toCanvasElement(a||1,t);return this.shadow=s,this.set(\"canvas\",_),n&&(this.group=n),this.set(r).setCoords(),p._objects=[],p.dispose(),p=null,v},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||\"png\",t.quality||1)},isType:function(t){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate:function(t){var e=(\"center\"!==this.originX||\"center\"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set(\"angle\",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(t,i){i=i||this.canvas.getPointer(t);var r=new e.Point(i.x,i.y),n=this._getLeftTopCoords();return this.angle&&(r=e.util.rotatePoint(r,n,o(-this.angle))),{x:r.x-n.x,y:r.y-n.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){e.runningAnimations&&e.runningAnimations.cancelByTarget(this)}}),e.util.createAccessors&&e.util.createAccessors(e.Object),i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.ENLIVEN_PROP
2S=[\"clipPath\"],e.Object._fromObject=function(t,i,n,s){var o=e[t];i=r(i,!0),e.util.enlivenPatterns([i.fill,i.stroke],(function(t){void 0!==t[0]&&(i.fill=t[0]),void 0!==t[1]&&(i.stroke=t[1]),e.util.enlivenObjectEnlivables(i,i,(function(){var t=s?new o(i[s],i):new o(i);n&&n(t)}))}))},e.Object.__uid=0)}(e),w=S.util.degreesToRadians,C={left:-.5,center:0,right:.5},E={top:-.5,center:0,bottom:.5},S.util.object.extend(S.Object.prototype,{translateToGivenOrigin:function(t,e,i,r,n){var s,o,a,h=t.x,l=t.y;return\"string\"==typeof e?e=C[e]:e-=.5,\"string\"==typeof r?r=C[r]:r-=.5,\"string\"==typeof i?i=E[i]:i-=.5,\"string\"==typeof n?n=E[n]:n-=.5,o=n-i,((s=r-e)||o)&&(a=this._getTransformedDimensions(),h=t.x+s*a.x,l=t.y+o*a.y),new S.Point(h,l)},translateToCenterPoint:function(t,e,i){var r=this.translateToGivenOrigin(t,e,i,\"center\",\"center\");return this.angle?S.util.rotatePoint(r,t,w(this.angle)):r},translateToOriginPoint:function(t,e,i){var r=this.translateToGivenOrigin(t,\"center\",\"center\",e,i);return this.angle?S.util.rotatePoint(r,t,w(this.angle)):r},getCenterPoint:function(){var t=new S.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var i=this.getCenterPoint();return this.translateToOriginPoint(i,t,e)},toLocalPoint:function(t,e,i){var r,n,s=this.getCenterPoint();return r=void 0!==e&&void 0!==i?this.translateToGivenOrigin(s,\"center\",\"center\",e,i):new S.Point(this.left,this.top),n=new S.Point(t.x,t.y),this.angle&&(n=S.util.rotatePoint(n,s,-w(this.angle))),n.subtractEquals(r)},setPositionByOrigin:function(t,e,i){var r=this.translateToCenterPoint(t,e,i),n=this.translateToOriginPoint(r,this.originX,this.originY);this.set(\"left\",n.x),this.set(\"top\",n.y)},adjustPosition:function(t){var e,i,r=w(this.angle),n=this.getScaledWidth(),s=S.util.cos(r)*n,o=S.util.sin(r)*n;e=\"string\"==typeof this.originX?C[this.originX]:this.originX-.5,i=\"string\"==typeof t?C[t]:t-.5,this.left+=s*(i-e),this.top+=o*(i-e),this.setCoords(),this.originX=t},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX=\"center\",this.originY=\"center\",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),\"left\",\"top\")}}),function(){var t=S.util,e=t.degreesToRadians,i=t.multiplyTransformMatrices,r=t.transformPoint;t.object.extend(S.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():(this.aCoords&&this.lineCoords||this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){return i=this._getCoords(t,e),[new S.Point(i.tl.x,i.tl.y),new S.Point(i.tr.x,i.tr.y),new S.Point(i.br.x,i.br.y),new S.Point(i.bl.x,i.bl.y)];var i},intersectsWithRect:function(t,e,i,r){var n=this.getCoords(i,r);return\"Intersection\"===S.Intersection.intersectPolygonRectangle(n,t,e).status},intersectsWithObject:function(t,e,i){return\"Intersection\"===S.Intersection.intersectPolygonPolygon(this.getCoords(e,i),t.getCoords(e,i)).status||t.isContainedWithinObject(this,e,i)||this.isContainedWithinObject(t,e,i)},isContainedWithinObject:function(t,e,i){for(var r=this.getCoords(e,i),n=e?t.aCoords:t.lineCoords,s=0,o=t._getImageLines(n);s<4;s++)if(!t.containsPoint(r[s],o))return!1;return!0},isContainedWithinRect:function(t,e,i,r){var n=this.getBoundingRect(i,r);return n.left>=t.x&&n.left+n.width<=e.x&&n.top>=t.y&&n.top+n.height<=e.y},containsPoint:function(t,e,i,r){var n=this._getCoords(i,r),s=(e=e||this._getImageLines(n),this._findCrossPoints(t,e));return 0!==s&&s%2==1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.getCoords(!0,t).some((function(t){return t.x<=i.x&&t.x>=e.x&&t.y<=i.y&&t.y>=e.y}))||!!this.intersectsWithRect(e,i,!0,t)||this._containsCenterOfCanvas(e,i,t)}
vendor: 7,140 bytes, line 2
2,_containsCenterOfCanvas:function(t,e,i){var r={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(r,null,!0,i)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,i,!0,t)||this.getCoords(!0,t).every((function(t){return(t.x>=i.x||t.x<=e.x)&&(t.y>=i.y||t.y<=e.y)}))&&this._containsCenterOfCanvas(e,i,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var i,r,n,s=0;for(var o in e)if(!((n=e[o]).o.y<t.y&&n.d.y<t.y||n.o.y>=t.y&&n.d.y>=t.y||(n.o.x===n.d.x&&n.o.x>=t.x?r=n.o.x:(i=(n.d.y-n.o.y)/(n.d.x-n.o.x),r=-(t.y-0*t.x-(n.o.y-i*n.o.x))/(0-i)),r>=t.x&&(s+=1),2!==s)))break;return s},getBoundingRect:function(e,i){var r=this.getCoords(e,i);return t.makeBoundingBoxFromPoints(r)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:0===t?1e-4:t},scale:function(t){return this._set(\"scaleX\",t),this._set(\"scaleY\",t),this.setCoords()},scaleToWidth:function(t,e){var i=this.getBoundingRect(e).width/this.getScaledWidth();return this.scale(t/this.width/i)},scaleToHeight:function(t,e){var i=this.getBoundingRect(e).height/this.getScaledHeight();return this.scale(t/this.height/i)},calcLineCoords:function(){var i=this.getViewportTransform(),n=this.padding,s=e(this.angle),o=t.cos(s)*n,a=t.sin(s)*n,h=o+a,l=o-a,c=this.calcACoords(),u={tl:r(c.tl,i),tr:r(c.tr,i),bl:r(c.bl,i),br:r(c.br,i)};return n&&(u.tl.x-=l,u.tl.y-=h,u.tr.x+=h,u.tr.y-=l,u.bl.x-=h,u.bl.y+=l,u.br.x+=l,u.br.y+=h),u},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),r=this.getViewportTransform(),n=i(r,e),s=i(n,t),o=(s=i(s,[1/r[0],0,0,1/r[3],0,0]),this._calculateCurrentDimensions()),a={};return this.forEachControl((function(t,e,i){a[e]=t.positionHandler(o,s,i)})),a},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=i(e,t),s=this._getTransformedDimensions(),o=s.x/2,a=s.y/2;return{tl:r({x:-o,y:-a},n),tr:r({x:o,y:-a},n),bl:r({x:-o,y:a},n),br:r({x:o,y:a},n)}},setCoords:function(t){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),t||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return t.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var t=this.getCenterPoint();return[1,0,0,1,t.x,t.y]},transformMatrixKey:function(t){var e=\"_\",i=\"\";return!t&&this.group&&(i=this.group.transformMatrixKey(t)+e),i+this.top+e+this.left+e+this.scaleX+e+this.scaleY+e+this.skewX+e+this.skewY+e+this.angle+e+this.originX+e+this.originY+e+this.width+e+this.height+e+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(t){var e=this.calcOwnMatrix();if(t||!this.group)return e;var r=this.transformMatrixKey(t),n=this.matrixCache||(this.matrixCache={});return n.key===r?n.value:(this.group&&(e=i(this.group.calcTransformMatrix(!1),e)),n.key=r,n.value=e,e)},calcOwnMatrix:function(){var e=this.transformMatrixKey(!0),i=this.ownMatrixCache||(this.ownMatrixCache={});if(i.key===e)return i.value;var r=this._calcTranslateMatrix(),n={angle:this.angle,translateX:r[4],translateY:r[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return i.key=e,i.value=t.composeMatrix(n),i.value},_getNonTransformedDimensions:function(){var t=this.strokeWidth;return{x:this.width+t,y:this.height+t}},_getTransformedDimensions:function(e,i){void 0===e&&(e=this.skewX),void 0===i&&(i=this.skewY);var r,n,s,o=0===e&&0===i;if(this.strokeUniform?(n=this.width,s=this.height):(n=(r=this._getNonTransformedDimensions()).x,s=r.y),o)return this._finalizeDimensions(n*this.scaleX,s*this.scaleY);var a=t.sizeAfterTransform(n,s,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:i});return this._finalizeDimensions(a.x,a.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions();return r(e,t,!0).scalarAdd(2*this.padding)}})}(),S.util.object.extend(S.Object.prototype,{sendToBack:function(){return this.group?S.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?S.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?S.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?S.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&\"activeSelection\"!==this.group.type?S.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&this.canvas.moveTo(this,t),this}}),function(){function t(t,e){if(e){if(e.toLive)return t+\": url(#SVGID_\"+e.id+\"); \";var i=new S.Color(e),r=t+\": \"+i.toRgb()+\"; \",n=i.getAlpha();return 1!==n&&(r+=t+\"-opacity: \"+n.toString()+\"; \"),r}return t+\": none; \"}var e=S.util.toFixed;S.util.object.extend(S.Object.prototype,{getSvgStyles:function(e){var i=this.fillRule?this.fillRule:\"nonzero\",r=this.strokeWidth?this.strokeWidth:\"0\",n=this.strokeDashArray?this.strokeDashArray.join(\" \"):\"none\",s=this.strokeDashOffset?this.strokeDashOffset:\"0\",o=this.strokeLineCap?this.strokeLineCap:\"butt\",a=this.strokeLineJoin?this.strokeLineJoin:\"miter\",h=this.strokeMiterLimit?this.strokeMiterLimit:\"4\",l=void 0!==this.opacity?this.opacity:\"1\",c=this.visible?\"\":\" visibility: hidden;\",u=e?\"\":this.getSvgFilter(),d=t(\"fill\",this.fill);return[t(\"stroke\",this.stroke),\"stroke-width: \",r,\"; \",\"stroke-dasharray: \",n,\"; \",\"stroke-linecap: \",o,\"; \",\"stroke-dashoffset: \",s,\"; \",\"stroke-linejoin: \",a,\"; \",\"stroke-miterlimit: \",h,\"; \",d,\"fill-rule: \",i,\"; \",\"opacity: \",l,\";\",u,c].join(\"\")},getSvgSpanStyles:function(e,i){var r=\"; \",n=e.fontFamily?\"font-family: \"+(-1===e.fontFamily.indexOf(\"'\")&&-1===e.fontFamily.indexOf('\"')?\"'\"+e.fontFamily+\"'\":e.fontFamily)+r:\"\",s=e.strokeWidth?\"stroke-width: \"+e.strokeWidth+r:\"\",o=e.fontSize?\"font-size: \"+e.fontSize+\"px\"+r:\"\",a=e.fontStyle?\"font-style: \"+e.fontStyle+r:\"\",h=e.fontWeight?\"font-weight: \"+e.fontWeight+r:\"\",l=e.fill?t(\"fill\",e.fill):\"\",c=e.stroke?t(\"stroke\",e.stroke):\"\",u=this.getSvgTextDecoration(e);return u&&(u=\"text-decoration: \"+u+r),[c,s,n,o,a,h,u,l,e.deltaY?\"baseline-shift: \"+-e.deltaY+\"; \":\"\",i?\"white-space: pre; \":\"\"].join(\"\")},getSvgTextDecoration:function(t){return[\"overline\",\"underline\",\"line-through\"].filter((function(e){return t[e.replace(\"-\",\"\")]}
2)).join(\" \")},getSvgFilter:function(){return this.shadow?\"filter: url(#SVGID_\"+this.shadow.id+\");\":\"\"},getSvgCommons:function(){return[this.id?'id=\"'+this.id+'\" ':\"\",this.clipPath?'clip-path=\"url(#'+this.clipPath.clipPathId+')\" ':\"\"].join(\"\")},getSvgTransform:function(t,e){var i=t?this.calcTransformMatrix():this.calcOwnMatrix();return'transform=\"'+S.util.matrixToSVG(i)+(e||\"\")+'\" '},_setSVGBg:function(t){if(this.backgroundColor){var i=S.Object.NUM_FRACTION_DIGITS;t.push(\"\\t\\t<rect \",this._getFillAttributes(this.backgroundColor),' x=\"',e(-this.width/2,i),'\" y=\"',e(-this.height/2,i),'\" width=\"',e(this.width,i),'\" height=\"',e(this.height,i),'\"></rect>\\n')}},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return\"\\t\"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var i=(e=e||{}).reviver,r=e.additionalTransform||\"\",n=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(\"\"),s=t.indexOf(\"COMMON_PARTS\");return t[s]=n,i?i(t.join(\"\")):t.join(\"\")},_createBaseSVGMarkup:function(t,e){var i,r,n=(e=e||{}).noStyle,s=e.reviver,o=n?\"\":'style=\"'+this.getSvgStyles()+'\" ',a=e.withShadow?'style=\"'+this.getSvgFilter()+'\" ':\"\",h=this.clipPath,l=this.strokeUniform?'vector-effect=\"non-scaling-stroke\" ':\"\",c=h&&h.absolutePositioned,u=this.stroke,d=this.fill,f=this.shadow,g=[],m=t.indexOf(\"COMMON_PARTS\"),p=e.additionalTransform;return h&&(h.clipPathId=\"CLIPPATH_\"+S.Object.__uid++,r='<clipPath id=\"'+h.clipPathId+'\" >\\n'+h.toClipPathSVG(s)+\"</clipPath>\\n\"),c&&g.push(\"<g \",a,this.getSvgCommons(),\" >\\n\"),g.push(\"<g \",this.getSvgTransform(!1),c?\"\":a+this.getSvgCommons(),\" >\\n\"),i=[o,l,n?\"\":this.addPaintOrder(),\" \",p?'transform=\"'+p+'\" ':\"\"].join(\"\"),t[m]=i,d&&d.toLive&&g.push(d.toSVG(this)),u&&u.toLive&&g.push(u.toSVG(this)),f&&g.push(f.toSVG(this)),h&&g.push(r),g.push(t.join(\"\")),g.push(\"</g>\\n\"),c&&g.push(\"</g>\\n\"),s?s(g.join(\"\")):g.join(\"\")},addPaintOrder:function(){return\"fill\"!==this.paintFirst?' paint-order=\"'+this.paintFirst+'\" ':\"\"}})}(),function(){var t=S.util.object.extend,e=\"stateProperties\";function i(e,i,r){var n={};r.forEach((function(t){n[t]=e[t]})),t(e[i],n,!0)}function r(t,e,i){if(t===e)return!0;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0,s=t.length;n<s;n++)if(!r(t[n],e[n]))return!1;return!0}if(t&&\"object\"==typeof t){var o,a=Object.keys(t);if(!e||\"object\"!=typeof e||!i&&a.length!==Object.keys(e).length)return!1;for(n=0,s=a.length;n<s;n++)if(\"canvas\"!==(o=a[n])&&\"group\"!==o&&!r(t[o],e[o]))return!1;return!0}}S.util.object.extend(S.Object.prototype,{hasStateChanged:function(t){var i=\"_\"+(t=t||e);return Object.keys(this[i]).length<this[t].length||!r(this[i],this,!0)},saveState:function(t){var r=t&&t.propertySet||e,n=\"_\"+r;return this[n]?(i(this,n,this[r]),t&&t.stateProperties&&i(this,n,t.stateProperties),this):this.setupState(t)},setupState:function(t){var i=(t=t||{}).propertySet||e;return t.propertySet=i,this[\"_\"+i]={},this.saveState(t),this}})}(),function(){var t=S.util.degreesToRadians;S.util.object.extend(S.Object.prototype,{_findTargetCorner:function(t,e){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var i,r,n,s=t.x,o=t.y,a=Object.keys(this.oCoords),h=a.length-1;for(this.__corner=0;h>=0;h--)if(n=a[h],this.isControlVisible(n)&&(r=this._getImageLines(e?this.oCoords[n].touchCorner:this.oCoords[n].corner),0!==(i=this._findCrossPoints({x:s,y:o},r))&&i%2==1))return this.__corner=n,n;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t=this.oCoords;for(var e in t){var i=this.controls[e];t[e].corner=i.calcCornerCoords(this.angle,this.cornerSize,t[e].x,t[e].y,!1),t[e].touchCorner=i.calcCornerCoords(this.angle,this.touchCornerSize,t[e].x,t[e].y,!0)}},drawSelectionBackground:function(e){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;e.save();var i=this.getCenterPoint(),r=this._calculateCurrentDimensions(),n=this.canvas.viewportTransform;return e.translate(i.x,i.y),e.scale(1/n[0],1/n[3]),e.rotate(t(this.angle)),e.fillStyle=this.selectionBackgroun
vendor: 8,240 bytes, line 2
2dColor,e.fillRect(-r.x/2,-r.y/2,r.x,r.y),e.restore(),this},drawBorders:function(t,e){e=e||{};var i=this._calculateCurrentDimensions(),r=this.borderScaleFactor,n=i.x+r,s=i.y+r,o=void 0!==e.hasControls?e.hasControls:this.hasControls,a=!1;return t.save(),t.strokeStyle=e.borderColor||this.borderColor,this._setLineDash(t,e.borderDashArray||this.borderDashArray),t.strokeRect(-n/2,-s/2,n,s),o&&(t.beginPath(),this.forEachControl((function(e,i,r){e.withConnection&&e.getVisibility(r,i)&&(a=!0,t.moveTo(e.x*n,e.y*s),t.lineTo(e.x*n+e.offsetX,e.y*s+e.offsetY))})),a&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,i){i=i||{};var r=S.util.sizeAfterTransform(this.width,this.height,e),n=this.strokeWidth,s=this.strokeUniform,o=this.borderScaleFactor,a=r.x+n*(s?this.canvas.getZoom():e.scaleX)+o,h=r.y+n*(s?this.canvas.getZoom():e.scaleY)+o;return t.save(),this._setLineDash(t,i.borderDashArray||this.borderDashArray),t.strokeStyle=i.borderColor||this.borderColor,t.strokeRect(-a/2,-h/2,a,h),t.restore(),this},drawControls:function(t,e){e=e||{},t.save();var i,r,n=this.canvas.getRetinaScaling();return t.setTransform(n,0,0,n,0,0),t.strokeStyle=t.fillStyle=e.cornerColor||this.cornerColor,this.transparentCorners||(t.strokeStyle=e.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(t,e.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(i=this.group.calcTransformMatrix()),this.forEachControl((function(n,s,o){r=o.oCoords[s],n.getVisibility(o,s)&&(i&&(r=S.util.transformPoint(r,i)),n.render(t,r.x,r.y,e,o))})),t.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t||(t={}),t)this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}})}(),S.util.object.extend(S.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return S.util.animate({target:this,startValue:t.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(e){t.set(\"left\",e),s.requestRenderAll(),n()},onComplete:function(){t.setCoords(),r()}})},fxCenterObjectV:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return S.util.animate({target:this,startValue:t.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(e){t.set(\"top\",e),s.requestRenderAll(),n()},onComplete:function(){t.setCoords(),r()}})},fxRemove:function(t,e){var i=function(){},r=(e=e||{}).onComplete||i,n=e.onChange||i,s=this;return S.util.animate({target:this,startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set(\"opacity\",e),s.requestRenderAll(),n()},onComplete:function(){s.remove(t),r()}})}}),S.util.object.extend(S.Object.prototype,{animate:function(){if(arguments[0]&&\"object\"==typeof arguments[0]){var t,e,i=[],r=[];for(t in arguments[0])i.push(t);for(var n=0,s=i.length;n<s;n++)t=i[n],e=n!==s-1,r.push(this._animate(t,arguments[0][t],arguments[1],e));return r}return this._animate.apply(this,arguments)},_animate:function(t,e,i,r){var n,s=this;e=e.toString(),i=i?S.util.object.clone(i):{},~t.indexOf(\".\")&&(n=t.split(\".\"));var o=s.colorProperties.indexOf(t)>-1||n&&s.colorProperties.indexOf(n[1])>-1,a=n?this.get(n[0])[n[1]]:this.get(t);\"from\"in i||(i.from=a),o||(e=~e.indexOf(\"=\")?a+parseFloat(e.replace(\"=\",\"\")):parseFloat(e));var h={target:this,startValue:i.from,endValue:e,byValue:i.by,easing:i.easing,duration:i.duration,abort:i.abort&&function(t,e,r){return i.abort.call(s,t,e,r)},onChange:function(e,o,a){n?s[n[0]][n[1]]=e:s.set(t,e),r||i.onChange&&i.onChange(e,o,a)},onComplete:function(t,e,n){r||(s.setCoords(),i.onComplete&&i.onComplete(t,e,n))}};return o?S.util.animateColor(h.startValue,h.endValue,h.duration,h):S.util.animate(h)}}),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n={x1:1,x2:1,y1:1,y2:1};function s(t,e){var i=t.origin,r=t.axis1,n=t.axis2,s=t.dimension,o=e.nearest,a=e.center,h=e.farthest;return function(){switch(this.get(i)){case o:return Math.min(this.get(r),this.get(n));case a:return Math.min(this.get(r),this.get(n))+.5*this.get(s);case h:return Math.max(this.get(r),this.get(n))}}}e.Line?e.warn(\"fabric.Line is already defined\"):(e.Line=e.util.createClass(e.Object,{type:\"line\",x1:0,y1:0,x2:0,y2:0,cacheProperties:e.Object.prototype.cacheProperties.concat(\"x1\",\"x2\",\"y1\",\"y2\"),initialize:function(t,e){t||(t=[0,0,0,0]),this.callSuper(\"initialize\",e),this.set(\"x1\",t[0]),this.set(\"y1\",t[1]),this.set(\"x2\",t[2]),this.set(\"y2\",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left=\"left\"in t?t.left:this._getLeftToOriginX(),this.top=\"top\"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper(\"_set\",t,e),void 0!==n[t]&&this._setWidthHeight(),this},_getLeftToOriginX:s({origin:\"originX\",axis1:\"x1\",axis2:\"x2\",dimension:\"width\"},{nearest:\"left\",center:\"center\",farthest:\"right\"}),_getTopToOriginY:s({origin:\"originY\",axis1:\"y1\",axis2:\"y2\",dimension:\"height\"},{nearest:\"top\",center:\"center\",farthest:\"bottom\"}),_render:function(t){t.beginPath();var e=this.calcLinePoints();t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth;var i=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=i},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return i(this.callSuper(\"toObject\",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper(\"_getNonTransformedDimensions\");return\"butt\"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,i=t*this.width*.5,r=e*this.height*.5;return{x1:i,x2:t*this.width*-.5,y1:r,y2:e*this.height*-.5}},_toSVG:function(){var t=this.calcLinePoints();return[\"<line \",\"COMMON_PARTS\",'x1=\"',t.x1,'\" y1=\"',t.y1,'\" x2=\"',t.x2,'\" y2=\"',t.y2,'\" />\\n']}}),e.Line.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(\"x1 y1 x2 y2\".split(\" \")),e.Line.fromElement=function(t,r,n){n=n||{};var s=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),o=[s.x1||0,s.y1||0,s.x2||0,s.y2||0];r(new e.Line(o,i(s,n)))},e.Line.fromObject=function(t,i){var n=r(t,!0);n.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject(\"Line\",n,(function(t){delete t.points,i&&i(t)}),\"points\")})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.degreesToRadians;e.Circle?e.warn(\"fabric.Circle is already defined.\"):(e.Circle=e.util.createClass(e.Object,{type:\"circle\",radius:0,startAngle:0,endAngle:360,cacheProperties:e.Object.prototype.cacheProperties.concat(\"radius\",\"startAngle\",\"endAngle\"),_set:function(t,e){return this.callSuper(\"_set\",t,e),\"radius\"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper(\"toObject\",[\"radius\",\"startAngle\",\"endAngle\"].concat(t))},_toSVG:function(){var t,r=(this.endAngle-this.startAngle)%360;if(0===r)t=[\"<circle \",\"COMMON_PARTS\",'cx=\"0\" cy=\"0\" ','r=\"',this.radius,'\" />\\n'];else{var n=i(this.startAngle),s=i(this.endAngle),o=this.radius;t=['<path d=\"M '+e.util.cos(n)*o+\" \"+e.util.sin(n)*o,\" A \"+o+\" \"+o,\" 0 \",+(r>180?\"1\":\"0\")+\" 1\",\" \"+e.util.cos(s)*o+\" \"+e.util.sin(s)*o,'\" ',\"COMMON_PARTS\",\" />\\n\"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,i(this.startAngle),i(this.endAngle),!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get(\"radius\")*this.get(\"scaleX\")},getRadiusY:function(){return this.get(\"radius\")*this.get(\"scaleY\")},setRadius:function(t){return this.radius=t,this.set(\"width\",2*t).set(\"height\",2*t)}}),e.Circle.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(\"cx cy r\".split(\" \")),e.Circle.fromElement=function(t,i){var r,n=e.parseAttributes(t,e.Circle.ATTRIBUTE_NAMES);
2if(!(\"radius\"in(r=n)&&r.radius>=0))throw new Error(\"value of `r` attribute is required and can not be negative\");n.left=(n.left||0)-n.radius,n.top=(n.top||0)-n.radius,i(new e.Circle(n))},e.Circle.fromObject=function(t,i){e.Object._fromObject(\"Circle\",t,i)})}(e),function(t){var e=t.fabric||(t.fabric={});e.Triangle?e.warn(\"fabric.Triangle is already defined\"):(e.Triangle=e.util.createClass(e.Object,{type:\"triangle\",width:100,height:100,_render:function(t){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,i),t.lineTo(0,-i),t.lineTo(e,i),t.closePath(),this._renderPaintInOrder(t)},_toSVG:function(){var t=this.width/2,e=this.height/2;return[\"<polygon \",\"COMMON_PARTS\",'points=\"',[-t+\" \"+e,\"0 \"+-e,t+\" \"+e].join(\",\"),'\" />']}}),e.Triangle.fromObject=function(t,i){return e.Object._fromObject(\"Triangle\",t,i)})}(e),function(t){var e=t.fabric||(t.fabric={}),i=2*Math.PI;e.Ellipse?e.warn(\"fabric.Ellipse is already defined.\"):(e.Ellipse=e.util.createClass(e.Object,{type:\"ellipse\",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat(\"rx\",\"ry\"),initialize:function(t){this.callSuper(\"initialize\",t),this.set(\"rx\",t&&t.rx||0),this.set(\"ry\",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper(\"_set\",t,e),t){case\"rx\":this.rx=e,this.set(\"width\",2*e);break;case\"ry\":this.ry=e,this.set(\"height\",2*e)}return this},getRx:function(){return this.get(\"rx\")*this.get(\"scaleX\")},getRy:function(){return this.get(\"ry\")*this.get(\"scaleY\")},toObject:function(t){return this.callSuper(\"toObject\",[\"rx\",\"ry\"].concat(t))},_toSVG:function(){return[\"<ellipse \",\"COMMON_PARTS\",'cx=\"0\" cy=\"0\" ','rx=\"',this.rx,'\" ry=\"',this.ry,'\" />\\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,i,!1),t.restore(),this._renderPaintInOrder(t)}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(\"cx cy rx ry\".split(\" \")),e.Ellipse.fromElement=function(t,i){var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);r.left=(r.left||0)-r.rx,r.top=(r.top||0)-r.ry,i(new e.Ellipse(r))},e.Ellipse.fromObject=function(t,i){e.Object._fromObject(\"Ellipse\",t,i)})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend;e.Rect?e.warn(\"fabric.Rect is already defined\"):(e.Rect=e.util.createClass(e.Object,{stateProperties:e.Object.prototype.stateProperties.concat(\"rx\",\"ry\"),type:\"rect\",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat(\"rx\",\"ry\"),initialize:function(t){this.callSuper(\"initialize\",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,i=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,n=this.height,s=-this.width/2,o=-this.height/2,a=0!==e||0!==i,h=.4477152502;t.beginPath(),t.moveTo(s+e,o),t.lineTo(s+r-e,o),a&&t.bezierCurveTo(s+r-h*e,o,s+r,o+h*i,s+r,o+i),t.lineTo(s+r,o+n-i),a&&t.bezierCurveTo(s+r,o+n-h*i,s+r-h*e,o+n,s+r-e,o+n),t.lineTo(s+e,o+n),a&&t.bezierCurveTo(s+h*e,o+n,s,o+n-h*i,s,o+n-i),t.lineTo(s,o+i),a&&t.bezierCurveTo(s,o+h*i,s+h*e,o,s+e,o),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper(\"toObject\",[\"rx\",\"ry\"].concat(t))},_toSVG:function(){return[\"<rect \",\"COMMON_PARTS\",'x=\"',-this.width/2,'\" y=\"',-this.height/2,'\" rx=\"',this.rx,'\" ry=\"',this.ry,'\" width=\"',this.width,'\" height=\"',this.height,'\" />\\n']}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(\"x y rx ry width height\".split(\" \")),e.Rect.fromElement=function(t,r,n){if(!t)return r(null);n=n||{};var s=e.parseAttributes(t,e.Rect.ATTRIBUTE_NAMES);s.left=s.left||0,s.top=s.top||0,s.height=s.height||0,s.width=s.width||0;var o=new e.Rect(i(n?e.util.object.clone(n):{},s));o.visible=o.visible&&o.width>0&&o.height>0,r(o)},e.Rect.fromObject=function(t,i){return e.Object._fromObject(\"Rect\",t,i)})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.array.min,n=e.util.array.max,s=e.util.toFixed,o=e.util.projectStrokeOnPoints;e.Polyline?e.warn(\"fabric.Polyline is already defined\"):(e.Polyline=e.util.createClass(e.Object,{type:\"polyline\",points:null,exactBoundingBox:!1,cacheProperties:e.Object.prototype.cacheProperties.concat(\"points\"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper(\"initialize\",e),this._setPositionDimensions(e)},_projectStrokeOnPoints:function(){return o(this.points,this,!0)},_setPositionDimensions:function(t){var e,i=this._calcDimensions(t),r=this.exactBoundingBox?this.strokeWidth:0;this.width=i.width-r,this.height=i.height-r,t.fromSVG||(e=this.translateToGivenOrigin({x:i.left-this.strokeWidth/2+r/2,y:i.top-this.strokeWidth/2+r/2},\"left\",\"top\",this.originX,this.originY)),void 0===t.left&&(this.left=t.fromSVG?i.left
2:e.x),void 0===t.top&&(this.top=t.fromSVG?i.top:e.y),this.pathOffset={x:i.left+this.width/2+r/2,y:i.top+this.height/2+r/2}},_calcDimensions:function(){var t=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,e=r(t,\"x\")||0,i=r(t,\"y\")||0;return{left:e,top:i,width:(n(t,\"x\")||0)-e,height:(n(t,\"y\")||0)-i}},toObject:function(t){return i(this.callSuper(\"toObject\",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],i=this.pathOffset.x,r=this.pathOffset.y,n=e.Object.NUM_FRACTION_DIGITS,o=0,a=this.points.length;o<a;o++)t.push(s(this.points[o].x-i,n),\",\",s(this.points[o].y-r,n),\" \");return[\"<\"+this.type+\" \",\"COMMON_PARTS\",'points=\"',t.join(\"\"),'\" />\\n']},commonRender:function(t){var e,i=this.points.length,r=this.pathOffset.x,n=this.pathOffset.y;if(!i||isNaN(this.points[i-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-n);for(var s=0;s<i;s++)e=this.points[s],t.lineTo(e.x-r,e.y-n);return!0},_render:function(t){this.commonRender(t)&&this._renderPaintInOrder(t)},complexity:function(){return this.get(\"points\").length}}),e.Polyline.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polyline.fromElementGenerator=function(t){return function(r,n,s){if(!r)return n(null);s||(s={});var o=e.parsePointsAttribute(r.getAttribute(\"points\")),a=e.parseAttributes(r,e[t].ATTRIBUTE_NAMES);a.fromSVG=!0,n(new e[t](o,i(a,s)))}},e.Polyline.fromElement=e.Polyline.fromElementGenerator(\"Polyline\"),e.Polyline.fromObject=function(t,i){return e.Object._fromObject(\"Polyline\",t,i,\"points\")})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.projectStrokeOnPoints;e.Polygon?e.warn(\"fabric.Polygon is already defined\"):(e.Polygon=e.util.createClass(e.Polyline,{type:\"polygon\",_projectStrokeOnPoints:function(){return i(this.points,this)},_render:function(t){this.commonRender(t)&&(t.closePath(),this._renderPaintInOrder(t))}}),e.Polygon.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polygon.fromElement=e.Polyline.fromElementGenerator(\"Polygon\"),e.Polygon.fromObject=function(t,i){e.Object._fromObject(\"Polygon\",t,i,\"points\")})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.array.min,r=e.util.array.max,n=e.util.object.extend,s=e.util.object.clone,o=e.util.toFixed;e.Path?e.warn(\"fabric.Path is already defined\"):(e.Path=e.util.createClass(e.Object,{type:\"path\",path:null,cacheProperties:e.Object.prototype.cacheProperties.concat(\"path\",\"fillRule\"),stateProperties:e.Object.prototype.stateProperties.concat(\"path\"),initialize:function(t,e){delete(e=s(e||{})).path,this.callSuper(\"initialize\",e),this._setPath(t||[],e)},_setPath:function(t,i){this.path=e.util.makePathSimpler(Array.isArray(t)?t:e.util.parsePath(t)),e.Polyline.prototype._setPositionDimensions.call(this,i||{})},_renderPathCommands:function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,h=-this.pathOffset.x,l=-this.pathOffset.y;t.beginPath();for(var c=0,u=this.path.length;c<u;++c)switch((e=this.path[c])[0]){case\"L\":n=e[1],s=e[2],t.lineTo(n+h,s+l);break;case\"M\":i=n=e[1],r=s=e[2],t.moveTo(n+h,s+l);break;case\"C\":n=e[5],s=e[6],o=e[3],a=e[4],t.bezierCurveTo(e[1]+h,e[2]+l,o+h,a+l,n+h,s+l);break;case\"Q\":t.quadraticCurveTo(e[1]+h,e[2]+l,e[3]+h,e[4]+l),n=e[3],s=e[4],o=e[1],a=e[2];break;case\"z\":case\"Z\":n=i,s=r,t.closePath()}},_render:function(t){this._renderPathCommands(t),this._renderPaintInOrder(t)},toString:function(){return\"#<fabric.Path (\"+this.complexity()+'): { \"top\": '+this.top+', \"left\": '+this.left+\" }>\"},toObject:function(t){return n(this.callSuper(\"toObject\",t),{path:this.path.map((function(t){return t.slice()}))})},toDatalessObject:function(t){var e=this.toObject([\"sourcePath\"].concat(t));return e.sourcePath&&delete e.path,e},_toSVG:function(){return[\"<path \",\"COMMON_PARTS\",'d=\"',e.util.joinPath(this.path),'\" stroke-linecap=\"round\" ',\"/>\\n\"]},_getOffsetTransform:function(){var t=e.Object.NUM_FRACTION_DIGITS;return\" translate(\"+o(-this.pathOffset.x,t)+\", \"+o(-this.pathOffset.y,t)+\")\"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return\"\\t\"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,n,s=[],o=[],a=0,h=0,l=0,c=0,u=0,d=this.path.length;u<d;++u){switch((t=this.path[u])[0]){case\"L\":l=t[1],c=t[2],n=[];break;case\"M\":a=l=t[1],h=c=t[2],n=[];break;case\"C\":n=e.util.getBoundsOfCurve(l,c,t[1],t[2],t[3],t[4],t[5],t[6]),l=t[5],c=t[6];break;case\"Q\":n=e.util.getBoundsOfCurve(l,c,t[1],t[2],t[1],t[2],t[3],t[4]),l=t[3],c=t[4];break;case\"z\":case\"Z\":l=a,c=h}n.forEach((function(t){s.push(t.x),o.push(t.y)})),s.push(l),o.push(c)}var f=i(s)||0,g=i(o)||0;return{left:f,top:g,width:(r(s)||0)-f,height:(r(o)||0)-g}}}
2),e.Path.fromObject=function(t,i){if(\"string\"==typeof t.sourcePath){var r=t.sourcePath;e.loadSVGFromURL(r,(function(e){var r=e[0];r.setOptions(t),i&&i(r)}))}else e.Object._fromObject(\"Path\",t,i,\"path\")},e.Path.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat([\"d\"]),e.Path.fromElement=function(t,i,r){var s=e.parseAttributes(t,e.Path.ATTRIBUTE_NAMES);s.fromSVG=!0,i(new e.Path(s.d,n(s,r)))})}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.array.min,r=e.util.array.max;e.Group||(e.Group=e.util.createClass(e.Object,e.Collection,{type:\"group\",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(t,e,i){e=e||{},this._objects=[],i&&this.callSuper(\"initialize\",e),this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;if(i)this._updateObjectsACoords();else{var n=e&&e.centerPoint;void 0!==e.originX&&(this.originX=e.originX),void 0!==e.originY&&(this.originY=e.originY),n||this._calcBounds(),this._updateObjectsCoords(n),delete e.centerPoint,this.callSuper(\"initialize\",e)}this.setCoords()},_updateObjectsACoords:function(){for(var t=this._objects.length;t--;)this._objects[t].setCoords(!0)},_updateObjectsCoords:function(t){t=t||this.getCenterPoint();for(var e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){var i=t.left,r=t.top;t.set({left:i-e.x,top:r-e.y}),t.group=this,t.setCoords(!0)},toString:function(){return\"#<fabric.Group: (\"+this.complexity()+\")>\"},addWithUpdate:function(t){var i=!!this.group;return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(i&&e.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set(\"canvas\",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,i?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set(\"canvas\",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,i){var r=this._objects.length;if(this.useSetOnGroup)for(;r--;)this._objects[r].setOnGroup(t,i);if(\"canvas\"===t)for(;r--;)this._objects[r]._set(t,i);e.Object.prototype._set.call(this,t,i)},toObject:function(t){var i=this.includeDefaultValues,r=this._objects.filter((function(t){return!t.excludeFromExport})).map((function(e){var r=e.includeDefaultValues;e.includeDefaultValues=i;var n=e.toObject(t);return e.includeDefaultValues=r,n})),n=e.Object.prototype.toObject.call(this,t);return n.objects=r,n},toDatalessObject:function(t){var i,r=this.sourcePath;if(r)i=r;else{var n=this.includeDefaultValues;i=this._objects.map((function(e){var i=e.includeDefaultValues;e.includeDefaultValues=n;var r=e.toDatalessObject(t);return e.includeDefaultValues=i,r}))}var s=e.Object.prototype.toDatalessObject.call(this,t);return s.objects=i,s},render:function(t){this._transformDone=!0,this.callSuper(\"render\",t),this._transformDone=!1},shouldCache:function(){var t=e.Object.prototype.shouldCache.call(this);if(t)for(var i=0,r=this._objects.length;i<r;i++)if(this._objects[i].willDrawShadow())return this.ownCaching=!1,!1;return t},willDrawShadow:function(){if(e.Object.prototype.willDrawShadow.call(this))return!0;for(var t=0,i=this._objects.length;t<i;t++)if(this._objects[t].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(t){for(var e=0,i=this._objects.length;e<i;e++)this._objects[e].render(t);this._drawClipPath(t,this.clipPath)},isCacheDirty:function(t){if(this.callSuper(\"isCacheDirty\",t))return!0;if(!this.statefullCache)return!1;for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e].isCacheDirty(!0)){if(this._cacheCanvas){var r=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-r/2,-n/2,r,n)}return!0}return!1},_restoreObjectsState:function(){var t=this.calcOwnMatrix();
2return this._objects.forEach((function(i){e.util.addTransformToObject(i,t),delete i.group,i.setCoords()})),this},destroy:function(){return this._objects.forEach((function(t){t.set(\"dirty\",!0)})),this._restoreObjectsState()},dispose:function(){this.callSuper(\"dispose\"),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[]},toActiveSelection:function(){if(this.canvas){var t=this._objects,i=this.canvas;this._objects=[];var r=this.toObject();delete r.objects;var n=new e.ActiveSelection([]);return n.set(r),n.type=\"activeSelection\",i.remove(this),t.forEach((function(t){t.group=n,t.dirty=!0,i.add(t)})),n.canvas=i,n._objects=t,i._activeObject=n,n.setCoords(),n}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject((function(t){t.setCoords(!0)})),this},_calcBounds:function(t){for(var e,i,r,n,s=[],o=[],a=[\"tr\",\"br\",\"bl\",\"tl\"],h=0,l=this._objects.length,c=a.length;h<l;++h){for(r=(e=this._objects[h]).calcACoords(),n=0;n<c;n++)i=a[n],s.push(r[i].x),o.push(r[i].y);e.aCoords=r}this._getBounds(s,o,t)},_getBounds:function(t,n,s){var o=new e.Point(i(t),i(n)),a=new e.Point(r(t),r(n)),h=o.y||0,l=o.x||0,c=a.x-o.x||0,u=a.y-o.y||0;this.width=c,this.height=u,s||this.setPositionByOrigin({x:l,y:h},\"left\",\"top\")},_toSVG:function(t){for(var e=[\"<g \",\"COMMON_PARTS\",\" >\\n\"],i=0,r=this._objects.length;i<r;i++)e.push(\"\\t\\t\",this._objects[i].toSVG(t));return e.push(\"</g>\\n\"),e},getSvgStyles:function(){var t=void 0!==this.opacity&&1!==this.opacity?\"opacity: \"+this.opacity+\";\":\"\",e=this.visible?\"\":\" visibility: hidden;\";return[t,this.getSvgFilter(),e].join(\"\")},toClipPathSVG:function(t){for(var e=[],i=0,r=this._objects.length;i<r;i++)e.push(\"\\t\",this._objects[i].toClipPathSVG(t));return this._createBaseClipPathSVGMarkup(e,{reviver:t})}}),e.Group.fromObject=function(t,i){var r=t.objects,n=e.util.object.clone(t,!0);delete n.objects,\"string\"!=typeof r?e.util.enlivenObjects(r,(function(r){var n=e.util.object.clone(t,!0);delete n.objects,e.util.enlivenObjectEnlivables(t,n,(function(){i&&i(new e.Group(r,n,!0))}))})):e.loadSVGFromURL(r,(function(s){var o=e.util.groupSVGElements(s,t,r);o.set(n),i&&i(o)}))})}(e),function(t){var e=t.fabric||(t.fabric={});e.ActiveSelection||(e.ActiveSelection=e.util.createClass(e.Group,{type:\"activeSelection\",initialize:function(t,i){i=i||{},this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;i.originX&&(this.originX=i.originX),i.originY&&(this.originY=i.originY),this._calcBounds(),this._updateObjectsCoords(),e.Object.prototype.initialize.call(this,i),this.setCoords()},toGroup:function(){var t=this._objects.concat();this._objects=[];var i=e.Object.prototype.toObject.call(this),r=new e.Group([]);if(delete i.type,r.set(i),t.forEach((function(t){t.canvas.remove(t),t.group=r})),r._objects=t,!this.canvas)return r;var n=this.canvas;return n.add(r),n._activeObject=r,r.setCoords(),r},onDeselect:function(){return this.destroy(),!1},toString:function(){return\"#<fabric.ActiveSelection: (\"+this.complexity()+\")>\"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,i){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper(\"_renderControls\",t,e),void 0===(i=i||{}).hasControls&&(i.hasControls=!1),i.forActiveSelection=!0;for(var r=0,n=this._objects.length;r<n;r++)this._objects[r]._renderControls(t,i);t.restore()}}),e.ActiveSelection.fromObject=function(t,i){e.util.enlivenObjects(t.objects,(function(r){delete t.objects,i&&i(new e.ActiveSelection(r,t,!0))}))})}(e),function(t){var e=S.util.object.extend;t.fabric||(t.fabric={}),t.fabric.Image?S.warn(\"fabric.Image is already defined.\"):(S.Image=S.util.createClass(S.Object,{type:\"image\",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:S.Object.prototype.stateProperties.concat(\"cropX\",\"cropY\"),cacheProperties:S.Object.prototype.cacheProperties.concat(\"cropX\",\"cropY\"),cacheKey:\"\",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e||(e={}),this.filters=[],this.cacheKey=\"texture\"+S.Object.__uid++,this.callSuper(\"initialize\",e),this._initElement(t,e)},getElement:function(){return this._element||{}},setElement:function(t,e){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+\"_filtered\"),this._element=t,this._originalElement=t,this._initConfig(e),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(t){var e=S.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.callSuper(\"dispose\"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+\"_filtered\"),this._cacheContext=void 0,[\"_originalElement\",\"_element\",\"_filteredEl\",\"_cacheCanvas\"].forEach(function(t){S.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var t=this.getElement();
vendor: 19,121 bytes, line 2
2return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}},_stroke:function(t){if(this.stroke&&0!==this.strokeWidth){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,-i),t.lineTo(e,-i),t.lineTo(e,i),t.lineTo(-e,i),t.lineTo(-e,-i),t.closePath()}},toObject:function(t){var i=[];this.filters.forEach((function(t){t&&i.push(t.toObject())}));var r=e(this.callSuper(\"toObject\",[\"cropX\",\"cropY\"].concat(t)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:i});return this.resizeFilter&&(r.resizeFilter=this.resizeFilter.toObject()),r},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var t,e=[],i=[],r=this._element,n=-this.width/2,s=-this.height/2,o=\"\",a=\"\";if(!r)return[];if(this.hasCrop()){var h=S.Object.__uid++;e.push('<clipPath id=\"imageCrop_'+h+'\">\\n','\\t<rect x=\"'+n+'\" y=\"'+s+'\" width=\"'+this.width+'\" height=\"'+this.height+'\" />\\n',\"</clipPath>\\n\"),o=' clip-path=\"url(#imageCrop_'+h+')\" '}if(this.imageSmoothing||(a='\" image-rendering=\"optimizeSpeed'),i.push(\"\\t<image \",\"COMMON_PARTS\",'xlink:href=\"',this.getSvgSrc(!0),'\" x=\"',n-this.cropX,'\" y=\"',s-this.cropY,'\" width=\"',r.width||r.naturalWidth,'\" height=\"',r.height||r.height,a,'\"',o,\"></image>\\n\"),this.stroke||this.strokeDashArray){var l=this.fill;this.fill=null,t=[\"\\t<rect \",'x=\"',n,'\" y=\"',s,'\" width=\"',this.width,'\" height=\"',this.height,'\" style=\"',this.getSvgStyles(),'\"/>\\n'],this.fill=l}return\"fill\"!==this.paintFirst?e.concat(t,i):e.concat(i,t)},getSrc:function(t){var e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute(\"src\"):e.src:this.src||\"\"},setSrc:function(t,e,i){return S.util.loadImage(t,(function(t,r){this.setElement(t,i),this._setWidthHeight(),e&&e(this,r)}),this,i&&i.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: \"'+this.getSrc()+'\" }>'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,i=this.getTotalObjectScaling(),r=i.scaleX,n=i.scaleY,s=this._filteredEl||this._originalElement;if(this.group&&this.set(\"dirty\",!0),!t||r>e&&n>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=r,void(this._lastScaleY=n);S.filterBackend||(S.filterBackend=S.initFilterBackend());var o=S.util.createCanvasElement(),a=this._filteredEl?this.cacheKey+\"_filtered\":this.cacheKey,h=s.width,l=s.height;o.width=h,o.height=l,this._element=o,this._lastScaleX=t.scaleX=r,this._lastScaleY=t.scaleY=n,S.filterBackend.applyFilters([t],s,h,l,this._element,a),this._filterScalingX=o.width/this._originalElement.width,this._filterScalingY=o.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter((function(t){return t&&!t.isNeutralState()})),this.set(\"dirty\",!0),this.removeTexture(this.cacheKey+\"_filtered\"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,i=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(this._element===this._originalElement){var n=S.util.createCanvasElement();n.width=i,n.height=r,this._element=n,this._filteredEl=n}else this._element=this._filteredEl,this._filteredEl.getContext(\"2d\").clearRect(0,0,i,r),this._lastScaleX=1,this._lastScaleY=1;return S.filterBackend||(S.filterBackend=S.initFilterBackend()),S.filterBackend.applyFilters(t,this._originalElement,i,r,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){S.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){S.util.setImageSmoothing(t,this.imageSmoothing),S.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var i=this._filterScalingX,r=this._filterScalingY,n=this.width,s=this.height,o=Math.min,a=Math.max,h=a(this.cropX,0),l=a(this.cropY,0),c=e.naturalWidth||e.width,u=e.naturalHeight||e.height,d=h*i,f=l*r,g=o(n*i,c-d),m=o(s*r,u-f),p=-n/2,_=-s/2,v=o(n,c/i-h),y=o(s,u/r-l);e&&t.drawImage(e,d,f,g,m,p,_,v,y)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(S.util.getById(t),e),S.util.addClass(this.getElement(),S.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?S.util.enlivenObjects(t,(function(t){e&&e(t)}),\"fabric.Image.filters\"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=S.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||\"\"),i=this._element.width,r=this._element.height,n=1,s=1,o=0,a=0,h=0,l=0,c=this.width,u=this.height,d={width:c,height:u};return!e||\"none\"===e.alignX&&\"none\"===e.alignY?(n=c/i,s=u/r):(\"meet\"===e.meetOrSlice&&(t=(c-i*(n=s=S.util.findScaleToFit(this._element,d)))/2,\"Min\"===e.alignX&&(o=-t),\"Max\"===e.alignX&&(o=t),t=(u-r*s)/2,\"Min\"===e.alignY&&(a=-t),\"Max\"===e.alignY&&(a=t)),\"slice\"===e.meetOrSlice&&(t=i-c/(n=s=S.util.findScaleToCover(this._element,d)),\"Mid\"===e.alignX&&(h=t/2),\"Max\"===e.alignX&&(h=t),t=r-u/s,\"Mid\"===e.alignY&&(l=t/2),\"Max\"===e.alignY&&(l=t),i=c/n,r=u/s)),{width:i,height:r,scaleX:n,scaleY:s,offsetLeft:o,offsetTop:a,cropX:h,cropY:l}}}),S.Image.CSS_CANVAS=\"canvas-img\",S.Image.prototype.getSvgSrc=S.Image.prototype.getSrc,S.Image.fromObject=function(t,e){var i=S.util.object.clone(t);S.util.loadImage(i.src,(function(t,r){r?e&&e(null,!0):S.Image.prototype._initFilters.call(i,i.filters,(function(r){i.filters=r||[],S.Image.prototype._initFilters.call(i,[i.resizeFilter],(function(r){i.resizeFilter=r[0],S.util.enlivenObjectEnlivables(i,i,(function(){var r=new S.Image(t,i);e(r,!1)}))}))}))}),null,i.crossOrigin)},S.Image.fromURL=function(t,e,i){S.util.loadImage(t,(function(t,r){e&&e(new S.Image(t,i),r)}),null,i&&i.crossOrigin)},S.Image.ATTRIBUTE_NAMES=S.SHARED_ATTRIBUTES.concat(\"x y width height preserveAspectRatio xlink:href crossOrigin image-rendering\".split(\" \")),S.Image.fromElement=function(t,i,r){var n=S.parseAttributes(t,S.Image.ATTRIBUTE_NAMES);S.Image.fromURL(n[\"xlink:href\"],i,e(r?S.util.object.clone(r):{},n))})}(e),S.util.object.extend(S.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(t){var e=function(){},i=(t=t||{}).onComplete||e,r=t.onChange||e,n=this;return S.util.animate({target:this,startValue:this.get(\"angle\"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){n.rotate(t),r()},onComplete:function(){n.setCoords(),i()}})}}),S.util.object.extend(S.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function t(t,e){var i=\"precision \"+e+\" float;\\nvoid main(){}\",r=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(r,i),t.compileShader(r),!!t.getShaderParameter(r,t.COMPILE_STATUS)}function e(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}S.isWebglSupported=function(e){if(S.isLikelyNode)return!1;e=e||S.WebglFilterBackend.prototype.tileSize;var i=document.createElement(\"canvas\"),r=i.getContext(\"webgl\")||i.getContext(\"experimental-webgl\"),n=!1;if(r){S.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),n=S.maxTextureSize>=e;for(var s=[\"highp\",\"mediump\",\"lowp\"],o=0;o<3;o++)if(t(r,s[o])){S.webGlPrecision=s[o];break}}return this.isSupported=n,n},S.WebglFilterBackend=e,e.prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var i,r=void 0!==window.performance;try{new ImageData(1,1),i=!0}catch(t){i=!1}var n=\"undefined\"!=typeof ArrayBuffer,s=\"undefined\"!=typeof Uint8ClampedArray;if(r&&i&&n&&s){var o=S.util.createCanvasElement(),a=new ArrayBuffer(t*e*4);if(S.forceGLPutImageData)return this.imageBuffer=a,void(this.copyGLTo2D=x);var h,l,c={imageBuffer:a,destinationWidth:t,destinationHeight:e,targetCanvas:o};o.width=t,o.height=e,h=window.performance.now(),I.call(c,this.gl,c),l=window.performance.now()-h,h=window.performance.now(),x.call(c,this.gl,c),l>window.performance.now()-h?(this.imageBuffer=a,this.copyGLTo2D=x):this.copyGLTo2D=I}},createWebGLCanvas:function(t,e){var i=S.util.createCanvasElement();i.width=t,i.height=e;var r={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},n=i.getContext(\"webgl\",r);n||(n=i.getContext(\"experimental-webgl\",r)),n&&(n.clearColor(0,0,0,0),this.canvas=i,this.gl=n)},applyFilters:function(t,e,i,r,n,s){var o,a=this.gl;s&&(o=this.getCachedTexture(s,e));var h={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:i,sourceHeight:r,destinationWidth:i,destinationHeight:r,context:a,sourceTexture:this.createTexture(a,i,r,!o&&e),targetTexture:this.createTexture(a,i,r),originalTexture:o||this.createTexture(a,i,r,!o&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:n},l=a.createFramebuffer();return a.bindFramebuffer(a.FRAMEBUFFER,l),t.forEach((function(t){t&&t.applyTo(h)})),function(t){var e=t.targetCanvas,i=e.width,r=e.height,n=t.destinationWidth,s=t.destinationHeight;i===n&&r===s||(e.width=n,e.height=s)}(h),this.copyGLTo2D(a,h),a.bindTexture(a.TEXTURE_2D,null),a.deleteTexture(h.sourceTexture),a.deleteTexture(h.targetTexture),a.deleteFramebuffer(l),n.getContext(\"2d\").setTransform(1,0,0,1,0,0),h},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,i,r){var n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),n},getCachedTexture:function(t,e){if(this.textureCache[t])return this.textureCache[t];var i=this.createTexture(this.gl,e.width,e.height,e);return this.textureCache[t]=i,i},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:I,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:\"\",vendor:\"\"};if(!t)return e;var i=t.getExtension(\"WEBGL_debug_renderer_info\");if(i){var r=t.getParameter(i.UNMASKED_RENDERER_WEBGL),n=t.getParameter(i.UNMASKED_VENDOR_WEBGL);r&&(e.renderer=r.toLowerCase()),n&&(e.vendor=n.toLowerCase())}return this.gpuInfo=e,e}}}(),function(){var t=function(){};function e(){}S.Canvas2dFilterBackend=e,e.prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,i,r,n){var s=n.getContext(\"2d\");s.drawImage(e,0,0,i,r);var o={sourceWidth:i,sourceHeight:r,imageData:s.getImageData(0,0,i,r),originalEl:e,originalImageData:s.getImageData(0,0,i,r),canvasEl:n,ctx:s,filterBackend:this};return t.forEach((function(t){t.applyTo(o)})),o.imageData.width===i&&o.imageData.height===r||(n.width=o.imageData.width,n.height=o.imageData.height),s.putImageData(o.imageData,0,0),o}}}(),S.Image=S.Image||{},S.Image.filters=S.Image.filters||{},S.Image.filters.BaseFilter=S.util.createClass({type:\"BaseFilter\",vertexSource:\"attribute vec2 aPosition;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvTexCoord = aPosition;\\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\\n}\",fragmentSource:\"precision highp float;\\nvarying vec2 vTexCoord;\\nuniform sampler2D uTexture;\\nvoid main() {\\ngl_FragColor = texture2D(uTexture, vTexCoord);\\n}\",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,i){e=e||this.fragmentSource,i=i||this.vertexSource,\"highp\"!==S.webGlPrecision&&(e=e.replace(/precision highp float/g,\"precision \"+S.webGlPrecision+\" float\"));var r=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error(\"Vertex shader compile error for \"+this.type+\": \"+t.getShaderInfoLog(r));var n=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error(\"Fragment shader compile error for \"+this.type+\": \"+t.getShaderInfoLog(n));var s=t.createProgram();if(t.attachShader(s,r),t.attachShader(s,n),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error('Shader link error for \"${this.type}\" '+t.getProgramInfoLog(s));var o=this.getAttributeLocations(t,s),a=this.getUniformLocations(t,s)||{};return a.uStepW=t.getUniformLocation(s,\"uStepW\"),a.uStepH=t.getUniformLocation(s,\"uStepH\"),{program:s,attributeLocations:o,uniformLocations:a}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,\"aPosition\")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,i){var r=e.aPosition,n=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,n),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,i,r=t.context;t.passes>1?(e=t.destinationWidth,i=t.destinationHeight,t.sourceWidth===e&&t.sourceHeight===i||(r.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(r,e,i)),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.targetTexture,0)):(r.bindFramebuffer(r.FRAMEBUFFER,null),r.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=S.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var i=e[t].length;i--;)if(this[t][i]!==e[t][i])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,i=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(i.program),this.sendAttributeData(e,i.attributeLocations,t.aPosition),e.uniform1f(i.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(i.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,i.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,i){t.activeTexture(i),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){if(!t.helpLayer){var e=document.createElement(\"canvas\");e.width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e}},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),S.Image.filters.BaseFilter.fromObject=function(t,e){var i=new S.Image.filters[t.type](t);return e&&e(i),i},function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.ColorMatrix=r(i.BaseFilter,{type:\"ColorMatrix\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nvarying vec2 vTexCoord;\\nuniform mat4 uColorMatrix;\\nuniform vec4 uConstants;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\ncolor *= uColorMatrix;\\ncolor += uConstants;\\ngl_FragColor = color;\\n}\",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:\"matrix\",colorsOnly:!0,initialize:function(t){this.callSuper(\"initialize\",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){var e,i,r,n,s,o=t.imageData.data,a=o.length,h=this.matrix,l=this.colorsOnly;for(s=0;s<a;s+=4)e=o[s],i=o[s+1],r=o[s+2],l?(o[s]=e*h[0]+i*h[1]+r*h[2]+255*h[4],o[s+1]=e*h[5]+i*h[6]+r*h[7]+255*h[9],o[s+2]=e*h[10]+i*h[11]+r*h[12]+255*h[14]):(n=o[s+3],o[s]=e*h[0]+i*h[1]+r*h[2]+n*h[3]+255*h[4],o[s+1]=e*h[5]+i*h[6]+r*h[7]+n*h[8]+255*h[9],o[s+2]=e*h[10]+i*h[11]+r*h[12]+n*h[13]+255*h[14],o[s+3]=e*h[15]+i*h[16]+r*h[17]+n*h[18]+255*h[19])},getUniformLocations:function(t,e){return{uColorMatrix:t.getUniformLocation(e,\"uColorMatrix\"),uConstants:t.getUniformLocation(e,\"uConstants\")}},sendUniformData:function(t,e){var i=this.matrix,r=[i[0],i[1],i[2],i[3],i[5],i[6],i[7],i[8],i[10],i[11],i[12],i[13],i[15],i[16],i[17],i[18]],n=[i[4],i[9],i[14],i[19]];t.uniformMatrix4fv(e.uColorMatrix,!1,r),t.uniform4fv(e.uConstants,n)}}),e.Image.filters.ColorMatrix.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Brightness=r(i.BaseFilter,{type:\"Brightness\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uBrightness;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\ncolor.rgb += uBrightness;\\ngl_FragColor = color;\\n}\",brightness:0,mainParameter:\"brightness\",applyTo2d:function(t){if(0!==this.brightness){var e,i=t.imageData.data,r=i.length,n=Math.round(255*this.brightness);for(e=0;e<r;e+=4)i[e]=i[e]+n,i[e+1]=i[e+1]+n,i[e+2]=i[e+2]+n}},getUniformLocations:function(t,e){return{uBrightness:t.getUniformLocation(e,\"uBrightness\")}},sendUniformData:function(t,e){t.uniform1f(e.uBrightness,this.brightness)}}),e.Image.filters.Brightness.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}
2),i=e.util.object.extend,r=e.Image.filters,n=e.util.createClass;r.Convolute=n(r.BaseFilter,{type:\"Convolute\",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[9];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 0);\\nfor (float h = 0.0; h < 3.0; h+=1.0) {\\nfor (float w = 0.0; w < 3.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\\n}\\n}\\ngl_FragColor = color;\\n}\",Convolute_3_0:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[9];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 1);\\nfor (float h = 0.0; h < 3.0; h+=1.0) {\\nfor (float w = 0.0; w < 3.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\\n}\\n}\\nfloat alpha = texture2D(uTexture, vTexCoord).a;\\ngl_FragColor = color;\\ngl_FragColor.a = alpha;\\n}\",Convolute_5_1:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[25];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 0);\\nfor (float h = 0.0; h < 5.0; h+=1.0) {\\nfor (float w = 0.0; w < 5.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\\n}\\n}\\ngl_FragColor = color;\\n}\",Convolute_5_0:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[25];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 1);\\nfor (float h = 0.0; h < 5.0; h+=1.0) {\\nfor (float w = 0.0; w < 5.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\\n}\\n}\\nfloat alpha = texture2D(uTexture, vTexCoord).a;\\ngl_FragColor = color;\\ngl_FragColor.a = alpha;\\n}\",Convolute_7_1:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[49];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 0);\\nfor (float h = 0.0; h < 7.0; h+=1.0) {\\nfor (float w = 0.0; w < 7.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\\n}\\n}\\ngl_FragColor = color;\\n}\",Convolute_7_0:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[49];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 1);\\nfor (float h = 0.0; h < 7.0; h+=1.0) {\\nfor (float w = 0.0; w < 7.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\\n}\\n}\\nfloat alpha = texture2D(uTexture, vTexCoord).a;\\ngl_FragColor = color;\\ngl_FragColor.a = alpha;\\n}\",Convolute_9_1:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[81];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 0);\\nfor (float h = 0.0; h < 9.0; h+=1.0) {\\nfor (float w = 0.0; w < 9.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\\n}\\n}\\ngl_FragColor = color;\\n}\",Convolute_9_0:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uMatrix[81];\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = vec4(0, 0, 0, 1);\\nfor (float h = 0.0; h < 9.0; h+=1.0) {\\nfor (float w = 0.0; w < 9.0; w+=1.0) {\\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\\n}\\n}\\nfloat alpha = texture2D(uTexture, vTexCoord).a;\\ngl_FragColor = color;\\ngl_FragColor.a = alpha;\\n}\"},retrieveShader:function(t){var e=Math.sqrt(this.matrix.length),i=this.type+\"_\"+e+\"_\"+(this.opaque?1:0),r=this.fragmentSource[i];return t.programCache.hasOwnProperty(i)||(t.programCache[i]=this.createProgram(t.context,r)),t.programCache[i]},applyTo2d:function(t){var e,i,r,n,s,o,a,h,l,c,u,d,f,g=t.imageData,m=g.data,p=this.matrix,_=Math.round(Math.sqrt(p.length)),v=Math.floor(_/2),y=g.width,w=g.height,C=t.ctx.createImageData(y,w),E=C.data,T=this.opaque?1:0;for(u=0;
vendor: 6,123 bytes, line 2
2u<w;u++)for(c=0;c<y;c++){for(s=4*(u*y+c),e=0,i=0,r=0,n=0,f=0;f<_;f++)for(d=0;d<_;d++)o=c+d-v,(a=u+f-v)<0||a>=w||o<0||o>=y||(h=4*(a*y+o),l=p[f*_+d],e+=m[h]*l,i+=m[h+1]*l,r+=m[h+2]*l,T||(n+=m[h+3]*l));E[s]=e,E[s+1]=i,E[s+2]=r,E[s+3]=T?m[s+3]:n}t.imageData=C},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,\"uMatrix\"),uOpaque:t.getUniformLocation(e,\"uOpaque\"),uHalfSize:t.getUniformLocation(e,\"uHalfSize\"),uSize:t.getUniformLocation(e,\"uSize\")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return i(this.callSuper(\"toObject\"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Grayscale=r(i.BaseFilter,{type:\"Grayscale\",fragmentSource:{average:\"precision highp float;\\nuniform sampler2D uTexture;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nfloat average = (color.r + color.b + color.g) / 3.0;\\ngl_FragColor = vec4(average, average, average, color.a);\\n}\",lightness:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform int uMode;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 col = texture2D(uTexture, vTexCoord);\\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\\ngl_FragColor = vec4(average, average, average, col.a);\\n}\",luminosity:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform int uMode;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 col = texture2D(uTexture, vTexCoord);\\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\\ngl_FragColor = vec4(average, average, average, col.a);\\n}\"},mode:\"average\",mainParameter:\"mode\",applyTo2d:function(t){var e,i,r=t.imageData.data,n=r.length,s=this.mode;for(e=0;e<n;e+=4)\"average\"===s?i=(r[e]+r[e+1]+r[e+2])/3:\"lightness\"===s?i=(Math.min(r[e],r[e+1],r[e+2])+Math.max(r[e],r[e+1],r[e+2]))/2:\"luminosity\"===s&&(i=.21*r[e]+.72*r[e+1]+.07*r[e+2]),r[e]=i,r[e+1]=i,r[e+2]=i},retrieveShader:function(t){var e=this.type+\"_\"+this.mode;if(!t.programCache.hasOwnProperty(e)){var i=this.fragmentSource[this.mode];t.programCache[e]=this.createProgram(t.context,i)}return t.programCache[e]},getUniformLocations:function(t,e){return{uMode:t.getUniformLocation(e,\"uMode\")}},sendUniformData:function(t,e){t.uniform1i(e.uMode,1)},isNeutralState:function(){return!1}}),e.Image.filters.Grayscale.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Invert=r(i.BaseFilter,{type:\"Invert\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform int uInvert;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nif (uInvert == 1) {\\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\\n} else {\\ngl_FragColor = color;\\n}\\n}\",invert:!0,mainParameter:\"invert\",applyTo2d:function(t){var e,i=t.imageData.data,r=i.length;for(e=0;e<r;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(t,e){return{uInvert:t.getUniformLocation(e,\"uInvert\")}},sendUniformData:function(t,e){t.uniform1i(e.uInvert,this.invert)}}),e.Image.filters.Invert.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.Image.filters,n=e.util.createClass;r.Noise=n(r.BaseFilter,{type:\"Noise\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uStepH;\\nuniform float uNoise;\\nuniform float uSeed;\\nvarying vec2 vTexCoord;\\nfloat rand(vec2 co, float seed, float vScale) {\\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\\n}\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\\ngl_FragColor = color;\\n}\",mainParameter:\"noise\",noise:0,applyTo2d:function(t){if(0!==this.noise){var e,i,r=t.imageData.data,n=r.length,s=this.noise;for(e=0,n=r.length;e<n;e+=4)i=(.5-Math.random())*s,r[e]+=i,r[e+1]+=i,r[e+2]+=i}},getUniformLocations:function(t,e){return{uNoise:t.getUniformLocation(e,\"uNoise\"),uSeed:t.getUniformLocation(e,\"uSeed\")}},sendUniformData:function(t,e){t.uniform1f(e.uNoise,this.noise/255),t.uniform1f(e.uSeed,Math.random())},toObject:function(){return i(this.callSuper(\"toObject\"),{noise:this.noise})}}),e.Image.filters.Noise.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Pixelate=r(i.BaseFilter,{type:\"Pixelate\",blocksize:4,mainParameter:\"blocksize\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uBlocksize;\\nuniform float uStepW;\\nuniform float uStepH;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nfloat blockW = uBlocksize * uStepW;\\nfloat blockH = uBlocksize * uStepW;\\nint posX = int(vTexCoord.x / blockW);\\nint posY = int(vTexCoord.y / blockH);\\nfloat fposX = float(posX);\\nfloat fposY = float(posY);\\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\\nvec4 color = texture2D(uTexture, squareCoords);\\ngl_FragColor = color;\\n}\",applyTo2d:function(t){var e,i,r,n,s,o,a,h,l,c,u,d=t.imageData,f=d.data,g=d.height,m=d.width;for(i=0;i<g;i+=this.blocksize)for(r=0;r<m;r+=this.blocksize)for(n=f[e=4*i*m+4*r],s=f[e+1],o=f[e+2],a=f[e+3],c=Math.min(i+this.blocksize,g),u=Math.min(r+this.blocksize,m),h=i;h<c;h++)for(l=r;l<u;l++)f[e=4*h*m+4*l]=n,f[e+1]=s,f[e+2]=o,f[e+3]=a},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(t,e){return{uBlocksize:t.getUniformLocation(e,\"uBlocksize\"),uStepW:t.getUniformLocation(e,\"uStepW\"),uStepH:t.getUniformLocation(e,\"uStepH\")}},sendUniformData:function(t,e){t.uniform1f(e.uBlocksize,this.blocksize)}}),e.Image.filters.Pixelate.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}
2),i=e.util.object.extend,r=e.Image.filters,n=e.util.createClass;r.RemoveColor=n(r.BaseFilter,{type:\"RemoveColor\",color:\"#FFFFFF\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform vec4 uLow;\\nuniform vec4 uHigh;\\nvarying vec2 vTexCoord;\\nvoid main() {\\ngl_FragColor = texture2D(uTexture, vTexCoord);\\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\\ngl_FragColor.a = 0.0;\\n}\\n}\",distance:.02,useAlpha:!1,applyTo2d:function(t){var i,r,n,s,o=t.imageData.data,a=255*this.distance,h=new e.Color(this.color).getSource(),l=[h[0]-a,h[1]-a,h[2]-a],c=[h[0]+a,h[1]+a,h[2]+a];for(i=0;i<o.length;i+=4)r=o[i],n=o[i+1],s=o[i+2],r>l[0]&&n>l[1]&&s>l[2]&&r<c[0]&&n<c[1]&&s<c[2]&&(o[i+3]=0)},getUniformLocations:function(t,e){return{uLow:t.getUniformLocation(e,\"uLow\"),uHigh:t.getUniformLocation(e,\"uHigh\")}},sendUniformData:function(t,i){var r=new e.Color(this.color).getSource(),n=parseFloat(this.distance),s=[0+r[0]/255-n,0+r[1]/255-n,0+r[2]/255-n,1],o=[r[0]/255+n,r[1]/255+n,r[2]/255+n,1];t.uniform4fv(i.uLow,s),t.uniform4fv(i.uHigh,o)},toObject:function(){return i(this.callSuper(\"toObject\"),{color:this.color,distance:this.distance})}}),e.Image.filters.RemoveColor.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass,n={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var s in n)i[s]=r(i.ColorMatrix,{type:s,matrix:n[s],mainParameter:!1,colorsOnly:!0}),e.Image.filters[s].fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric,i=e.Image.filters,r=e.util.createClass;i.BlendColor=r(i.BaseFilter,{type:\"BlendColor\",color:\"#F95C63\",mode:\"multiply\",alpha:1,fragmentSource:{multiply:\"gl_FragColor.rgb *= uColor.rgb;\\n\",screen:\"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\\n\",add:\"gl_FragColor.rgb += uColor.rgb;\\n\",diff:\"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\\n\",subtract:\"gl_FragColor.rgb -= uColor.rgb;\\n\",lighten:\"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\\n\",darken:\"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\\n\",exclusion:\"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\\n\",overlay:\"if (uColor.r < 0.5) {\\ngl_FragColor.r *= 2.0 * uColor.r;\\n} else {\\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\\n}\\nif (uColor.g < 0.5) {\\ngl_FragColor.g *= 2.0 * uColor.g;\\n} else {\\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\\n}\\nif (uColor.b < 0.5) {\\ngl_FragColor.b *= 2.0 * uColor.b;\\n} else {\\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\\n}\\n\",tint:\"gl_FragColor.rgb *= (1.0 - uColor.a);\\ngl_FragColor.rgb += uColor.rgb;\\n\"},buildSource:function(t){return\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform vec4 uColor;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\ngl_FragColor = color;\\nif (color.a > 0.0) {\\n\"+this.fragmentSource[t]+\"}\\n}\"},retrieveShader:function(t){var e,i=this.type+\"_\"+this.mode;return t.programCache.hasOwnProperty(i)||(e=this.buildSource(this.mode),t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},applyTo2d:function(t){var i,r,n,s,o,a,h,l=t.imageData.data,c=l.length,u=1-this.alpha;i=(h=new e.Color(this.color).getSource())[0]*this.alpha,r=h[1]*this.alpha,n=h[2]*this.alpha;for(var d=0;d<c;d+=4)switch(s=l[d],o=l[d+1],a=l[d+2],this.mode){case\"multiply\":l[d]=s*i/255,l[d+1]=o*r/255,l[d+2]=a*n/255;break;case\"screen\":l[d]=255-(255-s)*(255-i)/255,l[d+1]=255-(255-o)*(255-r)/255,l[d+2]=255-(255-a)*(255-n)/255;break;case\"add\":l[d]=s+i,l[d+1]=o+r,l[d+2]=a+n;break;case\"diff\":case\"difference\":l[d]=Math.abs(s-i),l[d+1]=Math.abs(o-r),l[d+2]=Math.abs(a-n);break;case\"subtract\":l[d]=s-i,l[d+1]=o-r,l[d+2]=a-n;break;case\"darken\":l[d]=Math.min(s,i),l[d+1]=Math.min(o,r),l[d+2]=Math.min(a,n);break;case\"lighten\":l[d]=Math.max(s,i),l[d+1]=Math.max(o,r),l[d+2]=Math.max(a,n);break;case\"overlay\":l[d]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255,l[d+1]=r<128?2*o*r/255:255-2*(255-o)*(255-r)/255,l[d+2]=n<128?2*a*n/255:255-2*(255-a)*(255-n)/255;break;case\"exclusion\":l[d]=i+s-2*i*s/255,l[d+1]=r+o-2*r*o/255,l[d+2]=n+a-2*n*a/255;break;case\"tint\":l[d]=i+s*u,l[d+1]=r+o*u,l[d+2]=n+a*u}},getUniformLocations:function(t,e){return{uColor:t.getUniformLocation(e,\"uColor\")}},sendUniformData:function(t,i){var r=new e.Color(this.color).getSource();r[0]=this.alpha*r[0]/255,r[1]=this.alpha*r[1]/255,r[2]=this.alpha*r[2]/255,r[3]=this.alpha,t.uniform4fv(i.uColor,r)}
2,toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendColor.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric,i=e.Image.filters,r=e.util.createClass;i.BlendImage=r(i.BaseFilter,{type:\"BlendImage\",image:null,mode:\"multiply\",alpha:1,vertexSource:\"attribute vec2 aPosition;\\nvarying vec2 vTexCoord;\\nvarying vec2 vTexCoord2;\\nuniform mat3 uTransformMatrix;\\nvoid main() {\\nvTexCoord = aPosition;\\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\\n}\",fragmentSource:{multiply:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform sampler2D uImage;\\nuniform vec4 uColor;\\nvarying vec2 vTexCoord;\\nvarying vec2 vTexCoord2;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nvec4 color2 = texture2D(uImage, vTexCoord2);\\ncolor.rgba *= color2.rgba;\\ngl_FragColor = color;\\n}\",mask:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform sampler2D uImage;\\nuniform vec4 uColor;\\nvarying vec2 vTexCoord;\\nvarying vec2 vTexCoord2;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nvec4 color2 = texture2D(uImage, vTexCoord2);\\ncolor.a = color2.a;\\ngl_FragColor = color;\\n}\"},retrieveShader:function(t){var e=this.type+\"_\"+this.mode,i=this.fragmentSource[this.mode];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,i)),t.programCache[e]},applyToWebGL:function(t){var e=t.context,i=this.createTexture(t.filterBackend,this.image);this.bindAdditionalTexture(e,i,e.TEXTURE1),this.callSuper(\"applyToWebGL\",t),this.unbindAdditionalTexture(e,e.TEXTURE1)}
2,createTexture:function(t,e){return t.getCachedTexture(e.cacheKey,e._element)},calculateMatrix:function(){var t=this.image,e=t._element.width,i=t._element.height;return[1/t.scaleX,0,0,0,1/t.scaleY,0,-t.left/e,-t.top/i,1]},applyTo2d:function(t){var i,r,n,s,o,a,h,l,c,u,d,f=t.imageData,g=t.filterBackend.resources,m=f.data,p=m.length,_=f.width,v=f.height,y=this.image;g.blendImage||(g.blendImage=e.util.createCanvasElement()),u=(c=g.blendImage).getContext(\"2d\"),c.width!==_||c.height!==v?(c.width=_,c.height=v):u.clearRect(0,0,_,v),u.setTransform(y.scaleX,0,0,y.scaleY,y.left,y.top),u.drawImage(y._element,0,0,_,v),d=u.getImageData(0,0,_,v).data;for(var w=0;w<p;w+=4)switch(o=m[w],a=m[w+1],h=m[w+2],l=m[w+3],i=d[w],r=d[w+1],n=d[w+2],s=d[w+3],this.mode){case\"multiply\":m[w]=o*i/255,m[w+1]=a*r/255,m[w+2]=h*n/255,m[w+3]=l*s/255;break;case\"mask\":m[w+3]=s}},getUniformLocations:function(t,e){return{uTransformMatrix:t.getUniformLocation(e,\"uTransformMatrix\"),uImage:t.getUniformLocation(e,\"uImage\")}},sendUniformData:function(t,e){var i=this.calculateMatrix();t.uniform1i(e.uImage,1),t.uniformMatrix3fv(e.uTransformMatrix,!1,i)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendImage.fromObject=function(t,i){e.Image.fromObject(t.image,(function(r){var n=e.util.object.clone(t);n.image=r,i(new e.Image.filters.BlendImage(n))}))}}(e),function(t){var e=t.fabric||(t.fabric={}),i=Math.pow,r=Math.floor,n=Math.sqrt,s=Math.abs,o=Math.round,a=Math.sin,h=Math.ceil,l=e.Image.filters,c=e.util.createClass;l.Resize=c(l.BaseFilter,{type:\"Resize\",resizeType:\"hermite\",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(t,e){return{uDelta:t.getUniformLocation(e,\"uDelta\"),uTaps:t.getUniformLocation(e,\"uTaps\")}},sendUniformData:function(t,e){t.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),t.uniform1fv(e.uTaps,this.taps)},retrieveShader:function(t){var e=this.getFilterWindow(),i=this.type+\"_\"+e;if(!t.programCache.hasOwnProperty(i)){var r=this.generateShader(e);t.programCache[i]=this.createProgram(t.context,r)}return t.programCache[i]},getFilterWindow:function(){var t=this.tempScale;return Math.ceil(this.lanczosLobes/t)},getTaps:function(){for(var t=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,i=this.getFilterWindow(),r=new Array(i),n=1;n<=i;n++)r[n-1]=t(n*e);return r},generateShader:function(t){for(var e=new Array(t),i=this.fragmentSourceTOP,r=1;r<=t;r++)e[r-1]=r+\".0 * uDelta\";return i+=\"uniform float uTaps[\"+t+\"];\\n\",i+=\"void main() {\\n\",i+=\"  vec4 color = texture2D(uTexture, vTexCoord);\\n\",i+=\"  float sum = 1.0;\\n\",e.forEach((function(t,e){i+=\"  color += texture2D(uTexture, vTexCoord + \"+t+\") * uTaps[\"+e+\"];\\n\",i+=\"  color += texture2D(uTexture, vTexCoord - \"+t+\") * uTaps[\"+e+\"];\\n\",i+=\"  sum += 2.0 * uTaps[\"+e+\"];\\n\"})),i+=\"  gl_FragColor = color / sum;\\n\",i+=\"}\"},fragmentSourceTOP:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform vec2 uDelta;\\nvarying vec2 vTexCoord;\\n\",applyTo:function(t){t.webgl?(t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceHeight=t.destinationHeight):this.applyTo2d(t)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(t){return function(e){if(e>=t||e<=-t)return 0;if(e<1.1920929e-7&&e>-1.1920929e-7)return 1;var i=(e*=Math.PI)/t;return a(e)/e*a(i)/i}},applyTo2d:function(t){var e=t.imageData,i=this.scaleX,r=this.scaleY;this.rcpScaleX=1/i,this.rcpScaleY=1/r;var n,s=e.width,a=e.height,h=o(s*i),l=o(a*r);
2\"sliceHack\"===this.resizeType?n=this.sliceByTwo(t,s,a,h,l):\"hermite\"===this.resizeType?n=this.hermiteFastResize(t,s,a,h,l):\"bilinear\"===this.resizeType?n=this.bilinearFiltering(t,s,a,h,l):\"lanczos\"===this.resizeType&&(n=this.lanczosResize(t,s,a,h,l)),t.imageData=n},sliceByTwo:function(t,i,n,s,o){var a,h,l=t.imageData,c=.5,u=!1,d=!1,f=i*c,g=n*c,m=e.filterBackend.resources,p=0,_=0,v=i,y=0;for(m.sliceByTwo||(m.sliceByTwo=document.createElement(\"canvas\")),((a=m.sliceByTwo).width<1.5*i||a.height<n)&&(a.width=1.5*i,a.height=n),(h=a.getContext(\"2d\")).clearRect(0,0,1.5*i,n),h.putImageData(l,0,0),s=r(s),o=r(o);!u||!d;)i=f,n=g,s<r(f*c)?f=r(f*c):(f=s,u=!0),o<r(g*c)?g=r(g*c):(g=o,d=!0),h.drawImage(a,p,_,i,n,v,y,f,g),p=v,_=y,y+=g;return h.getImageData(p,_,s,o)},lanczosResize:function(t,e,o,a,l){var c=t.imageData.data,u=t.ctx.createImageData(a,l),d=u.data,f=this.lanczosCreate(this.lanczosLobes),g=this.rcpScaleX,m=this.rcpScaleY,p=2/this.rcpScaleX,_=2/this.rcpScaleY,v=h(g*this.lanczosLobes/2),y=h(m*this.lanczosLobes/2),w={},C={},E={};return function t(h){var T,S,b,I,x,O,A,R,D,L,M;for(C.x=(h+.5)*g,E.x=r(C.x),T=0;T<l;T++){for(C.y=(T+.5)*m,E.y=r(C.y),x=0,O=0,A=0,R=0,D=0,S=E.x-v;S<=E.x+v;S++)if(!(S<0||S>=e)){L=r(1e3*s(S-C.x)),w[L]||(w[L]={});for(var F=E.y-y;F<=E.y+y;F++)F<0||F>=o||(M=r(1e3*s(F-C.y)),w[L][M]||(w[L][M]=f(n(i(L*p,2)+i(M*_,2))/1e3)),(b=w[L][M])>0&&(x+=b,O+=b*c[I=4*(F*e+S)],A+=b*c[I+1],R+=b*c[I+2],D+=b*c[I+3]))}d[I=4*(T*a+h)]=O/x,d[I+1]=A/x,d[I+2]=R/x,d[I+3]=D/x}return++h<a?t(h):u}(0)},bilinearFiltering:function(t,e,i,n,s){var o,a,h,l,c,u,d,f,g,m=0,p=this.rcpScaleX,_=this.rcpScaleY,v=4*(e-1),y=t.imageData.data,w=t.ctx.createImageData(n,s),C=w.data;for(h=0;h<s;h++)for(l=0;l<n;l++)for(c=p*l-(o=r(p*l)),u=_*h-(a=r(_*h)),g=4*(a*e+o),d=0;d<4;d++)f=y[g+d]*(1-c)*(1-u)+y[g+4+d]*c*(1-u)+y[g+v+d]*u*(1-c)+y[g+v+4+d]*c*u,C[m++]=f;return w},hermiteFastResize:function(t,e,i,o,a){for(var l=this.rcpScaleX,c=this.rcpScaleY,u=h(l/2),d=h(c/2),f=t.imageData.data,g=t.ctx.createImageData(o,a),m=g.data,p=0;p<a;p++)for(var _=0;_<o;_++){for(var v=4*(_+p*o),y=0,w=0,C=0,E=0,T=0,S=0,b=0,I=(p+.5)*c,x=r(p*c);x<(p+1)*c;x++)for(var O=s(I-(x+.5))/d,A=(_+.5)*l,R=O*O,D=r(_*l);D<(_+1)*l;D++){var L=s(A-(D+.5))/u,M=n(R+L*L);M>1&&M<-1||(y=2*M*M*M-3*M*M+1)>0&&(b+=y*f[3+(L=4*(D+x*e))],C+=y,f[L+3]<255&&(y=y*f[L+3]/250),E+=y*f[L],T+=y*f[L+1],S+=y*f[L+2],w+=y)}m[v]=E/w,m[v+1]=T/w,m[v+2]=S/w,m[v+3]=b/C}return g},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),e.Image.filters.Resize.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Contrast=r(i.BaseFilter,{type:\"Contrast\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uContrast;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\\ngl_FragColor = color;\\n}\",contrast:0,mainParameter:\"contrast\",applyTo2d:function(t){if(0!==this.contrast){var e,i=t.imageData.data,r=i.length,n=Math.floor(255*this.contrast),s=259*(n+255)/(255*(259-n));for(e=0;e<r;e+=4)i[e]=s*(i[e]-128)+128,i[e+1]=s*(i[e+1]-128)+128,i[e+2]=s*(i[e+2]-128)+128}},getUniformLocations:function(t,e){return{uContrast:t.getUniformLocation(e,\"uContrast\")}},sendUniformData:function(t,e){t.uniform1f(e.uContrast,this.contrast)}}),e.Image.filters.Contrast.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Saturation=r(i.BaseFilter,{type:\"Saturation\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uSaturation;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nfloat rgMax = max(color.r, color.g);\\nfloat rgbMax = max(rgMax, color.b);\\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\\ngl_FragColor = color;\\n}\",saturation:0,mainParameter:\"saturation\",applyTo2d:function(t){if(0!==this.saturation){var e,i,r=t.imageData.data,n=r.length,s=-this.saturation;for(e=0;e<n;e+=4)i=Math.max(r[e],r[e+1],r[e+2]),r[e]+=i!==r[e]?(i-r[e])*s:0,r[e+1]+=i!==r[e+1]?(i-r[e+1])*s:0,r[e+2]+=i!==r[e+2]?(i-r[e+2])*s:0}},getUniformLocations:function(t,e){return{uSaturation:t.getUniformLocation(e,\"uSaturation\")}},sendUniformData:function(t,e){t.uniform1f(e.uSaturation,-this.saturation)}}),e.Image.filters.Saturation.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Vibrance=r(i.BaseFilter,{type:\"Vibrance\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform float uVibrance;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nfloat max = max(color.r, max(color.g, color.b));\\nfloat avg = (color.r + color.g + color.b) / 3.0;\\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\\ngl_FragColor = color;\\n}\",vibrance:0,mainParameter:\"vibrance\",applyTo2d:function(t){if(0!==this.vibrance){var e,i,r,n,s=t.imageData.data,o=s.length,a=-this.vibrance;for(e=0;e<o;e+=4)i=Math.max(s[e],s[e+1],s[e+2]),r=(s[e]+s[e+1]+s[e+2])/3,n=2*Math.abs(i-r)/255*a,s[e]+=i!==s[e]?(i-s[e])*n:0,s[e+1]+=i!==s[e+1]?(i-s[e+1])*n:0,s[e+2]+=i!==s[e+2]?(i-s[e+2])*n:0}},getUniformLocations:function(t,e){return{uVibrance:t.getUniformLocation(e,\"uVibrance\")}},sendUniformData:function(t,e){t.uniform1f(e.uVibrance,-this.vibrance)}}),e.Image.filters.Vibrance.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Blur=r(i.BaseFilter,{type:\"Blur\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform vec2 uDelta;\\nvarying vec2 vTexCoord;\\nconst float nSamples = 15.0;\\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\\nfloat random(vec3 scale) {\\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\\n}\\nvoid main() {\\nvec4 color = vec4(0.0);\\nfloat total = 0.0;\\nfloat offset = random(v3offset);\\nfor (float t = -nSamples; t <= nSamples; t++) {\\nfloat percent = (t + offset - 0.5) / nSamples;\\nfloat weight = 1.0 - abs(percent);\\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\\ntotal += weight;\\n}\\ngl_FragColor = color / total;\\n}\",blur:0,mainParameter:\"blur\",applyTo:function(t){t.webgl?(this.aspectRatio=t.sourceW
vendor: 8,233 bytes, line 2
2idth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},applyTo2d:function(t){t.imageData=this.simpleBlur(t)},simpleBlur:function(t){var i,r,n=t.filterBackend.resources,s=t.imageData.width,o=t.imageData.height;n.blurLayer1||(n.blurLayer1=e.util.createCanvasElement(),n.blurLayer2=e.util.createCanvasElement()),i=n.blurLayer1,r=n.blurLayer2,i.width===s&&i.height===o||(r.width=i.width=s,r.height=i.height=o);var a,h,l,c,u=i.getContext(\"2d\"),d=r.getContext(\"2d\"),f=.06*this.blur*.5;for(u.putImageData(t.imageData,0,0),d.clearRect(0,0,s,o),c=-15;c<=15;c++)l=f*(h=c/15)*s+(a=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(h),d.drawImage(i,l,a),u.drawImage(r,0,0),d.globalAlpha=1,d.clearRect(0,0,r.width,r.height);for(c=-15;c<=15;c++)l=f*(h=c/15)*o+(a=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(h),d.drawImage(i,a,l),u.drawImage(r,0,0),d.globalAlpha=1,d.clearRect(0,0,r.width,r.height);t.ctx.drawImage(i,0,0);var g=t.ctx.getImageData(0,0,i.width,i.height);return u.globalAlpha=1,u.clearRect(0,0,i.width,i.height),g},getUniformLocations:function(t,e){return{delta:t.getUniformLocation(e,\"uDelta\")}},sendUniformData:function(t,e){var i=this.chooseRightDelta();t.uniform2fv(e.delta,i)},chooseRightDelta:function(){var t,e=1,i=[0,0];return this.horizontal?this.aspectRatio>1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),t=e*this.blur*.12,this.horizontal?i[0]=t:i[1]=t,i}}),i.Blur.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Gamma=r(i.BaseFilter,{type:\"Gamma\",fragmentSource:\"precision highp float;\\nuniform sampler2D uTexture;\\nuniform vec3 uGamma;\\nvarying vec2 vTexCoord;\\nvoid main() {\\nvec4 color = texture2D(uTexture, vTexCoord);\\nvec3 correction = (1.0 / uGamma);\\ncolor.r = pow(color.r, correction.r);\\ncolor.g = pow(color.g, correction.g);\\ncolor.b = pow(color.b, correction.b);\\ngl_FragColor = color;\\ngl_FragColor.rgb *= color.a;\\n}\",gamma:[1,1,1],mainParameter:\"gamma\",initialize:function(t){this.gamma=[1,1,1],i.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,i=t.imageData.data,r=this.gamma,n=i.length,s=1/r[0],o=1/r[1],a=1/r[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,n=256;e<n;e++)this.rVals[e]=255*Math.pow(e/255,s),this.gVals[e]=255*Math.pow(e/255,o),this.bVals[e]=255*Math.pow(e/255,a);for(e=0,n=i.length;e<n;e+=4)i[e]=this.rVals[i[e]],i[e+1]=this.gVals[i[e+1]],i[e+2]=this.bVals[i[e+2]]},getUniformLocations:function(t,e){return{uGamma:t.getUniformLocation(e,\"uGamma\")}},sendUniformData:function(t,e){t.uniform3fv(e.uGamma,this.gamma)}}),e.Image.filters.Gamma.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.Composed=r(i.BaseFilter,{type:\"Composed\",subFilters:[],initialize:function(t){this.callSuper(\"initialize\",t),this.subFilters=this.subFilters.slice(0)},applyTo:function(t){t.passes+=this.subFilters.length-1,this.subFilters.forEach((function(e){e.applyTo(t)}))},toObject:function(){return e.util.object.extend(this.callSuper(\"toObject\"),{subFilters:this.subFilters.map((function(t){return t.toObject()}))})},isNeutralState:function(){return!this.subFilters.some((function(t){return!t.isNeutralState()}))}}),e.Image.filters.Composed.fromObject=function(t,i){var r=(t.subFilters||[]).map((function(t){return new e.Image.filters[t.type](t)})),n=new e.Image.filters.Composed({subFilters:r});return i&&i(n),n}}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.Image.filters,r=e.util.createClass;i.HueRotation=r(i.ColorMatrix,{type:\"HueRotation\",rotation:0,mainParameter:\"rotation\",calculateMatrix:function(){var t=this.rotation*Math.PI,i=e.util.cos(t),r=e.util.sin(t),n=1/3,s=Math.sqrt(n)*r,o=1-i;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=i+o/3,this.matrix[1]=n*o-s,this.matrix[2]=n*o+s,this.matrix[5]=n*o+s,this.matrix[6]=i+n*o,this.matrix[7]=n*o-s,this.matrix[10]=n*o-s,this.matrix[11]=n*o+s,this.matrix[12]=i+n*o},isNeutralState:function(t){return this.calculateMatrix(),i.BaseFilter.prototype.isNeutralState.call(this,t)},applyTo:function(t){this.calculateMatrix(),i.BaseFilter.prototype.applyTo.call(this,t)}}),e.Image.filters.HueRotation.fromObject=e.Image.filters.BaseFilter.fromObject}(e),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.clone;if(e.Text)e.warn(\"fabric.Text is already defined\");else{var r=\"fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign\".split(\" \");e.Text=e.util.createClass(e.Object,{_dimensionAffectingProps:[\"fontSize\",\"fontWeight\",\"fontFamily\",\"fontStyle\",\"lineHeight\",\"text\",\"charSpacing\",\"textAlign\",\"styles\",\"path\",\"pathStartOffset\",\"pathSide\",\"pathAlign\"],_reNewline:/\\r?\\n/,_reSpacesAndTabs:/[ \\t\\r]/g,_reSpaceAndTab:/[ \\t\\r]/,_reWords:/\\S+/g,type:\"text\",fontSize:40,fontWeight:\"normal\",fontFamily:\"Times New Roman\",underline:!1,overline:!1,linethrough:!1,textAlign:\"left\",fontStyle:\"normal\",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:\"\",stateProperties:e.Object.prototype.stateProperties.concat(r),cacheProperties:e.Object.prototype.cacheProperties.concat(r),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:\"left\",pathAlign:\"baseline\",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:\"ltr\",_styleProperties:[\"stroke\",\"strokeWidth\",\"fill\",\"fontFamily\",\"fontSize\",\"fontWeight\",\"fontStyle\",\"underline\",\"overline\",\"linethrough\",\"deltaY\",\"textBackgroundColor\"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(t,e){this.styles=e&&e.styles||{},this.text=t,this.__skipDimension=!0,this.callSuper(\"initialize\",e),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:\"_dimensionAffectingProps\"})},setPathInfo:function(){var t=this.path;t&&(t.segmentsInfo=e.util.getPathSegmentsInfo(t.path))},getMeasuringContext:function(){return e._measuringContext||(e._measuringContext=this.canvas&&this.canvas.contextCache||e.util.createCanvasElement().getContext(\"2d\")),e._measuringContext},_splitText:function(){var t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf(\"justify\")&&this.enlargeSpaces(),this.saveState({propertySet:\"_dimensionAffectingProps\"}))},enlargeSpaces:function(){for(var t,e,i,r,n,s,o,a=0,h=this._textLines.length;a<h;a++)if((\"justify\"===this.textAlign||a!==h-1&&!this.isEndOfWrapping(a))&&(r=0,n=this._textLines[a],(e=this.getLineWidth(a))<this.width&&(o=this.textLines[a].match(this._reSpacesAndTabs)))){i=o.length,t=(this.width-e)/i;for(var l=0,c=n.length;l<=c;l++)s=this.__charBounds[a][l],this._reSpaceAndTab.test(n[l])?(s.width+=t,s.kernedWidth+=t,s.left+=r,r+=t):s.left+=r}},isEndOfWrapping:function(t){return t===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return\"#<fabric.Text (\"+this.complexity()+'): { \"text\": \"'+this.text+'\", \"fontFamily\": \"'+this.fontFamily+'\" }>'},_getCacheCanvasDimensions:function(){var t=this.callSuper(\"_getCacheCanvasDimensions\"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){var e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackgroun
2d(t),this._renderTextDecoration(t,\"underline\"),this._renderText(t),this._renderTextDecoration(t,\"overline\"),this._renderTextDecoration(t,\"linethrough\")},_renderText:function(t){\"stroke\"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,i){if(t.textBaseline=\"alphabetical\",this.path)switch(this.pathAlign){case\"center\":t.textBaseline=\"middle\";break;case\"ascender\":t.textBaseline=\"top\";break;case\"descender\":t.textBaseline=\"bottom\"}t.font=this._getFontDeclaration(e,i)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,i=this._textLines.length;e<i;e++){var r=this.getLineWidth(e);r>t&&(t=r)}return t},_renderTextLine:function(t,e,i,r,n,s){this._renderChars(t,e,i,r,n,s)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas(\"textBackgroundColor\")){for(var e,i,r,n,s,o,a,h=t.fillStyle,l=this._getLeftOffset(),c=this._getTopOffset(),u=0,d=0,f=this.path,g=0,m=this._textLines.length;g<m;g++)if(e=this.getHeightOfLine(g),this.textBackgroundColor||this.styleHas(\"textBackgroundColor\",g)){r=this._textLines[g],i=this._getLineLeftOffset(g),d=0,u=0,n=this.getValueOfPropertyAt(g,0,\"textBackgroundColor\");for(var p=0,_=r.length;p<_;p++)s=this.__charBounds[g][p],o=this.getValueOfPropertyAt(g,p,\"textBackgroundColor\"),f?(t.save(),t.translate(s.renderLeft,s.renderTop),t.rotate(s.angle),t.fillStyle=o,o&&t.fillRect(-s.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),s.width,e/this.lineHeight),t.restore()):o!==n?(a=l+i+u,\"rtl\"===this.direction&&(a=this.width-a-d),t.fillStyle=n,n&&t.fillRect(a,c,d,e/this.lineHeight),u=s.left,d=s.width,n=o):d+=s.kernedWidth;o&&!f&&(a=l+i+u,\"rtl\"===this.direction&&(a=this.width-a-d),t.fillStyle=o,t.fillRect(a,c,d,e/this.lineHeight)),c+=e}else c+=e;t.fillStyle=h,this._removeShadow(t)}},getFontCache:function(t){var i=t.fontFamily.toLowerCase();e.charWidthsCache[i]||(e.charWidthsCache[i]={});var r=e.charWidthsCache[i],n=t.fontStyle.toLowerCase()+\"_\"+(t.fontWeight+\"\").toLowerCase();return r[n]||(r[n]={}),r[n]},_measureChar:function(t,e,i,r){var n,s,o,a,h=this.getFontCache(e),l=i+t,c=this._getFontDeclaration(e)===this._getFontDeclaration(r),u=e.fontSize/this.CACHE_FONT_SIZE;if(i&&void 0!==h[i]&&(o=h[i]),void 0!==h[t]&&(a=n=h[t]),c&&void 0!==h[l]&&(a=(s=h[l])-o),void 0===n||void 0===o||void 0===s){var d=this.getMeasuringContext();this._setTextStyles(d,e,!0)}return void 0===n&&(a=n=d.measureText(t).width,h[t]=n),void 0===o&&c&&i&&(o=d.measureText(i).width,h[i]=o),c&&void 0===s&&(s=d.measureText(l).width,h[l]=s,a=s-o),{width:n*u,kernedWidth:a*u}},getHeightOfChar:function(t,e){return this.getValueOfPropertyAt(t,e,\"fontSize\")},measureLine:function(t){var e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e},_measureLine:function(t){var i,r,n,s,o,a,h=0,l=this._textLines[t],c=new Array(l.length),u=0,d=this.path,f=\"right\"===this.pathSide;for(this.__charBounds[t]=c,i=0;i<l.length;i++)r=l[i],s=this._getGraphemeBox(r,t,i,n),c[i]=s,h+=s.kernedWidth,n=r;if(c[i]={left:s?s.left+s.width:0,width:0,kernedWidth:0,height:this.fontSize},d){switch(a=d.segmentsInfo[d.segmentsInfo.length-1].length,(o=e.util.getPointOnPath(d.path,0,d.segmentsInfo)).x+=d.pathOffset.x,o.y+=d.pathOffset.y,this.textAlign){case\"left\":u=f?a-h:0;break;case\"center\":u=(a-h)/2;break;case\"right\":u=f?0:a-h}for(u+=this.pathStartOffset*(f?-1:1),i=f?l.length-1:0;f?i>=0:i<l.length;f?i--:i++)s=c[i],u>a?u%=a:u<0&&(u+=a),this._setGraphemeOnPath(u,s,o),u+=s.kernedWidth}return{width:h,numOfSpaces:0}},_setGraphemeOnPath:function(t,i,r){var n=t+i.kernedWidth/2,s=this.path,o=e.util.getPointOnPath(s.path,n,s.segmentsInfo);i.renderLeft=o.x-r.x,i.renderTop=o.y-r.y,i.angle=o.angle+(\"right\"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,i,r,n){var s,o=this.getCompleteStyleDeclaration(e,i),a=r?this.getCompleteStyleDeclaration(e,i-1):{},h=this._measureChar(t,o,r,a),l=h.kernedWidth,c=h.width;0!==this.charSpacing&&(c+=s=this._getWidthOfCharSpacing(),l+=s);var u={width:c,left:0,height:o.fontSize,kernedWidth:l,deltaY:o.deltaY};if(i>0&&!n){var d=this.__charBounds[e][i-1];u.left=d.left+d.width+h.kernedWidth-h.width}return u},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),r=1,n=e.length;r<n;r++)i=Math.max(this.getHeightOfChar(t,r),i);return this.__lineHeights[t]=i*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var t,e=0,i=0,r=this._textLines.length;i<r;i++)t=this.getHeightOfLine(i),e+=i===r-1?t/this.lineHeight:t;return e},_getLeftOffset:function(){return\"ltr\"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(t,e){t.save();for(var i=0,r=this._getLeftOffset(),n=this._getTopOffset(),s=0,o=this._textLines.length;s<o;s++){var a=this.getHeightOfLine(s),h=a/this.lineHeight,l=this._getLineLeftOffset(s);this._renderTextLine(e,t,this._textLines[s],r+l,n+i+h,s),i+=a}
2t.restore()},_renderTextFill:function(t){(this.fill||this.styleHas(\"fill\"))&&this._renderTextCommon(t,\"fillText\")},_renderTextStroke:function(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,\"strokeText\"),t.closePath(),t.restore())},_renderChars:function(t,e,i,r,n,s){var o,a,h,l,c,u=this.getHeightOfLine(s),d=-1!==this.textAlign.indexOf(\"justify\"),f=\"\",g=0,m=this.path,p=!d&&0===this.charSpacing&&this.isEmptyStyles(s)&&!m,_=\"ltr\"===this.direction,v=\"ltr\"===this.direction?1:-1,y=e.canvas.getAttribute(\"dir\");if(e.save(),y!==this.direction&&(e.canvas.setAttribute(\"dir\",_?\"ltr\":\"rtl\"),e.direction=_?\"ltr\":\"rtl\",e.textAlign=_?\"left\":\"right\"),n-=u*this._fontSizeFraction/this.lineHeight,p)return this._renderChar(t,e,s,0,i.join(\"\"),r,n,u),void e.restore();for(var w=0,C=i.length-1;w<=C;w++)l=w===C||this.charSpacing||m,f+=i[w],h=this.__charBounds[s][w],0===g?(r+=v*(h.kernedWidth-h.width),g+=h.width):g+=h.kernedWidth,d&&!l&&this._reSpaceAndTab.test(i[w])&&(l=!0),l||(o=o||this.getCompleteStyleDeclaration(s,w),a=this.getCompleteStyleDeclaration(s,w+1),l=this._hasStyleChanged(o,a)),l&&(m?(e.save(),e.translate(h.renderLeft,h.renderTop),e.rotate(h.angle),this._renderChar(t,e,s,w,f,-g/2,0,u),e.restore()):(c=r,this._renderChar(t,e,s,w,f,c,n,u)),f=\"\",o=a,r+=v*g,g=0);e.restore()},_applyPatternGradientTransformText:function(t){var i,r=e.util.createCanvasElement(),n=this.width+this.strokeWidth,s=this.height+this.strokeWidth;return r.width=n,r.height=s,(i=r.getContext(\"2d\")).beginPath(),i.moveTo(0,0),i.lineTo(n,0),i.lineTo(n,s),i.lineTo(0,s),i.closePath(),i.translate(n/2,s/2),i.fillStyle=t.toLive(i),this._applyPatternGradientTransform(i,t),i.fill(),i.createPattern(r,\"no-repeat\")},handleFiller:function(t,e,i){var r,n;return i.toLive?\"percentage\"===i.gradientUnits||i.gradientTransform||i.patternTransform?(r=-this.width/2,n=-this.height/2,t.translate(r,n),t[e]=this._applyPatternGradientTransformText(i),{offsetX:r,offsetY:n}):(t[e]=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})},_setStrokeStyles:function(t,e){return t.lineWidth=e.strokeWidth,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,\"strokeStyle\",e.stroke)},_setFillStyles:function(t,e){return this.handleFiller(t,\"fillStyle\",e.fill)},_renderChar:function(t,e,i,r,n,s,o){var a,h,l=this._getStyleDeclaration(i,r),c=this.getCompleteStyleDeclaration(i,r),u=\"fillText\"===t&&c.fill,d=\"strokeText\"===t&&c.stroke&&c.strokeWidth;(d||u)&&(e.save(),u&&(a=this._setFillStyles(e,c)),d&&(h=this._setStrokeStyles(e,c)),e.font=this._getFontDeclaration(c),l&&l.textBackgroundColor&&this._removeShadow(e),l&&l.deltaY&&(o+=l.deltaY),u&&e.fillText(n,s-a.offsetX,o-a.offsetY),d&&e.strokeText(n,s-h.offsetX,o-h.offsetY),e.restore())},setSuperscript:function(t,e){return this._setScript(t,e,this.superscript)},setSubscript:function(t,e){return this._setScript(t,e,this.subscript)},_setScript:function(t,e,i){var r=this.get2DCursorLocation(t,!0),n=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,\"fontSize\"),s=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,\"deltaY\"),o={fontSize:n*i.size,deltaY:s+n*i.baseline};return this.setSelectionStyles(o,t,e),this},_hasStyleChanged:function(t,e){return t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.deltaY!==e.deltaY},_hasStyleChangedForSvg:function(t,e){return this._hasStyleChanged(t,e)||t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),i=this.width-e,r=this.textAlign,n=this.direction,s=0,o=this.isEndOfWrapping(t);return\"justify\"===r||\"justify-center\"===r&&!o||\"justify-right\"===r&&!o||\"justify-left\"===r&&!o?0:(\"center\"===r&&(s=i/2),\"right\"===r&&(s=i),\"justify-center\"===r&&(s=i/2),\"justify-right\"===r&&(s=i),\"rtl\"===n&&(s-=i),s)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var t=this._forceClearCache;return t||(t=this.hasStateChanged(\"_dimensionAffectingProps\")),t&&(this.dirty=!0,this._forceClearCache=!1),t},getLineWidth:function(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];var e=this.measureLine(t).width;return this.__lineWidths[t]=e,e},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0}
vendor: 4,566 bytes, line 2
2,getValueOfPropertyAt:function(t,e,i){var r=this._getStyleDeclaration(t,e);return r&&void 0!==r[i]?r[i]:this[i]},_renderTextDecoration:function(t,e){if(this[e]||this.styleHas(e)){for(var i,r,n,s,o,a,h,l,c,u,d,f,g,m,p,_,v=this._getLeftOffset(),y=this._getTopOffset(),w=this.path,C=this._getWidthOfCharSpacing(),E=this.offsets[e],T=0,S=this._textLines.length;T<S;T++)if(i=this.getHeightOfLine(T),this[e]||this.styleHas(e,T)){h=this._textLines[T],m=i/this.lineHeight,s=this._getLineLeftOffset(T),u=0,d=0,l=this.getValueOfPropertyAt(T,0,e),_=this.getValueOfPropertyAt(T,0,\"fill\"),c=y+m*(1-this._fontSizeFraction),r=this.getHeightOfChar(T,0),o=this.getValueOfPropertyAt(T,0,\"deltaY\");for(var b=0,I=h.length;b<I;b++)if(f=this.__charBounds[T][b],g=this.getValueOfPropertyAt(T,b,e),p=this.getValueOfPropertyAt(T,b,\"fill\"),n=this.getHeightOfChar(T,b),a=this.getValueOfPropertyAt(T,b,\"deltaY\"),w&&g&&p)t.save(),t.fillStyle=_,t.translate(f.renderLeft,f.renderTop),t.rotate(f.angle),t.fillRect(-f.kernedWidth/2,E*n+a,f.kernedWidth,this.fontSize/15),t.restore();else if((g!==l||p!==_||n!==r||a!==o)&&d>0){var x=v+s+u;\"rtl\"===this.direction&&(x=this.width-x-d),l&&_&&(t.fillStyle=_,t.fillRect(x,c+E*r+o,d,this.fontSize/15)),u=f.left,d=f.width,l=g,_=p,r=n,o=a}else d+=f.kernedWidth;x=v+s+u,\"rtl\"===this.direction&&(x=this.width-x-d),t.fillStyle=p,g&&p&&t.fillRect(x,c+E*r+o,d-C,this.fontSize/15),y+=i}else y+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,i){var r=t||this,n=this.fontFamily,s=e.Text.genericFonts.indexOf(n.toLowerCase())>-1,o=void 0===n||n.indexOf(\"'\")>-1||n.indexOf(\",\")>-1||n.indexOf('\"')>-1||s?r.fontFamily:'\"'+r.fontFamily+'\"';return[e.isLikelyNode?r.fontWeight:r.fontStyle,e.isLikelyNode?r.fontStyle:r.fontWeight,i?this.CACHE_FONT_SIZE+\"px\":r.fontSize+\"px\",o].join(\" \")},render:function(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper(\"render\",t)))},_splitTextIntoLines:function(t){for(var i=t.split(this._reNewline),r=new Array(i.length),n=[\"\\n\"],s=[],o=0;o<i.length;o++)r[o]=e.util.string.graphemeSplit(i[o]),s=s.concat(r[o],n);return s.pop(),{_unwrappedLines:r,lines:i,graphemeText:s,graphemeLines:r}},toObject:function(t){var e=r.concat(t),n=this.callSuper(\"toObject\",e);return n.styles=i(this.styles,!0),n.path&&(n.path=this.path.toObject()),n},set:function(t,e){this.callSuper(\"set\",t,e);var i=!1,r=!1;if(\"object\"==typeof t)for(var n in t)\"path\"===n&&this.setPathInfo(),i=i||-1!==this._dimensionAffectingProps.indexOf(n),r=r||\"path\"===n;else i=-1!==this._dimensionAffectingProps.indexOf(t),r=\"path\"===t;return r&&this.setPathInfo(),i&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(\"x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor\".split(\" \")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,r,n){if(!t)return r(null);var s=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES),o=s.textAnchor||\"left\";if((n=e.util.object.extend(n?i(n):{},s)).top=n.top||0,n.left=n.left||0,s.textDecoration){var a=s.textDecoration;-1!==a.indexOf(\"underline\")&&(n.underline=!0),-1!==a.indexOf(\"overline\")&&(n.overline=!0),-1!==a.indexOf(\"line-through\")&&(n.linethrough=!0),delete n.textDecoration}\"dx\"in s&&(n.left+=s.dx),\"dy\"in s&&(n.top+=s.dy),\"fontSize\"in n||(n.fontSize=e.Text.DEFAULT_SVG_FONT_SIZE);var h=\"\";\"textContent\"in t?h=t.textContent:\"firstChild\"in t&&null!==t.firstChild&&\"data\"in t.firstChild&&null!==t.firstChild.data&&(h=t.firstChild.data),h=h.replace(/^\\s+|\\s+$|\\n+/g,\"\").replace(/\\s+/g,\" \");var l=n.strokeWidth;n.strokeWidth=0;var c=new e.Text(h,n),u=c.getScaledHeight()/c.height,d=((c.height+c.strokeWidth)*c.lineHeight-c.height)*u,f=c.getScaledHeight()+d,g=0;\"center\"===o&&(g=c.getScaledWidth()/2),\"right\"===o&&(g=c.getScaledWidth()),c.set({left:c.left-g,top:c.top-(f-c.fontSize*(.07+c._fontSizeFraction))/c.lineHeight,strokeWidth:void 0!==l?l:1}),r(c)},e.Text.fromObject=function(t,r){var n=i(t),s=t.path;return delete n.path,e.Object._fromObject(\"Text\",n,(function(t){s?e.Object._fromObject(\"Path\",s,(function(e){t.set(\"path\",e),r(t)}),\"path\"):r(t)}),\"text\")},e.Text.genericFonts=[\"sans-serif\",\"serif\",\"cursive\",\"fantasy\",\"monospace\"],e.util.createAccessors&&e.util.createAccessors(e.Text)}}(e),S.util.object.extend(S.Text.prototype,{isEmptyStyles:function(t){if(!this.styles)return!0;
2if(void 0!==t&&!this.styles[t])return!0;var e=void 0===t?this.styles:{line:this.styles[t]};for(var i in e)for(var r in e[i])for(var n in e[i][r])return!1;return!0},styleHas:function(t,e){if(!this.styles||!t||\"\"===t)return!1;if(void 0!==e&&!this.styles[e])return!1;var i=void 0===e?this.styles:{0:this.styles[e]};for(var r in i)for(var n in i[r])if(void 0!==i[r][n][t])return!0;return!1},cleanStyle:function(t){if(!this.styles||!t||\"\"===t)return!1;var e,i,r=this.styles,n=0,s=!0,o=0;for(var a in r){for(var h in e=0,r[a]){var l;n++,(l=r[a][h]).hasOwnProperty(t)?(i?l[t]!==i&&(s=!1):i=l[t],l[t]===this[t]&&delete l[t]):s=!1,0!==Object.keys(l).length?e++:delete r[a][h]}0===e&&delete r[a]}for(var c=0;c<this._textLines.length;c++)o+=this._textLines[c].length;s&&n===o&&(this[t]=i,this.removeStyle(t))},removeStyle:function(t){if(this.styles&&t&&\"\"!==t){var e,i,r,n=this.styles;for(i in n){for(r in e=n[i])delete e[r][t],0===Object.keys(e[r]).length&&delete e[r];0===Object.keys(e).length&&delete n[i]}}},_extendStyles:function(t,e){var i=this.get2DCursorLocation(t);this._getLineStyle(i.lineIndex)||this._setLineStyle(i.lineIndex),this._getStyleDeclaration(i.lineIndex,i.charIndex)||this._setStyleDeclaration(i.lineIndex,i.charIndex,{}),S.util.object.extend(this._getStyleDeclaration(i.lineIndex,i.charIndex),e)},get2DCursorLocation:function(t,e){void 0===t&&(t=this.selectionStart);for(var i=e?this._unwrappedTextLines:this._textLines,r=i.length,n=0;n<r;n++){if(t<=i[n].length)return{lineIndex:n,charIndex:t};t-=i[n].length+this.missingNewlineOffset(n)}return{lineIndex:n-1,charIndex:i[n-1].length<t?i[n-1].length:t}},getSelectionStyles:function(t,e,i){void 0===t&&(t=this.selectionStart||0),void 0===e&&(e=this.selectionEnd||t);for(var r=[],n=t;n<e;n++)r.push(this.getStyleAtPosition(n,i));return r},getStyleAtPosition:function(t,e){var i=this.get2DCursorLocation(t);return(e?this.getCompleteStyleDeclaration(i.lineIndex,i.charIndex):this._getStyleDeclaration(i.lineIndex,i.charIndex))||{}},setSelectionStyles:function(t,e,i){void 0===e&&(e=this.selectionStart||0),void 0===i&&(i=this.selectionEnd||e);for(var r=e;r<i;r++)this._extendStyles(r,t);return this._forceClearCache=!0,this},_getStyleDeclaration:function(t,e){var i=this.styles&&this.styles[t];return i?i[e]:null},getCompleteStyleDeclaration:function(t,e){for(var i,r=this._getStyleDeclaration(t,e)||{},n={},s=0;s<this._styleProperties.length;s++)n[i=this._styleProperties[s]]=void 0===r[i]?this[i]:r[i];return n},_setStyleDeclaration:function(t,e,i){this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){delete this.styles[t][e]},_getLineStyle:function(t){return!!this.styles[t]},_setLineStyle:function(t){this.styles[t]={}},_deleteLineStyle:function(t){delete this.styles[t]}}),function(){function t(t){t.textDecoration&&(t.textDecoration.indexOf(\"underline\")>-1&&(t.underline=!0),t.textDecoration.indexOf(\"line-through\")>-1&&(t.linethrough=!0),t.textDecoration.indexOf(\"overline\")>-1&&(t.overline=!0),delete t.textDecoration)}S.IText=S.util.createClass(S.Text,S.Observable,{type:\"i-text\",selectionStart:0,selectionEnd:0,selectionColor:\"rgba(17,119,255,0.3)\",isEditing:!1,editable:!0,editingBorderColor:\"rgba(102,153,255,0.25)\",cursorWidth:2,cursorColor:\"\",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\\s|\\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper(\"initialize\",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire(\"selectionStart\",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire(\"selectionEnd\",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire(\"selection:changed\"),this.canvas&&this.canvas.fire(\"text:selection:changed\",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper(\"initDimensions\")},render:function(t){this.clearContextTop(),this.callSuper(\"render\",t),this.cursorOffsetCac
2he={},this.renderCursorOrSelection()},_render:function(t){this.callSuper(\"_render\",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,i=this.canvas.viewportTransform;e.save(),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(e),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},_getCursorBoundaries:function(t){void 0===t&&(t=this.selectionStart);var e=this._getLeftOffset(),i=this._getTopOffset(),r=this._getCursorBoundariesOffsets(t);return{left:e,top:i,leftOffset:r.left,topOffset:r.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&\"top\"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,i,r,n,s=0,o=0,a=this.get2DCursorLocation(t);r=a.charIndex,i=a.lineIndex;for(var h=0;h<i;h++)s+=this.getHeightOfLine(h);e=this._getLineLeftOffset(i);var l=this.__charBounds[i][r];return l&&(o=l.left),0!==this.charSpacing&&r===this._textLines[i].length&&(o-=this._getWidthOfCharSpacing()),n={top:s,left:e+(o>0?o:0)},\"rtl\"===this.direction&&(n.left*=-1),this.cursorOffsetCache=n,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),r=i.lineIndex,n=i.charIndex>0?i.charIndex-1:0,s=this.getValueOfPropertyAt(r,n,\"fontSize\"),o=this.scaleX*this.canvas.getZoom(),a=this.cursorWidth/o,h=t.topOffset,l=this.getValueOfPropertyAt(r,n,\"deltaY\");h+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-s*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(r,n,\"fill\"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-a/2,h+t.top+l,a,s)},renderSelection:function(t,e){for(var i=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,r=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,n=-1!==this.textAlign.indexOf(\"justify\"),s=this.get2DCursorLocation(i),o=this.get2DCursorLocation(r),a=s.lineIndex,h=o.lineIndex,l=s.charIndex<0?0:s.charIndex,c=o.charIndex<0?0:o.charIndex,u=a;u<=h;u++){var d,f=this._getLineLeftOffset(u)||0,g=this.getHeightOfLine(u),m=0,p=0;if(u===a&&(m=this.__charBounds[a][l].left),u>=a&&u<h)p=n&&!this.isEndOfWrapping(u)?this.width:this.getLineWidth(u)||5;else if(u===h)if(0===c)p=this.__charBounds[h][c].left;else{var _=this._getWidthOfCharSpacing();p=this.__charBounds[h][c-1].left+this.__charBounds[h][c-1].width-_}d=g,(this.lineHeight<1||u===h&&this.lineHeight>1)&&(g/=this.lineHeight);var v=t.left+f+m,y=p-m,w=g,C=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||\"black\",w=1,C=g):e.fillStyle=this.selectionColor,\"rtl\"===this.direction&&(v=this.width-v-y),e.fillRect(v,t.top+t.topOffset+C,y,w),t.topOffset+=d}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,\"fontSize\")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,\"fill\")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),S.IText.fromObject=function(e,i){if(t(e),e.styles)for(var r in e.styles)for(var n in e.styles[r])t(e.styles[r][n]);S.Object._fromObject(\"IText\",e,i,\"text\")}}(),T=S.util.object.clone,S.util.object.extend(S.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var t=this;this.on(\"added\",(function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))}))},initRemovedHandler:function(){var t=this;this.on(\"removed\",(function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],S.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))}))},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEac
2h((function(t){t.__isMousedown=!1}))},t.on(\"mouse:up\",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off(\"mouse:up\",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,\"_onTickComplete\")},_animateCursor:function(t,e,i,r){var n;return n={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate(\"_currentCursorOpacity\",e,{duration:i,onComplete:function(){n.isAborted||t[r]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return n.isAborted}}),n},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout((function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,\"_tick\")}),100)},initDelayedCursor:function(t){var e=this,i=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout((function(){e._tick()}),i)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join(\"\")},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i--;for(;/\\S/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i++;for(;/\\S/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\\n/.test(this._text[i])&&i>-1;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\\n/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},searchWordBoundary:function(t,e){for(var i=this._text,r=this._reSpace.test(i[t])?t-1:t,n=i[r],s=S.reNonWord;!s.test(n)&&r>0&&r<i.length;)n=i[r+=e];return s.test(n)&&(r+=1===e?0:1),r},selectWord:function(t){t=t||this.selectionStart;var e=this.searchWordBoundary(t,-1),i=this.searchWordBoundary(t,1);this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(t){t=t||this.selectionStart;var e=this.findLineBoundaryLeft(t),i=this.findLineBoundaryRight(t);return this.selectionStart=e,this.selectionEnd=i,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(t),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire(\"editing:entered\"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire(\"text:editing:entered\",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(t){t._iTextInstances&&t._iTextInstances.forEach((function(t){t.selected=!1,t.isEditing&&t.exitEditing()}))},initMouseMoveHandler:function(){this.canvas.on(\"mouse:move\",this.mouseMoveHandler)},mouseMoveHandler:function(t){if(this.__isMousedown&&this.isEditing){var e=this.getSelectionStartFromPointer(t.e),i=this.selectionStart,r=this.selectionEnd;(e===this.__selectionStartOnMouseDown&&i!==r||i!==e&&r!==e)&&(e>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===r||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}}
2,_setEditingProps:function(){this.hoverCursor=\"text\",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor=\"text\"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,i){var r=i.slice(0,t),n=S.util.string.graphemeSplit(r).length;if(t===e)return{selectionStart:n,selectionEnd:n};var s=i.slice(t,e);return{selectionStart:n,selectionEnd:n+S.util.string.graphemeSplit(s).length}},fromGraphemeToStringSelection:function(t,e,i){var r=i.slice(0,t).join(\"\").length;return t===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+i.slice(t,e).join(\"\").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),i=this.get2DCursorLocation(t),r=i.lineIndex,n=i.charIndex,s=this.getValueOfPropertyAt(r,n,\"fontSize\")*this.lineHeight,o=e.leftOffset,a=this.calcTransformMatrix(),h={x:e.left+o,y:e.top+e.topOffset+s},l=this.canvas.getRetinaScaling(),c=this.canvas.upperCanvasEl,u=c.width/l,d=c.height/l,f=u-s,g=d-s,m=c.clientWidth/u,p=c.clientHeight/d;return h=S.util.transformPoint(h,a),(h=S.util.transformPoint(h,this.canvas.viewportTransform)).x*=m,h.y*=p,h.x<0&&(h.x=0),h.x>f&&(h.x=f),h.y<0&&(h.y=0),h.y>g&&(h.y=g),h.x+=this.canvas._offset.left,h.y+=this.canvas._offset.top,{left:h.x+\"px\",top:h.y+\"px\",fontSize:s+\"px\",charHeight:s}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire(\"editing:exited\"),t&&this.fire(\"modified\"),this.canvas&&(this.canvas.off(\"mouse:move\",this.mouseMoveHandler),this.canvas.fire(\"text:editing:exited\",{target:this}),t&&this.canvas.fire(\"object:modified\",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var i,r,n=this.get2DCursorLocation(t,!0),s=this.get2DCursorLocation(e,!0),o=n.lineIndex,a=n.charIndex,h=s.lineIndex,l=s.charIndex;if(o!==h){if(this.styles[o])for(i=a;i<this._unwrappedTextLines[o].length;i++)delete this.styles[o][i];if(this.styles[h])for(i=l;i<this._unwrappedTextLines[h].length;i++)(r=this.styles[h][i])&&(this.styles[o]||(this.styles[o]={}),this.styles[o][a+i-l]=r);for(i=o+1;i<=h;i++)delete this.styles[i];this.shiftLineStyles(h,o-h)}else if(this.styles[o]){r=this.styles[o];var c,u,d=l-a;for(i=a;i<l;i++)delete r[i];for(u in this.styles[o])(c=parseInt(u,10))>=l&&(r[c-d]=r[u],delete r[u])}},shiftLineStyles:function(t,e){var i=T(this.styles);for(var r in this.styles){var n=parseInt(r,10);n>t&&(this.styles[n+e]=i[n],i[n-e]||delete this.styles[n])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()}
vendor: 12,777 bytes, line 2
2,insertNewlineStyleObject:function(t,e,i,r){var n,s={},o=!1,a=this._unwrappedTextLines[t].length===e;for(var h in i||(i=1),this.shiftLineStyles(t,i),this.styles[t]&&(n=this.styles[t][0===e?e:e-1]),this.styles[t]){var l=parseInt(h,10);l>=e&&(o=!0,s[l-e]=this.styles[t][h],a&&0===e||delete this.styles[t][h])}var c=!1;for(o&&!a&&(this.styles[t+i]=s,c=!0),c&&i--;i>0;)r&&r[i-1]?this.styles[t+i]={0:T(r[i-1])}:n?this.styles[t+i]={0:T(n)}:delete this.styles[t+i],i--;this._forceClearCache=!0},insertCharStyleObject:function(t,e,i,r){this.styles||(this.styles={});var n=this.styles[t],s=n?T(n):{};for(var o in i||(i=1),s){var a=parseInt(o,10);a>=e&&(n[a+i]=s[a],s[a-i]||delete n[a])}if(this._forceClearCache=!0,r)for(;i--;)Object.keys(r[i]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+i]=T(r[i]));else if(n)for(var h=n[e?e-1:1];h&&i--;)this.styles[t][e+i]=T(h)},insertNewStyleBlock:function(t,e,i){for(var r=this.get2DCursorLocation(e,!0),n=[0],s=0,o=0;o<t.length;o++)\"\\n\"===t[o]?n[++s]=0:n[s]++;for(n[0]>0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,n[0],i),i=i&&i.slice(n[0]+1)),s&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+n[0],s),o=1;o<s;o++)n[o]>0?this.insertCharStyleObject(r.lineIndex+o,0,n[o],i):i&&this.styles[r.lineIndex+o]&&i[0]&&(this.styles[r.lineIndex+o][0]=i[0]),i=i&&i.slice(n[o]+1);n[o]>0&&this.insertCharStyleObject(r.lineIndex+o,0,n[o],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection=\"left\":\"right\"===this._selectionDirection&&(this._selectionDirection=\"left\",this.selectionEnd=t),this.selectionStart=i):i>t&&i<e?\"right\"===this._selectionDirection?this.selectionEnd=i:this.selectionStart=i:(e===t?this._selectionDirection=\"right\":\"left\"===this._selectionDirection&&(this._selectionDirection=\"right\",this.selectionStart=e),this.selectionEnd=i)},setSelectionInBoundaries:function(){var t=this.text.length;this.selectionStart>t?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}}),S.util.object.extend(S.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on(\"mousedown\",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire(\"tripleclick\",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on(\"mousedblclick\",this.doubleClickHandler),this.on(\"tripleclick\",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on(\"mousedown\",this._mouseDownHandler),this.on(\"mousedown:before\",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on(\"mouseup\",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,r=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,i=this.getLocalPointer(t),r=0,n=0,s=0,o=0,a=0,h=0,l=this._textLines.length;h<l&&s<=i.y;h++)s+=this.getHeightOfLine(h)*this.scaleY,a=h,h>0&&(o+=this._textLines[h-1].length+this.missingNewlineOffset(h-1));n=this._getLineLeftOffset(a)*this.scaleX,e=this._textLines[a],\"rtl\"===this.direction&&(i.x=this.width*this.scaleX-i.x+n);for(var c=0,u=e.length;c<u&&(r=n,(n+=this.__charBounds[a][c].kernedWidth*this.scaleX)<=i.x);c++)o++;return this._getNewSelectionStartFromOffset(i,r,n,o,u)},_getNewSelectionStartFromOffset:function(t,e,i,r,n){var s=t.x-e,o=i-t.x,a=r+(o>s||o<0?0:1);return this.flipX&&(a=n-a),a>this._text.length&&(a=this._text.length),a}}),S.util.object.extend(S.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=S.document.createElement(\"textarea\"),this.hiddenTextarea.setAttribute(\"autocapitalize\",\"off\"),this.hiddenTextarea.setAttribute(\"autocorrect\",\"off\"),this.hiddenTextarea.setAttribute(\"autocomplete\",\"off\"),this.hiddenTextarea.setAttribute(\"spellcheck\",\"false\"),this.hiddenTextarea.setAttribute(\"data-fabric-hiddentextarea\",\"\"),this.hiddenTextarea.setAttribute(\"wrap\",\"off\");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText=\"position: absolute; top: \"+t.top+\"; left: \"+t.left+\"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uff70top: \"+t.fontSize+\";\",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):S.document.body.appendChild(this.hiddenTextarea),S.util.addListener(this.hiddenTextarea,\"keydown\",this.onKeyDown.bind(this)),S.util.addListener(this.hiddenTextarea,\"keyup\",this.onKeyUp.bind(this)),S.util.addListener(this.hiddenTextarea,\"input\",this.onInput.bind(this)),S.util.addListener(this.hiddenTextarea,\"copy\",this.copy.bind(this)),S.util.addListener(this.hiddenTextarea,\"cut\",this.copy.bind(this)),S.util.addListener(this.hiddenTextarea,\"paste\",this.paste.bind(this)),S.util.addListener(this.hiddenTextarea,\"compositionstart\",this.onCompositionStart.bind(this)),S.util.addListener(this.hiddenTextarea,\"compositionupdate\",this.onCompositionUpdate.bind(this)),S.util.addListener(this.hiddenTextarea,\"compositionend\",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(S.util.addListener(this.canvas.upperCanvasEl,\"click\",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:\"exitEditing\",27:\"exitEditing\",33:\"moveCursorUp\",34:\"moveCursorDown\",35:\"moveCursorRight\",36:\"moveCursorLeft\",37:\"moveCursorLeft\",38:\"moveCursorUp\",39:\"moveCursorRight\",40:\"moveCursorDown\"},keysMapRtl:{9:\"exitEditing\",27:\"exitEditing\",33:\"moveCursorUp\",34:\"moveCursorDown\",35:\"moveCursorLeft\",36:\"moveCursorRight\",37:\"moveCursorRight\",38:\"moveCursorUp\",39:\"moveCursorLeft\",40:\"moveCursorDown\"},ctrlKeysMapUp:{67:\"copy\",88:\"cut\"},ctrlKeysMapDown:{65:\"selectAll\"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){var e=\"rtl\"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var i,r,n,s,o,a=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,l=a.length,c=l-h,u=this.selectionStart,d=this.selectionEnd,f=u!==d;if(\"\"===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire(\"changed\"),void(this.canvas&&(this.canvas.fire(\"text:changed\",{target:this}),this.canvas.requestRenderAll()));var g=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),m=u>g.selectionStart;f?(i=this._text.slice(u,d),c+=d-u):l<h&&(i=m?this._text.slice(d+c,d):this._text.slice(u,u-c)),r=a.slice(g.selectionEnd-c,g.selectionEnd),i&&i.length&&(r.length&&(n=this.getSelectionStyles(u,u+1,!1),n=r.map((function(){return n[0]}))),f?(s=u,o=d):m?(s=d-i.length,o=d):(s=d,o=d+i.length),this.removeStyleFromTo(s,o)),r.length&&(e&&r.join(\"\")===S.copiedText&&!S.disableStyleCopyPaste&&(n=S.copiedTextStyle),this.insertNewStyleBlock(r,u,n)),this.updateFromTextArea(),this.fire(\"changed\"),this.canvas&&(this.canvas.fire(\"text:changed\",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(t){this.compositionStart=t.target.selectionStart,this.compositionEnd=t.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(S.copiedText=this.getSelectedText(),S.disableStyleCopyPaste?S.copiedTextStyle=null:S.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||S.window.clipboardData},_getWidthBeforeCursor:function(t,e){var i,r=this._getLineLeftOffset(t);return e>0&&(r+=(i=this.__charBounds[t][e-1]).left+i.width),r},getDownCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(i),n=r.lineIndex;if(n===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-i;var s=r.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n+1,o);return this._textLines[n].slice(s).length+a+1+this.missingNewlineOffset(n)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var i=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(i),n=r.lineIndex;if(0===n||t.metaKey||33===t.keyCode)return-i;var s=r.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n-1,o),h=this._textLines[n].slice(0,s),l=this.missingNewlineOffset(n-1);return-this._textLines[n-1].length+a-h.length+(1-l)},_getIndexOnLine:function(t,e){for(var i,r,n=this._textLines[t],s=this._getLineLeftOffset(t),o=0,a=0,h=n.length;a<h;a++)if((s+=i=this.__charBounds[t][a].width)>e){r=!0;var l=s-i,c=s,u=Math.abs(l-e);o=Math.abs(c-e)<u?a:a-1;break}return r||(o=n.length-1),o},moveCursorDown:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown(\"Down\",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown(\"Up\",t)},_moveCursorUpOrDown:function(t,e){var i=this[\"get\"+t+\"CursorOffset\"](e,\"right\"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(i):this.moveCursorWithoutShift(i),0!==i&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e=\"left\"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight(\"Left\",t)}
2,_move:function(t,e,i){var r;if(t.altKey)r=this[\"findWordBoundary\"+i](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+=\"Left\"===i?-1:1,!0;r=this[\"findLineBoundary\"+i](this[e])}if(void 0!==typeof r&&this[e]!==r)return this[e]=r,!0},_moveLeft:function(t,e){return this._move(t,e,\"Left\")},_moveRight:function(t,e){return this._move(t,e,\"Right\")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection=\"left\",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,\"selectionStart\")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return\"right\"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,\"selectionEnd\"):0!==this.selectionStart?(this._selectionDirection=\"left\",this._moveLeft(t,\"selectionStart\")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight(\"Right\",t)},_moveCursorLeftOrRight:function(t,e){var i=\"moveCursor\"+t+\"With\";this._currentCursorOpacity=1,e.shiftKey?i+=\"Shift\":i+=\"outShift\",this[i](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return\"left\"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,\"selectionStart\"):this.selectionEnd!==this._text.length?(this._selectionDirection=\"right\",this._moveRight(t,\"selectionEnd\")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection=\"right\",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,\"selectionStart\"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){void 0===e&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(\"\"),this.set(\"dirty\",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,i,r){void 0===r&&(r=i),r>i&&this.removeStyleFromTo(i,r);var n=S.util.string.graphemeSplit(t);this.insertNewStyleBlock(n,i,e),this._text=[].concat(this._text.slice(0,i),n,this._text.slice(r)),this.text=this._text.join(\"\"),this.set(\"dirty\",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var t=S.util.toFixed,e=/  +/g;S.util.object.extend(S.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(\"\"),'\\t\\t<text xml:space=\"preserve\" ',this.fontFamily?'font-family=\"'+this.fontFamily.replace(/\"/g,\"'\")+'\" ':\"\",this.fontSize?'font-size=\"'+this.fontSize+'\" ':\"\",this.fontStyle?'font-style=\"'+this.fontStyle+'\" ':\"\",this.fontWeight?'font-weight=\"'+this.fontWeight+'\" ':\"\",e?'text-decoration=\"'+e+'\" ':\"\",'style=\"',this.getSvgStyles(!0),'\"',this.addPaintOrder(),\" >\",t.textSpans.join(\"\"),\"</text>\\n\"]},_getSVGTextAndBg:function(t,e){var i,r=[],n=[],s=t;this._setSVGBg(n);for(var o=0,a=this._textLines.length;o<a;o++)i=this._getLineLeftOffset(o),(this.textBackgroundColor||this.styleHas(\"textBackgroundColor\",o))&&this._setSVGTextLineBg(n,o,e+i,s),this._setSVGTextLineText(r,o,e+i,s),s+=this.getHeightOfLine(o);return{textSpans:r,textBgRects:n}},_createTextCharSpan:function(i,r,n,s){var o=i!==i.trim()||i.match(e),a=this.getSvgSpanStyles(r,o),h=a?'style=\"'+a+'\"':\"\",l=r.deltaY,c=\"\",u=S.Object.NUM_FRACTION_DIGITS;return l&&(c=' dy=\"'+t(l,u)+'\" '),['<tspan x=\"',t(n,u),'\" y=\"',t(s,u),'\" ',c,h,\">\",S.util.string.escapeXml(i),\"</tspan>\"].join(\"\")}
2,_setSVGTextLineText:function(t,e,i,r){var n,s,o,a,h,l=this.getHeightOfLine(e),c=-1!==this.textAlign.indexOf(\"justify\"),u=\"\",d=0,f=this._textLines[e];r+=l*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,m=f.length-1;g<=m;g++)h=g===m||this.charSpacing,u+=f[g],o=this.__charBounds[e][g],0===d?(i+=o.kernedWidth-o.width,d+=o.width):d+=o.kernedWidth,c&&!h&&this._reSpaceAndTab.test(f[g])&&(h=!0),h||(n=n||this.getCompleteStyleDeclaration(e,g),s=this.getCompleteStyleDeclaration(e,g+1),h=this._hasStyleChangedForSvg(n,s)),h&&(a=this._getStyleDeclaration(e,g)||{},t.push(this._createTextCharSpan(u,a,i,r)),u=\"\",n=s,i+=d,d=0)},_pushTextBgRect:function(e,i,r,n,s,o){var a=S.Object.NUM_FRACTION_DIGITS;e.push(\"\\t\\t<rect \",this._getFillAttributes(i),' x=\"',t(r,a),'\" y=\"',t(n,a),'\" width=\"',t(s,a),'\" height=\"',t(o,a),'\"></rect>\\n')},_setSVGTextLineBg:function(t,e,i,r){for(var n,s,o=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,h=0,l=0,c=this.getValueOfPropertyAt(e,0,\"textBackgroundColor\"),u=0,d=o.length;u<d;u++)n=this.__charBounds[e][u],(s=this.getValueOfPropertyAt(e,u,\"textBackgroundColor\"))!==c?(c&&this._pushTextBgRect(t,c,i+l,r,h,a),l=n.left,h=n.width,c=s):h+=n.kernedWidth;s&&this._pushTextBgRect(t,s,i+l,r,h,a)},_getFillAttributes:function(t){var e=t&&\"string\"==typeof t?new S.Color(t):\"\";return e&&e.getSource()&&1!==e.getAlpha()?'opacity=\"'+e.getAlpha()+'\" fill=\"'+e.setAlpha(1).toRgb()+'\"':'fill=\"'+t+'\"'},_getSVGLineTopOffset:function(t){for(var e,i=0,r=0;r<t;r++)i+=this.getHeightOfLine(r);return e=this.getHeightOfLine(r),{lineTop:i,offset:(this._fontSizeMult-this._fontSizeFraction)*e/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(t){return S.Object.prototype.getSvgStyles.call(this,t)+\" white-space: pre;\"}})}(),function(t){var e=t.fabric||(t.fabric={});e.Textbox=e.util.createClass(e.IText,e.Observable,{type:\"textbox\",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:e.Text.prototype._dimensionAffectingProps.concat(\"width\"),_wordJoiners:/[ \\t\\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set(\"width\",this.dynamicMinWidth),-1!==this.textAlign.indexOf(\"justify\")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:\"_dimensionAffectingProps\"}))},_generateStyleMap:function(t){for(var e=0,i=0,r=0,n={},s=0;s<t.graphemeLines.length;s++)\"\\n\"===t.graphemeText[r]&&s>0?(i=0,r++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[r])&&s>0&&(i++,r++),n[s]={line:e,offset:i},r+=t.graphemeLines[s].length,i+=t.graphemeLines[s].length;return n},styleHas:function(t,i){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[i];r&&(i=r.line)}return e.Text.prototype.styleHas.call(this,t,i)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,i,r=0,n=!1,s=this._styleMap[t],o=this._styleMap[t+1];for(var a in s&&(t=s.line,r=s.offset),o&&(n=o.line===t,e=o.offset),i=void 0===t?this.styles:{line:this.styles[t]})for(var h in i[a])if(h>=r&&(!n||h<e))for(var l in i[a][h])return!1;return!0},_getStyleDeclaration:function(t,e){if(this._styleMap&&!this.isWrapping){var i=this._styleMap[t];if(!i)return null;t=i.line,e=i.offset+e}return this.callSuper(\"_getStyleDeclaration\",t,e)},_setStyleDeclaration:function(t,e,i){var r=this._styleMap[t];t=r.line,e=r.offset+e,this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){var i=this._styleMap[t];t=i.line,e=i.offset+e,delete this.styles[t][e]},_getLineStyle:function(t){var e=this._styleMap[t];return!!this.styles[e.line]},_setLineStyle:function(t){var e=this._styleMap[t];this.styles[e.line]={}},_wrapText:function(t,e){var i,r=[];for(this.isWrapping=!0,i=0;i<t.length;i++)r=r.concat(this._wrapLine(t[i],i,e));return this.isWrapping=!1,r},_measureWord:function(t,e,i){var r,n=0;i=i||0;for(var s=0,o=t.length;s<o;s++)n+=this._getGraphemeBox(t[s],e,s+i,r,!0).kernedWidth,r=t[s];return n},_wrapLine:function(t,i,r,n){var s=0,o=this.splitByGrapheme,a=[],h=[],l=o?e.util.string.graphemeSplit(t):t.split(this._wordJoiners),c=\"\",u=0,d=o?\"\":\" \",f=0,g=0,m=0,p=!0,_=this._getWidthOfCharSpacing();n=n||0,0===l.length&&l.push([]),r-=n;for(var v=0;v<l.length;v++)c=o?l[v]:e.util.string.graphemeSplit(l[v]),f=this._measureWord(c,i,u),u+=c.length,(s+=g+f-_)>r&&!p?(a.push(h),h=[],s=f,p=!0):s+=_,p||o||h.push(d),h=h.concat(c),g=o?0:this._measureWord([d],i,u),u++,p=!1,f>m&&(m=f);return v&&a.push(h),m+n>this.dynamicMinWidth&&(this.dynamicMinWidth=m-_+n),a},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var i=e.Text.prototype._splitTextIntoLines.call(this,t),r=this._wrapText(i.lines,this.width),n=new Array(r.length),s=0;s<r.length;s++)n[s]=r[s].join(\"\");return i.lines=n,i.graphemeLines=r,i},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var t={};for(var e in this._styleMap)this._textLines[e]&&(t[this._styleMap[e].line]=1);for(var e in this.styles)t[e]||delete this.styles[e]},toObject:function(t){return this.callSuper(\"toObject\",[\"minWidth\",\"splitByGrapheme\"].concat(t))}}),e.Textbox.fromObject=function(t,i){return e.Object._fromObject(\"Textbox\",t,i,\"text\")}}(e),function(){var t=S.controlsUtils,e=t.scaleSkewCursorStyleHandler,i=t.scaleCursorStyleHandler,r=t.scalingEqually,n=t.scalingYOrSkewingX,s=t.scalingXOrSkewingY,o=t.scaleOrSkewActionName,a=S.Object.prototype.controls;if(a.ml=new S.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mr=new S.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mb=new S.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.mt=new S.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.tl=new S.Control({x:-.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.tr=new S.Control({x:.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.bl=new S.Control({x:-.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.br=new S.Control({x:.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.mtr=new S.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:\"rotate\"}),S.Textbox){var h=S.Textbox.prototype.controls={};h.mtr=a.mtr,h.tr=a.tr,h.br=a.br,h.tl=a.tl,h.bl=a.bl,h.mt=a.mt,h.mb=a.mb,h.mr=new S.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:\"resizing\"}),h.ml=new S.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:\"resizing\"})}}()},192:()=>{},898:()=>{},245:()=>{}},$e={};function ti(t){var e=$e[t];if(void 0!==e)return e.exports;var i=$e[t]={exports:{}};return Qe[t](i,i.exports,ti),i.exports}ti.d=(t,e)=>{for(var i in e)ti.o(e,i)&&!ti.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},ti.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var ei={};(()=>{let t;ti.d(ei,{R:()=>t}),t=\"undefined\"!=typeof document&&\"undefined\"!=typeof window?ti(653).fabric:{version:\"5.2.1\"}})();var ii,ri,ni,si,oi=ei.R;!function(t){t[t.DIMT_RECTANGLE=1]=\"DIMT_RECTANGLE\",t[t.DIMT_QUADRILATERAL=2]=\"DIMT_QUADRILATERAL\",t[t.DIMT_TEXT=4]=\"DIMT_TEXT\",t[t.DIMT_ARC=8]=\"DIMT_ARC\",t[t.DIMT_IMAGE=16]=\"DIMT_IMAGE\",t[t.DIMT_POLYGON=32]=\"DIMT_POLYGON\",t[t.DIMT_LINE=64]=\"DIMT_LINE\",t[t.DIMT_GROUP=128]=\"DIMT_GROUP\"}(ii||(ii={})),function(t){t[t.DIS_DEFAULT=1]=\"DIS_DEFAULT\",t[t.DIS_SELECTED=2]=\"DIS_SELECTED\"}(ri||(ri={})),function(t){t[t.EF_ENHANCED_FOCUS=4]=\"EF_ENHANCED_FOCUS\",t[t.EF_AUTO_ZOOM=16]=\"EF_AUTO_ZOOM\",t[t.EF_TAP_TO_FOCUS=64]=\"EF_TAP_TO_FOCUS\"}(ni||(ni={})),function(t){t.GREY=\"grey\",t.GREY32=\"grey32\",t.RGBA=\"rgba\",t.RBGA=\"rbga\",t.GRBA=\"grba\",t.GBRA=\"gbra\",t.BRGA=\"brga\",t.BGRA=\"bgra\"}(si||(si={}));const ai=t=>\"number\"==typeof t&&!Number.isNaN(t),hi=t=>
2\"string\"==typeof t;var li,ci,ui,di,fi,gi,mi,pi,_i,vi,yi;!function(t){t[t.ARC=0]=\"ARC\",t[t.IMAGE=1]=\"IMAGE\",t[t.LINE=2]=\"LINE\",t[t.POLYGON=3]=\"POLYGON\",t[t.QUAD=4]=\"QUAD\",t[t.RECT=5]=\"RECT\",t[t.TEXT=6]=\"TEXT\",t[t.GROUP=7]=\"GROUP\"}(fi||(fi={})),function(t){t[t.DEFAULT=0]=\"DEFAULT\",t[t.SELECTED=1]=\"SELECTED\"}(gi||(gi={}));class wi{get mediaType(){return new Map([[\"rect\",ii.DIMT_RECTANGLE],[\"quad\",ii.DIMT_QUADRILATERAL],[\"text\",ii.DIMT_TEXT],[\"arc\",ii.DIMT_ARC],[\"image\",ii.DIMT_IMAGE],[\"polygon\",ii.DIMT_POLYGON],[\"line\",ii.DIMT_LINE],[\"group\",ii.DIMT_GROUP]]).get(this._mediaType)}get styleSelector(){switch(Xe(this,ci,\"f\")){case ri.DIS_DEFAULT:return\"default\";case ri.DIS_SELECTED:return\"selected\"}}set drawingStyleId(t){this.styleId=t}get drawingStyleId(){return this.styleId}set coordinateBase(t){if(![\"view\",\"image\"].includes(t))throw new Error(\"Invalid 'coordinateBase'.\");this._drawingLayer&&(\"image\"===Xe(this,ui,\"f\")&&\"view\"===t?this.updateCoordinateBaseFromImageToView():\"view\"===Xe(this,ui,\"f\")&&\"image\"===t&&this.updateCoordinateBaseFromViewToImage()),ze(this,ui,t,\"f\")}get coordinateBase(){return Xe(this,ui,\"f\")}get drawingLayerId(){return this._drawingLayerId}constructor(t,e){if(li.add(this),ci.set(this,void 0),ui.set(this,\"image\"),this._zIndex=null,this._drawingLayer=null,this._drawingLayerId=null,this._mapState_StyleId=new Map,this.mapEvent_Callbacks=new Map([[\"selected\",new Map],[\"deselected\",new Map],[\"mousedown\",new Map],[\"mouseup\",new Map],[\"dblclick\",new Map],[\"mouseover\",new Map],[\"mouseout\",new Map]]),this.mapNoteName_Content=new Map([]),this.isDrawingItem=!0,null!=e&&!ai(e))throw new TypeError(\"Invalid 'drawingStyleId'.\");t&&this._setFabricObject(t),this.setState(ri.DIS_DEFAULT),this.styleId=e}_setFabricObject(t){this._fabricObject=t,this._fabricObject.on(\"selected\",(()=>{this.setState(ri.DIS_SELECTED)})),this._fabricObject.on(\"deselected\",(()=>{this._fabricObject.canvas&&this._fabricObject.canvas.getActiveObjects().includes(this._fabricObject)?this.setState(ri.DIS_SELECTED):this.setState(ri.DIS_DEFAULT),\"textbox\"===this._fabricObject.type&&(this._fabricObject.isEditing&&this._fabricObject.exitEditing(),this._fabricObject.selected=!1)})),t.getDrawingItem=()=>this}_getFabricObject(){return this._fabricObject}setState(t){ze(this,ci,t,\"f\")}getState(){return Xe(this,ci,\"f\")}_on(t,e){if(!e)return;const i=t.toLowerCase(),r=this.mapEvent_Callbacks.get(i);if(!r)throw new Error(`Event '${t}' does not exist.`);let n=r.get(e);n||(n=t=>{const i=t.e;if(!i)return void(e&&e.apply(this,[{targetItem:this,itemClientX:null,itemClientY:null,itemPageX:null,itemPageY:null}]));const r={targetItem:this,itemClientX:null,itemClientY:null,itemPageX:null,itemPageY:null};if(this._drawingLayer){let t,e,n,s;const o=i.target.getBoundingClientRect();t=o.left,e=o.top,n=t+window.scrollX,s=e+window.scrollY;const{width:a,height:h}=this._drawingLayer.fabricCanvas.lowerCanvasEl.getBoundingClientRect(),l=this._drawingLayer.width,c=this._drawingLayer.height,u=a/h,d=l/c,f=this._drawingLayer._getObjectFit();let g,m,p,_,v=1;if(\"contain\"===f)u<d?(v=a/l,g=t+this.get(\"x\")*v,m=e+this.get(\"y\")*v+(h-c*v)/2,p=n+this.get(\"x\")*v,_=s+this.get(\"y\")*v+(h-c*v)/2):(v=h/c,g=t+this.get(\"x\")*v+(a-l*v)/2,m=e+this.get(\"y\")*v,p=n+this.get(\"x\")*v+(a-l*v)/2,_=s+this.get(\"y\")*v);else if(\"cover\"===f)if(u<d){v=h/c;let i=this.get(\"x\")*v-(l*v-a)/2;i=Math.max(i,0),i=Math.min(i,a),g=t+i,m=e+this.get(\"y\")*v,p=n+i,_=s+this.get(\"y\")*v}else{v=a/l;let i=this.get(\"y\")*v-(c*v-h)/2;i=Math.max(i,0),i=Math.min(i,h),g=t+this.get(\"x\")*v,m=e+i,p=n+this.get(\"x\")*v,_=s+i}r.itemClientX=Math.round(g),r.itemClientY=Math.round(m),r.itemPageX=Math.round(p),r.itemPageY=Math.round(_)}for(let t of Object.getOwnPropertyNames(r))Object.defineProperty(i,t,{value:r[t],writable:!0});e&&e.apply(this,[i])},r.set(e,n),this._fabricObject.on(\"dblclick\"===i?\"mousedblclick\":i,n))}on(t,e){this._on(t,e)}_off(t,e){const i=t.toLowerCase(),r=this.mapEvent_Callbacks.get(i);if(!r)throw new Error(`Event '${t}' does not exist.`);let n=r.get(e);n&&(r.delete(e),this._fabricObject.off(\"dblclick\"===i?\"mousedblclick\":i,n))}off(t,e){this._off(t,e)}_setEditable(t){const e=this._fabricObject;
2t?(e.selectable=!0,e.hasControls=!0,e.hoverCursor=null):(e.selectable=!1,e.hasControls=!1,e.hoverCursor=\"default\")}hasNote(t){return this.mapNoteName_Content.has(t)}addNote(t,e){if(this.hasNote(t.name)&&!e)throw new Error(\"A note with the same name already exists, please use a different name.\");const i=t.content?JSON.parse(JSON.stringify(t.content)):t.content;this.mapNoteName_Content.set(t.name,[i])}getNote(t){const e=this.mapNoteName_Content.get(t);return e?1===e.length?{name:t,content:e[0]?JSON.parse(JSON.stringify(e[0])):e[0]}:{name:t,content:JSON.parse(JSON.stringify(e))}:null}getNotes(){const t=[];for(let e of this.mapNoteName_Content){let i=1===e[1].length?e[1][0]:e[1];i=i?JSON.parse(JSON.stringify(i)):i,t.push({name:e[0],content:i})}return t}updateNote(t,e,i){const r=this.mapNoteName_Content.get(t);if(!r)throw new Error(\"The note name does not exist.\");i||(r.length=0),e=e?JSON.parse(JSON.stringify(e)):e,r.push(e)}deleteNote(t){this.mapNoteName_Content.delete(t)}clearNotes(){this.mapNoteName_Content.clear()}set(t,e){if(!this.extendSet(t,e))if(\"x\"===t){const t=this._fabricObject.group;t?(this._fabricObject.set(\"left\",e-t.left-t.width/2),t.addWithUpdate()):this._fabricObject.set(\"left\",e)}else if(\"y\"===t){const t=this._fabricObject.group;t?(this._fabricObject.set(\"top\",e-t.top-t.height/2),t.addWithUpdate()):this._fabricObject.set(\"top\",e)}else\"styleId\"===t?this.styleId=e:this._fabricObject.set(t,e);[\"vertices\",\"startPoint\",\"endPoint\",\"x\",\"y\",\"left\",\"top\",\"width\",\"height\",\"scaleX\",\"scaleY\",\"skewX\",\"skewY\",\"padding\",\"angle\",\"strokeWidth\"].includes(t)&&this._fabricObject.setCoords()}get(t){let e=this.extendGet(t);if(void 0===e)if(\"x\"===t){const t=this._fabricObject.group;e=t?this._fabricObject.get(\"left\")+t.left+t.width/2:this._fabricObject.get(\"left\")}else if(\"y\"===t){const t=this._fabricObject.group;e=t?this._fabricObject.get(\"top\")+t.top+t.height/2:this._fabricObject.get(\"top\")}else e=\"scaledWidth\"===t?this._fabricObject.getScaledWidth():\"scaledHeight\"===t?this._fabricObject.getScaledHeight():[\"type\",\"mediaType\"].includes(t)?this.mediaType:\"state\"===t?this.getState():\"styleId\"===t?this.styleId:\"drawingLayerId\"===t?this.drawingLayerId:this._fabricObject.get(t);return e}remove(){this._drawingLayer&&this._drawingLayer.removeDrawingItems([this])}convertPropFromImageToView(t){if(\"number\"!=typeof t)throw new TypeError(\"Invalid value.\");return t*Xe(this,li,\"m\",di).call(this)}convertPropFromViewToImage(t){if(\"number\"!=typeof t)throw new TypeError(\"Invalid value.\");return t/Xe(this,li,\"m\",di).call(this)}_setLineWidth(t){if(this._drawingLayer)if(\"view\"===this.coordinateBase)this.set(\"strokeWidth\",this.convertPropFromViewToImage(t));else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"strokeWidth\",t)}}_getLineWidth(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return this.convertPropFromImageToView(this.get(\"strokeWidth\"));if(\"image\"===this.coordinateBase)return this.get(\"strokeWidth\");throw new Error(\"Invalid 'coordinateBase'.\")}}_setFontSize(t){if(this._drawingLayer)if(\"view\"===this.coordinateBase)this.set(\"fontSize\",this.convertPropFromViewToImage(t));else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"fontSize\",t)}}_getFontSize(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return this.convertPropFromImageToView(this.get(\"fontSize\"));if(\"image\"===this.coordinateBase)return this.get(\"fontSize\");throw new Error(\"Invalid 'coordinateBase'.\")}}}ci=new WeakMap,ui=new WeakMap,li=new WeakSet,di=function(){const t=this._drawingLayer;if(!t)return 1;const e=t.width,i=t.height,{width:r,height:n}=t.fabricCanvas.wrapperEl.getBoundingClientRect();if(r<=0||n<=0)throw new Error(\"Unable to get drawing layer dimensions. Layer may not be rendered on the page.\");const s=r/e,o=n/i,a=t._getObjectFit();let h=1;return\"contain\"===a?h=s<o?r/e:n/i:\"cover\"===a&&(h=s<o?n/i:r/e),h},wi.arrMediaTypes=[\"rect\",\"arc\",\"polygon\",\"image\",\"text\",\"line\",\"quad\"],wi.mapItemType=new Map([[fi.ARC,\"arc\"],[fi.IMAGE,\"image\"],[f
2i.LINE,\"line\"],[fi.POLYGON,\"polygon\"],[fi.QUAD,\"quad\"],[fi.RECT,\"rect\"],[fi.TEXT,\"text\"],[fi.GROUP,\"group\"]]),wi.arrStyleSelectors=[\"default\",\"selected\"],wi.mapItemState=new Map([[gi.DEFAULT,\"default\"],[gi.SELECTED,\"selected\"]]);class Ci extends wi{constructor(t,e){if(super(null,e),mi.set(this,void 0),!I(t))throw new TypeError(\"Invalid 'rect'.\");this._setFabricObject(new oi.Rect({left:t.x,top:t.y,width:t.width,height:t.height})),ze(this,mi,JSON.parse(JSON.stringify(t)),\"f\"),this._mediaType=\"rect\"}extendSet(t,e){return!1}extendGet(t){}updateCoordinateBaseFromImageToView(){this.set(\"left\",this.convertPropFromViewToImage(this.get(\"left\"))),this.set(\"top\",this.convertPropFromViewToImage(this.get(\"top\"))),this.set(\"width\",this.convertPropFromViewToImage(this.get(\"scaledWidth\"))),this.set(\"height\",this.convertPropFromViewToImage(this.get(\"scaledHeight\")))}updateCoordinateBaseFromViewToImage(){this.set(\"left\",this.convertPropFromImageToView(this.get(\"left\"))),this.set(\"top\",this.convertPropFromImageToView(this.get(\"top\"))),this.set(\"width\",this.convertPropFromImageToView(this.get(\"scaledWidth\"))),this.set(\"height\",this.convertPropFromImageToView(this.get(\"scaledHeight\")))}setPosition(t){this.setRect(t)}getPosition(){return this.getRect()}updatePosition(){Xe(this,mi,\"f\")&&this.setRect(Xe(this,mi,\"f\"))}setRect(t){if(!I(t))throw new TypeError(\"Invalid 'rect'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase)this.set(\"left\",this.convertPropFromViewToImage(t.x)),this.set(\"top\",this.convertPropFromViewToImage(t.y)),this.set(\"width\",this.convertPropFromViewToImage(t.width)),this.set(\"height\",this.convertPropFromViewToImage(t.height));else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"left\",t.x),this.set(\"top\",t.y),this.set(\"width\",t.width),this.set(\"height\",t.height)}this._drawingLayer.renderAll()}else ze(this,mi,JSON.parse(JSON.stringify(t)),\"f\")}getRect(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{x:this.convertPropFromImageToView(this.get(\"left\")),y:this.convertPropFromImageToView(this.get(\"top\")),width:this.convertPropFromImageToView(this.get(\"scaledWidth\")),height:this.convertPropFromImageToView(this.get(\"scaledHeight\"))};if(\"image\"===this.coordinateBase)return{x:this.get(\"left\"),y:this.get(\"top\"),width:this.get(\"scaledWidth\"),height:this.get(\"scaledHeight\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,mi,\"f\")?JSON.parse(JSON.stringify(Xe(this,mi,\"f\"))):null}}function Ei(t,e,i){let r=i.points[this.pointIndex].x-i.pathOffset.x,n=i.points[this.pointIndex].y-i.pathOffset.y;return oi.util.transformPoint({x:r,y:n},i.calcTransformMatrix())}function Ti(t){let e=new oi.Point(t.strokeUniform?1/t.scaleX:1,t.strokeUniform?1/t.scaleY:1).multiply(t.strokeWidth);return new oi.Point(t.width+e.x,t.height+e.y)}function Si(t,e,i,r){let n=e.target,s=n.controls[n.__corner],o=n.toLocalPoint(new oi.Point(i,r),\"center\",\"center\"),a=Ti(n),h=n._getTransformedDimensions(0,0),l={x:o.x*a.x/h.x+n.pathOffset.x,y:o.y*a.y/h.y+n.pathOffset.y};return n.points[s.pointIndex]=l,oi.controlsUtils.fireEvent(\"scaling\",{e:t,transform:e,pointer:{x:i,y:r}}),!0}function bi(t,e){return function(i,r,n,s){let o=r.target,a=oi.util.transformPoint({x:o.points[t].x-o.pathOffset.x,y:o.points[t].y-o.pathOffset.y},o.calcTransformMatrix()),h=e(i,r,n,s);o._setPositionDimensions({});let l=Ti(o),c=(o.points[t].x-o.pathOffset.x)/l.x,u=(o.points[t].y-o.pathOffset.y)/l.y;return o.setPositionByOrigin(a,c+.5,u+.5),h}}mi=new WeakMap;class Ii extends wi{constructor(t,e){if(super(null,e),pi.set(this,void 0),!S(t))throw new TypeError(\"Invalid 'polygon'.\");this._setFabricObject(new oi.Polygon(t.points,{objectCaching:!1}));const i=this._fabricObject;let r=i.points.length-1;i.controls=i.points.reduce((function(t,e,i){return t[\"p\"+i]=new oi.Control({positionHandler:Ei,actionHandler:bi(i>0?i-1:r,Si),actionName:\"modifyPolygon\",pointIndex:i}),t}),{}),ze(this,pi,JSON.parse(JSON.stringify(t)),\"f\"),this._mediaType=\"polygon\"}extendSet(t,e){if(\"vertices\"===t){const t=this._fabricObject;if(t.group){const i=t.group;t.points=e.map((t=>({x:t.x-i.left-i.width/2,y:t.y-i.top-i.height/2}))),i.addWithUpdate()}else t.points=e;const i=t.points.length-1;return t.controls=t.points.reduce((function(t,e,r){return t[\"p\"+r]=new oi.Control({positionHandler:Ei,actionHandler:bi(r>0?r-1:i,Si),actionName:\"modifyPolygon\",pointIndex:r}),t}),{}),t._setPositionDimensions({}),!0}}extendGet(t){if(\"vertices\"===t){const t=[],e=this._fabricObject;if(e.selectable&&!e.group)for(let i in e.oCoords)t.push({x:e.oCoords[i].x,y:e.oCoords[i].y});else for(let i of e.points){let r=i.x-e.pathOffset.x,n=i.y-e.pathOffset.
2y;const s=oi.util.transformPoint({x:r,y:n},e.calcTransformMatrix());t.push({x:s.x,y:s.y})}return t}}updateCoordinateBaseFromImageToView(){const t=this.get(\"vertices\").map((t=>({x:this.convertPropFromViewToImage(t.x),y:this.convertPropFromViewToImage(t.y)})));this.set(\"vertices\",t)}updateCoordinateBaseFromViewToImage(){const t=this.get(\"vertices\").map((t=>({x:this.convertPropFromImageToView(t.x),y:this.convertPropFromImageToView(t.y)})));this.set(\"vertices\",t)}setPosition(t){this.setPolygon(t)}getPosition(){return this.getPolygon()}updatePosition(){Xe(this,pi,\"f\")&&this.setPolygon(Xe(this,pi,\"f\"))}setPolygon(t){if(!S(t))throw new TypeError(\"Invalid 'polygon'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase){const e=t.points.map((t=>({x:this.convertPropFromViewToImage(t.x),y:this.convertPropFromViewToImage(t.y)})));this.set(\"vertices\",e)}else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"vertices\",t.points)}this._drawingLayer.renderAll()}else ze(this,pi,JSON.parse(JSON.stringify(t)),\"f\")}getPolygon(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{points:this.get(\"vertices\").map((t=>({x:this.convertPropFromImageToView(t.x),y:this.convertPropFromImageToView(t.y)})))};if(\"image\"===this.coordinateBase)return{points:this.get(\"vertices\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,pi,\"f\")?JSON.parse(JSON.stringify(Xe(this,pi,\"f\"))):null}}pi=new WeakMap;_i=new WeakMap,vi=new WeakMap;const xi=t=>{let e=(t=>t.split(\"\\n\").map((t=>t.split(\"\\t\"))))(t);return(t=>{for(let e=0;;e++){let i=-1;for(let r=0;r<t.length;r++){let n=t[r][e];void 0!==n&&n.length>i&&(i=n.length)}if(-1===i)break;for(let r=0;r<t.length;r++){if(e>=t[r].length-1)continue;let n=\" \".repeat(i+2-t[r][e].length);t[r][e]=t[r][e].concat(n)}}})(e),(t=>{let e=\"\";for(let i=0;i<t.length;i++)e=e.concat(...t[i],i===t.length-1?\"\":\"\\n\");return e})(e)};class Oi extends wi{constructor(t,e,i){if(super(null,i),yi.set(this,void 0),!hi(t))throw new TypeError(\"Invalid 'text'.\");if(!I(e))throw new TypeError(\"Invalid 'rect'.\");this._setFabricObject(new oi.Textbox(xi(t),{left:e.x,top:e.y,width:e.width})),this._text=t,ze(this,yi,JSON.parse(JSON.stringify(e)),\"f\"),this._mediaType=\"text\"}extendSet(t,e){if(\"text\"===t)return this._text=e,this._fabricObject.set(\"text\",xi(e)),!0}extendGet(t){if(\"text\"===t)return this._text}updateCoordinateBaseFromImageToView(){this.set(\"left\",this.convertPropFromViewToImage(this.get(\"left\"))),this.set(\"top\",this.convertPropFromViewToImage(this.get(\"top\"))),this.set(\"width\",this.convertPropFromViewToImage(this.get(\"scaledWidth\")))}updateCoordinateBaseFromViewToImage(){this.set(\"left\",this.convertPropFromImageToView(this.get(\"left\"))),this.set(\"top\",this.convertPropFromImageToView(this.get(\"top\"))),this.set(\"width\",this.convertPropFromImageToView(this.get(\"scaledWidth\")))}setPosition(t){this.setTextRect(t)}getPosition(){return this.getTextRect()}updatePosition(){Xe(this,yi,\"f\")&&this.setTextRect(Xe(this,yi,\"f\"))}setText(t){if(!hi(t))throw new TypeError(\"Invalid 'text'.\");this.set(\"text\",t)}getText(){return this.get(\"text\")}setTextRect(t){if(!I(t))throw new TypeError(\"Invalid 'rect'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase)this.set(\"left\",this.convertPropFromViewToImage(t.x)),this.set(\"top\",this.convertPropFromViewToImage(t.y)),this.set(\"width\",this.convertPropFromViewToImage(t.width));else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"left\",t.x),this.set(\"top\",t.y),this.set(\"width\",t.width)}this._drawingLayer.renderAll()}else ze(this,yi,JSON.parse(JSON.stringify(t)),\"f\")}getTextRect(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{x:this.convertPropFromImageToView(this.get(\"left\")),y:this.convertPropFromImageToView(this.get(\"top\")),width:this.convertPropFromImageToView(this.get(\"scaledWidth\")),height:this.convertPropFromImageToView(this.get(\"scaledHeight\"))};if(\"image\"===this.coordinateBase)return{x:this.get(\"left\"),y:this.get(\"top\"),width:this.get(\"scaledWidth\"),height:this.get(\"scaledHeight\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,yi,\"f\")?JSON.parse(JSON.stringify(Xe(this,yi,\"f\"))):null}}var Ai,Ri;yi=new WeakMap;Ai=new WeakMap;class Di extends Ii{constructor(t,e){if(super({points:null==t?void 0:t.points},e),Ri.set(this,void 0),!b(t))throw new TypeError(\"Invalid 'quad'.\");ze(this,Ri,JSON.parse(JSON.stringify(t)),\"f\"),this._mediaType=\"quad\"}setPosition(t){this.setQuad(t)}getPosition(){return this.getQuad()}updatePosition(){Xe(this,Ri,\"f\")&&this.setQuad(Xe(this,Ri,\"f\"))}setPolygon(){}getPolygon(){return null}setQuad(t){if(!b(t))throw new TypeError(\"Invalid 'quad'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase){const e=t.points.map((t=>({x:this.convertPropFromViewToImage(t.x),y:this.convertPropFromViewToImage(t.y)})));this.set(\"vertices\",e)}else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"vertices\",t.points)}this._drawingLayer.renderAll()}else ze(this,Ri,JSON.parse(JSON.stringify(t)),\"f\")}getQuad(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{points:this.get(\"vertices\").map((t=>({x:this.convertPropFromImageToView(t.x),y:this.convertPropFromImageToView(t.y)})))};if(\"image\"===this.coordinateBase)return{points:this.get(\"vertices\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,Ri,\"f\")?JSON.parse(JSON.stringify(Xe(this,Ri,\"f\"))):null}}Ri=new WeakMap;class Li extends wi{constructor(t){super(new oi.Group(t.map((t=>t._getFabricObject())))),this._fabricObject.on(\"selected\",(()=>{this.setState(ri.DIS_SELECTED);const t=this._fabricObject._objects;for(let e of t)setTimeout((()=>{e&&e.fire(\"selected\")}),0);setTimeout((()=>{this._fabricObject&&this._fabricObject.canvas&&(this._fabricObject.dirty=!0,this._fabricObject.canvas.renderAll())}),0)})),this._fabricObject.on(\"deselected\",(()=>{this.setState(ri.DIS_DEFAULT);const t=this._fabricObject._objects;for(let e of t)setTimeout((()=>{e&&e.fire(\"deselected\")}),0);setTimeout((()=>{this._fabricObject&&this._fabricObject.canvas&&(this._fabricObject.dirty=!0,this._fabricObject.canvas.renderAll())}),0)})),this._mediaType=\"group\"}extendSet(t,e){return!1}extendGet(t){}updateCoordinateBaseFromImageToView(){}updateCoordinateBaseFromViewToImage(){}setPosition(){}getPosition(){}updatePosition(){}getChildDrawingItems(){return this._fabricObject._objects.map((t=>t.getDrawingItem()))}setChildDrawingItems(t){if(!t||!t.isDrawingItem)throw TypeError(\"Illegal drawing item.\");this._drawingLayer?this._drawingLayer._updateGroupItem(this,t,\"add\"):this._fabricObject.addWithUpdate(t._getFabricObject())}removeChildItem(t){t&&t.isDrawingItem&&(this._drawingLayer?this._drawingLayer._updateGroupItem(this,t,\"remove\"):this._fabricObject.removeWithUpdate(t._getFabricObject()))}}const Mi=t=>null!==t&&\"object\"==typeof t&&!Array.isArray(t),Fi=t=>!!hi(t)&&\"\"!==t,Pi=t=>!(!Mi(t)||\"id\"in t&&!ai(t.id)||\"lineWidth\"in t&&!ai(t.lineWidth)||\"fillStyle\"in t&&!Fi(t.fillStyle)||\"strokeStyle\"in t&&!Fi(t.strokeStyle)||\"paintMode\"in t&&![\"fill\",\"stroke\",\"strokeAndFill\"].includes(t.paintMode)||\"fontFamily\"in t&&!Fi(t.fontFamily)||\"fontSize\"in t&&!ai(t.fontSize));class ki{static convert(t,e,i){const r={x:0,y:0,width:e,height:i};if(!t)return r;if(I(t))t.isMeasuredInPercentage?(r.x=t.x/100*e,r.y=t.y/100*i,r.width=t.width/100*e,r.height=t.height/100*i):(r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height);else{if(!w(t))throw TypeError(\"Invalid region.\");t.isMeasuredInPercentage?(r.x=t.left/100*e,r.y=t.top/100*i,r.width=(t.right-t.left)/100*e,r.height=(t.bottom-t.top)/100*i):(r.x=t.left,r.y=t.top,r.width=t.right-t.left,r.height=t.bottom-t.top)}return r.x=Math.round(r.x),r.y=Math.round(r.y),r.width=Math.round(r.width),r.height=Math.round(r.height),r}}var Bi,Ni;class ji{constructor(){Bi.set(this,new Map),Ni.set(this,!1)}get disposed(){return Xe(this,Ni,\"f\")}on(t,e){t=t.toLowerCase();const i=Xe(this,Bi,\"f\").get(t);if(i){if(i.includes(e))return;i.push(e)}else Xe(this,Bi,\"f\").set(t,[e])}off(t,e){t=t.toLowerCase();const i=Xe(this,Bi,\"f\").get(t);if(!i)return;const r=i.indexOf(e);-1!==r&&i.splice(r,1)}offAll(t){t=t.toLowerCase();const e=Xe(this,Bi,\"f\").get(t);e&&(e.length=0)}fire(t,e=[],i={async:!1,copy:!0}){e||(e=[]),t=t.toLowerCase();const r=Xe(this,Bi,\"f\").get(t);if(r&&r.length){i=Object.assign({async:!1,copy:!0},i);for(let n of r){if(!n)continue;let s=[];if(i.copy)for(let i of e){try{i=JSON.parse(JSON.stringify(i))}catch(t){}s.push(i)}else s=e;let o=!1;if(i.async)setTimeout((()=>{this.disposed||r.includes(n)&&n.apply(i.target,s)}),0);else try{o=n.apply(i.target,s)}catch(t){}if(!0===o)break}}}dispose(){ze(this,Ni,!0,\"f\")}}
vendor: 4,651 bytes, line 2
2function Ui(t,e,i){return(i.x-t.x)*(e.y-t.y)==(e.x-t.x)*(i.y-t.y)&&Math.min(t.x,e.x)<=i.x&&i.x<=Math.max(t.x,e.x)&&Math.min(t.y,e.y)<=i.y&&i.y<=Math.max(t.y,e.y)}function Vi(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function Gi(t,e,i,r){let n=t[0]*(i[1]-e[1])+e[0]*(t[1]-i[1])+i[0]*(e[1]-t[1]),s=t[0]*(r[1]-e[1])+e[0]*(t[1]-r[1])+r[0]*(e[1]-t[1]);return!((n^s)>=0&&0!==n&&0!==s||(n=i[0]*(t[1]-r[1])+r[0]*(i[1]-t[1])+t[0]*(r[1]-i[1]),s=i[0]*(e[1]-r[1])+r[0]*(i[1]-e[1])+e[0]*(r[1]-i[1]),(n^s)>=0&&0!==n&&0!==s))}Bi=new WeakMap,Ni=new WeakMap;const Wi=async t=>{if(\"string\"!=typeof t)throw new TypeError(\"Invalid url.\");const e=await fetch(t);if(!e.ok)throw Error(\"Network Error: \"+e.statusText);const i=await e.text();if(!i.trim().startsWith(\"<\"))throw Error(\"Unable to get valid HTMLElement.\");const r=document.createElement(\"div\");if(r.insertAdjacentHTML(\"beforeend\",i),1===r.childElementCount&&r.firstChild instanceof HTMLTemplateElement)return r.firstChild.content;const n=new DocumentFragment;for(let t of r.children)n.append(t);return n};var Yi,Hi,Xi,zi,Zi,qi,Ki,Ji,Qi,$i,tr,er,ir,rr,nr,sr,or,ar,hr,lr,cr,ur,dr,fr,gr,mr,pr,_r,vr,yr,wr,Cr,Er,Tr;class Sr{static createDrawingStyle(t){if(!Pi(t))throw new Error(\"Invalid style definition.\");let e,i=Sr.USER_START_STYLE_ID;for(;Xe(Sr,Yi,\"f\",Hi).has(i);)i++;e=i;const r=JSON.parse(JSON.stringify(t));r.id=e;for(let t in Xe(Sr,Yi,\"f\",Xi))r.hasOwnProperty(t)||(r[t]=Xe(Sr,Yi,\"f\",Xi)[t]);return Xe(Sr,Yi,\"f\",Hi).set(e,r),r.id}static _getDrawingStyle(t,e){if(\"number\"!=typeof t)throw new Error(\"Invalid style id.\");const i=Xe(Sr,Yi,\"f\",Hi).get(t);return i?e?JSON.parse(JSON.stringify(i)):i:null}static getDrawingStyle(t){return this._getDrawingStyle(t,!0)}static getAllDrawingStyles(){return JSON.parse(JSON.stringify(Array.from(Xe(Sr,Yi,\"f\",Hi).values())))}static _updateDrawingStyle(t,e){if(!Pi(e))throw new Error(\"Invalid style definition.\");const i=Xe(Sr,Yi,\"f\",Hi).get(t);if(i)for(let t in e)i.hasOwnProperty(t)&&(i[t]=e[t])}static updateDrawingStyle(t,e){this._updateDrawingStyle(t,e)}}Yi=Sr,Sr.STYLE_BLUE_STROKE=1,Sr.STYLE_GREEN_STROKE=2,Sr.STYLE_ORANGE_STROKE=3,Sr.STYLE_YELLOW_STROKE=4,Sr.STYLE_BLUE_STROKE_FILL=5,Sr.STYLE_GREEN_STROKE_FILL=6,Sr.STYLE_ORANGE_STROKE_FILL=7,Sr.STYLE_YELLOW_STROKE_FILL=8,Sr.STYLE_BLUE_STROKE_TRANSPARENT=9,Sr.STYLE_GREEN_STROKE_TRANSPARENT=10,Sr.STYLE_ORANGE_STROKE_TRANSPARENT=11,Sr.USER_START_STYLE_ID=1024,Hi={value:new Map([[Sr.STYLE_BLUE_STROKE,{id:Sr.STYLE_BLUE_STROKE,lineWidth:4,fillStyle:\"rgba(73, 173, 245, 0.3)\",strokeStyle:\"rgba(73, 173, 245, 1)\",paintMode:\"stroke\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_GREEN_STROKE,{id:Sr.STYLE_GREEN_STROKE,lineWidth:2,fillStyle:\"rgba(73, 245, 73, 0.3)\",strokeStyle:\"rgba(73, 245, 73, 0.9)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_ORANGE_STROKE,{id:Sr.STYLE_ORANGE_STROKE,lineWidth:2,fillStyle:\"rgba(254, 180, 32, 0.3)\",strokeStyle:\"rgba(254, 180, 32, 0.9)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_YELLOW_STROKE,{id:Sr.STYLE_YELLOW_STROKE,lineWidth:2,fillStyle:\"rgba(245, 236, 73, 0.3)\",strokeStyle:\"rgba(245, 236, 73, 1)\",paintMode:\"stroke\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_BLUE_STROKE_FILL,{id:Sr.STYLE_BLUE_STROKE_FILL,lineWidth:4,fillStyle:\"rgba(73, 173, 245, 0.3)\",strokeStyle:\"rgba(73, 173, 245, 1)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_GREEN_STROKE_FILL,{id:Sr.STYLE_GREEN_STROKE_FILL,lineWidth:2,fillStyle:\"rgba(73, 245, 73, 0.3)\",strokeStyle:\"rgba(73, 245, 73, 0.9)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_ORANGE_STROKE_FILL,{id:Sr.STYLE_ORANGE_STROKE_FILL,lineWidth:2,fillStyle:\"rgba(254, 180, 32, 0.3)\",strokeStyle:\"rgba(254, 180, 32, 1)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_YELLOW_STROKE_FILL,{id:Sr.STYLE_YELLOW_STROKE_FILL,lineWidth:2,fillStyle:\"rgba(245, 236, 73, 0.3)\",strokeStyle:\"rgba(245, 236, 73, 1)\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_BLUE_STROKE_TRANSPARENT,{id:Sr.STYLE_BLUE_STROKE_TRANSPARENT,lineWidth:4,fillStyle:\"rgba(73, 173, 245, 0.2)\",strokeStyle:\"transparent\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_GREEN_STROKE_TRANSPARENT,{id:Sr.STYLE_GREEN_STROKE_TRANSPARENT,lineWidth:2,fillStyle:\"rgba(73, 245, 73, 0.2)\",strokeStyle:\"transparent\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}],[Sr.STYLE_ORANGE_STROKE_TRANSPARENT,{id:Sr.STYLE_ORANGE_STROKE_TRANSPARENT,lineWidth:2,fillStyle:\"rgba(254, 180, 32, 
20.2)\",strokeStyle:\"transparent\",paintMode:\"strokeAndFill\",fontFamily:\"consolas\",fontSize:40}]])},Xi={value:{lineWidth:2,fillStyle:\"rgba(245, 236, 73, 0.3)\",strokeStyle:\"rgba(245, 236, 73, 1)\",paintMode:\"stroke\",fontFamily:\"consolas\",fontSize:40}},\"undefined\"!=typeof document&&\"undefined\"!=typeof window&&(oi.StaticCanvas.prototype.dispose=function(){return this.isRendering&&(oi.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove(\"lower-canvas\"),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute(\"width\",this.width),this.lowerCanvasEl.setAttribute(\"height\",this.height),oi.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},oi.Object.prototype.transparentCorners=!1,oi.Object.prototype.cornerSize=20,oi.Object.prototype.touchCornerSize=100,oi.Object.prototype.cornerColor=\"rgb(254,142,20)\",oi.Object.prototype.cornerStyle=\"circle\",oi.Object.prototype.strokeUniform=!0,oi.Object.prototype.hasBorders=!1,oi.Canvas.prototype.containerClass=\"\",oi.Canvas.prototype.getPointer=function(t,e){if(this._absolutePointer&&!e)return this._absolutePointer;if(this._pointer&&e)return this._pointer;var i,r=this.upperCanvasEl,n=oi.util.getPointer(t,r),s=r.getBoundingClientRect(),o=s.width||0,a=s.height||0;o&&a||(\"top\"in s&&\"bottom\"in s&&(a=Math.abs(s.top-s.bottom)),\"right\"in s&&\"left\"in s&&(o=Math.abs(s.right-s.left))),this.calcOffset(),n.x=n.x-this._offset.left,n.y=n.y-this._offset.top,e||(n=this.restorePointerVpt(n));var h=this.getRetinaScaling();
2if(1!==h&&(n.x/=h,n.y/=h),0!==o&&0!==a){var l=window.getComputedStyle(r).objectFit,c=r.width,u=r.height,d=o,f=a;i={width:c/d,height:u/f};var g,m,p=c/u,_=d/f;return\"contain\"===l?p>_?(g=d,m=d/p,{x:n.x*i.width,y:(n.y-(f-m)/2)*i.width}):(g=f*p,m=f,{x:(n.x-(d-g)/2)*i.height,y:n.y*i.height}):\"cover\"===l?p>_?{x:(c-i.height*d)/2+n.x*i.height,y:n.y*i.height}:{x:n.x*i.width,y:(u-i.width*f)/2+n.y*i.width}:{x:n.x*i.width,y:n.y*i.height}}return i={width:1,height:1},{x:n.x*i.width,y:n.y*i.height}},oi.Canvas.prototype._onTouchStart=function(t){var e=this.findTarget(t);!this.allowTouchScrolling&&t.cancelable&&t.preventDefault&&t.preventDefault(),e&&t.cancelable&&t.preventDefault&&t.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(t)),this.__onMouseDown(t),this._resetTransformEventData();var i=this.upperCanvasEl,r=this._getEventPrefix();oi.util.addListener(oi.document,\"touchend\",this._onTouchEnd,{passive:!1}),oi.util.addListener(oi.document,\"touchmove\",this._onMouseMove,{passive:!1}),oi.util.removeListener(i,r+\"down\",this._onMouseDown)},oi.Textbox.prototype._wrapLine=function(t,e,i,r){const n=t.match(/[\\u3040-\\u30ff\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\uff66-\\uff9f]/g),s=!(!n||!n.length);var o=0,a=this.splitByGrapheme||s,h=[],l=[],c=a?oi.util.string.graphemeSplit(t):t.split(this._wordJoiners),u=\"\",d=0,f=a?\"\":\" \",g=0,m=0,p=0,_=!0,v=this._getWidthOfCharSpacing();r=r||0,0===c.length&&c.push([]),i-=r;for(var y=0;y<c.length;y++)u=a?c[y]:oi.util.string.graphemeSplit(c[y]),g=this._measureWord(u,e,d),d+=u.length,(o+=m+g-v)>i&&!_?(h.push(l),l=[],o=g,_=!0):o+=v,_||a||l.push(f),l=l.concat(u),m=a?0:this._measureWord([f],e,d),d++,_=!1,g>p&&(p=g);return y&&h.push(l),p+r>this.dynamicMinWidth&&(this.dynamicMinWidth=p-v+r),h});class br{get width(){return this.fabricCanvas.width}get height(){return this.fabricCanvas.height}set _allowMultiSelect(t){this.fabricCanvas.selection=t,this.fabricCanvas.renderAll()}get _allowMultiSelect(){return this.fabricCanvas.selection}constructor(t,e,i){if(this.mapType_StateAndStyleId=new Map,this.mode=\"viewer\",this.onSelectionChanged=null,this._arrDrwaingItem=[],this._arrFabricObject=[],this._visible=!0,t.hasOwnProperty(\"getFabricCanvas\"))this.fabricCanvas=t.getFabricCanvas();else{let e=this.fabricCanvas=new oi.Canvas(t,Object.assign(i,{allowTouchScrolling:!0,selection:!1}));e.setDimensions({width:\"100%\",height:\"100%\"},{cssOnly:!0}),e.lowerCanvasEl.className=\"\",e.upperCanvasEl.className=\"\",e.on(\"selection:created\",(function(t){const e=t.selected,i=[];for(let t of e){const e=t.getDrawingItem()._drawingLayer;e&&!i.includes(e)&&i.push(e)}for(let t of i){const i=[];for(let r of e){const e=r.getDrawingItem();e._drawingLayer===t&&i.push(e)}setTimeout((()=>{t.onSelectionChanged&&t.onSelectionChanged(i,[])}),0)}})),e.on(\"before:selection:cleared\",(function(t){const e=this.getActiveObjects(),i=[];for(let t of e){const e=t.getDrawingItem()._drawingLayer;e&&!i.includes(e)&&i.push(e)}for(let t of i){const i=[];for(let r of e){const e=r.getDrawingItem();e._drawingLayer===t&&i.push(e)}setTimeout((()=>{const e=[];for(let r of i)t.hasDrawingItem(r)&&e.push(r);e.length>0&&t.onSelectionChanged&&t.onSelectionChanged([],e)}),0)}})),e.on(\"selection:updated\",(function(t){const e=t.selected,i=t.deselected,r=[];for(let t of e){const e=t.getDrawingItem()._drawingLayer;e&&!r.includes(e)&&r.push(e)}for(let t of i){const e=t.getDrawingItem()._drawingLayer;e&&!r.includes(e)&&r.push(e)}for(let t of r){const r=[],n=[];for(let i of e){const e=i.getDrawingItem();e._drawingLayer===t&&r.push(e)}for(let e of i){const i=e.getDrawingItem();i._drawingLayer===t&&n.push(i)}setTimeout((()=>{t.onSelectionChanged&&t.onSelectionChanged(r,n)}),0)}})),e.wrapperEl.style.position=\"absolute\",t.getFabricCanvas=()=>this.fabricCanvas}let r,n;switch(this.id=e,e){case br.DDN_LAYER_ID:r=Sr.getDrawingStyle(Sr.STYLE_BLUE_STROKE),n=Sr.getDrawingStyle(Sr.STYLE_BLUE_STROKE_FILL);break;case br.DBR_LAYER_ID:r=Sr.getDrawingStyle(Sr.STYLE_ORANGE_STROKE),n=Sr.getDrawingStyle(Sr.STYLE_ORANGE_STROKE_FILL);break;case br.DLR_LAYER_ID:r=Sr.getDrawingStyle(Sr.STYLE_GREEN_STROKE),n=Sr.getDrawingStyle(Sr.STYLE_GREEN_STROKE_FILL);break;default:r=Sr.getDrawingStyle(Sr.STYLE_YELLOW_STROKE),n=Sr.getDrawingStyle(Sr.STYLE_YELLOW_STROKE_FILL)}for(let t of wi.arrMediaTypes)this.mapType_StateAndStyleId.set(t,{default:r.id,selected:n.id})}getId(){return this.id}setVisible(t){if(t){for(let t of this._arrFabricObject)t.visible=!0,t.hasControls=!0;this._visible=!0}else{for(let t of this._arrFabricObject)t.visible=!1,t.hasControls=!1;this._visible=!1}this.fabricCanvas.renderAll()}isVisible(){return this._visible}_getItemCurrentStyle(t){if(t.styleId)return Sr.getDrawingStyle(t.styleId);return Sr.getDrawingStyle(t._mapState_StyleId.get(t.styleSelector))||null}_changeMediaTypeCurStyleInStyleSelector(t,e,i,r){const n=this.getDrawingItems((e=>e._mediaType===t));for(let t of n)t.styleSelector===e&&this._changeItemStyle(t,i,!0);r||this.fabricCanvas.renderAll()}_changeItemStyle(t,e,i){if(!t||!e)return;const r=t._getFabricObject();\"number\"==typeof t.styleId&&(e=Sr.getDrawingStyle(t.styleId)),r.strokeWidth=e.lineWidth,\"fill\"===e.paintMode?(r.fill=e.fillStyle,r.stroke=e.fillStyle):\"stroke\"===e.paintMode?(r.fill=\"transparent\",r.stroke=e.strokeStyle):\"strokeAndFill\"===e.paintMode&&(r.fill=e.fillStyle,r.stroke=e.strokeStyle),r.fontFamily&&
2(r.fontFamily=e.fontFamily),r.fontSize&&(r.fontSize=e.fontSize),r.group||(r.dirty=!0),i||this.fabricCanvas.renderAll()}_updateGroupItem(t,e,i){if(!t||!e)return;const r=t.getChildDrawingItems();if(\"add\"===i){if(r.includes(e))return;const i=e._getFabricObject();if(this.fabricCanvas.getObjects().includes(i)){if(!this._arrFabricObject.includes(i))throw new Error(\"Existed in other drawing layers.\");e._zIndex=null}else{let i;if(e.styleId)i=Sr.getDrawingStyle(e.styleId);else{const r=this.mapType_StateAndStyleId.get(e._mediaType);i=Sr.getDrawingStyle(r[t.styleSelector]);const n=()=>{this._changeItemStyle(e,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(e._mediaType).selected),!0)},s=()=>{this._changeItemStyle(e,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(e._mediaType).default),!0)};e._on(\"selected\",n),e._on(\"deselected\",s),e._funcChangeStyleToSelected=n,e._funcChangeStyleToDefault=s}e._drawingLayer=this,e._drawingLayerId=this.id,this._changeItemStyle(e,i,!0)}t._fabricObject.addWithUpdate(e._getFabricObject())}else{if(\"remove\"!==i)return;if(!r.includes(e))return;e._zIndex=null,e._drawingLayer=null,e._drawingLayerId=null,e._off(\"selected\",e._funcChangeStyleToSelected),e._off(\"deselected\",e._funcChangeStyleToDefault),e._funcChangeStyleToSelected=null,e._funcChangeStyleToDefault=null,t._fabricObject.removeWithUpdate(e._getFabricObject())}this.fabricCanvas.renderAll()}_addDrawingItem(t,e){if(!(t instanceof wi))throw new TypeError(\"Invalid 'drawingItem'.\");if(t._drawingLayer){if(t._drawingLayer==this)return;throw new Error(\"This drawing item has existed in other layer.\")}let i=t._getFabricObject();const r=this.fabricCanvas.getObjects();let n,s;if(r.includes(i)){if(this._arrFabricObject.includes(i))return;throw new Error(\"Existed in other drawing layers.\")}if(\"group\"===t._mediaType){n=t.getChildDrawingItems();for(let t of n)if(t._drawingLayer&&t._drawingLayer!==this)throw new Error(\"The childItems of DT_Group have existed in other drawing layers.\")}if(e&&\"object\"==typeof e&&!Array.isArray(e))for(let t in e)i.set(t,e[t]);if(n){for(let t of n){const e=this.mapType_StateAndStyleId.get(t._mediaType);for(let i of wi.arrStyleSelectors)t._mapState_StyleId.set(i,e[i]);if(t.styleId)s=Sr.getDrawingStyle(t.styleId);else{s=Sr.getDrawingStyle(e.default);const i=()=>{this._changeItemStyle(t,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(t._mediaType).selected),!0)},r=()=>{this._changeItemStyle(t,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(t._mediaType).default),!0)};t._on(\"selected\",i),t._on(\"deselected\",r),t._funcChangeStyleToSelected=i,t._funcChangeStyleToDefault=r}t._drawingLayer=this,t._drawingLayerId=this.id,this._changeItemStyle(t,s,!0)}i.dirty=!0,this.fabricCanvas.renderAll()}else{const e=this.mapType_StateAndStyleId.get(t._mediaType);for(let i of wi.arrStyleSelectors)t._mapState_StyleId.set(i,e[i]);if(t.styleId)s=Sr.getDrawingStyle(t.styleId);else{s=Sr.getDrawingStyle(e.default);const i=()=>{this._changeItemStyle(t,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(t._mediaType).selected))},r=()=>{this._changeItemStyle(t,Sr.getDrawingStyle(this.mapType_StateAndStyleId.get(t._mediaType).default))};t._on(\"selected\",i),t._on(\"deselected\",r),t._funcChangeStyleToSelected=i,t._funcChangeStyleToDefault=r}this._changeItemStyle(t,s)}t._zIndex=this.id,t._drawingLayer=this,t._drawingLayerId=this.id;const o=this._arrFabricObject.length;let a=r.length;if(o)a=r.indexOf(this._arrFabricObject[o-1])+1;else for(let e=0;e<r.length;e++)if(t._zIndex<r[e].getDrawingItem()._zIndex){a=e;break}this._arrDrwaingItem.push(t),this._arrFabricObject.push(i),this._visible?i.visible=!0:i.visible=!1,this.fabricCanvas.insertAt(i,a,!1)}addDrawingItem(t){if(!t||!t.isDrawingItem)throw TypeError(\"Illegal drawing item.\");if(\"viewer\"===this.mode)t._setEditable(!1);else{if(\"editor\"!==this.mode)throw new Error(\"Illegal 'mode'.\");t._setEditable(!0)}this._addDrawingItem(t),t.updatePosition()}addDrawingItems(t){for(let e of t)this.addDrawingItem(e)}removeDrawingItem(t){if(!t||!t.isDrawingItem)throw TypeError(\"Illegal drawing item.\");if(!this.hasDrawingItem(t))return;if(t._zIndex=null,t._drawingLayer=null,t._drawingLayerId=null,\"group\"===t._mediaType){const e=t.getChildDrawingItems();for(let t of e)t._zIndex=null,t._drawingLayer=null,t._drawingLayerId=null,t._off(\"selected\",t._funcChangeStyleToSelected),t._off(\"deselected\",t._funcChangeStyleToDefault),t._funcChangeStyleToSelected=null,t._funcChangeStyleToDefault=null,t._mapState_StyleId.clear()}else t._off(\"selected\",t._funcChangeStyleToSelected),t._off(\"deselected\",t._funcChangeStyleToDefault),t._funcChangeStyleToSelected=null,t._funcChangeStyleToDefault=null,t._mapState_StyleId.clear();const e=t._getFabricObject();\"selected\"===t.styleSelector&&(e.group?e.group.removeWithUpdate(e):this.fabricCanvas._activeObject=null,t.setState(ri.DIS_DEFAULT)),this.fabricCanvas.remove(e),this._arrDrwaingItem.splice(this._arrDrwaingItem.indexOf(t),1),this._arrFabricObject.
2splice(this._arrFabricObject.indexOf(e),1)}removeDrawingItems(t){for(let e of t)this.removeDrawingItem(e)}setDrawingItems(t){this.clearDrawingItems(),this.addDrawingItems(t)}getDrawingItems(t){return t&&\"function\"==typeof t?this._arrDrwaingItem.filter(t):Array.from(this._arrDrwaingItem)}getSelectedDrawingItems(){const t=this.fabricCanvas.getActiveObjects(),e=[];for(let i of t)this._arrFabricObject.includes(i)&&e.push(i.getDrawingItem());return e}hasDrawingItem(t){if(!t||!t.isDrawingItem)throw TypeError(\"Illegal drawing item.\");return this._arrDrwaingItem.includes(t)}clearDrawingItems(){this.removeDrawingItems(Array.from(this._arrDrwaingItem))}_setDefaultStyle(t,e,i){e?e.forEach((t=>t.toLowerCase())):e=wi.arrMediaTypes,i?i.forEach((t=>t.toLowerCase())):i=wi.arrStyleSelectors;const r=Sr.getDrawingStyle(t);if(!r)throw new Error(`The 'drawingStyle' with id '${t}' doesn't exist.`);let n;for(let s of e)if(n=this.mapType_StateAndStyleId.get(s),n)for(let e of i){this._changeMediaTypeCurStyleInStyleSelector(s,e,r,!0),n[e]=t;for(let i of this._arrDrwaingItem)i._mediaType===s&&i._mapState_StyleId.set(e,t)}this.fabricCanvas.renderAll()}setDefaultStyle(t,e,i){const r=[];i&ii.DIMT_RECTANGLE&&r.push(\"rect\"),i&ii.DIMT_QUADRILATERAL&&r.push(\"quad\"),i&ii.DIMT_TEXT&&r.push(\"text\"),i&ii.DIMT_ARC&&r.push(\"arc\"),i&ii.DIMT_IMAGE&&r.push(\"image\"),i&ii.DIMT_POLYGON&&r.push(\"polygon\"),i&ii.DIMT_LINE&&r.push(\"line\");const n=[];e&ri.DIS_DEFAULT&&n.push(\"default\"),e&ri.DIS_SELECTED&&n.push(\"selected\"),this._setDefaultStyle(t,r.length?r:null,n.length?n:null)}setMode(t){if(\"viewer\"===(t=t.toLowerCase())){for(let t of this._arrDrwaingItem)t._setEditable(!1);this.fabricCanvas.discardActiveObject(),this.fabricCanvas.renderAll(),this.mode=\"viewer\"}else{if(\"editor\"!==t)throw new RangeError(\"Invalid value.\");for(let t of this._arrDrwaingItem)t._setEditable(!0);this.mode=\"editor\"}this._manager._switchPointerEvent()}getMode(){return this.mode}_setDimensions(t,e){this.fabricCanvas.setDimensions(t,e)}_setObjectFit(t){if(t=t.toLowerCase(),![\"contain\",\"cover\"].includes(t))throw new Error(`Unsupported value '${t}'.`);this.fabricCanvas.lowerCanvasEl.style.objectFit=t,this.fabricCanvas.upperCanvasEl.style.objectFit=t}_getObjectFit(){return this.fabricCanvas.lowerCanvasEl.style.objectFit}renderAll(){for(let t of this._arrDrwaingItem){const e=this._getItemCurrentStyle(t);this._changeItemStyle(t,e,!0)}this.fabricCanvas.renderAll()}dispose(){this.clearDrawingItems(),1===this._manager._arrDrawingLayer.length&&(this.fabricCanvas.wrapperEl.style.pointerEvents=\"none\",this.fabricCanvas.dispose(),this._arrDrwaingItem.length=0,this._arrFabricObject.length=0)}}br.DDN_LAYER_ID=1,br.DBR_LAYER_ID=2,br.DLR_LAYER_ID=3,br.USER_DEFINED_LAYER_BASE_ID=100,br.TIP_LAYER_ID=999;class Ir{constructor(){this._arrDrawingLayer=[]}createDrawingLayer(t,e){if(this.getDrawingLayer(e))throw new Error(\"Existed drawing layer id.\");const i=new br(t,e,{enableRetinaScaling:!1});return i._manager=this,this._arrDrawingLayer.push(i),this._switchPointerEvent(),i}deleteDrawingLayer(t){const e=this.getDrawingLayer(t);if(!e)return;const i=this._arrDrawingLayer;e.dispose(),i.splice(i.indexOf(e),1),this._switchPointerEvent()}clearDrawingLayers(){for(let t of this._arrDrawingLayer)t.dispose();this._arrDrawingLayer.length=0}getDrawingLayer(t){for(let e of this._arrDrawingLayer)if(e.getId()===t)return e;return null}getAllDrawingLayers(){return Array.from(this._arrDrawingLayer)}getSelectedDrawingItems(){if(!this._arrDrawingLayer.length)return;const t=this._getFabricCanvas().getActiveObjects(),e=[];for(let i of t)e.push(i.getDrawingItem());return e}setDimensions(t,e){this._arrDrawingLayer.length&&this._arrDrawingLayer[0]._setDimensions(t,e)}setObjectFit(t){for(let e of this._arrDrawingLayer)e&&e._setObjectFit(t)}getObjectFit(){return this._arrDrawingLayer.length?this._arrDrawingLayer[0]._getObjectFit():null}setVisible(t){if(!this._arrDrawingLayer.length)return;this._getFabricCanvas().wrapperEl.style.display=t?\"block\":\"none\"}_getFabricCanvas(){return this._arrDrawingLayer.length?this._arrDrawingLayer[0].fabricCanvas:null}_switchPointerEvent(){if(this._arrDrawingLayer.length)for(let t of this._arrDrawingLayer)t.getMode()}}class xr extends Oi{constructor(t,e,i,r,n){super(t,{x:e,y:i,width:r,height:0},n),zi.set(this,void 0),Zi.set(this,void 0),this._fabricObject.paddingTop=15,this._fabricObject.calcTextHeight=function(){for(var t=0,e=0,i=this._textLines.length;e<i;e++)t+=this.getHeightOfLine(e);return t+2*this.paddingTop},this._fabricObject._getTopOffset=function(){return-this.height/2+this.getHeightOfLine(0)*(1-1/this.lineHeight)/2+this.paddingTop},this.set(\"backgroundColor\",\"rgba(50, 50, 52, .8)\"),this.set(\"lineHeight\",1.3),this.set(\"textAlign\",\"center\")}setDuration(t){ze(this,zi,t,\"f\"),Xe(this,Zi,\"f\")&&clearTimeout(Xe(this,Zi,\"f\")),Xe(this,zi,\"f\")>=0&&ze(this,Zi,setTimeout((()=>{this.set(\"visible\",!1),this._drawingLayer&&this._drawingLayer.renderAll()}),Xe(this,zi,\"f\")),\"f\")}getDuration(){return Xe(this,zi,\"f\")}}zi=new WeakMap,Zi=new WeakMap;class Or{constructor(){qi.add(this),Ki.set(this,void 0),Ji.set(this,void 0),Qi.set(this,void 0),$i.set(this,!0),this._drawingLayerManager=new Ir}createDrawingLayerBaseCvs(t,e,i=\"contain\"){if(\"number\"!=typeof t||t<=1)throw new Error(\"Invalid 'width'.\");if(\"number\"!=typeof e||e<=1)throw new Error(\"Invalid 'height'.\");if(![\"contain\",\"cover\"].includes(i))throw new Error(\"Unsupported 'objectFit'.\");const r=document.createElement(\"canvas\");return r.width==t&&r.height==e||(r.width=t,r.height=e),r.style.objectFit=i,r}_createDrawingLayer(t,e,i,r){if(!this._layerBaseCvs){let n;try{n=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"!==(t.message||t))throw t}e||(e=(null==n?void 0:n.width)||1280),i||(i=(null==n?void 0:n.height)||720),r||(r=(null==n?void 0:n.objectFit)||\"contain\"),this._layerBaseCvs=this.createDrawingLayerBaseCvs(e,i,r)}const n=this._layerBaseCvs,s=this._drawingLayerManager.createDrawingLayer(n,t);return this._innerComponent.getElement(\"drawing-layer\")||this._innerComponent.setElement(\"drawing-layer\",n.parentElement),s}createDrawingLayer(){let t;for(let e=br.USER_DEFINED_LAYER_BASE_ID;;e++)if(!this._drawingLayerManager.getDrawingLayer(e)&&e!==br.TIP_LAYER_ID){t=e;break}return this._createDrawingLayer(t)}deleteDrawingLayer(t){var e;this._drawingLayerManager.deleteDrawingLayer(t),this._drawingLayerManager.getAllDrawingLayers().length||(null===(e=this._innerComponent)||void 0===e||e.removeElement(\"drawing-layer\"),this._layerBaseCvs=null)}deleteUserDefinedDrawingLayer(t){if(\"number\"!=typeof t)throw new TypeError(\"Invalid id.\");if(t<br.USER_DEFINED_LAYER_BASE_ID)throw new Error(`The drawing layer with i
2d ${t} is not defined by users.`);this.deleteDrawingLayer(t)}_clearDrawingLayers(){const t=this.getAllDrawingLayers();for(let e of t)this.deleteDrawingLayer(e.getId())}clearUserDefinedDrawingLayers(){const t=this.getAllDrawingLayers();for(let e of t){const t=e.getId();t<br.USER_DEFINED_LAYER_BASE_ID||this.deleteUserDefinedDrawingLayer(t)}}getDrawingLayer(t){if(t==br.TIP_LAYER_ID)return null;return this._drawingLayerManager.getDrawingLayer(t)||([br.DDN_LAYER_ID,br.DBR_LAYER_ID,br.DLR_LAYER_ID].includes(t)?this._createDrawingLayer(t):null)}getAllDrawingLayers(){return this._drawingLayerManager.getAllDrawingLayers().filter((t=>t.getId()>=0&&t.getId()!==br.TIP_LAYER_ID))}updateDrawingLayers(t){((t,e,i)=>{if(!(t<=1||e<=1)){if(![\"contain\",\"cover\"].includes(i))throw new Error(\"Unsupported 'objectFit'.\");this._drawingLayerManager.setDimensions({width:t,height:e},{backstoreOnly:!0}),this._drawingLayerManager.setObjectFit(i)}})(t.width,t.height,t.objectFit)}getSelectedDrawingItems(){return this._drawingLayerManager.getSelectedDrawingItems()}setTipConfig(t){if(!(Mi(e=t)&&T(e.topLeftPoint)&&ai(e.width))||e.width<=0||!ai(e.duration)||\"coordinateBase\"in e&&![\"view\",\"image\"].includes(e.coordinateBase))throw new Error(\"Invalid tip config.\");var e;ze(this,Ki,JSON.parse(JSON.stringify(t)),\"f\"),Xe(this,Ki,\"f\").coordinateBase||(Xe(this,Ki,\"f\").coordinateBase=\"view\"),ze(this,Qi,t.duration,\"f\"),Xe(this,qi,\"m\",rr).
2call(this)}getTipConfig(){return Xe(this,Ki,\"f\")?Xe(this,Ki,\"f\"):null}setTipVisible(t){if(\"boolean\"!=typeof t)throw new TypeError(\"Invalid value.\");this._tip&&(this._tip.set(\"visible\",t),this._drawingLayerOfTip&&this._drawingLayerOfTip.renderAll()),ze(this,$i,t,\"f\")}isTipVisible(){return Xe(this,$i,\"f\")}updateTipMessage(t){if(!Xe(this,Ki,\"f\"))throw new Error(\"Tip config is not set.\");this._tipStyleId||(this._tipStyleId=Sr.createDrawingStyle({fillStyle:\"#FFFFFF\",paintMode:\"fill\",fontFamily:\"Open Sans\",fontSize:40})),this._drawingLayerOfTip||(this._drawingLayerOfTip=this._drawingLayerManager.getDrawingLayer(br.TIP_LAYER_ID)||this._createDrawingLayer(br.TIP_LAYER_ID)),this._tip?this._tip.set(\"text\",t):this._tip=Xe(this,qi,\"m\",tr).call(this,t,Xe(this,Ki,\"f\").topLeftPoint.x,Xe(this,Ki,\"f\").topLeftPoint.y,Xe(this,Ki,\"f\").width,Xe(this,Ki,\"f\").coordinateBase,this._tipStyleId),Xe(this,qi,\"m\",er).call(this,this._tip,this._drawingLayerOfTip),this._tip.set(\"visible\",Xe(this,$i,\"f\")),this._drawingLayerOfTip&&this._drawingLayerOfTip.renderAll(),Xe(this,Ji,\"f\")&&clearTimeout(Xe(this,Ji,\"f\")),Xe(this,Qi,\"f\")>=0&&ze(this,Ji,setTimeout((()=>{Xe(this,qi,\"m\",ir).call(this)}),Xe(this,Qi,\"f\")),\"f\")}}Ki=new WeakMap,Ji=new WeakMap,Qi=new WeakMap,$i=new WeakMap,qi=new WeakSet,tr=function(t,e,i,r,n,s){const o=new xr(t,e,i,r,s);return o.coordinateBase=n,o},er=function(t,e){e.hasDrawingItem(t)||e.addDrawingItems([t])},ir=function(){this._tip&&this._drawingLayerOfTip.removeDrawingItems([this._tip])},rr=function(){if(!this._tip)return;const t=Xe(this,Ki,\"f\");this._tip.coordinateBase=t.coordinateBase,this._tip.setTextRect({x:t.topLeftPoint.x,y:t.topLeftPoint.y,width:t.width,height:0}),this._tip.set(\"width\",this._tip.get(\"width\")),this._tip._drawingLayer&&this._tip._drawingLayer.renderAll()};class Ar extends HTMLElement{constructor(){super(),nr.set(this,void 0);const t=new DocumentFragment,e=document.createElement(\"div\");e.setAttribute(\"class\",\"wrapper\"),t.appendChild(e),ze(this,nr,e,\"f\");const i=document.createElement(\"slot\");i.setAttribute(\"name\",\"single-frame-input-container\"),e.append(i);const r=document.createElement(\"slot\");r.setAttribute(\"name\",\"content\"),e.append(r);const n=document.createElement(\"slot\");n.setAttribute(\"name\",\"drawing-layer\"),e.append(n);const s=document.createElement(\"style\");s.textContent='\\n.wrapper {\\n  position: relative;\\n  width: 100%;\\n  height: 100%;\\n}\\n::slotted(canvas[slot=\"content\"]) {\\n  object-fit: contain;\\n  pointer-events: none;\\n}\\n::slotted(div[slot=\"single-frame-input-container\"]) {\\n  width: 1px;\\n  height: 1px;\\n  overflow: hidden;\\n  pointer-events: none;\\n}\\n::slotted(*) {\\n  position: absolute;\\n  left: 0;\\n  top: 0;\\n  width: 100%;\\n  height: 100%;\\n}\\n    ',t.appendChild(s),this.attachShadow({mode:\"open\"}).appendChild(t)}getWrapper(){return Xe(this,nr,\"f\")}setElement(t,e){if(!(e instanceof HTMLElement))throw new TypeError(\"Invalid 'el'.\");if(![\"content\",\"single-frame-input-container\",\"drawing-layer\"].includes(t))throw new TypeError(\"Invalid 'slot'.\");this.removeElement(t),e.setAttribute(\"slot\",t),this.appendChild(e)}getElement(t){if(![\"content\",\"single-frame-input-container\",\"drawing-layer\"].includes(t))throw new TypeError(\"Invalid 'slot'.\");return this.querySelector(`[slot=\"${t}\"]`)}removeElement(t){var e;if(![\"content\",\"single-frame-input-container\",\"drawing-layer\"].includes(t))throw new TypeError(\"Invalid 'slot'.\");null===(e=this.querySelectorAll(`[slot=\"${t}\"]`))||void 0===e||e.forEach((t=>t.remove()))}}nr=new WeakMap,customElements.get(\"dce-component\")||customElements.define(\"dce-component\",Ar);class Rr extends Or{static get engineResourcePath(){return A(gt.engineResourcePaths).dce}static set defaultUIElementURL(t){Rr._defaultUIElementURL=t}static get defaultUIElementURL(){var t;return null===(t=Rr._defaultUIElementURL)||void 0===t?void 0:t.replace(\"@engineResourcePath/\",Rr.engineResourcePath)}static async createInstance(t){const e=new Rr;
2return\"string\"==typeof t&&(t=t.replace(\"@engineResourcePath/\",Rr.engineResourcePath)),await e.setUIElement(t||Rr.defaultUIElementURL),e}static _transformCoordinates(t,e,i,r,n,s,o){const a=s/r,h=o/n;t.x=Math.round(t.x/a+e),t.y=Math.round(t.y/h+i)}set _singleFrameMode(t){if(![\"disabled\",\"image\",\"camera\"].includes(t))throw new Error(\"Invalid value.\");if(t!==Xe(this,gr,\"f\")){if(ze(this,gr,t,\"f\"),Xe(this,sr,\"m\",_r).call(this))ze(this,lr,null,\"f\"),this._videoContainer=null,this._innerComponent.removeElement(\"content\"),this._innerComponent&&(this._innerComponent.addEventListener(\"click\",this._clickIptSingleFrameMode),this._innerComponent.setAttribute(\"title\",\"Take a photo\")),this._bgCamera&&(this._bgCamera.style.display=\"block\");else if(this._innerComponent&&(this._innerComponent.removeEventListener(\"click\",this._clickIptSingleFrameMode),this._innerComponent.removeAttribute(\"title\")),this._bgCamera&&(this._bgCamera.style.display=\"none\"),!Xe(this,lr,\"f\")){const t=document.createElement(\"video\");t.style.position=\"absolute\",t.style.left=\"0\",t.style.top=\"0\",t.style.width=\"100%\",t.style.height=\"100%\",t.style.objectFit=this.getVideoFit(),t.setAttribute(\"autoplay\",\"true\"),t.setAttribute(\"playsinline\",\"true\"),t.setAttribute(\"muted\",\"true\"),[\"iPhone\",\"iPad\",\"Mac\"].includes(He.OS)&&t.setAttribute(\"poster\",\"data:image/gif;base64,R0lGODlhAQABAIEAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAgEAAEEBAA7\"),ze(this,lr,t,\"f\");const e=document.createElement(\"div\");e.append(t),e.style.overflow=\"hidden\",this._videoContainer=e,this._innerComponent.setElement(\"content\",e)}Xe(this,sr,\"m\",_r).call(this)||this._hideDefaultSelection?(this._selCam&&(this._selCam.style.display=\"none\"),this._selRsl&&(this._selRsl.style.display=\"none\"),this._selMinLtr&&(this._selMinLtr.style.display=\"none\")):(this._selCam&&(this._selCam.style.display=\"block\"),this._selRsl&&(this._selRsl.style.display=\"block\"),this._selMinLtr&&(this._selMinLtr.style.display=\"block\"),this._stopLoading())}}get _singleFrameMode(){return Xe(this,gr,\"f\")}get disposed(){return Xe(this,pr,\"f\")}constructor(){super(),sr.add(this),or.set(this,void 0),ar.set(this,void 0),hr.set(this,void 0),this.containerClassName=\"dce-video-container\",lr.set(this,void 0),this.videoFit=\"contain\",this._hideDefaultSelection=!1,this._divScanArea=null,this._divScanLight=null,this._bgLoading=null,this._selCam=null,this._bgCamera=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._selMinLtr=null,this._optGotMinLtr=null,cr.set(this,null),this.regionMaskFillStyle=\"rgba(0,0,0,0.5)\",this.regionMaskStrokeStyle=\"rgb(254,142,20)\",this.regionMaskLineWidth=6,ur.set(this,!1),dr.set(this,!1),fr.set(this,{width:0,height:0}),this._updateLayersTimeout=500,this._videoResizeListener=()=>{Xe(this,sr,\"m\",Er).call(this),this._updateLayersTimeoutId&&clearTimeout(this._updateLayersTimeoutId),this._updateLayersTimeoutId=setTimeout((()=>{this.disposed||(this.eventHandler.fire(\"videoEl:resized\",null,{async:!1}),this.eventHandler.fire(\"content:updated\",null,{async:!1}),this.isScanLaserVisible()&&Xe(this,sr,\"m\",Cr).call(this))}),this._updateLayersTimeout)},this._windowResizeListener=()=>{Rr._onLog&&Rr._onLog(\"window resize event triggered.\"),Xe(this,fr,\"f\").width===document.documentElement.clientWidth&&Xe(this,fr,\"f\").height===document.documentElement.clientHeight||(Xe(this,fr,\"f\").width=document.documentElement.clientWidth,Xe(this,fr,\"f\").height=document.documentElement.clientHeight,this._videoResizeListener())},gr.set(this,\"disabled\"),this._clickIptSingleFrameMode=()=>{if(!Xe(this,sr,\"m\",_r).call(this))return;let t;if(this._singleFrameInputContainer)t=this._singleFrameInputContainer.firstElementChild;else{t=document.createElement(\"input\"),t.setAttribute(\"type\",\"file\"),\"camera\"===this._singleFrameMode?(t.setAttribute(\"capture\",\"\"),t.setAttribute(\"accept\",\"image/*\")):\"image\"===this._singleFrameMode&&(t.removeAttribute(\"capture\"),t.setAttribute(\"accept\",\".jpg,.jpeg,.icon,.gif,.svg,.webp,.png,.bmp\")),t.addEventListener(\"change\",(async()=>{const e=t.files[0];t.value=\"\";{const t=async t=>{let e=null,i=null;
2if(\"undefined\"!=typeof createImageBitmap)try{if(e=await createImageBitmap(t),e)return e}catch(t){}var r;return e||(i=await(r=t,new Promise(((t,e)=>{let i=URL.createObjectURL(r),n=new Image;n.src=i,n.onload=()=>{URL.revokeObjectURL(n.src),t(n)},n.onerror=t=>{e(new Error(\"Can't convert blob to image : \"+(t instanceof Event?t.type:t)))}})))),i},i=(t,e,i,r)=>{t.width==i&&t.height==r||(t.width=i,t.height=r);const n=t.getContext(\"2d\");n.clearRect(0,0,t.width,t.height),n.drawImage(e,0,0)},r=await t(e),n=r instanceof HTMLImageElement?r.naturalWidth:r.width,s=r instanceof HTMLImageElement?r.naturalHeight:r.height;let o=this._cvsSingleFrameMode;const a=null==o?void 0:o.width,h=null==o?void 0:o.height;o||(o=document.createElement(\"canvas\"),this._cvsSingleFrameMode=o),i(o,r,n,s),this._innerComponent.setElement(\"content\",o),a===o.width&&h===o.height||this.eventHandler.fire(\"content:updated\",null,{async:!1})}this._onSingleFrameAcquired&&setTimeout((()=>{this._onSingleFrameAcquired(this._cvsSingleFrameMode)}),0)})),t.style.position=\"absolute\",t.style.top=\"-9999px\",t.style.backgroundColor=\"transparent\",t.style.color=\"transparent\";const e=document.createElement(\"div\");e.append(t),this._innerComponent.setElement(\"single-frame-input-container\",e),this._singleFrameInputContainer=e}null==t||t.click()},mr.set(this,[]),this._capturedResultReceiver={onCapturedResultReceived:(t,e)=>{var i,r,n,s;if(this.disposed)return;if(this.clearAllInnerDrawingItems(),!t)return;const o=t.originalImageTag;if(!o)return;const a=t.items;if(!(null==a?void 0:a.length))return;const h=(null===(i=o.cropRegion)||void 0===i?void 0:i.left)||0,l=(null===(r=o.cropRegion)||void 0===r?void 0:r.top)||0,c=(null===(n=o.cropRegion)||void 0===n?void 0:n.right)?o.cropRegion.right-h:o.originalWidth,u=(null===(s=o.cropRegion)||void 0===s?void 0:s.bottom)?o.cropRegion.bottom-l:o.originalHeight,d=o.currentWidth,f=o.currentHeight,g=(t,e,i,r,n,s,o,a,h=[],l)=>{e.forEach((t=>Rr._transformCoordinates(t,i,r,n,s,o,a)));const c=new Di({points:[{x:e[0].x,y:e[0].y},{x:e[1].x,y:e[1].y},{x:e[2].x,y:e[2].y},{x:e[3].x,y:e[3].y}]},l);for(let t of h)c.addNote(t);t.addDrawingItems([c]),Xe(this,mr,\"f\").push(c)};let m,p;for(let t of a)switch(t.type){case mt.CRIT_ORIGINAL_IMAGE:break;case mt.CRIT_BARCODE:m=this.getDrawingLayer(br.DBR_LAYER_ID),p=[{name:\"format\",content:t.formatString},{name:\"text\",content:t.text}],(null==e?void 0:e.isBarcodeVerifyOpen)?t.verified?g(m,t.location.points,h,l,c,u,d,f,p):g(m,t.location.points,h,l,c,u,d,f,p,Sr.STYLE_ORANGE_STROKE_TRANSPARENT):g(m,t.location.points,h,l,c,u,d,f,p);break;case mt.CRIT_TEXT_LINE:m=this.getDrawingLayer(br.DLR_LAYER_ID),p=[{name:\"text\",content:t.text}],e.isLabelVerifyOpen?t.verified?g(m,t.location.points,h,l,c,u,d,f,p):g(m,t.location.points,h,l,c,u,d,f,p,Sr.STYLE_GREEN_STROKE_TRANSPARENT):g(m,t.location.points,h,l,c,u,d,f,p);break;case mt.CRIT_DETECTED_QUAD:m=this.getDrawingLayer(br.DDN_LAYER_ID),(null==e?void 0:e.isDetectVerifyOpen)?t.crossVerificationStatus===Tt.CVS_PASSED?g(m,t.location.points,h,l,c,u,d,f,[]):g(m,t.location.points,h,l,c,u,d,f,[],Sr.STYLE_BLUE_STROKE_TRANSPARENT):g(m,t.location.points,h,l,c,u,d,f,[]);break;case mt.CRIT_NORMALIZED_IMAGE:m=this.getDrawingLayer(br.DDN_LAYER_ID),(null==e?void 0:e.isNormalizeVerifyOpen)?t.crossVerificationStatus===Tt.CVS_PASSED?g(m,t.location.points,h,l,c,u,d,f,[]):g(m,t.location.points,h,l,c,u,d,f,[],Sr.STYLE_BLUE_STROKE_TRANSPARENT):g(m,t.location.points,h,l,c,u,d,f,[]);break;case mt.CRIT_PARSED_RESULT:break;default:throw new Error(\"Illegal item type.\")}}},pr.set(this,!1),this.eventHandler=new ji,this.eventHandler.on(\"content:updated\",(()=>{Xe(this,or,\"f\")&&clearTimeout(Xe(this,or,\"f\")),ze(this,or,setTimeout((()=>{if(this.disposed)return;let t;this._updateVideoContainer();try{t=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}this.updateDrawingLayers(t),this.updateConvertedRegion(t)}),0),\"f\")})),this.eventHandler.on(\"videoEl:resized\",(()=>{Xe(this,ar,\"f\")&&clearTimeout(Xe(this,ar,\"f\")),ze(this,ar,setTimeout((()=>{this.disposed||this._updateVideoContainer()}),0),\"f\")}))}_setUIElement(t){this.UIElement=t,this._unbindUI(),this._bindUI()}async setUIElement(t){let e;
2if(\"string\"==typeof t){let i=await Wi(t);e=document.createElement(\"div\"),Object.assign(e.style,{width:\"100%\",height:\"100%\"}),e.attachShadow({mode:\"open\"}).appendChild(i.cloneNode(!0))}else e=t;this._setUIElement(e)}getUIElement(){return this.UIElement}_bindUI(){var t,e;if(!this.UIElement)throw new Error(\"Need to set 'UIElement'.\");if(this._innerComponent)return;let i=this.UIElement;i=i.shadowRoot||i;let r=(null===(t=i.classList)||void 0===t?void 0:t.contains(this.containerClassName))?i:i.querySelector(`.${this.containerClassName}`);if(!r)throw Error(`Can not find the element with class '${this.containerClassName}'.`);if(this._innerComponent=document.createElement(\"dce-component\"),r.appendChild(this._innerComponent),Xe(this,sr,\"m\",_r).call(this));else{const t=document.createElement(\"video\");Object.assign(t.style,{position:\"absolute\",left:\"0\",top:\"0\",width:\"100%\",height:\"100%\",objectFit:this.getVideoFit()}),t.setAttribute(\"autoplay\",\"true\"),t.setAttribute(\"playsinline\",\"true\"),t.setAttribute(\"muted\",\"true\"),[\"iPhone\",\"iPad\",\"Mac\"].includes(He.OS)&&t.setAttribute(\"poster\",\"data:image/gif;base64,R0lGODlhAQABAIEAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAgEAAEEBAA7\"),ze(this,lr,t,\"f\");const e=document.createElement(\"div\");e.append(t),e.style.overflow=\"hidden\",this._videoContainer=e,this._innerComponent.setElement(\"content\",e)}if(this._selRsl=i.querySelector(\".dce-sel-resolution\"),this._selMinLtr=i.querySelector(\".dlr-sel-minletter\"),this._divScanArea=i.querySelector(\".dce-scanarea\"),this._divScanLight=i.querySelector(\".dce-scanlight\"),this._bgLoading=i.querySelector(\".dce-bg-loading\"),this._bgCamera=i.querySelector(\".dce-bg-camera\"),this._selCam=i.querySelector(\".dce-sel-camera\"),this._optGotRsl=i.querySelector(\".dce-opt-gotResolution\"),this._btnClose=i.querySelector(\".dce-btn-close\"),this._optGotMinLtr=i.querySelector(\".dlr-opt-gotMinLtr\"),this._selRsl&&(this._hideDefaultSelection||Xe(this,sr,\"m\",_r).call(this)||this._selRsl.options.length||(this._selRsl.innerHTML=['<option class=\"dce-opt-gotResolution\" value=\"got\"></option>','<option data-width=\"1920\" data-height=\"1080\">ask 1920x1080</option>','<option data-width=\"1280\" data-height=\"720\">ask 1280x720</option>','<option data-width=\"640\" data-height=\"480\">ask 640x480</option>'].join(\"\"),this._optGotRsl=this._selRsl.options[0])),this._selMinLtr&&(this._hideDefaultSelection||Xe(this,sr,\"m\",_r).call(this)||this._selMinLtr.options.length||(this._selMinLtr.innerHTML=['<option class=\"dlr-opt-gotMinLtr\" value=\"got\"></option>','<option value=\"0\" selected>any letter</option>','<option value=\"3\">3+ letters</option>','<option value=\"5\">5+ letters</option>','<option value=\"8\">8+ letters</option>','<option value=\"12\">12+ letters</option>','<option value=\"17\">17+ letters</option>','<option value=\"30\">30+ letters</option>','<option value=\"50\">50+ letters</option>','<option value=\"80\">80+ letters</option>','<option value=\"120\">120+ letters</option>'].join(\"\"),this._optGotMinLtr=this._selMinLtr.options[0])),this.isScanLaserVisible()||Xe(this,sr,\"m\",Er).call(this),Xe(this,sr,\"m\",_r).call(this)&&(this._innerComponent&&(this._innerComponent.addEventListener(\"click\",this._clickIptSingleFrameMode),this._innerComponent.setAttribute(\"title\",\"Take a photo\")),this._bgCamera&&(this._bgCamera.style.display=\"block\")),Xe(this,sr,\"m\",_r).call(this)||this._hideDefaultSelection?(this._selCam&&(this._selCam.style.display=\"none\"),this._selRsl&&(this._selRsl.style.display=\"none\"),this._selMinLtr&&(this._selMinLtr.style.display=\"none\")):(this._selCam&&(this._selCam.style.display=\"block\"),this._selRsl&&(this._selRsl.style.display=\"block\"),this._selMinLtr&&(this._selMinLtr.style.display=\"block\"),this._stopLoading()),window.ResizeObserver){this._resizeObserver||(this._resizeObserver=new ResizeObserver((t=>{var e;Rr._onLog&&Rr._onLog(\"resize observer triggered.\");for(let i of t)i.target===(null===(e=this._innerComponent)||void 0===e?void 0:e.getWrapper())&&this._videoResizeListener()})));const t=null===(e=this._innerComponent)||void 0===e?void 0:e.getWrapper();t&&this._resizeObserver.observe(t)}Xe(this,fr,\"f\").width=document.documentElement.clientWidth,Xe(this,fr,\"f\").height=document.documentElement.clientHeight,window.addEventListener(\"resize\",this._windowResizeListener)}_unbindUI(){var t,e,i,r;Xe(this,sr,\"m\",_r).call(this)?(this._innerComponent&&(this._innerComponent.removeEventListener(\"click\",this._clickIptSingleFrameMode),this._innerComponent.removeAttribute(\"title\")),this._bgCamera&&(this._bgCamera.style.display=\"none\")):this._stopLoading(),Xe(this,sr,\"m\",Er).call(this),null===(t=this._drawingLayerManager)||void 0===t||t.clearDrawingLayers(),null===(e=this._innerComponent)||void 0===e||e.removeElement(\"drawing-layer\"),this._layerBaseCvs=null,this._drawingLayerOfMask=null,this._drawingLayerOfTip=null,null===(i=this._innerComponent)||void 0===i||i.remove(),this._innerComponent=null,ze(this,lr,null,\"f\"),null===(r=this._videoContainer)||void 0===r||r.remove(),this._videoContainer=null,this._selCam=null,this._selRsl=null,this._optGotRsl=null,this._btnClose=null,this._selMinLtr=null,this._optGotMinLtr=null,this._divScanArea=null,this._divScanLight=null,this._singleFrameInputContainer&&(this._singleFrameInputContainer.remove(),this._singleFrameInputContainer=null),window.ResizeObserver&&this._resizeObserver&&this._resizeObserver.disconnect(),window.removeEventListener(\"resize\",this._windowResizeListener)}_startLoading(){this._bgLoading&&(this._bgLoading.style.display=\"\",this._bgLoading.style.animationPlayState=\"\")}_stopLoading(){this._bgLoading&&(this._bgLoading.style.display=\"none\",this._bgLoading.style.animationPlayState=\"paused\")}_renderCamerasInfo(t,e){if(this._selCam){let i;this._selCam.textContent=\"\";for(let r of e){const e=document.createElement(\"option\");e.value=r.deviceId,e.innerText=r.label,this._selCam.append(e),r.deviceId&&t&&t.deviceId==r.deviceId&&(i=e)}this._selCam.value=i?i.value:\"\"}
2let i=this.UIElement;if(i=i.shadowRoot||i,i.querySelector(\".dce-macro-use-mobile-native-like-ui\")){let t=i.querySelector(\".dce-mn-cameras\");if(t){t.textContent=\"\";for(let i of e){const e=document.createElement(\"div\");e.classList.add(\"dce-mn-camera-option\"),e.setAttribute(\"data-davice-id\",i.deviceId),e.textContent=i.label,t.append(e)}}}}_renderResolutionInfo(t){this._optGotRsl&&(this._optGotRsl.setAttribute(\"data-width\",t.width),this._optGotRsl.setAttribute(\"data-height\",t.height),this._optGotRsl.innerText=\"got \"+t.width+\"x\"+t.height,this._selRsl&&this._optGotRsl.parentNode==this._selRsl&&(this._selRsl.value=\"got\"));{let e=this.UIElement;e=(null==e?void 0:e.shadowRoot)||e;let i=null==e?void 0:e.querySelector(\".dce-mn-resolution-box\");if(i){let e=\"\";if(t&&t.width&&t.height){let i=Math.max(t.width,t.height),r=Math.min(t.width,t.height);e=r<=1080?r+\"P\":i<3e3?\"2K\":Math.round(i/1e3)+\"K\"}i.textContent=e}}}getVideoElement(){return Xe(this,lr,\"f\")}isVideoLoaded(){return!(!Xe(this,lr,\"f\")||!this.cameraEnhancer)&&this.cameraEnhancer.isOpen()}setVideoFit(t){if(t=t.toLowerCase(),![\"contain\",\"cover\"].includes(t))throw new Error(`Unsupported value '${t}'.`);if(this.videoFit=t,!Xe(this,lr,\"f\"))return;if(Xe(this,lr,\"f\").style.objectFit=t,Xe(this,sr,\"m\",_r).call(this))return;let e;this._updateVideoContainer();try{e=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}Xe(this,sr,\"m\",Tr).call(this,e,this.getConvertedRegion()),this.updateDrawingLayers(e)}getVideoFit(){return this.videoFit}getContentDimensions(){var t,e,i,r;let n,s,o;if(Xe(this,sr,\"m\",_r).call(this)?(n=null===(i=this._cvsSingleFrameMode)||void 0===i?void 0:i.width,s=null===(r=this._cvsSingleFrameMode)||void 0===r?void 0:r.height,o=\"contain\"):(n=null===(t=Xe(this,lr,\"f\"))||void 0===t?void 0:t.videoWidth,s=null===(e=Xe(this,lr,\"f\"))||void 0===e?void 0:e.videoHeight,o=this.getVideoFit()),!n||!s)throw new Error(\"Invalid content dimensions.\");return{width:n,height:s,objectFit:o}}updateConvertedRegion(t){const e=ki.convert(this.scanRegion,t.width,t.height);ze(this,cr,e,\"f\"),Xe(this,hr,\"f\")&&clearTimeout(Xe(this,hr,\"f\")),ze(this,hr,setTimeout((()=>{let t;try{t=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}Xe(this,sr,\"m\",vr).call(this,t,e),Xe(this,sr,\"m\",Tr).call(this,t,e)}),0),\"f\")}getConvertedRegion(){return Xe(this,cr,\"f\")}setScanRegion(t){if(null!=t&&!w(t)&&!I(t))throw TypeError(\"Invalid 'region'.\");let e;this.scanRegion=t?JSON.parse(JSON.stringify(t)):null;try{e=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}this.updateConvertedRegion(e)}getScanRegion(){return JSON.parse(JSON.stringify(this.scanRegion))}getVisibleRegionOfVideo(t){if(!this.isVideoLoaded())throw new Error(\"The video is not loaded.\");const e=Xe(this,lr,\"f\").videoWidth,i=Xe(this,lr,\"f\").videoHeight,r=this.getVideoFit(),{width:n,height:s}=this._innerComponent.getBoundingClientRect();if(n<=0||s<=0)throw new Error(\"Unable to get video dimensions. Video may not be rendered on the page.\");let o;const a={x:0,y:0,width:e,height:i,isMeasuredInPercentage:!1};if(\"cover\"===r&&(n/s<e/i?(o=s/i,a.x=Math.floor((e-n/o)/2),a.y=0,a.width=Math.ceil(n/o),a.height=i):(o=n/e,a.x=0,a.y=Math.floor((i-s/o)/2),a.width=e,a.height=Math.ceil(s/o))),null==t?void 0:t.inPixels)return a;const h=a;return h.x=Math.ceil(h.x/i*100),h.y=Math.ceil(h.y/e*100),h.width=Math.floor(h.width/e*100),h.height=Math.floor(h.height/i*100),h.isMeasuredInPercentage=!0,a}setScanRegionMask(t,e,i,r){this._drawingLayerOfMask||(this._drawingLayerOfMask=this._createDrawingLayer(-2),this.isScanRegionMaskVisible()||Xe(this,sr,\"m\",wr).call(this)),this.clearScanRegionMask(),this._maskBackRectStyleId||(this._maskBackRectStyleId=Sr.createDrawingStyle({paintMode:\"fill\",fillStyle:this.regionMaskFillStyle,lineWidth:0})),this._maskCenterRectStyleId||(this._maskCenterRectStyleId=Sr.createDrawingStyle({paintMode:\"stroke\",strokeStyle:this.regionMaskStrokeStyle,lineWidth:this.regionMaskLineWidth}));const n=this._drawingLayerOfMask.width,s=this._drawingLayerOfMask.height,o=new Ci({x:0,y:0,width:n,height:s},this._maskBackRectStyleId),a=new Ci({x:-n/2,y:-s/2+e,width:t,height:r}),h=new Ci({x:-n/2+t+i,y:-s/2+e,width:n-t-i<0?0:n-t-i,height:r}),l=new Ci({x:-n/2,y:-s/2,width:n,height:e}),c=new Ci({x:-n/2,y:-s/2+e+r,width:n,height:s-e-r<0?0:s-e-r});a.set(\"strokeWidth\",0),h.set(\"strokeWidth\",0),l.set(\"strokeWidth\",0),c.set(\"strokeWidth\",0);const u=new Li([a,h,l,c])._getFabricObject();o.set(\"clipPath\",u);const d=new Ci({x:t,y:e,width:i,height:r},this._maskCenterRectStyleId);this._drawingLayerOfMask.addDrawingItems([o,d])}clearScanRegionMask(){this._drawingLayerOfMask&&this._drawingLayerOfMask.clearDrawingItems()}deleteScanRegionMask(){this._drawingLayerOfMask&&this.deleteDrawingLayer(this._drawingLayerOfMask.getId())}
2_setScanRegionMaskVisible(t){ze(this,ur,t,\"f\"),t?Xe(this,sr,\"m\",yr).call(this):Xe(this,sr,\"m\",wr).call(this)}setScanRegionMaskVisible(t){this._setScanRegionMaskVisible(t),this._userSetMaskVisible=t}isScanRegionMaskVisible(){return Xe(this,ur,\"f\")}setScanRegionMaskStyle(t){if(!t)return;let e;t.fillStyle&&(this.regionMaskFillStyle=t.fillStyle),t.strokeStyle&&(this.regionMaskStrokeStyle=t.strokeStyle),t.lineWidth&&(this.regionMaskLineWidth=t.lineWidth),this._maskBackRectStyleId&&Sr.updateDrawingStyle(this._maskBackRectStyleId,{fillStyle:this.regionMaskFillStyle}),this._maskCenterRectStyleId&&Sr.updateDrawingStyle(this._maskCenterRectStyleId,{strokeStyle:this.regionMaskStrokeStyle,lineWidth:this.regionMaskLineWidth});try{e=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}Xe(this,sr,\"m\",vr).call(this,e,this.getConvertedRegion())}getScanRegionMaskStyle(){return{fillStyle:this.regionMaskFillStyle,strokeStyle:this.regionMaskStrokeStyle,lineWidth:this.regionMaskLineWidth}}_setScanLaserVisible(t){ze(this,dr,t,\"f\"),t?Xe(this,sr,\"m\",Cr).call(this):Xe(this,sr,\"m\",Er).call(this)}setScanLaserVisible(t){this._setScanLaserVisible(t),this._userSetLaserVisible=t}isScanLaserVisible(){return Xe(this,dr,\"f\")}_updateVideoContainer(){if(!Xe(this,lr,\"f\"))return;if(Xe(this,sr,\"m\",_r).call(this))return;let t=1;const e=Xe(this,lr,\"f\").style.transform.match(/scale\\((.+)\\)/);e&&(t=parseFloat(e[1]));const i=this._videoContainer;if(\"contain\"===this.videoFit&&t>1){const t=Xe(this,lr,\"f\").videoWidth,e=Xe(this,lr,\"f\").videoHeight,{width:r,height:n}=this._innerComponent.getBoundingClientRect(),s=t/e;if(r/n<s){let t=r/s;i.style.left=\"0\",i.style.top=(n-t)/2/n*100+\"%\",i.style.width=\"100%\",i.style.height=t/n*100+\"%\"}else{let t=n*s;i.style.left=(r-t)/2/r*100+\"%\",i.style.top=\"0\",i.style.width=t/r*100+\"%\",i.style.height=\"100%\"}}else i.style.left=\"0\",i.style.top=\"0\",i.style.width=\"100%\",i.style.height=\"100%\"}updateLayers(){let t;this._updateVideoContainer();try{t=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}const e=this.getConvertedRegion();Xe(this,sr,\"m\",Tr).call(this,t,e),this.updateDrawingLayers(t),Xe(this,sr,\"m\",vr).call(this,t,e)}clearAllInnerDrawingItems(){Xe(this,mr,\"f\").forEach((t=>t.remove())),Xe(this,mr,\"f\").length=0}dispose(){this._unbindUI(),ze(this,pr,!0,\"f\")}}function Dr(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}function Lr(t,e,i,r,n){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!n)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof e?t!==e||!n:!e.has(t))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}or=new WeakMap,ar=new WeakMap,hr=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,gr=new WeakMap,mr=new WeakMap,pr=new WeakMap,sr=new WeakSet,_r=function(){return\"disabled\"!==this._singleFrameMode},vr=function(t,e){!e||0===e.x&&0===e.y&&e.width===t.width&&e.height===t.height?this.clearScanRegionMask():this.setScanRegionMask(e.x,e.y,e.width,e.height)},yr=function(){this._drawingLayerOfMask&&this._drawingLayerOfMask.setVisible(!0)},wr=function(){this._drawingLayerOfMask&&this._drawingLayerOfMask.setVisible(!1)},Cr=function(){this._divScanLight&&\"none\"==this._divScanLight.style.display&&(this._divScanLight.style.display=\"block\")},Er=function(){this._divScanLight&&(this._divScanLight.style.display=\"none\")},Tr=function(t,e){if(!this._divScanArea)return;if(!this._innerComponent.getElement(\"content\"))return;const{width:i,height:r,objectFit:n}=t;e||(e={x:0,y:0,width:i,height:r});const{width:s,height:o}=this._innerComponent.getBoundingClientRect();if(s<=0||o<=0)return;const a=s/o,h=i/r;let l,c,u,d,f=1;if(\"contain\"===n)a<h?(f=s/i,l=0,c=(o-r*f)/2):(f=o/r,l=(s-i*f)/2,c=0),l
2+=e.x*f,c+=e.y*f,u=e.width*f,d=e.height*f;else if(\"cover\"===n)if(a<h){f=o/r,l=e.x*f-(i*f-s)/2,l=Math.max(l,0),l=Math.min(l,s),c=e.y*f;let t=(e.x+e.width)*f-(i*f-s)/2;t=Math.max(t,0),t=Math.min(t,s),u=t-l,d=e.height*f}else{f=s/i,l=e.x*f,c=e.y*f-(r*f-o)/2,c=Math.max(c,0),c=Math.min(c,o);let t=(e.y+e.height)*f-(r*f-o)/2;t=Math.max(t,0),t=Math.min(t,o),u=e.width*f,d=t-c}else l=0,c=0,u=0,d=0;this._divScanArea.style.left=l+\"px\",this._divScanArea.style.top=c+\"px\",this._divScanArea.style.width=u+\"px\",this._divScanArea.style.height=d+\"px\"},Rr._defaultUIElementURL=\"@engineResourcePath/dce.ui.html\",\"function\"==typeof SuppressedError&&SuppressedError;const Mr=\"undefined\"==typeof self;let Fr,Pr,kr,Br,Nr;function jr(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}function Ur(t,e,i,r,n){if(\"m\"===r)throw new TypeError(\"Private method is not writable\");if(\"a\"===r&&!n)throw new TypeError(\"Private accessor was defined without a setter\");if(\"function\"==typeof e?t!==e||!n:!e.has(t))throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");return\"a\"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}\"undefined\"!=typeof navigator&&(Fr=navigator,Pr=Fr.userAgent,kr=Fr.platform,Br=Fr.mediaDevices),function(){if(!Mr){const t={Edge:{search:\"Edg\",verSearch:\"Edg\"},OPR:null,Chrome:null,Safari:{str:Fr.vendor,search:\"Apple\",verSearch:[\"Version\",\"iPhone OS\",\"CPU OS\"]},Firefox:null,Explorer:{search:\"MSIE\",verSearch:\"MSIE\"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:kr,search:\"Win\"},Mac:{str:kr},Linux:{str:kr}};let i=\"unknownBrowser\",r=0,n=\"unknownOS\";for(let e in t){const n=t[e]||{};let s=n.str||Pr,o=n.search||e,a=n.verStr||Pr,h=n.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){r=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let r=i.str||Pr,s=i.search||t;if(-1!=r.indexOf(s)){n=t;break}}\"Linux\"==n&&-1!=Pr.indexOf(\"Windows NT\")&&(n=\"HarmonyOS\"),Nr={browser:i,version:r,OS:n}}Mr&&(Nr={browser:\"ssr\",version:0,OS:\"ssr\"})}(),Br&&Br.getUserMedia,\"Chrome\"===Nr.browser&&Nr.version>66||\"Safari\"===Nr.browser&&Nr.version>13||\"OPR\"===Nr.browser&&Nr.version>43||\"Edge\"===Nr.browser&&Nr.version,\"function\"==typeof SuppressedError&&SuppressedError;class Vr{static multiply(t,e){const i=[];for(let r=0;r<3;r++){const n=e.slice(3*r,3*r+3);for(let e=0;e<3;e++){const r=[t[e],t[e+3],t[e+6]].reduce(((t,e,i)=>t+e*n[i]),0);i.push(r)}}return i}static identity(){return[1,0,0,0,1,0,0,0,1]}static translate(t,e,i){return Vr.multiply(t,[1,0,0,0,1,0,e,i,1])}static rotate(t,e){var i=Math.cos(e),r=Math.sin(e);return Vr.multiply(t,[i,-r,0,r,i,0,0,0,1])}static scale(t,e,i){return Vr.multiply(t,[e,0,0,0,i,0,0,0,1])}}var Gr,Wr,Yr,Hr,Xr,zr,Zr,qr,Kr,Jr,Qr,$r,tn,en,rn,nn,sn,on,an,hn,ln,cn,un,dn,fn,gn,mn,pn,_n,vn,yn,wn,Cn,En,Tn,Sn,bn,In,xn,On,An,Rn,Dn,Ln,Mn,Fn,Pn,kn,Bn,Nn;!function(t){t.GREY=\"grey\",t.GREY32=\"grey32\",t.RGBA=\"rgba\",t.RBGA=\"rbga\",t.GRBA=\"grba\",t.GBRA=\"gbra\",t.BRGA=\"brga\",t.BGRA=\"bgra\"}(Gr||(Gr={}));class jn{static get version(){return\"1.1.3\"}static get webGLSupported(){return void 0===jn._webGLSupported&&(jn._webGLSupported=!!document.createElement(\"canvas\").getContext(\"webgl\")),jn._webGLSupported}get disposed(){return jr(this,Zr,\"f\")}constructor(){Wr.set(this,Gr.RGBA),Yr.set(this,null),Hr.set(this,null),Xr.set(this,null),this.useWebGLByDefault=!0,this._reusedCvs=null,this._reusedWebGLCvs=null,zr.set(this,null),Zr.set(this,!1)}drawImage(t,e,i,r,n,s){if(this.disposed)throw Error(\"The 'ImageDataGetter' instance has been disposed.\");if(!i||!r)throw new Error(\"Invalid 'sourceWidth' or 'sourceHeight'.\");if((null==s?void 0:s.bUseWebGL)&&!jn.webGLSupported)throw new Error(\"Your browser or machine may not support WebGL.\");if(e instanceof HTMLVideoElement&&4!==e.readyState||e instanceof HTMLImageElement&&!e.complete)throw new Error(\"The source is not loaded.\");let o;jn._onLog&&(o=Date.now(),jn._onLog(\"drawImage(), START: \"+o));let a=0,h=0,l=i,c=r,u=0,d=0,f=i,g=r;n&&(n.sx&&(a=Math.round(n.sx)),n.sy&&(h=Math.round(n.sy)),n.sWidth&&(l=Math.round(n.sWidth)),n.sHeight&&(c=Math.round(n.sHeight)),n.dx&&(u=Math.round(n.dx)),n.dy&&(d=Math.round(n.dy)),n.dWidth&&(f=Math.round(n.dWidth)),n.dHeight&&(g=Math.round(n.dHeight)));let m,p=Gr.RGBA;if((null==s?void 0:s.pixelFormat)&&(p=s.pixelFormat),(null==s?void 0:s.bufferContainer)&&(m=s.bufferContainer,m.length<4*f*g))throw new Error(\"Unexpected size of the 'bufferContainer'.\");const _=t;if(!jn.webGLSupported||!(this.useWebGLByDefault&&null==(null==s?void 0:s.bUseWebGL)||(null==s?void 0:s.bUseWebGL))){jn._onLog&&jn._onLog(\"drawImage() in context2d.\"),_.ctx2d||(_.ctx2d=_.getContext(\"2d\",{willReadFrequently:!0}));const t=_.ctx2d;if(!t)throw new Error(\"Unable to get 'CanvasRenderingContext2D' from canvas.\");return(_.width<u+f||_.height<d+g)&&(_.width=u+f,_.height=d+g),t.drawImage(e,a,h,l,c,u,d,f,g),jn._onLog&&jn._onLog(\"drawImage() in context2d end. Costs: \"+(Date.now()-o)),{context:t,pixelFormat:Gr.RGBA,bUseWebGL:!1}}jn._onLog&&jn._onLog(\"drawImage() in WebGL.\");try{(_.width<u+f||_.height<d+g)&&(_.width=u+f,_.height=d+g,_.ctxWebG
2L&&_.ctxWebGL.viewport(0,0,u+f,d+g));const t=_.ctxWebGL||_.getContext(\"webgl\",{antialias:!1})||_.getContext(\"experimental-webgl\",{antialias:!1});if(!t){jn._onLog&&jn._onLog(\"Browser or machine may not support WebGL, or the canvas has already been set to a different context mode.\");const t=new Error(\"Unable to get 'WebGLRenderingContext'. Your browser or machine may not support WebGL, or the canvas has already been set to a different context mode.\");throw t.name=\"WebGLError\",t}if(!_.ctxWebGL||p!==jr(this,Wr,\"f\")){_.ctxWebGL=t;const e=t=>{const e=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,e),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);const i=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),{positions:e,texCoords:i}},i=t=>{const e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e},r=(t,e)=>{const i=t.createProgram();if(e.forEach((e=>t.attachShader(i,e))),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){const e=new Error(`An error occured linking the program: ${t.getProgramInfoLog(i)}.`);throw e.name=\"WebGLError\",e}return t.useProgram(i),i},n=(t,e,i)=>{const r=t.createShader(e);if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const e=new Error(`An error occured compiling the shader: ${t.getShaderInfoLog(r)}.`);throw e.name=\"WebGLError\",e}return r},s=\"\\nattribute vec2 a_position;\\nattribute vec2 a_texCoord;\\n\\nuniform mat3 u_matrix;\\nuniform mat3 u_textureMatrix;\\n\\nvarying vec2 v_texCoord;\\nvoid main(void) {\\ngl_Position = vec4((u_matrix * vec3(a_position, 1)).xy, 0, 1.0);\\nv_texCoord = vec4((u_textureMatrix * vec3(a_texCoord, 1)).xy, 0, 1.0).xy;\\n}\";let o=\"rgb\";[\"rgba\",\"rbga\",\"grba\",\"gbra\",\"brga\",\"bgra\"].includes(p)&&(o=p.slice(0,3));const a=`\\nprecision mediump float;\\nvarying vec2 v_texCoord;\\nuniform sampler2D u_image;\\nuniform float uColorFactor;\\n\\nvoid main() {\\nvec4 sample = texture2D(u_image, v_texCoord);\\nfloat grey = 0.3 * sample.r + 0.59 * sample.g + 0.11 * sample.b;\\ngl_FragColor = vec4(sample.${o} * (1.0 - uColorFactor) + (grey * uColorFactor), sample.a);\\n}`,h=r(t,[n(t,t.VERTEX_SHADER,s),n(t,t.FRAGMENT_SHADER,a)]);Ur(this,Hr,{program:h,attribLocations:{vertexPosition:t.getAttribLocation(h,\"a_position\"),texPosition:t.getAttribLocation(h,\"a_texCoord\")},uniformLocations:{uSampler:t.getUniformLocation(h,\"u_image\"),uColorFactor:t.getUniformLocation(h,\"uColorFactor\"),uMatrix:t.getUniformLocation(h,\"u_matrix\"),uTextureMatrix:t.getUniformLocation(h,\"u_textureMatrix\")}},\"f\"),Ur(this,Xr,e(t),\"f\"),Ur(this,Yr,i(t),\"f\"),Ur(this,Wr,p,\"f\")}const n=(t,e,i)=>{t.bindBuffer(t.ARRAY_BUFFER,e),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,2,t.FLOAT,!1,0,0)},s=(t,e,i)=>{const r=t.RGBA,n=t.RGBA,s=t.UNSIGNED_BYTE;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,r,n,s,i)},v=(t,e,s,o)=>{t.clearColor(0,0,0,1),t.clearDepth(1),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),n(t,s.positions,e.attribLocations.vertexPosition),n(t,s.texCoords,e.attribLocations.texPosition),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.uniform1i(e.uniformLocations.uSampler,0),t.uniform1f(e.uniformLocations.uColorFactor,[Gr.GREY,Gr.GREY32].includes(p)?1:0);let m,_,v=Vr.translate(Vr.identity(),-1,-1);v=Vr.scale(v,2,2),v=Vr.scale(v,1/t.canvas.width,1/t.canvas.height),m=Vr.translate(v,u,d),m=Vr.scale(m,f,g),t.uniformMatrix3fv(e.uniformLocations.uMatrix,!1,m),_=Vr.translate(Vr.identity(),a/i,h/r),_=Vr.scale(_,l/i,c/r),t.uniformMatrix3fv(e.uniformLocations.uTextureMatrix,!1,_),t.drawArrays(t.TRIANGLES,0,6)};s(t,jr(this,Yr,\"f\"),e),v(t,jr(this,Hr,\"f\"),jr(this,Xr,\"f\"),jr(this,Yr,\"f\"));const y=m||new Uint8Array(4*f*g);if(t.readPixels(u,d,f,g,t.RGBA,t.UNSIGNED_BYTE,y),255!==y[3]){jn._onLog&&jn._onLog(\"Incorrect WebGL drawing .\");const t=new Error(\"WebGL error: incorrect drawing.\");throw t.name=\"WebGLError\",t}return jn._onLog&&jn._onLog(\"drawImage() in WebGL end. Costs: \"+(Date.now()-o)),{context:t,pixelFormat:p===Gr.GREY?Gr.GREY32:p,bUseWebGL:!0}}catch(o){if(this.forceLoseContext(),null==(null==s?void 0:s.bUseWebGL))return jn._onLog&&jn._onLog(\"'drawImage()' in WebGL failed, try again in context2d.\"),this.useWebGLByDefault=!1,this.drawImage(t,e,i,r,n,Object.assign({},s,{bUseWebGL:!1}));throw o.name=\"WebGLError\",o}}
2readCvsData(t,e,i){if(!(t instanceof CanvasRenderingContext2D||t instanceof WebGLRenderingContext))throw new Error(\"Invalid 'context'.\");let r,n=0,s=0,o=t.canvas.width,a=t.canvas.height;if(e&&(e.x&&(n=e.x),e.y&&(s=e.y),e.width&&(o=e.width),e.height&&(a=e.height)),(null==i?void 0:i.length)<4*o*a)throw new Error(\"Unexpected size of the 'bufferContainer'.\");if(t instanceof WebGLRenderingContext){const e=t;i?(e.readPixels(n,s,o,a,e.RGBA,e.UNSIGNED_BYTE,i),r=new Uint8Array(i.buffer,0,4*o*a)):(r=new Uint8Array(4*o*a),e.readPixels(n,s,o,a,e.RGBA,e.UNSIGNED_BYTE,r))}else if(t instanceof CanvasRenderingContext2D){let e;e=t.getImageData(n,s,o,a),r=new Uint8Array(e.data.buffer),null==i||i.set(r)}return r}transformPixelFormat(t,e,i,r){let n,s;if(jn._onLog&&(n=Date.now(),jn._onLog(\"transformPixelFormat(), START: \"+n)),e===i)return jn._onLog&&jn._onLog(\"transformPixelFormat() end. Costs: \"+(Date.now()-n)),r?new Uint8Array(t):t;const o=[Gr.RGBA,Gr.RBGA,Gr.GRBA,Gr.GBRA,Gr.BRGA,Gr.BGRA];if(o.includes(e))if(i===Gr.GREY){s=new Uint8Array(t.length/4);for(let e=0;e<t.length;e+=4){const i=.3*t[e]+.59*t[e+1]+.11*t[e+2];s[e/4]=i}}else if(i===Gr.GREY32){s=r?new Uint8Array(t):t;for(let e=0;e<t.length;e+=4){const i=.3*t[e]+.59*t[e+1]+.11*t[e+2];s[e]=i,s[e+1]=i,s[e+2]=i}}else{if(!o.includes(i))throw new Error(\"Unable to transform.\");if(r){s=new Uint8Array(t);const r=e.indexOf(\"r\"),n=e.indexOf(\"g\"),o=e.indexOf(\"b\"),a=i.indexOf(\"r\"),h=i.indexOf(\"g\"),l=i.indexOf(\"b\");for(let e=0;e<t.length;e+=4)s[e+a]=t[e+r],s[e+h]=t[e+n],s[e+l]=t[e+o]}else{s=t;const r=e.indexOf(\"r\"),n=e.indexOf(\"g\"),o=e.indexOf(\"b\"),a=i.indexOf(\"r\"),h=i.indexOf(\"g\"),l=i.indexOf(\"b\");for(let e=0;e<t.length;e+=4){let i=[t[e],t[e+1],t[e+2]];s[e+a]=i[r],s[e+h]=i[n],s[e+l]=i[o]}}}else if(e===Gr.GREY){if(i!==Gr.GREY32)throw new Error(\"Unable to transform.\");s=new Uint8Array(4*t.length);for(let e=0;e<t.length;e++)s[4*e]=t[e],s[4*e+1]=t[e],s[4*e+2]=t[e],s[4*e+3]=255}else{if(e!==Gr.GREY32)throw new Error(\"Unable to transform.\");if(i!==Gr.GREY)throw new Error(\"Unable to transform.\");s=new Uint8Array(t.length/4);for(let e=0;e<t.length;e+=4)s[e/4]=t[e]}return jn._onLog&&jn._onLog(\"transformPixelFormat() end. Costs: \"+(Date.now()-n)),s}getImageData(t,e,i){var r,n,s,o,a;if(this.disposed)throw Error(\"The 'ImageDataGetter' instance has been disposed.\");if(t instanceof HTMLVideoElement&&4!==t.readyState||t instanceof HTMLImageElement&&!t.complete)throw new Error(\"The source is not loaded.\");let h,l;if(t instanceof HTMLImageElement)h=t.naturalWidth,l=t.naturalHeight;else if(t instanceof HTMLCanvasElement)h=t.width,l=t.height;else if(t instanceof HTMLVideoElement)h=t.videoWidth,l=t.videoHeight;else{if(!(t instanceof ImageBitmap))throw Error(\"The type of 'source' is not supported.\");h=t.width,l=t.height}let c,u=jn.webGLSupported&&this.useWebGLByDefault;if(e.sx<0||e.sy<0||e.sx+e.sWidth>h||e.sy+e.sHeight>l)throw new Error(\"Invalid position.\");null===(r=jn._onLog)||void 0===r||r.call(jn,\"getImageData(), START: \"+(c=Date.now()));const d=Math.round(e.sx),f=Math.round(e.sy),g=Math.round(e.sWidth),m=Math.round(e.sHeight),p=Math.round(e.dWidth),_=Math.round(e.dHeight);let v,y=(null==i?void 0:i.pixelFormat)||Gr.RGBA,w=null==i?void 0:i.bufferContainer;if(w&&(Gr.GREY===y&&w.length<p*_||Gr.RGBA===y&&w.length<p*_*4))throw new Error(\"Unexpected size of the 'bufferContainer'.\");if(u){null===(n=jn._onLog)||void 0===n||n.call(jn,\"getImageData() in WebGL.\");let o,a=this._reusedWebGLCvs=this._reusedWebGLCvs||document.createElement(\"canvas\");try{if(w)if(y===Gr.GREY){if(v=new Uint8Array(4*p*_),o=this.drawImage(a,t,h,l,{sx:d,sy:f,sWidth:g,sHeight:m,dWidth:p,dHeight:_},{pixelFormat:y,bUseWebGL:!0,bufferContainer:v}),v=this.transformPixelFormat(v,o.pixelFormat,y),w){if(w.length<v.length)throw new Error(\"Unexpected size of the 'bufferContainer'.\");w.set(v)}}else o=this.drawImage(a,t,h,l,{sx:d,sy:f,sWidth:g,sHeight:m,dWidth:p,dHeight:_},{pixelFormat:y,bUseWebGL:!0,bufferContainer:w}),v=new Uint8Array(w.buffer,0,4*p*_),v=this.transformPixelFormat(v,o.pixelFormat,y);else y===Gr.GREY?((!jr(this,zr,\"f\")||jr(this,zr,\"f\").length<4*p*_)&&Ur(this,zr,new Uint8Array(4*p*_),\"f\"),v=new Uint8Array(jr(this,zr,\"f\").buffer,0,4*p*_)):v=new Uint8Array(4*p*_),o=this.drawImage(a,t,h,l,{sx:d,sy:f,sWidth:g,sHeight:m,dWidth:p,dHeight:_},{pixelFormat:y,bUseWebGL:!0,bufferContainer:v}),v=this.transformPixelFormat(v,o.pixelFormat,y)}catch(r){if(\"WebGLError\"===r.name)return this.forceLoseContext(),console.warn(\"WebGLError: \"+(null==r?void 0:r.message)),null===(s=jn._onLog)||void 0===s||s.call(jn,\"getImageData() in WebGL failed, try again in context2d.\"),jn._webGLSupported=!1,this.getImageData(t,e,
2i);throw r}}else{null===(o=jn._onLog)||void 0===o||o.call(jn,\"getImageData() in context2d.\");let e=this._reusedCvs=this._reusedCvs||document.createElement(\"canvas\");e.width!=p&&(e.width=p),e.height!=_&&(e.height=_);let i=e.getContext(\"2d\");if(i.drawImage(t,d,f,g,g,0,0,p,_),v=new Uint8Array(i.getImageData(0,0,p,_).data.buffer),Gr.GREY===y){let t=w||new Uint8Array(p*_);for(let e=0;e<v.length;e+=4)t[e/4]=Math.round((v[e]+v[e+1]+v[e+2])/3);v=t}else null==w||w.set(v)}return null===(a=jn._onLog)||void 0===a||a.call(jn,\"getImageData() end. Costs: \"+(Date.now()-c)),{data:v,pixelFormat:y,width:p,height:_,bUseWebGL:u}}convertDataToCvs(t,e,i,r){if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray))throw new TypeError(\"Invalid 'data'.\");if(\"number\"!=typeof e||e<=0)throw new Error(\"Invalid 'width'.\");if(\"number\"!=typeof i||i<=0)throw new Error(\"Invalid 'height'.\");const n=document.createElement(\"canvas\");let s;if(n.width=e,n.height=i,r===Gr.GREY){s=new Uint8ClampedArray(4*e*i);for(let e=0;e<s.length;e+=4)s[e]=t[e/4],s[e+1]=t[e/4],s[e+2]=t[e/4],s[e+3]=255}else s=new Uint8ClampedArray(t.buffer);const o=new ImageData(s,e,i);return n.getContext(\"2d\").putImageData(o,0,0),n}forceLoseContext(){var t;if(!this._reusedWebGLCvs)return;const e=this._reusedWebGLCvs.ctxWebGL;e&&!e.isContextLost()&&(null===(t=e.getExtension(\"WEBGL_lose_context\"))||void 0===t||t.loseContext()),Ur(this,Yr,null,\"f\"),Ur(this,Hr,null,\"f\"),Ur(this,Xr,null,\"f\"),this._reusedWebGLCvs=null}dispose(){this.forceLoseContext(),Ur(this,Zr,!0,\"f\")}}Wr=new WeakMap,Yr=new WeakMap,Hr=new WeakMap,Xr=new WeakMap,zr=new WeakMap,Zr=new WeakMap;class Un{constructor(){qr.set(this,new Map),Kr.set(this,!1)}get disposed(){return Dr(this,Kr,\"f\")}on(t,e){t=t.toLowerCase();const i=Dr(this,qr,\"f\").get(t);if(i){if(i.includes(e))return;i.push(e)}else Dr(this,qr,\"f\").set(t,[e])}off(t,e){t=t.toLowerCase();const i=Dr(this,qr,\"f\").get(t);if(!i)return;const r=i.indexOf(e);-1!==r&&i.splice(r,1)}offAll(t){t=t.toLowerCase();const e=Dr(this,qr,\"f\").get(t);e&&(e.length=0)}fire(t,e=[],i={async:!1,copy:!0}){e||(e=[]),t=t.toLowerCase();const r=Dr(this,qr,\"f\").get(t);if(r&&r.length){i=Object.assign({async:!1,copy:!0},i);for(let n of r){if(!n)continue;let s=[];if(i.copy)for(let i of e){try{i=JSON.parse(JSON.stringify(i))}catch(t){}s.push(i)}else s=e;let o=!1;if(i.async)setTimeout((()=>{this.disposed||r.includes(n)&&n.apply(i.target,s)}),0);else try{o=n.apply(i.target,s)}catch(t){}if(!0===o)break}}}dispose(){Lr(this,Kr,!0,\"f\")}}qr=new WeakMap,Kr=new WeakMap;const Vn=(t,e,i,r)=>{if(!i)return t;let n=e+Math.round((t-e)/i)*i;return r&&(n=Math.min(n,r)),n};class Gn{static get version(){return\"2.0.18\"}static isStorageAvailable(t){let e;try{e=window[t];const i=\"__storage_test__\";return e.setItem(i,i),e.removeItem(i),!0}catch(t){return t instanceof DOMException&&(22===t.code||1014===t.code||\"QuotaExceededError\"===t.name||\"NS_ERROR_DOM_QUOTA_REACHED\"===t.name)&&e&&0!==e.length}}static findBestRearCameraInIOS(t,e){if(!t||!t.length)return null;let i=!1;if((null==e?void 0:e.getMainCamera)&&(i=!0),i){const e=[\"\ud6c4\uba74 \uce74\uba54\ub77c\",\"\u80cc\u9762\u30ab\u30e1\u30e9\",\"\u5f8c\u7f6e\u93e1\u982d\",\"\u540e\u7f6e\u76f8\u673a\",\"\u0e01\u0e25\u0e49\u0e2d\u0e07\u0e14\u0e49\u0e32\u0e19\u0e2b\u0e25\u0e31\u0e07\",\"\u092c\u0948\u0915 \u0915\u0948\u092e\u0930\u093e\",\"\u0627\u0644\u0643\u0627\u0645\u064a\u0631\u0627 \u0627\u0644\u062e\u0644\u0641\u064a\u0629\",\"\u05de\u05e6\u05dc\u05de\u05d4 \u05d0\u05d7\u05d5\u05e8\u05d9\u05ea\",\"\u043a\u0430\u043c\u0435\u0440\u0430 \u043d\u0430 \u0437\u0430\u0434\u043d\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438\",\"\u0437\u0430\u0434\u043d\u044f \u043a\u0430\u043c\u0435\u0440\u0430\",\"\u0437\u0430\u0434\u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0430\",\"\u0430\u0440\u0442\u049b\u044b \u043a\u0430\u043c\u0435\u0440\u0430\",\"\u03c0\u03af\u03c3\u03c9 \u03ba\u03ac\u03bc\u03b5\u03c1\u03b1\",\"zadn\u00ed fotoapar\u00e1t\",\"zadn\u00e1 kamera\",\"tylny aparat\",\"takakamera\",\"stra\u017enja kamera\",\"r\u00fcckkamera\",\"kamera p\u00e5 baksidan\",\"kamera belakang\",\"kamera bak\",\"h\u00e1ts\u00f3 kamera\",\"fotocamera (posteriore)\",\"c\u00e2mera traseira\",\"c\u00e2mara traseira\",\"c\u00e1mara trasera\",\"c\u00e0mera posterior\",\"cam\u00e9ra arri\u00e8re\",\"camer\u0103 spate\",\"camera m\u1eb7t sau\",\"camera aan achterzijde\",\"bagsidekamera\",\"back camera\",\"arka kamera\"],i=t.find((t=>e.includes(t.label.toLowerCase())));return null==i?void 0:i.deviceId}{const e=[\"\ud6c4\uba74\",\"\u80cc\u9762\",\"\u5f8c\u7f6e\",\"\u540e\u7f6e\",\"\u0e32\u0e19\u0e2b\u0e25\u0e31\u0e07\",\"\u092c\u0948\u
20915\",\"\u062e\u0644\u0641\u064a\u0629\",\"\u05d0\u05d7\u05d5\u05e8\u05d9\u05ea\",\"\u0437\u0430\u0434\u043d\u044f\u044f\",\"\u0437\u0430\u0434\u043d\u0435\u0439\",\"\u0437\u0430\u0434\u043d\u0430\",\"\u03c0\u03af\u03c3\u03c9\",\"zadn\u00ed\",\"zadn\u00e1\",\"tylny\",\"trasera\",\"traseira\",\"taka\",\"stra\u017enja\",\"spate\",\"sau\",\"r\u00fcck\",\"posteriore\",\"posterior\",\"h\u00e1ts\u00f3\",\"belakang\",\"baksidan\",\"bakre\",\"bak\",\"bagside\",\"back\",\"a\u0440\u0442\u049b\u044b\",\"arri\u00e8re\",\"arka\",\"achterzijde\"],i=[\"\ud2b8\ub9ac\ud50c\",\"\u4e09\u955c\u5934\",\"\u4e09\u93e1\u982d\",\"\u30c8\u30ea\u30d7\u30eb\",\"\u0e2a\u0e32\u0e21\",\"\u091f\u094d\u0930\u093f\u092a\u0932\",\"\u062b\u0644\u0627\u062b\u064a\u0629\",\"\u05de\u05e9\u05d5\u05dc\u05e9\u05ea\",\"\u04af\u0448\u0442\u0456\u043a\",\"\u0442\u0440\u043e\u0439\u043d\u0430\u044f\",\"\u0442\u0440\u043e\u0439\u043d\u0430\",\"\u043f\u043e\u0442\u0440\u043e\u0454\u043d\u0430\",\"\u03c4\u03c1\u03b9\u03c0\u03bb\u03ae\",\"\u00fc\u00e7l\u00fc\",\"tr\u00f3jobiektywowy\",\"trostruka\",\"trojn\u00fd\",\"trojit\u00e1\",\"trippelt\",\"trippel\",\"tripl\u0103\",\"triple\",\"tripla\",\"tiga\",\"kolmois\",\"ba camera\"],r=[\"\ub4c0\uc5bc \uc640\uc774\ub4dc\",\"\u96d9\u5ee3\u89d2\",\"\u53cc\u5e7f\u89d2\",\"\u30c7\u30e5\u30a2\u30eb\u5e83\u89d2\",\"\u0e04\u0e39\u0e48\u0e14\u0e49\u0e32\u0e19\u0e2b\u0e25\u0e31\u0e07\u0e21\u0e38\u0e21\u0e01\u0e27\u0e49\u0e32\u0e07\",\"\u0921\u094d\u092f\u0941\u0905\u0932 \u0935\u093e\u0907\u0921\",\"\u0645\u0632\u062f\u0648\u062c\u0629 \u0639\u0631\u064a\u0636\u0629\",\"\u05db\u05e4\u05d5\u05dc\u05d4 \u05e8\u05d7\u05d1\u05d4\",\"\u049b\u043e\u0441 \u043a\u0435\u04a3 \u0431\u04b1\u0440\u044b\u0448\u0442\u044b\",\"\u0437\u0434\u0432\u043e\u0454\u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u043e\u043a\u0443\u0442\u043d\u0430\",\"\u0434\u0432\u043e\u0439\u043d\u0430\u044f \u0448\u0438\u0440\u043e\u043a\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f\",\"\u0434\u0432\u043e\u0439\u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u043e\u044a\u0433\u044a\u043b\u043d\u0430\",\"\u03b4\u03b9\u03c0\u03bb\u03ae \u03b5\u03c5\u03c1\u03b5\u03af\u03b1\",\"\u00e7ift geni\u015f\",\"laajakulmainen kaksois\",\"k\u00e9p r\u1ed9ng m\u1eb7t sau\",\"kett\u0151s, sz\u00e9les l\u00e1t\u00f3sz\u00f6g\u0171\",\"grande angular dupla\",\"ganda\",\"dwuobiektywowy\",\"dwikamera\",\"dvostruka \u0161iroka\",\"du\u00e1ln\u00ed \u0161iroko\u00fahl\u00fd\",\"du\u00e1lna \u0161irokouhl\u00e1\",\"dupla grande-angular\",\"dubl\u0103\",\"dubbel vidvinkel\",\"dual-weitwinkel\",\"dual wide\",\"dual con gran angular\",\"dual\",\"double\",\"doppia con grandangolo\",\"doble\",\"dobbelt vidvinkelkamera\"],n=t.filter((t=>{const i=t.label.toLowerCase();return e.some((t=>i.includes(t)))}));if(!n.length)return null;const s=n.find((t=>{const e=t.label.toLowerCase();return i.some((t=>e.includes(t)))}));if(s)return s.deviceId;const o=n.find((t=>{const e=t.label.toLowerCase();return r.some((t=>e.includes(t)))}));return o?o.deviceId:n[0].deviceId}}static findBestRearCamera(t,e){if(!t||!t.length)return null;if([\"iPhone\",\"iPad\",\"Mac\"].includes(Nr.OS))return Gn.findBestRearCameraInIOS(t,{getMainCamera:null==e?void 0:e.getMainCameraInIOS});const i=[\"\ud6c4\",\"\u80cc\u9762\",\"\u80cc\u7f6e\",\"\u5f8c\u9762\",\"\u5f8c\u7f6e\",\"\u540e\u9762\",\"\u540e\u7f6e\",\"\u0e32\u0e19\u0e2b\u0e25\u0e31\u0e07\",\"\u0e2b\u0e25\u0e31\u0e07\",\"\u092c\u0948\u0915\",\"\u062e\u0644\u0641\u064a\u0629\",\"\u05d0\u05d7\u05d5\u05e8\u05d9\u05ea\",\"\u0437\u0430\u0434\u043d\u044f\u044f\",\"\u0437\u0430\u0434\u043d\u044f\",\"\u0437\u0430\u0434\u043d\u0435\u0439\",\"\u0437\u0430\u0434\u043d\u0430\",\"\u03c0\u03af\u03c3\u03c9\",\"zadn\u00ed\",\"zadn\u00e1\",\"tylny\",\"tr\u00e1s\",\"trasera\",\"traseira\",\"taka\",\"stra\u017enja\",\"spate\",\"sau\",\"r\u00fcck\",\"rear\",\"posteriore\",\"posterior\",\"h\u00e1ts\u00f3\",\"darrere\",\"belakang\",\"baksidan\",\"bakre\",\"bak\",\"bagside\",\"back\",\"a\u0440\u0442\u049b\u044b\",\"arri\u00e8re\",\"arka\",\"achterzijde\"];for(let e of t){const t=e.label.toLowerCase();if(t&&i.some((e=>t.includes(e)))&&/\\b0(\\b)?/.test(t))return e.deviceId}return[\"Android\",\"HarmonyOS\"].includes(Nr.OS)?t[t.length-1].deviceId:null}static findBestCamera(t,e,i){return t&&t.length?\"environment\"===e?this.findBestRearCamera(t,i):\"user\"===e?null:e?void 0:null:null}static async playVideo(t,e,i){if(!t)throw new Error(\"Invalid 'videoEl'.\");if(!e)throw new Error(\"Invalid 'source'.\");return new Promise((async(r,n)=>{let s;const o=()=>{t.removeEventListener(\"loadstart\",c),t.removeEventListener(\"abort\",u),t.removeEventListener(\"play\",d),t.removeEventListener(\"error\",f),t.removeEventListener(\"loadedmetadata\",p)};let a=!1;const h=()=>{a=!0,s&&clearTimeout(s),o(),r(t)},l=t=>{s&&clearTimeout(s),o(),n(t)},c=()=>{t.addEventListener(\"abort\",u,{once:!0})},u=()=>{const t=new Error(\"Video playing was interrupted.\");t.name=\"AbortError\",l(t)},d=()=>{h()},f=()=>{l(new Error(`Video error ${t.error.code}: ${t.error.message}.`))};let g;const m=new Promise((t=>{g=t})),p=()=>{g()};if(t.addEventListener(\"loadstart\",c,{once:!0}),t.addEventListener(\"play\",d,{once:!0}),t.addEventListener(\"error\",f,{once:!0}),t.addEventListener(\"loadedmetadata\",p,{once:!0}
2),\"string\"==typeof e||e instanceof String?t.src=e:t.srcObject=e,t.autoplay&&await new Promise((t=>{setTimeout(t,1e3)})),!a){i&&(s=setTimeout((()=>{o(),n(new Error(\"Failed to play video. Timeout.\"))}),i)),await m;try{await t.play(),h()}catch(t){console.warn(\"1st play error: \"+((null==t?void 0:t.message)||t))}if(!a)try{await t.play(),h()}catch(t){console.warn(\"2rd play error: \"+((null==t?void 0:t.message)||t)),l(t)}}}))}static async testCameraAccess(t){var e,i;if(!(null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.mediaDevices)||void 0===i?void 0:i.getUserMedia))return{ok:!1,errorName:\"InsecureContext\",errorMessage:\"Insecure context.\"};let r;try{r=t?await navigator.mediaDevices.getUserMedia(t):await navigator.mediaDevices.getUserMedia({video:!0})}catch(t){return{ok:!1,errorName:t.name,errorMessage:t.message}}finally{null==r||r.getTracks().forEach((t=>{t.stop()}))}return{ok:!0}}get state(){if(!Dr(this,un,\"f\"))return\"closed\";if(\"pending\"===Dr(this,un,\"f\"))return\"opening\";if(\"fulfilled\"===Dr(this,un,\"f\"))return\"opened\";throw new Error(\"Unknown state.\")}set ifSaveLastUsedCamera(t){t?Gn.isStorageAvailable(\"localStorage\")?Lr(this,an,!0,\"f\"):(Lr(this,an,!1,\"f\"),console.warn(\"Local storage is unavailable\")):Lr(this,an,!1,\"f\")}get ifSaveLastUsedCamera(){return Dr(this,an,\"f\")}get isVideoPlaying(){return!(!Dr(this,$r,\"f\")||Dr(this,$r,\"f\").paused)&&\"opened\"===this.state}set tapFocusEventBoundEl(t){var e,i,r;if(!(t instanceof HTMLElement)&&null!=t)throw new TypeError(\"Invalid 'element'.\");null===(e=Dr(this,_n,\"f\"))||void 0===e||e.removeEventListener(\"click\",Dr(this,pn,\"f\")),null===(i=Dr(this,_n,\"f\"))||void 0===i||i.removeEventListener(\"touchend\",Dr(this,pn,\"f\")),null===(r=Dr(this,_n,\"f\"))||void 0===r||r.removeEventListener(\"touchmove\",Dr(this,mn,\"f\")),Lr(this,_n,t,\"f\"),t&&(window.TouchEvent&&[\"Android\",\"HarmonyOS\",\"iPhone\",\"iPad\"].includes(Nr.OS)?(t.addEventListener(\"touchend\",Dr(this,pn,\"f\")),t.addEventListener(\"touchmove\",Dr(this,mn,\"f\"))):t.addEventListener(\"click\",Dr(this,pn,\"f\")))}get tapFocusEventBoundEl(){return Dr(this,_n,\"f\")}get disposed(){return Dr(this,In,\"f\")}constructor(t){var e,i;Qr.add(this),$r.set(this,null),tn.set(this,void 0),en.set(this,(()=>{\"opened\"===this.state&&Dr(this,Cn,\"f\").fire(\"resumed\",null,{target:this,async:!1})})),rn.set(this,(()=>{Dr(this,Cn,\"f\").fire(\"paused\",null,{target:this,async:!1})})),nn.set(this,void 0),sn.set(this,void 0),this.cameraOpenTimeout=15e3,this._arrCameras=[],on.set(this,void 0),an.set(this,!1),this.ifSkipCameraInspection=!1,this.selectIOSRearMainCameraAsDefault=!1,hn.set(this,void 0),ln.set(this,!0),cn.set(this,void 0),un.set(this,void 0),dn.set(this,!1),this._focusParameters={maxTimeout:400,minTimeout:300,kTimeout:void 0,oldDistance:null,fds:null,isDoingFocus:0,taskBackToContinous:null,curFocusTaskId:0,focusCancelableTime:1500,defaultFocusAreaSizeRatio:6,focusBackToContinousTime:5e3,tapFocusMinDistance:null,tapFocusMaxDistance:null,focusArea:null,tempBufferContainer:null,defaultTempBufferContainerLenRatio:1/4},fn.set(this,!1),this._focusSupported=!0,this.calculateCoordInVideo=(t,e)=>{let i,r;const n=window.getComputedStyle(Dr(this,$r,\"f\")).objectFit,s=this.getResolution(),o=Dr(this,$r,\"f\").getBoundingClientRect(),a=o.left,h=o.top,{width:l,height:c}=Dr(this,$r,\"f\").getBoundingClientRect();if(l<=0||c<=0)throw new Error(\"Unable to get video dimensions. Video may not be rendered on the page.\");const u=l/c,d=s.width/s.height;let f=1;if(\"contain\"===n)d>u?(f=l/s.width,i=(t-a)/f,r=(e-h-(c-l/d)/2)/f):(f=c/s.height,r=(e-h)/f,i=(t-a-(l-c*d)/2)/f);else{if(\"cover\"!==n)throw new Error(\"Unsupported object-fit.\");d>u?(f=c/s.height,r=(e-h)/f,i=(t-a+(c*d-l)/2)/f):(f=l/s.width,i=(t-a)/f,r=(e-h+(l/d-c)/2)/f)}return{x:i,y:r}},gn.set(this,!1),mn.set(this,(()=>{Lr(this,gn,!0,\"f\")})),pn.set(this,(async t=>{var e;if(Dr(this,gn,\"f\"))return void Lr(this,gn,!1,\"f\");if(!Dr(this,fn,\"f\"))return;if(!this.isVideoPlaying)return;if(!Dr(this,tn,\"f\"))return;if(!this._focusSupported)return;if(!this._focusParameters.fds&&(this._focusParameters.fds=null===(e=this.getCameraCapabilities())||void 0===e?void 0:e.focusDistance,!this._focusParameters.fds))return void(this._focusSupported=!1);if(null==this._focusParameters.kTimeout&&(this._focusParameters.kTimeout=(this._focusParameters.maxTimeout-this._focusParameters.minTimeout)/(1/this._focusParameters.fds.min-1/this._focusParameters.fds.max)),1==this._focusParameters.isDoingFocus)return;let i,r;if(this._focusParameters.taskBackToContinous&&(clearTimeout(this._focusParameters.taskBackToContinous),this._focusParameters.taskBackToContinous=null),t instanceof MouseEvent)i=t.clientX,r=t.clientY;else{if(!(t instanceof TouchEvent))throw new Error(\"Unknown event type.\");if(!t.changedTouches.length)return;i=t.changedTouches[0].clientX,r=t.changedTouches[0].clientY}const n=this.getResolution(),s=2*Math.round(Math.min(n.width,n.height)/this._focusParameters.defaultFocusAreaSizeRatio/2);let o;try{o=this.calculateCoordInVideo(i,r)}catch(t){}if(o.x<0||o.x>n.width||o.y<0||o.y>n.height)return;const a={x:o.x+\"px\",y:o.y+\"px\"},h=s+\"px\",l=h;let c;Gn._onLog&&(c=Date.now());try{await Dr(this,Qr,\"m\",kn).call(this,a,h,l,this._focusParameters.tapFocusMinDistance,this._focusParameters.tapFocusMaxDistance)}catch(t){if(Gn._onLog)throw Gn._onLog(t),t}
2Gn._onLog&&Gn._onLog(`Tap focus costs: ${Date.now()-c} ms`),this._focusParameters.taskBackToContinous=setTimeout((()=>{var t;Gn._onLog&&Gn._onLog(\"Back to continuous focus.\"),null===(t=Dr(this,tn,\"f\"))||void 0===t||t.applyConstraints({advanced:[{focusMode:\"continuous\"}]}).catch((()=>{}))}),this._focusParameters.focusBackToContinousTime),Dr(this,Cn,\"f\").fire(\"tapfocus\",null,{target:this,async:!1})})),_n.set(this,null),vn.set(this,1),yn.set(this,{x:0,y:0}),this.updateVideoElWhenSoftwareScaled=()=>{if(!Dr(this,$r,\"f\"))return;const t=Dr(this,vn,\"f\");if(t<1)throw new RangeError(\"Invalid scale value.\");if(1===t)Dr(this,$r,\"f\").style.transform=\"\";else{const e=window.getComputedStyle(Dr(this,$r,\"f\")).objectFit,i=Dr(this,$r,\"f\").videoWidth,r=Dr(this,$r,\"f\").videoHeight,{width:n,height:s}=Dr(this,$r,\"f\").getBoundingClientRect();if(n<=0||s<=0)throw new Error(\"Unable to get video dimensions. Video may not be rendered on the page.\");const o=n/s,a=i/r;let h=1;\"contain\"===e?h=o<a?n/(i/t):s/(r/t):\"cover\"===e&&(h=a>o?s/(i/t):n/(r/t));const l=h*(1-1/t)*(i/2-Dr(this,yn,\"f\").x),c=h*(1-1/t)*(r/2-Dr(this,yn,\"f\").y);Dr(this,$r,\"f\").style.transform=`translate(${l}px, ${c}px) scale(${t})`}},wn.set(this,(function(){if(!(this.data instanceof Uint8Array||this.data instanceof Uint8ClampedArray))throw new TypeError(\"Invalid data.\");if(\"number\"!=typeof this.width||this.width<=0)throw new Error(\"Invalid width.\");if(\"number\"!=typeof this.height||this.height<=0)throw new Error(\"Invalid height.\");const t=document.createElement(\"canvas\");let e;if(t.width=this.width,t.height=this.height,this.pixelFormat===Gr.GREY){e=new Uint8ClampedArray(this.width*this.height*4);for(let t=0;t<e.length;t+=4)e[t]=this.data[t/4],e[t+1]=this.data[t/4],e[t+2]=this.data[t/4],e[t+3]=255}else e=new Uint8ClampedArray(this.data.buffer);const i=new ImageData(e,this.width,this.height);return t.getContext(\"2d\").putImageData(i,0,0),t})),Cn.set(this,void 0),En.set(this,[\"before:open\",\"opened\",\"before:close\",\"closed\",\"before:camera:change\",\"camera:changed\",\"before:resolution:change\",\"resolution:changed\",\"played\",\"paused\",\"resumed\",\"tapfocus\"]),this.detectedResolutions=[{width:160,height:120},{width:320,height:240},{width:480,height:360},{width:640,height:480},{width:800,height:600},{width:960,height:720},{width:1280,height:720},{width:1920,height:1080},{width:2560,height:1440},{width:3840,height:2160}],Tn.set(this,new Map),Sn.set(this,!1),bn.set(this,(async()=>{var t,e;if(\"visible\"===document.visibilityState){if(Gn._onLog&&Gn._onLog(\"document visible. video paused: \"+(null===(t=Dr(this,$r,\"f\"))||void 0===t?void 0:t.paused)),\"opening\"==this.state||\"opened\"==this.state){let e=!1;if(!this.isVideoPlaying){Gn._onLog&&Gn._onLog(\"document visible. Not auto resume. 1st resume start.\");try{await this.resume(),e=!0}catch(t){Gn._onLog&&Gn._onLog(\"document visible. 1st resume video failed, try open instead.\")}e||await Dr(this,Qr,\"m\",Dn).call(this)}if(await new Promise((t=>setTimeout(t,300))),!this.isVideoPlaying){Gn._onLog&&Gn._onLog(\"document visible. 1st open failed. 2rd resume start.\"),e=!1;try{await this.resume(),e=!0}catch(t){Gn._onLog&&Gn._onLog(\"document visible. 2rd resume video failed, try open instead.\")}e||await Dr(this,Qr,\"m\",Dn).call(this)}}}else\"hidden\"===document.visibilityState&&(Gn._onLog&&Gn._onLog(\"document hidden. video paused: \"+(null===(e=Dr(this,$r,\"f\"))||void 0===e?void 0:e.paused)),\"opening\"==this.state||\"opened\"==this.state&&this.isVideoPlaying&&this.pause())})),In.set(this,!1),(null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.mediaDevices)||void 0===i?void 0:i.getUserMedia)||setTimeout((()=>{Gn.onWarning&&Gn.onWarning(\"The browser is too old or the page is loaded from an insecure origin.\")}),0),this.defaultConstraints={video:{facingMode:{ideal:\"environment\"}}},this.resetMediaStreamConstraints(),t instanceof HTMLVideoElement&&this.setVideoEl(t),Lr(this,Cn,new Un,\"f\"),this.imageDataGetter=new jn,document.addEventListener(\"visibilitychange\",Dr(this,bn,\"f\"))}setVideoEl(t){if(!(t&&t instanceof HTMLVideoElement))throw new Error(\"Invalid 'videoEl'.\");t.addEventListener(\"play\",Dr(this,en,\"f\")),t.addEventListener(\"pause\",Dr(this,rn,\"f\")),Lr(this,$r,t,\"f\")}getVideoEl(){return Dr(this,$r,\"f\")}releaseVideoEl(){var t,e;null===(t=Dr(this,$r,\"f\"))||void 0===t||t.removeEventListener(\"play\",Dr(this,en,\"f\")),null===(e=Dr(this,$r,\"f\"))||void 0===e||e.removeEventListener(\"pause\",Dr(this,rn,\"f\")),Lr(this,$r,null,\"f\")}isVideoLoaded(){return!!Dr(this,$r,\"f\")&&4==Dr(this,$r,\"f\").readyState}
2async open(){if(Dr(this,cn,\"f\")&&!Dr(this,ln,\"f\")){if(\"pending\"===Dr(this,un,\"f\"))return Dr(this,cn,\"f\");if(\"fulfilled\"===Dr(this,un,\"f\"))return}Dr(this,Cn,\"f\").fire(\"before:open\",null,{target:this}),await Dr(this,Qr,\"m\",Dn).call(this),Dr(this,Cn,\"f\").fire(\"played\",null,{target:this,async:!1}),Dr(this,Cn,\"f\").fire(\"opened\",null,{target:this,async:!1})}async close(){if(\"closed\"===this.state)return;Dr(this,Cn,\"f\").fire(\"before:close\",null,{target:this});const t=Dr(this,cn,\"f\");if(Dr(this,Qr,\"m\",Mn).call(this),t&&\"pending\"===Dr(this,un,\"f\")){try{await t}catch(t){}if(!1===Dr(this,ln,\"f\")){const t=new Error(\"'close()' was interrupted.\");throw t.name=\"AbortError\",t}}Lr(this,cn,null,\"f\"),Lr(this,un,null,\"f\"),Dr(this,Cn,\"f\").fire(\"closed\",null,{target:this,async:!1})}pause(){if(!this.isVideoLoaded())throw new Error(\"Video is not loaded.\");if(\"opened\"!==this.state)throw new Error(\"Camera or video is not open.\");Dr(this,$r,\"f\").pause()}async resume(){if(!this.isVideoLoaded())throw new Error(\"Video is not loaded.\");if(\"opened\"!==this.state)throw new Error(\"Camera or video is not open.\");await Dr(this,$r,\"f\").play()}async setCamera(t){if(\"string\"!=typeof t)throw new TypeError(\"Invalid 'deviceId'.\");if(\"object\"!=typeof Dr(this,nn,\"f\").video&&(Dr(this,nn,\"f\").video={}),delete Dr(this,nn,\"f\").video.facingMode,Dr(this,nn,\"f\").video.deviceId={exact:t},!(\"closed\"===this.state||this.videoSrc||\"opening\"===this.state&&Dr(this,ln,\"f\"))){Dr(this,Cn,\"f\").fire(\"before:camera:change\",[],{target:this,async:!1}),await Dr(this,Qr,\"m\",Ln).call(this);try{this.resetSoftwareScale()}catch(t){}return Dr(this,sn,\"f\")}}async switchToFrontCamera(t){if(\"object\"!=typeof Dr(this,nn,\"f\").video&&(Dr(this,nn,\"f\").video={}),(null==t?void 0:t.resolution)&&(Dr(this,nn,\"f\").video.width={ideal:t.resolution.width},Dr(this,nn,\"f\").video.height={ideal:t.resolution.height}),delete Dr(this,nn,\"f\").video.deviceId,Dr(this,nn,\"f\").video.facingMode={exact:\"user\"},Lr(this,on,null,\"f\"),!(\"closed\"===this.state||this.videoSrc||\"opening\"===this.state&&Dr(this,ln,\"f\"))){Dr(this,Cn,\"f\").fire(\"before:camera:change\",[],{target:this,async:!1}),Dr(this,Qr,\"m\",Ln).call(this);try{this.resetSoftwareScale()}catch(t){}return Dr(this,sn,\"f\")}}getCamera(){var t;if(Dr(this,sn,\"f\"))return Dr(this,sn,\"f\");{let e=(null===(t=Dr(this,nn,\"f\").video)||void 0===t?void 0:t.deviceId)||\"\";if(e){e=e.exact||e.ideal||e;for(let t of this._arrCameras)if(t.deviceId===e)return JSON.parse(JSON.stringify(t))}return{deviceId:\"\",label:\"\",_checked:!1}}}async _getCameras(t){var e,i;if(!(null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.mediaDevices)||void 0===i?void 0:i.getUserMedia))throw new Error(\"Failed to access the camera because the browser is too old or the page is loaded from an insecure origin.\");let r;if(t){let t=await navigator.mediaDevices.getUserMedia({video:!0});r=(await navigator.mediaDevices.enumerateDevices()).filter((t=>\"videoinput\"===t.kind)),t.getTracks().forEach((t=>{t.stop()}))}else r=(await navigator.mediaDevices.enumerateDevices()).filter((t=>\"videoinput\"===t.kind));const n=[],s=[];if(this._arrCameras)for(let t of this._arrCameras)t._checked&&s.push(t);for(let t=0;t<r.length;t++){let e,i=r[t];for(let t of s)if(i.deviceId==t.deviceId){e=t;break}e||(e={deviceId:i.deviceId,label:i.label?i.label:\"camera \"+t,_checked:!1}),e.deviceId&&n.push(e)}return this._arrCameras=n,Gn._onLog&&Gn._onLog(JSON.stringify(this._arrCameras)),n}async getCameras(){var t,e;if(!(null===(e=null===(t=null===window||void 0===window?void 0:window.navigator)||void 0===t?void 0:t.mediaDevices)||void 0===e?void 0:e.enumerateDevices))throw new Error(\"Failed to access the camera because the browser is too old or the page is loaded from an insecure origin.\");const i=(await navigator.mediaDevices.enumerateDevices()).filter((t=>\"videoinput\"===t.kind));return i&&i.length&&!i[0].deviceId?this._getCameras(!0):this._getCameras(!1)}async getAllCameras(){return this.getCameras()}
2async setResolution(t,e,i){if(\"number\"!=typeof t||t<=0)throw new TypeError(\"Invalid 'width'.\");if(\"number\"!=typeof e||e<=0)throw new TypeError(\"Invalid 'height'.\");if(\"object\"!=typeof Dr(this,nn,\"f\").video&&(Dr(this,nn,\"f\").video={}),i?(Dr(this,nn,\"f\").video.width={exact:t},Dr(this,nn,\"f\").video.height={exact:e}):(Dr(this,nn,\"f\").video.width={ideal:t},Dr(this,nn,\"f\").video.height={ideal:e}),\"closed\"===this.state||this.videoSrc||\"opening\"===this.state&&Dr(this,ln,\"f\"))return null;Dr(this,Cn,\"f\").fire(\"before:resolution:change\",[],{target:this,async:!1}),await Dr(this,Qr,\"m\",Ln).call(this);try{this.resetSoftwareScale()}catch(t){}const r=this.getResolution();return{width:r.width,height:r.height}}getResolution(){if(\"opened\"===this.state&&this.videoSrc&&Dr(this,$r,\"f\"))return{width:Dr(this,$r,\"f\").videoWidth,height:Dr(this,$r,\"f\").videoHeight};if(Dr(this,tn,\"f\")){const t=Dr(this,tn,\"f\").getSettings();return{width:t.width,height:t.height}}if(this.isVideoLoaded())return{width:Dr(this,$r,\"f\").videoWidth,height:Dr(this,$r,\"f\").videoHeight};{const t={width:0,height:0};let e=Dr(this,nn,\"f\").video.width||0,i=Dr(this,nn,\"f\").video.height||0;return e&&(t.width=e.exact||e.ideal||e),i&&(t.height=i.exact||i.ideal||i),t}}async getResolutions(t){var e,i,r,n,s,o,a,h,l,c,u;if(!(null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.mediaDevices)||void 0===i?void 0:i.getUserMedia))throw new Error(\"Failed to access the camera because the browser is too old or the page is loaded from an insecure origin.\");let d=\"\";const f=(t,e)=>{const i=Dr(this,Tn,\"f\").get(t);if(!i||!i.length)return!1;for(let t of i)if(t.width===e.width&&t.height===e.height)return!0;return!1};if(this._mediaStream){d=null===(u=Dr(this,sn,\"f\"))||void 0===u?void 0:u.deviceId;let e=Dr(this,Tn,\"f\").get(d);if(e&&!t)return JSON.parse(JSON.stringify(e));e=[],Dr(this,Tn,\"f\").set(d,e),Lr(this,dn,!0,\"f\");try{for(let t of this.detectedResolutions){await Dr(this,tn,\"f\").applyConstraints({width:{ideal:t.width},height:{ideal:t.height}}),Dr(this,Qr,\"m\",On).call(this);const i=Dr(this,tn,\"f\").getSettings(),r={width:i.width,height:i.height};f(d,r)||e.push({width:r.width,height:r.height})}}catch(t){throw Dr(this,Qr,\"m\",Mn).call(this),Lr(this,dn,!1,\"f\"),t}try{await Dr(this,Qr,\"m\",Dn).call(this)}catch(t){if(\"AbortError\"===t.name)return e;throw t}finally{Lr(this,dn,!1,\"f\")}return e}{const e=async(t,e,i)=>{const r={video:{deviceId:{exact:t},width:{ideal:e},height:{ideal:i}}};let n=null;try{n=await navigator.mediaDevices.getUserMedia(r)}catch(t){return null}if(!n)return null;const s=n.getVideoTracks();let o=null;try{const t=s[0].getSettings();o={width:t.width,height:t.height}}catch(t){const e=document.createElement(\"video\");e.srcObject=n,o={width:e.videoWidth,height:e.videoHeight},e.srcObject=null}return s.forEach((t=>{t.stop()})),o};let i=(null===(s=null===(n=null===(r=Dr(this,nn,\"f\"))||void 0===r?void 0:r.video)||void 0===n?void 0:n.deviceId)||void 0===s?void 0:s.exact)||(null===(h=null===(a=null===(o=Dr(this,nn,\"f\"))||void 0===o?void 0:o.video)||void 0===a?void 0:a.deviceId)||void 0===h?void 0:h.ideal)||(null===(c=null===(l=Dr(this,nn,\"f\"))||void 0===l?void 0:l.video)||void 0===c?void 0:c.deviceId);if(!i)return[];let u=Dr(this,Tn,\"f\").get(i);if(u&&!t)return JSON.parse(JSON.stringify(u));u=[],Dr(this,Tn,\"f\").set(i,u);for(let t of this.detectedResolutions){const r=await e(i,t.width,t.height);r&&!f(i,r)&&u.push({width:r.width,height:r.height})}return u}}async setMediaStreamConstraints(t,e){if(!(t=>{return null!==t&&\"[object Object]\"===(e=t,Object.prototype.toString.call(e));var e})(t))throw new TypeError(\"Invalid 'mediaStreamConstraints'.\");Lr(this,nn,JSON.parse(JSON.stringify(t)),\"f\"),Lr(this,on,null,\"f\"),e&&Dr(this,Qr,\"m\",Ln).call(this)}getMediaStreamConstraints(){return JSON.parse(JSON.stringify(Dr(this,nn,\"f\")))}resetMediaStreamConstraints(){Lr(this,nn,this.defaultConstraints?JSON.parse(JSON.stringify(this.defaultConstraints)):null,\"f\")}getCameraCapabilities(){if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");return Dr(this,tn,\"f\").getCapabilities?Dr(this,tn,\"f\").getCapabilities():{}}getCameraSettings(){if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");return Dr(this,tn,\"f\").getSettings()}async turnOnTorch(){if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const t=this.getCameraCapabilities();if(!(null==t?void 0:t.torch))throw Error(\"Not supported.\");await Dr(this,tn,\"f\").applyConstraints({advanced:[{torch:!0}]})}async turnOffTorch(){if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const t=this.getCameraCapabilities();if(!(null==t?void 0:t.torch))throw Error(\"Not supported.\");await Dr(this,tn,\"f\").applyConstraints({advanced:[{torch:!1}]})}async setColorTemperature(t,e){var i;if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'value'.\");if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const r=null===(i=this.getCameraCapabilities())||void 0===i?void 0:i.colorTemperature;if(!r)throw Error(\"Not supported.\");return e&&(t<r.min?t=r.min:t>r.max&&(t=r.max),t=Vn(t,r.min,r.step,r.max)),await Dr(this,tn,\"f\").applyConstraints({advanced:[{colorTemperature:t,whiteBalanceMode:\"manual\"}]}),t}getColorTemperature(){return this.getCameraSettings().colorTemperature||0}async setExposureCompensation(t,e){var i;if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'value'.\");if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const r=null===(i=this.getCameraCapabilities())||void 0===i?void 0:i.exposureCompensation;if(!r)throw Error(\"Not supported.\");return e&&(t<r.min?t=r.min:t>r.max&&(t=r.max),t=Vn(t,r.min,r.step,r.max)),await Dr(this,tn,\"f\").applyConstraints({advanced:[{exposureCompensation:t}]}),t}getExposureCompensation(){return this.getCameraSettings().exposureCompensation||0}async setFrameRate(t,e){var i;if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'value'.\");if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");let r=null===(i=this.getCameraCapabilities())||void 0===i?void 0:i.frameRate;if(!r)throw Error(\"Not supported.\");e&&(t<r.min?t=r.min:t>r.max&&(t=r.max));const n=this.getResolution();return await Dr(this,tn,\"f\").applyConstraints({width:{ideal:Math.max(n.width,n.height)},frameRate:t}),t}getFrameRate(){return this.getCameraSettings().frameRate}async setFocus(t,e){if(\"object\"!=typeof t||Array.isArray(t)||null==t)throw new TypeError(\"Invalid 'settings'.\");if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const i=this.getCameraCapabilities(),r=null==i?void 0:i.focusMode,n=null==i?void 0:i.focusDistance;if(!r)throw Error(\"Not supported.\");if(\"string\"!=typeof t.mode)throw TypeError(\"Invalid 'mode'.\");const s=t.mode.toLowerCase();if(!r.includes(s))throw Error(\"Unsupported focus mode.\");if(\"manual\"===s){if(!n)throw Error(\"Manual focus unsupported.\");if(t.hasOwnProperty(\"distance\")){let i=t.distance;e&&(i<n.min?i=n.min:i>n.max&&(i=n.max),i=Vn(i,n.min,n.step,n.max)),this._focusParameters.focusArea=null,await Dr(this,tn,\"f\").applyConstraints({advanced:[{focusMode:s,focusDistance:i}]})}else{if(!t.area)throw new Error(\"'distance' or 'area' should be specified in 'manual' mode.\");{const e=t.area.centerPoint;let i=t.area.width,r=t.area.height;if(!i||!r){const t=this.getResolution();i||(i=2*Math.round(Math.min(t.width,t.height)/this._focusParameters.defaultFocusAreaSizeRatio/2)+\"px\"),r||(r=2*Math.round(Math.min(t.width,t.height)/this._focusParameters.defaultFocusAreaSizeRatio/2)+\"px\")}this._focusParameters.focusArea={centerPoint:{x:e.x,y:e.y},width:i,height:r},await Dr(this,Qr,\"m\",kn).call(this,e,i,r)}}}else this._focusParameters.focusArea=null,await Dr(this,tn,\"f\").applyConstraints({advanced:[{focusMode:s}]})}getFocus(){const t=this.getCameraSettings(),e=t.focusMode;return e?\"manual\"===e?this._focusParameters.focusArea?{mode:\"manual\",area:JSON.parse(JSON.stringify(this._focusParameters.focusArea))}:{mode:\"manual\",distance:t.focusDistance}:{mode:e}:null}async enableTapToFocus(){Lr(this,fn,!0,\"f\")}disableTapToFocus(){Lr(this,fn,!1,\"f\")}isTapToFocusEnabled(){return Dr(this,fn,\"f\")}async setZoom(t){if(\"object\"!=typeof t||Array.isArray(t)||null==t)throw new TypeError(\"Invalid 'settings'.\");if(\"number\"!=typeof t.factor)throw new TypeError(\"Illegal type of 'factor'.\");if(t.factor<1)throw new RangeError(\"Invalid 'factor'.\");if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");t.centerPoint?Dr(this,Qr,\"m\",Bn).call(this,t.centerPoint):this.resetScaleCenter();try{if(Dr(this,Qr,\"m\",Nn).call(this,Dr(this,yn,\"f\"))){const e=await this.setHardwareScale(t.factor,!0);let i=this.getHardwareScale();1==i&&1!=e&&(i=e),t.factor>i?this.setSoftwareScale(t.factor/i):this.setSoftwareScale(1)}else await this.setHardwareScale(1),this.setSoftwareScale(t.factor)}catch(e){const i=e.message||e;if(\"Not supported.\"!==i&&\"Camera is not open.\"!==i)throw e;this.setSoftwareScale(t.factor)}}
2getZoom(){if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");let t=1;try{t=this.getHardwareScale()}catch(t){if(\"Camera is not open.\"!==(t.message||t))throw t}return{factor:t*Dr(this,vn,\"f\")}}async resetZoom(){await this.setZoom({factor:1})}async setHardwareScale(t,e){var i;if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'value'.\");if(t<1)throw new RangeError(\"Invalid 'value'.\");if(!Dr(this,tn,\"f\")||\"opened\"!==this.state)throw new Error(\"Camera is not open.\");const r=null===(i=this.getCameraCapabilities())||void 0===i?void 0:i.zoom;if(!r)throw Error(\"Not supported.\");return e&&(t<r.min?t=r.min:t>r.max&&(t=r.max),t=Vn(t,r.min,r.step,r.max)),await Dr(this,tn,\"f\").applyConstraints({advanced:[{zoom:t}]}),t}getHardwareScale(){return this.getCameraSettings().zoom||1}setSoftwareScale(t,e){if(\"number\"!=typeof t)throw new TypeError(\"Invalid 'value'.\");if(t<1)throw new RangeError(\"Invalid 'value'.\");if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");e&&Dr(this,Qr,\"m\",Bn).call(this,e),Lr(this,vn,t,\"f\"),this.updateVideoElWhenSoftwareScaled()}getSoftwareScale(){return Dr(this,vn,\"f\")}resetScaleCenter(){if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");const t=this.getResolution();Lr(this,yn,{x:t.width/2,y:t.height/2},\"f\")}resetSoftwareScale(){this.setSoftwareScale(1),this.resetScaleCenter()}getFrameData(t){if(this.disposed)throw Error(\"The 'Camera' instance has been disposed.\");if(!this.isVideoLoaded())return null;if(Dr(this,dn,\"f\"))return null;const e=Date.now();Gn._onLog&&Gn._onLog(\"getFrameData() START: \"+e);const i=Dr(this,$r,\"f\").videoWidth,r=Dr(this,$r,\"f\").videoHeight;let n={sx:0,sy:0,sWidth:i,sHeight:r,dWidth:i,dHeight:r};(null==t?void 0:t.position)&&(n=JSON.parse(JSON.stringify(t.position)));let s=Gr.RGBA;(null==t?void 0:t.pixelFormat)&&(s=t.pixelFormat);let o=Dr(this,vn,\"f\");(null==t?void 0:t.scale)&&(o=t.scale);let a=Dr(this,yn,\"f\");if(null==t?void 0:t.scaleCenter){if(\"string\"!=typeof t.scaleCenter.x||\"string\"!=typeof t.scaleCenter.y)throw new Error(\"Invalid scale center.\");let e=0,n=0;if(t.scaleCenter.x.endsWith(\"px\"))e=parseFloat(t.scaleCenter.x);else{if(!t.scaleCenter.x.endsWith(\"%\"))throw new Error(\"Invalid scale center.\");e=parseFloat(t.scaleCenter.x)/100*i}if(t.scaleCenter.y.endsWith(\"px\"))n=parseFloat(t.scaleCenter.y);else{if(!t.scaleCenter.y.endsWith(\"%\"))throw new Error(\"Invalid scale center.\");n=parseFloat(t.scaleCenter.y)/100*r}if(isNaN(e)||isNaN(n))throw new Error(\"Invalid scale center.\");a.x=Math.round(e),a.y=Math.round(n)}let h=null;if((null==t?void 0:t.bufferContainer)&&(h=t.bufferContainer),0==i||0==r)return null;1!==o&&(n.sWidth=Math.round(n.sWidth/o),n.sHeight=Math.round(n.sHeight/o),n.sx=Math.round((1-1/o)*a.x+n.sx/o),n.sy=Math.round((1-1/o)*a.y+n.sy/o));const l=this.imageDataGetter.getImageData(Dr(this,$r,\"f\"),n,{pixelFormat:s,bufferContainer:h});if(!l)return null;const c=Date.now();return Gn._onLog&&Gn._onLog(\"getFrameData() END: \"+c),{data:l.data,width:l.width,height:l.height,pixelFormat:l.pixelFormat,timeSpent:c-e,timeStamp:c,toCanvas:Dr(this,wn,\"f\")}}on(t,e){if(!Dr(this,En,\"f\").includes(t.toLowerCase()))throw new Error(`Event '${t}' does not exist.`);Dr(this,Cn,\"f\").on(t,e)}off(t,e){Dr(this,Cn,\"f\").off(t,e)}async dispose(){this.tapFocusEventBoundEl=null,await this.close(),this.releaseVideoEl(),Dr(this,Cn,\"f\").dispose(),this.imageDataGetter.dispose(),document.removeEventListener(\"visibilitychange\",Dr(this,bn,\"f\")),Lr(this,In,!0,\"f\")}}var Wn,Yn,Hn,Xn,zn,Zn,qn,Kn,Jn,Qn,$n,ts,es,is,rs,ns,ss,os,as,hs,ls,cs,us,ds,fs,gs,ms,ps,_s,vs,ys,ws,Cs,Es,Ts;$r=new WeakMap,tn=new WeakMap,en=new WeakMap,rn=new WeakMap,nn=new WeakMap,sn=new WeakMap,on=new WeakMap,an=new WeakMap,hn=new WeakMap,ln=new WeakMap,cn=new WeakMap,un=new WeakMap,dn=new WeakMap,fn=new WeakMap,gn=new WeakMap,mn=new WeakMap,pn=new WeakMap,_n=new WeakMap,vn=new WeakMap,yn=new WeakMap,wn=new WeakMap,Cn=new WeakMap,En=new WeakMap,Tn=new WeakMap,Sn=new WeakMap,bn=new WeakMap,In=new WeakMap,Qr=new WeakSet,xn=async function(){const t=this.getMediaStreamConstraints();if(\"boolean\"==typeof t.video&&(t.video={}),t.video.deviceId);else if(Dr(this,on,\"f\"))delete t.video.facingMode,t.video.deviceId={exact:Dr(this,on,\"f\")};else if(this.ifSaveLastUsedCamera&&Gn.isStorageAvailable&&window.localStorage.getItem(\"dce_last_camera_id\")){delete t.video.facingMode,t.video.deviceId={ideal:window.localStorage.getItem(\"dce_last_camera_id\")};const e=JSON.parse(window.localStorage.getItem(\"dce_last_apply_width\")),i=JSON.parse(window.localStorage.getItem(\"dce_last_apply_height\"));e&&i&&(t.video.width=e,t.video.height=i)}else if(this.ifSkipCameraInspection);else{const e=async t=>{let e=null;return\"environment\"===t&&[\"Android\",\"HarmonyOS\",\"iPhone\",\"iPad\"].includes(Nr.OS)?(await this._getCameras(!1),Dr(this,Qr,\"m\",On).call(this),e=Gn.findBestCamera(this._arrCameras,\"environment\",{getMainCameraInIOS:this.selectIOSRearMainCameraAsDefault})):t||[\"Android\",\"HarmonyOS\",\"iPhone\",\"iPad\"].includes(Nr.OS)||(await this._getCameras(!1),Dr(this,Qr,\"m\",On).call(this),e=Gn.findBestCamera(this._arrCameras,null,{getMainCameraInIOS:this.selectIOSRearMainCameraAsDefault})),e};let i=t.video.facingMode;i instanceof Array&&i.length&&(i=i[0]),\"object\"==typeof i&&(i=i.exact||i.ideal);const r=await e(i);r&&(delete t.video.facingMode,t.video.deviceId={exact:r})}return t},On=function(){if(Dr(this,ln,\"f\")){const t=new Error(\"The operation was interrupted.\");throw t.name=\"AbortError\",t}},An=async function(t){var e,i;if(!(null===(i=null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.mediaDevices)||void 0===i?void 0:i.getUserMedia))throw new Error(\"Failed to access the camera because the browser is too old or the page is loaded from an insecure origin.\");let r;try{Gn._onLog&&Gn._onLog(\"======try getUserMedia========\");let e=[0,500,1e3,2e3],i=null;const n=async t=>{for(let n of e){n&&(await new Promise((t=>setTimeout(t,n))),Dr(this,Qr,\"m\",On).call(this));try{Gn._onLog&&Gn._onLog(\"ask \"+JSON.stringify(t)),r=await navigator.mediaDevices.getUserMedia(t),Dr(this,Qr,\"m\",On).call(this);break}catch(t){if(\"NotFoundError\"===t.name||\"NotAllowedError\"===t.name||\"AbortError\"===t.name||\"OverconstrainedError\"===t.name)throw t;i=t,Gn._onLog&&Gn._onLog(t.message||t)}}};if(await n(t),r||\"object\"!=typeof t.video||(t.video.deviceId&&(delete t.video.deviceId,await n(t)),!r&&t.video.facingMode&&(delete t.video.facingMode,await n(t)),r||!t.video.width&&!t.video.height||(delete t.video.width,delete t.video.height,await n(t))),!r)throw i;return r}
2catch(t){throw null==r||r.getTracks().forEach((t=>{t.stop()})),\"NotFoundError\"===t.name&&(DOMException?t=new DOMException(\"No camera available, please use a device with an accessible camera.\",t.name):(t=new Error(\"No camera available, please use a device with an accessible camera.\")).name=\"NotFoundError\"),t}},Rn=function(){this._mediaStream&&(this._mediaStream.getTracks().forEach((t=>{t.stop()})),this._mediaStream=null),Lr(this,tn,null,\"f\")},Dn=async function(){Lr(this,ln,!1,\"f\");const t=Lr(this,hn,Symbol(),\"f\");if(Dr(this,cn,\"f\")&&\"pending\"===Dr(this,un,\"f\")){try{await Dr(this,cn,\"f\")}catch(t){}Dr(this,Qr,\"m\",On).call(this)}if(t!==Dr(this,hn,\"f\"))return;const e=Lr(this,cn,(async()=>{Lr(this,un,\"pending\",\"f\");try{if(this.videoSrc){if(!Dr(this,$r,\"f\"))throw new Error(\"'videoEl' should be set.\");await Gn.playVideo(Dr(this,$r,\"f\"),this.videoSrc,this.cameraOpenTimeout),Dr(this,Qr,\"m\",On).call(this)}else{let t=await Dr(this,Qr,\"m\",xn).call(this);Dr(this,Qr,\"m\",Rn).call(this);let e=await Dr(this,Qr,\"m\",An).call(this,t);await this._getCameras(!1),Dr(this,Qr,\"m\",On).call(this);const i=()=>{const t=e.getVideoTracks();let i,r;if(t.length&&(i=t[0]),i){const t=i.getSettings();if(t)for(let e of this._arrCameras)if(t.deviceId===e.deviceId){e._checked=!0,e.label=i.label,r=e;break}}return r},r=Dr(this,nn,\"f\");if(\"object\"==typeof r.video){let n=r.video.facingMode;if(n instanceof Array&&n.length&&(n=n[0]),\"object\"==typeof n&&(n=n.exact||n.ideal),!(Dr(this,on,\"f\")||this.ifSaveLastUsedCamera&&Gn.isStorageAvailable&&window.localStorage.getItem(\"dce_last_camera_id\")||this.ifSkipCameraInspection||r.video.deviceId)){const r=i(),s=Gn.findBestCamera(this._arrCameras,n,{getMainCameraInIOS:this.selectIOSRearMainCameraAsDefault});s&&s!=(null==r?void 0:r.deviceId)&&(e.getTracks().forEach((t=>{t.stop()})),t.video.deviceId={exact:s},e=await Dr(this,Qr,\"m\",An).call(this,t),Dr(this,Qr,\"m\",On).call(this))}}const n=i();(null==n?void 0:n.deviceId)&&(Lr(this,on,n&&n.deviceId,\"f\"),this.ifSaveLastUsedCamera&&Gn.isStorageAvailable&&(window.localStorage.setItem(\"dce_last_camera_id\",Dr(this,on,\"f\")),\"object\"==typeof t.video&&t.video.width&&t.video.height&&(window.localStorage.setItem(\"dce_last_apply_width\",JSON.stringify(t.video.width)),window.localStorage.setItem(\"dce_last_apply_height\",JSON.stringify(t.video.height))))),Dr(this,$r,\"f\")&&(await Gn.playVideo(Dr(this,$r,\"f\"),e,this.cameraOpenTimeout),Dr(this,Qr,\"m\",On).call(this)),this._mediaStream=e;const s=e.getVideoTracks();(null==s?void 0:s.length)&&Lr(this,tn,s[0],\"f\"),Lr(this,sn,n,\"f\")}}catch(t){throw Dr(this,Qr,\"m\",Mn).call(this),Lr(this,un,null,\"f\"),t}Lr(this,un,\"fulfilled\",\"f\")})(),\"f\");return e},Ln=async function(){var t;if(\"closed\"===this.state||this.videoSrc)return;const e=null===(t=Dr(this,sn,\"f\"))||void 0===t?void 0:t.deviceId,i=this.getResolution();await Dr(this,Qr,\"m\",Dn).call(this);const r=this.getResolution();e&&e!==Dr(this,sn,\"f\").deviceId&&Dr(this,Cn,\"f\").fire(\"camera:changed\",[Dr(this,sn,\"f\").deviceId,e],{target:this,async:!1}),i.width==r.width&&i.height==r.height||Dr(this,Cn,\"f\").fire(\"resolution:changed\",[{width:r.width,height:r.height},{width:i.width,height:i.height}],{target:this,async:!1}),Dr(this,Cn,\"f\").fire(\"played\",null,{target:this,async:!1})},Mn=function(){Dr(this,Qr,\"m\",Rn).call(this),Lr(this,sn,null,\"f\"),Dr(this,$r,\"f\")&&(Dr(this,$r,\"f\").srcObject=null,this.videoSrc&&(Dr(this,$r,\"f\").pause(),Dr(this,$r,\"f\").currentTime=0)),Lr(this,ln,!0,\"f\");try{this.resetSoftwareScale()}catch(t){}},Fn=async function t(e,i){const r=t=>{if(!Dr(this,tn,\"f\")||!this.isVideoPlaying||t.focusTaskId!=this._focusParameters.curFocusTaskId){Dr(this,tn,\"f\")&&this.isVideoPlaying||(this._focusParameters.isDoingFocus=0);const e=new Error(`Focus task ${t.focusTaskId} canceled.`);throw e.name=\"DeprecatedTaskError\",e}1===this._focusParameters.isDoingFocus&&Date.now()-t.timeStart>this._focusParameters.focusCancelableTime&&(this._focusParameters.isDoingFocus=-1)};let n;i=Vn(i,this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),await Dr(this,tn,\"f\").applyConstraints({advanced:[{focusMode:\"manual\",focusDistance:i}]}),r(e),n=null==this._focusParameters.oldDistance?this._focusParameters.kTimeout*Math.max(Math.abs(1/this._focusParameters.fds.min-1/i),Math.abs(1/this._focusParameters.fds.max-1/i))+this._focusParameters.minTimeout:this._focusParameters.kTimeout*Math.abs(1/this._focusParameters.oldDistance-1/i)+this._focusParameters.minTimeout,this._focusParameters.oldDistance=i,await new Promise((t=>{setTimeout(t,n)}
2)),r(e);let s=e.focusL-e.focusW/2,o=e.focusT-e.focusH/2,a=e.focusW,h=e.focusH;const l=this.getResolution();s=Math.round(s),o=Math.round(o),a=Math.round(a),h=Math.round(h),a>l.width&&(a=l.width),h>l.height&&(h=l.height),s<0?s=0:s+a>l.width&&(s=l.width-a),o<0?o=0:o+h>l.height&&(o=l.height-h);const c=4*l.width*l.height*this._focusParameters.defaultTempBufferContainerLenRatio,u=4*a*h;let d=this._focusParameters.tempBufferContainer;if(d){const t=d.length;c>t&&c>=u?d=new Uint8Array(c):u>t&&u>=c&&(d=new Uint8Array(u))}else d=this._focusParameters.tempBufferContainer=new Uint8Array(Math.max(c,u));if(!this.imageDataGetter.getImageData(Dr(this,$r,\"f\"),{sx:s,sy:o,sWidth:a,sHeight:h,dWidth:a,dHeight:h},{pixelFormat:Gr.RGBA,bufferContainer:d}))return Dr(this,Qr,\"m\",t).call(this,e,i);const f=d;let g=0;for(let t=0,e=u-8;t<e;++t){let e=f[t]-f[t+8];++t;let i=f[t]-f[t+8];++t;let r=f[t]-f[t+8];++t,g+=e*e+i*i+r*r}return-g},Pn=async function t(e,i,r,n,s,o,a){let h;if(i=Vn(i,this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),n=Vn(n,this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),o?o=Vn(o,this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max):(o=Vn(Math.sqrt((i||this._focusParameters.fds.step)*(n||this._focusParameters.fds.step)),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),a=await Dr(this,Qr,\"m\",Fn).call(this,e,o)),a<=r&&a<=s?h=3:r<s&&r<a?h=1:s<r&&s<a&&(h=2),(n-i)/2<=this._focusParameters.fds.step)return 3===h||(1===h?await Dr(this,tn,\"f\").applyConstraints({advanced:[{focusMode:\"manual\",focusDistance:i}]}):2===h&&await Dr(this,tn,\"f\").applyConstraints({advanced:[{focusMode:\"manual\",focusDistance:n}]})),!0;if(1===h)return await Dr(this,Qr,\"m\",t).call(this,e,i,r,o,a);if(2===h)return await Dr(this,Qr,\"m\",t).call(this,e,o,a,n,s);if(3!==h)return r=await Dr(this,Qr,\"m\",Fn).call(this,e,i),s=await Dr(this,Qr,\"m\",Fn).call(this,e,n),await Dr(this,Qr,\"m\",t).call(this,e,i,r,n,s);let l=Vn(Math.sqrt((i||this._focusParameters.fds.step)*(o||this._focusParameters.fds.step)),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),c=Vn(Math.sqrt((n||this._focusParameters.fds.step)*(o||this._focusParameters.fds.step)),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max);if(Math.abs(1/this._focusParameters.oldDistance-1/l)<=Math.abs(1/this._focusParameters.oldDistance-1/c)){let h=await Dr(this,Qr,\"m\",Fn).call(this,e,l);if(h<a)return await Dr(this,Qr,\"m\",t).call(this,e,i,r,o,a,l,h);if(h==a)return await Dr(this,Qr,\"m\",t).call(this,e,l,h,o,a);let u=await Dr(this,Qr,\"m\",Fn).call(this,e,c);if(h>a&&a<u)return await Dr(this,Qr,\"m\",t).call(this,e,l,h,c,u,o,a);if(a==u)return await Dr(this,Qr,\"m\",t).call(this,e,o,a,c,u);if(a>u)return await Dr(this,Qr,\"m\",t).call(this,e,o,a,n,s,c,u)}else{let h=await Dr(this,Qr,\"m\",Fn).call(this,e,c);if(a>h)return await Dr(this,Qr,\"m\",t).call(this,e,o,a,n,s,c,h);if(a==h)return await Dr(this,Qr,\"m\",t).call(this,e,o,a,c,h);let u=await Dr(this,Qr,\"m\",Fn).call(this,e,l);if(u>a&&a<h)return await Dr(this,Qr,\"m\",t).call(this,e,l,u,c,h,o,a);if(u==a)return await Dr(this,Qr,\"m\",t).call(this,e,l,u,o,a);if(u<a)return await Dr(this,Qr,\"m\",t).call(this,e,i,r,o,a,l,u)}return!1},kn=async function(t,e,i,r,n){var s;if(1==this._focusParameters.isDoingFocus)return!1;if(!t||\"string\"!=typeof t.x||\"string\"!=typeof t.y)throw new Error(\"Invalid 'centerPoint'.\");if(!e||\"string\"!=typeof e)throw new Error(\"Invalid 'width'.\");if(!i||\"string\"!=typeof i)throw new Error(\"Invalid 'height'.\");const o=this.getResolution();let a=0,h=0;if(t.x.endsWith(\"px\"))a=parseFloat(t.x);else{if(!t.x.endsWith(\"%\"))throw new Error(\"Invalid 'centerPoint'.\");a=parseFloat(t.x)/100*o.width}if(t.y.endsWith(\"px\"))h=parseFloat(t.y);else{if(!t.y.endsWith(\"%\"))throw new Error(\"Invalid 'centerPoint'.\");h=parseFloat(t.y)/100*o.height}if(isNaN(a)||isNaN(h)||a<0||a>o.width||h<0||h>o.height)throw new Error(\"Invalid 'centerPoint'.\");let l=0;if(e.endsWith(\"px\"))l=parseFloat(e);else{if(!e.endsWith(\"%\"))throw new Error(\"Invalid 'width'.\");l=parseFloat(e)/100*o.width}if(isNaN(l)||l<0)throw new Error(\"Invalid 'width'.\");let c=0;if(i.endsWith(\"px\"))c=parseFloat(i);else{if(!i.endsWith(\"%\"))throw new Error(\"Invalid 'height'.\");c=parseFloat(i)/100*o.height}if(isNaN(c)||c<0)throw new Error(\"Invalid 'height'.\");if(1!==Dr(this,vn,\"f\")){const t=Dr(this,vn,\"f\"),e=Dr(this,yn,\"f\");l/=t,c/=t,a=(1-1/t)*e.x+a/t,h=(1-1/t)*e.y+h/t}if(!this._focusSupported)throw new Error(\"Manual focus unsupported.\");if(!this._focusParameters.fds&&(this._focusParameters.fds=null===(s=this.getCameraCapabilities())||void 0===s?void 0:s.focusDistance,!this._focusParameters.fds))throw this._focusSupported=!1,new Error(\"Manual focus unsupported.\");null==this._focusParameters.kTimeout&&(this._focusParameters.kTimeout=(this._focusParameters.maxTimeout-this._focusParameters.minTimeout)/(1/this._focusParameters.fds.min-1/this._focusParameters.fds.max)),this._focusParameters.isDoingFocus=1;const u={focusL:a,focusT:h,focusW:l,focusH:c,focusTaskId:++this._focusParameters.curFocusTaskId,timeStart:Date.now()},d=async(t,e,i)=>{try{(null==e||e<this._focusParameters.fds.min)&&(e=this._focusParameters.fds.min),(null==i||i>this._focusParameters.fds.max)&&(i=this._focusParameters.fds.max),this._focusParameters.oldDistance=null;let r=Vn(Math.sqrt(i*(e||this._focusParameters.fds.step)),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),n=Vn(Math.sqrt((e||this._focusParameters.fds.step)*r),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),s=Vn(Math.sqrt(r*i),this._focusParameters.fds.min,this._focusParameters.fds.step,this._focusParameters.fds.max),o=await Dr(this,Qr,\"m\",Fn).call(this,t,s),a=await Dr(this,Qr,\"m\",Fn).call(this,t,n),h=await Dr(this,Qr,\"m\",Fn).call(this,t,r);if(a>h&&h<o){const e=await Dr(this,Qr,\"m\",Pn).call(this,t,n,a,s,o,r,h);return this._focusParameters.isDoingFocus=0,e}if(a<h&&a<o){let i=await Dr(this,Qr,\"m\",Fn).call(this,t,e);const s=await Dr(this,Qr,\"m\",Pn).call(this,t,e,i,r,h,n,a);return this._focusParameters.isDoingFocus=0,s}if(h>o&&a>o){let e=await Dr(this,Qr,\"m\",Fn).call(this,t,i);const n=await Dr(this,Qr,\"m\",Pn).call(this,t,r,h,i,e,s,o);return this._focusParameters.isDoingFocus=0,n}if(a==h&&h<o){const e=await Dr(this,Qr,\"m\",Pn).call(this,t,n,a,r,h);return this._focusParameters.isDoingFocus=0,e}if(h==o&&a>h){const e=await Dr(this,Qr,\"m\",Pn).call(this,t,r,h,s,o);return this._focusParameters.isDoingFocus=0,e}return d(t,e,i)}catch(t){if(\"DeprecatedTaskError\"!==t.name)throw t}};return d(u,r,n)},Bn=function(t){if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");if(!t||\"string\"!=typeof t.x||\"string\"!=typeof t.y)throw new Error(\"Invalid 'center'.\");const e=this.getResolution();let i=0,r=0;if(t.x.endsWith(\"px\"))i=parseFloat(t.x);else{if(!t.x.endsWith(\"%\"))throw new Error(\"Invalid scale center.\");i=parseFloat(t.x)/100*e.width}if(t.y.endsWith(\"px\"))r=parseFloat(t.y);else{if(!t.y.endsWith(\"%\"))throw new Error(\"Invalid scale center.\");r=parseFloat(t.y)/100*e.height}if(isNaN(i)||isNaN(r))throw new Error(\"Invalid scale center.\");Lr(this,yn,{x:i,y:r},\"f\")},Nn=function(t){if(\"opened\"!==this.state)throw new Error(\"Video is not playing.\");const e=this.getResolution();return t&&t.x==e.width/2&&t.y==e.height/2},Gn.browserInfo=Nr,Gn.onWarning=null===(Jr=null===window||void 0===window?void 0:window.console)||void 0===Jr?void 0:Jr.warn;class Ss{constructor(t){Wn.add(this),Yn.set(this,void 0),Hn.set(this,0),Xn.set(this,void 0),zn.set(this,0),Zn.set(this,!1),ze(this,Yn,t,\"f\")}startCharging(){Xe(this,Zn,\"f\")||(Ss._onLog&&Ss._onLog(\"start charging.\"),Xe(this,Wn,\"m\",Kn).call(this),ze(this,Zn,!0,\"f\"))}stopCharging(){Xe(this,Xn,\"f\")&&clearTimeout(Xe(this,Xn,\"f\")),Xe(this,Zn,\"f\")&&(Ss._onLog&&Ss._onLog(\"stop charging.\"),ze(this,Hn,Date.now()-Xe(this,zn,\"f\"),\"f\"),ze(this,Zn,!1,\"f\"))}}Yn=new WeakMap,Hn=new WeakMap,Xn=new WeakMap,zn=new WeakMap,Zn=new WeakMap,Wn=new WeakSet,qn=function(){gt.cfd(1),Ss._onLog&&Ss._onLog(\"charge 1.\")},Kn=function t(){0==Xe(this,Hn,\"f\")&&Xe(this,Wn,\"m\",qn).call(this),ze(this,zn,Date.now(),\"f\"),Xe(this,Xn,\"f\")&&clearTimeout(Xe(this,Xn,\"f\")),ze(this,Xn,setTimeout((()=>{ze(this,Hn,0,\"f\"),Xe(this,Wn,\"m\",t).call(this)}),Xe(this,Yn,\"f\")-Xe(this,Hn,\"f\")),\"f\")};class bs{static beep(){if(!this.allowBeep)return;if(!this.beepSoundSource)return;let t,e=Date.now();
2if(!(e-Xe(this,Jn,\"f\",ts)<100)){if(ze(this,Jn,e,\"f\",ts),Xe(this,Jn,\"f\",Qn).size&&(t=Xe(this,Jn,\"f\",Qn).values().next().value,this.beepSoundSource==t.src?(Xe(this,Jn,\"f\",Qn).delete(t),t.play()):t=null),!t)if(Xe(this,Jn,\"f\",$n).size<16){t=new Audio(this.beepSoundSource);let e=null,i=()=>{t.removeEventListener(\"loadedmetadata\",i),t.play(),e=setTimeout((()=>{Xe(this,Jn,\"f\",$n).delete(t)}),2e3*t.duration)};t.addEventListener(\"loadedmetadata\",i),t.addEventListener(\"ended\",(()=>{null!=e&&(clearTimeout(e),e=null),t.pause(),t.currentTime=0,Xe(this,Jn,\"f\",$n).delete(t),Xe(this,Jn,\"f\",Qn).add(t)}))}else Xe(this,Jn,\"f\",es)||(ze(this,Jn,!0,\"f\",es),console.warn(\"The requested audio tracks exceed 16 and will not be played.\"));t&&Xe(this,Jn,\"f\",$n).add(t)}}static vibrate(){if(this.allowVibrate){if(!navigator||!navigator.vibrate)throw new Error(\"Not supported.\");navigator.vibrate(bs.vibrateDuration)}}}Jn=bs,Qn={value:new Set},$n={value:new Set},ts={value:0},es={value:!1},bs.allowBeep=!0,bs.beepSoundSource=\"data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\",bs.allowVibrate=!0,bs.vibrateDuration=300;const Is=new Map([[Gr.GREY,h.IPF_GRAYSCALED],[Gr.RGBA,h.IPF_ABGR_8888]]),xs=\"function\"==typeof BigInt?{BF_NULL:BigInt(0),BF_ALL:BigInt(0x10000000000000000),BF_DEFAULT:BigInt(4265345023),BF_ONED:BigInt(3147775),BF_GS1_DATABAR:BigInt(260096),BF_CODE_39:BigInt(1),BF_CODE_128:BigInt(2),BF_CODE_93:BigInt(4),BF_CODABAR:BigInt(8),BF_ITF:BigInt(16),BF_EAN_13:BigInt(32),BF_EAN_8:BigInt(64),BF_UPC_A:BigInt(128),BF_UPC_E:BigInt(256),BF_INDUSTRIAL_25:BigInt(512),BF_CODE_39_EXTENDED:BigInt(1024),BF_GS1_DATABAR_OMNIDIRECTIONAL:BigInt(2048),BF_GS1_DATABAR_TRUNCATED:BigInt(4096),BF_GS1_DATABAR_STACKED:BigInt(8192),BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:BigInt(16384),BF_GS1_DATABAR_EXPANDED:BigInt(32768),BF_GS1_DATABAR_EXPANDED_STACKED:BigInt(65536),BF_GS1_DATABAR_LIMITED:BigInt(131072),BF_PATCHCODE:BigInt(262144),BF_CODE_32:BigInt(16777216),BF_PDF417:BigInt(33554432),BF_QR_CODE:BigInt(67108864),BF_DATAMATRIX:BigInt(134217728),BF_AZTEC:BigInt(268435456),BF_MAXICODE:BigInt(536870912),BF_MICRO_QR:BigInt(1073741824),BF_MICRO_PDF417:BigInt(524288),BF_GS1_COMPOSITE:BigInt(2147483648),BF_MSI_CODE:BigInt(1048576),BF_CODE_11:BigInt(2097152),BF_TWO_DIGIT_ADD_ON:BigInt(4194304),BF_FIVE_DIGIT_ADD_ON:BigInt(8388608),BF_MATRIX_25:BigInt(68719476736),BF_POSTALCODE:BigInt(0x3f0000000000000),BF_NONSTANDARD_BARCODE:BigInt(4294967296),BF_USPSINTELLIGENTMAIL:BigInt(4503599627370496),BF_POSTNET:BigInt(9007199254740992),BF_PLANET:BigInt(0x40000000000000),BF_AUSTRALIANPOST:BigInt(0x80000000000000),BF_RM4SCC:BigInt(72057594037927940),BF_KIX:BigInt(0x200000000000000),BF_DOTCODE:BigInt(8589934592),BF_PHARMACODE_ONE_TRACK:BigInt(17179869184),BF_PHARMACODE_TWO_TRACK:BigInt(34359738368),BF_PHARMACODE:BigInt(51539607552)}:{BF_NULL:\"0x00\",BF_ALL:\"0xFFFFFFFFFFFFFFFF\",BF_DEFAULT:\"0xFE3BFFFF\",BF_ONED:\"0x003007FF\",BF_GS1_DATABAR:\"0x0003F800\",BF_CODE_39:\"0x1\",BF_CODE_128:\"0x2\",BF_CODE_93:\"0x4\",BF_CODABAR:\"0x8\",BF_ITF:\"0x10\",BF_EAN_13:\"0x20\",BF_EAN_8:\"0x40\",BF_UPC_A:\"0x80\",BF_UPC_E:\"0x100\",BF_INDUSTRIAL_25:\"0x200\",BF_CODE_39_EXTENDED:\"0x400\",BF_GS1_DATABAR_OMNIDIRECTIONAL:\"0x800\",BF_GS1_DATABAR_TRUNCATED:\"0x1000\",BF_GS1_DATABAR_STACKED:\"0x2000\",BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:\"0x4000\",BF_GS1_DATABAR_EXPANDED:\"0x8000\",BF_GS1_DATABAR_EXPANDED_STACKED:\"0x10000\",BF_GS1_DATABAR_LIMITED:\"0x20000\",BF_PATCHCODE:\"0x00040000\",BF_CODE_32:\"0x01000000\",BF_PDF417:\"0x02000000\",BF_QR_CODE:\"0x04000000\",BF_DATAMATRIX:\"0x08000000\",BF_AZTEC:\"0x10000000\",BF_MAXICODE:\"0x20000000\",BF_MICRO_QR:\"0x40000000\",BF_MICRO_PDF417:\"0x00080000\",BF_GS1_COMPOSITE:\"0x80000000\",BF_MSI_CODE:\"0x100000\",BF_CODE_11:\"0x200000\",BF_TWO_DIGIT_ADD_ON:\"0x400000\",BF_FIVE_DIGIT_ADD_ON:\"0x800000\",BF_MATRIX_25:\"0x1000000000\",BF_POSTALCODE:\"0x3F0000000000000\",BF_NONSTANDARD_BARCODE:\"0x100000000\",BF_USPSINTELLIGENTMAIL:\"0x10000000000000\",BF_POSTNET:\"0x20000000000000\",BF_PLANET:\"0x40000000000000\",BF_AUSTRALIANPOST:\"0x80000000000000\",BF_RM4SCC:\"0x100000000000000\",BF_KIX:\"0x200000000000000\",BF_DOTCODE:\"0x200000000\",BF_PHARMACODE_ONE_TRACK:\"0x400000000\",BF_PHARMACODE_TWO_TRACK:\"0x800000000\",BF_PHARMACODE:\"0xC00000000\"};class Os extends z{static set _onLog(t){ze(Os,rs,t,\"f\",ns),Gn._onLog=t,Ss._onLog=t}static get _onLog(){return Xe(Os,rs,\"f\",ns)}static async detectEnvironment(){return await(async()=>({wasm:Ze,worker:qe,getUserMedia:Ke,camera:await Je(),browser:He.browser,version:He.version,OS:He.OS}))()}static async testCameraAccess(){const t=await Gn.testCameraAccess();return t.ok?{ok:!0,message:\"Successfully accessed the camera.\"}:\"InsecureContext\"===t.errorName?{ok:!1,message:\"Insecure context.\"}:\"OverconstrainedError\"===t.errorName||\"NotFoundError\"===t.errorName?{ok:!1,message:\"No camera detected.\"}:\"NotAllowedError\"===t.errorName?{ok:!1,message:\"No permission to access camera.\"}:\"AbortError\"===t.errorName?{ok:!1,message:\"Some problem occurred which prevented the device from being used.\"}:\"NotReadableError\"===t.errorName?{ok:!1,message:\"A hardware error occurred.\"}:\"SecurityError\"===t.errorName?{ok:!1,message:\"User media support is disabled.\"}:{ok:!1,message:t.errorMessage}}static async createInstance(t){var e,i;if(t&&!(t instanceof Rr))throw new TypeError(\"Invalid view.\");if(null===(e=ct.license)||void 0===e?void 0:e.LicenseManager){if(!(null===(i=ct.license)||void 0===i?void 0:i.LicenseManager.bCallInitLicense))throw new Error(\"License is not set.\");await gt.loadWasm([\"license\"]),await ct.license.dynamsoft()}const r=new Os(t);return Os.onWarning&&(location&&\"file:\"===location.protocol?setTimeout((()=>{Os.onWarning&&Os.onWarning({id:1,message:\"The page is opened over file:// and Dynamsoft Camera Enhancer may not work properly. Please open the page via https://.\"})}),0):!1!==window.isSecureContext&&navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia||setTimeout((()=>{Os.onWarning&&Os.onWarning({id:2,message:\"Dynamsoft Camera Enhancer may not work properly in a non-secure context. Please open the page via https://.\"})}),0)),r}get video(){return this.cameraManager.getVideoEl()}set videoSrc(t){if(!this.cameraManager)throw new Error(\"Camera manager is null.\");this.cameraView&&(this.cameraView._hideDefaultSelection=!0),this.cameraManager.videoSrc=t}get videoSrc(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.videoSrc}set ifSaveLastUsedCamera(t){if(!this.cameraManager)throw new Error(\"Camera manager is null.\");this.cameraManager.ifSaveLastUsedCamera=t}get ifSaveLastUsedCamera(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.ifSaveLastUsedCamera}set ifSkipCameraInspection(t){if(!this.cameraManager)throw new Error(\"Camera manager is null.\");this.cameraManager.ifSkipCameraInspection=t}get ifSkipCameraInspection(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.ifSkipCameraInspection}set cameraOpenTimeout(t){if(!this.cameraManager)throw new Error(\"Camera manager is null.\");this.cameraManager.cameraOpenTimeout=t}get cameraOpenTimeout(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.cameraOpenTimeout}set singleFrameMode(t){if(![\"disabled\",\"image\",\"camera\"].includes(t))throw new Error(\"Invalid value.\");if(this.isOpen())throw new Error(\"It is not allowed to change `singleFrameMode` when the camera is open.\");ze(this,as,t,\"f\")}get singleFrameMode(){return Xe(this,as,\"f\")}get _isFetchingStarted(){return Xe(this,fs,\"f\")}get disposed(){return Xe(this,vs,\"f\")}constructor(t){if(super(),is.add(this),ss.set(this,\"closed\"),os.set(this,void 0),this.isTorchOn=void 0,as.set(this,void 0),this._onCameraSelChange=async()=>{this.isOpen()&&this.cameraView&&!this.cameraView.disposed&&await this.selectCamera(this.cameraView._selCam.value)}
2,this._onResolutionSelChange=async()=>{if(!this.isOpen())return;if(!this.cameraView||this.cameraView.disposed)return;let t,e;if(this.cameraView._selRsl&&-1!=this.cameraView._selRsl.selectedIndex){let i=this.cameraView._selRsl.options[this.cameraView._selRsl.selectedIndex];t=parseInt(i.getAttribute(\"data-width\")),e=parseInt(i.getAttribute(\"data-height\"))}await this.setResolution({width:t,height:e})},this._onCloseBtnClick=async()=>{this.isOpen()&&this.cameraView&&!this.cameraView.disposed&&this.close()},hs.set(this,((t,e,i,r)=>{const n=Date.now(),s={sx:r.x,sy:r.y,sWidth:r.width,sHeight:r.height,dWidth:r.width,dHeight:r.height},o=Math.max(s.dWidth,s.dHeight);if(this.canvasSizeLimit&&o>this.canvasSizeLimit){const t=this.canvasSizeLimit/o;s.dWidth>s.dHeight?(s.dWidth=this.canvasSizeLimit,s.dHeight=Math.round(s.dHeight*t)):(s.dWidth=Math.round(s.dWidth*t),s.dHeight=this.canvasSizeLimit)}const a=this.cameraManager.imageDataGetter.getImageData(t,s,{pixelFormat:this.getPixelFormat()===h.IPF_GRAYSCALED?Gr.GREY:Gr.RGBA});let l=null;if(a){const t=Date.now();let o;o=a.pixelFormat===Gr.GREY?a.width:4*a.width;let h=!0;0===s.sx&&0===s.sy&&s.sWidth===e&&s.sHeight===i&&(h=!1),l={bytes:a.data,width:a.width,height:a.height,stride:o,format:Is.get(a.pixelFormat),tag:{imageId:this._imageId==Number.MAX_VALUE?this._imageId=0:++this._imageId,type:wt.ITT_FILE_IMAGE,isCropped:h,cropRegion:{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height,isMeasuredInPercentage:!1},originalWidth:e,originalHeight:i,currentWidth:a.width,currentHeight:a.height,timeSpent:t-n,timeStamp:t},toCanvas:Xe(this,ls,\"f\"),isDCEFrame:!0}}return l})),this._onSingleFrameAcquired=t=>{let e;e=this.cameraView?this.cameraView.getConvertedRegion():ki.convert(Xe(this,us,\"f\"),t.width,t.height),e||(e={x:0,y:0,width:t.width,height:t.height});const i=Xe(this,hs,\"f\").call(this,t,t.width,t.height,e);Xe(this,os,\"f\").fire(\"singleFrameAcquired\",[i],{async:!1,copy:!1})},ls.set(this,(function(){if(!(this.bytes instanceof Uint8Array||this.bytes instanceof Uint8ClampedArray))throw new TypeError(\"Invalid bytes.\");if(\"number\"!=typeof this.width||this.width<=0)throw new Error(\"Invalid width.\");if(\"number\"!=typeof this.height||this.height<=0)throw new Error(\"Invalid height.\");const t=document.createElement(\"canvas\");let e;if(t.width=this.width,t.height=this.height,this.format===h.IPF_GRAYSCALED){e=new Uint8ClampedArray(this.width*this.height*4);for(let t=0;t<e.length;t+=4)e[t]=this.bytes[t/4],e[t+1]=this.bytes[t/4],e[t+2]=this.bytes[t/4],e[t+3]=255}else e=new Uint8ClampedArray(this.bytes.buffer);return t.getContext(\"2d\").putImageData(new ImageData(e,this.width,this.height),0,0),t})),cs.set(this,void 0),us.set(this,void 0),ds.set(this,h.IPF_ABGR_8888),fs.set(this,!1),this._imageId=-1,gs.set(this,void 0),this.fetchInterval=0,ms.set(this,{enhancedFocus:!1,autoZoom:!1,tapToFocus:!1}),ps.set(this,{minValue:1,maxValue:999,autoFocusFrameArray:[],autoFocusFrameLimit:[5,3],autoZoomDetectionArea:.5,autoZoomTargetBorder:.9,autoZoomIdealArea:[0,.05],autoZoomInFrameArray:[],autoZoomInFrameLimit:[5,3],autoZoomInMaxTimes:5,autoZoomInMinStep:Math.pow(10,.2),autoZoomInIdealModuleSize:6,autoZoomOutFrameCount:0,autoZoomOutFrameLimit:3,autoZoomOutStepRate:1/3,autoZoomOutStepRate_2:.05,autoZoomOutMinStep:2,frameArrayInIdealZoom:[],frameLimitInIdealZoom:[5,3]}),_s.set(this,void 0),vs.set(this,!1),this.isCameraEnhancer=!0,this._taskid4AutoTorch=null,this._delay4AutoTorch=250,this.grayThreshold4AutoTorch=20,this.maxDarkCount4AutoTroch=3,t&&!(t instanceof Rr))throw new TypeError(\"Invalid view.\");ze(this,os,new ji,\"f\"),this.cameraManager=new Gn,this._imageDataGetter=this.cameraManager.imageDataGetter,this.cameraManager.updateVideoElWhenSoftwareScaled=()=>{if(!this.video)return;const t=this.cameraManager.getSoftwareScale();if(t<1)throw new RangeError(\"Invalid scale value.\");this.cameraView&&!this.cameraView.disposed?(this.video.style.transform=1===t?\"\":`scale(${t})`,this.cameraView._updateVideoContainer()):this.video.style.transform=1===t?\"\":`scale(${t})`},[\"iPhone\",\"iPad\",\"Android\",\"HarmonyOS\"].includes(He.OS)?this.cameraManager.setResolution(1280,720):this.cameraManager.setResolution(1920,1080),navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?this.singleFrameMode=\"disabled\":this.singleFrameMode=\"image\",t&&(this.setCameraView(t),t.cameraEnhancer=this),this._on(\"before:camera:change\",(()=>{Xe(this,_s,\"f\").stopCharging();const t=this.cameraView;t&&!t.disposed&&(t._startLoading(),t.clearAllInnerDrawingItems())})),this._on(\"camera:changed\",(()=>{this.clearBuffer()})),this._on(\"before:resolution:change\",(()=>{const t=this.cameraView;t&&!t.disposed&&(t._startLoading(),t.clearAllInnerDrawingItems())})),this._on(\"resolution:changed\",(()=>{this.clearBuffer(),t.eventHandler.fire(\"content:updated\",null,{async:!1})})),this._on(\"paused\",(()=>{Xe(this,_s,\"f\").stopCharging();const t=this.cameraView;t&&t.disposed})),this._on(\"resumed\",(()=>{const t=this.cameraView;t&&t.disposed})),this._on(\"tapfocus\",(()=>{Xe(this,ms,\"f\").tapToFocus&&Xe(this,_s,\"f\").startCharging()})),this._intermediateResultReceiver={},this._intermediateResultReceiver.onTaskResultsReceived=async(t,e)=>{var i,r,n,s;if(Xe(this,is,\"m\",ys).call(this)||!this.isOpen()||this.isPaused())return;const o=t.intermediateResultUnits;Os._onLog&&(Os._onLog(\"intermediateResultUnits:\"),Os._onLog(o));let a=!1,h=!1;for(let t of o){if(t.unitType===St.IRUT_DECODED_BARCODES&&t.decodedBarcodes.length){a=!0;break}t.unitType===St.IRUT_LOCALIZED_BARCODES&&t.localizedBarcodes.length&&(h=!0)}if(Os._onLog&&(Os._onLog(\"hasLocalizedBarcodes:\"),Os._onLog(h)),Xe(this,ms,\"f\").autoZoom||Xe(this,ms,\"f\").enhancedFocus)if(a)Xe(this,ps,\"f\").autoZoomInFrameArray.length=0,Xe(this,ps,\"f\").autoZoomOutFrameCount=0,Xe(this,ps,\"f\").frameArrayInIdealZoom.length=0,Xe(this,ps,\"f\").autoFocusFrameArray.length=0;else{const e=async t=>{await this.setZoom(t),Xe(this,ms,\"f\").autoZoom&&Xe(this,_s,\"f\").startCharging()},a=async t=>{await this.setFocus(t),Xe(this,ms,\"f\").enhancedFocus&&Xe(this,_s,\"f\").startCharging()};if(h){const h=o[0].originalImageTag,l=(null===(i=h.cropRegion)||void 0===i?void 0:i.left)||0,c=(null===(r=h.cropRegion)||void 0===r?void 0:r.top)||0,u=(null===(n=h.cropRegion)||void 0===n?void 0:n.right)?h.cropRegion.right-l:h.originalWidth,d=(null===(s=h.cropRegion)||void 0===s?void 0:s.bottom)?h.cropRegion.bottom-c:h.originalHeight,f=h.currentWidth,g=h.currentHeight;let m;{let t,e,i,r,n;
2{const t=this.video.videoWidth*(1-Xe(this,ps,\"f\").autoZoomDetectionArea)/2,e=this.video.videoWidth*(1+Xe(this,ps,\"f\").autoZoomDetectionArea)/2,i=e,r=t,s=this.video.videoHeight*(1-Xe(this,ps,\"f\").autoZoomDetectionArea)/2,o=s,a=this.video.videoHeight*(1+Xe(this,ps,\"f\").autoZoomDetectionArea)/2;n=[{x:t,y:s},{x:e,y:o},{x:i,y:a},{x:r,y:a}]}Os._onLog&&(Os._onLog(\"detectionArea:\"),Os._onLog(n));const s=[];{const t=(t,e)=>{const i=(t,e)=>{if(!t&&!e)throw new Error(\"Invalid arguments.\");return function(t,e,i){let r=!1;const n=t.length;if(n<=2)return!1;for(let s=0;s<n;s++){const o=t[s],a=t[(s+1)%n];if(Ui(o,a,{x:e,y:i}))return!0;Vi(o.y-i)>0!=Vi(a.y-i)>0&&Vi(e-(i-o.y)*(o.x-a.x)/(o.y-a.y)-o.x)<0&&(r=!r)}return r}(e,t.x,t.y)},r=(t,e)=>!!(Gi([t[0],t[1]],[t[2],t[3]],[e[0].x,e[0].y],[e[1].x,e[1].y])||Gi([t[0],t[1]],[t[2],t[3]],[e[1].x,e[1].y],[e[2].x,e[2].y])||Gi([t[0],t[1]],[t[2],t[3]],[e[2].x,e[2].y],[e[3].x,e[3].y])||Gi([t[0],t[1]],[t[2],t[3]],[e[3].x,e[3].y],[e[0].x,e[0].y]));return!!(i({x:t[0].x,y:t[0].y},e)||i({x:t[1].x,y:t[1].y},e)||i({x:t[2].x,y:t[2].y},e)||i({x:t[3].x,y:t[3].y},e))||!!(i({x:e[0].x,y:e[0].y},t)||i({x:e[1].x,y:e[1].y},t)||i({x:e[2].x,y:e[2].y},t)||i({x:e[3].x,y:e[3].y},t))||!!(r([e[0].x,e[0].y,e[1].x,e[1].y],t)||r([e[1].x,e[1].y,e[2].x,e[2].y],t)||r([e[2].x,e[2].y,e[3].x,e[3].y],t)||r([e[3].x,e[3].y,e[0].x,e[0].y],t))};for(let e of o)if(e.unitType===St.IRUT_LOCALIZED_BARCODES)for(let i of e.localizedBarcodes){if(!i)continue;const e=i.location.points;e.forEach((t=>{Rr._transformCoordinates(t,l,c,u,d,f,g)})),t(n,e)&&s.push(i)}if(Os._debug&&this.cameraView){const t=this.__layer||(this.__layer=this.cameraView._createDrawingLayer(99));t.clearDrawingItems();const e=this.__styleId2||(this.__styleId2=Sr.createDrawingStyle({strokeStyle:\"red\"}));for(let i of o)if(i.unitType===St.IRUT_LOCALIZED_BARCODES)for(let r of i.localizedBarcodes){if(!r)continue;const i=r.location.points,n=new Ii({points:i},e);t.addDrawingItems([n])}}}if(Os._onLog&&(Os._onLog(\"intersectedResults:\"),Os._onLog(s)),!s.length)return;let a;if(s.length){let t=s.filter((t=>t.possibleFormats==xs.BF_QR_CODE||t.possibleFormats==xs.BF_DATAMATRIX));if(t.length||(t=s.filter((t=>t.possibleFormats==xs.BF_ONED)),t.length||(t=s)),t.length){const e=t=>{const e=t.location.points,i=(e[0].x+e[1].x+e[2].x+e[3].x)/4,r=(e[0].y+e[1].y+e[2].y+e[3].y)/4;return(i-f/2)*(i-f/2)+(r-g/2)*(r-g/2)};a=t[0];let i=e(a);if(1!=t.length)for(let r=1;r<t.length;r++){const n=e(t[r]);(t[r].confidence>1.1*a.confidence||t[r].confidence>.9*a.confidence&&n<i)&&(a=t[r],i=n)}}}if(Os._onLog&&(Os._onLog(\"highPriorityResult:\"),Os._onLog(a)),a){const n=a.location.points;t=Math.min(n[0].x,n[1].x,n[2].x,n[3].x),e=Math.max(n[0].x,n[1].x,n[2].x,n[3].x),i=Math.min(n[0].y,n[1].y,n[2].y,n[3].y),r=Math.max(n[0].y,n[1].y,n[2].y,n[3].y),m={points:[{x:t,y:i},{x:e,y:i},{x:e,y:r},{x:t,y:r}],result:a}}}if(Os._onLog&&(Os._onLog(\"boundingRect:\"),Os._onLog(m)),!m)return;if(Os._debug&&this.cameraView&&(null==m?void 0:m.points)){const t=this.__layer||(this.__layer=this.cameraView._createDrawingLayer(99)),e=this.__styleId1||(this.__styleId1=Sr.createDrawingStyle({strokeStyle:\"blue\"})),i=new Ii({points:m.points},e);t.addDrawingItems([i])}if(Xe(this,ps,\"f\").autoZoomOutFrameCount=0,Xe(this,ms,\"f\").autoZoom){const i=Xe(this,ps,\"f\").autoZoomIdealArea[1];let r=(1-Xe(this,ps,\"f\").autoZoomTargetBorder)/2;const n=m.points[0].x/u,s=(u-m.points[2].x)/u,o=m.points[0].y/d,h=(d-m.points[2].y)/d;if(n>i&&s>i&&o>i&&h>i&&m.result.moduleSize<Xe(this,ps,\"f\").autoZoomInIdealModuleSize){if(Xe(this,ps,\"f\").autoZoomInFrameArray.push(!0),Xe(this,ps,\"f\").autoZoomInFrameArray.splice(0,Xe(this,ps,\"f\").autoZoomInFrameArray.length-Xe(this,ps,\"f\").autoZoomInFrameLimit[0]),Xe(this,ps,\"f\").frameArrayInIdealZoom.length=0,Xe(this,ms,\"f\").enhancedFocus&&a({mode:\"continuous\"}).catch((()=>{})),Xe(this,ps,\"f\").autoZoomInFrameArray.filter((t=>!0===t)).length>=Xe(this,ps,\"f\").autoZoomInFrameLimit[1]){Xe(this,ps,\"f\").autoZoomInFrameArray.length=0;const i=[(.5-r)/(.5-n),(.5-r)/(.5-s),(.5-r)/(.5-o),(.5-r)/(.5-h)].filter((t=>t>0)),a=Math.min(...i,Xe(this,ps,\"f\").autoZoomInIdealModuleSize/m.result.moduleSize),l=this.getZoomSettings().factor;let c=Math.max(Math.pow(l*a,1/Xe(this,ps,\"f\").autoZoomInMaxTimes),Xe(this,ps,\"f\").autoZoomInMinStep);c=Math.min(c,a);let u=l*c;u=Math.max(Xe(this,ps,\"f\").minValue,u),u=Math.min(Xe(this,ps,\"f\").maxValue,u);try{await e({factor:u})}catch(t){const e=t.message||t;console.warn(e)}this.clearBuffer()}}else if(Xe(this,ps,\"f\").autoZoomInFrameArray.length=0,Xe(this,ps,\"f\").frameArrayInIdealZoom.pu
2sh(!0),Xe(this,ps,\"f\").frameArrayInIdealZoom.splice(0,Xe(this,ps,\"f\").frameArrayInIdealZoom.length-Xe(this,ps,\"f\").frameLimitInIdealZoom[0]),Xe(this,ps,\"f\").frameArrayInIdealZoom.filter((t=>!0===t)).length>=Xe(this,ps,\"f\").frameLimitInIdealZoom[1]&&(Xe(this,ps,\"f\").frameArrayInIdealZoom.length=0,Xe(this,ms,\"f\").enhancedFocus)){const e=m.points;try{await a({mode:\"manual\",area:{centerPoint:{x:(e[0].x+e[2].x)/2+\"px\",y:(e[0].y+e[2].y)/2+\"px\"},width:e[2].x-e[0].x+\"px\",height:e[2].y-e[0].y+\"px\"}})}catch(t){const e=t.message||t;console.warn(e)}this.clearBuffer()}}if(!Xe(this,ms,\"f\").autoZoom&&Xe(this,ms,\"f\").enhancedFocus&&(Xe(this,ps,\"f\").autoFocusFrameArray.push(!0),Xe(this,ps,\"f\").autoFocusFrameArray.splice(0,Xe(this,ps,\"f\").autoFocusFrameArray.length-Xe(this,ps,\"f\").autoFocusFrameLimit[0]),Xe(this,ps,\"f\").autoFocusFrameArray.filter((t=>!0===t)).length>=Xe(this,ps,\"f\").autoFocusFrameLimit[1])){Xe(this,ps,\"f\").autoFocusFrameArray.length=0;try{const t=m.points;await a({mode:\"manual\",area:{centerPoint:{x:(t[0].x+t[2].x)/2+\"px\",y:(t[0].y+t[2].y)/2+\"px\"},width:t[2].x-t[0].x+\"px\",height:t[2].y-t[0].y+\"px\"}})}catch(t){const e=t.message||t;console.warn(e)}this.clearBuffer()}}else{if(Xe(this,ms,\"f\").autoZoom){if(Xe(this,ps,\"f\").autoZoomInFrameArray.push(!1),Xe(this,ps,\"f\").autoZoomInFrameArray.splice(0,Xe(this,ps,\"f\").autoZoomInFrameArray.length-Xe(this,ps,\"f\").autoZoomInFrameLimit[0]),Xe(this,ps,\"f\").autoZoomOutFrameCount++,Xe(this,ps,\"f\").frameArrayInIdealZoom.push(!1),Xe(this,ps,\"f\").frameArrayInIdealZoom.splice(0,Xe(this,ps,\"f\").frameArrayInIdealZoom.length-Xe(this,ps,\"f\").frameLimitInIdealZoom[0]),Xe(this,ps,\"f\").autoZoomOutFrameCount>=Xe(this,ps,\"f\").autoZoomOutFrameLimit){Xe(this,ps,\"f\").autoZoomOutFrameCount=0;const i=this.getZoomSettings().factor;let r=i-Math.max((i-1)*Xe(this,ps,\"f\").autoZoomOutStepRate,Xe(this,ps,\"f\").autoZoomOutMinStep);r=Math.max(Xe(this,ps,\"f\").minValue,r),r=Math.min(Xe(this,ps,\"f\").maxValue,r);try{await e({factor:r})}catch(t){const e=t.message||t;console.warn(e)}this.clearBuffer()}Xe(this,ms,\"f\").enhancedFocus&&a({mode:\"continuous\"}).catch((()=>{}))}!Xe(this,ms,\"f\").autoZoom&&Xe(this,ms,\"f\").enhancedFocus&&(Xe(this,ps,\"f\").autoFocusFrameArray.length=0,a({mode:\"continuous\"}).catch((()=>{})))}}},ze(this,_s,new Ss(1e4),\"f\")}setCameraView(t){if(!(t instanceof Rr))throw new TypeError(\"Invalid view.\");if(t.disposed)throw new Error(\"The camera view has been disposed.\");if(this.isOpen())throw new Error(\"It is not allowed to change camera view when the camera is open.\");this.releaseCameraView(),t._singleFrameMode=this.singleFrameMode,t._onSingleFrameAcquired=this._onSingleFrameAcquired,this.videoSrc&&(this.cameraView._hideDefaultSelection=!0),Xe(this,is,\"m\",ys).call(this)||this.cameraManager.setVideoEl(t.getVideoElement()),this.cameraView=t,this.addListenerToView()}getCameraView(){return this.cameraView}releaseCameraView(){this.cameraView&&(this.removeListenerFromView(),this.cameraView.disposed||(this.cameraView._singleFrameMode=\"disabled\",this.cameraView._onSingleFrameAcquired=null,this.cameraView._hideDefaultSelection=!1),this.cameraManager.releaseVideoEl(),this.cameraView=null)}addListenerToView(){if(!this.cameraView)return;if(this.cameraView.disposed)throw new Error(\"'cameraView' has been disposed.\");const t=this.cameraView;Xe(this,is,\"m\",ys).call(this)||this.videoSrc||(t._innerComponent&&(this.cameraManager.tapFocusEventBoundEl=t._innerComponent),t._selCam&&t._selCam.addEventListener(\"change\",this._onCameraSelChange),t._selRsl&&t._selRsl.addEventListener(\"change\",this._onResolutionSelChange)),t._btnClose&&t._btnClose.addEventListener(\"click\",this._onCloseBtnClick)}removeListenerFromView(){if(!this.cameraView||this.cameraView.disposed)return;const t=this.cameraView;this.cameraManager.tapFocusEventBoundEl=null,t._selCam&&t._selCam.removeEventListener(\"change\",this._onCameraSelChange),t._selRsl&&t._selRsl.removeEventListener(\"change\",this._onResolutionSelChange),t._btnClose&&t._btnClose.removeEventListener(\"click\",this._onCloseBtnClick)}getCameraState(){return Xe(this,is,\"m\",ys).call(this)?Xe(this,ss,\"f\"):new Map([[\"closed\",\"closed\"],[\"opening\",\"opening\"],[\"o
2pened\",\"open\"]]).get(this.cameraManager.state)}isOpen(){return\"open\"===this.getCameraState()}getVideoEl(){return this.video}async open(){const t=this.cameraView;if(null==t?void 0:t.disposed)throw new Error(\"'cameraView' has been disposed.\");t&&(t._singleFrameMode=this.singleFrameMode,Xe(this,is,\"m\",ys).call(this)?t._clickIptSingleFrameMode():(this.cameraManager.setVideoEl(t.getVideoElement()),t._startLoading()));let e={width:0,height:0,deviceId:\"\"};if(Xe(this,is,\"m\",ys).call(this));else{try{await this.cameraManager.open()}catch(e){throw t&&t._stopLoading(),\"NotFoundError\"===e.name?new Error(`No camera devices were detected. Please ensure a camera is connected and recognized by your system. ${null==e?void 0:e.name}: ${null==e?void 0:e.message}`):\"NotAllowedError\"===e.name?new Error(`Camera access is blocked. Please check your browser settings or grant permission to use the camera. ${null==e?void 0:e.name}: ${null==e?void 0:e.message}`):e}let i,r=t.getUIElement();if(r=r.shadowRoot||r,i=r.querySelector(\".dce-macro-use-mobile-native-like-ui\")){let t=r.elTorchAuto=r.querySelector(\".dce-mn-torch-auto\"),e=r.elTorchOn=r.querySelector(\".dce-mn-torch-on\"),n=r.elTorchOff=r.querySelector(\".dce-mn-torch-off\");t&&(e.style.display=null==this.isTorchOn?\"\":\"none\"),e&&(e.style.display=1==this.isTorchOn?\"\":\"none\"),n&&(n.style.display=0==this.isTorchOn?\"\":\"none\");let s=r.elBeepOn=r.querySelector(\".dce-mn-beep-on\"),o=r.elBeepOff=r.querySelector(\".dce-mn-beep-off\");s&&(s.style.display=bs.allowBeep?\"\":\"none\"),o&&(o.style.display=bs.allowBeep?\"none\":\"\");let a=r.elVibrateOn=r.querySelector(\".dce-mn-vibrate-on\"),h=r.elVibrateOff=r.querySelector(\".dce-mn-vibrate-off\");a&&(a.style.display=bs.allowVibrate?\"\":\"none\"),h&&(h.style.display=bs.allowVibrate?\"none\":\"\"),r.elResolutionBox=r.querySelector(\".dce-mn-resolution-box\");let l,c=r.elZoom=r.querySelector(\".dce-mn-zoom\");c&&(c.style.display=\"none\",l=r.elZoomSpan=c.querySelector(\"span\"));let u=r.elToast=r.querySelector(\".dce-mn-toast\"),d=r.elCameraClose=r.querySelector(\".dce-mn-camera-close\"),f=r.elTakePhoto=r.querySelector(\".dce-mn-take-photo\"),g=r.elCameraSwitch=r.querySelector(\".dce-mn-camera-switch\"),m=r.elCameraAndResolutionSettings=r.querySelector(\".dce-mn-camera-and-resolution-settings\");m&&(m.style.display=\"none\");const p=r.dceMnFs={},_=()=>{this.turnOnTorch()};null==t||t.addEventListener(\"pointerdown\",_);const v=()=>{this.turnOffTorch()};null==e||e.addEventListener(\"pointerdown\",v);const y=()=>{this.turnAutoTorch()};null==n||n.addEventListener(\"pointerdown\",y);const w=()=>{bs.allowBeep=!bs.allowBeep,s&&(s.style.display=bs.allowBeep?\"\":\"none\"),o&&(o.style.display=bs.allowBeep?\"none\":\"\")};for(let t of[o,s])null==t||t.addEventListener(\"pointerdown\",w);const C=()=>{bs.allowVibrate=!bs.allowVibrate,a&&(a.style.display=bs.allowVibrate?\"\":\"none\"),h&&(h.style.display=bs.allowVibrate?\"none\":\"\")};for(let t of[h,a])null==t||t.addEventListener(\"pointerdown\",C);const E=async t=>{let e,i=t.target;if(e=i.closest(\".dce-mn-camera-option\"))this.selectCamera(e.getAttribute(\"data-davice-id\"));else if(e=i.closest(\".dce-mn-resolution-option\")){let t,i=parseInt(e.getAttribute(\"data-width\")),r=parseInt(e.getAttribute(\"data-height\")),n=await this.setResolution({width:i,height:r});{let e=Math.max(n.width,n.height),i=Math.min(n.width,n.height);t=i<=1080?i+\"P\":e<3e3?\"2K\":Math.round(e/1e3)+\"K\"}t!=e.textContent&&b(`Fallback to ${t}`)}else i.closest(\".dce-mn-camera-and-resolution-settings\")||(i.closest(\".dce-mn-resolution-box\")?m&&(m.style.display=m.style.display?\"\":\"none\"):m&&\"\"===m.style.display&&(m.style.display=\"none\"))};r.addEventListener(\"click\",E);let T=null;p.funcInfoZoomChange=(t,e=3e3)=>{c&&l&&(l.textContent=t.toFixed(1),c.style.display=\"\",null!=T&&(clearTimeout(T),T=null),T=setTimeout((()=>{c.style.display=\"none\",T=null}),e))};let S=null,b=p.funcShowToast=(t,e=3e3)=>{u&&(u.textContent=t,u.style.display=\"\",null!=S&&(clearTimeout(S),S=null),S=setTimeout((()=>{u.style.display=\"none\",S=null}),e))};const I=()=>{this.close()};null==d||d.addEventListener(\"click\",I);const x=()=>{};null==f||f.addEventListener(\"pointerdown\",x);const O=()=>{var t,e;let i,r=this.getVideoSettings(),n=r.video.facingMode,s=null===(e=null===(t=this.cameraManager.getCamera())||void 0===t?void 0:t.label)||void 0===e?void 0:e.toLowerCase(),o=null==s?void 0:s.indexOf(\"front\");-1===o&&(o=null==s?void 0:s.indexOf(\"\u524d\"));let a=null==s?void 0:s.indexOf(\"back\");-1===a&&(a=null==s?void 0:s.indexOf(\"\u540e\")),\"number\"==typeof o&&-1!==o?i=!0:\"number\"==typeof a&&-1!==a&&(i=!1),void 0===i&&(i=\"user\"===((null==n?void 0:n.ideal)||(null==n?void 0:n.exact)||n)),r.video.facingMode={ideal:i?\"environment\":\"user\"},delete r.video.deviceId,this.updateVideoSettings(r)};null==g||g.addEventListener(\"pointerdown\",O);let A=-1/0,R=1;const D=t=>{let e=Date.now();e-A>1e3&&(R=this.getZoomSettings().factor),R-=t.deltaY/200,R>20&&(R=20),R<1&&(R=1),this.setZoom({factor:R}),A=e};i.addEventListener(\"wheel\",D);const L=new Map;let M=!1;const F=async t=>{var e;
2for(t.touches.length>=2&&\"touchmove\"==t.type&&t.preventDefault();t.changedTouches.length>1&&2==t.touches.length;){let i=t.touches[0],r=t.touches[1],n=L.get(i.identifier),s=L.get(r.identifier);if(!n||!s)break;let o=Math.pow(Math.pow(n.x-s.x,2)+Math.pow(n.y-s.y,2),.5),a=Math.pow(Math.pow(i.clientX-r.clientX,2)+Math.pow(i.clientY-r.clientY,2),.5),h=Date.now();if(M||h-A<100)return;h-A>1e3&&(R=this.getZoomSettings().factor),R*=a/o,R>20&&(R=20),R<1&&(R=1);let l=!1;\"safari\"==(null===(e=null==He?void 0:He.browser)||void 0===e?void 0:e.toLocaleLowerCase())&&(a/o>1&&R<2?(R=2,l=!0):a/o<1&&R<2&&(R=1,l=!0)),M=!0,l&&b(\"zooming...\"),await this.setZoom({factor:R}),l&&(u.textContent=\"\"),M=!1,A=Date.now();break}L.clear();for(let e of t.touches)L.set(e.identifier,{x:e.clientX,y:e.clientY})};r.addEventListener(\"touchstart\",F),r.addEventListener(\"touchmove\",F),r.addEventListener(\"touchend\",F),r.addEventListener(\"touchcancel\",F),p.unbind=()=>{null==t||t.removeEventListener(\"pointerdown\",_),null==e||e.removeEventListener(\"pointerdown\",v),null==n||n.removeEventListener(\"pointerdown\",y);for(let t of[o,s])null==t||t.removeEventListener(\"pointerdown\",w);for(let t of[h,a])null==t||t.removeEventListener(\"pointerdown\",C);r.removeEventListener(\"click\",E),null==d||d.removeEventListener(\"click\",I),null==f||f.removeEventListener(\"pointerdown\",x),null==g||g.removeEventListener(\"pointerdown\",O),i.removeEventListener(\"wheel\",D),r.removeEventListener(\"touchstart\",F),r.removeEventListener(\"touchmove\",F),r.removeEventListener(\"touchend\",F),r.removeEventListener(\"touchcancel\",F),delete r.dceMnFs,i.style.display=\"none\"},i.style.display=\"\",t&&null==this.isTorchOn&&setTimeout((()=>{this.turnAutoTorch(1e3)}),0)}this.isTorchOn&&this.turnOnTorch().catch((()=>{}));const n=this.getResolution();e.width=n.width,e.height=n.height,e.deviceId=this.getSelectedCamera().deviceId}return ze(this,ss,\"open\",\"f\"),t&&(t._innerComponent.style.display=\"\",Xe(this,is,\"m\",ys).call(this)||(t._stopLoading(),t._renderCamerasInfo(this.getSelectedCamera(),this.cameraManager._arrCameras),t._renderResolutionInfo({width:e.width,height:e.height}),t.eventHandler.fire(\"content:updated\",null,{async:!1}),t.eventHandler.fire(\"videoEl:resized\",null,{async:!1}))),Xe(this,os,\"f\").fire(\"opened\",null,{target:this,async:!1}),e}close(){var t;const e=this.cameraView;if(null==e?void 0:e.disposed)throw new Error(\"'cameraView' has been disposed.\");if(this.stopFetching(),this.clearBuffer(),Xe(this,is,\"m\",ys).call(this));else{this.cameraManager.close();let i=e.getUIElement();i=i.shadowRoot||i,i.querySelector(\".dce-macro-use-mobile-native-like-ui\")&&(null===(t=i.dceMnFs)||void 0===t||t.unbind())}ze(this,ss,\"closed\",\"f\"),Xe(this,_s,\"f\").stopCharging(),e&&(e._innerComponent.style.display=\"none\",Xe(this,is,\"m\",ys).call(this)&&e._innerComponent.removeElement(\"content\"),e._stopLoading()),Xe(this,os,\"f\").fire(\"closed\",null,{target:this,async:!1})}pause(){if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'pause()' is invalid in 'singleFrameMode'.\");this.cameraManager.pause()}isPaused(){var t;return!Xe(this,is,\"m\",ys).call(this)&&!0===(null===(t=this.video)||void 0===t?void 0:t.paused)}async resume(){if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'resume()' is invalid in 'singleFrameMode'.\");await this.cameraManager.resume()}async selectCamera(t){if(!t)throw new Error(\"Invalid value.\");let e;e=\"string\"==typeof t?t:t.deviceId,await this.cameraManager.setCamera(e),this.isTorchOn=!1;const i=this.getResolution(),r=this.cameraView;return r&&!r.disposed&&(r._stopLoading(),r._renderCamerasInfo(this.getSelectedCamera(),this.cameraManager._arrCameras),r._renderResolutionInfo({width:i.width,height:i.height})),{width:i.width,height:i.height,deviceId:this.getSelectedCamera().deviceId}}getSelectedCamera(){return this.cameraManager.getCamera()}async getAllCameras(){return this.cameraManager.getCameras()}async setResolution(t){await this.cameraManager.setResolution(t.width,t.height),this.isTorchOn&&this.turnOnTorch().catch((()=>{}));const e=this.getResolution(),i=this.cameraView;return i&&!i.disposed&&(i._stopLoading(),i._renderResolutionInfo({width:e.width,height:e.height})),{width:e.width,height:e.height,deviceId:this.getSelectedCamera().deviceId}}getResolution(){return this.cameraManager.getResolution()}getAvailableResolutions(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getResolutions()}_on(t,e){[\"opened\",\"closed\",\"singleframeacquired\",\"frameaddedtobuffer\"].includes(t.toLowerCase())?Xe(this,os,\"f\").on(t,e):this.cameraManager.on(t,e)}_off(t,e){[\"opened\",\"closed\",\"singleframeacquired\",\"frameaddedtobuffer\"].includes(t.toLowerCase())?Xe(this,os,\"f\").off(t,e):this.cameraManager.off(t,e)}on(t,e){const i=t.toLowerCase(),r=new Map([[\"cameraopen\",\"opened\"],[\"cameraclose\",\"closed\"],[\"camerachange\",\"camera:changed\"],[\"resolutionchange\",\"resolution:changed\"],[\"played\",\"played\"],[\"singleframeacquired\",\"singleFrameAcquired\"],[\"frameaddedtobuffer\",\"frameAddedToBuffer\"]]).get(i);if(!r)throw new Error(\"Invalid event.\");this._on(r,e)}off(t,e){const i=t.toLowerCase(),r=new Map([[\"cameraopen\",\"opened\"],[\"cameraclose\",\"closed\"],[\"camerachange\",\"camera:changed\"],[\"resolutionchange\",\"resolution:changed\"],[\"played\",\"played\"],[\"singleframeacquired\",\"singleFrameAcquired\"],[\"frameaddedtobuffer\",\"frameAddedToBuffer\"]]).get(i);if(!r)throw new Error(\"Invalid event.\");this._off(r,e)}getVideoSettings(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getMediaStreamConstraints()}async updateVideoSettings(t){var e;await(null===(e=this.cameraManager)||void 0===e?void 0:e.setMediaStreamConstraints(t,!0))}getCapabilities(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getCameraCapabilities()}getCameraSettings(){return this.cameraManager.getCameraSettings()}async turnOnTorch(){var t,e;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'turnOnTorch()' is invali
2d in 'singleFrameMode'.\");try{await(null===(t=this.cameraManager)||void 0===t?void 0:t.turnOnTorch())}catch(t){let i=this.cameraView.getUIElement();throw i=i.shadowRoot||i,null===(e=null==i?void 0:i.dceMnFs)||void 0===e||e.funcShowToast(\"Torch Not Supported\"),t}this.isTorchOn=!0;let i=this.cameraView.getUIElement();i=i.shadowRoot||i,i.elTorchAuto&&(i.elTorchAuto.style.display=\"none\"),i.elTorchOn&&(i.elTorchOn.style.display=\"\"),i.elTorchOff&&(i.elTorchOff.style.display=\"none\")}async turnOffTorch(){var t;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'turnOffTorch()' is invalid in 'singleFrameMode'.\");await(null===(t=this.cameraManager)||void 0===t?void 0:t.turnOffTorch()),this.isTorchOn=!1;let e=this.cameraView.getUIElement();e=e.shadowRoot||e,e.elTorchAuto&&(e.elTorchAuto.style.display=\"none\"),e.elTorchOn&&(e.elTorchOn.style.display=\"none\"),e.elTorchOff&&(e.elTorchOff.style.display=\"\")}async turnAutoTorch(t=250){if(null!=this._taskid4AutoTorch){if(!(t<this._delay4AutoTorch))return;clearInterval(this._taskid4AutoTorch),this._taskid4AutoTorch=null}this._delay4AutoTorch=t;let e=!1,i=0,r=0;const n=async()=>{var t,n,s;if(this.disposed||e||null!=this.isTorchOn||!this.isOpen())return clearInterval(this._taskid4AutoTorch),void(this._taskid4AutoTorch=null);if(this.isPaused())return;if(++r>10&&this._delay4AutoTorch<1e3)return clearInterval(this._taskid4AutoTorch),this._taskid4AutoTorch=null,void this.turnAutoTorch(1e3);let o;try{o=this.fetchImage()}catch(t){}if(!o||!o.width||!o.height)return;let a=0;if(h.IPF_GRAYSCALED===o.format){for(let t=0;t<o.bytes.length;++t)a+=o.bytes[t];a/=o.bytes.length}else{if(h.IPF_ABGR_8888!==o.format)return;for(let t=0;t<o.bytes.length;t+=4)a+=o.bytes[t],a+=o.bytes[t+1],a+=o.bytes[t+2];a/=o.bytes.length/4*3}if(a<this.grayThreshold4AutoTorch){if(++i>=this.maxDarkCount4AutoTroch){null===(t=Os._onLog)||void 0===t||t.call(Os,`darkCount ${i}`);try{await this.turnOnTorch(),this.isTorchOn=!0;let t=this.cameraView.getUIElement();t=t.shadowRoot||t,null===(n=null==t?void 0:t.dceMnFs)||void 0===n||n.funcShowToast(\"Torch Auto On\")}catch(t){console.warn(t),e=!0;let i=this.cameraView.getUIElement();i=i.shadowRoot||i,null===(s=null==i?void 0:i.dceMnFs)||void 0===s||s.funcShowToast(\"Torch Not Supported\")}}}else i=0};this._taskid4AutoTorch=setInterval(n,t),this.isTorchOn=void 0,n();let s=this.cameraView.getUIElement();s=s.shadowRoot||s,s.elTorchAuto&&(s.elTorchAuto.style.display=\"\"),s.elTorchOn&&(s.elTorchOn.style.display=\"none\"),s.elTorchOff&&(s.elTorchOff.style.display=\"none\")}async setColorTemperature(t){if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'setColorTemperature()' is invalid in 'singleFrameMode'.\");await this.cameraManager.setColorTemperature(t,!0)}getColorTemperature(){return this.cameraManager.getColorTemperature()}async setExposureCompensation(t){var e;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'setExposureCompensation()' is invalid in 'singleFrameMode'.\");await(null===(e=this.cameraManager)||void 0===e?void 0:e.setExposureCompensation(t,!0))}getExposureCompensation(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getExposureCompensation()}async _setZoom(t){var e,i,r;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'setZoom()' is invalid in 'singleFrameMode'.\");await(null===(e=this.cameraManager)||void 0===e?void 0:e.setZoom(t));{let e=null===(i=this.cameraView)||void 0===i?void 0:i.getUIElement();e=(null==e?void 0:e.shadowRoot)||e,null===(r=null==e?void 0:e.dceMnFs)||void 0===r||r.funcInfoZoomChange(t.factor)}}async setZoom(t){await this._setZoom(t)}getZoomSettings(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getZoom()}async resetZoom(){var t;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'resetZoom()' is invalid in 'singleFrameMode'.\");await(null===(t=this.cameraManager)||void 0===t?void 0:t.resetZoom())}async setFrameRate(t){var e;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'setFrameRate()' is invalid in 'singleFrameMode'.\");await(null===(e=this.cameraManager)||void 0===e?void 0:e.setFrameRate(t,!0))}getFrameRate(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getFrameRate()}async setFocus(t){var e;if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'setFocus()' is invali
2d in 'singleFrameMode'.\");await(null===(e=this.cameraManager)||void 0===e?void 0:e.setFocus(t,!0))}getFocusSettings(){var t;return null===(t=this.cameraManager)||void 0===t?void 0:t.getFocus()}setAutoZoomRange(t){Xe(this,ps,\"f\").minValue=t.min,Xe(this,ps,\"f\").maxValue=t.max}getAutoZoomRange(){return{min:Xe(this,ps,\"f\").minValue,max:Xe(this,ps,\"f\").maxValue}}async enableEnhancedFeatures(t){var e,i;if(!(null===(i=null===(e=ct.license)||void 0===e?void 0:e.LicenseManager)||void 0===i?void 0:i.bPassValidation))throw new Error(\"License is not verified, or license is invalid.\");if(0!==gt.bSupportDce4Module)throw new Error(\"Please set a license containing the DCE module.\");t&ni.EF_ENHANCED_FOCUS&&(Xe(this,ms,\"f\").enhancedFocus=!0),t&ni.EF_AUTO_ZOOM&&(Xe(this,ms,\"f\").autoZoom=!0),t&ni.EF_TAP_TO_FOCUS&&(Xe(this,ms,\"f\").tapToFocus=!0,this.cameraManager.enableTapToFocus())}disableEnhancedFeatures(t){t&ni.EF_ENHANCED_FOCUS&&(Xe(this,ms,\"f\").enhancedFocus=!1,this.setFocus({mode:\"continuous\"}).catch((()=>{}))),t&ni.EF_AUTO_ZOOM&&(Xe(this,ms,\"f\").autoZoom=!1,this.resetZoom().catch((()=>{}))),t&ni.EF_TAP_TO_FOCUS&&(Xe(this,ms,\"f\").tapToFocus=!1,this.cameraManager.disableTapToFocus()),Xe(this,is,\"m\",Cs).call(this)&&Xe(this,is,\"m\",ws).call(this)||Xe(this,_s,\"f\").stopCharging()}_setScanRegion(t){if(null!=t&&!w(t)&&!I(t))throw TypeError(\"Invalid 'region'.\");ze(this,us,t?JSON.parse(JSON.stringify(t)):null,\"f\"),this.cameraView&&!this.cameraView.disposed&&this.cameraView.setScanRegion(t)}setScanRegion(t){this._setScanRegion(t),this.cameraView&&!this.cameraView.disposed&&(null===t?this.cameraView.setScanRegionMaskVisible(!1):this.cameraView.setScanRegionMaskVisible(!0))}getScanRegion(){return JSON.parse(JSON.stringify(Xe(this,us,\"f\")))}setErrorListener(t){if(!t)throw new TypeError(\"Invalid 'listener'\");ze(this,cs,t,\"f\")}hasNextImageToFetch(){return!(\"open\"!==this.getCameraState()||!this.cameraManager.isVideoLoaded()||Xe(this,is,\"m\",ys).call(this))}startFetching(){if(Xe(this,is,\"m\",ys).call(this))throw Error(\"'startFetching()' is unavailable in 'singleFrameMode'.\");Xe(this,fs,\"f\")||(ze(this,fs,!0,\"f\"),Xe(this,is,\"m\",Es).call(this))}stopFetching(){Xe(this,fs,\"f\")&&(Os._onLog&&Os._onLog(\"DCE: stop fetching loop: \"+Date.now()),Xe(this,gs,\"f\")&&clearTimeout(Xe(this,gs,\"f\")),ze(this,fs,!1,\"f\"))}fetchImage(){if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'fetchImage()' is unavailable in 'singleFrameMode'.\");if(!this.video)throw new Error(\"The video element does not exist.\");if(4!==this.video.readyState)throw new Error(\"The video is not loaded.\");const t=this.getResolution();if(!(null==t?void 0:t.width)||!(null==t?void 0:t.height))throw new Error(\"The video is not loaded.\");let e;if(e=ki.convert(Xe(this,us,\"f\"),t.width,t.height),e||(e={x:0,y:0,width:t.width,height:t.height}),e.x>t.width||e.y>t.height)throw new Error(\"Invalid scan region.\");e.x+e.width>t.width&&(e.width=t.width-e.x),e.y+e.height>t.height&&(e.height=t.height-e.y);const i={sx:e.x,sy:e.y,sWidth:e.width,sHeight:e.height,dWidth:e.width,dHeight:e.height},r=Math.max(i.dWidth,i.dHeight);if(this.canvasSizeLimit&&r>this.canvasSizeLimit){const t=this.canvasSizeLimit/r;i.dWidth>i.dHeight?(i.dWidth=this.canvasSizeLimit,i.dHeight=Math.round(i.dHeight*t)):(i.dWidth=Math.round(i.dWidth*t),i.dHeight=this.canvasSizeLimit)}const n=this.cameraManager.getFrameData({position:i,pixelFormat:this.getPixelFormat()===h.IPF_GRAYSCALED?Gr.GREY:Gr.RGBA});if(!n)return null;let s;s=n.pixelFormat===Gr.GREY?n.width:4*n.width;let o=!0;return 0===i.sx&&0===i.sy&&i.sWidth===t.width&&i.sHeight===t.height&&(o=!1),{bytes:n.data,width:n.width,height:n.height,stride:s,format:Is.get(n.pixelFormat),tag:{imageId:this._imageId==Number.MAX_VALUE?this._imageId=0:++this._imageId,type:wt.ITT_VIDEO_FRAME,isCropped:o,cropRegion:{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height,isMeasuredInPercentage:!1},originalWidth:t.width,originalHeight:t.height,currentWidth:n.width,currentHeight:n.height,timeSpent:n.timeSpent,timeStamp:n.timeStamp},toCanvas:Xe(this,ls,\"f\"),isDCEFrame:!0}}setImageFetchInterval(t){this.fetchInterval=t,Xe(this,fs,\"f\")&&(Xe(this,gs,\"f\")&&clearTimeout(Xe(this,gs,\"f\")),ze(this,gs,setTimeout((()=>{this.disposed||Xe(this,is,\"m\",Es).call(this)}),t),\"f\"))}getImageFetchInterval(){return this.fetchInterval}setPixelFormat(t){ze(this,ds,t,\"f\")}getPixelFormat(){return Xe(this,ds,\"f\")}takePhoto(t){if(!this.isOpen())throw new Error(\"Not open.\");if(Xe(this,is,\"m\",ys).call(this))throw new Error(\"'takePhoto()' is unavailable in 'singleFrameMode'.\");const e=document.createElement(\"input\");e.setAttribute(\"type\",\"file\"),e.setAttribute(\"accept\",\".jpg,.jpeg,.icon,.gif,.svg,.webp,.png,.bmp\"),e.setAttribute(\"capture\",\"\"),e.style.position=\"absolute\",e.style.top=\"-9999px\",e.style.backgroundColor=\"transparent\",e.style.color=\"transparent\",e.addEventListener(\"click\",(()=>{const t=this.isOpen();this.close(),window.addEventListener(\"focus\",(()=>{t&&this.open(),e.remove()}),{once:!0})})),e.addEventListener(\"change\",(async()=>{const i=e.files[0],r=await(async t=>{let e=null,i=null;
2if(\"undefined\"!=typeof createImageBitmap)try{if(e=await createImageBitmap(t),e)return e}catch(t){}var r;return e||(i=await(r=t,new Promise(((t,e)=>{let i=URL.createObjectURL(r),n=new Image;n.src=i,n.onload=()=>{URL.revokeObjectURL(n.src),t(n)},n.onerror=t=>{e(new Error(\"Can't convert blob to image : \"+(t instanceof Event?t.type:t)))}})))),i})(i),n=r instanceof HTMLImageElement?r.naturalWidth:r.width,s=r instanceof HTMLImageElement?r.naturalHeight:r.height;let o=ki.convert(Xe(this,us,\"f\"),n,s);o||(o={x:0,y:0,width:n,height:s});const a=Xe(this,hs,\"f\").call(this,r,n,s,o);t&&t(a)})),document.body.appendChild(e),e.click()}convertToPageCoordinates(t){const e=Xe(this,is,\"m\",Ts).call(this,t);return{x:e.pageX,y:e.pageY}}convertToClientCoordinates(t){const e=Xe(this,is,\"m\",Ts).call(this,t);return{x:e.clientX,y:e.clientY}}convertToScanRegionCoordinates(t){if(!Xe(this,us,\"f\"))return JSON.parse(JSON.stringify(t));let e,i,r=Xe(this,us,\"f\").left||Xe(this,us,\"f\").x||0,n=Xe(this,us,\"f\").top||Xe(this,us,\"f\").y||0;if(!Xe(this,us,\"f\").isMeasuredInPercentage)return{x:t.x-r,y:t.y-n};if(!this.cameraView)throw new Error(\"Camera view is not set.\");if(this.cameraView.disposed)throw new Error(\"'cameraView' has been disposed.\");if(!this.isOpen())throw new Error(\"Not open.\");if(!Xe(this,is,\"m\",ys).call(this)&&!this.cameraManager.isVideoLoaded())throw new Error(\"Video is not loaded.\");if(Xe(this,is,\"m\",ys).call(this)&&!this.cameraView._cvsSingleFrameMode)throw new Error(\"No image is selected.\");if(Xe(this,is,\"m\",ys).call(this)){const t=this.cameraView._innerComponent.getElement(\"content\");e=t.width,i=t.height}else{const t=this.getVideoEl();e=t.videoWidth,i=t.videoHeight}return{x:t.x-Math.round(r*e/100),y:t.y-Math.round(n*i/100)}}dispose(){this.close(),this.cameraManager.dispose(),this.releaseCameraView(),ze(this,vs,!0,\"f\")}}var As,Rs,Ds,Ls,Ms,Fs,Ps,ks;rs=Os,ss=new WeakMap,os=new WeakMap,as=new WeakMap,hs=new WeakMap,ls=new WeakMap,cs=new WeakMap,us=new WeakMap,ds=new WeakMap,fs=new WeakMap,gs=new WeakMap,ms=new WeakMap,ps=new WeakMap,_s=new WeakMap,vs=new WeakMap,is=new WeakSet,ys=function(){return\"disabled\"!==this.singleFrameMode},ws=function(){return!this.videoSrc&&\"opened\"===this.cameraManager.state},Cs=function(){for(let t in Xe(this,ms,\"f\"))if(1==Xe(this,ms,\"f\")[t])return!0;return!1},Es=function t(){if(this.disposed)return;if(\"open\"!==this.getCameraState()||!Xe(this,fs,\"f\"))return Xe(this,gs,\"f\")&&clearTimeout(Xe(this,gs,\"f\")),void ze(this,gs,setTimeout((()=>{this.disposed||Xe(this,is,\"m\",t).call(this)}),this.fetchInterval),\"f\");const e=()=>{var t;let e;Os._onLog&&Os._onLog(\"DCE: start fetching a frame into buffer: \"+Date.now());try{e=this.fetchImage()}catch(e){const i=e.message||e;if(\"The video is not loaded.\"===i)return;if(null===(t=Xe(this,cs,\"f\"))||void 0===t?void 0:t.onErrorReceived)return void setTimeout((()=>{var t;null===(t=Xe(this,cs,\"f\"))||void 0===t||t.onErrorReceived(_t.EC_IMAGE_READ_FAILED,i)}),0);console.warn(e)}e?(this.addImageToBuffer(e),Os._onLog&&Os._onLog(\"DCE: finish fetching a frame into buffer: \"+Date.now()),Xe(this,os,\"f\").fire(\"frameAddedToBuffer\",null,{async:!1})):Os._onLog&&Os._onLog(\"DCE: get a invalid frame, abandon it: \"+Date.now())};if(this.getImageCount()>=this.getMaxImageCount())switch(this.getBufferOverflowProtectionMode()){case o.BOPM_BLOCK:break;case o.BOPM_UPDATE:e()}else e();Xe(this,gs,\"f\")&&clearTimeout(Xe(this,gs,\"f\")),ze(this,gs,setTimeout((()=>{this.disposed||Xe(this,is,\"m\",t).call(this)}),this.fetchInterval),\"f\")},Ts=function(t){if(!this.cameraView)throw new Error(\"Camera view is not set.\");if(this.cameraView.disposed)throw new Error(\"'cameraView' has been disposed.\");if(!this.isOpen())throw new Error(\"Not open.\");if(!Xe(this,is,\"m\",ys).call(this)&&!this.cameraManager.isVideoLoaded())throw new Error(\"Video is not loaded.\");if(Xe(this,is,\"m\",ys).call(this)&&!this.cameraView._cvsSingleFrameMode)throw new Error(\"No image is selected.\");const e=this.cameraView._innerComponent.getBoundingClientRect(),i=e.left,r=e.top,n=i+window.scrollX,s=r+window.scrollY,{width:o,height:a}=this.cameraView._innerComponent.getBoundingClientRect();if(o<=0||a<=0)throw new Error(\"Unable to get content dimensions. Camera view may not be rendered on the page.\");let h,l,c;if(Xe(this,is,\"m\",ys).call(this)){const t=this.cameraView._innerComponent.getElement(\"content\");h=t.width,l=t.height,c=\"contain\"}else{const t=this.getVideoEl();h=t.videoWidth,l=t.videoHeight,c=this.cameraView.getVideoFit()}const u=o/a,d=h/l;let f,g,m,p,_=1;if(\"contain\"===c)u<d?(_=o/h,f=i+t.x*_,g=r+t.y*_+(a-l*_)/2,m=n+t.x*_,p=s+t.y*_+(a-l*_)/2):(_=a/l,f=i+t.x*_+(o-h*_)/2,g=r+t.y*_,m=n+t.x*_+(o-h*_)/2,p=s+t.y*_);else if(\"cover\"===c)if(u<d){_=a/l;let e=t.x*_-(h*_-o)/2;e=Math.max(e,0),e=Math.min(e,o),f=i+e,g=r+t.y*_,m=n+e,p=s+t.y*_}else{_=o/h;
2let e=t.y*_-(l*_-a)/2;e=Math.max(e,0),e=Math.min(e,a),f=i+t.x*_,g=r+e,m=n+t.x*_,p=s+e}return{clientX:f,clientY:g,pageX:m,pageY:p}},Os._debug=!1,ns={value:void 0},Os.browserInfo=He;class Bs{get magnifierCanvas(){return Xe(this,As,\"f\")}constructor(){As.set(this,void 0),ze(this,As,document.createElement(\"canvas\"),\"f\"),Xe(this,As,\"f\").style.borderRadius=\"50%\"}update(t,e,i,r){if(!this.magnifierCanvas)throw new Error(\"'magnifierCanvas' not created.\");const n=this.magnifierCanvas;n.width=n.height=t;let s=e.x-i/2,o=e.y-i/2,a=i,h=i,l=n.width,c=n.height,u=n.getContext(\"2d\");for(let t of r)u.drawImage(t.image,s,o,a,h,0,0,l,c);n.style.width=n.width+\"px\",n.style.height=n.height+\"px\"}show(){if(!this.magnifierCanvas)throw new Error(\"'magnifierCanvas' not created.\");this.magnifierCanvas.style.display=\"block\"}hide(){if(!this.magnifierCanvas)throw new Error(\"'magnifierCanvas' not created.\");this.magnifierCanvas.style.display=\"none\"}}As=new WeakMap;class Ns extends Or{static async createInstance(t){const e=new Ns;return await e.setUIElement(t||Xe(e,Rs,\"m\",ks).call(e)),e}get disposed(){return Xe(this,Ps,\"f\")}constructor(){super(),Rs.add(this),this.containerClassName=\"dce-image-container\",Ds.set(this,void 0),Ls.set(this,void 0),this.isUseMagnifier=!0,Ms.set(this,(t=>{var e;if(!this.isUseMagnifier)return;if(Xe(this,Ls,\"f\")||ze(this,Ls,new Bs,\"f\"),!Xe(this,Ls,\"f\").magnifierCanvas)return;document.body.contains(Xe(this,Ls,\"f\").magnifierCanvas)||(Xe(this,Ls,\"f\").magnifierCanvas.style.position=\"fixed\",Xe(this,Ls,\"f\").magnifierCanvas.style.boxSizing=\"content-box\",Xe(this,Ls,\"f\").magnifierCanvas.style.border=\"2px solid #FFFFFF\",document.body.append(Xe(this,Ls,\"f\").magnifierCanvas));const i=this._innerComponent.getElement(\"content\");if(!i)return;if(t.pointer.x<0||t.pointer.x>i.width||t.pointer.y<0||t.pointer.y>i.height)return void Xe(this,Fs,\"f\").call(this);const r=null===(e=this._drawingLayerManager._getFabricCanvas())||void 0===e?void 0:e.lowerCanvasEl;if(!r)return;const n=Math.max(i.clientWidth/5/1.5,i.clientHeight/4/1.5),s=1.5*n,o=[{image:i,width:i.width,height:i.height},{image:r,width:r.width,height:r.height}];Xe(this,Ls,\"f\").update(s,t.pointer,n,o);{let e=0,i=0;t.e instanceof MouseEvent?(e=t.e.clientX,i=t.e.clientY):t.e instanceof TouchEvent&&t.e.changedTouches.length&&(e=t.e.changedTouches[0].clientX,i=t.e.changedTouches[0].clientY),e<1.5*s&&i<1.5*s?(Xe(this,Ls,\"f\").magnifierCanvas.style.left=\"auto\",Xe(this,Ls,\"f\").magnifierCanvas.style.top=\"0\",Xe(this,Ls,\"f\").magnifierCanvas.style.right=\"0\"):(Xe(this,Ls,\"f\").magnifierCanvas.style.left=\"0\",Xe(this,Ls,\"f\").magnifierCanvas.style.top=\"0\",Xe(this,Ls,\"f\").magnifierCanvas.style.right=\"auto\")}Xe(this,Ls,\"f\").show()})),Fs.set(this,(()=>{Xe(this,Ls,\"f\")&&Xe(this,Ls,\"f\").hide()})),Ps.set(this,!1)}_setUIElement(t){this.UIElement=t,this._unbindUI(),this._bindUI()}async setUIElement(t){let e;if(\"string\"==typeof t){let i=await Wi(t);e=document.createElement(\"div\"),Object.assign(e.style,{width:\"100%\",height:\"100%\"}),e.attachShadow({mode:\"open\"}).appendChild(i)}else e=t;this._setUIElement(e)}getUIElement(){return this.UIElement}_bindUI(){if(!this.UIElement)throw new Error(\"Need to set 'UIElement'.\");if(this._innerComponent)return;const t=this.UIElement;let e=t.classList.contains(this.containerClassName)?t:t.querySelector(`.${this.containerClassName}`);e||(e=document.createElement(\"div\"),e.style.width=\"100%\",e.style.height=\"100%\",e.className=this.containerClassName,t.append(e)),this._innerComponent=document.createElement(\"dce-component\"),e.appendChild(this._innerComponent)}_unbindUI(){var t,e,i;null===(t=this._drawingLayerManager)||void 0===t||t.clearDrawingLayers(),null===(e=this._innerComponent)||void 0===e||e.removeElement(\"drawing-layer\"),this._layerBaseCvs=null,null===(i=this._innerComponent)||void 0===i||i.remove(),this._innerComponent=null}setImage(t,e,i){if(!this._innerComponent)throw new Error(\"Need to set 'UIElement'.\");let r=this._innerComponent.getElement(\"content\");r||(r=document.createElement(\"canvas\"),r.style.objectFit=\"contain\",this._innerComponent.setElement(\"content\",r)),r.width===e&&r.height===i||(r.width=e,r.height=i);const n=r.getContext(\"2d\");n.clearRect(0,0,r.width,r.height),t instanceof Uint8Array||t instanceof Uint8ClampedArray?(t instanceof Uint8Array&&(t=new Uint8ClampedArray(t.buffer)),n.putImageData(new ImageData(t,e,
2i),0,0)):(t instanceof HTMLCanvasElement||t instanceof HTMLImageElement)&&n.drawImage(t,0,0)}getImage(){return this._innerComponent.getElement(\"content\")}clearImage(){if(!this._innerComponent)return;let t=this._innerComponent.getElement(\"content\");t&&t.getContext(\"2d\").clearRect(0,0,t.width,t.height)}removeImage(){this._innerComponent&&this._innerComponent.removeElement(\"content\")}setOriginalImage(t){if(y(t)){ze(this,Ds,t,\"f\");const{width:e,height:i,bytes:r,format:n}=Object.assign({},t);let s;if(n===h.IPF_GRAYSCALED){s=new Uint8ClampedArray(e*i*4);for(let t=0;t<s.length;t+=4)s[t]=r[t/4],s[t+1]=r[t/4],s[t+2]=r[t/4],s[t+3]=255}else s=new Uint8ClampedArray(r.buffer);this.setImage(s,e,i)}else if(t instanceof HTMLCanvasElement)ze(this,Ds,t,\"f\"),this.setImage(t,t.width,t.height);else{if(!(t instanceof HTMLImageElement))throw new TypeError(\"Invalid img.\");ze(this,Ds,t,\"f\"),this.setImage(t,t.naturalWidth,t.naturalHeight)}let e;try{e=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"===(t.message||t))return;throw t}this.updateDrawingLayers(e)}getOriginalImage(){return Xe(this,Ds,\"f\")}getContentDimensions(){let t,e,i;if(this._innerComponent){const r=this._innerComponent.getElement(\"content\");t=null==r?void 0:r.width,e=null==r?void 0:r.height,i=\"contain\"}if(!t||!e)throw new Error(\"Invalid content dimensions.\");return{width:t,height:e,objectFit:i}}_createDrawingLayer(t,e,i,r){if(!this._layerBaseCvs){let n;try{n=this.getContentDimensions()}catch(t){if(\"Invalid content dimensions.\"!==(t.message||t))throw t}e||(e=(null==n?void 0:n.width)||300),i||(i=(null==n?void 0:n.height)||150),r||(r=(null==n?void 0:n.objectFit)||\"contain\"),this._layerBaseCvs=this.createDrawingLayerBaseCvs(e,i,r)}const n=this._layerBaseCvs,s=this._drawingLayerManager.createDrawingLayer(n,t);this._innerComponent.getElement(\"drawing-layer\")||this._innerComponent.setElement(\"drawing-layer\",n.parentElement),t!=br.TIP_LAYER_ID&&s.setMode(\"editor\");const o=this._drawingLayerManager._getFabricCanvas();return o&&(o.on(\"object:scaling\",Xe(this,Ms,\"f\")),o.on(\"object:rotating\",Xe(this,Ms,\"f\")),o.on(\"object:skewing\",Xe(this,Ms,\"f\")),o.on(\"mouse:up\",Xe(this,Fs,\"f\"))),s}dispose(){this._unbindUI(),this.__proto__=null;for(let t in this)delete this[t];Object.defineProperty(this,\"disposed\",{value:!0})}}Ds=new WeakMap,Ls=new WeakMap,Ms=new WeakMap,Fs=new WeakMap,Ps=new WeakMap,Rs=new WeakSet,ks=function(){const t=document.createElement(\"div\");return t.className=this.containerClassName,t.style.width=\"100%\",t.style.height=\"100%\",t};var js=Object.freeze({__proto__:null,CameraEnhancer:Os,CameraEnhancerModule:class{static getVersion(){return\"4.1.1\"}},CameraView:Rr,DrawingItem:wi,DrawingStyleManager:Sr,get EnumDrawingItemMediaType(){return ii},get EnumDrawingItemState(){return ri},get EnumEnhancedFeatures(){return ni},Feedback:bs,GroupDrawingItem:Li,ImageDrawingItem:class extends wi{set maintainAspectRatio(t){t&&this.set(\"scaleY\",this.get(\"scaleX\"))}get maintainAspectRatio(){return Xe(this,vi,\"f\")}constructor(t,e,i,r){if(super(null,r),_i.set(this,void 0),vi.set(this,void 0),!I(e))throw new TypeError(\"Invalid 'rect'.\");if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)this._setFabricObject(new oi.Image(t,{left:e.x,top:e.y}));else{if(!y(t))throw new TypeError(\"Invalid 'image'.\");{const i=document.createElement(\"canvas\");let r;if(i.width=t.width,i.height=t.height,t.format===h.IPF_GRAYSCALED){r=new Uint8ClampedArray(t.width*t.height*4);for(let e=0;e<r.length;e+=4)r[e]=t.bytes[e/4],r[e+1]=t.bytes[e/4],r[e+2]=t.bytes[e/4],r[e+3]=255}else r=new Uint8ClampedArray(t.bytes.buffer);i.getContext(\"2d\").putImageData(new ImageData(r,t.width,t.height),0,0),this._setFabricObject(new oi.Image(i,{left:e.x,top:e.y}))}}if(i){const t=e.width/this.get(\"width\");this.set(\"scaleX\",t),this.set(\"scaleY\",t)}else this.set(\"scaleX\",e.width/this.get(\"width\")),this.set(\"scaleY\",e.height/this.get(\"height\"));this.image=t,ze(this,_i,JSON.parse(JSON.stringify(e)),\"f\"),ze(this,vi,i,\"f\"),this._mediaType=\"image\"}extendSet(t,e){if(\"image\"===t){if(e instanceof HTMLImageElement)return this._fabricObject.
2setElement(e),this.image=e,!0;if(e instanceof HTMLCanvasElement){const t=new Image;return t.src=e.toDataURL(),this._fabricObject.setElement(t),this.image=e,!0}throw new Error(\"Unsupported value.\")}}extendGet(t){if(\"image\"===t)return this.image}updateCoordinateBaseFromImageToView(){if(this.set(\"left\",this.convertPropFromViewToImage(this.get(\"left\"))),this.set(\"top\",this.convertPropFromViewToImage(this.get(\"top\"))),Xe(this,vi,\"f\")){const t=this.convertPropFromViewToImage(this.get(\"width\"))/this.get(\"width\");this.set(\"scaleX\",t),this.set(\"scaleY\",t)}else this.set(\"scaleX\",this.convertPropFromViewToImage(this.get(\"width\"))/this.get(\"width\")),this.set(\"scaleY\",this.convertPropFromViewToImage(this.get(\"height\"))/this.get(\"height\"))}updateCoordinateBaseFromViewToImage(){if(this.set(\"left\",this.convertPropFromImageToView(this.get(\"left\"))),this.set(\"top\",this.convertPropFromImageToView(this.get(\"top\"))),Xe(this,vi,\"f\")){const t=this.convertPropFromImageToView(this.get(\"width\"))/this.get(\"width\");this.set(\"scaleX\",t),this.set(\"scaleY\",t)}else this.set(\"scaleX\",this.convertPropFromImageToView(this.get(\"width\"))/this.get(\"width\")),this.set(\"scaleY\",this.convertPropFromImageToView(this.get(\"height\"))/this.get(\"height\"))}setPosition(t){this.setImageRect(t)}getPosition(){return this.getImageRect()}updatePosition(){Xe(this,_i,\"f\")&&this.setImageRect(Xe(this,_i,\"f\"))}setImage(t){const e=this.getImageRect();if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)this.set(\"image\",t);else{if(!y(t))throw new TypeError(\"Invalid 'image'.\");{const e=document.createElement(\"canvas\");let i;if(e.width=t.width,e.height=t.height,t.format===h.IPF_GRAYSCALED){i=new Uint8ClampedArray(t.width*t.height*4);for(let e=0;e<i.length;e+=4)i[e]=t.bytes[e/4],i[e+1]=t.bytes[e/4],i[e+2]=t.bytes[e/4],i[e+3]=255}else i=new Uint8ClampedArray(t.bytes.buffer);e.getContext(\"2d\").putImageData(new ImageData(i,t.width,t.height),0,0),this.set(\"image\",e)}}if(Xe(this,vi,\"f\")){const t=e.width/this.get(\"width\");this.set(\"scaleX\",t),this.set(\"scaleY\",t)}else this.set(\"scaleX\",e.width/this.get(\"width\")),this.set(\"scaleY\",e.height/this.get(\"height\"))}getImage(){return this.image}setImageRect(t){if(!I(t))throw new TypeError(\"Invalid 'rect'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase)if(this.set(\"left\",this.convertPropFromViewToImage(t.x)),this.set(\"top\",this.convertPropFromViewToImage(t.y)),Xe(this,vi,\"f\")){const e=this.convertPropFromViewToImage(t.width)/this.get(\"width\");this.set(\"scaleX\",e),this.set(\"scaleY\",e)}else this.set(\"scaleX\",this.convertPropFromViewToImage(t.width)/this.get(\"width\")),this.set(\"scaleY\",this.convertPropFromViewToImage(t.height)/this.get(\"height\"));else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");if(this.set(\"left\",t.x),this.set(\"top\",t.y),Xe(this,vi,\"f\")){const e=t.width/this.get(\"width\");this.set(\"scaleX\",e),this.set(\"scaleY\",e)}else this.set(\"scaleX\",t.width/this.get(\"width\")),this.set(\"scaleY\",t.height/this.get(\"height\"))}this._drawingLayer.renderAll()}else ze(this,_i,JSON.parse(JSON.stringify(t)),\"f\")}getImageRect(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{x:this.convertPropFromImageToView(this.get(\"left\")),y:this.convertPropFromImageToView(this.get(\"top\")),width:this.convertPropFromImageToView(this.get(\"scaledWidth\")),height:this.convertPropFromImageToView(this.get(\"scaledHeight\"))};if(\"image\"===this.coordinateBase)return{x:this.get(\"left\"),y:this.get(\"top\"),width:this.get(\"scaledWidth\"),height:this.get(\"scaledHeight\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,_i,\"f\")?JSON.parse(JSON.stringify(Xe(this,_i,\"f\"))):null}},ImageEditorView:Ns,LineDrawingItem:class extends Ii{constructor(t,e){if(super({points:[null==t?void 0:t.startPoint,null==t?void 0:t.endPoint]},e),Ai.set(this,void 0),!E(t))throw new TypeError(\"Invalid 'line'.\");ze(this,Ai,JSON.parse(JSON.stringify(t)),\"f\"),this._mediaType=\"line\"}
2extendSet(t,e){if(\"startPoint\"===t||\"endPoint\"===t){e=\"startPoint\"===t?[e,this.get(\"endPoint\")]:[this.get(\"startPoint\"),e];const i=this._fabricObject;if(i.group){const t=i.group;i.points=e.map((e=>({x:e.x-t.left-t.width/2,y:e.y-t.top-t.height/2}))),t.addWithUpdate()}else i.points=e;const r=i.points.length-1;return i.controls=i.points.reduce((function(t,e,i){return t[\"p\"+i]=new oi.Control({positionHandler:Ei,actionHandler:bi(i>0?i-1:r,Si),actionName:\"modifyPolygon\",pointIndex:i}),t}),{}),i._setPositionDimensions({}),!0}}extendGet(t){if(\"startPoint\"===t||\"endPoint\"===t){const e=[],i=this._fabricObject;if(i.selectable&&!i.group)for(let t in i.oCoords)e.push({x:i.oCoords[t].x,y:i.oCoords[t].y});else for(let t of i.points){let r=t.x-i.pathOffset.x,n=t.y-i.pathOffset.y;const s=oi.util.transformPoint({x:r,y:n},i.calcTransformMatrix());e.push({x:s.x,y:s.y})}return\"startPoint\"===t?e[0]:e[1]}}updateCoordinateBaseFromImageToView(){const t=this.get(\"startPoint\"),e=this.get(\"endPoint\");this.set(\"startPoint\",{x:this.convertPropFromViewToImage(t.x),y:this.convertPropFromViewToImage(t.y)}),this.set(\"endPoint\",{x:this.convertPropFromViewToImage(e.x),y:this.convertPropFromViewToImage(e.y)})}updateCoordinateBaseFromViewToImage(){const t=this.get(\"startPoint\"),e=this.get(\"endPoint\");this.set(\"startPoint\",{x:this.convertPropFromImageToView(t.x),y:this.convertPropFromImageToView(t.y)}),this.set(\"endPoint\",{x:this.convertPropFromImageToView(e.x),y:this.convertPropFromImageToView(e.y)})}setPosition(t){this.setLine(t)}getPosition(){return this.getLine()}updatePosition(){Xe(this,Ai,\"f\")&&this.setLine(Xe(this,Ai,\"f\"))}setPolygon(){}getPolygon(){return null}setLine(t){if(!E(t))throw new TypeError(\"Invalid 'line'.\");if(this._drawingLayer){if(\"view\"===this.coordinateBase)this.set(\"startPoint\",{x:this.convertPropFromViewToImage(t.startPoint.x),y:this.convertPropFromViewToImage(t.startPoint.y)}),this.set(\"endPoint\",{x:this.convertPropFromViewToImage(t.endPoint.x),y:this.convertPropFromViewToImage(t.endPoint.y)});else{if(\"image\"!==this.coordinateBase)throw new Error(\"Invalid 'coordinateBase'.\");this.set(\"startPoint\",t.startPoint),this.set(\"endPoint\",t.endPoint)}this._drawingLayer.renderAll()}else ze(this,Ai,JSON.parse(JSON.stringify(t)),\"f\")}getLine(){if(this._drawingLayer){if(\"view\"===this.coordinateBase)return{startPoint:{x:this.convertPropFromImageToView(this.get(\"startPoint\").x),y:this.convertPropFromImageToView(this.get(\"startPoint\").y)},endPoint:{x:this.convertPropFromImageToView(this.get(\"endPoint\").x),y:this.convertPropFromImageToView(this.get(\"endPoint\").y)}};if(\"image\"===this.coordinateBase)return{startPoint:this.get(\"startPoint\"),endPoint:this.get(\"endPoint\")};throw new Error(\"Invalid 'coordinateBase'.\")}return Xe(this,Ai,\"f\")?JSON.parse(JSON.stringify(Xe(this,Ai,\"f\"))):null}},QuadDrawingItem:Di,RectDrawingItem:Ci,TextDrawingItem:Oi});const Us=\"undefined\"==typeof self,Vs=\"function\"==typeof importScripts,Gs=(()=>{if(!Vs){if(!Us&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})(),Ws=t=>{if(null==t&&(t=\"./\"),Us||Vs);else{let e=document.createElement(\"a\");e.href=t,t=e.href}return t.endsWith(\"/\")||(t+=\"/\"),t};gt.engineResourcePaths.dbr={version:\"10.4.31\",path:Gs,isInternal:!0},ut.dbr={js:!1,wasm:!0,deps:[\"license\",\"dip\"]},ct.dbr={};const Ys=\"1.4.21\";\"string\"!=typeof gt.engineResourcePaths.std&&O(gt.engineResourcePaths.std.version,Ys)<0&&(gt.engineResourcePaths.std={version:Ys,path:Ws(Gs+`../../dynamsoft-capture-vision-std@${Ys}/dist/`),isInternal:!0});const Hs=\"2.4.31\";(!gt.engineResourcePaths.dip||\"string\"!=typeof gt.engineResourcePaths.dip&&O(gt.engineResourcePaths.dip.version,Hs)<0)&&(gt.engineResourcePaths.dip={version:Hs,path:Ws(Gs+`../../dynamsoft-image-processing@${Hs}/dist/`),isInternal:!0});const Xs={BF_NULL:BigInt(0),BF_ALL:BigInt(\"0xFFFFFFFEFFFFFFFF\"),BF_DEFAULT:BigInt(4265345023),BF_ONED:BigInt(3147775),BF_GS1_DATABAR:BigInt(260096),BF_CODE_39:BigInt(1),BF_CODE_128:BigInt(2),BF_CODE_93:BigInt(4),BF_CODABAR:BigInt(8),BF_ITF:BigInt(16),B
2F_EAN_13:BigInt(32),BF_EAN_8:BigInt(64),BF_UPC_A:BigInt(128),BF_UPC_E:BigInt(256),BF_INDUSTRIAL_25:BigInt(512),BF_CODE_39_EXTENDED:BigInt(1024),BF_GS1_DATABAR_OMNIDIRECTIONAL:BigInt(2048),BF_GS1_DATABAR_TRUNCATED:BigInt(4096),BF_GS1_DATABAR_STACKED:BigInt(8192),BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:BigInt(16384),BF_GS1_DATABAR_EXPANDED:BigInt(32768),BF_GS1_DATABAR_EXPANDED_STACKED:BigInt(65536),BF_GS1_DATABAR_LIMITED:BigInt(131072),BF_PATCHCODE:BigInt(262144),BF_CODE_32:BigInt(16777216),BF_PDF417:BigInt(33554432),BF_QR_CODE:BigInt(67108864),BF_DATAMATRIX:BigInt(134217728),BF_AZTEC:BigInt(268435456),BF_MAXICODE:BigInt(536870912),BF_MICRO_QR:BigInt(1073741824),BF_MICRO_PDF417:BigInt(524288),BF_GS1_COMPOSITE:BigInt(2147483648),BF_MSI_CODE:BigInt(1048576),BF_CODE_11:BigInt(2097152),BF_TWO_DIGIT_ADD_ON:BigInt(4194304),BF_FIVE_DIGIT_ADD_ON:BigInt(8388608),BF_MATRIX_25:BigInt(68719476736),BF_POSTALCODE:BigInt(0x3f0000000000000),BF_NONSTANDARD_BARCODE:BigInt(4294967296),BF_USPSINTELLIGENTMAIL:BigInt(4503599627370496),BF_POSTNET:BigInt(9007199254740992),BF_PLANET:BigInt(0x40000000000000),BF_AUSTRALIANPOST:BigInt(0x80000000000000),BF_RM4SCC:BigInt(72057594037927940),BF_KIX:BigInt(0x200000000000000),BF_DOTCODE:BigInt(8589934592),BF_PHARMACODE_ONE_TRACK:BigInt(17179869184),BF_PHARMACODE_TWO_TRACK:BigInt(34359738368),BF_PHARMACODE:BigInt(51539607552)};var zs,Zs,qs,Ks;!function(t){t[t.EBRT_STANDARD_RESULT=0]=\"EBRT_STANDARD_RESULT\",t[t.EBRT_CANDIDATE_RESULT=1]=\"EBRT_CANDIDATE_RESULT\",t[t.EBRT_PARTIAL_RESULT=2]=\"EBRT_PARTIAL_RESULT\"}(zs||(zs={})),function(t){t[t.QRECL_ERROR_CORRECTION_H=0]=\"QRECL_ERROR_CORRECTION_H\",t[t.QRECL_ERROR_CORRECTION_L=1]=\"QRECL_ERROR_CORRECTION_L\",t[t.QRECL_ERROR_CORRECTION_M=2]=\"QRECL_ERROR_CORRECTION_M\",t[t.QRECL_ERROR_CORRECTION_Q=3]=\"QRECL_ERROR_CORRECTION_Q\"}(Zs||(Zs={})),function(t){t[t.LM_AUTO=1]=\"LM_AUTO\",t[t.LM_CONNECTED_BLOCKS=2]=\"LM_CONNECTED_BLOCKS\",t[t.LM_STATISTICS=4]=\"LM_STATISTICS\",t[t.LM_LINES=8]=\"LM_LINES\",t[t.LM_SCAN_DIRECTLY=16]=\"LM_SCAN_DIRECTLY\",t[t.LM_STATISTICS_MARKS=32]=\"LM_STATISTICS_MARKS\",t[t.LM_STATISTICS_POSTAL_CODE=64]=\"LM_STATISTICS_POSTAL_CODE\",t[t.LM_CENTRE=128]=\"LM_CENTRE\",t[t.LM_ONED_FAST_SCAN=256]=\"LM_ONED_FAST_SCAN\",t[t.LM_REV=-2147483648]=\"LM_REV\",t[t.LM_SKIP=0]=\"LM_SKIP\"}(qs||(qs={})),function(t){t[t.DM_DIRECT_BINARIZATION=1]=\"DM_DIRECT_BINARIZATION\",t[t.DM_THRESHOLD_BINARIZATION=2]=\"DM_THRESHOLD_BINARIZATION\",t[t.DM_GRAY_EQUALIZATION=4]=\"DM_GRAY_EQUALIZATION\",t[t.DM_SMOOTHING=8]=\"DM_SMOOTHING\",t[t.DM_MORPHING=16]=\"DM_MORPHING\",t[t.DM_DEEP_ANALYSIS=32]=\"DM_DEEP_ANALYSIS\",t[t.DM_SHARPENING=64]=\"DM_SHARPENING\",t[t.DM_BASED_ON_LOC_BIN=128]=\"DM_BASED_ON_LOC_BIN\",t[t.DM_SHARPENING_SMOOTHING=256]=\"DM_SHARPENING_SMOOTHING\",t[t.DM_REV=-2147483648]=\"DM_REV\",t[t.DM_SKIP=0]=\"DM_SKIP\"}(Ks||(Ks={}));var Js=Object.freeze({__proto__:null,BarcodeReaderModule:class{static getVersion(){const t=lt.dbr&&lt.dbr.wasm;return`10.4.31(Worker: ${lt.dbr&&lt.dbr.worker||\"Not Loaded\"}, Wasm: ${t||\"Not Loaded\"})`}},EnumBarcodeFormat:Xs,get EnumDeblurMode(){return Ks},get EnumExtendedBarcodeResultType(){return zs},get EnumLocalizationMode(){return qs},get EnumQRCodeErrorCorrectionLevel(){return Zs}});const Qs=async t=>{let e;await new Promise(((i,r)=>{e=new Image,e.onload=()=>i(e),e.onerror=r,e.src=URL.createObjectURL(t)}));const i=document.createElement(\"canvas\"),r=i.getContext(\"2d\");return i.width=e.width,i.height=e.height,r.drawImage(e,0,0),{bytes:Uint8Array.from(r.getImageData(0,0,i.width,i.height).data),width:i.width,height:i.height,stride:4*i.width,format:10}};const $s=\"undefined\"==typeof self,to=\"function\"==typeof importScripts,eo=(()=>{if(!to){if(!$s&&document.currentScript){let t=document.currentScript.src,e=t.indexOf(\"?\");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf(\"#\");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf(\"/\")+1)}return\"./\"}})(),io=t=>{if(null==t&&(t=\"./\"),$s||to);else{let e=document.createElement(\"a\");e.href=t,t=e.href}return t.endsWith(\"/\")||(t+=\"/\"),t};gt.engineResourcePaths.utility={version:\"1.4.32\",path:eo,isInternal:!0},ut.utility={js:!0,wasm:!0};const ro=\"1.4.21\";\"string\"!=typeof gt.engineResourcePaths.std&&O(gt.engineResourcePaths.std.version,ro)<0&&(gt.engineResourcePaths.std={version:ro,path:io(eo+`../../dynamsoft-capture-vision-std@${ro}/dist/`),isInternal:!0});const no=\"2.4.31\";(!gt.engineResourcePaths.dip||\"string\"!=typeof gt.engineResourcePaths.dip&&O(gt.engineResourcePaths.dip.version,no)<0)&&(gt.engineResourcePaths.dip={version:no,path:io(eo+`../../dynamsoft-image-processing@${no}/dist/`),isInternal:!0});function so(t,e,i,r){if(\"a\"===i&&!r)throw new TypeError(\"Private accessor was defined without a getter\");if(\"function\"==typeof e?t!==e||!r:!e.has(t))throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");return\"m\"===i?r:\"a\"===i?r.call(t):r?r.value:e.get(t)}var oo,ao,ho,lo,co;function uo(t,e){let i=!0;for(let o=0;o<t.length;o++){const a=(o+1)%t.length;if(r=t[o],s=e,((n=t[a]).x-r.x)*(s.y-r.y)-(n.y-r.y)*(s.x-r.x)<0){i=!1;break}}var r,n,s;return i}function fo(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function go(t,e){const[i,r]=t,n=i.x,s=i.y,o=r.x,a=r.y,h=e.x,l=e.y,c=(o-n)**2+(a-s)**2;if(0===c)return Math.sqrt((h-n)**2+(l-s)**2);const u=((h-n)*(o-n)+(l-s)*(a-s))/c;if(u<0)return Math.sqrt((h-n)**2+(l-s)**2);if(u>1)return Math.sqrt((h-o)**2+(l-a)**2);{const t=n+u*(o-n),e=s+u*(a-s);return Math.sqrt((h-t)**2+(l-e)**2)}}function mo(t){const e=[];for(let i=0;i<t.length;i++){const r=t[i],n=t[(i+1)%t.length];e.push([r,n])}return e}function po(t){const[e,i]=t;return{x:(e.x+i.x)/2,y:(e.y+i.y)/2}}
vendor: 4,335 bytes, line 2
2function _o(t,e,i,r){const n=e.x-t.x,s=e.y-t.y,o=r.x-i.x,a=r.y-i.y,h=(-s*(t.x-i.x)+n*(t.y-i.y))/(-o*s+n*a),l=(o*(t.y-i.y)-a*(t.x-i.x))/(-o*s+n*a);return h>=0&&h<=1&&l>=0&&l<=1?{x:t.x+l*n,y:t.y+l*s}:null}function vo(t){let e=0;for(let i=0;i<t.length;i++){const r=(i+1)%t.length;e+=t[i].x*t[r].y,e-=t[r].x*t[i].y}return Math.abs(e/2)}function yo(t,e,i){let r=e.x-t.x,n=e.y-t.y,s=i.x-t.x;return r*(i.y-t.y)-n*s>0}function wo(t,e){for(let i=0;i<4;i++)if(!yo(t.points[i],t.points[(i+1)%4],e))return!1;return!0}\"function\"==typeof SuppressedError&&SuppressedError;function Co(t,e,i,r){const n=t.points,s=e.points;let o=8*i;o=Math.max(o,5);const a=mo(n)[3],h=mo(n)[1],l=mo(s)[3],c=mo(s)[1];let u,d=0;if(u=Math.max(Math.abs(go(a,e.points[0])),Math.abs(go(a,e.points[3]))),u>d&&(d=u),u=Math.max(Math.abs(go(h,e.points[1])),Math.abs(go(h,e.points[2]))),u>d&&(d=u),u=Math.max(Math.abs(go(l,t.points[0])),Math.abs(go(l,t.points[3]))),u>d&&(d=u),u=Math.max(Math.abs(go(c,t.points[1])),Math.abs(go(c,t.points[2]))),u>d&&(d=u),d>o)return!1;const f=po(mo(n)[0]),g=po(mo(n)[2]),m=po(mo(s)[0]),p=po(mo(s)[2]),_=fo(f,p),v=fo(m,g),y=_>v,w=Math.min(_,v),C=fo(f,g),E=fo(m,p);let T=12*i;return T=Math.max(T,5),T=Math.min(T,C),T=Math.min(T,E),!!(w<T||uo(n,y?m:p)||uo(s,y?g:f))&&(y?(r.points[0]=t.points[0],r.points[1]=t.points[1],r.points[2]=e.points[2],r.points[3]=e.points[3]):(r.points[0]=e.points[0],r.points[1]=e.points[1],r.points[2]=t.points[2],r.points[3]=t.points[3]),r.area=vo(r.points),!0)}class Eo{constructor(t,e,i,r){this.overlapCount=t,this.verificationCount=e,this.crossVerificationFrame=5,this.location=r.location,this.locationArea=r.location.area,this.locationAngle=r.angle,this.format=r.format,this.text=r.text,this.isOneD=i,this.item=r,this.locationThreshold=5*r.moduleSize,this.strictLimit=Math.max(this.locationThreshold,1),this.strictLimit=Math.min(this.strictLimit,15)}getCenterPoint(t){const e={x:0,y:0};return t.forEach((({x:t,y:i})=>{e.x+=t,e.y+=i})),e.x/=t.length,e.y/=t.length,e}isProbablySameLocationWithOffset(t,e){const i=this.item.location,r=t.location;if(i.area<=0)return!1;if(Math.abs(i.area-r.area)>.4*i.area)return!1;let n=new Array(4).fill(0),s=new Array(4).fill(0),o=0,a=0;for(let t=0;t<4;++t)n[t]=Math.round(100*(r.points[t].x-i.points[t].x))/100,o+=n[t],s[t]=Math.round(100*(r.points[t].y-i.points[t].y))/100,a+=s[t];o/=4,a/=4;for(let t=0;t<4;++t){if(Math.abs(n[t]-o)>this.strictLimit||Math.abs(o)>.8)return!1;if(Math.abs(s[t]-a)>this.strictLimit||Math.abs(a)>.8)return!1}return e.x=o,e.y=a,!0}isLocationOverlap(t,e){if(this.locationArea>e){for(let e=0;e<4;e++)if(wo(this.location,t.points[e]))return!0;const e=this.getCenterPoint(t.points);if(wo(this.location,e))return!0}else{for(let e=0;e<4;e++)if(wo(t,this.location.points[e]))return!0;if(wo(t,this.getCenterPoint(this.location.points)))return!0}return!1}isMatchedLocationWithOffset(t,e={x:0,y:0}){if(this.isOneD){const i=Object.assign({},t.location);for(let t=0;t<4;t++)i.points[t].x-=e.x,i.points[t].y-=e.y;if(!this.isLocationOverlap(i,t.locationArea))return!1;const r=[this.location.points[0],this.location.points[3]],n=[this.location.points[1],this.location.points[2]];for(let t=0;t<4;t++){const e=i.points[t],s=0===t||3===t?r:n;if(Math.abs(go(s,e))>this.locationThreshold)return!1}}else for(let i=0;i<4;i++){const r=t.location.points[i],n=this.location.points[i];if(!(Math.abs(n.x+e.x-r.x)<this.locationThreshold))return!1;if(Math.abs(n.y+e.y-r.y)>=this.locationThreshold)return!1}return!0}isOverlappedLocationWithOffset(t,e,i=!0){const r=Object.assign({},t.location);for(let t=0;t<4;t++)r.points[t].x-=e.x,r.points[t].y-=e.y;if(!this.isLocationOverlap(r,t.location.area))return!1;if(i){const t=.75;return function(t,e){const i=[];for(let r=0;r<4;r++)for(let n=0;n<4;n++){const s=_o(t[r],t[(r+1)%4],e[n],e[(n+1)%4]);s&&i.push(s)}return t.forEach((t=>{uo(e,t)&&i.push(t)})),e.forEach((e=>{uo(t,e)&&i.push(e)})),vo(function(t){if(t.length<=1)return t;t.sort(((t,e)=>t.x-e.x||t.y-e.y));const e=t.shift();return t.sort(((t,i)=>Math.atan2(t.y-e.y,t.x-e.x)-Math.atan2(i.y-e.y,i.x-e.x))),[e,...t]}(i))}([...this.location.points],r.points)>this.locationArea*t}return!0}}const To={BF_ONED:BigInt(3147775),BF_GS1_DATABAR:BigInt(260096)},So={barcode:2,text_line:4,detected_quad:8,normalized_image:16},bo=t=>Object.values(So).includes(t)||So.hasOwnProperty(t),Io=(t,e)=>
2\"string\"==typeof t?e[So[t]]:e[t],xo=(t,e,i)=>{\"string\"==typeof t?e[So[t]]=i:e[t]=i},Oo=(t,e,i)=>{const r=[8,16].includes(i);if(!r&&t.isResultCrossVerificationEnabled(i))for(let t=0;t<e.length;t++)e[t]&&e[t].type===i&&!e[t].verified&&(e[t].isFilter=!0);if(!r&&t.isResultDeduplicationEnabled(i))for(let t=0;t<e.length;t++)e[t]&&e[t].type===i&&e[t].duplicate&&(e[t].isFilter=!0)};oo=new WeakMap,ao=new WeakMap,ho=new WeakMap,lo=new WeakMap,co=new WeakMap;var Ao=Object.freeze({__proto__:null,ImageManager:class{async saveToFile(t,e,i){if(!t||!e)return null;if(\"string\"!=typeof e)throw new TypeError(\"FileName must be of type string.\");const r=M(t);return R(r,e,i)}async drawOnImage(t,e,i,r=4294901760,n=1,s){let o;if(t instanceof Blob)o=await Qs(t);else if(\"string\"==typeof t){let e=await x(t,\"blob\");o=await Qs(e)}return await new Promise(((t,a)=>{let h=rt();nt[h]=async e=>{if(e.success)return s&&this.saveToFile(e.image,\"test.png\",s),t(e.image);{let t=new Error(e.message);return t.stack=e.stack+\"\\n\"+t.stack,a(t)}},et.postMessage({type:\"utility_drawOnImage\",id:h,body:{dsImage:o,drawingItem:e instanceof Array?e:[e],color:r,thickness:n,type:i}})}))}},MultiFrameResultCrossFilter:class{constructor(){this.verificationEnabled={[mt.CRIT_BARCODE]:!1,[mt.CRIT_TEXT_LINE]:!0,[mt.CRIT_DETECTED_QUAD]:!0,[mt.CRIT_NORMALIZED_IMAGE]:!1},this.duplicateFilterEnabled={[mt.CRIT_BARCODE]:!1,[mt.CRIT_TEXT_LINE]:!1,[mt.CRIT_DETECTED_QUAD]:!1,[mt.CRIT_NORMALIZED_IMAGE]:!1},this.duplicateForgetTime={[mt.CRIT_BARCODE]:3e3,[mt.CRIT_TEXT_LINE]:3e3,[mt.CRIT_DETECTED_QUAD]:3e3,[mt.CRIT_NORMALIZED_IMAGE]:3e3},this.latestOverlappingEnabled={[mt.CRIT_BARCODE]:!1,[mt.CRIT_TEXT_LINE]:!1,[mt.CRIT_DETECTED_QUAD]:!1,[mt.CRIT_NORMALIZED_IMAGE]:!1},this.maxOverlappingFrames={[mt.CRIT_BARCODE]:5,[mt.CRIT_TEXT_LINE]:5,[mt.CRIT_DETECTED_QUAD]:5,[mt.CRIT_NORMALIZED_IMAGE]:5},this.overlapSet=[],this.stabilityCount=0,this.crossVerificationFrames=5,oo.set(this,new Map),ao.set(this,new Map),ho.set(this,new Map),lo.set(this,new Map),co.set(this,new Map)}_dynamsoft(){so(this,oo,\"f\").forEach(((t,e)=>{xo(e,this.verificationEnabled,t)})),so(this,ao,\"f\").forEach(((t,e)=>{xo(e,this.duplicateFilterEnabled,t)})),so(this,ho,\"f\").forEach(((t,e)=>{xo(e,this.duplicateForgetTime,t)})),so(this,lo,\"f\").forEach(((t,e)=>{xo(e,this.latestOverlappingEnabled,t)})),so(this,co,\"f\").forEach(((t,e)=>{xo(e,this.maxOverlappingFrames,t)}))}enableResultCrossVerification(t,e){bo(t)&&so(this,oo,\"f\").set(t,e)}isResultCrossVerificationEnabled(t){return!!bo(t)&&Io(t,this.verificationEnabled)}enableResultDeduplication(t,e){bo(t)&&(e&&this.enableLatestOverlapping(t,!1),so(this,ao,\"f\").set(t,e))}isResultDeduplicationEnabled(t){return!!bo(t)&&Io(t,this.duplicateFilterEnabled)}setDuplicateForgetTime(t,e){bo(t)&&(e>18e4&&(e=18e4),e<0&&(e=0),so(this,ho,\"f\").set(t,e))}getDuplicateForgetTime(t){return bo(t)?Io(t,this.duplicateForgetTime):-1}setMaxOverlappingFrames(t,e){bo(t)&&so(this,co,\"f\").set(t,e)}getMaxOverlappingFrames(t){return bo(t)?Io(t,this.maxOverlappingFrames):-1}enableLatestOverlapping(t,e){bo(t)&&(e&&this.enableResultDeduplication(t,!1),so(this,lo,\"f\").set(t,e))}isLatestOverlappingEnabled(t){return!!bo(t)&&Io(t,this.latestOverlappingEnabled)}getFilteredResultItemTypes(){let t=0;const e=[mt.CRIT_BARCODE,mt.CRIT_TEXT_LINE,mt.CRIT_DETECTED_QUAD,mt.CRIT_NORMALIZED_IMAGE];for(let i=0;i<e.length;i++)(this.verificationEnabled[e[i]]||this.duplicateFilterEnabled[e[i]])&&(t|=e[i]);return t}onOriginalImageResultReceived(t){}latestOverlappingFilter(t){var e,i,r;const n=this.isResultCrossVerificationEnabled(mt.CRIT_BARCODE),s=this.isLatestOverlappingEnabled(mt.CRIT_BARCODE);if(s){const o=5,a=60,h=s?this.getMaxOverlappingFrames(mt.CRIT_BARCODE):5,l=t.items.length,c=null===(r=null===(i=null===(e=null==t?void 0:t.intermediateResult)||void 0===e?void 0:e[0])||void 0===i?void 0:i.intermediateResultUnits)||void 0===r?void 0:r[1].localizedBarcodes,u=c?c.length:0;let d=[];const f=[],g={x:0,y:0};let m=new Array(l).fill(-1),p=0;const _=t.items.map((t=>{if(1!==t.type){const e=(BigInt(t.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(t.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0);return new Eo(h,e?1:2,e,t)}}
vendor: 5,010 bytes, line 2
2)).filter(Boolean);if(this.overlapSet.length>0){const t=new Array(l).fill(new Array(this.overlapSet.length).fill(1));let e=0;for(;e<l;){const i={x:0,y:0},r=new Array(l).fill(-1);let n=!1;for(;e<l;e++){if(!_[e])continue;const s=_[e].item;for(let o=0;o<this.overlapSet.length;o++){if(t[e][o]<1)continue;const a=this.overlapSet[o],h=a.item;if(s.format===h.format&&s.text===h.text){if(n=a.isProbablySameLocationWithOffset(_[e],i),n){r[e]=o,t[e][o]=0;break}}else t[e][o]=0}if(n)break}if(n){for(let n=0;n<l;n++){if(n===e||!_[n])continue;const s=_[n].item;for(let e=0;e<this.overlapSet.length;e++){if(t[n][e]<1)continue;if(r.includes(e))continue;const o=this.overlapSet[e],a=o.item;if(s.format===a.format&&s.text===a.text){if(o.isMatchedLocationWithOffset(_[n],i)){r[n]=e,t[n][e]=0;break}}else t[n][e]=0}}const n=r.filter((t=>-1!==t)).length;n>p&&(p=n,m=r,g.x=i.x,g.y=i.y)}}if(0===p){for(let e=0;e<l;e++){const i=_[e].item;for(let r=0;r<this.overlapSet.length;r++){if(t[e][r]<1)continue;if(m.includes(r))continue;const n=this.overlapSet[r],s=n.item;if(i.format===s.format&&i.text===s.text){if(n.isMatchedLocationWithOffset(_[e])){m[e]=r,t[e][r]=0;break}}else t[e][r]=0}}p+=m.filter((t=>-1!=t)).length}let i=this.overlapSet.length<=3?p>=1:p>=2;if(!i&&s&&u>0){let t=0;for(let e=0;e<this.overlapSet.length;e++){const i=this.overlapSet[e];for(let e=0;e<u;e++)if(i.isOverlappedLocationWithOffset(c[e],g)){t++;break}}i=this.overlapSet.length<=3?t>=1:t>=3}i||(this.overlapSet=[])}if(0===this.overlapSet.length)this.stabilityCount=0,t.items.forEach(((t,e)=>{if(1!==t.type){const i=Object.assign({},t),r=(BigInt(t.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(t.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0),s=t.confidence<a,o=new Eo(h,r?1:2,r,i);n&&r&&s&&f.push(e),this.overlapSet.push(o)}}));else{let e=!0;s?(Math.abs(g.x)>5||Math.abs(g.y)>5)&&(e=!1):e=!1;for(let i=0;i<t.items.length;i++){const t=m[i];if(t<0&&_[i]){const t=_[i].item;let r={points:[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],area:0};for(let i=0;i<4;i++)r.points[i].x=e?t.location.points[i].x-g.x:t.location.points[i].x,r.points[i].y=e?t.location.points[i].y-g.y:t.location.points[i].y;for(let n=0;n<this.overlapSet.length;n++){if(m.includes(n))continue;const s=this.overlapSet[n].item.text,o=this.overlapSet[n].item.format;if(t.format===o&&t.text===s){if(this.overlapSet[n].isOverlappedLocationWithOffset(t,g,!1)){const e=Object.assign({},t),r=(BigInt(e.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(e.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0),s=r?1:2;this.overlapSet[n]=new Eo(h,s,r,e),m[i]=n;break}if(_[i].isOneD){let s={points:[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],area:0};for(let t=0;t<4;t++)s.points[t].x=e?this.overlapSet[n].location.points[t].x:this.overlapSet[n].location.points[t].x+g.x,s.points[t].y=e?this.overlapSet[n].location.points[t].y:this.overlapSet[n].location.points[t].y+g.y;let o={points:[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],area:0};if(Co(r,s,t.moduleSize,o)){t.location=o;const e=Object.assign({},t),r=(BigInt(e.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(e.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0),s=r?1:2;this.overlapSet[n]=new Eo(h,s,r,e),m[i]=n;break}}}}}else{if(e)_[i]&&(_[i].item.location=this.overlapSet[t].location);else{const e=Object.assign({},_[i].item),r=(BigInt(e.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(e.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0),n=r?1:2;this.overlapSet[t]=new Eo(h,n,r,e)}this.overlapSet[t]&&(this.overlapSet[t].overlapCount=h,this.overlapSet[t].verificationCount=2,this.overlapSet[t].crossVerificationFrame=o)}}e?this.stabilityCount<15&&this.stabilityCount++:this.stabilityCount=0;let i=!0;for(let t=0;t<this.overlapSet.length;t++){if(m.includes(t))continue;const r=this.overlapSet[t];r.overlapCount--,r.crossVerificationFrame--;const n=r.overlapCount+this.stabilityCount;if(s&&n>0){for(let t=0;t<l;t++)if(r.isOverlappedLocationWithOffset(_[t],g,!1)){i=!1;break}if(!i)break;const t=r.item;if(!e){for(let t=0;t<4;t++)r.location.points[t].x+=g.x,r.location.points[t].y+=g.y;t.location=r.location}2===r.verificationCount&&d.push(t)}}if(s&&!i){d=[];for(let t=0;t<this.overlapSet.length;t++){if(m.includes(t))continue;const e=this.overlapSet[t];e.overlapCount=0-this.stabilityCount,e.crossVerificationFrame=0,e.verificationCount=0}}for(let t=0;t<l;t++){if(-1!==m[t]||!_[t])continue;const i=_[t].item;if(e){for(let e=0;e<4;e++)_[t].location.points[e].x-=g.x,_[t].location.points[e].y-=g.y;i.location=_[t].location}let r=!1;for(let e of this.overlapSet)if(!(e.crossVerificationFrame<=0&&e.verificationCount<=0)&&(r=e.isLocationOverlap(_[t].location,_[t].locationArea),r))break;if(r){f.push(t);continue}const s=Object.assign({},i),o=(BigInt(i.format)&BigInt(To.BF_ONED))!=BigInt(0)||(BigInt(i.format)&BigInt(To.BF_GS1_DATABAR))!=BigInt(0),l=i.confidence<a,c=new Eo(h,o?1:2,o,s);n&&o&&l?f.push(t):c.verificationCount=2,this.overlapSet.push(c)}this.overlapSet=this.overlapSet.filter((t=>!(t.overlapCount+this.stabilityCount<=0&&t.crossVerificationFrame<=0)))}f.sort(((t,e)=>
2e-t)).forEach(((e,i)=>{t.items.splice(e,1)})),d.forEach((e=>{t.items.push(Object.assign(Object.assign({},e),{overlapped:!0}))}))}}onDecodedBarcodesReceived(t){this.latestOverlappingFilter(t),Oo(this,t.items,mt.CRIT_BARCODE)}onRecognizedTextLinesReceived(t){Oo(this,t.items,mt.CRIT_TEXT_LINE)}onDetectedQuadsReceived(t){Oo(this,t.items,mt.CRIT_DETECTED_QUAD)}onNormalizedImagesReceived(t){Oo(this,t.items,mt.CRIT_NORMALIZED_IMAGE)}},UtilityModule:class{static getVersion(){return`1.4.32(Worker: ${lt.utility&&lt.utility.worker||\"Not Loaded\"}, Wasm: ${lt.utility&&lt.utility.wasm||\"Not Loaded\"})`}}});le._defaultTemplate=\"ReadSingleBarcode\",t.CVR=ge,t.Core=xt,t.DBR=Js,t.DCE=js,t.License=Be,t.Utility=Ao}));","Idus_Search/js/idusBarcodeScannerDataLayer.js":"define([], function () {\n    'use strict';\n\n    const EVENT_NAME = 'barcode_scan';\n\n    window.idusDataLayer = window.idusDataLayer || [];\n\n    const sendEvent = (data) => {\n        if (!data) return false;\n\n        return window.idusDataLayer.push({\n            customEvent: EVENT_NAME,\n            customData: data\n        });\n    }\n\n    const barcodeScannerDataLayer = {\n        sendEvent: (data) => sendEvent(data),\n    }\n\n    return barcodeScannerDataLayer;\n});","Idus_Search/js/idus_barcode_scanner.js":"define([\"dynamsoft\", 'Idus_Search/js/idusBarcodeScannerDataLayer'], function (Dynamsoft, barcodeScannerDataLayer) {\n  \"use strict\";\n\n  // Validate that Dynamsoft is loaded before proceeding\n  if (typeof Dynamsoft === \"undefined\" || !Dynamsoft.Core) {\n    console.warn(\"Dynamsoft library is missing. Disabling barcode scanner.\");\n    document.querySelector(\".idus_barcode_scanner\").style.display = \"none\";\n    return function () { };\n  }\n\n  var config,\n    cvRouter,\n    cameraEnhancer,\n    barcodeScannerIsRunning = false,\n    barcodeScannerElement,\n    barcodeScannerInput,\n    barcodeScannerContainer,\n    barcodeScannerKeyboardButton,\n    barcodeScannerKeyboardSearchError,\n    barcodeScannerCameraButtons,\n    barcodeScannerCloseButton,\n    barcodeScannerKeyboardSearchBtn,\n    enhancerUIContainer,\n    barcodeScannerKeyboardInput;\n\n  return function () {\n\n    // Get args & obj\n    config = arguments[0];\n    barcodeScannerElement = arguments[1];\n    barcodeScannerInput = document.querySelector(config.input);\n\n    barcodeScannerCameraButtons = barcodeScannerElement.querySelectorAll(\n      \".idus_barcode_scanner_camera_button\"\n    );\n    barcodeScannerKeyboardButton = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner_keyboard_button\"\n    );\n    barcodeScannerKeyboardInput = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner_keyboard_input\"\n    );\n    barcodeScannerKeyboardSearchBtn = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner_keyboard_search_btn\"\n    );\n    barcodeScannerKeyboardSearchError = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner_keyboard_error\"\n    );\n    barcodeScannerContainer = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner_container\"\n    );\n    barcodeScannerCloseButton = barcodeScannerElement.querySelector(\n      \".idus_barcode_scanner.close\"\n    );\n\n    //Dynamsoft\n    enhancerUIContainer = barcodeScannerElement.querySelector(\n      \"#enhancerUIContainer\"\n    );\n\n    (async function () {\n      try {\n\n        async function createInstance() {\n          if (cvRouter && cameraEnhancer) return true;\n\n          try {\n\n            // Check if required modules are available before initializing\n            if (!Dynamsoft.License || !Dynamsoft.Core || !Dynamsoft.DCE || !Dynamsoft.CVR || !Dynamsoft.DBR) {\n              console.warn(\"One or more Dynamsoft modules are missing. Disabling barcode scanner.\");\n              document.querySelector(\".idus_barcode_scanner\").style.display = \"none\";\n              return false;\n            }\n\n            Dynamsoft.Core.CoreModule.engineResourcePaths = {\n              std: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n              dip: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n              core: \"https://cdn.jsdelivr.net/npm/[email protected]
2/dist/\",\n              license: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n              cvr: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n              dbr: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n              dce: \"https://cdn.jsdelivr.net/npm/[email protected]/dist/\",\n            };\n\n            Dynamsoft.License.LicenseManager.initLicense(config.license);\n            Dynamsoft.Core.CoreModule.loadWasm([\"dbr\"]);\n\n            // Create a `CameraEnhancer` instance for camera control and a `CameraView` instance for UI control.\n            cvRouter =\n              await Dynamsoft.CVR.CaptureVisionRouter.createInstance();\n            const cameraView = await Dynamsoft.DCE.CameraView.createInstance(\n              enhancerUIContainer\n            );\n\n            // Setting\n            cameraView.setVideoFit(\"cover\");\n\n            cameraEnhancer =\n              await Dynamsoft.DCE.CameraEnhancer.createInstance(cameraView);\n\n            // Create a `CaptureVisionRouter` instance and set `CameraEnhancer` instance as its image source.\n            cvRouter.setInput(cameraEnhancer);\n\n            let settings = await cvRouter.getSimplifiedSettings(\n              \"ReadSingleBarcode\"\n            );\n            // Enable 1D barcodes only\n            settings.barcodeSettings.barcodeFormatIds =\n              Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED;\n            await cvRouter.updateSettings(\"ReadSingleBarcode\", settings);\n\n            // Define a callback for results.\n            cvRouter.addResultReceiver({\n              onDecodedBarcodesReceived: (result) => {\n                if (!result.barcodeResultItems.length) return;\n\n                let eventJson = {\n                  clickType: 'search',\n                  type: 'camera',\n                  search_term: result.barcodeResultItems[0].text,\n                  status: 'error'\n                };\n\n                if (result.barcodeResultItems[0].formatString === \"EAN_13\") {\n                  barcodeFound(result.barcodeResultItems[0].text);\n                  cameraEnhancer.close();\n                  barcodeScannerElement.classList.remove(\"open\");\n\n                  eventJson.status = 'success';\n                }\n\n                barcodeScannerDataLayer.sendEvent(eventJson);\n              },\n            });\n\n            // Filter out unchecked and duplicate results.\n            const filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();\n            filter.enableResultCrossVerification(\"barcode\", true);\n            filter.enableResultDeduplication(\"barcode\", true);\n            await cvRouter.addResultFilter(filter);\n\n            // Check if Dynamsoft modules are available\n            if (!Dynamsoft.CVR || !Dynamsoft.DCE) {\n              console.warn(\"Dynamsoft Camera or Router module missing. Skipping barcode scanner initialization.\");\n              return false;\n            }\n\n            return true;\n\n          } catch (ex) {\n            console.error(\"Failed to create Dynamsoft instances:\", ex);\n            document.querySelector(\".idus_barcode_scanner\").style.display = \"none\";\n            return false;\n          }\n        }\n\n        // Start/stop scanner function\n        function stopBarcodeScanner() {\n          barcodeScannerKeyboardInput.classList.remove(\"active\");\n          barcodeScannerKeyboardButton.classList.remove(\"active\");\n          barcodeScannerContainer.classList.remove(\"camera_active\");\n          barcodeScannerCameraButtons.forEach((el) =>\n            el.classList.remove(\"active\")\n          );\n          barcodeScannerIsRunning = false;\n          cameraEnhancer.close();\n        }\n\n        barcodeScannerCameraButtons.forEach((el) => {\n          barcodeScannerCloseButton.addEventListener(\"click\", function () {\n            barcodeScannerElement.classList.remove(\"open\");\n            stopBarcodeScanner();\n          });\n\n          // Start/stop scanner\n          el.addEventListener(\"click\", function () {\n            barcodeScannerKeyboardSearchError.style.display = \"none\";\n\n            if (barcodeScannerIsRunning) {\n              if (!barcodeScannerElement.classList.contains(\"open\")) {\n                stopBarcodeScanner();\n              }\n            } else {\n              barcodeScannerDataLayer.sendEvent({ clickType: 'click', type: el.dataset.type });\n              barcodeScannerKeyboardInput.classList.remove(\"active\");\n              barcodeScannerKeyboardButton.classList.remove(\"active\");\n              barcodeScannerContainer.classList.add(\"camera_active\");\n              barcodeScannerCameraButtons.forEach((el) =>\n                el.classList.add(\"active\")\n              );\n              startScanner();\n            }\n          });\n        });\n\n        barcodeScannerKeyboardButton.addEventListener(\"click\", function () {\n          barcodeScannerKeyboardSearchError.style.display = \"none\";\n\n          barcodeScannerCameraButtons.forEach((el) => el.classList.toggle(\"active\", false));\n\n          if (barcodeScannerIsRunning) {\n            stopBarcodeScanner();\n\n            if (!barcodeScannerKeyboardInput.classList.contains(\"active\")) {\n              barcodeScannerDataLayer.sendEvent({ clickType: 'option_choose', type: 'keyboard' });\n              barcodeScannerKeyboardInput.classList.add(\"active\");\n              barcodeScannerKeyboardButton.classList.add(\"active\");\n            } else {\n              barcodeScannerKeyboardInput.classList.remove(\"active\");\n              barcodeScannerKeyboardButton.classList.remove(\"active\");\n            }\n          }\n        });\n\n        barcodeScannerKeyboardSearchBtn.addEventListener(\n          \"click\",\n          function () {\n            let result = barcodeScannerKeyboardInput.value;
2\n\n            let eventJson = {\n              clickType: 'search',\n              type: 'keyboard',\n              search_term: result,\n              status: 'error'\n            }\n\n            if (result && result.slice(0, 3) == \"729\") {\n              barcodeFound(result);\n              stopBarcodeScanner();\n              barcodeScannerElement.classList.remove(\"open\");\n              barcodeScannerKeyboardInput.value = \"\";\n              eventJson.status = 'success';\n            } else {\n              barcodeScannerKeyboardSearchError.style.display = \"flex\";\n            }\n\n            barcodeScannerDataLayer.sendEvent(eventJson);\n          }\n        );\n\n        function barcodeFound(result) {\n          barcodeScannerIsRunning = false;\n          barcodeScannerInput.value = result;\n          barcodeScannerInput.dispatchEvent(new Event(\"keyup\"));\n        }\n\n        async function startScanner() {\n          if (!cvRouter || !cameraEnhancer) {\n            let instanceCreatead = await createInstance();\n            if (!instanceCreatead) return false;\n          }\n\n          await cameraEnhancer.open();\n          document.dispatchEvent(new Event(\"barcodeScannerOpen\"));\n          \n          await cvRouter.startCapturing(\"ReadSingleBarcode\");\n\n          barcodeScannerIsRunning = true;\n          barcodeScannerElement.classList.add(\"open\");\n        }\n      } catch (ex) {\n        console.warn(\"Barcode scanner initialization failed:\", ex);\n        document.querySelector(\".idus_barcode_scanner\").style.display = \"none\";\n      }\n    })();\n  };\n});","Idus_Shipping/js/free_shipping.js":"define([\n\t'jquery',\n\t'Idus_Core/js/idus'\n\t], function ($,idus) {\n\t\t'use strict';\n\n\t\tfunction deltaUntilFreeShipping(){\n\t\t\tvar checkout_data = idus.getLocalStorage('checkout_data', 1);\n\n\t\t\tvar total = checkout_data.subtotal_with_discount;\n\t\t\tif(total > checkout_data.subtotal) total = checkout_data.subtotal;\n\t\t\t\n\t\t\tif(checkout_data && total != undefined){\n\t\t\t\tvar delta = '';\n\t\t\t\tvar action = 'over';\n\t\t\t\tvar delta_until_from = $('.delta_until_free_shipping[data-from]');\n\t\t\t\tvar delta_until = $('.delta_until_free_shipping');\n\t\t\t\tvar from = delta_until_from.attr('data-from');\n\t\t\t\tif(total < from){\n\t\t\t\t\tdelta = Math.floor((from - total) * 100) / 100;\n\t\t\t\t\tdelta = delta + window.checkout['currency'];\n\t\t\t\t\taction = 'under';\n\t\t\t\t}\n\n\t\t\t\tdelta_until.each(function(){\n\t\t\t\t\tvar text = $(this).attr('text-'+action);\n\t\t\t\t\tif(text != undefined)\n\t\t\t\t\t\t$('span',$(this)).html(text.replace('%1', delta));\n\t\t\t\t});\n\n\t\t\t\tif (action === 'over') {\n\n\t\t\t\t\t$('body').addClass('has_free_shipping');\n\t\t\t\t} else {\n\t\t\t\t\t$('body').removeClass('has_free_shipping');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdeltaUntilFreeShipping();\n\n\t\tif($('#checkout').length){\n\t\t\t$('#checkout').on('contentUpdated',function(){\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tdeltaUntilFreeShipping();\n\t\t\t\t},1);\n\t\t\t});\n\t\t}\n\n\t\t$('[data-block=\\'minicart\\']').on('contentUpdated',function(){\n\t\t\tsetTimeout(function(){\n\t\t\t\tdeltaUntilFreeShipping();\n\t\t\t},1);\n\t\t});\n\t}\n);\n","Idus_Shipping/js/progress_bar.js":"define([\n\t'jquery',\n\t'Idus_Core/js/idus'\n\t], function ($,idus) {\n\t\t'use strict';\n\n\t\tlet updateProgressBar = () => {\n\n\t\t\t// cart data\n\t\t\tlet checkout_data = idus.getLocalStorage('checkout_data', 1);\n\t\t\tlet total = checkout_data.subtotal;\n\n\t\t\t$('.delta_until_free_shipping').each(function(){\n\t\t\t\tlet obj = $(this);\n\t\t\t\tlet progressBar = $('.progress_bar',obj);\n\t\t\t\tlet from = obj.attr('data-from');\n\t\t\t\tlet endValue = Math.round(((total/from)*100));\n\t\t\t\tlet progressBarSpeed = progressBar.attr(\"data-speed\");\n\t\t\t\tlet progressBarColor = progressBar.attr(\"data-color\");\n\t\t\t\tlet progressBarInnerColor = progressBar.attr(\"data-inner-color\");\t\n\t\t\t\tlet progressBarGradientType = progressBar.attr(\"data-gradient-type\");\t\n\t\t\t\tlet additionalGradientSettings = '';\n\t\t\t\tif (progressBarGradientType == 'linear') additionalGradientSettings = 'to left,'\n\n\t\t\t\tlet value = progressBar.data('value');\n\t\t\t\tif(value == undefined) value = 0;\n\t\t\t\telse if (value == endValue) return;\n\n\t\t\t\tlet isForwards = value < endValue;\n\n\n\t\t\t\tobj.attr('data-percent',((total/from)*100).toFixed(2));\n\t\t\t\tif(value != endValue) progressBar.removeClass('complete');\n\n\t\t\t\tif(total >= from && 0 ) {\n\t\t\t\t\tprogressBar.addClass('complete');\n\t\t\t\t\tprogressBar.data('value',100);\n\t\t\t\t}else{\n\n\t\t\t\t\tlet progress = setInterval (() =>
2 {\n\n\t\t\t\t\t\tif(isForwards){\n\t\t\t\t\t\t\tvalue++;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tvalue--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(value > 100 || value < 0){\n\t\t\t\t\t\t\tclearInterval(progress);\n\t\t\t\t\t\t\tvalue=endValue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tprogressBar.data('value',value);\n\t\t\t\t\t\tprogressBar.css('background',`${progressBarGradientType}-gradient(${additionalGradientSettings}${progressBarColor} ${value}%,${progressBarInnerColor} 0%)`);\n\n\t\t\t\t\t\tif(value == endValue) {\n\t\t\t\t\t\t\tif(value >= 100){\n\t\t\t\t\t\t\t\tprogressBar.addClass('complete');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclearInterval(progress);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t},progressBarSpeed);\n\t\t\t\t}\n\n\t\t\t});\n\t\t}\n\n\t\tupdateProgressBar();\n\n\t\t$('[data-block=\\'minicart\\']').on('contentUpdated',function(){\n\t\t\tupdateProgressBar();\n\t\t});\t\t\n\t}\n);","Idus_Social/js/embeds.min.js":"(function(){\nvar global=this;\nvar __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now(),__DEV__=false,process=this.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||\"production\";!(function(t){\"use strict\";function e(){return s=Object.create(null)}function r(t){const e=t,r=s[e];return r&&r.isInitialized?r.publicModule.exports:i(e,r)}function n(t){const e=t;if(s[e]&&s[e].importedDefault!==f)return s[e].importedDefault;const n=r(e),o=n&&n.__esModule?n.default:n;return s[e].importedDefault=o}function o(t){const e=t;if(s[e]&&s[e].importedAll!==f)return s[e].importedAll;const n=r(e);let o;if(n&&n.__esModule)o=n;else{if(o={},n)for(const t in n)a.call(n,t)&&(o[t]=n[t]);o.default=n}return s[e].importedAll=o}function i(e,r){if(!p&&t.ErrorUtils){p=!0;let n;try{n=c(e,r)}catch(e){t.ErrorUtils.reportFatalError(e)}return p=!1,n}return c(e,r)}function l(t){return{segmentId:t>>>h,localId:t&m}}function c(e,i){if(!i&&I.length>0){const t=l(e),r=t.segmentId,n=t.localId,o=I[r];null!=o&&(o(n),i=s[e])}const c=t.nativeRequire;if(!i&&c){const t=l(e),r=t.segmentId;c(t.localId,r),i=s[e]}if(!i)throw u(e);if(i.hasError)throw d(e,i.error);i.isInitialized=!0;const f=i,a=f.factory,p=f.dependencyMap;try{const l=i.publicModule;if(l.id=e,g.length>0)for(let t=0;t<g.length;++t)g[t].cb(e,l);return a(t,r,n,o,l,l.exports,p),i.factory=void 0,i.dependencyMap=void 0,l.exports}catch(t){throw i.hasError=!0,i.error=t,i.isInitialized=!1,i.publicModule.exports=void 0,t}}function u(t){let e='Requiring unknown module \"'+t+'\".';return Error(e)}function d(t,e){const r=t;return Error('Requiring module \"'+r+'\", which threw an exception: '+e)}t.__r=r,t.__d=function(t,e,r){null==s[e]&&(s[e]={dependencyMap:r,factory:t,hasError:!1,importedAll:f,importedDefault:f,isInitialized:!1,publicModule:{exports:{}}})},t.__c=e,t.__registerSegment=function(t,e){I[t]=e};var s=e();const f={},a={}.hasOwnProperty;r.importDefault=n,r.importAll=o;let p=!1;const h=16,m=65535;r.unpackModuleId=l,r.packModuleId=function(t){return(t.segmentId<<h)+t.localId};const g=[];r.registerHook=function(t){const e={cb:t};return g.push(e),{release:()=>{for(let t=0;t<g.length;++t)if(g[t]===e){g.splice(t,1);break}}}};const I=[]})('undefined'!=typeof global?global:'undefined'!=typeof window?window:this);\n__s={\"js\":{},\"css\":{}}\nvar __d=this.__d;\n__d(function(g,r,i,a,m,e,d){\"use strict\";function t(t){return!isNaN(Number(t))}function n(t,n){t.className+=' '+n}function o(t,n){t.className=t.className.replace(n,'')}function s(t){const n=document.getElementsByTagName('iframe');let o;for(let s=n.length-1;s>=0;s--){const c=n[s];if(c.contentWindow===t.source){o=c;break}}return o}function c(t){const n=t.clientWidth,o=window.devicePixelRatio;return n&&o?parseInt(n*o,10):0}function l(t){const n=t.match(_);return n?n[1].replace(/^https?:\\/\\/(www.)?/,'https://www.')+'/':null}function u(t){if(t.hasAttribute(S))return t.getAttribute(S);const n=t.getElementsByTagName('a');for(let t=n.length-1;t>=0;t--){const o=l(n[t].href);if(o)return o}return null}function p(t){'performance'in window&&null!=window.performance&&'object'==typeof window.performance&&'function'==typeof window.performance.now&&t(window.performance.now())}function f(t){if('performance'in window&&null!=window.performance&&'object'==typeof window.performance&&'function'==typeof window.performance.getEntries){const n=window.performance.getEntries().filter(t=>t.name.match(G));n&&n.length&&'fetchStart'in n[0]&&'responseEnd'in n[0]&&t(n[0].fetchStart,n[0].responseEnd)}}function w(s,l){const u=W++,w=E+u,h={};s.id||(s.id=$+u);let y=l.replace(I,'$1/');if(y+='embed/',s.hasAttribute(A)&&(y+='captioned/'),y+='?cr=1',s.hasAttribute(M)){const n=parseInt(s.getAttribute(M),10);t(n)&&(y+='&v='+n)}const N=c(s);N&&(y+='&wp='+N.toString()),y+='&rd='+encodeURIComponent(window.location.origin);const C=window.location.pathname;if(C){const t=C+(window.location.search||'');y+='&rp='+encodeURIComponent(t.substring(0,200))}y=y.replace(j,k),h.ci=u,p(function(t){h.os=t}),f(function(t,n){h.ls=t,h.le=n});const U=encodeURIComponent(JSON.stringify(h)),B=document.createElement('iframe');
2B.className=s.className,B.id=w,B.src=y+'#'+U,B.setAttribute('allowTransparency','true'),B.setAttribute('allowfullscreen','true');const S=s.style.position;S&&B.setAttribute(v,S),B.setAttribute('frameBorder','0'),B.setAttribute('height','0'),B.setAttribute(L,s.id),B.setAttribute('scrolling','no'),B.setAttribute('style',s.style.cssText+';'+O),B.style.position='absolute',s.parentNode.insertBefore(B,s),n(s,T),o(s,R),P[w]=!0,p(function(t){K[w]={frameLoading:t}}),setTimeout(function(){b(w)},x)}function b(t){Object.prototype.hasOwnProperty.call(P,t)&&(delete P[t],y())}function h(t){if(!B.test(t.origin))return;const o=s(t);if(!o)return;const c=o.id;let l;try{l=JSON.parse(t.data)}catch(t){}if('object'!=typeof l||'string'!=typeof l.type||'object'!=typeof l.details)return;const{details:u,type:f}=l;let w=null;switch(f){case i(d[0]).MOUNTED:{const t=document.getElementById(o.getAttribute(L));if(t||i(d[1])(0),w=t.clientHeight,o.style.position=o.hasAttribute(v)?o.getAttribute(v):'','object'==typeof u.styles&&u.styles.length)try{for(let t=0;t<u.styles.length;t++){const n=u.styles[t][0],s=u.styles[t][1];o.style[n]=s}}catch(t){}n(o,U),t.parentNode&&t.parentNode.removeChild(t),b(c),p(function(t){K[c]&&(K[c].contentLoaded=t,window.__igEmbedLoaded&&window.__igEmbedLoaded({frameId:c,stats:K[c]}))});break}case i(d[0]).LOADING:p(function(t){K[c]&&(K[c].contentLoading=t)});break;case i(d[0]).MEASURE:{const t=u.height;D[c]!==t&&(w=t);break}case i(d[0]).UNMOUNTING:delete D[c]}null!==w&&(o.height=D[c]=w)}function y(){const t=document.getElementsByClassName(R);for(let n=0;n<t.length;n++){if(Object.keys(P).length>=C)break;const o=t[n];if('BLOCKQUOTE'===o.tagName){const t=u(o);t&&w(o,t)}}}function N(){if(!J){if(H)return;H=!0}i(d[2])(()=>{y(),J||(i(d[3]).add(window,'message',h.bind(this)),J=!0)})}const A='data-instgrm-captioned',E='instagram-embed-',x=1e4,O=\"\\n  background-color: white;\\n  border-radius: 3px;\\n  border: 1px solid #dbdbdb;\\n  box-shadow: none;\\n  display: block;\\n  margin: 0;\\n  min-width: 326px;\\n  padding: 0;\\n\",j=/^https?:\\/\\//,k='https://',I=/^(.*?)\\/?(\\?.*|#|$)/,C=3,R='instagram-media',T=\"instagram-media-registered\",U=\"instagram-media-rendered\",B=new RegExp(\"^https?://([\\\\w-]+\\\\.)*(\"+['instagram\\\\.com','instagr\\\\.am'].join('|')+\")$\"),L='data-instgrm-payload-id',$='instagram-media-payload-',S='data-instgrm-permalink',_=new RegExp('^('+B.source.replace(/^\\^/,'').replace(/\\$$/,'')+\"/p/[^/]+)\"),v='data-instgrm-preserve-position',G=new RegExp('^('+B.source.replace(/^\\^/,'').replace(/\\$$/,'')+'/embed\\\\.js)'),M='data-instgrm-version',D={};let J=!1;const P={};let W=0,H=!1;const K={};r(d[4]).getGlobalContext().process||(N(),r(d[4]).getGlobalContext().process=N)},0,[1,2,3,4,5]);\n__d(function(g,r,i,a,m,e,d){m.exports={MOUNTED:\"MOUNTED\",LOADING:\"LOADING\",UNMOUNTING:\"UNMOUNTING\",MEASURE:\"MEASURE\"}},1,[]);\n__d(function(g,r,i,a,m,e,d){'use strict';let n=r(d[0]);m.exports=function(o,t){if(!o){let o;if(void 0===t)o=new Error(\"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.\");else{const l=[t];for(let n=2,o=arguments.length;n<o;n++)l.push(arguments[n]);(o=new Error(n.apply(null,l))).name='Invariant Violation',o.messageWithParams=l}throw o.framesToPop=1,o}}},2,[6]);\n__d(function(g,r,i,a,m,e,d){var n=function(...t){return(t=t.map(n=>String(n)))[0].split('%s').length!==t.length?n('ex args number mismatch: %s',JSON.stringify(t)):n._prefix+JSON.stringify(t)+n._suffix};n._prefix='<![EX[',n._suffix=']]>',m.exports=n},6,[]);\n__d(function(g,r,i,a,m,e,d){\"use strict\";function t(){if(!o)return;let t;for(;t=o.shift();)t();o=null}Object.defineProperty(e,'__esModule',{value:!0});let o=null;if(r(d[0]).canUseDOM){var n,u;const c=null===(n=document)||void 0===n?void 0:null===(u=n.documentElement)||void 0===u?void 0:u.doScroll;if(!('readyState'in document?'complete'===document.readyState||'loading'!==document.readyState&&!c:!!document.body)&&(o=[],i(d[1]).add(document,'DOMContentLoaded',t),i(d[1]).add(window,'load',t),c&&window===window.top)){const o=function(){try{c('left')}catch(t){return void setTimeout(o,0)}t()};o()}}e.default=function(t){o?o.push(t):t()}},3,[7,4]);\n__d(function(g,r,i,a,m,e,d){'use strict';const n=!('undefined'==typeof window||!window.document||!window.document.createElement||window._ssr),t={canUseDOM:n,canUseWorkers:'undefined'!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseVie
2wport:n&&!!window.screen,isInWorker:!n};m.exports=t},7,[]);\n__d(function(g,r,i,a,m,e,d){\"use strict\";Object.defineProperty(e,'__esModule',{value:!0});let t=!1;const n=i(d[0])(()=>{try{const n=Object.defineProperty({},'passive',{get:function(){t=!0}});r(d[1]).canUseDOM&&(window.addEventListener('test',null,n),window.removeEventListener('test',null,n))}catch(t){}return t}),s={capture:!1};class l{constructor(t){this.$EventListenerHelper1=null,this.$EventListenerHelper1=t}static add(t,o,c,u=s){let v=u;return n()||(v='boolean'!=typeof u&&!!u.capture),t.addEventListener(o,c,v),new l(()=>{t.removeEventListener(o,c,v)})}remove(){this.$EventListenerHelper1&&(this.$EventListenerHelper1(),this.$EventListenerHelper1=null)}}e.default=l},4,[8,7]);\n__d(function(g,r,i,a,m,e,d){function n(c,o){if('function'!=typeof c||null!=o&&'function'!=typeof o)throw new TypeError(t);var f=function(){var n=arguments,t=o?o.apply(this,n):n[0],u=f.cache;if(u.has(t))return u.get(t);var h=c.apply(this,n);return f.cache=u.set(t,h)||u,h};return f.cache=new(n.Cache||r(d[0])),f}var t='Expected a function';n.Cache=r(d[0]),m.exports=n},8,[9]);\n__d(function(g,r,i,a,m,e,d){function t(t){var o=-1,p=null==t?0:t.length;for(this.clear();++o<p;){var l=t[o];this.set(l[0],l[1])}}t.prototype.clear=r(d[0]),t.prototype.delete=r(d[1]),t.prototype.get=r(d[2]),t.prototype.has=r(d[3]),t.prototype.set=r(d[4]),m.exports=t},9,[10,11,12,13,14]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(){this.size=0,this.__data__={hash:new(r(d[0])),map:new(r(d[1])||r(d[2])),string:new(r(d[0]))}}},10,[15,16,17]);\n__d(function(g,r,i,a,m,e,d){function t(t){var o=-1,p=null==t?0:t.length;for(this.clear();++o<p;){var l=t[o];this.set(l[0],l[1])}}t.prototype.clear=r(d[0]),t.prototype.delete=r(d[1]),t.prototype.get=r(d[2]),t.prototype.has=r(d[3]),t.prototype.set=r(d[4]),m.exports=t},15,[18,19,20,21,22]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(){this.__data__=r(d[0])?r(d[0])(null):{},this.size=0}},18,[23]);\n__d(function(g,r,i,a,m,e,d){var t=r(d[0])(Object,'create');m.exports=t},23,[24]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n,o){var t=r(d[0])(n,o);return r(d[1])(t)?t:void 0}},24,[25,26]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n,o){return null==n?void 0:n[o]}},25,[]);\n__d(function(g,r,i,a,m,e,d){var t=/^\\[object .+?Constructor\\]$/,o=Function.prototype,n=Object.prototype,c=o.toString,p=n.hasOwnProperty,u=RegExp('^'+c.call(p).replace(/[\\\\^$.*+?()[\\]{}|]/g,'\\\\$&').replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,'$1.*?')+'$');m.exports=function(o){return!(!r(d[0])(o)||r(d[1])(o))&&(r(d[2])(o)?u:t).test(r(d[3])(o))}},26,[27,28,29,30]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n){var t=typeof n;return null!=n&&('object'==t||'function'==t)}},27,[]);\n__d(function(g,r,i,a,m,e,d){var n=(function(){var n=/[^.]+$/.exec(r(d[0])&&r(d[0]).keys&&r(d[0]).keys.IE_PROTO||'');return n?'Symbol(src)_1.'+n:''})();m.exports=function(t){return!!n&&n in t}},28,[31]);\n__d(function(g,r,i,a,m,e,d){m.exports=r(d[0])['__core-js_shared__']},31,[32]);\n__d(function(g,r,i,a,m,e,d){var t='object'==typeof self&&self&&self.Object===Object&&self,f=r(d[0])||t||Function('return this')();m.exports=f},32,[33]);\n__d(function(g,r,i,a,m,e,d){var t='object'==typeof g&&g&&g.Object===Object&&g;m.exports=t},33,[]);\n__d(function(g,r,i,a,m,e,d){var n='[object AsyncFunction]',t='[object Function]',o='[object GeneratorFunction]',c='[object Proxy]';m.exports=function(u){if(!r(d[0])(u))return!1;var b=r(d[1])(u);return b==t||b==o||b==n||b==c}},29,[27,34]);\n__d(function(g,r,i,a,m,e,d){var n='[object Null]',t='[object Undefined]',o=r(d[0])?r(d[0]).toStringTag:void 0;m.exports=function(c){return null==c?void 0===c?t:n:o&&o in Object(c)?r(d[1])(c):r(d[2])(c)}},34,[35,36,37]);\n__d(function(g,r,i,a,m,e,d){m.exports=r(d[0]).Symbol},35,[32]);\n__d(function(g,r,i,a,m,e,d){var t=Object.prototype,o=t.hasOwnProperty,n=t.toString,c=r(d[0])?r(d[0]).toStringTag:void 0;m.exports=function(t){var l=o.call(t,c),v=t[c];try{t[c]=void 0}catch(t){}var p=n.call(t);return l?t[c]=v:delete t[c],p}},36,[35]);\n__d(function(g,r,i,a,m,e,d){var t=Object.prototype.toString;m.exports=function(n){return t.call(n)}},37,[]);\n__d(function(g,r,i,a,m,e,d){var t=Function.prototype.toString;m.exports=function(n){if(null!=n){try{return t.call(n)}catch(t){}try{return n+''}catch(t){}}return''}},30,[]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t){var s=this.has(t)&&delete this.__data__[t];return this.size-=s?1:0,s}},19,[]);\n__d(function(g,r,i,a,m,e,d){var _='__lodash_hash_undefined__',t=Object.prototype.hasOwnProperty;m.exports=function(n){var o=this.__data__;if(r(d[0])){var h=o[n];return h===_?void 0:h}return t.call(o,n)?o[n]:void 0}},20,[23]);\n__d(function(g,r,i,a,m,e,d){var t=Object.prototype.hasOwnProperty;m.exports=function(o){var n=this.__data__;return r(d[0])?void 0!==n[o]:t.call(n,o)}},21,[23]);\n__d(function(g,r,i,a,m,e,d){var _='__lodash_hash_undefined__';m.exports=function(s,t){var h=this.__data__;return this.size+=this.has(s)?0:1,h[s]=r(d[0])&&void 0===t?_:t,this}},22,[23]);\n__d(function(g,r,i,a,m,e,d){var n=r(d[0])(r(d[1]),'Map');m.exports=n},16,[24,32]);\n__d(function(g,r,i,a,m,e,d){function t(t){var o=-1,p=null==t?0:t.length;for(this.clear();++o<p;){var l=t[o];this.set(l[0],l[1])}}t.prototype.clear=r(d[0]),t.prototype.delete=r(d[1]),t.prototype.get=r(d[2]),t.prototype.has=r(d[3]),t.prototype.set=r(d[4]),m.exports=t},17,[38,39,40,41,42]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(){this.__data__=[],this.size=0}},38,[]);\n__d(function(g,r,i,a,m,e,d){var t=Array.prototype.splice;m.exports=function(n){var o=this.__data__,p=r(d[0])(o,n);return!(p<0||(p==o.length-1?o.pop():t.call(o,p,1),--this.size,0))}},39,[43]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n,t){for(var f=n.length;f--;)if(r(d[0])(n[f][0],t))return f;return-1}},43,[44]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n,t){return n===t||n!=n&&t!=t}},44,[]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t){var _=this.__data__,n=r(d[0])(_,t);return n<0?void 0:_[n][1]}},40,[43]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t){return r(d[0])(this.__data__,t)>-1}
2},41,[43]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t,s){var _=this.__data__,n=r(d[0])(_,t);return n<0?(++this.size,_.push([t,s])):_[n][1]=s,this}},42,[43]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t){var n=r(d[0])(this,t).delete(t);return this.size-=n?1:0,n}},11,[45]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t,n){var _=t.__data__;return r(d[0])(n)?_['string'==typeof n?'string':'hash']:_.map}},45,[46]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n){var o=typeof n;return'string'==o||'number'==o||'symbol'==o||'boolean'==o?'__proto__'!==n:null===n}},46,[]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(t){return r(d[0])(this,t).get(t)}},12,[45]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(n){return r(d[0])(this,n).has(n)}},13,[45]);\n__d(function(g,r,i,a,m,e,d){m.exports=function(s,t){var n=r(d[0])(this,s),h=n.size;return n.set(s,t),this.size+=n.size==h?0:1,this}},14,[45]);\n__d(function(g,r,i,a,m,e,d){\"use strict\";Object.defineProperty(e,'__esModule',{value:!0}),window.instgrm||(window.instgrm={Embeds:{}}),e.getGlobalContext=function(){return window.instgrm.Embeds}},5,[]);\nglobal.__r(0);\n}).call({});","Idus_Social/js/share.js":"define([\n\t'jquery',\n\t'Idus_Core/js/idus'\n], function ($, idus) {\n\t'use strict';\n\treturn function () {\n\t\t$('a.social-links').off('click').on('click', function () {\n\t\t\tvar btn = $(this);\n\t\t\tvar element = $(this).closest('.product-page');\n\t\t\tif(!element.length) element = $('.product-page:eq(0)');\n\t\t\tvar eventProps = false;\n\t\t\tif(window.idusDataLayer.products && window.idusDataLayer.products[element.data('id')]){\n\t\t\t\teventProps = {\n\t\t\t\t\tsku: window.idusDataLayer.products[element.data('id')].sku,\n\t\t\t\t\tid: element.data('id'),\n\t\t\t\t\tplatform: 'unknown'\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (!window.navigator.share) {\n\t\t\t\tvar parent = $(this).closest('div.social-links');\n\t\t\t\t$('.social-list', parent).slideToggle();\n\n\t\t\t\tif(btn.attr('aria-expanded') == 'true'){\n\t\t\t\t\tbtn.attr('aria-expanded', 'false');\n\t\t\t\t}else{\n\t\t\t\t\tbtn.attr('aria-expanded', 'true');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tvar shareData = $(this).closest('[data-share-title]');\n\t\t\t\tlet shareText = shareData.data('share-text') || '';\n\t\t\t\tshareText = shareText.replace(/\\\\n/g, \"\\n\");\n\t\t\t\tvar url = shareData.data('share-url');\n\t\t\t\tif (window.customProductUrl) {\n\t\t\t\t\turl = window.customProductUrl;\n\t\t\t\t}\n\t\t\t\tnavigator.share({\n\t\t\t\t\ttitle: shareData.data('share-title'),\n\t\t\t\t\ttext: shareText,\n\t\t\t\t\turl: url\n\t\t\t\t}).then(function (res) {\n\t\t\t\t\t$(document).trigger('idus-productShare',  [eventProps]);\n\t\t\t\t}).catch(function (err) {\n\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t$('.social-option').off('click').on('click', function (e) {\n\t\t\tvar self = $(this);\n\t\t\tvar parent = $(this).closest('div.social-links');\n\t\t\tvar url = $('a', self).attr('data-href');\n\t\t\tif (parent.hasClass('product')) {\n\t\t\t\turl = window.location.href;\n\t\t\t}\n\n\t\t\tif (window.customProductUrl) {\n\t\t\t\turl = window.customProductUrl;\n\t\t\t}\n\n\t\t\tif (self.hasClass('copyurl')) {\n\t\t\t\tidus.copy().copy(url);\n\t\t\t\te.preventDefault();\n\t\t\t} else {\n\t\t\t\t$('a', self).attr('href', $('a', self).attr('href').replace('%url_page%', url).replace('%name_page%', document.title));\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t$('a', self).attr('href', $('a', self).attr('href').replace(url, '%url_page%'));\n\t\t\t\t}, 500);\n\t\t\t}\n\t\t\t$('.social-list', parent).slideToggle();\n\t\t});\n\t}\n});","Idus_Social/js/social_post.js":"define([\n\t\t'jquery',\n\t\t'Idus_Core/js/idus',\n\t\t'Idus_Core/js/url',\n\t\t'Magento_Ui/js/modal/modal',\n\t\t'embeds',\n\t\t'idus_slider'\n\t],\n\tfunction ($, idus, url, modal, embeds, IdusSlider) {\n\t\t'use strict';\n\n\t\treturn function (data, el) {\n\t\t\tvar wrapper = $(el).closest('.social_posts');\n\t\t\tvar load_more = $('.social_post.load_more', wrapper);\n\n\t\t\t// init slider\n\t\t\tvar socialSlider = new IdusSlider(wrapper.get(0), {\n\t\t\t\tdots: data.dots,\n\t\t\t\tarrows: true,\n\t\t\t\tresponsive: [{\n\t\t\t\t\t\tbreakpoint: 1199,\n\t\t\t\t\t\tsettings: {\n\t\t\t\t\t\t\tslidesToScroll: parseInt($('.social_posts_content', wrapper).attr('show_tb')),\n\t\t\t\t\t\t\tslidesToShow: parseInt($('.social_posts_content', wrapper).attr('show_tb'))\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tbreakpoint: 767,\n\t\t\t\t\t\tsettings: {\n\t\t\t\t\t\t\tslidesToScroll: parseInt($('.social_posts_content', wrapper).attr('show_sp')),\n\t\t\t\t\t\t\tslidesToShow: parseInt($('.social_posts_content', wrapper).attr('show_sp'))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tslidesToScroll: parseInt($('.social_posts_content', wrapper).attr('show_dt')),\n\t\t\t\tslidesToShow: parseInt($('.social_posts_content', wrapper).attr('show_dt'))\n\t\t\t}, {\n\t\t\t\tslides: '.idus-slider-slide'\n\t\t\t});\n\n\t\t\tsocialSlider.initControls();\n\t\t\tsocialSlider.initScroll();\n\n\t\t\tsocialSlider.checkIfOverflowing();\n\n\t\t\tsocialSlider.initSlides();\n\n\t\t\tif (localStorage.getItem('idus-slider-debug')) socialSlider.initDebugWindow();\n\n\t\t\tsocialSlider.attachMouseEvents();\n\t\t\tsocialSlider.initAutoplay();\n\n\t\t\tvar innerScroll = true;\n\t\t\tif ($(window).width() > 767) {\n\t\t\t\tinnerScroll = false;\n\t\t\t}\n\n\t\t\tvar object = $('#popup_modal_social_post_'+wrapper.attr('data-platform'));\n\n\t\t\tvar options = {\n\t\t\t\ttype: 'popup',\n\t\t\t\ttitle: false,\n\t\t\t\tresponsive: true,\n\t\t\t\tinnerScroll: innerScroll,\n\t\t\t\tmodalClass: 'popup_social_post',\n\t\t\t\tbuttons: [{\n\t\t\t\t\ttext: $.mage.__('\u05d4\u05e7\u05d5\u05d3\u05dd'),\n\t\t\t\t\tattr: {\n\t\t\t\t\t\t'data-action': 'prev'\n\t\t\t\t\t},\n\t\t\t\t\t'class': 'action primary no_loading',\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tgoTo('prev');\n\t\t\t\t\t}\n\t\t\t\t}, {\n\t\t\t\t\ttext: $.mage.__('\u05d4\u05d1\u05d0'),\n\t\t\t\t\tattr: {\n\t\t\t\t\t\t'data-action': 'next'\n\t\t\t\t\t},\n\t\t\t\t\t'class': 'action primary no_loading',\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tgoTo('next');\n\t\t\t\t\t}\n\t\t\t\t}],\n\t\t\t\tclosed: function () {\n\n\t\t\t\t\tif (!window.socialPost) return;\n\t\t\t\t\tvar products = $('.product_wrap', object).detach();\n\t\t\t\t\tproducts.hide();\n\t\t\t\t\tif (!$('.product_wrap', window.socialPost).length) $('<
2div class=\"product_wrap\"></div>').appendTo(window.socialPost);\n\t\t\t\t\t$('.product_wrap', window.socialPost).replaceWith(products);\n\t\t\t\t\twindow.socialPost = false;\n\t\t\t\t},\n\t\t\t};\n\t\t\t\n\t\t\tif (object.attr('init') == undefined) {\n\t\t\t\tmodal(options, object);\n\t\t\t\tobject.attr('init', 1);\n\t\t\t}\n\n\t\t\tfunction goTo(action) {\n\t\t\t\tvar id = object.attr('data-post');\n\t\t\t\tvar item = $('.social_post_' + id, wrapper);\n\t\t\t\tvar element = item.next();\n\t\t\t\tif (action == 'prev') element = item.prev();\n\t\t\t\tvar next = element;\n\t\t\t\tif (!next.length) {\n\t\t\t\t\tif ($('.social_post.load_more', wrapper).length) {\n\t\t\t\t\t\t$('button', load_more).attr('next', 'true').click();\n\t\t\t\t\t\t$('.loading', object).show();\n\t\t\t\t\t\t$('.content,.embeds,.default', object).hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext = $('.social_post:eq(0)', wrapper);\n\t\t\t\t\t\tif (action == 'prev') next = $('.social_post:last-child', wrapper);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnext.click();\n\t\t\t}\n\n\t\t\tvar ajaxCall = false;\n\t\t\t$('button', load_more).on('click', function () {\n\n\t\t\t\tvar ajaxUrl = url.getUrl('social/post/more');\n\t\t\t\tif (ajaxCall) ajaxCall.abort();\n\t\t\t\tdata['page'] = (wrapper.attr('page') * 1) + 1;\n\t\t\t\tajaxCall = $.ajax({\n\t\t\t\t\turl: ajaxUrl,\n\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\tdata: data,\n\t\t\t\t\tbeforeSend: function () {\n\t\t\t\t\t\t$('.idus_social_post', load_more).addClass('active');\n\t\t\t\t\t\t$('button', load_more).hide();\n\t\t\t\t\t},\n\n\t\t\t\t\tcomplete: function (response) {\n\t\t\t\t\t\t$('.idus_social_post', load_more).removeClass('active');\n\t\t\t\t\t\t$('button', load_more).show();\n\t\t\t\t\t\tload_more.parent().append(load_more);\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}).done(\n\t\t\t\t\tfunction (response) {\n\t\t\t\t\t\tif (response.success) {\n\t\t\t\t\t\t\tif (!response.load_more) {\n\t\t\t\t\t\t\t\tload_more.remove();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twrapper.attr('page', response.page);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$.each(response.items, function () {\n\t\t\t\t\t\t\t\t$('.social_posts_list', wrapper).append(this);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t$('.social_posts_list', wrapper).trigger('contentUpdated');\n\n\t\t\t\t\t\t\tif ($('button', load_more).attr('next') == 'true') {\n\t\t\t\t\t\t\t\t$('button', load_more).attr('next', 'false');\n\t\t\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\t\t\t$('.popup_social_post [data-action=\"next\"]').click();\n\t\t\t\t\t\t\t\t}, 100);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsocialSlider.reInit();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t).fail(\n\t\t\t\t\tfunction (response) {\n\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t});\n\n\t\t\t$(document).on('click', '.popup_social_post .product_quickview', function () {\n\t\t\t\tobject.modal('closeModal');\n\t\t\t});\n\n\t\t\twrapper.on('click', '.social_post:not(.load_more)', function (e) {\n\t\t\t\tif($(e.target).hasClass('swatch-option')) return;\n\t\t\t\tvar self = $(this);\n\n\t\t\t\tif(self.hasClass('show')) return;\n\t\t\t\tself.addClass('show');\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tself.removeClass('show');\n\t\t\t\t},1000);\n\n\t\t\t\tvar object = $('#popup_modal_social_post_'+self.attr('platform'));\n\n\t\t\t\tif (!object.length) {\n\t\t\t\t\tobject = $('#popup_modal_social_post_'+wrapper.data('platform'));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$('.loading', object).show();\n\n\t\t\t\t// $('.embeds', object).show().html('<blockquote class=\"instagram-media w_100\" data-instgrm-captioned data-instgrm-version=\"7\"><a href=\"' + $('a', self).attr('data-href') + '\" target=\"_blank\"></a></blockquote>');\n\n\t\t\t\t$('.default', object).show();\n\t\t\t\t\n\t\t\t\t$('.default .additional', object).html($('.additional', self).html());\n\t\t\t\t$('.default .description', object).html($('img', self).data('title')).attr('dir', idus.getDir($('img', self).data('title')));\n\t\t\t\t$('.default .link a', object).attr('href', $('a', self).data('href'));\n\t\t\t\t$('.default img', object).show().attr('src', $('img', self).data('src'));\n\n\t\t\t\tif($('img', self).attr('embed')){\n\t\t\t\t\t$('.default .embed', object).show().html(JSON.parse($('img', self).attr('embed')));\n\t\t\t\t}else{\n\t\t\t\t\t$('.default .embed', object).hide().html('');\n\t\t\t\t}\n\n\t\t\t\tif (self.attr('type') == 'video') {\n\t\t\t\t\t$('.default video', object).show();\n\t\t\t\t\t$('.default video source').attr('src', $('img', self).attr('video'));\n\t\t\t\t\tvar video = $('.default video', object).clone();\n\t\t\t\t\t$('.default .video video', object).remove();\n\t\t\t\t\t$('.default .video').append(video);\n\t\t\t\t\t$('.default .img_wrap').hide();\n\t\t\t\t\t$('.default', object).addClass('has-video');\n\t\t\t\t\t$('.popup_social_post').on('modalclosed', function() { \n\t\t\t\t\t\tvideo.trigger('pause');\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t$('.default video', object).hide();\n\t\t\t\t\t$('.default video source').attr('src', '//:0');\n\t\t\t\t\t$('.default .img_wrap').show();\n\t\t\t\t\t$('.default', object).removeClass('has-video');\n\t\t\t\t}\n\n\t\t\t\t$(object).attr('data-post', self.attr('data-post'));\n\t\t\t\tvar product = $('.product_wrap', self).html();\n\t\t\t\tif (!product || product.trim() === '') {\n\t\t\t\t\tproduct = '';\n\t\t\t\t\t$('.social_post_wrap', object).attr('data-empty', true);\n\t\t\t\t} else {\n\t\t\t\t\t$('.social_post_wrap', object).attr('data-empty', false);\n\t\t\t\t}\n\t\t\t\tvar products = $('.product_wrap', self).detach();
2\n\t\t\t\tif (!$('.product_wrap', object).length) $('<div class=\"product_wrap\"></div>').appendTo($('.content', object));\n\t\t\t\telse $('.product_wrap', object).hide();\n\t\t\t\t$('.product_wrap', object).replaceWith(products);\n\t\t\t\t$('.product_wrap', object).show();\n\n\t\t\t\tobject.modal('openModal');\n\t\t\t\twindow.socialPost = self;\n\t\t\t\t// window.instgrm.Embeds.process();\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t$('.loading', object).hide();\n\t\t\t\t\t$(window).trigger('scroll');\n\t\t\t\t\t$('.instagram-media', object).attr('style', 'opacity: 1 !important; display: block !important;');\n\t\t\t\t}, 100);\n\t\t\t});\n\t\t}\n\t}\n);","Idus_SocialLogin/js/sociallogin.js":"define([\n    'jquery',\n    'Idus_Core/js/idus'\n], function($,idus){\n\n    return function(){\n        var element = $(arguments[1]);\n        \n        var register = element.closest('#customer-account-register-form');\n        if(register.length){\n            $('#account-register-send').on('click',function(){\n                $('.idus_social_login', register).hide();\n                $('.idus_social_login .sociallogin', register).hide();\n            });\n        }\n\n        $('a.sociallogin', element).off('click').on('click',function(e){\n            e.preventDefault();\n            windowCenter($(this).attr('href'), $(this).attr('title'), 520, 600);\n        });\n\n        var isOS = navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/Mac OS/i);\n        \n        if(isOS){\n            $('.apple_login', element).show();\n        }\n\n        function windowCenter(url, title, w, h) {\n            var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;\n            var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;\n\n            var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;\n            var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;\n\n            var systemZoom = width / window.screen.availWidth;\n            var left = (width - w) / 2 / systemZoom + dualScreenLeft;\n            var top = (height - h) / 2 / systemZoom + dualScreenTop;\n            var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);\n            if (window.focus) newWindow.focus();\n        }\n    }\n});","js/script.js":"require(['jquery', 'Idus_Core/js/idus', 'domReady!'], function ($, idus) {\n\n\n\tvar shareData = $('.product_share[data-share-title]');\n\tif (shareData.length) shareData.data('share-text', '\u05de\u05e9\u05e7\u05e4\u05d9\u05d9\u05dd \u05e9\u05d7\u05e9\u05d1\u05ea\u05d9 \u05e9\u05d9\u05e2\u05e0\u05d9\u05d9\u05e0\u05d5 \u05d0\u05d5\u05ea\u05da');\n\n\t$('#page-header-navigation-toggle').on('change', function () {\n\n\t\tif (this.checked) {\n\n\t\t\tif ($('.idus_minicart_popup._show').length) $('#btn-minicart-close').trigger('click');\n\t\t\tif ($('.customer-popup-login._show').length) $('.action-close', '.customer-popup-login._show').trigger('click');\n\t\t}\n\t});\n\n\t// add container width to html tag\n\tfunction setContainerRealVW() {\n\t\tvar realContainerVW = $('.page-main.container').width() * 0.01;\n\t\tdocument.documentElement.style.setProperty('--container-width', realContainerVW + 'px');\n\t}\n\n\tsetContainerRealVW();\n\t$(window).on('resize', function () {\n\t\tsetContainerRealVW();\n\n\t});\n\n\t// close mini-cart\n\tvar mini_cart_open = $('body .mini-cart a');\n\t\n\tmini_cart_open.on('click', function(){\n\n\t\tif($('body').hasClass('_has-modal')){\n\t\t\t\n\t\t\tsetTimeout(function(){\n\t\t\t\t$('.action.close', 'body').trigger('click');\n\t\t\t},1);\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\n\t});\n\n\t// category filter buttons\n\tvar custom_filters_slider = $('.idus-slider-layout-custom_filters');\n\t\n\tif(custom_filters_slider.length > 0) {\n\t\t$('.idus-slider-slide.filter-selected a',custom_filters_slider).attr('href', window.location.href.split('?')[0]);\n\t}\n\n\t// stores filter buttons\n\tvar tagsFilterOption = $('.filter_tag_option');\n\tvar stores = $('.stores .store');\n\n\ttagsFilterOption = tagsFilterOption.removeClass('filter_tag_option').addClass('tag_option');\n\n\tsetTimeout(function () {\n\t\ttagsFilterOption.first().trigger('click');\n\t\t$('.stores').addClass('loaded');\n\t}, 250);\n\n\ttagsFilterOption.on('click', function () {\n\n\t\tvar me = $(this);\n\t\tstores.addClass('tag_hide');\n\t\ttagsFilterOption.removeClass('active');\n\t\tme.addClass('active');\n\n\t\tvar activeFilters = [];\n\t\t$('.tag_option.active').each(function (i, el) {\n\t\t\tactiveFilters.push($(el).data('filter'));\n\t\t});\n\n\t\t$('.stores .store.' + activeFilters.join('.') + '').removeClass('tag_hide');\n\n\t});\n\n\t// stores search free text\n\tvar searchStoreInput = $('#search_store_free_text');\n\n\tsearchStoreInput.on('change keyup', function () {\n\t\tvar me = $(this);\n\n\t\tif (me.val().length > 0) {\n\t\t\tstores.removeClass('tag_hide');\n\t\t\t$('body').addClass('search_store');\n\t\t} else {\n\t\t\t$('.tag_option.active').trigger('click');\n\t\t\t$('body').removeClass('search_store');\n\t\t}\n\n\t});\n\n\t// product page show more\n\tvar showMoreButton = $('.product-box-show_more');\n\tvar productPageTabs = $('.product_page_tabs');\n\n\t$('a', showMoreButton).on('click', function () {\n\t\tvar btn = $(this);\n\n\t\tif (productPageTabs.hasClass('show_more')) {\n\t\t\tproductPageTabs.removeClass('show_more');\n\t\t\tbtn.html('SHOW MORE');\n\t\t} else {\n\t\t\tproductPageTabs.addClass('show_more');\n\t\t\tbtn.html('SHOW LESS');\n\t\t}\n\t});\n\n\t// filters \n\tif ($('.layered-navigation').length > 0) {\n\t\tvar parent_nav = $('.layered-navigation');\n\n\t\t$('.items', parent_nav).each(function () {\n\t\t\tif ($('.item', $(this)).length > 2) {\n\t\t\t\t$(this).addClass('columns');\n\t\t\t}\n\n\t\t});\n\t}\n\n\t// product page slider count\n\tif ($('.product-page-gallery-thumb').length > 0) {\n\t\tvar gallery_thumb = $('.product-page-gallery-thumb');\n\t\tvar gallery_thumb_count = $('.item', gallery_thumb).length;\n\n\t\tif (gallery_thumb_count == 2) {\n\t\t\tgallery_thumb.addClass('item_2');\n\t\t}\n\n\t\t$(document).on('click', '.swatch-option', function () {\n\t\t\tgallery_thumb.removeClass('item_2');\n\t\t\tgallery_thumb_count = $('.item', gallery_thumb).length;\n\n\t\t\tif (gallery_thumb_count == 2) {\n\t\t\t\tgallery_thumb.addClass('item_2');\n\t\t\t}\n\t\t});\n\t}\n\n\t// product page share button\n\tif ($('.product-share').length > 0 && $('.product-page-gallery-main').length > 0) {\n\t\tvar product_share = $('.product-share');
2\n\t\tvar gallery_main = $('.product-page-gallery-main');\n\t\tgallery_main.wrap('<div class=\"product-page-gallery-main_wrap\"></div>');\n\t\t$('.product-page-gallery-main_wrap').append(product_share);\n\t}\n\n\t// product images count\n\tfunction gelleryCount(){ \n\n\t\tif($('.product-page-gallery-main').length > 0){\n\t\t\tvar slide_count = $('.idus-slider-slide','.product-page-gallery-main').length;\n\t\t\tvar type = 'odd';\n\n\t\t\tif (slide_count % 2 == 0) {\n\t\t\t\ttype = 'even';\n\t\t\t}\n\t\t\t$('.product-page-gallery-main').attr('data-type',type).attr('data-count',slide_count);\n\t\t}\n\t}\n\n\t$(document).on('click','.swatch-option', function(){\n\t\tgelleryCount();\n\t});\n\n\tgelleryCount();\n\n\t// slider scroll\n\tvar slider = $('.idus-slider.is__dynamic');\n\n\tslider.each(function () {\n\t\tvar isDown = false;\n\t\tvar startX;\n\t\tvar scrollLeft = 0;\n\n\t\t$(this).on('mousedown', function (e) {\n\t\t\te.preventDefault();\n\t\t\tisDown = true;\n\t\t\tslider.addClass('active');\n\t\t\tstartX = e.pageX - $(this).offset().left;\n\t\t\tscrollLeft = $(this).scrollLeft();\n\t\t});\n\n\t\t$(this).on('mouseleave', function (e) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tisDown = false;\n\t\t\t\tslider.removeClass('active');\n\t\t\t}, 1000)\n\t\t});\n\n\t\t$(this).on('mouseup', function (e) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tisDown = false;\n\t\t\t\tslider.removeClass('active');\n\t\t\t});\n\t\t});\n\n\t\t$(this).on('mousemove', function (e) {\n\t\t\tif (!isDown) return;\n\t\t\te.preventDefault();\n\t\t\tvar x = e.pageX - $(this).offset().left;\n\t\t\tvar walk = (x - startX) * 3;\n\t\t\t$(this).scrollLeft(scrollLeft - walk);\n\t\t});\n\n\t});\n\n\n\t// custom slider arrows animation\n\tvar customer_service = $('.customer-service-menu-wrap .cms_sidebar');\n\n\tif (customer_service.length > 0) {\n\t\tcustomer_service.addClass('idus-slider-wrapper idus_css3_slider').wrapInner('<div class=\"idus-slider-scroll-wrapper custom-area-navigation-slider\"><div class=\"idus-slider is__dynamic\"></div></div>');\n\t\t$('.idus-slider > div', customer_service).addClass('idus-slider-slide');\n\t}\n\n\tvar custom_slider = $('.custom-area-navigation-slider');\n\n\tif (custom_slider.length > 0) {\n\n\t\tcustom_slider.each(function () {\n\t\t\tvar self = $(this);\n\n\t\t\tself.obj = {\n\t\t\t\tcustom_slider: '.idus-slider',\n\t\t\t\tcustom_item: '.idus-slider-slide',\n\t\t\t\tcustom_arrow_left_append: '<div class=\"custom_arrow custom_arrow_left idus_slider_arrow idus_slider_arrow_left idus_slider_control\" tabindex=\"0\" role=\"button\" aria-label=\"\u05d2\u05dc\u05d9\u05dc\u05d4 \u05e9\u05de\u05d0\u05dc\u05d4\"><span aria-hidden=\"true\">\u05e9\u05de\u05d0\u05dc\u05d4</span></div>',\n\t\t\t\tcustom_arrow_right_append: '<div class=\"custom_arrow custom_arrow_right idus_slider_arrow idus_slider_arrow_right idus_slider_control\" tabindex=\"0\" role=\"button\" aria-label=\"\u05d2\u05dc\u05d9\u05dc\u05d4 \u05d9\u05de\u05d9\u05e0\u05d4\"><span aria-hidden=\"true\">\u05d9\u05de\u05d9\u05e0\u05d4</span></div>'\n\t\t\t};\n\n\t\t\tself.prepend(self.obj.custom_arrow_right_append).append(self.obj.custom_arrow_left_append);\n\n\t\t\tshowArrowSlider($(self.obj.custom_slider, $(self)));\n\n\t\t\t$(window).on('resize', function () {\n\t\t\t\tshowArrowSlider($(self.obj.custom_slider, $(self)));\n\t\t\t});\n\n\t\t\t$('.custom_arrow', self).on('click keydown', function (e) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tif (e.type === 'keydown' && (e.which !== 13 && e.which !== 32)) return false;\n\t\t\t\tvar width = $(self.obj.custom_slider, self).outerWidth();\n\t\t\t\tvar scroll = '-=' + width;\n\n\t\t\t\tif ($(this).hasClass('custom_arrow_right')) {\n\t\t\t\t\tscroll = '+=' + width;\n\t\t\t\t}\n\n\t\t\t\t$('.idus-slider').animate({\n\t\t\t\t\tscrollLeft: scroll\n\t\t\t\t}, 'slow');\n\n\t\t\t});\n\n\t\t});\n\t}\n\n\tfunction showArrowSlider(selector) {\n\t\t$('.custom_arrow', selector.parent()).removeClass('show');\n\n\t\tif (selector[0].scrollWidth > selector.innerWidth()) {\n\t\t\t$('.custom_arrow', selector.parent()).addClass('show');\n\t\t}\n\t}\n\n\t// slide to active slide\n\tvar slideAcrive = $('.idus-slider-slide.active');\n\n\tif(slideAcrive.length > 0){\n\n\t\tslideAcrive.each(function(){\n\t\t\t\n\t\t\tvar scroll = $(this).offset().left;\n\t\t\tvar parent = $(this).parent();\n\t\t\t\n\t\t\t$(parent).animate({\n\t\t\t\tscrollLeft: scroll\n\n\t\t\t}, 'slow');\n\t\t});\n\t}\n\n\t// mincart Options Details\n\tfunction showCartDetails(){\n\t\tvar cartDetails = $('.cart-details');\n\n\t\tif(cartDetails.length){\n\t\t\t\n\t\t\tcartDetails.each(function(){\n\t\t\t\tvar obj = $(this);\n\t\t\t\tvar optionWrap = $('.option_wrap', obj);\n\n\t\t\t\toptionWrap.each(function(index, data){\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tif(!$(data).hasClass('option_0_wrap') && !$(data).hasClass('option_1_wrap')){\n\t\t\t\t\t\t\n\t\t\t\t\t\tobj.addClass('active');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\t\n\t\t\t});\n\n\t\t}\n\t}\n\n\t$('body').on('contentUpdated', function(){\n\t\tshowCartDetails();\n\t});\n\n\n\t// datalayer\n\twindow.googleDataLayerParse = function (event) {\t\n\t\t\n\t\tswitch (event.event) {\n\t\t\t\n\t\t\tcase 'checkout':\n                var step = event.ecommerce.checkout.actionField.step;\n                \n                if (step === 1) {\n               \t\tevent.ecommerce.checkout.actionField.option = '';\n                }\n\n                if (step === 2) {\n               \t\tevent.ecommerce.checkout.actionField.option = event.ecommerce.checkout.actionField.option[0];\n                }\n\n                if(step > 1){\n\n                \twindow.googleDataLayer.push({\n\t\t\t\t\t\tevent: 'checkoutOption',\n\t\t\t\t\t\tecommerce: {\n\t\t\t\t\t\t\tcheckout_option: {\n\t\t\t\t\t\t\t\tactionField: {\n\t\t\t\t\t\t\t\t\tstep: event.ecommerce.checkout.actionField.step,\n\t\t\t\t\t\t\t\t\toption: event.ecommerce.checkout.actionField.option\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n                }\n\n                break;\n\n            case 'checkoutOption':\n              \tvar step = event.ecommerce.checkout_option.step;\n            \t\n            \tif(step === 1){\n\t            \t\n\t            \tvar actionField = {\n\t            \t\tstep: 2,\n\t            \t\toption: event.ecommerce.checkout_option.option\n\t            \t}\n\n\t            \tdelete event.ecommerce.checkout_option.option;\n\t            \tdelete event.ecommerce.checkout_option.step;\n\t\t        \tevent.ecommerce.checkout_option.actionField = actionField;\n\t            }\n\n\t            break;    \t\n\t\t}\n\n\t\tif (event.ecommerce) event.ecommerce.currencyCode = 'ILS';\n    \treturn event;\n\t}\n\n\n\n\n\n    function otpInput(element) {\n        \n        if(!element.classList.contains('split-otp')) return false;\n\n        var inputs = [];\n        element.type = 'hidden';
2\n        var parent = element.parentElement;\n        var maxlength = element.maxLength;\n        if(maxlength <= 0) maxlength = 6;\n        parent.style.direction = 'ltr';\n        for (var i = 0; i < maxlength; i++) {\n            const field = document.createElement('input');\n            field.id = element.id + '_' + i;\n            field.type = 'tel';\n            field.inputmode = 'numeric';\n            field.autocomplete = 'one-time-code';\n            field.style['text-align'] = 'center';\n\n            if(i === 0){\n                field.maxLength = maxlength;\n            }else{\n                field.maxLength = 1;    \n            }\n\n            parent.appendChild(field);\n            inputs[i] = field;\n        }\n\n        const len = inputs.length;\n\n        const pasteCode = (event) => {\n            const input = event.currentTarget;\n            const i = inputs.indexOf(input);\n            if(i !== 0) return;\n            var value = event.clipboardData.getData('Text');\n            autocomplete(value);\n        };\n\n        const inputCode = (event) => {\n            const input = event.currentTarget;\n            const i = inputs.indexOf(input);\n            if(i === 0 && input.value.length > 1){\n                autocomplete(input.value);\n            }else if (input.value && (i+1) % len) inputs[i + 1].focus();\n\n            inputHidden();\n            if(i == maxlength) submit(element);\n        };\n\n        const keydownCode = (event) => {\n            const input = event.currentTarget\n            const i = inputs.indexOf(input);\n            if (!input.value && event.key === 'Backspace' && i) inputs[i - 1].focus();\n\n            inputHidden();\n        };\n\n        const inputHidden = () => {\n            var value = '';\n            [].forEach.call(inputs, (node, index) => {\n                value += node.value;\n            });\n            element.value = value;\n        };\n        \n        const autocomplete = (value) => {\n            var clip = value.replace(/\\s/g, \"\").split('');\n\n            [].forEach.call(inputs, (node, index) => {\n                if(clip[index] != undefined){\n                    node.value = clip[index];\n                    inputs[index].focus();\n                }\n            });\n\n            element.value = value;\n            if(clip.length == inputs.length){\n                submit(element);\n            }\n        };\n\n        const submit = (element) => {\n            var form = element.closest('form');\n            if(form.length){\n                var button = form.querySelectorAll('button[type=submit]');\n                if(button.length){\n                    button[0].click();\n                }\n            }
2else{\n                var parnet = element.parent().parent().parent();\n                $('button:eq(0)', parnet).click();\n            }\n        };\n\n        inputs.forEach(input => {\n            input.addEventListener('paste', pasteCode);\n            input.addEventListener('input', inputCode);\n            input.addEventListener('keydown', keydownCode);\n        });\n\n        element.classList.add('split-otp-done');\n\n        if ('OTPCredential' in window) {\n\n            const ac = new AbortController();\n            navigator.credentials.get({\n                otp: { transport:['sms'] },\n                signal: ac.signal\n            }).then(otp => {\n                var codes = otp.code.split('');\n                for (var i = 0; i < maxlength; i++) {\n                    inputs[i].value = codes[i];\n                    inputs[i].focus();\n                }\n                element.value = otp.code;\n                submit(element);\n            }).catch(err => {\n                console.log(err);\n            });\n        }\n    }\n\t\n\t$('body').on('contentUpdated',function() {\n        var splits = document.querySelectorAll('input.split-otp:not(.split-otp-done)');\n        for (var i = 0, len = splits.length; i < len; i++) {\n            otpInput(splits[i]);\n        }\n    });\n\n\n\twindow.otpInput = otpInput;\n});\n\n\n\n\n\n","js/header.js":"require(['jquery', 'Idus_Core/js/idus', 'domReady!'], function ($, idusHelper) {\n\n\t// $('body').on('contentUpdated', function(){\n    //     var headerContainerEl = document.querySelector('.header-container');\n    //     var headerContainerHeight = headerContainerEl.clientHeight;\n    //     headerContainerEl.closest('.page-header').style.setProperty('--header-container-height', headerContainerHeight + 'px');\n\t// });    \n\n\n});","fotorama/fotorama.js":"/*!\n * Fotorama 4.6.4 | http://fotorama.io/license/\n */\nfotoramaVersion = '4.6.4';\n(function (window, document, location, $, undefined) {\n    \"use strict\";\n    var _fotoramaClass = 'fotorama',\n        _fullscreenClass = 'fotorama__fullscreen',\n\n        wrapClass = _fotoramaClass + '__wrap',\n        wrapCss2Class = wrapClass + '--css2',\n        wrapCss3Class = wrapClass + '--css3',\n        wrapVideoClass = wrapClass + '--video',\n        wrapFadeClass = wrapClass + '--fade',\n        wrapSlideClass = wrapClass + '--slide',\n        wrapNoControl
2sClass = wrapClass + '--no-controls',\n        wrapNoShadowsClass = wrapClass + '--no-shadows',\n        wrapPanYClass = wrapClass + '--pan-y',\n        wrapRtlClass = wrapClass + '--rtl',\n        wrapOnlyActiveClass = wrapClass + '--only-active',\n        wrapNoCaptionsClass = wrapClass + '--no-captions',\n        wrapToggleArrowsClass = wrapClass + '--toggle-arrows',\n\n        stageClass = _fotoramaClass + '__stage',\n        stageFrameClass = stageClass + '__frame',\n        stageFrameVideoClass = stageFrameClass + '--video',\n        stageShaftClass = stageClass + '__shaft',\n\n        grabClass = _fotoramaClass + '__grab',\n        pointerClass = _fotoramaClass + '__pointer',\n\n        arrClass = _fotoramaClass + '__arr',\n        arrDisabledClass = arrClass + '--disabled',\n        arrPrevClass = arrClass + '--prev',\n        arrNextClass = arrClass + '--next',\n\n        navClass = _fotoramaClass + '__nav',\n        navWrapClass = navClass + '-wrap',\n        navShaftClass = navClass + '__shaft',\n        navShaftVerticalClass = navWrapClass + '--vertical',\n        navShaftListClass = navWrapClass + '--list',\n        navShafthorizontalClass = navWrapClass + '--horizontal',\n        navDotsClass = navClass + '--dots',\n        navThumbsClass = navClass + '--thumbs',\n        navFrameClass = navClass + '__frame',\n\n        fadeClass = _fotoramaClass + '__fade',\n        fadeFrontClass = fadeClass + '-front',\n        fadeRearClass = fadeClass + '-rear',\n\n        shadowClass = _fotoramaClass + '__shadow',\n        shadowsClass = shadowClass + 's',\n        shadowsLeftClass = shadowsClass + '--left',\n        shadowsRightClass = shadowsClass + '--right',\n        shadowsTopClass = shadowsClass + '--top',\n        shadowsBottomClass = shadowsClass + '--bottom',\n\n        activeClass = _fotoramaClass + '__active',\n        selectClass = _fotoramaClass + '__select',\n\n        hiddenClass = _fotoramaClass + '--hidden',\n\n        fullscreenClass = _fotoramaClass + '--fullscreen',\n        fullscreenIconClass = _fotoramaClass + '__fullscreen-icon',\n\n        errorClass = _fotoramaClass + '__error',\n        loadingClass = _fotoramaClass + '__loading',\n        loadedClass = _fotoramaClass + '__loaded',\n        loadedFullClass = loadedClass + '--full',\n        loadedImgClass = loadedClass + '--img',\n\n        grabbingClass = _fotoramaClass + '__grabbing',\n\n        imgClass = _fotoramaClass + '__img',\n        imgFullClass = imgClass + '--full',\n\n        thumbClass = _fotoramaClass + '__thumb',\n        thumbArrLeft = thumbClass + '__arr--left',\n        thumbArrRight = thumbClass + '__arr--right',\n        thumbBorderClass = thumbClass + '-border',\n\n        htmlClass = _fotoramaClass + '__html',\n\n        videoContainerClass = _fotoramaClass + '-video-container',\n        videoClass = _fotoramaClass + '__video',\n        videoPlayClass = videoClass + '-play',\n        videoCloseClass = videoClass + '-close',\n\n\n        horizontalImageClass = _fotoramaClass + '_horizontal_ratio',\n        verticalImageClass = _fotoramaClass + '_vertical_ratio',\n        fotoramaSpinnerClass = _fotoramaClass + '__spinner',\n        spinnerShowClass = fotoramaSpinnerClass + '--show';\n    var JQUERY_VERSION = $ && $.fn.jquery.split('.');\n\n    if (!JQUERY_VERSION\n        || JQUERY_VERSION[0] < 1\n        || (JQUERY_VERSION[0] == 1 && JQUERY_VERSION[1] < 8)) {\n        throw 'Fotorama requires jQuery 1.8 or later and will not run without it.';\n    }\n\n    var _ = {};\n    /* Modernizr 2.8.3 (Custom Build) | MIT & BSD\n     * Build: http://modernizr.com/download/#-csstransforms3d-csstransitions-touch-prefixed\n     */\n\n    var Modernizr = (function (window, document, undefined) {\n        var version = '2.8.3',\n            Modernizr = {},\n\n\n            docElement = document.documentElement,\n\n            mod = 'modernizr',\n            modElem = document.createElement(mod),\n            mStyle = modElem.style,\n            inputElem,\n\n\n            toString = {}.toString,\n\n            prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),\n\n\n            omPrefixes = 'Webkit Moz O ms',\n\n            cssomPrefixes = omPrefixes.split(' '),\n\n            domPrefixes = omPrefixes.toLowerCase().split(' '),\n\n\n            tests = {},\n            inputs = {},\n            attrs = {},\n\n            classes = [],\n\n            slice = classes.slice,\n\n            featureName,\n\n\n            injectElementWithStyles = function (rule, callback, nodes, testnames) {\n\n                var style, ret, node, docOverflow,\n                    div = document.createElement('div'),\n                    body = document.body,\n                    fakeBody = body || document.createElement('body');\n\n                if (parseInt(nodes, 10)) {\n                    while (nodes--) {\n                        node = document.createElement('div');\n                        node.id = testnames ? testnames[nodes] : mod + (nodes + 1);\n                        div.appendChild(node);\n                    }\n                }\n\n                style = ['&#173;', '<style id=\"s', mod, '\">', rule, '</style>'].join('');\n                div.id = mod;\n                (body ? div : fakeBody).innerHTML += style;\n                fakeBody.appendChild(div);\n                if (!body) {\n                    fakeBody.style.background = '';\n                    fakeBody.style.overflow = 'hidden';
2\n                    docOverflow = docElement.style.overflow;\n                    docElement.style.overflow = 'hidden';\n                    docElement.appendChild(fakeBody);\n                }\n\n                ret = callback(div, rule);\n                if (!body) {\n                    fakeBody.parentNode.removeChild(fakeBody);\n                    docElement.style.overflow = docOverflow;\n                } else {\n                    div.parentNode.removeChild(div);\n                }\n\n                return !!ret;\n\n            },\n            _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;\n\n        if (!is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined')) {\n            hasOwnProp = function (object, property) {\n                return _hasOwnProperty.call(object, property);\n            };\n        }\n        else {\n            hasOwnProp = function (object, property) {\n                return ((property in object) && is(object.constructor.prototype[property], 'undefined'));\n            };\n        }\n\n\n        if (!Function.prototype.bind) {\n            Function.prototype.bind = function bind(that) {\n\n                var target = this;\n\n                if (typeof target != \"function\") {\n                    throw new TypeError();\n                }\n\n                var args = slice.call(arguments, 1),\n                    bound = function () {\n\n                        if (this instanceof bound) {\n\n                            var F = function () {\n                            };\n                            F.prototype = target.prototype;\n                            var self = new F();\n\n                            var result = target.apply(\n                                self,\n                                args.concat(slice.call(arguments))\n                            );\n                            if (Object(result) === result) {\n                                return result;\n                            }\n                            return self;\n\n                        } else {\n\n                            return target.apply(\n                                that,\n                                args.concat(slice.call(arguments))\n                            );\n\n                        }\n\n                    };\n\n                return bound;\n            };\n        }\n\n        function setCss(str) {\n            mStyle.cssText = str;\n        }\n\n        function setCssAll(str1, str2) {\n            return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));\n        }\n\n        function is(obj, type) {\n            return typeof obj === type;\n        }\n\n        function contains(str, substr) {\n            return !!~('' + str).indexOf(substr);\n        }\n\n        function testProps(props, prefixed) {\n            for (var i in props) {\n                var prop = props[i];\n                if (!contains(prop, \"-\") && mStyle[prop] !== undefined) {\n                    return prefixed == 'pfx' ? prop : true;\n                }\n            }\n            return false;\n        }\n\n        function testDOMProps(props, obj, elem) {\n            for (var i in props) {\n                var item = obj[props[i]];\n                if (item !== undefined) {\n\n                    if (elem === false) return props[i];\n\n                    if (is(item, 'function')) {\n                        return item.bind(elem || obj);\n                    }\n\n                    return item;\n                }\n            }\n            return false;\n        }\n\n        function testPropsAll(prop, prefixed, elem) {\n\n            var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),\n                props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');\n\n            if (is(prefixed, \"string\") || is(prefixed, \"undefined\")) {\n                return testProps(props, prefixed);\n\n            } else {\n                props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');\n                return testDOMProps(props, prefixed, elem);\n            }\n        }\n\n        tests['touch'] = function () {\n            var bool;\n\n            if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {\n                bool = true;\n            } else {\n                injectElementWithStyles(['@media (', prefixes.join('touch-enabled),('), mod, ')', '{#modernizr{top:9px;position:absolute}}'].join(''), function (node) {\n                    bool = node.offsetTop === 9;\n                });\n            }\n\n            return bool;\n        };\n        tests['csstransforms3d'] = function () {\n\n            var ret = !!testPropsAll('perspective');\n\n            if (ret && 'webkitPerspective' in docElement.style) {\n\n                injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function (node, rule) {\n                    ret = node.offsetLeft === 9 && node.offsetHeight === 3;\n                });\n            }\n            return ret;\n        };\n\n\n        tests['csstransitions'] = function () {\n            return testPropsAll('transition');\n        };\n\n\n        for (var feature in tests) {\n            if (hasOwnProp(tests, feature)) {\n                featureName = feature.toLowerCase();\n                Modernizr[featureName] = tests[feature]();\n\n                classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);\n            }\n        }\n\n\n        Modernizr.addTest = function (feature, test) {\n            if (typeof feature == 'object') {\n                for (var key in feature) {\n                    if (hasOwnProp(feature, key)) {\n                        Modernizr.addTest(key, feature[key]);\n                    }\n                }\n            } else {\n\n                feature = feature.toLowerCase();\n\n                if (Modernizr[feature] !== undefined) {\n                    return Modernizr;\n                }\n\n                test = typeof test == 'function' ? test() : test;\n\n                if (typeof enableClasses !== \"undefined\" && enableClasses) {\n                    docElement.className += ' ' + (test ? '' : 'no-') + feature;\n                }\n                Modernizr[feature] = test;\n\n            }\n\n            return Modernizr;\n        };\n\n\n        setCss('');\n        modElem = inputElem = null;\n\n\n        Modernizr._version = version;\n\n        Modernizr._prefixes = prefixes;\n        Modernizr._domPrefixes = domPrefixes;\n        Modernizr._cssomPrefixes = cssomPrefixes;\n\n\n        Modernizr.testProp = function (prop) {\n            return testProps([prop]);\n        };\n\n        Modernizr.testAllProps = testPropsAll;\n        Modernizr.testStyles = injectElementWithStyles;\n        Modernizr.prefixed = function (prop, obj, elem) {\n            if (!obj) {\n                return testPropsAll(prop, 'pfx');\n            } else {\n                return testPropsAll(prop, obj, elem);\n            }\n        };\n        return Modernizr;\n    })(window, document);\n\n    var fullScreenApi = {\n            ok: false,\n            is: function () {\n                return false;\n            },\n            request: function () {\n            },\n            cancel: function () {\n            },\n            event: '',\n            prefix: ''\n        },\n        browserPrefixes = 'webkit moz o ms khtml'.split(' ');\n\n// check for native support\n    if (typeof document.cancelFullScreen != 'undefined') {\n        fullScreenApi.ok = true;\n    } else {\n        // check for fullscreen support by vendor prefix\n        for (var i = 0, il = browserPrefixes.length; i < il;
2 i++) {\n            fullScreenApi.prefix = browserPrefixes[i];\n            if (typeof document[fullScreenApi.prefix + 'CancelFullScreen'] != 'undefined') {\n                fullScreenApi.ok = true;\n                break;\n            }\n        }\n    }\n\n// update methods to do something useful\n    if (fullScreenApi.ok) {\n        fullScreenApi.event = fullScreenApi.prefix + 'fullscreenchange';\n        fullScreenApi.is = function () {\n            switch (this.prefix) {\n                case '':\n                    return document.fullScreen;\n                case 'webkit':\n                    return document.webkitIsFullScreen;\n                default:\n                    return document[this.prefix + 'FullScreen'];\n            }\n        };\n        fullScreenApi.request = function (el) {\n            return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();\n        };\n        fullScreenApi.cancel = function (el) {\n            return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();\n        };\n    }\n    /* Bez v1.0.10-g5ae0136\n     * http://github.com/rdallasgray/bez\n     *\n     * A plugin to convert CSS3 cubic-bezier co-ordinates to jQuery-compatible easing functions\n     *\n     * With thanks to Nikolay Nemshilov for clarification on the cubic-bezier maths\n     * See http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html\n     *\n     * Copyright 2011 Robert Dallas Gray. All rights reserved.\n     * Provided under the FreeBSD license: https://github.com/rdallasgray/bez/blob/master/LICENSE.txt\n     */\n    function bez(coOrdArray) {\n        var encodedFuncName = \"bez_\" + $.makeArray(arguments).join(\"_\").replace(\".\", \"p\");\n        if (typeof $['easing'][encodedFuncName] !== \"function\") {\n            var polyBez = function (p1, p2) {\n                var A = [null, null],\n                    B = [null, null],\n                    C = [null, null],\n                    bezCoOrd = function (t, ax) {\n                        C[ax] = 3 * p1[ax];\n                        B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax];\n                        A[ax] = 1 - C[ax] - B[ax];\n                        return t * (C[ax] + t * (B[ax] + t * A[ax]));\n                    },\n                    xDeriv = function (t) {\n                        return C[0] + t * (2 * B[0] + 3 * A[0] * t);\n                    },\n                    xForT = function (t) {\n                        var x = t, i = 0, z;\n                        while (++i < 14) {\n                            z = bezCoOrd(x, 0) - t;\n                            if (Math.abs(z) < 1e-3) break;\n                            x -= z / xDeriv(x);\n                        }\n                        return x;\n                    };\n                return function (t) {\n                    return bezCoOrd(xForT(t), 1);\n                }\n            };\n            $['easing'][encodedFuncName] = function (x, t, b, c, d) {\n                return c * polyBez([coOrdArray[0], coOrdArray[1]], [coOrdArray[2], coOrdArray[3]])(t / d) + b;\n            }\n        }\n        return encodedFuncName;\n    }\n\n    var $WINDOW = $(window),\n        $DOCUMENT = $(document),\n        $HTML,\n        $BODY,\n\n        QUIRKS_FORCE = location.hash.replace('#', '') === 'quirks',\n        TRANSFORMS3D = Modernizr.csstransforms3d,\n        CSS3 = TRANSFORMS3D && !QUIRKS_FORCE,\n        COMPAT = TRANSFORMS3D || document.compatMode === 'CSS1Compat',\n        FULLSCREEN = fullScreenApi.ok,\n\n        MOBILE = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),\n        SLOW = !CSS3 || MOBILE,\n\n        MS_POINTER = navigator.msPointerEnabled,\n\n        WHEEL = \"onwheel\" in document.createElement(\"div\") ? \"wheel\" : document.onmousewheel !== undefined ? \"mousewheel\" : \"DOMMouseScroll\",\n\n        TOUCH_TIMEOUT = 250,\n        TRANSITION_DURATION = 300,\n\n        SCROLL_LOCK_TIMEOUT = 1400,\n\n        AUTOPLAY_INTERVAL = 5000,\n        MARGIN = 2,\n        THUMB_SIZE = 64,\n\n        WIDTH = 500,\n        HEIGHT = 333,\n\n        STAGE_FRAME_KEY = '$stageFrame',\n        NAV_DOT_FRAME_KEY = '$navDotFrame',\n        NAV_THUMB_FRAME_KEY = '$navThumbFrame',\n\n        AUTO = 'auto',\n\n        BEZIER = bez([.1, 0, .25, 1]),\n\n        MAX_WIDTH = 1200,\n\n        /**\n         * Number of thumbnails in slide. Calculated only on setOptions and resize.\n         * @type {number}\n         */\n        thumbsPerSlide = 1,\n\n        OPTIONS = {\n\n            /**\n             * Set width for gallery.\n             * Default value - width of first image\n             * Number - set value in px\n             * String - set value in quotes\n             *\n             */\n            width: null,\n\n            /**\n             * Set min-width for gallery\n             *\n             */\n            minwidth: null,\n\n            /**\n             * Set max-width for gallery\n             *\n             */\n            maxwidth: '100%',\n\n            /**\n             * Set height for gallery\n             * Default value - height of first image\n             * Number - set value in px\n             * String - set value in quotes\n             *\n             */\n            height: null,\n\n            /**\n             * Set min-height for gallery\n             *\n             */\n            minheight: null,\n\n            /**\n             * Set max-height for gallery\n             *\n             */\n            maxheight: null,\n\n            /**\n             * Set proportion ratio for gallery depen
2ds of image\n             *\n             */\n            ratio: null, // '16/9' || 500/333 || 1.5\n\n            margin: MARGIN,\n\n            nav: 'dots', // 'thumbs' || false\n            navposition: 'bottom', // 'top'\n            navwidth: null,\n            thumbwidth: THUMB_SIZE,\n            thumbheight: THUMB_SIZE,\n            thumbmargin: MARGIN,\n            thumbborderwidth: MARGIN,\n\n            allowfullscreen: false, // true || 'native'\n\n            transition: 'slide', // 'crossfade' || 'dissolve'\n            clicktransition: null,\n            transitionduration: TRANSITION_DURATION,\n\n            captions: true,\n\n            startindex: 0,\n\n            loop: false,\n\n            autoplay: false,\n            stopautoplayontouch: true,\n\n            keyboard: false,\n\n            arrows: true,\n            click: true,\n            swipe: false,\n            trackpad: false,\n\n            shuffle: false,\n\n            direction: 'ltr', // 'rtl'\n\n            shadows: true,\n\n            showcaption: true,\n\n            /**\n             * Set type of thumbnail navigation\n             */\n            navdir: 'horizontal',\n\n            /**\n             * Set configuration to show or hide arrows in thumb navigation\n             */\n            navarrows: true,\n\n            /**\n             * Set type of navigation. Can be thumbs or slides\n             */\n            navtype: 'thumbs'\n\n        },\n\n        KEYBOARD_OPTIONS = {\n            left: true,\n            right: true,\n            down: true,\n            up: true,\n            space: false,\n            home: false,\n            end: false\n        };\n\n    function noop() {\n    }\n\n    function minMaxLimit(value, min, max) {\n        return Math.max(isNaN(min) ? -Infinity : min, Math.min(isNaN(max) ? Infinity : max, value));\n    }\n\n    function readTransform(css, dir) {\n        return css.match(/ma/) && css.match(/-?\\d+(?!d)/g)[css.match(/3d/) ?\n                (dir === 'vertical' ? 13 : 12) : (dir === 'vertical' ? 5 : 4)\n                ]\n    }\n\n    function readPosition($el, dir) {\n        if (CSS3) {\n            return +readTransform($el.css('transform'), dir);\n        } else {\n            return +$el.css(dir === 'vertical' ? 'top' : 'left').replace('px', '');\n        }\n    }\n\n    function getTranslate(pos, direction) {\n        var obj = {};\n\n        if (CSS3) {\n\n            switch (direction) {\n                case 'vertical':\n                    obj.transform = 'translate3d(0, ' + (pos) + 'px,0)';\n                    break;\n                case 'list':\n                    break;\n                default :\n                    obj.transform = 'translate3d(' + (pos) + 'px,0,0)';\n                    break;\n            }\n        } else {\n            direction === 'vertical' ?\n                obj.top = pos :\n                obj.left = pos;\n        }\n        return obj;\n    }\n\n    function getDuration(time) {\n        return {'transition-duration': time + 'ms'};\n    }\n\n    function unlessNaN(value, alternative) {\n        return isNaN(value) ? alternative : value;\n    }\n\n    function numberFromMeasure(value, measure) {\n        return unlessNaN(+String(value).replace(measure || 'px', ''));\n    }\n\n    function numberFromPercent(value) {\n        return /%$/.test(value) ? numberFromMeasure(value, '%') : undefined;\n    }\n\n    function numberFromWhatever(value, whole) {\n        return unlessNaN(numberFromPercent(value) / 100 * whole, numberFromMeasure(value));\n    }\n\n    function measureIsValid(value) {\n        return (!isNaN(numberFromMeasure(value)) || !isNaN(numberFromMeasure(value, '%'))) && value;\n    }\n\n    function getPosByIndex(index, side, margin, baseIndex) {\n\n        return (index - (baseIndex || 0)) * (side + (margin || 0));\n    }\n\n    function getIndexByPos(pos, side, margin, baseIndex) {\n        return -Math.round(pos / (side + (margin || 0)) - (baseIndex || 0));\n    }\n\n    function bindTransitionEnd($el) {\n        var elData = $el.data();\n\n        if (elData.tEnd) return;\n\n        var el = $el[0],\n            transitionEndEvent = {\n                WebkitTransition: 'webkitTransitionEnd',\n                MozTransition: 'transitionend',\n                OTransition: 'oTransitionEnd otransitionend',\n                msTransition: 'MSTransitionEnd',\n                transition: 'transitionend'\n            };\n        addEvent(el, transitionEndEvent[Modernizr.prefixed('transition')], function (e) {\n            elData.tProp && e.propertyName.match(elData.tProp) && elData.onEndFn();\n        });\n        elData.tEnd = true;\n    }\n\n    function afterTransition($el, property, fn, time) {\n        var ok,\n            elData = $el.data();\n\n        if (elData) {\n            elData.onEndFn = function () {\n                if (ok) return;\n                ok = true;\n                clearTimeout(elData.tT);\n                fn();\n            };\n            elData.tProp = property;\n\n            // Passive call, just in case of fail of native transition-end event\n            clearTimeout(elData.tT);\n            elData.tT = setTimeout(function () {\n                elData.onEndFn();\n            }, time * 1.5);\n\n            bindTransitionEnd($el);\n        }\n    }\n\n\n    function stop($el, pos/*, _001*/) {\n        var dir = $el.navdir || 'horizontal';\n        if ($el.length) {\n            var elData = $el.data();\n            if (CSS3) {\n                $el.css(getDuration(0));\n                elData.onEndFn = noop;\n                clearTimeout(elData.tT);\n            } else {\n                $el.stop();\n            }\n            var lockedPos = getNumber(pos, function () {\n                return readPosition($el, dir);\n            });\n\n            $el.css(getTranslate(lockedPos, dir/*, _001*/));//.width(); // `.width()` for reflow\n            return lockedPos;\n        }\n    }\n\n    function getNumber() {\n        var number;\n        for (var _i = 0, _l = arguments.length; _i < _l;
2 _i++) {\n            number = _i ? arguments[_i]() : arguments[_i];\n            if (typeof number === 'number') {\n                break;\n            }\n        }\n\n        return number;\n    }\n\n    function edgeResistance(pos, edge) {\n        return Math.round(pos + ((edge - pos) / 1.5));\n    }\n\n    function getProtocol() {\n        getProtocol.p = getProtocol.p || (location.protocol === 'https:' ? 'https://' : 'http://');\n        return getProtocol.p;\n    }\n\n    function parseHref(href) {\n        var a = document.createElement('a');\n        a.href = href;\n        return a;\n    }\n\n    function findVideoId(href, forceVideo) {\n        if (typeof href !== 'string') return href;\n        href = parseHref(href);\n\n        var id,\n            type;\n\n        if (href.host.match(/youtube\\.com/) && href.search) {\n            //.log();\n            id = href.search.split('v=')[1];\n            if (id) {\n                var ampersandPosition = id.indexOf('&');\n                if (ampersandPosition !== -1) {\n                    id = id.substring(0, ampersandPosition);\n                }\n                type = 'youtube';\n            }\n        } else if (href.host.match(/youtube\\.com|youtu\\.be|youtube-nocookie.com/)) {\n            id = href.pathname.replace(/^\\/(embed\\/|v\\/)?/, '').replace(/\\/.*/, '');\n            type = 'youtube';\n        } else if (href.host.match(/vimeo\\.com/)) {\n            type = 'vimeo';\n            id = href.pathname.replace(/^\\/(video\\/)?/, '').replace(/\\/.*/, '');\n        }\n\n        if ((!id || !type) && forceVideo) {\n            id = href.href;\n            type = 'custom';\n        }\n\n        return id ? {id: id, type: type, s: href.search.replace(/^\\?/, ''), p: getProtocol()} : false;\n    }\n\n    function getVideoThumbs(dataFrame, data, fotorama) {\n        var img, thumb, video = dataFrame.video;\n        if (video.type === 'youtube') {\n            thumb = getProtocol() + 'img.youtube.com/vi/' + video.id + '/default.jpg';\n            img = thumb.replace(/\\/default.jpg$/, '/hqdefault.jpg');\n            dataFrame.thumbsReady = true;\n        } else if (video.type === 'vimeo') {\n            $.ajax({\n                url: getProtocol() + 'vimeo.com/api/v2/video/' + video.id + '.json',\n                dataType: 'jsonp',\n                success: function (json) {\n                    dataFrame.thumbsReady = true;\n                    updateData(data, {\n                        img: json[0].thumbnail_large,\n                        thumb: json[0].thumbnail_small\n                    }, dataFrame.i, fotorama);\n                }\n            });\n        } else {\n            dataFrame.thumbsReady = true;\n        }\n\n        return {\n            img: img,\n            thumb: thumb\n        }\n    }\n\n    function updateData(data, _dataFrame, i, fotorama) {\n        for (var _i = 0, _l = data.length; _i < _l; _i++) {\n            var dataFrame = data[_i];\n\n            if (dataFrame.i === i && dataFrame.thumbsReady) {\n                var clear = {videoReady: true};\n                clear[STAGE_FRAME_KEY] = clear[NAV_THUMB_FRAME_KEY] = clear[NAV_DOT_FRAME_KEY] = false;\n\n                fotorama.splice(_i, 1, $.extend(\n                    {},\n                    dataFrame,\n                    clear,\n                    _dataFrame\n                ));\n\n                break;\n            }\n        }\n    }\n\n    function getDataFromHtml($el) {\n        var data = [];\n\n        function getDataFromImg($img, imgData, checkVideo) {\n            var $child = $img.children('img').eq(0),\n                _imgHref = $img.attr('href'),\n                _imgSrc = $img.attr('src'),\n                _thumbSrc = $child.attr('src'),\n                _video = imgData.video,\n                video = checkVideo ? findVideoId(_imgHref, _video === true) : false;\n\n            if (video) {\n                _imgHref = false;\n            } else {\n                video = _video;\n            }\n\n            getDimensions($img, $child, $.extend(imgData, {\n                video: video,\n                img: imgData.img || _imgHref || _imgSrc || _thumbSrc,\n                thumb: imgData.thumb || _thumbSrc || _imgSrc || _imgHref\n            }));\n        }\n\n        function getDimensions($img, $child, imgData) {\n            var separateThumbFLAG = imgData.thumb && imgData.img !== imgData.thumb,\n                width = numberFromMeasure(imgData.width || $img.attr('width')),\n                height = numberFromMeasure(imgData.height || $img.attr('height'));\n\n            $.extend(imgData, {\n                width: width,\n                height: height,\n                thumbratio: getRatio(imgData.thumbratio || (numberFromMeasure(imgData.thumbwidth || ($child && $child.attr('width')) || separateThumbFLAG || width) / numberFromMeasure(imgData.thumbheight || ($child && $child.attr('height')) || separateThumbFLAG || height)))\n            });\n        }\n\n        $el.children().each(function () {\n            var $this = $(this),\n                dataFrame = optionsToLowerCase($.extend($this.data(), {id: $this.attr('id')}));\n            if ($this.is('a, img')) {\n                getDataFromImg($this, dataFrame, true);\n            } else if (!$this.is(':empty')) {\n                getDimensions($this, null, $.extend(dataFrame, {\n                    html: this,\n                    _html: $this.html() // Because of IE\n                }));\n            } else return;\n\n            data.push(dataFrame);\n        });\n\n        return data;\n    }\n\n    function isHidden(el) {\n        return el.offsetWidth === 0 && el.offsetHeight === 0;\n    }\n\n    function isDetached(el) {\n        return !$.contains(document.documentElement, el);\n    }\n\n    function waitFor(test, fn, timeout, i) {\n        if (!waitFor.i) {\n            waitFor.i = 1;\n            waitFor.ii = [true];\n        }\n\n        i = i || waitFor.i;\n\n        if (typeof waitFor.ii[i] === 'undefined') {\n            waitFor.ii[i] = true;\n        }\n\n        if (test()) {\n            fn();\n        } else {\n            waitFor.ii[i] && setTimeout(function () {\n                waitFor.ii[i] && waitFor(test, fn, timeout, i);\n            }, timeout || 100);\n        }\n\n        return waitFor.i++;\n    }\n\n    waitFor.stop = function (i) {\n        waitFor.ii[i] = false;\n    };\n\n    function fit($el, measuresToFit) {\n        var elData = $el.data(),\n            measures = elData.measures;\n\n        if (measures && (!elData.l ||\n            elData.l.W !== measures.width ||\n            elData.l.H !== measures.height ||\n            elData.l.r !== measures.ratio ||\n            elData.l.w !== measuresToFit.w ||\n            elData.l.h !== measuresToFit.h)) {\n\n            var height = minMaxLimit(measuresToFit.h, 0, measures.height),\n                width = height * measures.ratio;\n\n            UTIL.setRatio($el, width, height);\n\n            elData.l = {\n                W: measures.width,\n                H: measures.height,\n                r: measures.ratio,\n                w: measuresToFit.w,\n                h: measuresToFit.h\n            };\n        }\n\n        return true;\n    }\n\n    function setStyle($el, style) {\n        var el = $el[0];\n        if (el.styleSheet) {\n            el.styleSheet.cssText = style;\n        } else {\n            $el.html(style);\n        }\n    }\n\n    function findShadowEdge(pos, min, max, dir) {\n        return min === max ? false :\n            dir === 'vertical' ?\n                (pos <= min ? 'top' : pos >= max ? 'bottom' : 'top bottom') :\n                (pos <= min ? 'left' : pos >= max ? 'right' : 'left right');\n    }\n\n    function smartClick($el, fn, _options) {\n        _options = _options || {};\n\n        $el.each(function () {\n            var $this = $(this),\n                thisData = $this.data(),\n                startEvent;\n\n            if (thisData.clickOn) return;\n\n            thisData.clickOn = true;\n\n            $.extend(touch($this, {\n                onStart: function (e) {\n                    startEvent = e;\n                    (_options.onStart || noop).call(this, e);\n                },\n                onMove: _options.onMove || noop,\n                onTouchEnd: _options.onTouchEnd || noop,\n                onEnd: function (result) {\n                    if (result.moved) return;\n                    fn.call(this, startEvent);\n                }\n            }), {noMove: true});\n        });\n    }\n\n    function div(classes, child) {\n        return '<div class=\"' + classes + '\">' + (child || '') + '</div>';\n    }\n\n\n    /**\n     * Function transforming into valid classname\n     * @param className - name of the class\n     * @returns {string} - dom format of class name\n     */\n    function cls(className) {\n        return \".\" + className;
2\n    }\n\n    /**\n     *\n     * @param {json-object} videoItem Parsed object from data.video item or href from link a in input dates\n     * @returns {string} DOM view of video iframe\n     */\n    function createVideoFrame(videoItem) {\n        var frame = '<iframe src=\"' + videoItem.p + videoItem.type + '.com/embed/' + videoItem.id + '\" frameborder=\"0\" allowfullscreen></iframe>';\n        return frame;\n    }\n\n// Fisher\u2013Yates Shuffle\n// http://bost.ocks.org/mike/shuffle/\n    function shuffle(array) {\n        // While there remain elements to shuffle\n        var l = array.length;\n        while (l) {\n            // Pick a remaining element\n            var i = Math.floor(Math.random() * l--);\n\n            // And swap it with the current element\n            var t = array[l];\n            array[l] = array[i];\n            array[i] = t;\n        }\n\n        return array;\n    }\n\n    function clone(array) {\n        return Object.prototype.toString.call(array) == '[object Array]'\n            && $.map(array, function (frame) {\n                return $.extend({}, frame);\n            });\n    }\n\n    function lockScroll($el, left, top) {\n        $el\n            .scrollLeft(left || 0)\n            .scrollTop(top || 0);\n    }\n\n    function optionsToLowerCase(options) {\n        if (options) {\n            var opts = {};\n            $.each(options, function (key, value) {\n                opts[key.toLowerCase()] = value;\n            });\n\n            return opts;\n        }\n    }\n\n    function getRatio(_ratio) {\n        if (!_ratio) return;\n        var ratio = +_ratio;\n        if (!isNaN(ratio)) {\n            return ratio;\n        } else {\n            ratio = _ratio.split('/');\n            return +ratio[0] / +ratio[1] || undefined;\n        }\n    }\n\n    function addEvent(el, e, fn, bool) {\n        if (!e) return;\n        el.addEventListener ? el.addEventListener(e, fn, !!bool) : el.attachEvent('on' + e, fn);\n    }\n\n    /**\n     *\n     * @param position guess position for navShaft\n     * @param restriction object contains min and max values for position\n     * @returns {*} filtered value of position\n     */\n    function validateRestrictions(position, restriction) {\n        if (position > restriction.max) {\n            position = restriction.max;\n        } else {\n            if (position < restriction.min) {\n                position = restriction.min;\n            }\n        }\n        return position;\n    }\n\n    function validateSlidePos(opt, navShaftTouchTail, guessIndex, offsetNav, $guessNavFrame, $navWrap, dir) {\n        var position,\n            size,\n            wrapSize;\n        if (dir === 'horizontal') {\n            size = opt.thumbwidth;\n            wrapSize = $navWrap.width();\n        } else {\n            size = opt.thumbheight;\n            wrapSize = $navWrap.height();\n        }\n        if ( (size + opt.margin) * (guessIndex + 1) >= (wrapSize - offsetNav) ) {\n            if (dir === 'horizontal') {\n                position = -$guessNavFrame.position().left;\n            } else {\n                position = -$guessNavFrame.position().top;\n            }\n        } else {\n            if ((size + opt.margin) * (guessIndex) <= Math.abs(offsetNav)) {\n                if (dir === 'horizontal') {\n                    position = -$guessNavFrame.position().left + wrapSize - (size + opt.margin);\n                } else {\n                    position = -$guessNavFrame.position().top + wrapSize - (size + opt.margin);\n                }\n            } else {\n                position = offsetNav;\n            }\n        }\n        position = validateRestrictions(position, navShaftTouchTail);\n\n        return position || 0;\n    }\n\n    function elIsDisabled(el) {\n        return !!el.getAttribute('disabled');\n    }\n\n    function disableAttr(FLAG, disable) {\n        if (disable) {\n            return {disabled: FLAG};\n        } else {\n            return {tabindex: FLAG * -1 + '', disabled: FLAG};\n\n        }\n    }\n\n    function addEnterUp(el, fn) {\n        addEvent(el, 'keyup', function (e) {\n            elIsDisabled(el) || e.keyCode == 13 && fn.call(el, e);\n        });\n    }\n\n    function addFocus(el, fn) {\n        addEvent(el, 'focus', el.onfocusin = function (e) {\n            fn.call(el, e);\n        }, true);\n    }\n\n    function stopEvent(e, stopPropagation) {\n        e.preventDefault ? e.preventDefault() : (e.returnValue = false);\n        stopPropagation && e.stopPropagation && e.stopPropagation();\n    }\n\n    function stubEvent($el, eventType) {\n        var isIOS = /ip(ad|hone|od)/i.test(window.navigator.userAgent);\n\n        if (isIOS && eventType === 'touchend') {\n            $el.on('touchend', function(e){\n                $DOCUMENT.trigger('mouseup', e);\n            })\n        }\n\n        $el.on(eventType, function (e) {\n            stopEvent(e, true);\n\n            return false;\n        });\n    }\n\n    function getDirectionSign(forward) {\n        return forward ? '>' : '<';\n    }\n\n    var UTIL = (function () {\n\n        function setRatioClass($el, wh, ht) {\n            var rateImg = wh / ht;\n\n            if (rateImg <= 1) {\n                $el.parent().removeClass(horizontalImageClass);\n                $el.parent().addClass(verticalImageClass);\n            } else {\n                $el.parent().removeClass(verticalImageClass);\n                $el.parent().addClass(horizontalImageClass);\n            }\n        }\n\n        /**\n         * Set specific attribute in thumbnail template\n         * @param $frame DOM item of specific thumbnail\n         * @param value Value which must be setted into specific attribute\n         * @param searchAttr Name of attribute where value must be included\n         */\n        function setThumbAttr($frame, value, searchAttr) {\n            var attr = searchAttr;\n\n            if (!$frame.attr(attr) && $frame.attr(attr) !== undefined) {\n                $frame.attr(attr, value);\n            }\n\n            if ($frame.find(\"[\" + attr + \"]\").length) {\n                $frame.find(\"[\" + attr + \"]\")\n                    .each(function () {\n                        $(this).attr(attr, value);\n                    });\n            }\n        }\n\n        /**\n         * Method describe behavior need to render caption on preview or not\n         * @param frameItem specific item from data\n         * @param isExpected {bool} if items with caption need render them or not\n         * @returns {boolean} if true then caption should be rendered\n         */\n        function isExpectedCaption(frameItem, isExpected, undefined) {\n            var expected = false,\n                frameExpected;\n\n            frameItem.showCaption === undefined || frameItem.showCaption === true ? frameExpected = true : frameExpected = false;\n\n            if (!isExpected) {\n                return false;\n            }\n\n            if (frameItem.caption && frameExpected) {\n                expected = true;\n            }\n\n            return expected;\n        }\n\n        return {\n            setRatio: setRatioClass,\n            setThumbAttr: setThumbAttr,\n            isExpectedCaption: isExpectedCaption\n        };\n\n    }(UTIL || {}, jQuery));\n\n    function slide($el, options) {\n        var elData = $el.data(),\n            elPos = Math.round(options.pos),\n            onEndFn = function () {\n                if (elData && elData.sliding) {\n                    elData.sliding = false;\n                }\n                (options.onEnd || noop)();\n            };\n\n        if (typeof options.overPos !== 'undefined' && options.overPos !== options.pos) {\n            elPos = options.overPos;\n        }\n\n        var translate = $.extend(getTranslate(elPos, options.direction), options.width && {width: options.width}, options.height && {height: options.height});\n        if (elData && elData.sliding) {\n            elData.sliding = true;\n        }\n\n        if (CSS3) {\n            $el.css($.extend(getDuration(options.time), translate));\n\n            if (options.time > 10) {\n                afterTransition($el, 'transform', onEndFn, options.time);\n            } else {\n                onEndFn();\n            }\n        } else {\n            $el.stop().animate(translate, options.time, BEZIER, onEndFn);\n        }\n    }
2\n\n    function fade($el1, $el2, $frames, options, fadeStack, chain) {\n        var chainedFLAG = typeof chain !== 'undefined';\n        if (!chainedFLAG) {\n            fadeStack.push(arguments);\n            Array.prototype.push.call(arguments, fadeStack.length);\n            if (fadeStack.length > 1) return;\n        }\n\n        $el1 = $el1 || $($el1);\n        $el2 = $el2 || $($el2);\n\n        var _$el1 = $el1[0],\n            _$el2 = $el2[0],\n            crossfadeFLAG = options.method === 'crossfade',\n            onEndFn = function () {\n                if (!onEndFn.done) {\n                    onEndFn.done = true;\n                    var args = (chainedFLAG || fadeStack.shift()) && fadeStack.shift();\n                    args && fade.apply(this, args);\n                    (options.onEnd || noop)(!!args);\n                }\n            },\n            time = options.time / (chain || 1);\n\n        $frames.removeClass(fadeRearClass + ' ' + fadeFrontClass);\n\n        $el1\n            .stop()\n            .addClass(fadeRearClass);\n        $el2\n            .stop()\n            .addClass(fadeFrontClass);\n\n        crossfadeFLAG && _$el2 && $el1.fadeTo(0, 0);\n\n        $el1.fadeTo(crossfadeFLAG ? time : 0, 1, crossfadeFLAG && onEndFn);\n        $el2.fadeTo(time, 0, onEndFn);\n\n        (_$el1 && crossfadeFLAG) || _$el2 || onEndFn();\n    }\n\n    var lastEvent,\n        moveEventType,\n        preventEvent,\n        preventEventTimeout,\n        dragDomEl;\n\n    function extendEvent(e) {\n        var touch = (e.touches || [])[0] || e;\n        e._x = touch.pageX || touch.originalEvent.pageX;\n        e._y = touch.clientY || touch.originalEvent.clientY;\n        e._now = $.now();\n    }\n\n    function touch($el, options) {\n        var el = $el[0],\n            tail = {},\n            touchEnabledFLAG,\n            startEvent,\n            $target,\n            controlTouch,\n            touchFLAG,\n            targetIsSelectFLAG,\n            targetIsLinkFlag,\n            tolerance,\n            moved;\n\n        function onStart(e) {\n            $target = $(e.target);\n            tail.checked = targetIsSelectFLAG = targetIsLinkFlag = moved = false;\n\n            if (touchEnabledFLAG\n                || tail.flow\n                || (e.touches && e.touches.length > 1)\n                || e.which > 1\n                || (lastEvent && lastEvent.type !== e.type && preventEvent)\n                || (targetIsSelectFLAG = options.select && $target.is(options.select, el))) return targetIsSelectFLAG;\n\n            touchFLAG = e.type === 'touchstart';\n            targetIsLinkFlag = $target.is('a, a *', el);\n            controlTouch = tail.control;\n\n            tolerance = (tail.noMove || tail.noSwipe || controlTouch) ? 16 : !tail.snap ? 4 : 0;\n\n            extendEvent(e);\n\n            startEvent = lastEvent = e;\n            moveEventType = e.type.replace(/down|start/, 'move').replace(/Down/, 'Move');\n\n            (options.onStart || noop).call(el, e, {control: controlTouch, $target: $target});\n\n            touchEnabledFLAG = tail.flow = true;\n\n            if (!touchFLAG || tail.go) stopEvent(e);\n        }\n\n        function onMove(e) {\n            if ((e.touches && e.touches.length > 1)\n                || (MS_POINTER && !e.isPrimary)\n                || moveEventType !== e.type\n                || !touchEnabledFLAG) {\n                touchEnabledFLAG && onEnd();\n                (options.onTouchEnd || noop)();\n                return;\n            }\n\n            extendEvent(e);\n\n            var xDiff = Math.abs(e._x - startEvent._x), // opt _x \u2192 _pageX\n                yDiff = Math.abs(e._y - startEvent._y),\n                xyDiff = xDiff - yDiff,\n                xWin = (tail.go || tail.x || xyDiff >= 0) && !tail.noSwipe,\n                yWin = xyDiff < 0;\n\n            if (touchFLAG && !tail.checked) {\n                if (touchEnabledFLAG = xWin) {\n                    stopEvent(e);\n                }\n            } else {\n                stopEvent(e);\n                (options.onMove || noop).call(el, e, {touch: touchFLAG});\n            }\n\n            if (!moved && Math.sqrt(Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) > tolerance) {\n                moved = true;\n            }\n\n            tail.checked = tail.checked || xWin || yWin;\n        }\n\n        function onEnd(e) {\n            (options.onTouchEnd || noop)();\n\n            var _touchEnabledFLAG = touchEnabledFLAG;\n            tail.control = touchEnabledFLAG = false;\n\n            if (_touchEnabledFLAG) {\n                tail.flow = false;\n            }\n\n            if (!_touchEnabledFLAG || (targetIsLinkFlag && !tail.checked)) return;\n\n            e && stopEvent(e);\n\n            preventEvent = true;\n            clearTimeout(preventEventTimeout);\n            preventEventTimeout = setTimeout(function () {\n                preventEvent = false;\n            }, 1000);\n\n            (options.onEnd || noop).call(el, {\n                moved: moved,\n                $target: $target,\n                control: controlTouch,\n                touch: touchFLAG,\n                startEvent: startEvent,\n                aborted: !e || e.type === 'MSPointerCancel'\n            });\n        }\n\n        function onOtherStart() {\n            if (tail.flow) return;\n            tail.flow = true;\n        }\n\n        function onOtherEnd() {\n            if (!tail.flow) return;\n            tail.flow = false;\n        }\n\n        if (MS_POINTER) {\n            addEvent(el, 'MSPointerDown', onStart);\n            addEvent(document, 'MSPointerMove', onMove);\n            addEvent(document, 'MSPointerCancel', onEnd);\n            addEvent(document, 'MSPointerUp', onEnd);\n        } else {\n            addEvent(el, 'touchstart', onStart);\n            addEvent(el, 'touchmove', onMove);\n            addEvent(el, 'touchend', onEnd);\n\n            addEvent(document, 'touchstart', onOtherStart);\n            addEvent(document, 'touchend', onOtherEnd);\n            addEvent(document, 'touchcancel', onOtherEnd);\n\n            $WINDOW.on('scroll', onOtherEnd);\n\n            $el.on('mousedown pointerdown', onStart);\n            $DOCUMENT\n                .on('mousemove pointermove', onMove)\n                .on('mouseup pointerup', onEnd);\n        }\n        if (Modernizr.touch) {\n            dragDomEl = 'a';\n        } else {\n            dragDomEl = 'div';\n        }\n        $el.on('click', dragDomEl, function (e) {\n            tail.checked && stopEvent(e);\n        });\n\n        return tail;\n    }\n\n    function moveOnTouch($el, options) {\n        var el = $el[0],\n            elData = $el.data(),\n            tail = {},\n            startCoo,\n            coo,\n            startElPos,\n            moveElPos,\n            edge,\n            moveTrack,\n            startTime,\n            endTime,\n            min,\n            max,\n            snap,\n            dir,\n            slowFLAG,\n            controlFLAG,\n            moved,\n            tracked;\n\n        function startTracking(e, noStop) {\n            tracked = true;\n            startCoo = coo = (dir === 'vertical') ? e._y : e._x;\n            startTime = e._now;\n\n            moveTrack = [\n                [startTime, startCoo]\n            ];\n\n            startElPos = moveElPos = tail.noMove || noStop ? 0 : stop($el, (options.getPos || noop)()/*, options._001*/);\n\n            (options.onStart || noop).call(el, e);\n        }\n\n        function onStart(e, result) {\n            min = tail.min;\n            max = tail.max;\n            snap = tail.snap,\n                dir = tail.direction || 'horizontal',\n                $el.navdir = dir;\n\n            slowFLAG = e.altKey;\n            tracked = moved = false;\n\n            controlFLAG = result.control;\n\n            if (!controlFLAG && !elData.sliding) {\n                startTracking(e);\n            }\n        }\n\n        function onMove(e, result) {\n            if (!tail.noSwipe) {\n                if (!tracked) {\n                    startTracking(e);\n                }\n                coo = (dir === 'vertical') ? e._y : e._x;\n\n                moveTrack.push([e._now, coo]);\n\n                moveElPos = startElPos - (startCoo - coo);\n\n                edge = findShadowEdge(moveElPos, min, max, dir);\n\n                if (moveElPos <= min) {\n                    moveElPos = edgeResistance(moveElPos, min);\n                } else if (moveElPos >= max) {\n                    moveElPos = edgeResistance(moveElPos, max);\n                }\n\n                if (!tail.noMove) {\n                    $el.css(getTranslate(moveElPos, dir));
2\n                    if (!moved) {\n                        moved = true;\n                        // only for mouse\n                        result.touch || MS_POINTER || $el.addClass(grabbingClass);\n                    }\n\n                    (options.onMove || noop).call(el, e, {pos: moveElPos, edge: edge});\n                }\n            }\n        }\n\n        function onEnd(result) {\n            if (tail.noSwipe && result.moved) return;\n\n            if (!tracked) {\n                startTracking(result.startEvent, true);\n            }\n\n            result.touch || MS_POINTER || $el.removeClass(grabbingClass);\n\n            endTime = $.now();\n\n            var _backTimeIdeal = endTime - TOUCH_TIMEOUT,\n                _backTime,\n                _timeDiff,\n                _timeDiffLast,\n                backTime = null,\n                backCoo,\n                virtualPos,\n                limitPos,\n                newPos,\n                overPos,\n                time = TRANSITION_DURATION,\n                speed,\n                friction = options.friction;\n\n            for (var _i = moveTrack.length - 1; _i >= 0; _i--) {\n                _backTime = moveTrack[_i][0];\n                _timeDiff = Math.abs(_backTime - _backTimeIdeal);\n                if (backTime === null || _timeDiff < _timeDiffLast) {\n                    backTime = _backTime;\n                    backCoo = moveTrack[_i][1];\n                } else if (backTime === _backTimeIdeal || _timeDiff > _timeDiffLast) {\n                    break;\n                }\n                _timeDiffLast = _timeDiff;\n            }\n\n            newPos = minMaxLimit(moveElPos, min, max);\n\n            var cooDiff = backCoo - coo,\n                forwardFLAG = cooDiff >= 0,\n                timeDiff = endTime - backTime,\n                longTouchFLAG = timeDiff > TOUCH_TIMEOUT,\n                swipeFLAG = !longTouchFLAG && moveElPos !== startElPos && newPos === moveElPos;\n\n            if (snap) {\n                newPos = minMaxLimit(Math[swipeFLAG ? (forwardFLAG ? 'floor' : 'ceil') : 'round'](moveElPos / snap) * snap, min, max);\n                min = max = newPos;\n            }\n\n            if (swipeFLAG && (snap || newPos === moveElPos)) {\n                speed = -(cooDiff / timeDiff);\n                time *= minMaxLimit(Math.abs(speed), options.timeLow, options.timeHigh);\n                virtualPos = Math.round(moveElPos + speed * time / friction);\n\n                if (!snap) {\n                    newPos = virtualPos;\n                }\n\n                if (!forwardFLAG && virtualPos > max || forwardFLAG && virtualPos < min) {\n                    limitPos = forwardFLAG ? min : max;\n                    overPos = virtualPos - limitPos;\n                    if (!snap) {\n                        newPos = limitPos;\n                    }\n                    overPos = minMaxLimit(newPos + overPos * .03, limitPos - 50, limitPos + 50);\n                    time = Math.abs((moveElPos - overPos) / (speed / friction));\n                }\n            }\n\n            time *= slowFLAG ? 10 : 1;\n\n            (options.onEnd || noop).call(el, $.extend(result, {\n                moved: result.moved || longTouchFLAG && snap,\n                pos: moveElPos,\n                newPos: newPos,\n                overPos: overPos,\n                time: time,\n                dir: dir\n            }));\n        }\n\n        tail = $.extend(touch(options.$wrap, $.extend({}, options, {\n            onStart: onStart,\n            onMove: onMove,\n            onEnd: onEnd\n        })), tail);\n\n        return tail;\n    }\n\n    function wheel($el, options) {\n        var el = $el[0],\n            lockFLAG,\n            lastDirection,\n            lastNow,\n            tail = {\n                prevent: {}\n            };\n\n        addEvent(el, WHEEL, function (e) {\n            var yDelta = e.wheelDeltaY || -1 * e.deltaY || 0,\n                xDelta = e.wheelDeltaX || -1 * e.deltaX || 0,\n                xWin = Math.abs(xDelta) && !Math.abs(yDelta),\n                direction = getDirectionSign(xDelta < 0),\n                sameDirection = lastDirection === direction,\n                now = $.now(),\n                tooFast = now - lastNow < TOUC
2H_TIMEOUT;\n\n            lastDirection = direction;\n            lastNow = now;\n\n            if (!xWin || !tail.ok || tail.prevent[direction] && !lockFLAG) {\n                return;\n            } else {\n                stopEvent(e, true);\n                if (lockFLAG && sameDirection && tooFast) {\n                    return;\n                }\n            }\n\n            if (options.shift) {\n                lockFLAG = true;\n                clearTimeout(tail.t);\n                tail.t = setTimeout(function () {\n                    lockFLAG = false;\n                }, SCROLL_LOCK_TIMEOUT);\n            }\n\n            (options.onEnd || noop)(e, options.shift ? direction : xDelta);\n\n        });\n\n        return tail;\n    }\n\n    jQuery.Fotorama = function ($fotorama, opts) {\n        $HTML = $('html');\n        $BODY = $('body');\n\n        var that = this,\n            stamp = $.now(),\n            stampClass = _fotoramaClass + stamp,\n            fotorama = $fotorama[0],\n            data,\n            dataFrameCount = 1,\n            fotoramaData = $fotorama.data(),\n            size,\n\n            $style = $('<style></style>'),\n\n            $anchor = $(div(hiddenClass)),\n            $wrap = $fotorama.find(cls(wrapClass)),\n            $stage = $wrap.find(cls(stageClass)),\n            stage = $stage[0],\n\n            $stageShaft = $fotorama.find(cls(stageShaftClass)),\n            $stageFrame = $(),\n            $arrPrev = $fotorama.find(cls(arrPrevClass)),\n            $arrNext = $fotorama.find(cls(arrNextClass)),\n            $arrs = $fotorama.find(cls(arrClass)),\n            $navWrap = $fotorama.find(cls(navWrapClass)),\n            $nav = $navWrap.find(cls(navClass)),\n            $navShaft = $nav.find(cls(navShaftClass)),\n            $navFrame,\n            $navDotFrame = $(),\n            $navThumbFrame = $(),\n\n            stageShaftData = $stageShaft.data(),\n            navShaftData = $navShaft.data(),\n\n            $thumbBorder = $fotorama.find(cls(thumbBorderClass)),\n            $thumbArrLeft = $fotorama.find(cls(thumbArrLeft)),\n            $thumbArrRight = $fotorama.find(cls(thumbArrRight)),\n\n            $fullscreenIcon = $fotorama.find(cls(fullscreenIconClass)),\n            fullscreenIcon = $fullscreenIcon[0],\n            $videoPlay = $(div(videoPlayClass)),\n            $videoClose = $fotorama.find(cls(videoCloseClass)),\n            videoClose = $videoClose[0],\n\n            $spinner = $fotorama.find(cls(fotoramaSpinnerClass)),\n\n            $videoPlaying,\n\n            activeIndex = false,\n            activeFrame,\n            activeIndexes,\n            repositionIndex,\n            dirtyIndex,\n            lastActiveIndex,\n            prevIndex,\n            nextIndex,\n            nextAutoplayIndex,\n            startIndex,\n\n            o_loop,\n            o_nav,\n            o_navThumbs,\n            o_navTop,\n            o_allowFullScreen,\n            o_nativeFullScreen,\n            o_fade,\n            o_thumbSide,\n            o_thumbSide2,\n            o_transitionDuration,\n            o_transition,\n            o_shadows,\n            o_rtl,\n            o_keyboard,\n            lastOptions = {},\n\n            measures = {},\n            measuresSetFLAG,\n\n            stageShaftTouchTail = {},\n            stageWheelTail = {},\n            navShaftTouchTail = {},\n            navWheelTail = {},\n\n            scrollTop,\n            scrollLeft,\n\n            showedFLAG,\n            pausedAutoplayFLAG,\n            stoppedAutoplayFLAG,\n\n            toDeactivate = {},\n            toDetach = {},\n\n            measuresStash,\n\n            touchedFLAG,\n\n            hoverFLAG,\n\n            navFrameKey,\n            stageLeft = 0,\n\n            fadeStack = [];\n\n        $wrap[STAGE_FRAME_KEY] = $('<div class=\"' + stageFrameClass + '\"></div>');\n        $wrap[NAV_THUMB_FRAME_KEY] = $($.Fotorama.jst.thumb());\n        $wrap[NAV_DOT_FRAME_KEY] = $($.Fotorama.jst.dots());\n\n        toDeactivate[STAGE_FRAME_KEY] = [];\n        toDeactivate[NAV_THUMB_FRAME_KEY] = [];\n        toDeactivate[NAV_DOT_FRAME_KEY] = [];\n        toDetach[STAGE_FRAME_KEY] = {};\n\n        $wrap.addClass(CSS3 ? wrapCss3Class : wrapCss2Class);\n\n        fotoramaData.fotorama = this;\n\n        /**\n         * Search video items in incomming data and transform object for video layout.\n         *\n         */\n        function checkForVideo() {\n            $.each(data, function (i, dataFrame) {\n                if (!dataFrame.i) {\n                    dataFrame.i = dataFrameCount++;\n                    var video = findVideoId(dataFrame.video, true);\n                    if (video) {\n                        var thumbs = {};\n                        dataFrame.video = video;\n                        if (!dataFrame.img && !dataFrame.thumb) {\n                            thumbs = getVideoThumbs(dataFrame, data, that);\n                        } else {\n                            dataFrame.thumbsReady = true;\n                        }\n                        updateData(data, {img: thumbs.img, thumb: thumbs.thumb}, dataFrame.i, that);\n                    }\n                }\n            });\n        }\n\n        function allowKey(key) {\n            return o_keyboard[key];\n        }
2\n\n        function setStagePosition() {\n            if ($stage !== undefined) {\n\n                if (opts.navdir == 'vertical') {\n                    var padding = opts.thumbwidth + opts.thumbmargin;\n\n                    $stage.css('left', padding);\n                    $arrNext.css('right', padding);\n                    $fullscreenIcon.css('right', padding);\n                    $wrap.css('width', $wrap.css('width') + padding);\n                    $stageShaft.css('max-width', $wrap.width() - padding);\n                } else {\n                    $stage.css('left', '');\n                    $arrNext.css('right', '');\n                    $fullscreenIcon.css('right', '');\n                    $wrap.css('width', $wrap.css('width') + padding);\n                    $stageShaft.css('max-width', '');\n                }\n            }\n        }\n\n        function bindGlobalEvents(FLAG) {\n            var keydownCommon = 'keydown.' + _fotoramaClass,\n                localStamp = _fotoramaClass + stamp,\n                keydownLocal = 'keydown.' + localStamp,\n                keyupLocal = 'keyup.' + localStamp,\n                resizeLocal = 'resize.' + localStamp + ' ' + 'orientationchange.' + localStamp,\n                showParams;\n\n            if (FLAG) {\n                $DOCUMENT\n                    .on(keydownLocal, function (e) {\n                        var catched,\n                            index;\n\n                        if ($videoPlaying && e.keyCode === 27) {\n                            catched = true;\n                            unloadVideo($videoPlaying, true, true);\n                        } else if (that.fullScreen || (opts.keyboard && !that.index)) {\n                            if (e.keyCode === 27) {\n                                catched = true;\n                                that.cancelFullScreen();\n                            } else if ((e.shiftKey && e.keyCode === 32 && allowKey('space')) || (e.keyCode === 37 && allowKey('left')) || (e.keyCode === 38 && allowKey('up') && $(':focus').attr('data-gallery-role'))) {\n                                that.longPress.progress();\n                                index = '<';\n                            } else if ((e.keyCode === 32 && allowKey('space')) || (e.keyCode === 39 && allowKey('right')) || (e.keyCode === 40 && allowKey('down') && $(':focus').attr('data-gallery-role'))) {\n                                that.longPress.progress();\n                                index = '>';\n                            } else if (e.keyCode === 36 && allowKey('home')) {\n                                that.longPress.progress();\n                                index = '<<';\n                            } else if (e.keyCode === 35 && allowKey('end')) {\n                                that.longPress.progress();\n                                index = '>>';\n                            }\n                        }\n\n                        (catched || index) && stopEvent(e);\n                        showParams = {index: index, slow: e.altKey, user: true};\n                        index && (that.longPress.inProgress ?\n                            that.showWhileLongPress(showParams) :\n                            that.show(showParams));\n                    });\n\n                if (FLAG) {\n                    $DOCUMENT\n                        .on(keyupLocal, function (e) {\n                            if (that.longPress.inProgress) {\n                                that.showEndLongPress({user: true});\n                            }\n                            that.longPress.reset();\n                        });\n                }\n\n                if (!that.index) {\n                    $DOCUMENT\n                        .off(keydownCommon)\n                        .on(keydownCommon, 'textarea, input, select', function (e) {\n                            !$BODY.hasClass(_fullscreenClass) && e.stopPropagation();\n                        });\n                }\n\n                $WINDOW.on(resizeLocal, that.resize);\n            } else {\n                $DOCUMENT.off(keydownLocal);\n                $WINDOW.off(resizeLocal);\n            }\n        }\n\n        function appendElements(FLAG) {\n            if (FLAG === appendElements.f) return;\n\n            if (FLAG) {\n                $fotorama\n                    .addClass(_fotoramaClass + ' ' + stampClass)\n                    .before($anchor)\n                    .before($style);\n                addInstance(that);\n            } else {\n                $anchor.detach();\n                $style.detach();\n                $fotorama\n                    .html(fotoramaData.urtext)\n                    .removeClass(stampClass);\n\n                hideInstance(that);\n            }\n\n            bindGlobalEvents(FLAG);\n            appendElements.f = FLAG;\n        }\n\n        /**\n         * Set and install data from incomming @param {JSON}
2 options or takes data attr from data-\"name\"=... values.\n         */\n        function setData() {\n            data = that.data = data || clone(opts.data) || getDataFromHtml($fotorama);\n            size = that.size = data.length;\n\n            ready.ok && opts.shuffle && shuffle(data);\n\n            checkForVideo();\n\n            activeIndex = limitIndex(activeIndex);\n\n            size && appendElements(true);\n        }\n\n        function stageNoMove() {\n            var _noMove = size < 2 || $videoPlaying;\n            stageShaftTouchTail.noMove = _noMove || o_fade;\n            stageShaftTouchTail.noSwipe = _noMove || !opts.swipe;\n\n            !o_transition && $stageShaft.toggleClass(grabClass, !opts.click && !stageShaftTouchTail.noMove && !stageShaftTouchTail.noSwipe);\n            MS_POINTER && $wrap.toggleClass(wrapPanYClass, !stageShaftTouchTail.noSwipe);\n        }\n\n        function setAutoplayInterval(interval) {\n            if (interval === true) interval = '';\n            opts.autoplay = Math.max(+interval || AUTOPLAY_INTERVAL, o_transitionDuration * 1.5);\n        }\n\n        function updateThumbArrow(opt) {\n            if (opt.navarrows && opt.nav === 'thumbs') {\n                $thumbArrLeft.show();\n                $thumbArrRight.show();\n            } else {\n                $thumbArrLeft.hide();\n                $thumbArrRight.hide();\n            }\n\n        }\n\n        function getThumbsInSlide($el, opts) {\n            return Math.floor($wrap.width() / (opts.thumbwidth + opts.thumbmargin));\n        }\n\n        /**\n         * Options on the fly\n         * */\n        function setOptions() {\n            if (!opts.nav || opts.nav === 'dots') {\n                opts.navdir = 'horizontal'\n            }\n\n            that.options = opts = optionsToLowerCase(opts);\n            thumbsPerSlide = getThumbsInSlide($wrap, opts);\n\n            o_fade = (opts.transition === 'crossfade' || opts.transition === 'dissolve');\n\n            o_loop = opts.loop && (size > 2 || (o_fade && (!o_transition || o_transition !== 'slide')));\n\n            o_transitionDuration = +opts.transitionduration || TRANSITION_DURATION;\n\n            o_rtl = opts.direction === 'rtl';\n\n            o_keyboard = $.extend({}, opts.keyboard && KEYBOARD_OPTIONS, opts.keyboard);\n            updateThumbArrow(opts);\n            var classes = {add: [], remove: []};\n\n            function addOrRemoveClass(FLAG, value) {\n                classes[FLAG ? 'add' : 'remove'].push(value);\n            }\n\n            if (size > 1) {\n                o_nav = opts.nav;\n                o_navTop = opts.navposition === 'top';\n                classes.remove.push(selectClass);\n\n                $arrs.toggle(opts.arrows);\n            } else {\n                o_nav = false;\n                $arrs.hide();\n            }\n\n            arrsUpdate();\n            stageWheelUpdate();\n            thumbArrUpdate();\n            if (opts.autoplay) setAutoplayInterval(opts.autoplay);\n\n            o_thumbSide = numberFromMeasure(opts.thumbwidth) || THUMB_SIZE;\n            o_thumbSide2 = numberFromMeasure(opts.thumbheight) || THUMB_SIZE;\n\n            stageWheelTail.ok = navWheelTail.ok = opts.trackpad && !SLOW;\n\n            stageNoMove();\n\n            extendMeasures(opts, [measures]);\n\n            o_navThumbs = o_nav === 'thumbs';\n\n            if ($navWrap.filter(':hidden') && !!o_nav) {\n                $navWrap.show();\n            }\n            if (o_navThumbs) {\n                frameDraw(size, 'navThumb');\n\n                $navFrame = $navThumbFrame;\n                navFrameKey = NAV_THUMB_FRAME_KEY;\n\n                setStyle($style, $.Fotorama.jst.style({\n                    w: o_thumbSide,\n                    h: o_thumbSide2,\n                    b: opts.thumbborderwidth,\n                    m: opts.thumbmargin,\n                    s: stamp,\n                    q: !COMPAT\n                }));\n\n                $nav\n                    .addClass(navThumbsClass)\n                    .removeClass(navDotsClass);\n            } else if (o_nav === 'dots') {\n                frameDraw(size, 'navDot');\n\n                $navFrame = $navDotFrame;
2\n                navFrameKey = NAV_DOT_FRAME_KEY;\n\n                $nav\n                    .addClass(navDotsClass)\n                    .removeClass(navThumbsClass);\n            } else {\n                $navWrap.hide();\n                o_nav = false;\n                $nav.removeClass(navThumbsClass + ' ' + navDotsClass);\n            }\n\n            if (o_nav) {\n                if (o_navTop) {\n                    $navWrap.insertBefore($stage);\n                } else {\n                    $navWrap.insertAfter($stage);\n                }\n                frameAppend.nav = false;\n\n                frameAppend($navFrame, $navShaft, 'nav');\n            }\n\n            o_allowFullScreen = opts.allowfullscreen;\n\n            if (o_allowFullScreen) {\n                $fullscreenIcon.prependTo($stage);\n                o_nativeFullScreen = FULLSCREEN && o_allowFullScreen === 'native';\n\n                // Due 300ms click delay on mobile devices\n                // we stub touchend and fallback to click.\n                // MAGETWO-69567\n                stubEvent($fullscreenIcon, 'touchend');\n            } else {\n                $fullscreenIcon.detach();\n                o_nativeFullScreen = false;\n            }\n\n            addOrRemoveClass(o_fade, wrapFadeClass);\n            addOrRemoveClass(!o_fade, wrapSlideClass);\n            addOrRemoveClass(!opts.captions, wrapNoCaptionsClass);\n            addOrRemoveClass(o_rtl, wrapRtlClass);\n            addOrRemoveClass(opts.arrows, wrapToggleArrowsClass);\n\n            o_shadows = opts.shadows && !SLOW;\n            addOrRemoveClass(!o_shadows, wrapNoShadowsClass);
2\n\n            $wrap\n                .addClass(classes.add.join(' '))\n                .removeClass(classes.remove.join(' '));\n\n            lastOptions = $.extend({}, opts);\n            setStagePosition();\n        }\n\n        function normalizeIndex(index) {\n            return index < 0 ? (size + (index % size)) % size : index >= size ? index % size : index;\n        }\n\n        function limitIndex(index) {\n            return minMaxLimit(index, 0, size - 1);\n        }\n\n        function edgeIndex(index) {\n            return o_loop ? normalizeIndex(index) : limitIndex(index);\n        }\n\n        function getPrevIndex(index) {\n            return index > 0 || o_loop ? index - 1 : false;\n        }\n\n        function getNextIndex(index) {\n            return index < size - 1 || o_loop ? index + 1 : false;\n        }\n\n        function setStageShaftMinmaxAndSnap() {\n            stageShaftTouchTail.min = o_loop ? -Infinity : -getPosByIndex(size - 1, measures.w, opts.margin, repositionIndex);\n            stageShaftTouchTail.max = o_loop ? Infinity : -getPosByIndex(0, measures.w, opts.margin, repositionIndex);\n            stageShaftTouchTail.snap = measures.w + opts.margin;\n        }\n\n        function setNavShaftMinMax() {\n\n            var isVerticalDir = (opts.navdir === 'vertical');\n            var param = isVerticalDir ? $navShaft.height() : $navShaft.width();\n            var mainParam = isVerticalDir ? measures.h : measures.nw;\n            navShaftTouchTail.min = Math.min(0, mainParam - param);\n            navShaftTouchTail.max = 0;\n            navShaftTouchTail.direction = opts.navdir;\n            $navShaft.toggleClass(grabClass, !(navShaftTouchTail.noMove = navShaftTouchTail.min === navShaftTouchTail.max));\n        }\n\n        function eachIndex(indexes, type, fn) {\n            if (typeof indexes === 'number') {\n                indexes = new Array(indexes);\n                var rangeFLAG = true;\n            }\n            return $.each(indexes, function (i, index) {\n                if (rangeFLAG) index = i;\n                if (typeof index === 'number') {\n                    var dataFrame = data[normalizeIndex(index)];\n\n                    if (dataFrame) {\n                        var key = '$' + type + 'Frame',\n                            $frame = dataFrame[key];\n\n                        fn.call(this, i, index, dataFrame, $frame, key, $frame && $frame.data());\n                    }\n                }\n            });\n        }\n\n        function setMeasures(width, height, ratio, index) {\n            if (!measuresSetFLAG || (measuresSetFLAG === '*' && index === startIndex)) {\n\n                width = measureIsValid(opts.width) || measureIsValid(width) || WIDTH;\n                height = measureIsValid(opts.height) || measureIsValid(
2height) || HEIGHT;\n                that.resize({\n                    width: width,\n                    ratio: opts.ratio || ratio || width / height\n                }, 0, index !== startIndex && '*');\n            }\n        }\n\n        function loadImg(indexes, type, specialMeasures, again) {\n\n            eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {\n\n                if (!$frame) return;\n\n                var fullFLAG = that.fullScreen && !frameData.$full && type === 'stage';\n\n                if (frameData.$img && !again && !fullFLAG) return;\n\n                var img = new Image(),\n                    $img = $(img),\n                    imgData = $img.data();\n\n                frameData[fullFLAG ? '$full' : '$img'] = $img;\n\n                var srcKey = type === 'stage' ? (fullFLAG ? 'full' : 'img') : 'thumb',\n                    src = dataFrame[srcKey],\n                    dummy = fullFLAG ? dataFrame['img'] : dataFrame[type === 'stage' ? 'thumb' : 'img'];\n\n                if (type === 'navThumb') $frame = frameData.$wrap;\n\n                function triggerTriggerEvent(event) {\n                    var _index = normalizeIndex(index);\n                    triggerEvent(event, {\n                        index: _index,\n                        src: src,\n                        frame: data[_index]\n                    });\n                }\n\n                function error() {\n                    $img.remove();\n\n                    $.Fotorama.cache[src] = 'error';\n\n                    if ((!dataFrame.html || type !== 'stage') && dummy && dummy !== src) {\n                        dataFrame[srcKey] = src = dummy;\n                        frameData.$full = null;\n                        loadImg([index], type, specialMeasures, true);\n                    } else {\n                        if (src && !dataFrame.html && !fullFLAG) {\n                            $frame\n                                .trigger('f:error')\n                                .removeClass(loadingClass)\n                                .addClass(errorClass);\n\n                            triggerTriggerEvent('error');\n                        } else if (type === 'stage') {\n                            $frame\n                                .trigger('f:load')\n                                .removeClass(loadingClass + ' ' + errorClass)\n                                .addClass(loadedClass);\n\n                            triggerTriggerEvent('load');\n                            setMeasures();\n                        }\n\n                        frameData.state = 'error';\n\n                        if (size > 1 && data[index] === dataFrame && !dataFrame.html && !dataFrame.deleted && !dataFrame.video && !fullFLAG) {\n                            dataFrame.deleted = true;\n                            that.splice(index, 1);\n                        }\n                    }\n                }\n\n                function loaded() {\n                    $.Fotorama.measures[src] = imgData.measures = $.Fotorama.measures[src] || {\n                            width: img.width,\n                            height: img.height,\n                            ratio: img.width / img.height\n                        };\n\n                    setMeasures(imgData.measures.width, imgData.measures.height, imgData.measures.ratio, index);\n\n                    $img\n                        .off('load error')\n                        .addClass('' + (fullFLAG ? imgFullClass: imgClass))\n                        .attr('aria-hidden', 'false')\n                        .prependTo($frame);\n\n                    if ($frame.hasClass(stageFrameClass) && !$frame.hasClass(videoContainerClass)) {\n                        $frame.attr(\"href\", $img.attr(\"src\"));\n                    }\n\n                    fit($img, (\n                            $.isFunction(specialMeasures) ? specialMeasures() : specialMeasures) || measures);\n\n                    $.Fotorama.cache[src] = frameData.state = 'loaded';\n\n                    setTimeout(function () {\n                        $frame\n                            .trigger('f:load')\n                            .removeClass(loadingClass + ' ' + errorClass)\n                            .addClass(loadedClass + ' ' + (fullFLAG ? loadedFullClass : loadedImgClass));\n\n                        if (type === 'stage') {\n                            triggerTriggerEvent('load');\n                        } else if (dataFrame.thumbratio === AUTO || !dataFrame.thumbratio && opts.thumbratio === AUTO) {\n                            // danger! reflow for all thumbnails\n                            dataFrame.thumbratio = imgData.measures.ratio;\n                            reset();\n                        }\n                    }, 0);\n                }\n\n                if (!src) {\n                    error();\n                    return;\n                }\n\n                function waitAndLoad() {\n                    var _i = 10;\n                    waitFor(function () {\n                        return !touchedFLAG || !_i-- && !SLOW;\n                    }, function () {\n                        loaded();\n                    });\n                }\n\n                if (!$.Fotorama.cache[src]) {\n                    $.Fotorama.cache[src] = '*';\n\n                    $img\n                        .on('load', waitAndLoad)\n                        .on('error', error);\n                } else {\n                    (function justWait() {\n                        if ($.Fotorama.cache[src] === 'error') {\n                            error();\n                        } else if ($.Fotorama.cache[src] === 'loaded') {\n                            setTimeout(waitAndLoad, 0
2);\n                        } else {\n                            setTimeout(justWait, 100);\n                        }\n                    })();\n                }\n\n                frameData.state = '';\n                img.src = src;\n\n                if (frameData.data.caption) {\n                    img.alt = frameData.data.caption || \"\";\n                }\n\n                if (frameData.data.full) {\n                    $(img).data('original', frameData.data.full);\n                }\n\n                if (UTIL.isExpectedCaption(dataFrame, opts.showcaption)) {\n                    $(img).attr('aria-labelledby', dataFrame.labelledby);\n                }\n            });\n        }\n\n        function updateFotoramaState() {\n            var $frame = activeFrame[STAGE_FRAME_KEY];\n\n            if ($frame && !$frame.data().state) {\n                $spinner.addClass(spinnerShowClass);\n                $frame.on('f:load f:error', function () {\n                    $frame.off('f:load f:error');\n                    $spinner.removeClass(spinnerShowClass);\n                });\n            }\n        }\n\n        function addNavFrameEvents(frame) {\n            addEnterUp(frame, onNavFrameClick);\n            addFocus(frame, function () {\n\n                setTimeout(function () {\n                    lockScroll($nav);\n                }, 0);\n                slideNavShaft({time: o_transitionDuration, guessIndex: $(this).data().eq, minMax: navShaftTouchTail});\n            });\n        }\n\n        function frameDraw(indexes, type) {\n            eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {\n                if ($frame) return;\n\n                $frame = dataFrame[key] = $wrap[key].clone();\n                frameData = $frame.data();\n                frameData.data = dataFrame;\n                var frame = $frame[0],\n                    labelledbyValue = \"labelledby\" + $.now();\n\n                if (type === 'stage') {\n\n                    if (dataFrame.html) {\n                        $('<div class=\"' + htmlClass + '\"></div>')\n                            .append(\n                            dataFrame._html ? $(dataFrame.html)\n                                .removeAttr('id')\n                                .html(dataFrame._html) // Because of IE\n                                : dataFrame.html\n                        )\n                            .appendTo($frame);\n                    }\n\n                    if (dataFrame.id) {\n                        labelledbyValue = dataFrame.id || labelledbyValue;\n                    }\n                    dataFrame.labelledby = labelledbyValue;\n\n                    if (UTIL.isExpectedCaption(dataFrame, opts.showcaption)) {\n                        $($.Fotorama.jst.frameCaption({\n                            caption: dataFrame.caption,\n                            labelledby: labelledbyValue\n                        })).appendTo($frame);\n                    }\n\n                    dataFrame.video && $frame\n                        .addClass(stageFrameVideoClass)\n                        .append($videoPlay.clone());\n\n                    // This solves tabbing problems\n                    addFocus(frame, function () {\n                        setTimeout(function () {\n                            lockScroll($stage);\n                        }, 0);\n                        clickToShow({index: frameData.eq, user: true});\n                    });\n\n                    $stageFrame = $stageFrame.add($frame);\n                } else if (type === 'navDot') {\n                    addNavFrameEvents(frame);\n                    $navDotFrame = $navDotFrame.add($frame);\n                } else if (type === 'navThumb') {\n                    addNavFrameEvents(frame);\n                    frameData.$wrap = $frame.children(':first');\n\n                    $navThumbFrame = $navThumbFrame.add($frame);\n                    if (dataFrame.video) {\n                        frameData.$wrap.append($videoPlay.clone());\n                    }\n                }\n            });\n        }\n\n        function callFit($img, measuresToFit) {\n            return $img && $img.length && fit($img, measuresToFit);\n        }
2\n\n        function stageFramePosition(indexes) {\n            eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {\n                if (!$frame) return;\n\n                var normalizedIndex = normalizeIndex(index);\n                frameData.eq = normalizedIndex;\n\n                toDetach[STAGE_FRAME_KEY][normalizedIndex] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, opts.margin, repositionIndex)}, o_fade && getDuration(0)));\n\n                if (isDetached($frame[0])) {\n                    $frame.appendTo($stageShaft);\n                    unloadVideo(dataFrame.$video);\n                }\n\n                callFit(frameData.$img, measures);\n                callFit(frameData.$full, measures);\n\n                if ($frame.hasClass(stageFrameClass) && !($frame.attr('aria-hidden') === \"false\" && $frame.hasClass(activeClass))) {\n                    $frame.attr('aria-hidden', 'true');\n                }\n            });\n        }\n\n        function thumbsDraw(pos, loadFLAG) {\n            var leftLimit,\n                rightLimit,\n                exceedLimit;\n\n\n            if (o_nav !== 'thumbs' || isNaN(pos)) return;\n\n            leftLimit = -pos;\n            rightLimit = -pos + measures.nw;\n\n            if (opts.navdir === 'vertical') {\n                pos = pos - opts.thumbheight;\n                rightLimit = -pos + measures.h;\n            }\n\n            $navThumbFrame.each(function () {\n                var $this = $(this),\n                    thisData = $this.data(),\n                    eq = thisData.eq,\n                    getSpecialMeasures = function () {\n                        return {\n                            h: o_thumbSide2,\n                            w: thisData.w\n                        }\n                    },\n                    specialMeasures = getSpecialMeasures(),\n                    exceedLimit = opts.navdir === 'vertical' ?\n                    thisData.t > rightLimit : thisData.l > rightLimit;\n                specialMeasures.w = thisData.w;\n\n                if (thisData.l + thisData.w < leftLimit\n                    || exceedLimit\n                    || callFit(thisData.$img, specialMeasures)) return;\n\n                loadFLAG && loadImg([eq], 'navThumb', getSpecialMeasures);\n            });\n        }\n\n        function frameAppend($frames, $shaft, type) {\n            if (!frameAppend[type]) {\n\n                var thumbsFLAG = type === 'nav' && o_navThumbs,\n                    left = 0,\n                    top = 0;\n\n                $shaft.append(\n                    $frames\n                        .filter(function () {\n                            var actual,\n                                $this = $(this),\n                                frameData = $this.data();\n                            for (var _i = 0, _l = data.length; _i < _l; _i++) {\n                                if (frameData.data === data[_i]) {\n                                    actual = true;\n                                    frameData.eq = _i;\n                                    break;\n                                }\n                            }\n                            return actual || $this.remove() && false;\n                        })\n                        .sort(function (a, b) {\n                            return $(a).data().eq - $(b).data().eq;\n                        })\n                        .each(function () {\n                            var $this = $(this),\n                                frameData = $this.data();\n                            UTIL.setThumbAttr($this, frameData.data.caption, \"aria-label\");\n                        })\n                        .each(function () {\n\n                            if (!thumbsFLAG) return;\n\n                            var $this = $(this),\n                                frameData = $this.data(),\n                                thumbwidth = Math.round(o_thumbSide2 * frameData.data.thumbratio) || o_thumbSide,\n                                thumbheight = Math.round(o_thumbSide / frameData.data.thumbratio) || o_thumbSide2;\n                            frameData.t = top;\n                            frameData.h = thumbheight;\n                            frameData.l = left;\n                            frameData.w = thumbwidth;\n\n                            $this.css({width: thumbwidth});\n\n                            top += thumbheight + opts.thumbmargin;\n                            left += thumbwidth + opts.thumbmargin;\n                        })\n                );
2\n\n                frameAppend[type] = true;\n            }\n        }\n\n        function getDirection(x) {\n            return x - stageLeft > measures.w / 3;\n        }\n\n        function disableDirrection(i) {\n            return !o_loop && (!(activeIndex + i) || !(activeIndex - size + i)) && !$videoPlaying;\n        }\n\n        function arrsUpdate() {\n            var disablePrev = disableDirrection(0),\n                disableNext = disableDirrection(1);\n            $arrPrev\n                .toggleClass(arrDisabledClass, disablePrev)\n                .attr(disableAttr(disablePrev, false));\n            $arrNext\n                .toggleClass(arrDisabledClass, disableNext)\n                .attr(disableAttr(disableNext, false));\n        }\n\n        function thumbArrUpdate() {\n            var isLeftDisable = false,\n                isRightDisable = false;\n            if (opts.navtype === 'thumbs' && !opts.loop) {\n                (activeIndex == 0) ? isLeftDisable = true : isLeftDisable = false;\n                (activeIndex == opts.data.length - 1) ? isRightDisable = true : isRightDisable = false;\n            }\n            if (opts.navtype === 'slides') {\n                var pos = readPosition($navShaft, opts.navdir);\n                pos >= navShaftTouchTail.max ? isLeftDisable = true : isLeftDisable = false;\n                pos <= navShaftTouchTail.min ? isRightDisable = true : isRightDisable = false;\n            }\n            $thumbArrLeft\n                .toggleClass(arrDisabledClass, isLeftDisable)\n                .attr(disableAttr(isLeftDisable, true));\n            $thumbArrRight\n                .toggleClass(arrDisabledClass, isRightDisable)\n                .attr(disableAttr(isRightDisable, true));\n        }\n\n        function stageWheelUpdate() {\n            if (stageWheelTail.ok) {\n                stageWheelTail.prevent = {'<': disableDirrection(0), '>': disableDirrection(1)};\n            }\n        }\n\n        function getNavFrameBounds($navFrame) {\n            var navFrameData = $navFrame.data(),\n                left,\n                top,\n                width,\n                height;\n\n            if (o_navThumbs) {\n                left = navFrameData.l;\n                top = navFrameData.t;\n                width = navFrameData.w;\n                height = navFrameData.h;\n            } else {\n                left = $navFrame.position().left;\n                width = $navFrame.width();\n            }\n\n            var horizontalBounds = {\n                c: left + width / 2,\n                min: -left + opts.thumbmargin * 10,\n                max: -left + measures.w - width - opts.thumbmargin * 10\n            };\n\n            var verticalBounds = {\n                c: top + height / 2,\n                min: -top + opts.thumbmargin * 10,\n                max: -top + measures.h - height - opts.thumbmargin * 10\n            };\n\n            return opts.navdir === 'vertical' ? verticalBounds : horizontalBounds;\n        }\n\n        function slideThumbBorder(time) {\n            var navFrameData = activeFrame[navFrameKey].data();\n            slide($thumbBorder, {\n                time: time * 1.2,\n                pos: (opts.navdir === 'vertical' ? navFrameData.t : navFrameData.l),\n                width: navFrameData.w,\n                height: navFrameData.h,\n                direction: opts.navdir\n            });\n        }\n\n        function slideNavShaft(options) {\n            var $guessNavFrame = data[options.guessIndex][navFrameKey],\n                typeOfAnimation = opts.navtype;\n\n            var overflowFLAG,\n                time,\n                minMax,\n                boundTop,\n                boundLeft,\n                l,\n                pos,\n                x;\n\n            if ($guessNavFrame) {\n                if (typeOfAnimation === 'thumbs') {\n                    overflowFLAG = navShaftTouchTail.min !== navShaftTouchTail.max;\n                    minMax = options.minMax || overflowFLAG && getNavFrameBounds(activeFrame[navFrameKey]);\n                    boundTop = overflowFLAG && (options.keep && slideNavShaft.t ? slideNavShaft.l : minMaxLimit((options.coo || measures.nw / 2) - getNavFrameBounds($guessNavFrame).c, minMax.min, minMax.max));\n                    boundLeft = overflowFLAG && (options.keep && slideNavShaft.l ? slideNavShaft.l : minMaxLimit((options.coo || measures.nw / 2) - getNavFrameBounds($guessNavFrame).c, minMax.min, minMax.max));\n                    l = (opts.navdir === 'vertical' ? boundTop : boundLeft);\n                    pos = overflowFLAG && minMaxLimit(l, navShaftTouchTail.min, navShaftTouchTail.max) || 0;\n                    time = options.time * 1.1;\n                    slide($navShaft, {\n                        time: time,\n                        pos: pos,\n                        direction: opts.navdir,\n                        onEnd: function () {\n                            thumbsDraw(pos, true);\n                            thumbArrUpdate();\n                        }\n                    });\n\n                    setShadow($nav, findShadowEdge(pos, navShaftTouchTail.min, navShaftTouchTail.max, opts.navdir));\n                    slideNavShaft.l = l;\n                } else {\n                    x = readPosition($navShaft, opts.navdir);\n                    time = options.time * 1.11;\n\n                    pos = validateSlidePos(opts, navShaftTouchTail, options.guessIndex, x, $guessNavFrame, $navWrap, opts.navdir);\n\n                    slide($navShaft, {\n                        time: time,\n                        pos: pos,\n                        direction: opts.navdir,\n                        onEnd: function () {\n                            thumbsDraw(pos, true);\n                            thumbArrUpdate();\n                        }\n                    });\n                    setShadow($nav, findShadowEdge(pos, navShaftTouchTail.min, navShaftTouchTail.max, opts.navdir));\n                }\n            }\n        }\n\n        function navUpdate() {\n            deactivateFrames(navFrameKe
2y);\n            toDeactivate[navFrameKey].push(activeFrame[navFrameKey].addClass(activeClass).attr('data-active', true));\n        }\n\n        function deactivateFrames(key) {\n            var _toDeactivate = toDeactivate[key];\n\n            while (_toDeactivate.length) {\n                _toDeactivate.shift().removeClass(activeClass).attr('data-active', false);\n            }\n        }\n\n        function detachFrames(key) {\n            var _toDetach = toDetach[key];\n\n            $.each(activeIndexes, function (i, index) {\n                delete _toDetach[normalizeIndex(index)];\n            });\n\n            $.each(_toDetach, function (index, $frame) {\n                delete _toDetach[index];\n                $frame.detach();\n            });\n        }\n\n        function stageShaftReposition(skipOnEnd) {\n\n            repositionIndex = dirtyIndex = activeIndex;\n\n            var $frame = activeFrame[STAGE_FRAME_KEY];\n\n            if ($frame) {\n                deactivateFrames(STAGE_FRAME_KEY);\n                toDeactivate[STAGE_FRAME_KEY].push($frame.addClass(activeClass).attr('data-active', true));\n\n                if ($frame.hasClass(stageFrameClass)) {\n                    $frame.attr('aria-hidden', 'false');\n                }\n\n                skipOnEnd || that.showStage.onEnd(true);\n                stop($stageShaft, 0, true);\n\n                detachFrames(STAGE_FRAME_KEY);\n                stageFramePosition(activeIndexes);\n                setStageShaftMinmaxAndSnap();\n                setNavShaftMinMax();\n                addEnterUp($stageShaft[0], function () {\n                    if (!$fotorama.hasClass(fullscreenClass)) {\n                        that.requestFullScreen();\n                        $fullscreenIcon.focus();\n                    }\n                });\n            }\n        }\n\n        function extendMeasures(options, measuresArray) {\n            if (!options) return;\n\n            $.each(measuresArray, function (i, measures) {\n                if (!measures) return;\n\n                $.extend(measures, {\n                    width: options.width || measures.width,\n                    height: options.height,\n                    minwidth: options.minwidth,\n                    maxwidth: options.maxwidth,\n                    minheight: options.minheight,\n                    maxheight: options.maxheight,\n                    ratio: getRatio(options.ratio)\n                })\n            });\n        }\n\n        function triggerEvent(event, extra) {\n            $fotorama.trigger(_fotoramaClass + ':' + event, [that, extra]);\n        }\n\n        function onTouchStart() {\n            clearTimeout(onTouchEnd.t);\n            touchedFLAG = 1;\n\n            if (opts.stopautoplayontouch) {\n                that.stopAutoplay();\n            } else {\n                pausedAutoplayFLAG = true;\n            }\n        }\n\n        function onTouchEnd() {\n            if (!touchedFLAG) return;
2\n            if (!opts.stopautoplayontouch) {\n                releaseAutoplay();\n                changeAutoplay();\n            }\n\n            onTouchEnd.t = setTimeout(function () {\n                touchedFLAG = 0;\n            }, TRANSITION_DURATION + TOUCH_TIMEOUT);\n        }\n\n        function releaseAutoplay() {\n            pausedAutoplayFLAG = !!($videoPlaying || stoppedAutoplayFLAG);\n        }\n\n        function changeAutoplay() {\n\n            clearTimeout(changeAutoplay.t);\n            waitFor.stop(changeAutoplay.w);\n\n            if (!opts.autoplay || pausedAutoplayFLAG) {\n                if (that.autoplay) {\n                    that.autoplay = false;\n                    triggerEvent('stopautoplay');\n                }\n\n                return;\n            }\n\n            if (!that.autoplay) {\n                that.autoplay = true;\n                triggerEvent('startautoplay');\n            }\n\n            var _activeIndex = activeIndex;\n\n\n            var frameData = activeFrame[STAGE_FRAME_KEY].data();\n            changeAutoplay.w = waitFor(function () {\n                return frameData.state || _activeIndex !== activeIndex;\n            }, function () {\n                changeAutoplay.t = setTimeout(function () {\n\n                    if (pausedAutoplayFLAG || _activeIndex !== activeIndex) return;\n\n                    var _nextAutoplayIndex = nextAutoplayIndex,\n                        nextFrameData = data[_nextAutoplayIndex][STAGE_FRAME_KEY].data();\n\n                    changeAutoplay.w = waitFor(function () {\n\n                        return nextFrameData.state || _nextAutoplayIndex !== nextAutoplayIndex;\n                    }, function () {\n                        if (pausedAutoplayFLAG || _nextAutoplayIndex !== nextAutoplayIndex) return;\n                        that.show(o_loop ? getDirectionSign(!o_rtl) : nextAutoplayIndex);\n                    });\n                }, opts.autoplay);\n            });\n\n        }\n\n        that.startAutoplay = function (interval) {\n            if (that.autoplay) return this;\n            pausedAutoplayFLAG = stoppedAutoplayFLAG = false;\n            setAutoplayInterval(interval || opts.autoplay);\n            changeAutoplay();\n\n            return this;\n        };\n\n        that.stopAutoplay = function () {\n            if (that.autoplay) {\n                pausedAutoplayFLAG = stoppedAutoplayFLAG = true;\n                changeAutoplay();\n            }\n            return this;\n        };\n\n        that.showSlide = function (slideDir) {\n            var currentPosition = readPosition($navShaft, opts.navdir),\n                pos,\n                time = 500 * 1.1,\n                size = opts.navdir === 'horizontal' ? opts.thumbwidth : opts.thumbheight,\n                onEnd = function () {\n                    thumbArrUpdate();\n                };\n            if (slideDir === 'next') {\n                pos = currentPosition - (size + opts.margin) * thumbsPerSlide;\n            }\n            if (slideDir === 'prev') {\n                pos = currentPosition + (size + opts.margin) * thumbsPerSlide;\n            }\n            pos = validateRestrictions(pos, navShaftTouchTail);\n            thumbsDraw(pos, true);\n            slide($navShaft, {\n                time: time,\n                pos: pos,\n                direction: opts.navdir,\n                onEnd: onEnd\n            });\n        };\n\n        that.showWhileLongPress = function (options) {\n            if (that.longPress.singlePressInProgress) {\n                return;\n            }\n\n            var index = calcActiveIndex(options);\n            calcGlobalIndexes(index);\n            var time = calcTime(options) / 50;\n            var _activeFrame = activeFrame;\n            that.activeFrame = activeFrame = data[activeIndex];\n            var silent = _activeFrame === activeFrame && !options.user;\n\n            that.showNav(silent, options, time);\n\n            return this;\n        };\n\n        that.showEndLongPress = function (options) {\n            if (that.longPress.singlePressInProgress) {\n                return;\n            }\n\n            var index = calcActiveIndex(options);
2\n            calcGlobalIndexes(index);\n            var time = calcTime(options) / 50;\n            var _activeFrame = activeFrame;\n            that.activeFrame = activeFrame = data[activeIndex];\n\n            var silent = _activeFrame === activeFrame && !options.user;\n\n            that.showStage(silent, options, time);\n\n            showedFLAG = typeof lastActiveIndex !== 'undefined' && lastActiveIndex !== activeIndex;\n            lastActiveIndex = activeIndex;\n            return this;\n        };\n\n        function calcActiveIndex (options) {\n            var index;\n\n            if (typeof options !== 'object') {\n                index = options;\n                options = {};\n            } else {\n                index = options.index;\n            }\n\n            index = index === '>' ? dirtyIndex + 1 : index === '<' ? dirtyIndex - 1 : index === '<<' ? 0 : index === '>>' ? size - 1 : index;\n            index = isNaN(index) ? undefined : index;\n            index = typeof index === 'undefined' ? activeIndex || 0 : index;\n\n            return index;\n        }\n\n        function calcGlobalIndexes (index) {\n            that.activeIndex = activeIndex = edgeIndex(index);\n            prevIndex = getPrevIndex(activeIndex);\n            nextIndex = getNextIndex(activeIndex);\n            nextAutoplayIndex = normalizeIndex(activeIndex + (o_rtl ? -1 : 1));\n            activeIndexes = [activeIndex, prevIndex, nextIndex];\n\n            dirtyIndex = o_loop ? index : activeIndex;\n        }\n\n        function calcTime (options) {\n            var diffIndex = Math.abs(lastActiveIndex - dirtyIndex),\n                time = getNumber(options.time, function () {\n                    return Math.min(o_transitionDuration * (1 + (diffIndex - 1) / 12), o_transitionDuration * 2);\n                });\n\n            if (options.slow) {\n                time *= 10;\n            }\n\n            return time;\n        }\n\n        that.showStage = function (silent, options, time) {\n            unloadVideo($videoPlaying, activeFrame.i !== data[normalizeIndex(repositionIndex)].i);\n            frameDraw(activeIndexes, 'stage');\n            stageFramePosition(SLOW ? [dirtyIndex] : [dirtyIndex, getPrevIndex(dirtyIndex), getNextIndex(dirtyIndex)]);\n            updateTouchTails('go', true);\n\n            silent || triggerEvent('show', {\n                user: options.user,\n                time: time\n            });\n\n            pausedAutoplayFLAG = true;\n\n            var overPos = options.overPos;\n            var onEnd = that.showStage.onEnd = function (skipReposition) {\n                if (onEnd.ok) return;\n                onEnd.ok = true;\n\n                skipReposition || stageShaftReposition(true);\n\n                if (!silent) {\n                    triggerEvent('showend', {\n                        user: options.user\n                    });\n                }\n\n                if (!skipReposition && o_transition && o_transition !== opts.transition) {\n                    that.setOptions({transition: o_transition});\n                    o_transition = false;\n                    return;\n                }\n\n                updateFotoramaState();\n                loadImg(activeIndexes, 'stage');\n\n                updateTouchTails('go', false);\n                stageWheelUpdate();\n\n                stageCursor();\n                releaseAutoplay();\n                changeAutoplay();\n\n                if (that.fullScreen) {\n                    activeFrame[STAGE_FRAME_KEY].find('.' + imgFullClass).attr('aria-hidden', false);\n                    activeFrame[STAGE_FRAME_KEY].find('.' + imgClass).attr('aria-hidden', true)\n                } else {\n                    activeFrame[STAGE_FRAME_KEY].find('.' + imgFullClass).attr('aria-hidden', true);\n                    activeFrame[STAGE_FRAME_KEY].find('.' + imgClass).attr('aria-hidden', false)\n                }\n            };\n\n            if (!o_fade) {\n                slide($stageShaft, {\n                    pos: -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex),\n                    overPos: overPos,\n                    time: time,\n                    onEnd: onEnd\n                });\n            } else {\n                var $activeFrame = activeFrame[STAGE_FRAME_KEY],\n                    $prevActiveFrame = data[lastActiveIndex] && activeIndex !== lastActiveIndex ? data[lastActiveIndex][STAGE_FRAME_KEY] : null;\n\n                fade($activeFrame, $prevActiveFrame, $stageFrame, {\n                    time: time,\n                    method: opts.transition,\n                    onEnd: onEnd\n                }
2, fadeStack);\n            }\n\n            arrsUpdate();\n        };\n\n        that.showNav = function(silent, options, time){\n            thumbArrUpdate();\n            if (o_nav) {\n                navUpdate();\n\n                var guessIndex = limitIndex(activeIndex + minMaxLimit(dirtyIndex - lastActiveIndex, -1, 1));\n                slideNavShaft({\n                    time: time,\n                    coo: guessIndex !== activeIndex && options.coo,\n                    guessIndex: typeof options.coo !== 'undefined' ? guessIndex : activeIndex,\n                    keep: silent\n                });\n                if (o_navThumbs) slideThumbBorder(time);\n            }\n        };\n\n        that.show = function (options) {\n            that.longPress.singlePressInProgress = true;\n\n            var index = calcActiveIndex(options);\n            calcGlobalIndexes(index);\n            var time = calcTime(options);\n            var _activeFrame = activeFrame;\n            that.activeFrame = activeFrame = data[activeIndex];\n\n            var silent = _activeFrame === activeFrame && !options.user;\n\n            that.showStage(silent, options, time);\n            that.showNav(silent, options, time);\n\n            showedFLAG = typeof lastActiveIndex !== 'undefined' && lastActiveIndex !== activeIndex;\n            lastActiveIndex = activeIndex;\n            that.longPress.singlePressInProgress = false;\n\n            return this;\n        };\n\n        that.requestFullScreen = function () {\n            if (o_allowFullScreen && !that.fullScreen) {\n\n                //check that this is not video\n                var isVideo = $((that.activeFrame || {}).$stageFrame || {}).hasClass('fotorama-video-container');\n                if(isVideo) {\n                    return;\n                }\n\n                scrollTop = $WINDOW.scrollTop();\n                scrollLeft = $WINDOW.scrollLeft();\n\n                lockScroll($WINDOW);\n\n                updateTouchTails('x', true);\n\n                measuresStash = $.extend({}, measures);\n\n                $fotorama\n                    .addClass(fullscreenClass)\n                    .appendTo($BODY.addClass(_fullscreenClass));\n\n                $HTML.addClass(_fullscreenClass);\n\n                unloadVideo($videoPlaying, true, true);\n\n                that.fullScreen = true;\n\n                if (o_nativeFullScreen) {\n                    fullScreenApi.request(fotorama);\n                }\n\n                that.resize();\n                loadImg(activeIndexes, 'stage');\n                updateFotoramaState();\n                triggerEvent('fullscreenenter');\n\n                if (!('ontouchstart' in window)) {\n                    $fullscreenIcon.focus();\n                }\n            }\n\n            return this;\n        };\n\n        function cancelFullScreen() {\n            if (that.fullScreen) {\n                that.fullScreen = false;\n\n                if (FULLSCREEN) {\n                    fullScreenApi.cancel(fotorama);\n                }\n\n                $BODY.removeClass(_fullscreenClass);\n                $HTML.removeClass(_fullscreenClass);\n\n                $fotorama\n                    .removeClass(fullscreenClass)\n                    .insertAfter($anchor);\n\n                measures = $.extend({}, measuresStash);\n\n                unloadVideo($videoPlaying, true, true);\n\n                updateTouchTails('x', false);\n\n                that.resize();\n                loadImg(activeIndexes, 'stage');\n\n                lockScroll($WINDOW, scrollLeft, scrollTop);\n\n                triggerEvent('fullscreenexit');\n            }\n        }\n\n        that.cancelFullScreen = function () {\n            if (o_nativeFullScreen && fullScreenApi.is()) {\n                fullScreenApi.cancel(document);\n            } else {\n                cancelFullScreen();\n            }\n\n            return this;\n        };\n\n        that.toggleFullScreen = function () {\n            return that[(that.fullScreen ? 'cancel' : 'request') + 'FullScreen']();\n        };\n\n        that.resize = function (options) {\n            if (!data) return this;\n\n            var time = arguments[1] || 0,\n                setFLAG = arguments[2];\n\n            thumbsPerSlide = getThumbsInSlide($wrap, opts);\n            extendMeasures(!that.fullScreen ? optionsToLowerCase(options) : {\n                width: $(window).width(),\n                maxwidth: null,\n                minwidth: null,\n                height: $(window).height(),\
2n                maxheight: null,\n                minheight: null\n            }, [measures, setFLAG || that.fullScreen || opts]);\n\n            var width = measures.width,\n                height = measures.height,\n                ratio = measures.ratio,\n                windowHeight = $WINDOW.height() - (o_nav ? $nav.height() : 0);\n\n            if (measureIsValid(width)) {\n                $wrap.css({width: ''});\n                $wrap.css({height: ''});\n                $stage.css({width: ''});\n                $stage.css({height: ''});\n                $stageShaft.css({width: ''});\n                $stageShaft.css({height: ''});\n                $nav.css({width: ''});\n                $nav.css({height: ''});\n                $wrap.css({minWidth: measures.minwidth || 0, maxWidth: measures.maxwidth || MAX_WIDTH});\n\n                if (o_nav === 'dots') {\n                    $navWrap.hide();\n                }\n                width = measures.W = measures.w = $wrap.width();\n                measures.nw = o_nav && numberFromWhatever(opts.navwidth, width) || width;\n\n                $stageShaft.css({width: measures.w, marginLeft: (measures.W - measures.w) / 2});\n\n                height = numberFromWhatever(height, windowHeight);\n\n                height = height || (ratio && width / ratio);\n\n                if (height) {\n                    width = Math.round(width);\n                    height = measures.h = Math.round(minMaxLimit(height, numberFromWhatever(measures.minheight, windowHeight), numberFromWhatever(measures.maxheight, windowHeight)));\n                    $stage.css({'width': width, 'height': height});\n\n                    if (opts.navdir === 'vertical' && !that.fullscreen) {\n                        $nav.width(opts.thumbwidth + opts.thumbmargin * 2);\n                    }\n\n                    if (opts.navdir === 'horizontal' && !that.fullscreen) {\n                        $nav.height(opts.thumbheight + opts.thumbmargin * 2);\n                    }\n\n                    if (o_nav === 'dots') {\n                        $nav.width(width)\n                            .height('auto');\n                        $navWrap.show();\n                    }\n\n                    if (opts.navdir === 'vertical' && that.fullScreen) {\n                        $stage.css('height', $WINDOW.height());\n                    }\n\n                    if (opts.navdir === 'horizontal' && that.fullScreen) {\n                        $stage.css('height', $WINDOW.height() - $nav.height());\n                    }\n\n                    if (o_nav) {\n                        switch (opts.navdir) {\n                            case 'vertical':\n                                $navWrap.removeClass(navShafthorizontalClass);\n                                $navWrap.removeClass(navShaftListClass);\n                                $navWrap.addClass(navShaftVerticalClass);\n                                $nav\n                                    .stop()\n                                    .animate({height: measures.h, width: opts.thumbwidth}, time);\n                                break;\n                            case 'list':\n                                $navWrap.removeClass(navShaftVerticalClass);\n                                $navWrap.removeClass(navShafthorizontalClass);\n                                $navWrap.addClass(navShaftListClass);\n                                break;\n                            default:\n                                $navWrap.removeClass(navShaftVerticalClass);\n                                $navWrap.removeClass(navShaftListClass);\n                                $navWrap.addClass(navShafthorizontalClass);\n                                $nav\n                                    .stop()\n                                    .animate({width: measures.nw}, time);\n                                break;\n                        }\n\n                        stageShaftReposition();\n                        slideNavShaft({guessIndex: activeIndex, time: time, keep: true});\n                        if (o_navThumbs && frameAppend.nav) slideThumbBorder(time);\n                    }\n\n                    measuresSetFLAG = setFLAG || true;\n\n                    ready.ok = true;\n                    ready();\n                }\n            }\n\n            stageLeft = $stage.offset().left;\n            setStagePosition();\n\n            return this;\n        };\n\n        that.setOptions = function (options) {\n            $.extend(opts, options);\n            reset();\n            return this;\n        };\n\n        that.shuffle = function () {\n            data && shuffle(data) && reset();\n            return this;\n        };\n\n        function setShadow($el, edge) {\n            if (o_shadows) {\n                $el.removeClass(shadowsLeftClass + ' ' + shadowsRightClass);\n                $el.removeClass(shadowsTopClass + ' ' + shadowsBottomClass);\n                edge && !$videoPlaying && $el.addClass(edge.replace(/^|\\s/g, ' ' + shadowsClass + '--'));\n            }\n        }\n\n        that.longPress = {\n            threshold: 1,\n            count: 0,\n            thumbSlideTime: 20,\n            progress: function(){\n                if (!this.inProgress) {\n                    this.count++;\n                    this.inProgress = this.count > this.threshold;\n                }\n            },\n            end: function(){\n                if(this.inProgress) {\n                    this.isEnded = true\n                }\n            },\n            reset: function(){\n                this.count = 0;\n                this.inProgress = false;\n                this.isEnded = false;\n            }\n        };\n\n        that.destroy = function () {\n            that.cancelFullScreen();\n            that.stopAutoplay();\n\n            data = that.data = null;\n\n            appendElements();\n\n            activeIndexes = [];\n            detachFrames(STAGE_FRAME_KEY);\n\n            reset.ok = false;\n\n            return this;\n        };\n\n        /**\n         *\n         * @returns {jQuery.Fotorama}\n         */\n        that.playVideo = function () {\n            var dataFrame = activeFrame,\n                video = dataFrame.video,\n                _activeIndex = activeIndex;\n\n            if (typeof video === 'object' && dataFrame.videoReady) {\
2n                o_nativeFullScreen && that.fullScreen && that.cancelFullScreen();\n\n                waitFor(function () {\n                    return !fullScreenApi.is() || _activeIndex !== activeIndex;\n                }, function () {\n                    if (_activeIndex === activeIndex) {\n                        dataFrame.$video = dataFrame.$video || $(div(videoClass)).append(createVideoFrame(video));\n                        dataFrame.$video.appendTo(dataFrame[STAGE_FRAME_KEY]);\n\n                        $wrap.addClass(wrapVideoClass);\n                        $videoPlaying = dataFrame.$video;\n\n                        stageNoMove();\n\n                        $arrs.blur();\n                        $fullscreenIcon.blur();\n\n                        triggerEvent('loadvideo');\n                    }\n                });\n            }\n\n            return this;\n        };\n\n        that.stopVideo = function () {\n            unloadVideo($videoPlaying, true, true);\n            return this;\n        };\n\n        that.spliceByIndex = function (index, newImgObj) {\n            newImgObj.i = index + 1;\n            newImgObj.img && $.ajax({\n                url: newImgObj.img,\n                type: 'HEAD',\n                success: function () {\n                    data.splice(index, 1, newImgObj);\n                    reset();\n                }\n            });\n        };\n\n        function unloadVideo($video, unloadActiveFLAG, releaseAutoplayFLAG) {\n            if (unloadActiveFLAG) {\n                $wrap.removeClass(wrapVideoClass);\n                $videoPlaying = false;\n\n                stageNoMove();\n            }\n\n            if ($video && $video !== $videoPlaying) {\n                $video.remove();\n                triggerEvent('unloadvideo');\n            }\n\n            if (releaseAutoplayFLAG) {\n                releaseAutoplay();\n                changeAutoplay();\n            }\n        }\n\n        function toggleControlsClass(FLAG) {\n            $wrap.toggleClass(wrapNoControl
2sClass, FLAG);\n        }\n\n        function stageCursor(e) {\n            if (stageShaftTouchTail.flow) return;\n\n            var x = e ? e.pageX : stageCursor.x,\n                pointerFLAG = x && !disableDirrection(getDirection(x)) && opts.click;\n\n            if (stageCursor.p !== pointerFLAG\n                && $stage.toggleClass(pointerClass, pointerFLAG)) {\n                stageCursor.p = pointerFLAG;\n                stageCursor.x = x;\n            }\n        }\n\n        $stage.on('mousemove', stageCursor);\n\n        function clickToShow(showOptions) {\n            clearTimeout(clickToShow.t);\n\n            if (opts.clicktransition && opts.clicktransition !== opts.transition) {\n                setTimeout(function () {\n                    var _o_transition = opts.transition;\n\n                    that.setOptions({transition: opts.clicktransition});\n\n                    // now safe to pass base transition to o_transition, so that.show will restor it\n                    o_transition = _o_transition;\n                    // this timeout is here to prevent jerking in some browsers\n                    clickToShow.t = setTimeout(function () {\n                        that.show(showOptions);\n                    }, 10);\n                }, 0);\n            } else {\n                that.show(showOptions);\n            }\n        }\n\n        function onStageTap(e, toggleControlsFLAG) {\n            var target = e.target,\n                $target = $(target);\n            if ($target.hasClass(videoPlayClass)) {\n                that.playVideo();\n            } else if (target === fullscreenIcon) {\n                that.toggleFullScreen();\n            } else if ($videoPlaying) {\n                target === videoClose && unloadVideo($videoPlaying, true, true);\n            } else if (!$fotorama.hasClass(fullscreenClass)) {\n                that.requestFullScreen();\n            }\n        }\n\n        function updateTouchTails(key, value) {\n            stageShaftTouchTail[key] = navShaftTouchTail[key] = value;\n        }\n\n        stageShaftTouchTail = moveOnTouch($stageShaft, {\n            onStart: onTouchStart,\n            onMove: function (e, result) {\n                setShadow($stage, result.edge);\n            },\n            onTouchEnd: onTouchEnd,\n            onEnd: function (result) {\n                var toggleControlsFLAG;\n\n                setShadow($stage);\n                toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) &&\n                    opts.arrows;\n\n                if ((result.moved || (toggleControlsFLAG && result.pos !== result.newPos && !result.control)) && result.$target[0] !== $fullscreenIcon[0]) {\n                    var index = getIndexByPos(result.newPos, measures.w, opts.margin, repositionIndex);\n                    \n                    that.show({\n                        index: index,\n                        time: o_fade ? o_transitionDuration : result.time,\n                        overPos: result.overPos,\n                        user: true\n                    });\n                } else if (!result.aborted && !result.control) {\n                    onStageTap(result.startEvent, toggleControlsFLAG);\n                }\n            },\n            timeLow: 1,\n            timeHigh: 1,\n            friction: 2,\n            select: '.' + selectClass + ', .' + selectClass + ' *',\n            $wrap: $stage,\n            direction: 'horizontal'\n\n        });\n\n        navShaftTouchTail = moveOnTouch($navShaft, {\n            onStart: onTouchStart,\n            onMove: function (e, result) {\n                setShadow($nav, result.edge);\n            },\n            onTouchEnd: onTouchEnd,\n            onEnd: function (result) {\n\n                function onEnd() {\n                    slideNavShaft.l = result.newPos;\n                    releaseAutoplay();\n                    changeAutoplay();\n                    thumbsDraw(result.newPos, true);\n                    thumbArrUpdate();\n                }\n\n                if (!result.moved) {\n                    var target = result.$target.closest('.' + navFrameClass, $navShaft)[0];\n                    target && onNavFrameClick.call(target, result.startEvent);\n                } else if (result.pos !== result.newPos) {\n                    pausedAutoplayFLAG = true;\n                    slide($navShaft, {\n                        time: result.time,\n                        pos: result.newPos,\n                        overPos: result.overPos,\n                        direction: opts.navdir,\n                        onEnd: onEnd\n                    });\n                    thumbsDraw(result.newPos);\n                    o_shadows && setShadow($nav, findShadowEdge(result.newPos, navShaftTouchTail.min, navShaftTouchTail.max, result.dir));\n                } else {\n                    onEnd();\n                }\n            },\n            timeLow: .5,\n            timeHigh: 2,\n            friction: 5,\n            $wrap: $nav,\n            direction: opts.navdir\n        });\n\n        stageWheelTail = wheel($stage, {\n            shift: true,\n            onEnd: function (e, direction) {\n                onTouchStart();\n                onTouchEnd();\n                that.show({index: direction, slow: e.altKey})\n            }\n        });\n\n        navWheelTail = wheel($nav, {\n            onEnd: function (e, direction) {\n                onTouchStart();\n                onTouchEnd();\n                var newPos = stop($navShaft) + direction * .25;\n                $navShaft.css(getTranslate(minMaxLimit(newPos, navShaftTouchTail.min, navShaftTouchTail.max), opts.navdir));\n                o_shadows && setShadow($nav, findShadowEdge(newPos, navShaftTouchTail.min, navShaftTouchTail.max, opts.navdir));\n                navWheelTail.prevent = {'<': newPos >= navShaftTouchTail.max, '>': newPos <= navShaftTouchTail.min};\n                clearTimeout(navWheelTail.t);\n                navWheelTail.t = setTimeout(function () {\n                    slideNavShaft.l = newPos;\n                    thumbsDraw(newPos, true)\n                }, TOUCH_TIMEOUT);\n                thumbsDraw(newPos);\n            }\n        });\n\n        $wrap.hover(\n            function () {\n                setTimeout(function () {\n                    if (touchedFLAG) return;\n                    toggleControlsClass(!(hoverFLAG = true));\n                }, 0);\n            },\n            function () {\n                if (!hoverFLAG) return;\n                toggleControlsClass(!(hoverFLAG = false));\n            }\n        );\n\n        function onNavFrameClick(e) {\n            var index = $(this).data().eq;\n\n            if (opts.navtype === 'thumbs') {\n                clickToShow({index: index, slow: e.altKey, user: true, coo: e._x - $nav.offset().left});\n            } else {\n                clickToShow({index: index, slow: e.altKey, user: true});\n            }\n        }\n\n        function onArrClick(e) {\n            clickToShow({index: $arrs.index(this) ? '>' : '<', slow: e.altKey, user: true});\n        }\n\n        smartClick($arrs, function (e) {\n            stopEvent(e);\n            onArrClick.call(this, e);\n        }, {\n            onStart: function () {\n                onTouchStart();\n                stageShaftTouchTail.control = true;\n            },\n            onTouchEnd: onTouchEnd\n        });\n\n        smartClick($thumbArrLeft, function (e) {\n            stopEvent(e);\n            if (opts.navtype === 'thumbs') {\n\n                that.show('<');\n            } else {\n                that.showSlide('prev')\n            }\n        });\n\n        smartClick($thumbArrRight, function (e) {\n            stopEvent(e);\n            if (opts.navtype === 'thumbs') {\n                that.show('>');\n            } else {\n                that.showSlide('next')\n            }\n\n        });
2\n\n\n        function addFocusOnControls(el) {\n            addFocus(el, function () {\n                setTimeout(function () {\n                    lockScroll($stage);\n                }, 0);\n                toggleControlsClass(false);\n            });\n        }\n\n        $arrs.each(function () {\n            addEnterUp(this, function (e) {\n                onArrClick.call(this, e);\n            });\n            addFocusOnControls(this);\n        });\n\n        addEnterUp(fullscreenIcon, function () {\n            if ($fotorama.hasClass(fullscreenClass)) {\n                that.cancelFullScreen();\n                $stageShaft.focus();\n            } else {\n                that.requestFullScreen();\n                $fullscreenIcon.focus();\n            }\n\n        });\n        addFocusOnControls(fullscreenIcon);\n\n        function reset() {\n            setData();\n            setOptions();\n\n            if (!reset.i) {\n                reset.i = true;\n                // Only once\n                var _startindex = opts.startindex;\n                activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(_startindex) || 0;\n                /*(o_rtl ? size - 1 : 0)*///;\n            }\n\n            if (size) {\n                if (changeToRtl()) return;\n\n                if ($videoPlaying) {\n                    unloadVideo($videoPlaying, true);\n                }\n\n                activeIndexes = [];\n                detachFrames(STAGE_FRAME_KEY);\n\n                reset.ok = true;\n\n                that.show({index: activeIndex, time: 0});\n                that.resize();\n            } else {\n                that.destroy();\n            }\n        }\n\n        function changeToRtl() {\n\n            if (!changeToRtl.f === o_rtl) {\n                changeToRtl.f = o_rtl;\n                activeIndex = size - 1 - activeIndex;\n                that.reverse();\n\n                return true;\n            }\n        }\n\n        $.each('load push pop shift unshift reverse sort splice'.split(' '), function (i, method) {\n            that[method] = function () {\n                data = data || [];\n                if (method !== 'load') {\n                    Array.prototype[method].apply(data, arguments);\n                } else if (arguments[0] && typeof arguments[0] === 'object' && arguments[0].length) {\n                    data = clone(arguments[0]);\n                }\n                reset();\n                return that;\n            }\n        });\n\n        function ready() {\n            if (ready.ok) {\n                ready.ok = false;\n                triggerEvent('ready');\n            }\n        }\n\n        reset();\n    };\n    $.fn.fotorama = function (opts) {\n        return this.each(function () {\n            var that = this,\n                $fotorama = $(this),\n                fotoramaData = $fotorama.data(),\n                fotorama = fotoramaData.fotorama;\n\n            if (!fotorama) {\n                waitFor(function () {\n                    return !isHidden(that);\n                }, function () {\n                    fotoramaData.urtext = $fotorama.html();\n                    new $.Fotorama($fotorama,\n                        $.extend(\n                            {},\n                            OPTIONS,\n                            window.fotoramaDefaults,\n                            opts,\n                            fotoramaData\n                        )\n                    );\n                });\n            } else {\n                fotorama.setOptions(opts, true);\n            }\n        });\n    };\n    $.Fotorama.instances = [];\n\n    function calculateIndexes() {\n        $.each($.Fotorama.instances, function (index, instance) {\n            instance.index = index;\n        });\n    }\n\n    function addInstance(instance) {\n        $.Fotorama.instances.push(instance);\n        calculateIndexes();\n    }\n\n    function hideInstance(instance) {\n        $.Fotorama.instances.splice(instance.index, 1);\n        calculateIndexes();\n    }\n\n    $.Fotorama.cache = {};\n    $.Fotorama.measures = {};\n    $ = $ || {};\n    $.Fotorama = $.Fotorama || {};\n    $.Fotorama.jst = $.Fotorama.jst || {};\n\n    $.Fotorama.jst.dots = function (v) {\n        var __t, __p = '', __e = _.escape;\n        __p += '<div class=\"fotorama__nav__frame fotorama__nav__frame--dot\" tabindex=\"0\" role=\"button\" data-gallery-role=\"nav-frame\" data-nav-type=\"thumb\" aria-label>\\r\\n    <div class=\"fotorama__dot\"></div>\\r\\n</div>';\n        return __p\n    };\n\n    $.Fotorama.jst.frameCaption = function (v) {\n        var __t, __p = '', __e = _.escape;\n        __p += '<div class=\"fotorama__caption\" aria-hidden=\"true\">\\r\\n    <div class=\"fotorama__caption__wrap\" id=\"' +\n            ((__t = ( v.labelledby )) == null ? '' : __t) +\n            '\">' +\n            ((__t = ( v.caption )) == null ? '' : __t) +\n            '</div>\\r\\n</div>\\r\\n';\n        return __p\n    };\n\n    $.Fotorama.jst.style = function (v) {\n        var __t, __p = '', __e = _.escape;\n        __p += '.fotorama' +\n            ((__t = ( v.s )) == null ? '' : __t) +\n            ' .fotorama__nav--thumbs .fotorama__nav__frame{\\r\\npadding:' +\n            ((__t = ( v.m )) == null ? '' : __t) +\n            'px;\\r\\nheight:' +\n            ((__t = ( v.h )) == null ? '' : __t) +\n            'px}\\r\\n.fotorama' +\n            ((__t = ( v.s )) == null ? '' : __t) +\n            ' .fotorama__thumb-border{\\r\\nheight:' +\n            ((__t = ( v.h )) == null ? '' : __t) +\n            'px;\\r\\nborder-width:' +\n            ((__t = ( v.b )) == null ? '' : __t) +\n            'px;\\r\\nmargin-top:' +\n            ((__t = ( v.m )) == null ? '' : __t) +\n            'px}';\n        return __p\n    };\n\n    $.Fotorama.jst.thumb = function (v) {\n        var __t, __p = '', __e = _.escape;\n        __p += '<div class=\"fotorama__nav__frame fotorama__nav__frame--thumb\" tabindex=\"0\" role=\"button\" data-gallery-role=\"nav-frame\" data-nav-type=\"thumb\" aria-label>\\r\\n    <div class=\"fotorama__thumb\">\\r\\n    </div>\\r\\n</div>';\n        return __p\n    };\n})(window, document, location, typeof jQuery !== 'undefined' && jQuery);\n\n","fotorama/fotorama.min.js":"/*!\n * Fotorama 4.6.4 | http://fotorama.io/license/\n */\nfotoramaVersion=\"4.6.4\";(function(bo,k,a3,bV,aP){var ag=\"fotorama\",bH=\"fotorama__fullscreen\",ae=ag+\"__wrap\",ah=ae+\"--css2\",aX=ae+\"--css3\",bt=ae+\"--video\",ar=ae+\"--fade\",aw=ae+\"--slide\",P=ae+\"--no-controls\",aM=ae+\"--no-sha
2dows\",U=ae+\"--pan-y\",a0=ae+\"--rtl\",az=ae+\"--only-active\",bN=ae+\"--no-captions\",f=ae+\"--toggle-arrows\",a7=ag+\"__stage\",x=a7+\"__frame\",l=x+\"--video\",B=a7+\"__shaft\",aB=ag+\"__grab\",bC=ag+\"__pointer\",aK=ag+\"__arr\",F=aK+\"--disabled\",bc=aK+\"--prev\",r=aK+\"--next\",bO=ag+\"__nav\",bq=bO+\"-wrap\",aH=bO+\"__shaft\",b=bq+\"--vertical\",ax=bq+\"--list\",bZ=bq+\"--horizontal\",bW=bO+\"--dots\",ai=bO+\"--thumbs\",aG=bO+\"__frame\",br=ag+\"__fade\",al=br+\"-front\",n=br+\"-rear\",aW=ag+\"__shadow\",bz=aW+\"s\",S=bz+\"--left\",aL=bz+\"--right\",a2=bz+\"--top\",aR=bz+\"--bottom\",a4=ag+\"__active\",a9=ag+\"__select\",bs=ag+\"--hidden\",M=ag+\"--fullscreen\",aJ=ag+\"__fullscreen-icon\",bP=ag+\"__error\",bM=ag+\"__loading\",c=ag+\"__loaded\",b3=c+\"--full\",bg=c+\"--img\",bR=ag+\"__grabbing\",J=ag+\"__img\",Y=J+\"--full\",bS=ag+\"__thumb\",b0=bS+\"__arr--left\",H=bS+\"__arr--right\",cb=bS+\"-border\",bd=ag+\"__html\",af=ag+\"-video-container\",bJ=ag+\"__video\",T=bJ+\"-play\",w=bJ+\"-close\",au=ag+\"_horizontal_ratio\",aY=ag+\"_vertical_ratio\",ca=ag+\"__spinner\",Z=ca+\"--show\";var E=bV&&bV.fn.jquery.split(\".\");if(!E||E[0]<1||(E[0]==1&&E[1]<8)){throw\"Fotorama requires jQuery 1.8 or later and will not run without it.\"}var bx={};var ap=(function(co,ct,cj){var cf=\"2.8.3\",cm={},cD=ct.documentElement,cE=\"modernizr\",cB=ct.createElement(cE),cp=cB.style,cg,cw={}.toString,cy=\" -webkit- -moz- -o- -ms- \".split(\" \"),cd=\"Webkit Moz O ms\",cG=cd.split(\" \"),cq=cd.toLowerCase().split(\" \"),ck={},ce={},cu={},cA=[],cv=cA.slice,cc,cz=function(cQ,cS,cK,cR){var cJ,cP,cM,cN,cI=ct.createElement(\"div\"),cO=ct.body,cL=cO||ct.createElement(\"body\");if(parseInt(cK,10)){while(cK--){cM=ct.createElement(\"div\");cM.id=cR?cR[cK]:cE+(cK+1);cI.appendChild(cM)}}cJ=[\"&#173;\",'<style id=\"s',cE,'\">',cQ,\"</style>\"].join(\"\");cI.id=cE;(cO?cI:cL).innerHTML+=cJ;cL.appendChild(cI);if(!cO){cL.style.background=\"\";cL.style.overflow=\"hidden\";cN=cD.style.overflow;cD.style.overflow=\"hidden\";cD.appendChild(cL)}cP=cS(cI,cQ);if(!cO){cL.parentNode.removeChild(cL);cD.style.overflow=cN}else{cI.parentNode.removeChild(cI)}return !!cP},cs=({}).hasOwnProperty,cC;if(!cl(cs,\"undefined\")&&!cl(cs.call,\"undefined\")){cC=function(cI,cJ){return cs.call(cI,cJ)}}else{cC=function(cI,cJ){return((cJ in cI)&&cl(cI.constructor.prototype[cJ],\"undefined\"))}}if(!Function.prototype.bind){Function.prototype.bind=function cH(cK){var cL=this;if(typeof cL!=\"function\"){throw new TypeError()}var cI=cv.call(arguments,1),cJ=function(){if(this instanceof cJ){var cO=function(){};cO.prototype=cL.prototype;var cN=new cO();var cM=cL.apply(cN,cI.concat(cv.call(arguments)));if(Object(cM)===cM){return cM}return cN}else{return cL.apply(cK,cI.concat(cv.call(arguments)))}};return cJ}}function cr(cI){cp.cssText=cI}function ci(cJ,cI){return cr(cy.join(cJ+\";\")+(cI||\"\"))}function cl(cJ,cI){return typeof cJ===cI}function cn(cJ,cI){return !!~(\"\"+cJ).indexOf(cI)}function cF(cK,cI){for(var cJ in cK){var cL=cK[cJ];if(!cn(cL,\"-\")&&cp[cL]!==cj){return cI==\"pfx\"?cL:true}}return false}function cx(cJ,cM,cL){for(var cI in cJ){var cK=cM[cJ[cI]];if(cK!==cj){if(cL===false){return cJ[cI]}if(cl(cK,\"function\")){return cK.bind(cL||cM)}return cK}}return false}function i(cM,cI,cL){var cJ=cM.charAt(0).toUpperCase()+cM.slice(1),cK=(cM+\" \"+cG.join(cJ+\" \")+cJ).split(\" \");if(cl(cI,\"string\")||cl(cI,\"undefined\")){return cF(cK,cI)}else{cK=(cM+\" \"+(cq).join(cJ+\" \")+cJ).split(\" \");return cx(cK,cI,cL)}}ck.touch=function(){var cI;if((\"ontouchstart\" in co)||co.DocumentTouch&&ct instanceof DocumentTouch){cI=true}else{cz([\"@media (\",cy.join(\"touch-enabled),(\"),cE,\")\",\"{#modernizr{top:9px;position:absolute}}\"].join(\"\"),function(cJ){cI=cJ.offsetTop===9})}return cI};ck.csstransforms3d=function(){var cI=!!i(\"perspective\");if(cI&&\"webkitPerspective\" in cD.style){cz(\"@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}\",function(cJ,cK){cI=cJ.offsetLeft===9&&cJ.offsetHeight===3})}return cI};ck.csstransitions=function(){return i(\"transition\")};for(var ch in ck){if(cC(ck,ch)){cc=ch.toLowerCase();cm[cc]=ck[ch]();cA.push((cm[cc]?\"\":\"no-\")+cc)}}cm.addTest=function(cJ,cK){if(typeof cJ==\"object\"){for(var cI in cJ){if(cC(cJ,cI)){cm.addTest(cI,cJ[cI])}}}else{cJ=cJ.toLowerCase();if(cm[cJ]!==cj){return cm}
2cK=typeof cK==\"function\"?cK():cK;if(typeof enableClasses!==\"undefined\"&&enableClasses){cD.className+=\" \"+(cK?\"\":\"no-\")+cJ}cm[cJ]=cK}return cm};cr(\"\");cB=cg=null;cm._version=cf;cm._prefixes=cy;cm._domPrefixes=cq;cm._cssomPrefixes=cG;cm.testProp=function(cI){return cF([cI])};cm.testAllProps=i;cm.testStyles=cz;cm.prefixed=function(cK,cJ,cI){if(!cJ){return i(cK,\"pfx\")}else{return i(cK,cJ,cI)}};return cm})(bo,k);var bB={ok:false,is:function(){return false},request:function(){},cancel:function(){},event:\"\",prefix:\"\"},h=\"webkit moz o ms khtml\".split(\" \");if(typeof k.cancelFullScreen!=\"undefined\"){bB.ok=true}else{for(var bv=0,N=h.length;bv<N;bv++){bB.prefix=h[bv];if(typeof k[bB.prefix+\"CancelFullScreen\"]!=\"undefined\"){bB.ok=true;break}}}if(bB.ok){bB.event=bB.prefix+\"fullscreenchange\";bB.is=function(){switch(this.prefix){case\"\":return k.fullScreen;case\"webkit\":return k.webkitIsFullScreen;default:return k[this.prefix+\"FullScreen\"]}};bB.request=function(i){return(this.prefix===\"\")?i.requestFullScreen():i[this.prefix+\"RequestFullScreen\"]()};bB.cancel=function(i){return(this.prefix===\"\")?k.cancelFullScreen():k[this.prefix+\"CancelFullScreen\"]()}}function a6(i){var cc=\"bez_\"+bV.makeArray(arguments).join(\"_\").replace(\".\",\"p\");if(typeof bV.easing[cc]!==\"function\"){var cd=function(ck,ci){var cf=[null,null],cl=[null,null],cj=[null,null],ch=function(cm,cn){cj[cn]=3*ck[cn];cl[cn]=3*(ci[cn]-ck[cn])-cj[cn];cf[cn]=1-cj[cn]-cl[cn];return cm*(cj[cn]+cm*(cl[cn]+cm*cf[cn]))},cg=function(cm){return cj[0]+cm*(2*cl[0]+3*cf[0]*cm)},ce=function(co){var cm=co,cn=0,cp;while(++cn<14){cp=ch(cm,0)-co;if(Math.abs(cp)<0.001){break}cm-=cp/cg(cm)}return cm};return function(cm){return ch(ce(cm),1)}};bV.easing[cc]=function(cf,cg,ce,ci,ch){return ci*cd([i[0],i[1]],[i[2],i[3]])(cg/ch)+ce}}return cc}var bf=bV(bo),bw=bV(k),R,I,bT=a3.hash.replace(\"#\",\"\")===\"quirks\",ac=ap.csstransforms3d,aA=ac&&!bT,aN=ac||k.compatMode===\"CSS1Compat\",s=bB.ok,am=navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),bh=!aA||am,aZ=navigator.msPointerEnabled,y=\"onwheel\" in k.createElement(\"div\")?\"wheel\":k.onmousewheel!==aP?\"mousewheel\":\"DOMMouseScroll\",b8=250,ba=300,bY=1400,bQ=5000,b9=2,L=64,bk=500,bE=333,bu=\"$stageFrame\",b7=\"$navDotFrame\",bl=\"$navThumbFrame\",bF=\"auto\",u=a6([0.1,0,0.25,1]),bK=1200,b4=1,Q={width:null,minwidth:null,maxwidth:\"100%\",height:null,minheight:null,maxheight:null,ratio:null,margin:b9,nav:\"dots\",navposition:\"bottom\",navwidth:null,thumbwidth:L,thumbheight:L,thumbmargin:b9,thumbborderwidth:b9,allowfullscreen:false,transition:\"slide\",clicktransition:null,transitionduration:ba,captions:true,startindex:0,loop:false,autoplay:false,stopautoplayontouch:true,keyboard:false,arrows:true,click:true,swipe:false,trackpad:false,shuffle:false,direction:\"ltr\",shadows:true,showcaption:true,navdir:\"horizontal\",navarrows:true,navtype:\"thumbs\"},p={left:true,right:true,down:true,up:true,space:false,home:false,end:false};function g(){}function bb(cd,cc,i){return Math.max(isNaN(cc)?-Infinity:cc,Math.min(isNaN(i)?Infinity:i,cd))}function bi(cc,i){return cc.match(/ma/)&&cc.match(/-?\\d+(?!d)/g)[cc.match(/3d/)?(i===\"vertical\"?13:12):(i===\"vertical\"?5:4)]}function aa(cc,i){if(aA){return +bi(cc.css(\"transform\"),i)}else{return +cc.css(i===\"vertical\"?\"top\":\"left\").replace(\"px\",\"\")}}function b2(cd,cc){var i={};if(aA){switch(cc){case\"vertical\":i.transform=\"translate3d(0, \"+(cd)+\"px,0)\";break;case\"list\":break;default:i.transform=\"translate3d(\"+(cd)+\"px,0,0)\";break}}else{cc===\"vertical\"?i.top=cd:i.left=cd}return i}function b6(i){return{\"transition-duration\":i+\"ms\"}}function aV(cc,i){return isNaN(cc)?i:cc}function m(cc,i){return aV(+String(cc).replace(i||\"px\",\"\"))}function K(i){return/%$/.test(i)?m(i,\"%\"):aP}function d(cc,i){return aV(K(cc)/100*i,m(cc))}function t(i){return(!isNaN(m(i))||!isNaN(m(i,\"%\")))&&i}function a8(cc,cd,ce,i){return(cc-(i||0))*(cd+(ce||0))}function by(ce,cc,cd,i){return -Math.round(ce/(cc+(cd||0))-(i||0))}function aO(cd){var cc=cd.data();if(cc.tEnd){return}var ce=cd[0],i={WebkitTransition:\"webkitTransitionEnd\",MozTransition:\"transitionend\",OTransition:\"oTransitionEnd otransitionend\",msTransition:\"MSTransitionEnd\",transition:\"transitionend\"};D(ce,i[ap.prefixed(\"transition\")],function(cf){cc.tProp&&cf.propertyName.match(cc.tProp)&&cc.onEndFn()});cc.tEnd=true}function X(cd,cf,ce,cg){var cc,i=cd.data();if(i){i.onEndFn=function(){if(cc){return}cc=true;clearTimeout(i.tT);ce()};i.tProp=cf;clearTimeout(i.tT);i.tT=setTimeout(function(){i.onEndFn()},cg*1.5);aO(cd)}}function a1(cd,cf){var cc=cd.navdir||\"horizontal\";if(cd.length){var i=cd.data();if(aA){cd.css(b6(0));i.onEndFn=g;clearTimeout(i.tT)}else{cd.stop()}var ce=bj(cf,function(){return aa(cd,cc)});cd.css(b2(ce,cc));return ce}}function bj(){var cc;for(var cd=0,i=arguments.length;cd<i;cd++){cc=cd?arguments[cd]():arguments[cd];if(typeof cc===\"number\"){break}}return cc}function aF(cc,i){return Math.round(cc+((i-cc)/1.5))}function aU(){aU.p=aU.p||(a3.protocol===\"https:\"?\"https://\":\"http://\");return aU.p}function ak(cc){var i=k.createElement(\"a\");i.href=cc;return i}function at(i,cd){if(typeof i!==\"string\"){return i}i=ak(i);var cf,ce;if(i.host.match(/youtube\\.com/)&&i.search){cf=i.search.split(\"v=\")[1];if(cf){var cc=cf.indexOf(\"&\");if(cc!==-1){cf=cf.substring(0,cc)}ce=\"youtube\"}}else{if(i.host.match(/youtube\\.com|youtu\\.be/)){cf=i.pathname.replace(/^\\/(embed\\/|v\\/)?/,\"\").replace(/\\/.*/,\"\");ce=\"youtube\"}else{if(i.host.match(/vimeo\\.com/)){ce=\"vimeo\";cf=i.pathname.replace(/^\\/(video\\/)?/,\"\").replace(/\\/.*/,\"\")}}}if((!cf||!ce)&&cd){cf=i.href;ce=\"custom\"}return cf?{id:cf,type:ce,s:i.search.replace(/^\\?/,\"\"),p:aU()}:false}function aQ(cg,ce,cf){var cc,i,cd=cg.video;
2if(cd.type===\"youtube\"){i=aU()+\"img.youtube.com/vi/\"+cd.id+\"/default.jpg\";cc=i.replace(/\\/default.jpg$/,\"/hqdefault.jpg\");cg.thumbsReady=true}else{if(cd.type===\"vimeo\"){bV.ajax({url:aU()+\"vimeo.com/api/v2/video/\"+cd.id+\".json\",dataType:\"jsonp\",success:function(ch){cg.thumbsReady=true;v(ce,{img:ch[0].thumbnail_large,thumb:ch[0].thumbnail_small},cg.i,cf)}})}else{cg.thumbsReady=true}}return{img:cc,thumb:i}}function v(ch,cd,cf,ci){for(var cg=0,ce=ch.length;cg<ce;cg++){var cj=ch[cg];if(cj.i===cf&&cj.thumbsReady){var cc={videoReady:true};cc[bu]=cc[bl]=cc[b7]=false;ci.splice(cg,1,bV.extend({},cj,cc,cd));break}}}function bI(cc){var ce=[];function cd(cf,ch,cn){var ci=cf.children(\"img\").eq(0),cm=cf.attr(\"href\"),ck=cf.attr(\"src\"),cl=ci.attr(\"src\"),cj=ch.video,cg=cn?at(cm,cj===true):false;if(cg){cm=false}else{cg=cj}i(cf,ci,bV.extend(ch,{video:cg,img:ch.img||cm||ck||cl,thumb:ch.thumb||cl||ck||cm}))}function i(cg,cj,ck){var ci=ck.thumb&&ck.img!==ck.thumb,ch=m(ck.width||cg.attr(\"width\")),cf=m(ck.height||cg.attr(\"height\"));bV.extend(ck,{width:ch,height:cf,thumbratio:bm(ck.thumbratio||(m(ck.thumbwidth||(cj&&cj.attr(\"width\"))||ci||ch)/m(ck.thumbheight||(cj&&cj.attr(\"height\"))||ci||cf)))})}cc.children().each(function(){var cf=bV(this),cg=bA(bV.extend(cf.data(),{id:cf.attr(\"id\")}));if(cf.is(\"a, img\")){cd(cf,cg,true)}else{if(!cf.is(\":empty\")){i(cf,null,bV.extend(cg,{html:this,_html:cf.html()}))}else{return}}ce.push(cg)});return ce}function W(i){return i.offsetWidth===0&&i.offsetHeight===0}function be(i){return !bV.contains(k.documentElement,i)}function bX(cf,cd,ce,cc){if(!bX.i){bX.i=1;bX.ii=[true]}cc=cc||bX.i;if(typeof bX.ii[cc]===\"undefined\"){bX.ii[cc]=true}if(cf()){cd()}else{bX.ii[cc]&&setTimeout(function(){bX.ii[cc]&&bX(cf,cd,ce,cc)},ce||100)}return bX.i++}bX.stop=function(cc){bX.ii[cc]=false};function V(ce,cd){var cc=ce.data(),cg=cc.measures;if(cg&&(!cc.l||cc.l.W!==cg.width||cc.l.H!==cg.height||cc.l.r!==cg.ratio||cc.l.w!==cd.w||cc.l.h!==cd.h)){var i=bb(cd.h,0,cg.height),cf=i*cg.ratio;aS.setRatio(ce,cf,i);cc.l={W:cg.width,H:cg.height,r:cg.ratio,w:cd.w,h:cd.h}}return true}function an(i,cd){var cc=i[0];if(cc.styleSheet){cc.styleSheet.cssText=cd}else{i.html(cd)}}function bp(ce,cd,i,cc){return cd===i?false:cc===\"vertical\"?(ce<=cd?\"top\":ce>=i?\"bottom\":\"top bottom\"):(ce<=cd?\"left\":ce>=i?\"right\":\"left right\")}function z(cc,cd,i){i=i||{};cc.each(function(){var cg=bV(this),cf=cg.data(),ce;if(cf.clickOn){return}cf.clickOn=true;bV.extend(aI(cg,{onStart:function(ch){ce=ch;(i.onStart||g).call(this,ch)},onMove:i.onMove||g,onTouchEnd:i.onTouchEnd||g,onEnd:function(ch){if(ch.moved){return}cd.call(this,ce)}}),{noMove:true})})}function ab(i,cc){return'<div class=\"'+i+'\">'+(cc||\"\")+\"</div>\"}function aT(i){return\".\"+i}function q(i){var cc='<iframe src=\"'+i.p+i.type+\".com/embed/\"+i.id+'\" frameborder=\"0\" allowfullscreen></iframe>';return cc}function aC(cf){var cc=cf.length;while(cc){var ce=Math.floor(Math.random()*cc--);var cd=cf[cc];cf[cc]=cf[ce];cf[ce]=cd}return cf}function bG(i){return Object.prototype.toString.call(i)==\"[object Array]\"&&bV.map(i,function(cc){return bV.extend({},cc)})}function bU(i,cd,cc){i.scrollLeft(cd||0).scrollTop(cc||0)}function bA(i){if(i){var cc={};bV.each(i,function(cd,ce){cc[cd.toLowerCase()]=ce});return cc}}function bm(i){if(!i){return}var cc=+i;if(!isNaN(cc)){return cc}else{cc=i.split(\"/\");return +cc[0]/+cc[1]||aP}}function D(cd,ce,cc,i){if(!ce){return}cd.addEventListener?cd.addEventListener(ce,cc,!!i):cd.attachEvent(\"on\"+ce,cc)}function a5(i,cc){if(i>cc.max){i=cc.max}else{if(i<cc.min){i=cc.min}}return i}function aD(i,ck,ch,cf,ce,cd,cc){var cg,cj,ci;if(cc===\"horizontal\"){cj=i.thumbwidth;ci=cd.width()}else{cj=i.thumbheight;ci=cd.height()}if((cj+i.margin)*(ch+1)>=(ci-cf)){if(cc===\"horizontal\"){cg=-ce.position().left}else{cg=-ce.position().top}}else{if((cj+i.margin)*(ch)<=Math.abs(cf)){if(cc===\"horizontal\"){cg=-ce.position().left+ci-(cj+i.margin)}else{cg=-ce.position().top+ci-(cj+i.margin)}}else{cg=cf}}cg=a5(cg,ck);return cg||0}function aj(i){return !!i.getAttribute(\"disabled\")}function ad(cc,i){if(i){return{disabled:cc}}else{return{tabindex:cc*-1+\"\",disabled:cc}}}function a(cc,i){D(cc,\"keyup\",function(cd){aj(cc)||cd.keyCode==13&&i.call(cc,cd)})}function bL(cc,i){D(cc,\"focus\",cc.onfocusin=function(cd){i.call(cc,cd)},true)}function O(cc,i){cc.preventDefault?cc.preventDefault():(cc.returnValue=false);i&&cc.stopPropagation&&cc.stopPropagation()}function aE(cd,cc){var i=/iP(ad|hone|od)/i.test(bo.navigator.userAgent);if(i&&cc===\"touchend\"){cd.on(\"touchend\",function(ce){bw.trigger(\"mouseup\",ce)})}cd.on(cc,function(ce){O(ce,true);return false})}function ay(i){return i?\">\":\"<\"}var aS=(function(){function cd(ch,ce,cg){var cf=ce/cg;if(cf<=1){ch.parent().removeClass(au);ch.parent().addClass(aY)}else{ch.parent().removeClass(aY);ch.parent().addClass(au)}}function i(cf,cg,ch){var ce=ch;if(!cf.attr(ce)&&cf.attr(ce)!==aP){cf.attr(ce,cg)}if(cf.find(\"[\"+ce+\"]\").length){cf.find(\"[\"+ce+\"]\").each(function(){bV(this).attr(ce,cg)})}}function cc(cf,ce,ci){var cg=false,ch;cf.showCaption===ci||cf.showCaption===true?ch=true:ch=false;if(!ce){return false}if(cf.caption&&ch){cg=true}return cg}return{setRatio:cd,setThumbAttr:i,isExpectedCaption:cc}}(aS||{},jQuery));function A(ce,cd){var cc=ce.data(),i=Math.round(cd.pos),cf=function(){if(cc&&
2cc.sliding){cc.sliding=false}(cd.onEnd||g)()};if(typeof cd.overPos!==\"undefined\"&&cd.overPos!==cd.pos){i=cd.overPos}var cg=bV.extend(b2(i,cd.direction),cd.width&&{width:cd.width},cd.height&&{height:cd.height});if(cc&&cc.sliding){cc.sliding=true}if(aA){ce.css(bV.extend(b6(cd.time),cg));if(cd.time>10){X(ce,\"transform\",cf,cd.time)}else{cf()}}else{ce.stop().animate(cg,cd.time,u,cf)}}function aq(ck,cj,cc,cm,ce,i){var ch=typeof i!==\"undefined\";if(!ch){ce.push(arguments);Array.prototype.push.call(arguments,ce.length);if(ce.length>1){return}}ck=ck||bV(ck);cj=cj||bV(cj);var ci=ck[0],cg=cj[0],cf=cm.method===\"crossfade\",cl=function(){if(!cl.done){cl.done=true;var cn=(ch||ce.shift())&&ce.shift();cn&&aq.apply(this,cn);(cm.onEnd||g)(!!cn)}},cd=cm.time/(i||1);cc.removeClass(n+\" \"+al);ck.stop().addClass(n);cj.stop().addClass(al);cf&&cg&&ck.fadeTo(0,0);ck.fadeTo(cf?cd:0,1,cf&&cl);cj.fadeTo(cd,0,cl);(ci&&cf)||cg||cl()}var G,b5,e,j,bD;function bn(i){var cc=(i.touches||[])[0]||i;i._x=cc.pageX||cc.originalEvent.pageX;i._y=cc.clientY||cc.originalEvent.clientY;i._now=bV.now()}function aI(cr,cg){var cc=cr[0],cj={},i,cl,cf,cn,cs,cd,ce,co,ch;function cq(ct){cf=bV(ct.target);cj.checked=cd=ce=ch=false;if(i||cj.flow||(ct.touches&&ct.touches.length>1)||ct.which>1||(G&&G.type!==ct.type&&e)||(cd=cg.select&&cf.is(cg.select,cc))){return cd}cs=ct.type===\"touchstart\";ce=cf.is(\"a, a *\",cc);cn=cj.control;co=(cj.noMove||cj.noSwipe||cn)?16:!cj.snap?4:0;bn(ct);cl=G=ct;b5=ct.type.replace(/down|start/,\"move\").replace(/Down/,\"Move\");(cg.onStart||g).call(cc,ct,{control:cn,$target:cf});i=cj.flow=true;if(!cs||cj.go){O(ct)}}function ck(cx){if((cx.touches&&cx.touches.length>1)||(aZ&&!cx.isPrimary)||b5!==cx.type||!i){i&&ci();(cg.onTouchEnd||g)();return}bn(cx);var cy=Math.abs(cx._x-cl._x),cu=Math.abs(cx._y-cl._y),cw=cy-cu,cv=(cj.go||cj.x||cw>=0)&&!cj.noSwipe,ct=cw<0;if(cs&&!cj.checked){if(i=cv){O(cx)}}else{O(cx);(cg.onMove||g).call(cc,cx,{touch:cs})}if(!ch&&Math.sqrt(Math.pow(cy,2)+Math.pow(cu,2))>co){ch=true}cj.checked=cj.checked||cv||ct}function ci(cu){(cg.onTouchEnd||g)();var ct=i;cj.control=i=false;if(ct){cj.flow=false}if(!ct||(ce&&!cj.checked)){return}cu&&O(cu);e=true;clearTimeout(j);j=setTimeout(function(){e=false},1000);(cg.onEnd||g).call(cc,{moved:ch,$target:cf,control:cn,touch:cs,startEvent:cl,aborted:!cu||cu.type===\"MSPointerCancel\"})}function cm(){if(cj.flow){return}cj.flow=true}function cp(){if(!cj.flow){return}cj.flow=false}if(aZ){D(cc,\"MSPointerDown\",cq);D(k,\"MSPointerMove\",ck);D(k,\"MSPointerCancel\",ci);D(k,\"MSPointerUp\",ci)}else{D(cc,\"touchstart\",cq);D(cc,\"touchmove\",ck);D(cc,\"touchend\",ci);D(k,\"touchstart\",cm);D(k,\"touchend\",cp);D(k,\"touchcancel\",cp);bf.on(\"scroll\",cp);cr.on(\"mousedown pointerdown\",cq);bw.on(\"mousemove pointermove\",ck).on(\"mouseup pointerup\",ci)}if(ap.touch){bD=\"a\"}else{bD=\"div\"}cr.on(\"click\",bD,function(ct){cj.checked&&O(ct)});return cj}function ao(cz,cd){var cc=cz[0],ce=cz.data(),cm={},cw,cf,cx,cj,ch,cy,co,cg,cr,ct,cp,cq,i,cv,ci,cn;function cs(cA,cB){cn=true;cw=cf=(cq===\"vertical\")?cA._y:cA._x;co=cA._now;cy=[[co,cw]];cx=cj=cm.noMove||cB?0:a1(cz,(cd.getPos||g)());(cd.onStart||g).call(cc,cA)}function cu(cB,cA){cr=cm.min;ct=cm.max;cp=cm.snap,cq=cm.direction||\"horizontal\",cz.navdir=cq;i=cB.altKey;cn=ci=false;cv=cA.control;if(!cv&&!ce.sliding){cs(cB)}}function cl(cB,cA){if(!cm.noSwipe){if(!cn){cs(cB)}cf=(cq===\"vertical\")?cB._y:cB._x;cy.push([cB._now,cf]);cj=cx-(cw-cf);ch=bp(cj,cr,ct,cq);if(cj<=cr){cj=aF(cj,cr)}else{if(cj>=ct){cj=aF(cj,ct)}}if(!cm.noMove){cz.css(b2(cj,cq));if(!ci){ci=true;cA.touch||aZ||cz.addClass(bR)}(cd.onMove||g).call(cc,cB,{pos:cj,edge:ch})}}}function ck(cJ){if(cm.noSwipe&&cJ.moved){return}if(!cn){cs(cJ.startEvent,true)}cJ.touch||aZ||cz.removeClass(bR);cg=bV.now();var cG=cg-b8,cK,cP,cQ,cS=null,cA,cE,cN,cD,cF,cI=ba,cO,cH=cd.friction;for(var cC=cy.length-1;cC>=0;cC--){cK=cy[cC][0];cP=Math.abs(cK-cG);if(cS===null||cP<cQ){cS=cK;cA=cy[cC][1]}else{if(cS===cG||cP>cQ){break}}cQ=cP}cD=bb(cj,cr,ct);var cT=cA-cf,cR=cT>=0,cL=cg-cS,cB=cL>b8,cM=!cB&&cj!==cx&&cD===cj;if(cp){cD=bb(Math[cM?(cR?\"floor\":\"ceil\"):\"round\"](cj/cp)*cp,cr,ct);cr=ct=cD}if(cM&&(cp||cD===cj)){cO=-(cT/cL);cI*=bb(Math.abs(cO),cd.timeLow,cd.timeHigh);cE=Math.round(cj+cO*cI/cH);if(!cp){cD=cE}if(!cR&&cE>ct||cR&&cE<cr){cN=cR?cr:ct;cF=cE-cN;if(!cp){cD=cN}cF=bb(cD+cF*0.03,cN-50,cN+50);cI=Math.abs((cj-cF)/(cO/cH))}}cI*=i?10:1;(cd.onEnd||g).call(cc,bV.extend(cJ,{moved:cJ.moved||cB&&cp,pos:cj,newPos:cD,overPos:cF,time:cI,dir:cq}))}cm=bV.extend(aI(cd.$wrap,bV.extend({},cd,{onStart:cu,onMove:cl,onEnd:ck})),cm);return cm}function o(ce,cd){var cg=ce[0],ch,cf,i,cc={prevent:{}};D(cg,y,function(co){var cl=co.wheelDeltaY||-1*co.deltaY||0,cn=co.wheelDeltaX||-1*co.deltaX||0,ck=Math.abs(cn)&&!Math.abs(cl),cm=ay(cn<0),cp=cf===cm,ci=bV.now(),cj=ci-i<b8;cf=cm;i=ci;if(!ck||!cc.ok||cc.prevent[cm]&&!ch){return}else{O(co,true);if(ch&&cp&&cj){return}}if(cd.shift){ch=true;clearTimeout(cc.t);cc.t=setTimeout(function(){ch=false},bY)}(cd.onEnd||g)(co,cd.shift?cm:cn)});return cc}jQuery.Fotorama=function(d6,c3){R=bV(\"html\");I=bV(\"body\");var cg=this,cC=bV.now(),cQ=ag+cC,eu=d6[0],dP,cY=1,cR=d6.data(),c1,de=bV(\"<style></style>\"),c9=bV(ab(bs)),dk=d6.find(aT(ae)),cf=dk.find(aT(a7)),dY=cf[0],cl=d6.find(aT(B)),c8=bV(),dW=d6.find(aT(bc)),da=d6.find(aT(r)),cU=d6.find(aT(aK)),dU=d6.find(aT(bq)),dO=dU.find(aT(bO)),cF=dO.find(aT(aH)),dA,cB=bV(),cW=bV(),dS=cl.data(),cX=cF.data(),c7=d6.find(aT(cb)),eg=d6.find(aT(b0)),dX=d6.find(aT(H)),dM=d6.find(aT(aJ)),dD=dM[
20],cH=bV(ab(T)),dt=d6.find(aT(w)),d1=dt[0],eb=d6.find(aT(ca)),dg,eo=false,dF,ea,c2,ed,dw,d4,cN,cK,dx,dj,cq,c0,d8,c4,d2,cv,ch,ej,ds,cu,ec,dH,dE,d0={},en={},dG,d5={},cG={},dy={},ef={},cs,cT,ee,cj,el,cd={},er={},dZ,c6,dz,dr,d3=0,cI=[];dk[bu]=bV('<div class=\"'+x+'\"></div>');dk[bl]=bV(bV.Fotorama.jst.thumb());dk[b7]=bV(bV.Fotorama.jst.dots());cd[bu]=[];cd[bl]=[];cd[b7]=[];er[bu]={};dk.addClass(aA?aX:ah);cR.fotorama=this;function ep(){bV.each(dP,function(ey,eA){if(!eA.i){eA.i=cY++;var ez=at(eA.video,true);if(ez){var ex={};eA.video=ez;if(!eA.img&&!eA.thumb){ex=aQ(eA,dP,cg)}else{eA.thumbsReady=true}v(dP,{img:ex.img,thumb:ex.thumb},eA.i,cg)}}})}function df(ex){return dE[ex]}function i(){if(cf!==aP){if(c3.navdir==\"vertical\"){var ex=c3.thumbwidth+c3.thumbmargin;cf.css(\"left\",ex);da.css(\"right\",ex);dM.css(\"right\",ex);dk.css(\"width\",dk.css(\"width\")+ex);cl.css(\"max-width\",dk.width()-ex)}else{cf.css(\"left\",\"\");da.css(\"right\",\"\");dM.css(\"right\",\"\");dk.css(\"width\",dk.css(\"width\")+ex);cl.css(\"max-width\",\"\")}}}function ek(eB){var eC=\"keydown.\"+ag,eD=ag+cC,ex=\"keydown.\"+eD,eA=\"keyup.\"+eD,ey=\"resize.\"+eD+\" orientationchange.\"+eD,ez;if(eB){bw.on(ex,function(eG){var eF,eE;if(dg&&eG.keyCode===27){eF=true;cO(dg,true,true)}else{if(cg.fullScreen||(c3.keyboard&&!cg.index)){if(eG.keyCode===27){eF=true;cg.cancelFullScreen()}else{if((eG.shiftKey&&eG.keyCode===32&&df(\"space\"))||(eG.keyCode===37&&df(\"left\"))||(eG.keyCode===38&&df(\"up\")&&bV(\":focus\").attr(\"data-gallery-role\"))){cg.longPress.progress();eE=\"<\"}else{if((eG.keyCode===32&&df(\"space\"))||(eG.keyCode===39&&df(\"right\"))||(eG.keyCode===40&&df(\"down\")&&bV(\":focus\").attr(\"data-gallery-role\"))){cg.longPress.progress();eE=\">\"}else{if(eG.keyCode===36&&df(\"home\")){cg.longPress.progress();eE=\"<<\"}else{if(eG.keyCode===35&&df(\"end\")){cg.longPress.progress();eE=\">>\"}}}}}}}(eF||eE)&&O(eG);ez={index:eE,slow:eG.altKey,user:true};eE&&(cg.longPress.inProgress?cg.showWhileLongPress(ez):cg.show(ez))});if(eB){bw.on(eA,function(eE){if(cg.longPress.inProgress){cg.showEndLongPress({user:true})}cg.longPress.reset()})}if(!cg.index){bw.off(eC).on(eC,\"textarea, input, select\",function(eE){!I.hasClass(bH)&&eE.stopPropagation()})}bf.on(ey,cg.resize)}else{bw.off(ex);bf.off(ey)}}function dd(ex){if(ex===dd.f){return}if(ex){d6.addClass(ag+\" \"+cQ).before(c9).before(de);C(cg)}else{c9.detach();de.detach();d6.html(cR.urtext).removeClass(cQ);av(cg)}ek(ex);dd.f=ex}function dn(){dP=cg.data=dP||bG(c3.data)||bI(d6);c1=cg.size=dP.length;eq.ok&&c3.shuffle&&aC(dP);ep();eo=cn(eo);c1&&dd(true)}function em(){var ex=c1<2||dg;d5.noMove=ex||cv;d5.noSwipe=ex||!c3.swipe;!cu&&cl.toggleClass(aB,!c3.click&&!d5.noMove&&!d5.noSwipe);aZ&&dk.toggleClass(U,!d5.noSwipe)}function dq(ex){if(ex===true){ex=\"\"}c3.autoplay=Math.max(+ex||bQ,ds*1.5)}function db(ex){if(ex.navarrows&&ex.nav===\"thumbs\"){eg.show();dX.show()}else{eg.hide();dX.hide()}}function ck(ex,ey){return Math.floor(dk.width()/(ey.thumbwidth+ey.thumbmargin))}function dQ(){if(!c3.nav||c3.nav===\"dots\"){c3.navdir=\"horizontal\"}cg.options=c3=bA(c3);b4=ck(dk,c3);cv=(c3.transition===\"crossfade\"||c3.transition===\"dissolve\");dj=c3.loop&&(c1>2||(cv&&(!cu||cu!==\"slide\")));ds=+c3.transitionduration||ba;dH=c3.direction===\"rtl\";dE=bV.extend({},c3.keyboard&&p,c3.keyboard);db(c3);var ey={add:[],remove:[]};function ex(ez,eA){ey[ez?\"add\":\"remove\"].push(eA)}if(c1>1){cq=c3.nav;d8=c3.navposition===\"top\";ey.remove.push(a9);cU.toggle(c3.arrows)}else{cq=false;cU.hide()}dh();cJ();ev();if(c3.autoplay){dq(c3.autoplay)}ch=m(c3.thumbwidth)||L;ej=m(c3.thumbheight)||L;cG.ok=ef.ok=c3.trackpad&&!bh;em();dL(c3,[en]);c0=cq===\"thumbs\";if(dU.filter(\":hidden\")&&!!cq){dU.show()}if(c0){dl(c1,\"navThumb\");dA=cW;dr=bl;an(de,bV.Fotorama.jst.style({w:ch,h:ej,b:c3.thumbborderwidth,m:c3.thumbmargin,s:cC,q:!aN}));dO.addClass(ai).removeClass(bW)}else{if(cq===\"dots\"){dl(c1,\"navDot\");dA=cB;dr=b7;dO.addClass(bW).removeClass(ai)}else{dU.hide();cq=false;dO.removeClass(ai+\" \"+bW)}}if(cq){if(d8){dU.insertBefore(cf)}else{dU.insertAfter(cf)}cz.nav=false;cz(dA,cF,\"nav\")}c4=c3.allowfullscreen;if(c4){dM.prependTo(cf);d2=s&&c4===\"native\";aE(dM,\"touchend\")}else{dM.detach();d2=false}ex(cv,ar);ex(!cv,aw);ex(!c3.captions,bN);ex(dH,a0);ex(c3.arrows,f);ec=c3.shadows&&!bh;ex(!ec,aM);dk.addClass(ey.add.join(\" \")).removeClass(ey.remove.join(\" \"));d0=bV.extend({},c3);i()}function cZ(ex){return ex<0?(c1+(ex%c1))%c1:ex>=c1?ex%c1:ex}function cn(ex){return bb(ex,0,c1-1)}function du(ex){return dj?cZ(ex):cn(ex)}function dB(ex){return ex>0||dj?ex-1:false}function ci(ex){return ex<c1-1||dj?ex+1:false}function d9(){d5.min=dj?-Infinity:-a8(c1-1,en.w,c3.margin,c2);d5.max=dj?Infinity:-a8(0,en.w,c3.margin,c2);d5.snap=en.w+c3.margin}function c5(){var ex=(c3.navdir===\"vertical\");var ez=ex?cF.height():cF.width();var ey=ex?en.h:en.nw;dy.min=Math.min(0,ey-ez);dy.max=0;dy.direction=c3.navdir;
2cF.toggleClass(aB,!(dy.noMove=dy.min===dy.max))}function dm(ey,eA,ez){if(typeof ey===\"number\"){ey=new Array(ey);var ex=true}return bV.each(ey,function(eD,eB){if(ex){eB=eD}if(typeof eB===\"number\"){var eF=dP[cZ(eB)];if(eF){var eC=\"$\"+eA+\"Frame\",eE=eF[eC];ez.call(this,eD,eB,eF,eE,eC,eE&&eE.data())}}})}function cc(eA,ex,ez,ey){if(!dG||(dG===\"*\"&&ey===dx)){eA=t(c3.width)||t(eA)||bk;ex=t(c3.height)||t(ex)||bE;cg.resize({width:eA,ratio:c3.ratio||ez||eA/ex},0,ey!==dx&&\"*\")}}function cx(ex,ey,eA,ez){dm(ex,ey,function(eM,eE,eD,eC,eR,eB){if(!eC){return}var eN=cg.fullScreen&&!eB.$full&&ey===\"stage\";if(eB.$img&&!ez&&!eN){return}var eS=new Image(),eG=bV(eS),eO=eG.data();eB[eN?\"$full\":\"$img\"]=eG;var eJ=ey===\"stage\"?(eN?\"full\":\"img\"):\"thumb\",eF=eD[eJ],eP=eN?eD.img:eD[ey===\"stage\"?\"thumb\":\"img\"];if(ey===\"navThumb\"){eC=eB.$wrap}function eH(eT){var eU=cZ(eE);dc(eT,{index:eU,src:eF,frame:dP[eU]})}function eK(){eG.remove();bV.Fotorama.cache[eF]=\"error\";if((!eD.html||ey!==\"stage\")&&eP&&eP!==eF){eD[eJ]=eF=eP;eB.$full=null;cx([eE],ey,eA,true)}else{if(eF&&!eD.html&&!eN){eC.trigger(\"f:error\").removeClass(bM).addClass(bP);eH(\"error\")}else{if(ey===\"stage\"){eC.trigger(\"f:load\").removeClass(bM+\" \"+bP).addClass(c);eH(\"load\");cc()}}eB.state=\"error\";if(c1>1&&dP[eE]===eD&&!eD.html&&!eD.deleted&&!eD.video&&!eN){eD.deleted=true;cg.splice(eE,1)}}}function eL(){bV.Fotorama.measures[eF]=eO.measures=bV.Fotorama.measures[eF]||{width:eS.width,height:eS.height,ratio:eS.width/eS.height};cc(eO.measures.width,eO.measures.height,eO.measures.ratio,eE);eG.off(\"load error\").addClass(\"\"+(eN?Y:J)).attr(\"aria-hidden\",\"false\").prependTo(eC);if(eC.hasClass(x)&&!eC.hasClass(af)){eC.attr(\"href\",eG.attr(\"src\"))}V(eG,(bV.isFunction(eA)?eA():eA)||en);bV.Fotorama.cache[eF]=eB.state=\"loaded\";setTimeout(function(){eC.trigger(\"f:load\").removeClass(bM+\" \"+bP).addClass(c+\" \"+(eN?b3:bg));if(ey===\"stage\"){eH(\"load\")}else{if(eD.thumbratio===bF||!eD.thumbratio&&c3.thumbratio===bF){eD.thumbratio=eO.measures.ratio;dV()}}},0)}if(!eF){eK();return}function eI(){var eT=10;bX(function(){return !c6||!eT--&&!bh},function(){eL()})}if(!bV.Fotorama.cache[eF]){bV.Fotorama.cache[eF]=\"*\";eG.on(\"load\",eI).on(\"error\",eK)}else{(function eQ(){if(bV.Fotorama.cache[eF]===\"error\"){eK()}else{if(bV.Fotorama.cache[eF]===\"loaded\"){setTimeout(eI,0)}else{setTimeout(eQ,100)}}})()}eB.state=\"\";eS.src=eF;if(eB.data.caption){eS.alt=eB.data.caption||\"\"}if(eB.data.full){bV(eS).data(\"original\",eB.data.full)}if(aS.isExpectedCaption(eD,c3.showcaption)){bV(eS).attr(\"aria-labelledby\",eD.labelledby)}})}function cy(){var ex=dF[bu];if(ex&&!ex.data().state){eb.addClass(Z);ex.on(\"f:load f:error\",function(){ex.off(\"f:load f:error\");eb.removeClass(Z)})}}function cL(ex){a(ex,dJ);bL(ex,function(){setTimeout(function(){bU(dO)},0);dT({time:ds,guessIndex:bV(this).data().eq,minMax:dy})})}function dl(ex,ey){dm(ex,ey,function(eB,ez,eG,eD,eA,eC){if(eD){return}eD=eG[eA]=dk[eA].clone();eC=eD.data();eC.data=eG;var eF=eD[0],eE=\"labelledby\"+bV.now();if(ey===\"stage\"){if(eG.html){bV('<div class=\"'+bd+'\"></div>').append(eG._html?bV(eG.html).removeAttr(\"id\").html(eG._html):eG.html).appendTo(eD)}if(eG.id){eE=eG.id||eE}eG.labelledby=eE;if(aS.isExpectedCaption(eG,c3.showcaption)){bV(bV.Fotorama.jst.frameCaption({caption:eG.caption,labelledby:eE})).appendTo(eD)}eG.video&&eD.addClass(l).append(cH.clone());bL(eF,function(){setTimeout(function(){bU(cf)},0);cm({index:eC.eq,user:true})});c8=c8.add(eD)}else{if(ey===\"navDot\"){cL(eF);cB=cB.add(eD)}else{if(ey===\"navThumb\"){cL(eF);eC.$wrap=eD.children(\":first\");cW=cW.add(eD);if(eG.video){eC.$wrap.append(cH.clone())}}}}})}function cM(ey,ex){return ey&&ey.length&&V(ey,ex)}function di(ex){dm(ex,\"stage\",function(eB,ez,eE,eD,eA,eC){if(!eD){return}var ey=cZ(ez);eC.eq=ey;er[bu][ey]=eD.css(bV.extend({left:cv?0:a8(ez,en.w,c3.margin,c2)},cv&&b6(0)));if(be(eD[0])){eD.appendTo(cl);cO(eE.$video)}cM(eC.$img,en);cM(eC.$full,en);if(eD.hasClass(x)&&!(eD.attr(\"aria-hidden\")===\"false\"&&eD.hasClass(a4))){eD.attr(\"aria-hidden\",\"true\")}})}function dp(eB,ex){var ey,ez,eA;if(cq!==\"thumbs\"||isNaN(eB)){return}ey=-eB;ez=-eB+en.nw;if(c3.navdir===\"vertical\"){eB=eB-c3.thumbheight;ez=-eB+en.h}cW.each(function(){var eH=bV(this),eD=eH.data(),eC=eD.eq,eG=function(){return{h:ej,w:eD.w}},eF=eG(),eE=c3.navdir===\"vertical\"?eD.t>ez:eD.l>ez;eF.w=eD.w;if(eD.l+eD.w<ey||eE||cM(eD.$img,eF)){return}ex&&cx([eC],\"navThumb\",eG)})}function cz(ex,eC,ey){if(!cz[ey]){var eB=ey===\"nav\"&&c0,eA=0,ez=0;eC.append(ex.filter(function(){var eH,eG=bV(this),eE=eG.data();for(var eF=0,eD=dP.length;eF<eD;eF++){if(eE.data===dP[eF]){eH=true;eE.eq=eF;break}}return eH||eG.remove()&&false}).sort(function(eE,eD){return bV(eE).data().eq-bV(eD).data().eq}).each(function(){var eE=bV(this),eD=eE.data();aS.setThumbAttr(eE,eD.data.caption,\"aria-label\")}).each(function(){if(!eB){return}var eF=bV(this),eE=eF.data(),eG=Math.round(ej*eE.data.thumbratio)||ch,eD=Math.round(ch/eE.data.thumbratio)||ej;eE.t=ez;eE.h=eD;eE.l=eA;eE.w=eG;
2eF.css({width:eG});ez+=eD+c3.thumbmargin;eA+=eG+c3.thumbmargin}));cz[ey]=true}}function eh(ex){return ex-d3>en.w/3}function cE(ex){return !dj&&(!(eo+ex)||!(eo-c1+ex))&&!dg}function dh(){var ey=cE(0),ex=cE(1);dW.toggleClass(F,ey).attr(ad(ey,false));da.toggleClass(F,ex).attr(ad(ex,false))}function ev(){var ex=false,ey=false;if(c3.navtype===\"thumbs\"&&!c3.loop){(eo==0)?ex=true:ex=false;(eo==c3.data.length-1)?ey=true:ey=false}if(c3.navtype===\"slides\"){var ez=aa(cF,c3.navdir);ez>=dy.max?ex=true:ex=false;ez<=dy.min?ey=true:ey=false}eg.toggleClass(F,ex).attr(ad(ex,true));dX.toggleClass(F,ey).attr(ad(ey,true))}function cJ(){if(cG.ok){cG.prevent={\"<\":cE(0),\">\":cE(1)}}}function dI(eD){var eA=eD.data(),eC,eB,ez,ex;if(c0){eC=eA.l;eB=eA.t;ez=eA.w;ex=eA.h}else{eC=eD.position().left;ez=eD.width()}var ey={c:eC+ez/2,min:-eC+c3.thumbmargin*10,max:-eC+en.w-ez-c3.thumbmargin*10};var eE={c:eB+ex/2,min:-eB+c3.thumbmargin*10,max:-eB+en.h-ex-c3.thumbmargin*10};return c3.navdir===\"vertical\"?eE:ey}function d7(ey){var ex=dF[dr].data();A(c7,{time:ey*1.2,pos:(c3.navdir===\"vertical\"?ex.t:ex.l),width:ex.w,height:ex.h,direction:c3.navdir})}function dT(eH){var eB=dP[eH.guessIndex][dr],ez=c3.navtype;var eD,ex,eA,eG,eC,ey,eE,eF;if(eB){if(ez===\"thumbs\"){eD=dy.min!==dy.max;eA=eH.minMax||eD&&dI(dF[dr]);eG=eD&&(eH.keep&&dT.t?dT.l:bb((eH.coo||en.nw/2)-dI(eB).c,eA.min,eA.max));eC=eD&&(eH.keep&&dT.l?dT.l:bb((eH.coo||en.nw/2)-dI(eB).c,eA.min,eA.max));ey=(c3.navdir===\"vertical\"?eG:eC);eE=eD&&bb(ey,dy.min,dy.max)||0;ex=eH.time*1.1;A(cF,{time:ex,pos:eE,direction:c3.navdir,onEnd:function(){dp(eE,true);ev()}});co(dO,bp(eE,dy.min,dy.max,c3.navdir));dT.l=ey}else{eF=aa(cF,c3.navdir);ex=eH.time*1.11;eE=aD(c3,dy,eH.guessIndex,eF,eB,dU,c3.navdir);A(cF,{time:ex,pos:eE,direction:c3.navdir,onEnd:function(){dp(eE,true);ev()}});co(dO,bp(eE,dy.min,dy.max,c3.navdir))}}}function cS(){dN(dr);cd[dr].push(dF[dr].addClass(a4).attr(\"data-active\",true))}function dN(ey){var ex=cd[ey];while(ex.length){ex.shift().removeClass(a4).attr(\"data-active\",false)}}function ce(ey){var ex=er[ey];bV.each(ea,function(eA,ez){delete ex[cZ(ez)]});bV.each(ex,function(ez,eA){delete ex[ez];eA.detach()})}function dC(ey){c2=ed=eo;var ex=dF[bu];if(ex){dN(bu);cd[bu].push(ex.addClass(a4).attr(\"data-active\",true));if(ex.hasClass(x)){ex.attr(\"aria-hidden\",\"false\")}ey||cg.showStage.onEnd(true);a1(cl,0,true);ce(bu);di(ea);d9();c5();a(cl[0],function(){if(!d6.hasClass(M)){cg.requestFullScreen();dM.focus()}})}}function dL(ey,ex){if(!ey){return}bV.each(ex,function(ez,eA){if(!eA){return}bV.extend(eA,{width:ey.width||eA.width,height:ey.height,minwidth:ey.minwidth,maxwidth:ey.maxwidth,minheight:ey.minheight,maxheight:ey.maxheight,ratio:bm(ey.ratio)})})}function dc(ey,ex){d6.trigger(ag+\":\"+ey,[cg,ex])}function dR(){clearTimeout(cr.t);c6=1;if(c3.stopautoplayontouch){cg.stopAutoplay()}else{cj=true}}function cr(){if(!c6){return}if(!c3.stopautoplayontouch){cw();es()}cr.t=setTimeout(function(){c6=0},ba+b8)}function cw(){cj=!!(dg||el)}function es(){clearTimeout(es.t);bX.stop(es.w);if(!c3.autoplay||cj){if(cg.autoplay){cg.autoplay=false;dc(\"stopautoplay\")}return}if(!cg.autoplay){cg.autoplay=true;dc(\"startautoplay\")}var ey=eo;var ex=dF[bu].data();es.w=bX(function(){return ex.state||ey!==eo},function(){es.t=setTimeout(function(){if(cj||ey!==eo){return}var ez=cK,eA=dP[ez][bu].data();es.w=bX(function(){return eA.state||ez!==cK},function(){if(cj||ez!==cK){return}cg.show(dj?ay(!dH):cK)})},c3.autoplay)})}cg.startAutoplay=function(ex){if(cg.autoplay){return this}cj=el=false;dq(ex||c3.autoplay);es();return this};cg.stopAutoplay=function(){if(cg.autoplay){cj=el=true;es()}return this};cg.showSlide=function(ez){var eA=aa(cF,c3.navdir),eC,eB=500*1.1,ey=c3.navdir===\"horizontal\"?c3.thumbwidth:c3.thumbheight,ex=function(){ev()};if(ez===\"next\"){eC=eA-(ey+c3.margin)*b4}if(ez===\"prev\"){eC=eA+(ey+c3.margin)*b4}eC=a5(eC,dy);dp(eC,true);A(cF,{time:eB,pos:eC,direction:c3.navdir,onEnd:ex})};cg.showWhileLongPress=function(eA){if(cg.longPress.singlePressInProgress){return}var ez=dK(eA);ew(ez);var eB=cA(eA)/50;var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showNav(ex,eA,eB);return this};cg.showEndLongPress=function(eA){if(cg.longPress.singlePressInProgress){return}var ez=dK(eA);ew(ez);var eB=cA(eA)/50;var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showStage(ex,eA,eB);ee=typeof dw!==\"undefined\"&&dw!==eo;dw=eo;return this};function dK(ey){var ex;if(typeof ey!==\"object\"){ex=ey;ey={}}else{ex=ey.index}ex=ex===\">\"?ed+1:ex===\"<\"?ed-1:ex===\"<<\"?0:ex===\">>\"?c1-1:ex;ex=isNaN(ex)?aP:ex;ex=typeof ex===\"undefined\"?eo||0:ex;return ex}function ew(ex){cg.activeIndex=eo=du(ex);d4=dB(eo);cN=ci(eo);cK=cZ(eo+(dH?-1:1));ea=[eo,d4,cN];ed=dj?ex:eo}function cA(ey){var ex=Math.abs(dw-ed),ez=bj(ey.time,function(){return Math.min(ds*(1+(ex-1)/12),ds*2)});if(ey.slow){ez*=10}return ez}cg.showStage=function(ey,eA,eD){cO(dg,dF.i!==dP[cZ(c2)].i);dl(ea,\"stage\");di(bh?[ed]:[ed,dB(ed),ci(ed)]);cD(\"go\",true);ey||dc(\"show\",{user:eA.user,time:eD});cj=true;var eC=eA.overPos;var ez=cg.showStage.onEnd=function(eE){if(ez.ok){return}ez.ok=true;eE||dC(true);if(!ey){dc(\"showend\",{user:eA.user})}if(!eE&&cu&&cu!==c3.transition){cg.setOptions({transition:cu});cu=false;return}cy();cx(ea,\"stage\");cD(\"go\",false);cJ();ei();cw();es();if(cg.fullScreen){dF[bu].find(\".\"+Y).attr(\"aria-hidden\",false);dF[bu].find(\".\"+J).attr(\"aria-hidden\",true)}else{dF[bu].find(\".\"+Y).attr(\"aria-hidden\",true);dF[bu].find(\".\"+J).attr(\"aria-hidden\",false)}};if(!cv){A(cl,{pos:-a8(ed,en.w,c3.margin,c2),overPos:eC,time:eD,onEnd:ez})}else{var ex=dF[bu],eB=dP[dw]&&eo!==dw?dP[dw][bu]:null;aq(ex,eB,c8,{time:eD,method:c3.transition,onEnd:ez},cI)}dh()};cg.showNav=function(ey,ez,eA){ev();if(cq){cS();var ex=cn(eo+bb(ed-dw,-1,1));dT({time:eA,coo:ex!==eo&&ez.coo,guessIndex:typeof ez.coo!==\"undefined\"?ex:eo,keep:ey});if(c0){d7(eA)}}};cg.show=function(eA){cg.longPress.singlePressInProgress=true;var ez=dK(eA);ew(ez);var eB=cA(eA);var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showStage(ex,eA,eB);cg.showNav(ex,eA,eB);ee=typeof dw!==\"undefined\"&&dw!==eo;dw=eo;cg.longPress.singlePressInProgress=false;return this};cg.requestFullScreen=function(){if(c4&&!cg.fullScreen){var ex=bV((cg.activeFrame||{}).$stageFrame||{}).hasClass(\"fotorama-video-container\");if(ex){return}cs=bf.scrollTop();cT=bf.scrollLeft();bU(bf);cD(\"x\",true);dZ=bV.extend({},en);d6.addClass(M).appendTo(I.addClass(bH));R.addClass(bH);cO(dg,true,true);cg.fullScreen=true;if(d2){bB.request(eu)}cg.resize();cx(ea,\"stage\");cy();dc(\"fullscreenenter\");if(!(\"ontouchstart\" in bo)){dM.focus()}}return this};function cP(){if(cg.fullScreen){cg.fullScreen=false;if(s){bB.cancel(eu)}I.removeClass(bH);R.removeClass(bH);d6.removeClass(M).insertAfter(c9);en=bV.extend({},dZ);cO(dg,true,true);cD(\"x\",false);cg.resize();cx(ea,\"stage\");bU(bf,cT,cs);dc(\"fullscreenexit\")}}cg.cancelFullScreen=function(){if(d2&&bB.is()){bB.cancel(k)}else{cP()}return this};cg.toggleFullScreen=function(){return cg[(cg.fullScreen?\"cancel\":\"request\")+\"FullScreen\"]()};cg.resize=function(ez){if(!dP){return this}var eC=arguments[1]||0,ey=arguments[2];b4=ck(dk,c3);dL(!cg.fullScreen?bA(ez):{width:bV(bo).width(),maxwidth:null,minwidth:null,height:bV(bo).height(),maxheight:null,minheight:null},[en,ey||cg.fullScreen||c3]);var eB=en.width,ex=en.height,eA=en.ratio,eD=bf.height()-(cq?dO.height():0);if(t(eB)){dk.css({width:\"\"});dk.css({height:\"\"});cf.css({width:\"\"});cf.css({height:\"\"});cl.css({width:\"\"});cl.css({height:\"\"});dO.css({width:\"\"});dO.css({height:\"\"});
2dk.css({minWidth:en.minwidth||0,maxWidth:en.maxwidth||bK});if(cq===\"dots\"){dU.hide()}eB=en.W=en.w=dk.width();en.nw=cq&&d(c3.navwidth,eB)||eB;cl.css({width:en.w,marginLeft:(en.W-en.w)/2});ex=d(ex,eD);ex=ex||(eA&&eB/eA);if(ex){eB=Math.round(eB);ex=en.h=Math.round(bb(ex,d(en.minheight,eD),d(en.maxheight,eD)));cf.css({width:eB,height:ex});if(c3.navdir===\"vertical\"&&!cg.fullscreen){dO.width(c3.thumbwidth+c3.thumbmargin*2)}if(c3.navdir===\"horizontal\"&&!cg.fullscreen){dO.height(c3.thumbheight+c3.thumbmargin*2)}if(cq===\"dots\"){dO.width(eB).height(\"auto\");dU.show()}if(c3.navdir===\"vertical\"&&cg.fullScreen){cf.css(\"height\",bf.height())}if(c3.navdir===\"horizontal\"&&cg.fullScreen){cf.css(\"height\",bf.height()-dO.height())}if(cq){switch(c3.navdir){case\"vertical\":dU.removeClass(bZ);dU.removeClass(ax);dU.addClass(b);dO.stop().animate({height:en.h,width:c3.thumbwidth},eC);break;case\"list\":dU.removeClass(b);dU.removeClass(bZ);dU.addClass(ax);break;default:dU.removeClass(b);dU.removeClass(ax);dU.addClass(bZ);dO.stop().animate({width:en.nw},eC);break}dC();dT({guessIndex:eo,time:eC,keep:true});if(c0&&cz.nav){d7(eC)}}dG=ey||true;eq.ok=true;eq()}}d3=cf.offset().left;i();return this};cg.setOptions=function(ex){bV.extend(c3,ex);dV();return this};cg.shuffle=function(){dP&&aC(dP)&&dV();return this};function co(ex,ey){if(ec){ex.removeClass(S+\" \"+aL);ex.removeClass(a2+\" \"+aR);ey&&!dg&&ex.addClass(ey.replace(/^|\\s/g,\" \"+bz+\"--\"))}}cg.longPress={threshold:1,count:0,thumbSlideTime:20,progress:function(){if(!this.inProgress){this.count++;this.inProgress=this.count>this.threshold}},end:function(){if(this.inProgress){this.isEnded=true}},reset:function(){this.count=0;this.inProgress=false;this.isEnded=false}};cg.destroy=function(){cg.cancelFullScreen();cg.stopAutoplay();dP=cg.data=null;dd();ea=[];ce(bu);dV.ok=false;return this};cg.playVideo=function(){var ez=dF,ex=ez.video,ey=eo;if(typeof ex===\"object\"&&ez.videoReady){d2&&cg.fullScreen&&cg.cancelFullScreen();bX(function(){return !bB.is()||ey!==eo},function(){if(ey===eo){ez.$video=ez.$video||bV(ab(bJ)).append(q(ex));ez.$video.appendTo(ez[bu]);dk.addClass(bt);dg=ez.$video;em();cU.blur();dM.blur();dc(\"loadvideo\")}})}return this};cg.stopVideo=function(){cO(dg,true,true);return this};cg.spliceByIndex=function(ex,ey){ey.i=ex+1;ey.img&&bV.ajax({url:ey.img,type:\"HEAD\",success:function(){dP.splice(ex,1,ey);dV()}})};function cO(ex,ez,ey){if(ez){dk.removeClass(bt);dg=false;em()}if(ex&&ex!==dg){ex.remove();dc(\"unloadvideo\")}if(ey){cw();es()}}function cp(ex){dk.toggleClass(P,ex)}function ei(ez){if(d5.flow){return}var ex=ez?ez.pageX:ei.x,ey=ex&&!cE(eh(ex))&&c3.click;if(ei.p!==ey&&cf.toggleClass(bC,ey)){ei.p=ey;ei.x=ex}}cf.on(\"mousemove\",ei);function cm(ex){clearTimeout(cm.t);if(c3.clicktransition&&c3.clicktransition!==c3.transition){setTimeout(function(){var ey=c3.transition;cg.setOptions({transition:c3.clicktransition});cu=ey;cm.t=setTimeout(function(){cg.show(ex)},10)},0)}else{cg.show(ex)}}function ct(eA,ey){var ez=eA.target,ex=bV(ez);if(ex.hasClass(T)){cg.playVideo()}else{if(ez===dD){cg.toggleFullScreen()}else{if(dg){ez===d1&&cO(dg,true,true)}else{if(!d6.hasClass(M)){cg.requestFullScreen()}}}}O(eA,true)}function cD(ex,ey){d5[ex]=dy[ex]=ey}d5=ao(cl,{onStart:dR,onMove:function(ey,ex){co(cf,ex.edge)},onTouchEnd:cr,onEnd:function(ex){var ez;co(cf);ez=(aZ&&!dz||ex.touch)&&c3.arrows;if((ex.moved||(ez&&ex.pos!==ex.newPos&&!ex.control))&&ex.$target[0]!==dM[0]){var ey=by(ex.newPos,en.w,c3.margin,c2);cg.show({index:ey,time:cv?ds:ex.time,overPos:ex.overPos,user:true})}else{if(!ex.aborted&&!ex.control){ct(ex.startEvent,ez)}}},timeLow:1,timeHigh:1,friction:2,select:\".\"+a9+\", .\"+a9+\" *\",$wrap:cf,direction:\"horizontal\"});dy=ao(cF,{onStart:dR,onMove:function(ey,ex){co(dO,ex.edge)},onTouchEnd:cr,onEnd:function(ex){function ey(){dT.l=ex.newPos;cw();es();dp(ex.newPos,true);ev()}if(!ex.moved){var ez=ex.$target.closest(\".\"+aG,cF)[0];ez&&dJ.call(ez,ex.startEvent)}else{if(ex.pos!==ex.newPos){cj=true;A(cF,{time:ex.time,pos:ex.newPos,overPos:ex.overPos,direction:c3.navdir,onEnd:ey});dp(ex.newPos);ec&&co(dO,bp(ex.newPos,dy.min,dy.max,ex.dir))}else{ey()}}},timeLow:0.5,timeHigh:2,friction:5,$wrap:dO,direction:c3.navdir});cG=o(cf,{shift:true,onEnd:function(ey,ex){dR();cr();cg.show({index:ex,slow:ey.altKey})}});ef=o(dO,{onEnd:function(ez,ey){dR();cr();var ex=a1(cF)+ey*0.25;cF.css(b2(bb(ex,dy.min,dy.max),c3.navdir));ec&&co(dO,bp(ex,dy.min,dy.max,c3.navdir));ef.prevent={\"<\":ex>=dy.max,\">\":ex<=dy.min};clearTimeout(ef.t);ef.t=setTimeout(function(){dT.l=ex;dp(ex,true)},b8);dp(ex)}});dk.hover(function(){setTimeout(function(){if(c6){return}cp(!(dz=true))},0)},function(){if(!dz){return}cp(!(dz=false))});function dJ(ey){var ex=bV(this).data().eq;if(c3.navtype===\"thumbs\"){cm({index:ex,slow:ey.altKey,user:true,coo:ey._x-dO.offset().left})}else{cm({index:ex,slow:ey.altKey,user:true})}}function et(ex){cm({index:cU.index(this)?\">\":\"<\",slow:ex.altKey,user:true})}z(cU,function(ex){O(ex);et.call(this,ex)},{onStart:function(){dR();d5.control=true},onTouchEnd:cr});z(eg,function(ex){O(ex);if(c3.navtype===\"thumbs\"){cg.show(\"<\")}else{cg.showSlide(\"prev\")}});z(dX,function(ex){O(ex);if(c3.navtype===\"thumbs\"){cg.show(\">\")}else{cg.showSlide(\"next\")}});function dv(ex){bL(ex,function(){setTimeout(function(){bU(cf)},0);cp(false)})}cU.each(function(){a(this,function(ex){et.call(this,ex)});dv(this)});a(dD,function(){if(d6.hasClass(M)){cg.cancelFullScreen();
2cl.focus()}else{cg.requestFullScreen();dM.focus()}});dv(dD);function dV(){dn();dQ();if(!dV.i){dV.i=true;var ex=c3.startindex;eo=c2=ed=dw=dx=du(ex)||0}if(c1){if(cV()){return}if(dg){cO(dg,true)}ea=[];ce(bu);dV.ok=true;cg.show({index:eo,time:0});cg.resize()}else{cg.destroy()}}function cV(){if(!cV.f===dH){cV.f=dH;eo=c1-1-eo;cg.reverse();return true}}bV.each(\"load push pop shift unshift reverse sort splice\".split(\" \"),function(ex,ey){cg[ey]=function(){dP=dP||[];if(ey!==\"load\"){Array.prototype[ey].apply(dP,arguments)}else{if(arguments[0]&&typeof arguments[0]===\"object\"&&arguments[0].length){dP=bG(arguments[0])}}dV();return cg}});function eq(){if(eq.ok){eq.ok=false;dc(\"ready\")}}dV()};bV.fn.fotorama=function(i){return this.each(function(){var ce=this,cd=bV(this),cc=cd.data(),cf=cc.fotorama;if(!cf){bX(function(){return !W(ce)},function(){cc.urtext=cd.html();new bV.Fotorama(cd,bV.extend({},Q,bo.fotoramaDefaults,i,cc))})}else{cf.setOptions(i,true)}})};bV.Fotorama.instances=[];function b1(){bV.each(bV.Fotorama.instances,function(cc,i){i.index=cc})}function C(i){bV.Fotorama.instances.push(i);b1()}function av(i){bV.Fotorama.instances.splice(i.index,1);b1()}bV.Fotorama.cache={};bV.Fotorama.measures={};bV=bV||{};bV.Fotorama=bV.Fotorama||{};bV.Fotorama.jst=bV.Fotorama.jst||{};bV.Fotorama.jst.dots=function(cc){var i,ce=\"\",cd=bx.escape;ce+='<div class=\"fotorama__nav__frame fotorama__nav__frame--dot\" tabindex=\"0\" role=\"button\" data-gallery-role=\"nav-frame\" data-nav-type=\"thumb\" aria-label>\\r\\n    <div class=\"fotorama__dot\"></div>\\r\\n</div>';return ce};bV.Fotorama.jst.frameCaption=function(cc){var i,ce=\"\",cd=bx.escape;ce+='<div class=\"fotorama__caption\" aria-hidden=\"true\">\\r\\n    <div class=\"fotorama__caption__wrap\" id=\"'+((i=(cc.labelledby))==null?\"\":i)+'\">'+((i=(cc.caption))==null?\"\":i)+\"</div>\\r\\n</div>\\r\\n\";return ce};bV.Fotorama.jst.style=function(cc){var i,ce=\"\",cd=bx.escape;ce+=\".fotorama\"+((i=(cc.s))==null?\"\":i)+\" .fotorama__nav--thumbs .fotorama__nav__frame{\\r\\npadding:\"+((i=(cc.m))==null?\"\":i)+\"px;\\r\\nheight:\"+((i=(cc.h))==null?\"\":i)+\"px}\\r\\n.fotorama\"+((i=(cc.s))==null?\"\":i)+\" .fotorama__thumb-border{\\r\\nheight:\"+((i=(cc.h))==null?\"\":i)+\"px;\\r\\nborder-width:\"+((i=(cc.b))==null?\"\":i)+\"px;\\r\\nmargin-top:\"+((i=(cc.m))==null?\"\":i)+\"px}\";return ce};bV.Fotorama.jst.thumb=function(cc){var i,ce=\"\",cd=bx.escape;ce+='<div class=\"fotorama__nav__frame fotorama__nav__frame--thumb\" tabindex=\"0\" role=\"button\" data-gallery-role=\"nav-frame\" data-nav-type=\"thumb\" aria-label>\\r\\n    <div class=\"fotorama__thumb\">\\r\\n    </div>\\r\\n</div>';return ce}})(window,document,location,typeof jQuery!==\"undefined\"&&jQuery);","jquery/jquery-migrate.js":"/*!\n * jQuery Migrate - v1.2.1 - 2013-05-08\n * https://github.com/jquery/jquery-migrate\n * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT\n */\n(function( jQuery, window, undefined ) {\n// See http://bugs.jquery.com/ticket/13335\n// \"use strict\";\n\n\nvar warnedAbout = {};\n\n// List of warnings already given; public read only\njQuery.migrateWarnings = [];\n\n// Set to true to prevent console output; migrateWarnings still maintained\n// jQuery.migrateMute = false;\n\n// Show a message on the console so devs know we're active\nif ( !jQuery.migrateMute && window.console && window.console.log ) {\n\twindow.console.log(\"JQMIGRATE: Logging is active\");\n}\n\n// Set to false to disable traces that appear with warnings\nif ( jQuery.migrateTrace === undefined ) {\n\tjQuery.migrateTrace = true;\n}\n\n// Forget any warnings we've already given; public\njQuery.migrateReset = function() {\n\twarnedAbout = {};\n\tjQuery.migrateWarnings.length = 0;\n};\n\nfunction migrateWarn( msg) {\n\tvar console = window.console;\n\tif ( !warnedAbout[ msg ] ) {\n\t\twarnedAbout[ msg ] = true;\n\t\tjQuery.migrateWarnings.push( msg );\n\t\tif ( console && console.warn && !jQuery.migrateMute ) {\n\t\t\tconsole.warn( \"JQMIGRATE: \" + msg );\n\t\t\tif ( jQuery.migrateTrace && console.trace ) {\n\t\t\t\tconsole.trace();\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction migrateWarnProp( obj, prop, value, msg ) {\n\tif ( Object.defineProperty ) {\n\t\t// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
2\n\t\t// allow property to be overwritten in case some other plugin wants it\n\t\ttry {\n\t\t\tObject.defineProperty( obj, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tget: function() {\n\t\t\t\t\tmigrateWarn( msg );\n\t\t\t\t\treturn value;\n\t\t\t\t},\n\t\t\t\tset: function( newValue ) {\n\t\t\t\t\tmigrateWarn( msg );\n\t\t\t\t\tvalue = newValue;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t} catch( err ) {\n\t\t\t// IE8 is a dope about Object.defineProperty, can't warn there\n\t\t}\n\t}\n\n\t// Non-ES5 (or broken) browser; just set the property\n\tjQuery._definePropertyBroken = true;\n\tobj[ prop ] = value;\n}\n\nif ( document.compatMode === \"BackCompat\" ) {\n\t// jQuery has never supported or tested Quirks Mode\n\tmigrateWarn( \"jQuery is not compatible with Quirks Mode\" );\n}\n\n\nvar attrFn = jQuery( \"<input/>\", { size: 1 } ).attr(\"size\") && jQuery.attrFn,\n\toldAttr = jQuery.attr,\n\tvalueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||\n\t\tfunction() { return null; },\n\tvalueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||\n\t\tfunction() { return undefined; },\n\trnoType = /^(?:input|button)$/i,\n\trnoAttrNodeType = /^[238]$/,\n\trboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,\n\truseDefault = /^(?:checked|selected)$/i;\n\n// jQuery.attrFn\nmigrateWarnProp( jQuery, \"attrFn\", attrFn || {}, \"jQuery.attrFn is deprecated\" );\n\njQuery.attr = function( elem, name, value, pass ) {\n\tvar lowerName = name.toLowerCase(),\n\t\tnType = elem && elem.nodeType;\n\n\tif ( pass ) {\n\t\t// Since pass is used internally, we only warn for new jQuery\n\t\t// versions where there isn't a pass arg in the formal params\n\t\tif ( oldAttr.length < 4 ) {\n\t\t\tmigrateWarn(\"jQuery.fn.attr( props, pass ) is deprecated\");\n\t\t}\n\t\tif ( elem && !rnoAttrNodeType.test( nType ) &&\n\t\t\t(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {\n\t\t\treturn jQuery( elem )[ name ]( value );\n\t\t}\n\t}\n\n\t// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking\n\t// for disconnected elements we don't warn on $( \"<button>\", { type: \"button\" } ).\n\tif ( name === \"type\" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {\n\t\tmigrateWarn(\"Can't change the 'type' of an input or button in IE 6/7/8\");\n\t}\n\n\t// Restore boolHook for boolean property/attribute synchronization\n\tif ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {\n\t\tjQuery.attrHooks[ lowerName ] = {\n\t\t\tget: function( elem, name ) {\n\t\t\t\t// Align boolean attributes with corresponding properties\n\t\t\t\t// Fall back to attribute presence where some booleans are not supported\n\t\t\t\tvar attrNode,\n\t\t\t\t\tproperty = jQuery.prop( elem, name );\n\t\t\t\treturn property === true || typeof property !== \"boolean\" &&\n\t\t\t\t\t( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?\n\n\t\t\t\t\tname.toLowerCase() :\n\t\t\t\t\tundefined;\n\t\t\t},\n\t\t\tset: function( elem, value, name ) {\n\t\t\t\tvar propName;\n\t\t\t\tif ( value === false ) {\n\t\t\t\t\t// Remove boolean attributes when set to false\n\t\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\t} else {\n\t\t\t\t\t// value is true since we know at this point it's type boolean and not false\n\t\t\t\t\t// Set boolean attributes to the same name and set the DOM property\n\t\t\t\t\tpropName = jQuery.propFix[ name ] || name;\n\t\t\t\t\tif ( propName in elem ) {\n\t\t\t\t\t\t// Only set the IDL specifically if it already exists on the element\n\t\t\t\t\t\telem[ propName ] = true;\n\t\t\t\t\t}\n\n\t\t\t\t\telem.setAttribute( name, name.toLowerCase() );\n\t\t\t\t}\n\t\t\t\treturn name;\n\t\t\t}\n\t\t};\n\n\t\t// Warn only for attributes that can remain distinct from their properties post-1.9\n\t\tif ( ruseDefault.test( lowerName ) ) {\n\t\t\tmigrateWarn( \"jQuery.fn.attr('\" + lowerName + \"') may use property instead of attribute\" );\n\t\t}\n\t}\n\n\treturn oldAttr.call( jQuery, elem, name, value );\n};
2\n\n// attrHooks: value\njQuery.attrHooks.value = {\n\tget: function( elem, name ) {\n\t\tvar nodeName = ( elem.nodeName || \"\" ).toLowerCase();\n\t\tif ( nodeName === \"button\" ) {\n\t\t\treturn valueAttrGet.apply( this, arguments );\n\t\t}\n\t\tif ( nodeName !== \"input\" && nodeName !== \"option\" ) {\n\t\t\tmigrateWarn(\"jQuery.fn.attr('value') no longer gets properties\");\n\t\t}\n\t\treturn name in elem ?\n\t\t\telem.value :\n\t\t\tnull;\n\t},\n\tset: function( elem, value ) {\n\t\tvar nodeName = ( elem.nodeName || \"\" ).toLowerCase();\n\t\tif ( nodeName === \"button\" ) {\n\t\t\treturn valueAttrSet.apply( this, arguments );\n\t\t}\n\t\tif ( nodeName !== \"input\" && nodeName !== \"option\" ) {\n\t\t\tmigrateWarn(\"jQuery.fn.attr('value', val) no longer sets properties\");\n\t\t}\n\t\t// Does not return so that setAttribute is also used\n\t\telem.value = value;\n\t}\n};\n\n\nvar matched, browser,\n\toldInit = jQuery.fn.init,\n\toldParseJSON = jQuery.parseJSON,\n\t// Note: XSS check is done below after string is trimmed\n\trquickExpr = /^([^<]*)(<[\\w\\W]+>)([^>]*)$/;\n\n// $(html) \"looks like html\" rule change\njQuery.fn.init = function( selector, context, rootjQuery ) {\n\tvar match;\n\n\tif ( selector && typeof selector === \"string\" && !jQuery.isPlainObject( context ) &&\n\t\t\t(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {\n\t\t// This is an HTML string according to the \"old\" rules; is it still?\n\t\tif ( selector.charAt( 0 ) !== \"<\" ) {\n\t\t\tmigrateWarn(\"$(html) HTML strings must start with '<' character\");\n\t\t}\n\t\tif ( match[ 3 ] ) {\n\t\t\tmigrateWarn(\"$(html) HTML text after last tag is ignored\");\n\t\t}\n\t\t// Consistently reject any HTML-like string starting with a hash (#9521)\n\t\t// Note that this may break jQuery 1.6.x code that otherwise would work.\n\t\tif ( match[ 0 ].charAt( 0 ) === \"#\" ) {\n\t\t\tmigrateWarn(\"HTML string cannot start with a '#' character\");\n\t\t\tjQuery.error(\"JQMIGRATE: Invalid selector string (XSS)\");\n\t\t}\n\t\t// Now process using loose rules; let pre-1.8 play too\n\t\tif ( context && context.context ) {\n\t\t\t// jQuery object as context; parseHTML expects a DOM object\n\t\t\tcontext = context.context;\n\t\t}\n\t\tif ( jQuery.parseHTML ) {\n\t\t\treturn oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),\n\t\t\t\t\tcontext, rootjQuery );\n\t\t}\n\t}\n\treturn oldInit.apply( this, arguments );\n};\njQuery.fn.init.prototype = jQuery.fn;\n\n// Let $.parseJSON(falsy_value) return null\njQuery.parseJSON = function( json ) {\n\tif ( !json && json !== null ) {\n\t\tmigrateWarn(\"jQuery.parseJSON requires a valid JSON string\");\n\t\treturn null;\n\t}\n\treturn oldParseJSON.apply( this, arguments );\n};\n\njQuery.uaMatch = function( ua ) {\n\tua = ua.toLowerCase();\n\n\tvar match = /(chrome)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(webkit)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(opera)(?:.*version|)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(msie) ([\\w.]+)/.exec( ua ) ||\n\t\tua.indexOf(\"compatible\") < 0 && /(mozilla)(?:.*? rv:([\\w.]+)|)/.exec( ua ) ||\n\t\t[];\n\n\treturn {\n\t\tbrowser: match[ 1 ] || \"\",\n\t\tversion: match[ 2 ] || \"0\"\n\t};\n};\n\n// Don't clobber any existing jQuery.browser in case it's different\nif ( !jQuery.browser ) {\n\tmatched = jQuery.uaMatch( navigator.userAgent );\n\tbrowser = {};\n\n\tif ( matched.browser ) {\n\t\tbrowser[ matched.browser ] = true;\n\t\tbrowser.version = matched.version;\n\t}\n\n\t// Chrome is Webkit, but Webkit is also Safari.\n\tif ( browser.chrome ) {\n\t\tbrowser.webkit = true;\n\t} else if ( browser.webkit ) {\n\t\tbrowser.safari = true;\n\t}\n\n\tjQuery.browser = browser;\n}\n\n// Warn if the code tries to get jQuery.browser\nmigrateWarnProp( jQuery, \"browser\", jQuery.browser, \"jQuery.browser is deprecated\" );\n\njQuery.sub = function() {\n\tfunction jQuerySub( selector, context ) {\n\t\treturn new jQuerySub.fn.init( selector, context );\n\t}\n\tjQuery.extend( true, jQuerySub, this );\n\tjQuerySub.superclass = this;\n\tjQuerySub.fn = jQuerySub.prototype = this();\n\tjQuerySub.fn.constructor = jQuerySub;\n\tjQuerySub.sub = this.sub;\n\tjQuerySub.fn.init = function init( selector, context ) {\n\t\tif ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {\n\t\t\tcontext = jQuerySub( context );\n\t\t}\n\n\t\treturn jQuery.fn.init.call( this, selector, context, rootjQuerySub );\n\t};\n\tjQuerySub.fn.init.prototype = jQuerySub.fn;\n\tvar rootjQuerySub = jQuerySub(document);\n\tmigrateWarn( \"jQuery.sub() is deprecated\" );\n\treturn jQuerySub;\n};\n\n\n// Ensure that $.ajax gets the new parseJSON defined in core.js\njQuery.ajaxSetup({\n\tconverters: {\n\t\t\"text json\": jQuery.parseJSON\n\t}\n});\n\n\nvar oldFnData = jQuery.fn.data;\n\njQuery.fn.data = function( name ) {\n\tvar ret, evt,\n\t\telem = this[0];\n\n\t// Handles 1.7 which has this behavior and 1.8 which doesn't\n\tif ( elem && name === \"events\" && arguments.length === 1 ) {\n\t\tret = jQuery.data( elem, name );\n\t\tevt = jQuery._data( elem, name );\n\t\tif ( ( ret === undefined || ret === evt ) && evt !== undefined ) {\n\t\t\tmigrateWarn(\"Use of jQuery.fn.data('events') is deprecated\");\n\t\t\treturn evt;\n\t\t}\n\t}\n\treturn oldFnData.apply( this, arguments );\n};
2\n\n\nvar rscriptType = /\\/(java|ecma)script/i,\n\toldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;\n\njQuery.fn.andSelf = function() {\n\tmigrateWarn(\"jQuery.fn.andSelf() replaced by jQuery.fn.addBack()\");\n\treturn oldSelf.apply( this, arguments );\n};\n\n// Since jQuery.clean is used internally on older versions, we only shim if it's missing\nif ( !jQuery.clean ) {\n\tjQuery.clean = function( elems, context, fragment, scripts ) {\n\t\t// Set context per 1.8 logic\n\t\tcontext = context || document;\n\t\tcontext = !context.nodeType && context[0] || context;\n\t\tcontext = context.ownerDocument || context;\n\n\t\tmigrateWarn(\"jQuery.clean() is deprecated\");\n\n\t\tvar i, elem, handleScript, jsTags,\n\t\t\tret = [];\n\n\t\tjQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );\n\n\t\t// Complex logic lifted directly from jQuery 1.8\n\t\tif ( fragment ) {\n\t\t\t// Special handling of each script element\n\t\t\thandleScript = function( elem ) {\n\t\t\t\t// Check if we consider it executable\n\t\t\t\tif ( !elem.type || rscriptType.test( elem.type ) ) {\n\t\t\t\t\t// Detach the script and store it in the scripts array (if provided) or the fragment\n\t\t\t\t\t// Return truthy to indicate that it has been handled\n\t\t\t\t\treturn scripts ?\n\t\t\t\t\t\tscripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :\n\t\t\t\t\t\tfragment.appendChild( elem );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tfor ( i = 0; (elem = ret[i]) != null; i++ ) {\n\t\t\t\t// Check if we're done after handling an executable script\n\t\t\t\tif ( !( jQuery.nodeName( elem, \"script\" ) && handleScript( elem ) ) ) {\n\t\t\t\t\t// Append to fragment and handle embedded scripts\n\t\t\t\t\tfragment.appendChild( elem );\n\t\t\t\t\tif ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\t\t\t// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration\n\t\t\t\t\t\tjsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName(\"script\") ), handleScript );\n\n\t\t\t\t\t\t// Splice the scripts into ret after their former ancestor and advance our index beyond them\n\t\t\t\t\t\tret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );\n\t\t\t\t\t\ti += jsTags.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t};\n}\n\nvar eventAdd = jQuery.event.add,\n\teventRemove = jQuery.event.remove,\n\teventTrigger = jQuery.event.trigger,\n\toldToggle = jQuery.fn.toggle,\n\toldLive = jQuery.fn.live,\n\toldDie = jQuery.fn.die,\n\tajaxEvents = \"ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess\",\n\trajaxEvent = new RegExp( \"\\\\b(?:\" + ajaxEvents + \")\\\\b\" ),\n\trhoverHack = /(?:^|\\s)hover(\\.\\S+|)\\b/,\n\thoverHack = function( events ) {\n\t\tif ( typeof( events ) !== \"string\" || jQuery.event.special.hover ) {\n\t\t\treturn events;\n\t\t}\n\t\tif ( rhoverHack.test( events ) ) {\n\t\t\tmigrateWarn(\"'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'\");\n\t\t}\n\t\treturn events && events.replace( rhoverHack, \"mouseenter$1 mouseleave$1\" );\n\t};\n\n// Event props removed in 1.9, put them back if needed; no practical way to warn them\nif ( jQuery.event.props && jQuery.event.props[ 0 ] !== \"attrChange\" ) {\n\tjQuery.event.props.unshift( \"attrChange\", \"attrName\", \"relatedNode\", \"srcElement\" );\n}\n\n// Undocumented jQuery.event.handle was \"deprecated\" in jQuery 1.7\nif ( jQuery.event.dispatch ) {\n\tmigrateWarnProp( jQuery.event, \"handle\", jQuery.event.dispatch, \"jQuery.event.handle is undocumented and deprecated\" );\n}\n\n// Support for 'hover' pseudo-event and ajax event warnings\njQuery.event.add = function( elem, types, handler, data, selector ){\n\tif ( elem !== document && rajaxEvent.test( types ) ) {\n\t\tmigrateWarn( \"AJAX events should be attached to document: \" + types );\n\t}\n\teventAdd.call( this, elem, hoverHack( types || \"\" ), handler, data, selector );\n};\njQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){\n\teventRemove.call( this, elem, hoverHack( types ) || \"\", handler, selector, mappedTypes );\n};
2\n\njQuery.fn.error = function() {\n\tvar args = Array.prototype.slice.call( arguments, 0);\n\tmigrateWarn(\"jQuery.fn.error() is deprecated\");\n\targs.splice( 0, 0, \"error\" );\n\tif ( arguments.length ) {\n\t\treturn this.bind.apply( this, args );\n\t}\n\t// error event should not bubble to window, although it does pre-1.7\n\tthis.triggerHandler.apply( this, args );\n\treturn this;\n};\n\njQuery.fn.toggle = function( fn, fn2 ) {\n\n\t// Don't mess with animation or css toggles\n\tif ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {\n\t\treturn oldToggle.apply( this, arguments );\n\t}\n\tmigrateWarn(\"jQuery.fn.toggle(handler, handler...) is deprecated\");\n\n\t// Save reference to arguments for access in closure\n\tvar args = arguments,\n\t\tguid = fn.guid || jQuery.guid++,\n\t\ti = 0,\n\t\ttoggler = function( event ) {\n\t\t\t// Figure out which function to execute\n\t\t\tvar lastToggle = ( jQuery._data( this, \"lastToggle\" + fn.guid ) || 0 ) % i;\n\t\t\tjQuery._data( this, \"lastToggle\" + fn.guid, lastToggle + 1 );\n\n\t\t\t// Make sure that clicks stop\n\t\t\tevent.preventDefault();\n\n\t\t\t// and execute the function\n\t\t\treturn args[ lastToggle ].apply( this, arguments ) || false;\n\t\t};\n\n\t// link all the functions, so any of them can unbind this click handler\n\ttoggler.guid = guid;\n\twhile ( i < args.length ) {\n\t\targs[ i++ ].guid = guid;\n\t}\n\n\treturn this.click( toggler );\n};\n\njQuery.fn.live = function( types, data, fn ) {\n\tmigrateWarn(\"jQuery.fn.live() is deprecated\");\n\tif ( oldLive ) {\n\t\treturn oldLive.apply( this, arguments );\n\t}\n\tjQuery( this.context ).on( types, this.selector, data, fn );\n\treturn this;\n};\n\njQuery.fn.die = function( types, fn ) {\n\tmigrateWarn(\"jQuery.fn.die() is deprecated\");\n\tif ( oldDie ) {\n\t\treturn oldDie.apply( this, arguments );\n\t}\n\tjQuery( this.context ).off( types, this.selector || \"**\", fn );\n\treturn this;\n};\n\n// Turn global events into document-triggered events\njQuery.event.trigger = function( event, data, elem, onlyHandlers  ){\n\tif ( !elem && !rajaxEvent.test( event ) ) {\n\t\tmigrateWarn( \"Global events are undocumented and deprecated\" );\n\t}\n\treturn eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );\n};\njQuery.each( ajaxEvents.split(\"|\"),\n\tfunction( _, name ) {\n\t\tjQuery.event.special[ name ] = {\n\t\t\tsetup: function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\t// The document needs no shimming; must be !== for oldIE\n\t\t\t\tif ( elem !== document ) {\n\t\t\t\t\tjQuery.event.add( document, name + \".\" + jQuery.guid, function() {\n\t\t\t\t\t\tjQuery.event.trigger( name, null, elem, true );\n\t\t\t\t\t});\n\t\t\t\t\tjQuery._data( this, name, jQuery.guid++ );\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tif ( this !== document ) {\n\t\t\t\t\tjQuery.event.remove( document, name + \".\" + jQuery._data( this, name ) );\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t}\n);\n\n\n})( jQuery, window );\n","jquery/jquery-ui-timepicker-addon.js":"/*! jQuery Timepicker Addon - v1.4.3 - 2013-11-30\n* http://trentrichardson.com/examples/timepicker\n* Copyright (c) 2013 Trent Richardson; Licensed MIT */\n(function (factory) {\n    if (typeof define === 'function' && define.amd) {\n        define([\n            \"jquery\",\n            \"jquery/ui\"\n        ], factory);\n    } else {\n        factory(jQuery);\n    }\n}(function ($) {\n\n\t/*\n\t* Lets not redefine timepicker, Prevent \"Uncaught RangeError: Maximum call stack size exceeded\"\n\t*/\n\t$.ui.timepicker = $.ui.timepicker || {};\n\tif ($.ui.timepicker.version) {\n\t\treturn;\n\t}\n\n\t/*\n\t* Extend jQueryUI, get it started with our version number\n\t*/\n\t$.extend($.ui, {\n\t\ttimepicker: {\n\t\t\tversion: \"1.4.3\"\n\t\t}\n\t});\n\n\t/* \n\t* Timepicker manager.\n\t* Use the singleton instance of this class, $.timepicker, to interact with the time picker.\n\t* Settings for (groups of) time pickers are maintained in an instance object,\n\t* allowing multiple different settings on the same page.\n\t*/\n\tvar Timepicker = function () {\n\t\tthis.regional = []; // Available regional settings, indexed by language code\n\t\tthis.regional[''] = { // Default regional settings\n\t\t\tcurrentText: 'Now',\n\t\t\tcloseText: 'Done',\n\t\t\tamNames: ['AM', 'A'],\n\t\t\tpmNames: ['PM', 'P'],\n\t\t\ttimeFormat: 'HH:mm',\n\t\t\ttimeSuffix: '',\n\t\t\ttimeOnlyTitle: 'Choose Time',\n\t\t\ttimeText: 'Time',\n\t\t\thourText: 'Hour',\n\t\t\tminuteText: 'Minute',\n\t\t\tsecondText: 'Second',\n\t\t\tmillisecText: 'Millisecond',\n\t\t\tmicrosecText: 'Microsecond',\n\t\t\ttimezoneText: 'Time Zone',\n\t\t\tisRTL: false\n\t\t};\n\t\tthis._defaults = { // Global defaults for all the datetime picker instances\n\t\t\tshowButtonPanel: true,\n\t\t\ttimeOnly: false,\n\t\t\tshowH
2our: null,\n\t\t\tshowMinute: null,\n\t\t\tshowSecond: null,\n\t\t\tshowMillisec: null,\n\t\t\tshowMicrosec: null,\n\t\t\tshowTimezone: null,\n\t\t\tshowTime: true,\n\t\t\tstepHour: 1,\n\t\t\tstepMinute: 1,\n\t\t\tstepSecond: 1,\n\t\t\tstepMillisec: 1,\n\t\t\tstepMicrosec: 1,\n\t\t\thour: 0,\n\t\t\tminute: 0,\n\t\t\tsecond: 0,\n\t\t\tmillisec: 0,\n\t\t\tmicrosec: 0,\n\t\t\ttimezone: null,\n\t\t\thourMin: 0,\n\t\t\tminuteMin: 0,\n\t\t\tsecondMin: 0,\n\t\t\tmillisecMin: 0,\n\t\t\tmicrosecMin: 0,\n\t\t\thourMax: 23,\n\t\t\tminuteMax: 59,\n\t\t\tsecondMax: 59,\n\t\t\tmillisecMax: 999,\n\t\t\tmicrosecMax: 999,\n\t\t\tminDateTime: null,\n\t\t\tmaxDateTime: null,\n\t\t\tonSelect: null,\n\t\t\thourGrid: 0,\n\t\t\tminuteGrid: 0,\n\t\t\tsecondGrid: 0,\n\t\t\tmillisecGrid: 0,\n\t\t\tmicrosecGrid: 0,\n\t\t\talwaysSetTime: true,\n\t\t\tseparator: ' ',\n\t\t\taltFieldTimeOnly: true,\n\t\t\taltTimeFormat: null,\n\t\t\taltSeparator: null,\n\t\t\taltTimeSuffix: null,\n\t\t\tpickerTimeFormat: null,\n\t\t\tpickerTimeSuffix: null,\n\t\t\tshowTimepicker: true,\n\t\t\ttimezoneList: null,\n\t\t\taddSliderAccess: false,\n\t\t\tsliderAccessArgs: null,\n\t\t\tcontrolType: 'slider',\n\t\t\tdefaultValue: null,\n\t\t\tparse: 'strict'\n\t\t};\n\t\t$.extend(this._defaults, this.regional['']);\n\t};\n\n\t$.extend(Timepicker.prototype, {\n\t\t$input: null,\n\t\t$altInput: null,\n\t\t$timeObj: null,\n\t\tinst: null,\n\t\thour_slider: null,\n\t\tminute_slider: null,\n\t\tsecond_slider: null,\n\t\tmillisec_slider: null,\n\t\tmicrosec_slider: null,\n\t\ttimezone_select: null,\n\t\thour: 0,\n\t\tminute: 0,\n\t\tsecond: 0,\n\t\tmillisec: 0,\n\t\tmicrosec: 0,\n\t\ttimezone: null,\n\t\thourMinOriginal: null,\n\t\tminuteMinOriginal: null,\n\t\tsecondMinOriginal: null,\n\t\tmillisecMinOriginal: null,\n\t\tmicrosec
2MinOriginal: null,\n\t\thourMaxOriginal: null,\n\t\tminuteMaxOriginal: null,\n\t\tsecondMaxOriginal: null,\n\t\tmillisecMaxOriginal: null,\n\t\tmicrosecMaxOriginal: null,\n\t\tampm: '',\n\t\tformattedDate: '',\n\t\tformattedTime: '',\n\t\tformattedDateTime: '',\n\t\ttimezoneList: null,\n\t\tunits: ['hour', 'minute', 'second', 'millisec', 'microsec'],\n\t\tsupport: {},\n\t\tcontrol: null,\n\n\t\t/* \n\t\t* Override the default settings for all instances of the time picker.\n\t\t* @param  {Object} settings  object - the new settings to use as defaults (anonymous object)\n\t\t* @return {Object} the manager object\n\t\t*/\n\t\tsetDefaults: function (settings) {\n\t\t\textendRemove(this._defaults, settings || {});\n\t\t\treturn this;\n\t\t},\n\n\t\t/*\n\t\t* Create a new Timepicker instance\n\t\t*/\n\t\t_newInst: function ($input, opts) {\n\t\t\tvar tp_inst = new Timepicker(),\n\t\t\t\tinlineSettings = {},\n\t\t\t\tfns = {},\n\t\t\t\toverrides, i;\n\n\t\t\tfor (var attrName in this._defaults) {\n\t\t\t\tif (this._defaults.hasOwnProperty(attrName)) {\n\t\t\t\t\tvar attrValue = $input.attr('time:' + attrName);\n\t\t\t\t\tif (attrValue) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tinlineSettings[attrName] = eval(attrValue);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tinlineSettings[attrName] = attrValue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toverrides = {\n\t\t\t\tbeforeShow: function (input, dp_inst) {\n\t\t\t\t\tif ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {\n\t\t\t\t\t\treturn tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tonChangeMonthYear: function (year, month, dp_inst) {\n\t\t\t\t\t// Update the time as well : this prevents the time from disappearing from the $input field.\n\t\t\t\t\ttp_inst._updateDateTime(dp_inst);\n\t\t\t\t\tif ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {\n\t\t\t\t\t\ttp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tonClose: function (dateText, dp_inst) {\n\t\t\t\t\tif (tp_inst.timeDefined === true && $input.val() !== '') {\n\t\t\t\t\t\ttp_inst._updateDateTime(dp_inst);\n\t\t\t\t\t}\n\t\t\t\t\tif ($.isFunction(tp_inst._defaults.evnts.onClose)) {\n\t\t\t\t\t\ttp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tfor (i in overrides) {\n\t\t\t\tif (overrides.hasOwnProperty(i)) {\n\t\t\t\t\tfns[i] = opts[i] || null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {\n\t\t\t\tevnts: fns,\n\t\t\t\ttimepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');\n\t\t\t});\n\t\t\ttp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {\n\t\t\t\treturn val.toUpperCase();\n\t\t\t});\n\t\t\ttp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {\n\t\t\t\treturn val.toUpperCase();\n\t\t\t});\n\n\t\t\t// detect which units are supported\n\t\t\ttp_inst.support = detectSupport(\n\t\t\t\t\ttp_inst._defaults.timeFormat + \n\t\t\t\t\t(tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +\n\t\t\t\t\t(tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));\n\n\t\t\t// controlType is string - key to our this._controls\n\t\t\tif (typeof(tp_inst._defaults.controlType) === 'string') {\n\t\t\t\tif (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {\n\t\t\t\t\ttp_inst._defaults.controlType = 'select';\n\t\t\t\t}\n\t\t\t\ttp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];\n\t\t\t}\n\t\t\t// controlType is an object and must implement create, options, value methods\n\t\t\telse {\n\t\t\t\ttp_inst.control = tp_inst._defaults.controlType;\n\t\t\t}\n\n\t\t\t// prep the timezone options\n\t\t\tvar timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,\n\t\t\t\t\t0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];\n\t\t\tif (tp_inst._defaults.timezoneList !== null) {\n\t\t\t\ttimezoneList = tp_inst._defaults.timezoneList;\n\t\t\t}\n\t\t\tvar tzl = timezoneList.length, tzi = 0, tzv = null;\n\t\t\tif (tzl > 0 && typeof timezoneList[0] !== 'object') {\n\t\t\t\tfor (; tzi < tzl; tzi++) {\n\t\t\t\t\ttzv = timezoneList[tzi];\n\t\t\t\t\ttimezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };\n\t\t\t\t}\n\t\t\t}\n\t\t\ttp_inst._defaults.timezoneList = timezoneList;\n\n\t\t\t// set the default units\n\t\t\ttp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :\n\t\t\t\t\t\t\t((new Date()).getTimezoneOffset() * -1);\n\t\t\ttp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :\n\t\t\t\t\t\t\ttp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;\n\t\t\ttp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :\n\t\t\t\t\t\t\ttp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;\n\t\t\ttp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :\n\t\t\t\t\t\t\ttp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;\n\t\t\ttp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :\n\t\t\t\t\t\t\ttp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;\n\t\t\ttp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsec
2Min ? tp_inst._defaults.microsecMin :\n\t\t\t\t\t\t\ttp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;\n\t\t\ttp_inst.ampm = '';\n\t\t\ttp_inst.$input = $input;\n\n\t\t\tif (tp_inst._defaults.altField) {\n\t\t\t\ttp_inst.$altInput = $(tp_inst._defaults.altField).css({\n\t\t\t\t\tcursor: 'pointer'\n\t\t\t\t}).focus(function () {\n\t\t\t\t\t$input.trigger(\"focus\");\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {\n\t\t\t\ttp_inst._defaults.minDate = new Date();\n\t\t\t}\n\t\t\tif (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {\n\t\t\t\ttp_inst._defaults.maxDate = new Date();\n\t\t\t}\n\n\t\t\t// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..\n\t\t\tif (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {\n\t\t\t\ttp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());\n\t\t\t}\n\t\t\tif (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {\n\t\t\t\ttp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());\n\t\t\t}\n\t\t\tif (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {\n\t\t\t\ttp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());\n\t\t\t}\n\t\t\tif (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {\n\t\t\t\ttp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());\n\t\t\t}\n\t\t\ttp_inst.$input.bind('focus', function () {\n\t\t\t\ttp_inst._onFocus();\n\t\t\t});\n\n\t\t\treturn tp_inst;\n\t\t},\n\n\t\t/*\n\t\t* add our sliders to the calendar\n\t\t*/\n\t\t_addTimePicker: function (dp_inst) {\n\t\t\tvar currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();\n\n\t\t\tthis.timeDefined = this._parseTime(currDT);\n\t\t\tthis._limitMinMaxDateTime(dp_inst, false);\n\t\t\tthis._injectTimePicker();\n\t\t},\n\n\t\t/*\n\t\t* parse the time string from input value or _setTime\n\t\t*/\n\t\t_parseTime: function (timeString, withDate) {\n\t\t\tif (!this.inst) {\n\t\t\t\tthis.inst = $.datepicker._getInst(this.$input[0]);\n\t\t\t}\n\n\t\t\tif (withDate || !this._defaults.timeOnly) {\n\t\t\t\tvar dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');\n\t\t\t\ttry {\n\t\t\t\t\tvar parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);\n\t\t\t\t\tif (!parseRes.timeObj) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t$.extend(this, parseRes.timeObj);\n\t\t\t\t} catch (err) {\n\t\t\t\t\t$.timepicker.log(\"Error parsing the date/time string: \" + err +\n\t\t\t\t\t\t\t\t\t\"\\ndate/time string = \" + timeString +\n\t\t\t\t\t\t\t\t\t\"\\ntimeFormat = \" + this._defaults.timeFormat +\n\t\t\t\t\t\t\t\t\t\"\\ndateFormat = \" + dp_dateFormat);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tvar timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);\n\t\t\t\tif (!timeObj) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$.extend(this, timeObj);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t* generate and inject html for timepicker into ui datepicker\n\t\t*/\n\t\t_injectTimePicker: function () {\n\t\t\tvar $dp = this.inst.dpDiv,\n\t\t\t\to = this.inst.settings,\n\t\t\t\ttp_inst = this,\n\t\t\t\tlitem = '',\n\t\t\t\tuitem = '',\n\t\t\t\tshow = null,\n\t\t\t\tmax = {},\n\t\t\t\tgridSize = {},\n\t\t\t\tsize = null,\n\t\t\t\ti = 0,\n\t\t\t\tl = 0;\n\n\t\t\t// Prevent displaying twice\n\t\t\tif ($dp.find(\"div.ui-timepicker-div\").length === 0 && o.showTimepicker) {\n\t\t\t\tvar noDisplay = ' style=\"display:none;\"',\n\t\t\t\t\thtml = '<div class=\"ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + '\"><dl>' + '<dt class=\"ui_tpicker_time_label\"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +\n\t\t\t\t\t\t\t\t'<dd class=\"ui_tpicker_time\"' + ((o.showTime) ? '' : noDisplay) + '></dd>';\n\n\t\t\t\t// Create the markup\n\t\t\t\tfor (i = 0, l = this.units.length; i < l;
2 i++) {\n\t\t\t\t\tlitem = this.units[i];\n\t\t\t\t\tuitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);\n\t\t\t\t\tshow = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];\n\n\t\t\t\t\t// Added by Peter Medeiros:\n\t\t\t\t\t// - Figure out what the hour/minute/second max should be based on the step values.\n\t\t\t\t\t// - Example: if stepMinute is 15, then minMax is 45.\n\t\t\t\t\tmax[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);\n\t\t\t\t\tgridSize[litem] = 0;\n\n\t\t\t\t\thtml += '<dt class=\"ui_tpicker_' + litem + '_label\"' + (show ? '' : noDisplay) + '>' + o[litem + 'Text'] + '</dt>' +\n\t\t\t\t\t\t\t\t'<dd class=\"ui_tpicker_' + litem + '\"><div class=\"ui_tpicker_' + litem + '_slider\"' + (show ? '' : noDisplay) + '></div>';\n\n\t\t\t\t\tif (show && o[litem + 'Grid'] > 0) {\n\t\t\t\t\t\thtml += '<div style=\"padding-left: 1px\"><table class=\"ui-tpicker-grid-label\"><tr>';\n\n\t\t\t\t\t\tif (litem === 'hour') {\n\t\t\t\t\t\t\tfor (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {\n\t\t\t\t\t\t\t\tgridSize[litem]++;\n\t\t\t\t\t\t\t\tvar tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);\n\t\t\t\t\t\t\t\thtml += '<td data-for=\"' + litem + '\">' + tmph + '</td>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tfor (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {\n\t\t\t\t\t\t\t\tgridSize[litem]++;\n\t\t\t\t\t\t\t\thtml += '<td data-for=\"' + litem + '\">' + ((m < 10) ? '0' : '') + m + '</td>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\thtml += '</tr></table></div>';\n\t\t\t\t\t}\n\t\t\t\t\thtml += '</dd>';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Timezone\n\t\t\t\tvar showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;\n\t\t\t\thtml += '<dt class=\"ui_tpicker_timezone_label\"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';\n\t\t\t\thtml += '<dd class=\"ui_tpicker_timezone\" ' + (showTz ? '' : noDisplay) + '></dd>';\n\n\t\t\t\t// Create the elements from string\n\t\t\t\thtml += '</dl></div>';\n\t\t\t\tvar $tp = $(html);\n\n\t\t\t\t// if we only want time picker...\n\t\t\t\tif (o.timeOnly === true) {\n\t\t\t\t\t$tp.prepend('<div class=\"ui-widget-header ui-helper-clearfix ui-corner-all\">' + '<div class=\"ui-datepicker-title\">' + o.timeOnlyTitle + '</div>' + '</div>');\n\t\t\t\t\t$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// add sliders, adjust grids, add events\n\t\t\t\tfor (i = 0, l = tp_inst.units.length; i < l; i++) {\n\t\t\t\t\tlitem = tp_inst.units[i];\n\t\t\t\t\tuitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);\n\t\t\t\t\tshow = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];\n\n\t\t\t\t\t// add the slider\n\t\t\t\t\ttp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);\n\n\t\t\t\t\t// adjust the grid and add click event\n\t\t\t\t\tif (show && o[litem + 'Grid'] > 0) {\n\t\t\t\t\t\tsize = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);\n\t\t\t\t\t\t$tp.find('.ui_tpicker_' + litem + ' table').css({\n\t\t\t\t\t\t\twidth: size + \"%\",\n\t\t\t\t\t\t\tmarginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + \"%\"),\n\t\t\t\t\t\t\tmarginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + \"%\") : '0',\n\t\t\t\t\t\t\tborderCollapse: 'collapse'\n\t\t\t\t\t\t}).find(\"td\").click(function (e) {\n\t\t\t\t\t\t\t\tvar $t = $(this),\n\t\t\t\t\t\t\t\t\th = $t.html(),\n\t\t\t\t\t\t\t\t\tn = parseInt(h.replace(/[^0-9]/g), 10),\n\t\t\t\t\t\t\t\t\tap = h.replace(/[^apm]/ig),\n\t\t\t\t\t\t\t\t\tf = $t.data('for'); // loses scope, so we use data-for\n\n\t\t\t\t\t\t\t\tif (f === 'hour') {\n\t\t\t\t\t\t\t\t\tif (ap.indexOf('p') !== -1 && n < 12) {\n\t\t\t\t\t\t\t\t\t\tn += 12;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif (ap.indexOf('a') !== -1 && n === 12) {\n\t\t\t\t\t\t\t\t\t\t\tn = 0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);\n\n\t\t\t\t\t\t\t\ttp_inst._onTimeChange();\n\t\t\t\t\t\t\t\ttp_inst._onSelectHandler();\n\t\t\t\t\t\t\t}).css({\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\twidth: (100 / gridSize[litem]) + '%',\n\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\toverflow: 'hidden'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} // end if grid > 0\n\t\t\t\t} // end for loop\n\n\t\t\t\t// Add timezone options\n\t\t\t\tthis.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find(\"select\");\n\t\t\t\t$.fn.append.apply(this.timezone_select,\n\t\t\t\t$.map(o.timezoneList, function (val, idx) {\n\t\t\t\t\treturn $(\"<option />\").val(typeof val === \"object\" ? val.value : val).text(typeof val === \"object\" ? val.label : val);\n\t\t\t\t}));\n\t\t\t\tif (typeof(this.timezone) !== \"undefined\" && this.timezone !== null && this.timezone !== \"\") {\n\t\t\t\t\tvar local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;\n\t\t\t\t\tif (local_timezone === this.timezone) {\n\t\t\t\t\t\tselectLocalTimezone(tp_inst);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.timezone_select.val(this.timezone);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof(this.hour) !== \"undefined\" && this.hour !== null && this.hour !== \"\") {\n\t\t\t\t\t\tthis.timezone_select.val(o.timezone);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tselectLocalTimezone(tp_inst);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.timezone_select.change(function () {\n\t\t\t\t\ttp_inst._onTimeChange();\n\t\t\t\t\ttp_inst._onSelectHandler();\n\t\t\t\t});\n\t\t\t\t// End timezone options\n\t\t\t\t\n\t\t\t\t// inject timepicker into datepicker\n\t\t\t\tvar $buttonPanel = $dp.find('.ui-datepicker-buttonpane');\n\t\t\t\tif ($buttonPanel.length) {\n\t\t\t\t\t$buttonPanel.before($tp);\n\t\t\t\t} else {\n\t\t\t\t\t$dp.append($tp);\n\t\t\t\t}\n\n\t\t\t\tthis.$timeObj = $tp.find('.ui_tpicker_time');\n\n\t\t\t\tif (this.inst !== null) {\n\t\t\t\t\tvar timeDefined = this.timeDefined;\n\t\t\t\t\tthis._onTimeChange();\n\t\t\t\t\tthis.timeDefined = timeDefined;\n\t\t\t\t}\n\n\t\t\t\t// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/\n\t\t\t\tif (this._defaults.addSliderAccess) {\
2n\t\t\t\t\tvar sliderAccessArgs = this._defaults.sliderAccessArgs,\n\t\t\t\t\t\trtl = this._defaults.isRTL;\n\t\t\t\t\tsliderAccessArgs.isRTL = rtl;\n\t\t\t\t\t\t\n\t\t\t\t\tsetTimeout(function () { // fix for inline mode\n\t\t\t\t\t\tif ($tp.find('.ui-slider-access').length === 0) {\n\t\t\t\t\t\t\t$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);\n\n\t\t\t\t\t\t\t// fix any grids since sliders are shorter\n\t\t\t\t\t\t\tvar sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);\n\t\t\t\t\t\t\tif (sliderAccessWidth) {\n\t\t\t\t\t\t\t\t$tp.find('table:visible').each(function () {\n\t\t\t\t\t\t\t\t\tvar $g = $(this),\n\t\t\t\t\t\t\t\t\t\toldWidth = $g.outerWidth(),\n\t\t\t\t\t\t\t\t\t\toldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),\n\t\t\t\t\t\t\t\t\t\tnewWidth = oldWidth - sliderAccessWidth,\n\t\t\t\t\t\t\t\t\t\tnewMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',\n\t\t\t\t\t\t\t\t\t\tcss = { width: newWidth, marginRight: 0, marginLeft: 0 };\n\t\t\t\t\t\t\t\t\tcss[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;\n\t\t\t\t\t\t\t\t\t$g.css(css);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 10);\n\t\t\t\t}\n\t\t\t\t// end slideAccess integration\n\n\t\t\t\ttp_inst._limitMinMaxDateTime(this.inst, true);\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t* This function tries to limit the ability to go outside the\n\t\t* min/max date range\n\t\t*/\n\t\t_limitMinMaxDateTime: function (dp_inst, adjustSliders) {\n\t\t\tvar o = this._defaults,\n\t\t\t\tdp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);\n\n\t\t\tif (!this._defaults.showTimepicker) {\n\t\t\t\treturn;\n\t\t\t} // No time so nothing to check here\n\n\t\t\tif ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {\n\t\t\t\tvar minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),\n\t\t\t\t\tminDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);\n\n\t\t\t\tif (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {\n\t\t\t\t\tthis.hourMinOriginal = o.hourMin;\n\t\t\t\t\tthis.minuteMinOriginal = o.minuteMin;\n\t\t\t\t\tthis.secondMinOriginal = o.secondMin;\n\t\t\t\t\tthis.millisecMinOriginal = o.millisecMin;\n\t\t\t\t\tthis.microsecMinOriginal = o.microsecMin;\n\t\t\t\t}\n\n\t\t\t\tif (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {\n\t\t\t\t\tthis._defaults.hourMin = minDateTime.getHours();\n\t\t\t\t\tif (this.hour <= this._defaults.hourMin) {\n\t\t\t\t\t\tthis.hour = this._defaults.hourMin;\n\t\t\t\t\t\tthis._defaults.minuteMin = minDateTime.getMinutes();\n\t\t\t\t\t\tif (this.minute <= this._defaults.minuteMin) {\n\t\t\t\t\t\t\tthis.minute = this._defaults.minuteMin;\n\t\t\t\t\t\t\tthis._defaults.secondMin = minDateTime.getSeconds();\n\t\t\t\t\t\t\tif (this.second <= this._defaults.secondMin) {\n\t\t\t\t\t\t\t\tthis.second = this._defaults.secondMin;\n\t\t\t\t\t\t\t\tthis._defaults.millisecMin = minDateTime.getMilliseconds();\n\t\t\t\t\t\t\t\tif (this.millisec <= this._defaults.millisecMin) {\n\t\t\t\t\t\t\t\t\tthis.millisec = this._defaults.millisecMin;\n\t\t\t\t\t\t\t\t\tthis._defaults.microsecMin = minDateTime.getMicroseconds();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (this.microsec < this._defaults.microsecMin) {\n\t\t\t\t\t\t\t\t\t\tthis.microsec = this._defaults.microsecMin;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tthis._defaults.microsecMin = this.microsecMinOriginal;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._defaults.millisecMin = this.millisecMinOriginal;\n\t\t\t\t\t\t\t\tthis._defaults.microsecMin = this.microsecMinOriginal;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._defaults.secondMin = this.secondMinOriginal;\n\t\t\t\t\t\t\tthis._defaults.millisecMin = this.millisecMinOriginal;
2\n\t\t\t\t\t\t\tthis._defaults.microsecMin = this.microsecMinOriginal;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._defaults.minuteMin = this.minuteMinOriginal;\n\t\t\t\t\t\tthis._defaults.secondMin = this.secondMinOriginal;\n\t\t\t\t\t\tthis._defaults.millisecMin = this.millisecMinOriginal;\n\t\t\t\t\t\tthis._defaults.microsecMin = this.microsecMinOriginal;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._defaults.hourMin = this.hourMinOriginal;\n\t\t\t\t\tthis._defaults.minuteMin = this.minuteMinOriginal;\n\t\t\t\t\tthis._defaults.secondMin = this.secondMinOriginal;\n\t\t\t\t\tthis._defaults.millisecMin = this.millisecMinOriginal;\n\t\t\t\t\tthis._defaults.microsecMin = this.microsecMinOriginal;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {\n\t\t\t\tvar maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),\n\t\t\t\t\tmaxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);\n\n\t\t\t\tif (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {\n\t\t\t\t\tthis.hourMaxOriginal = o.hourMax;\n\t\t\t\t\tthis.minuteMaxOriginal = o.minuteMax;\n\t\t\t\t\tthis.secondMaxOriginal = o.secondMax;\n\t\t\t\t\tthis.millisecMaxOriginal = o.millisecMax;\n\t\t\t\t\tthis.microsecMaxOriginal = o.microsecMax;\n\t\t\t\t}\n\n\t\t\t\tif (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {\n\t\t\t\t\tthis._defaults.hourMax = maxDateTime.getHours();\n\t\t\t\t\tif (this.hour >= this._defaults.hourMax) {\n\t\t\t\t\t\tthis.hour = this._defaults.hourMax;\n\t\t\t\t\t\tthis._defaults.minuteMax = maxDateTime.getMinutes();\n\t\t\t\t\t\tif (this.minute >= this._defaults.minuteMax) {\n\t\t\t\t\t\t\tthis.minute = this._defaults.minuteMax;\n\t\t\t\t\t\t\tthis._defaults.secondMax = maxDateTime.getSeconds();\n\t\t\t\t\t\t\tif (this.second >= this._defaults.secondMax) {\n\t\t\t\t\t\t\t\tthis.second = this._defaults.secondMax;\n\t\t\t\t\t\t\t\tthis._defaults.millisecMax = maxDateTime.getMilliseconds();\n\t\t\t\t\t\t\t\tif (this.millisec >= this._defaults.millisecMax) {\n\t\t\t\t\t\t\t\t\tthis.millisec = this._defaults.millisecMax;\n\t\t\t\t\t\t\t\t\tthis._defaults.microsecMax = maxDateTime.getMicroseconds();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (this.microsec > this._defaults.microsecMax) {\n\t\t\t\t\t\t\t\t\t\tthis.microsec = this._defaults.microsecMax;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tthis._defaults.microsecMax = this.microsecMaxOriginal;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._defaults.millisecMax = this.millisecMaxOriginal;\n\t\t\t\t\t\t\t\tthis._defaults.microsecMax = this.microsecMaxOriginal;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._defaults.secondMax = this.secondMaxOriginal;\n\t\t\t\t\t\t\tthis._defaults.millisecMax = this.millisecMaxOriginal;\n\t\t\t\t\t\t\tthis._defaults.microsecMax = this.microsecMaxOriginal;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._defaults.minuteMax = this.minuteMaxOriginal;\n\t\t\t\t\t\tthis._defaults.secondMax = this.secondMaxOriginal;\n\t\t\t\t\t\tthis._defaults.millisecMax = this.millisecMaxOriginal;\n\t\t\t\t\t\tthis._defaults.microsecMax = this.microsecMaxOriginal;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._defaults.hourMax = this.hourMaxOriginal;\n\t\t\t\t\tthis._defaults.minuteMax = this.minuteMaxOriginal;\n\t\t\t\t\tthis._defaults.secondMax = this.secondMaxOriginal;\n\t\t\t\t\tthis._defaults.millisecMax = this.millisecMaxOriginal;\n\t\t\t\t\tthis._defaults.microsecMax = this.microsecMaxOriginal;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (adjustSliders !== undefined && adjustSliders === true) {\n\t\t\t\tvar hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),\n\t\t\t\t\tminMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),\n\t\t\t\t\tsecMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),\n\t\t\t\t\tmillisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),\n\t\t\t\t\tmicrosec
2Max = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);\n\n\t\t\t\tif (this.hour_slider) {\n\t\t\t\t\tthis.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });\n\t\t\t\t\tthis.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));\n\t\t\t\t}\n\t\t\t\tif (this.minute_slider) {\n\t\t\t\t\tthis.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });\n\t\t\t\t\tthis.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));\n\t\t\t\t}\n\t\t\t\tif (this.second_slider) {\n\t\t\t\t\tthis.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });\n\t\t\t\t\tthis.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));\n\t\t\t\t}\n\t\t\t\tif (this.millisec_slider) {\n\t\t\t\t\tthis.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });\n\t\t\t\t\tthis.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));\n\t\t\t\t}\n\t\t\t\tif (this.microsec_slider) {\n\t\t\t\t\tthis.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax });\n\t\t\t\t\tthis.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));\n\t\t\t\t}\n\t\t\t}\n\n\t\t},\n\n\t\t/*\n\t\t* when a slider moves, set the internal time...\n\t\t* on time change is also called when the time is updated in the text field\n\t\t*/\n\t\t_onTimeChange: function () {\n\t\t\tif (!this._defaults.showTimepicker) {\n                                return;\n\t\t\t}\n\t\t\tvar hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,\n\t\t\t\tminute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,\n\t\t\t\tsecond = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,\n\t\t\t\tmillisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,\n\t\t\t\tmicrosec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,\n\t\t\t\ttimezone = (this.timezone_select) ? this.timezone_select.val() : false,\n\t\t\t\to = this._defaults,\n\t\t\t\tpickerTimeFormat = o.pickerTimeFormat || o.timeFormat,\n\t\t\t\tpickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;\n\n\t\t\tif (typeof(hour) === 'object') {\n\t\t\t\thour = false;\n\t\t\t}\n\t\t\tif (typeof(minute) === 'object') {\n\t\t\t\tminute = false;\n\t\t\t}\n\t\t\tif (typeof(second) === 'object') {\n\t\t\t\tsecond = false;\n\t\t\t}\n\t\t\tif (typeof(millisec) === 'object') {\n\t\t\t\tmillisec = false;\n\t\t\t}\n\t\t\tif (typeof(microsec) === 'object') {\n\t\t\t\tmicrosec = false;\n\t\t\t}\n\t\t\tif (typeof(timezone) === 'object') {\n\t\t\t\ttimezone = false;\n\t\t\t}\n\n\t\t\tif (hour !== false) {\n\t\t\t\thour = parseInt(hour, 10);\n\t\t\t}\n\t\t\tif (minute !== false) {\n\t\t\t\tminute = parseInt(minute, 10);\n\t\t\t}\n\t\t\tif (second !== false) {\n\t\t\t\tsecond = parseInt(second, 10);\n\t\t\t}\n\t\t\tif (millisec !== false) {\n\t\t\t\tmillisec = parseInt(millisec, 10);\n\t\t\t}\n\t\t\tif (microsec !== false) {\n\t\t\t\tmicrosec = parseInt(microsec, 10);\n\t\t\t}\n\t\t\tif (timezone !== false) {\n\t\t\t\ttimezone = timezone.toString();\n\t\t\t}\n\n\t\t\tvar ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];\n\n\t\t\t// If the update was done in the input field, the input field should not be updated.\n\t\t\t// If the update was done using the sliders, update the input field.\n\t\t\tvar hasChanged = (\n\t\t\t\t\t\thour !== parseInt(this.hour,10) || // sliders should all be numeric\n\t\t\t\t\t\tminute !== parseInt(this.minute,10) || \n\t\t\t\t\t\tsecond !== parseInt(this.second,10) || \n\t\t\t\t\t\tmillisec !== parseInt(this.millisec,10) || \n\t\t\t\t\t\tmicrosec !== parseInt(this.microsec,10) || \n\t\t\t\t\t\t(this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) || \n\t\t\t\t\t\t(this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or \"EST\" format, so use toString()\n\t\t\t\t\t);\n\n\t\t\tif (hasChanged) {\n\n\t\t\t\tif (hour !== false) {\n\t\t\t\t\tthis.hour = hour;\n\t\t\t\t}\n\t\t\t\tif (minute !== false) {\n\t\t\t\t\tthis.minute = minute;\n\t\t\t\t}\n\t\t\t\tif (second !== false) {\n\t\t\t\t\tthis.second = second;\n\t\t\t\t}\n\t\t\t\tif (millisec !== false) {\n\t\t\t\t\tthis.millisec = millisec;\n\t\t\t\t}\n\t\t\t\tif (microsec !== false) {\n\t\t\t\t\tthis.microsec = microsec;\n\t\t\t\t}\n\t\t\t\tif (timezone !== false) {\n\t\t\t\t\tthis.timezone = timezone;\n\t\t\t\t}\n\n\t\t\t\tif (!this.inst) {\n\t\t\t\t\tthis.inst = $.datepicker._getInst(this.$input[0]);\n\t\t\t\t}\n\n\t\t\t\tthis._limitMinMaxDateTime(this.inst, true);\n\t\t\t}\n\t\t\tif (this.support.ampm) {\n\t\t\t\tthis.ampm = ampm;\n\t\t\t}\n\n\t\t\t// Updates the time within the timepicker\n\t\t\tthis.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);\n\t\t\tif (this.$timeObj) {\n\t\t\t\tif (pickerTimeFormat === o.timeFormat) {\n\t\t\t\t\tthis.$timeObj.text(this.formattedTime + pickerTimeSuffix);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.timeDefined = true;\n\t\t\tif (hasChanged) {\n\t\t\t\tthis._updateDateTime();\n\t\t\t\tthis.$input.focus();\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t* call custom onSelect.\n\t\t* bind to sliders slidestop, and grid click.\n\t\t*/\n\t\t_onSelectHandler: function () {\n\t\t\tvar onSelect = this._defaults.onSelect || this.inst.settings.onSelect;\n\t\t\tvar inputEl = this.$input ? this.$input[0] : null;\n\t\t\tif (onSelect && inputEl) {\n\t\t\t\tonSelect.apply(inputEl, [this.formattedDateTime, this]);\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t* update our input with the new date time..\n\t\t*/\n\t\t_updateDateTime: function (dp_inst) {\n\t\t\tdp_inst = this.inst || dp_inst;\n\t\t\tvar dtTmp = (dp_inst.currentYear > 0? \n\t\t\t\t\t\t\tnew Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) : \n\t\t\t\t\t\t\tnew Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),\n\t\t\t\tdt = $.datepicker._daylightSavingAdjust(dtTmp),\n\t\t\t\t//dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),\n\t\t\t\t//dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),\n\t\t\t\tdateFmt = $.datepicker._get(dp_inst, 'dateFormat'),\n\t\t\t\tformatCfg = $.datepicker._getFormatConfig(dp_inst),\n\t\t\t\ttimeAvailable = dt !== null && this.timeDefined;\n\t\t\tthis.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);\n\t\t\tvar formattedDateTime = this.formattedDate;\n\t\t\t\n\t\t\t// if a slider was changed but datepicker doesn't have a value yet, set it\n\t\t\tif (dp_inst.lastVal === \"\") {\n                dp_inst.currentYear = dp_inst.selectedYear;\n                dp_inst.currentMonth = dp_inst.selectedMonth;\n                dp_inst.currentDay = dp_inst.selectedDay;\n            }\n\n\t\t\t/*\n\t\t\t* remove following lines to force every changes in date picker to change the input value\n\t\t\t* Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker. \n\t\t\t* If the user manually empty the value in the input field, the date picker will never change selected value.\n\t\t\t*/\n\t\t\t//if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {\n\t\t\t//\treturn;\n\t\t\t//}\n\n\t\t\tif (this._defaults.timeOnly === true) {\n\t\t\t\tformattedDateTime = this.formattedTime;\n\t\t\t} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {\n\t\t\t\tformattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;\n\t\t\t}\n\n\t\t\tthis.formattedDateTime = formattedDateTime;
2\n\n\t\t\tif (!this._defaults.showTimepicker) {\n\t\t\t\tthis.$input.val(this.formattedDate);\n\t\t\t} else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {\n\t\t\t\tthis.$altInput.val(this.formattedTime);\n\t\t\t\tthis.$input.val(this.formattedDate);\n\t\t\t} else if (this.$altInput) {\n\t\t\t\tthis.$input.val(formattedDateTime);\n\t\t\t\tvar altFormattedDateTime = '',\n\t\t\t\t\taltSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,\n\t\t\t\t\taltTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;\n\t\t\t\t\n\t\t\t\tif (!this._defaults.timeOnly) {\n\t\t\t\t\tif (this._defaults.altFormat) {\n\t\t\t\t\t\taltFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\taltFormattedDateTime = this.formattedDate;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (altFormattedDateTime) {\n\t\t\t\t\t\taltFormattedDateTime += altSeparator;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this._defaults.altTimeFormat) {\n\t\t\t\t\taltFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\taltFormattedDateTime += this.formattedTime + altTimeSuffix;\n\t\t\t\t}\n\t\t\t\tthis.$altInput.val(altFormattedDateTime);\n\t\t\t} else {\n\t\t\t\tthis.$input.val(formattedDateTime);\n\t\t\t}\n\n\t\t\tthis.$input.trigger(\"change\");\n\t\t},\n\n\t\t_onFocus: function () {\n\t\t\tif (!this.$input.val() && this._defaults.defaultValue) {\n\t\t\t\tthis.$input.val(this._defaults.defaultValue);\n\t\t\t\tvar inst = $.datepicker._getInst(this.$input.get(0)),\n\t\t\t\t\ttp_inst = $.datepicker._get(inst, 'timepicker');\n\t\t\t\tif (tp_inst) {\n\t\t\t\t\tif (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$.datepicker._updateDatepicker(inst);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t$.timepicker.log(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/*\n\t\t* Small abstraction to control types\n\t\t* We can add more, just be sure to follow the pattern: create, options, value\n\t\t*/\n\t\t_controls: {\n\t\t\t// slider methods\n\t\t\tslider: {\n\t\t\t\tcreate: function (tp_inst, obj, unit, val, min, max, step) {\n\t\t\t\t\tvar rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60\n\t\t\t\t\treturn obj.prop('slide', null).slider({\n\t\t\t\t\t\torientation: \"horizontal\",\n\t\t\t\t\t\tvalue: rtl ? val * -1 : val,\n\t\t\t\t\t\tmin: rtl ? max * -1 : min,\n\t\t\t\t\t\tmax: rtl ? min * -1 : max,\n\t\t\t\t\t\tstep: step,\n\t\t\t\t\t\tslide: function (event, ui) {\n\t\t\t\t\t\t\ttp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);\n\t\t\t\t\t\t\ttp_inst._onTimeChange();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstop: function (event, ui) {\n\t\t\t\t\t\t\ttp_inst._onSelectHandler();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\t\n\t\t\t\t},\n\t\t\t\toptions: function (tp_inst, obj, unit, opts, val) {\n\t\t\t\t\tif (tp_inst._defaults.isRTL) {\n\t\t\t\t\t\tif (typeof(opts) === 'string') {\n\t\t\t\t\t\t\tif (opts === 'min' || opts === 'max') {\n\t\t\t\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\t\t\t\treturn obj.slider(opts, val * -1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn Math.abs(obj.slider(opts));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn obj.slider(opts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar min = opts.min, \n\t\t\t\t\t\t\tmax = opts.max;\n\t\t\t\t\t\topts.min = opts.max = null;\n\t\t\t\t\t\tif (min !== undefined) {\n\t\t\t\t\t\t\topts.max = min * -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (max !== undefined) {\n\t\t\t\t\t\t\topts.min = max * -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn obj.slider(opts);\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof(opts) === 'string' && val !== undefined) {\n\t\t\t\t\t\treturn obj.slider(opts, val);\n\t\t\t\t\t}\n\t\t\t\t\treturn obj.slider(opts);\n\t\t\t\t},\n\t\t\t\tvalue: function (tp_inst, obj, unit, val) {\n\t\t\t\t\tif (tp_inst._defaults.isRTL) {\n\t\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\t\treturn obj.slider('value', val * -1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn Math.abs(obj.slider('value'));\n\t\t\t\t\t}\n\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\treturn obj.slider('value', val);\n\t\t\t\t\t}\n\t\t\t\t\treturn obj.slider('value');\n\t\t\t\t}\n\t\t\t}
2,\n\t\t\t// select methods\n\t\t\tselect: {\n\t\t\t\tcreate: function (tp_inst, obj, unit, val, min, max, step) {\n\t\t\t\t\tvar sel = '<select class=\"ui-timepicker-select\" data-unit=\"' + unit + '\" data-min=\"' + min + '\" data-max=\"' + max + '\" data-step=\"' + step + '\">',\n\t\t\t\t\t\tformat = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;\n\n\t\t\t\t\tfor (var i = min; i <= max; i += step) {\n\t\t\t\t\t\tsel += '<option value=\"' + i + '\"' + (i === val ? ' selected' : '') + '>';\n\t\t\t\t\t\tif (unit === 'hour') {\n\t\t\t\t\t\t\tsel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }\n\t\t\t\t\t\telse {sel += '0' + i.toString(); }\n\t\t\t\t\t\tsel += '</option>';\n\t\t\t\t\t}\n\t\t\t\t\tsel += '</select>';\n\n\t\t\t\t\tobj.children('select').remove();\n\n\t\t\t\t\t$(sel).appendTo(obj).change(function (e) {\n\t\t\t\t\t\ttp_inst._onTimeChange();\n\t\t\t\t\t\ttp_inst._onSelectHandler();\n\t\t\t\t\t});\n\n\t\t\t\t\treturn obj;\n\t\t\t\t},\n\t\t\t\toptions: function (tp_inst, obj, unit, opts, val) {\n\t\t\t\t\tvar o = {},\n\t\t\t\t\t\t$t = obj.children('select');\n\t\t\t\t\tif (typeof(opts) === 'string') {\n\t\t\t\t\t\tif (val === undefined) {\n\t\t\t\t\t\t\treturn $t.data(opts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\to[opts] = val;\t\n\t\t\t\t\t}\n\t\t\t\t\telse { o = opts; }\n\t\t\t\t\treturn tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));\n\t\t\t\t},\n\t\t\t\tvalue: function (tp_inst, obj, unit, val) {\n\t\t\t\t\tvar $t = obj.children('select');\n\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\treturn $t.val(val);\n\t\t\t\t\t}\n\t\t\t\t\treturn $t.val();\n\t\t\t\t}\n\t\t\t}\n\t\t} // end _controls\n\n\t});\n\n\t$.fn.extend({\n\t\t/*\n\t\t* shorthand just to use timepicker.\n\t\t*/\n\t\ttimepicker: function (o) {\n\t\t\to = o || {};\n\t\t\tvar tmp_args = Array.prototype.slice.call(arguments);\n\n\t\t\tif (typeof o === 'object') {\n\t\t\t\ttmp_args[0] = $.extend(o, {\n\t\t\t\t\ttimeOnly: true\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn $(this).each(function () {\n\t\t\t\t$.fn.datetimepicker.apply($(this), tmp_args);\n\t\t\t});\n\t\t},\n\n\t\t/*\n\t\t* extend timepicker to datepicker\n\t\t*/\n\t\tdatetimepicker: function (o) {\n\t\t\to = o || {};\n\t\t\tvar tmp_args = arguments;\n\n\t\t\tif (typeof(o) === 'string') {\n\t\t\t\tif (o === 'getDate') {\n\t\t\t\t\treturn $.fn.datepicker.apply($(this[0]), tmp_args);\n\t\t\t\t} else {\n\t\t\t\t\treturn this.each(function () {\n\t\t\t\t\t\tvar $t = $(this);\n\t\t\t\t\t\t$t.datepicker.apply($t, tmp_args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn this.each(function () {\n\t\t\t\t\tvar $t = $(this);\n\t\t\t\t\t$t.datepicker($.timepicker._newInst($t, o)._defaults);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n\t* Public Utility to parse date and time\n\t*/\n\t$.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {\n\t\tvar parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);\n\t\tif (parseRes.timeObj) {\n\t\t\tvar t = parseRes.timeObj;\n\t\t\tparseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);\n\t\t\tparseRes.date.setMicroseconds(t.microsec);\n\t\t}\n\n\t\treturn parseRes.date;\n\t};\n\n\t/*\n\t* Public utility to parse time\n\t*/\n\t$.datepicker.parseTime = function (timeFormat, timeString, options) {\n\t\tvar o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),\n\t\t\tiso8601 = (timeFormat.replace(/\\'.*?\\'/g, '').indexOf('Z') !== -1);\n\n\t\t// Strict parse requires the timeString to match the timeFormat exactly\n\t\tvar strictParse = function (f, s, o) {\n\n\t\t\t// pattern for standard and localized AM/PM markers\n\t\t\tvar getPatternAmpm = function (amNames, pmNames) {\n\t\t\t\tvar markers = [];\n\t\t\t\tif (amNames) {\n\t\t\t\t\t$.merge(markers, amNames);\n\t\t\t\t}\n\t\t\t\tif (pmNames) {\n\t\t\t\t\t$.merge(markers, pmNames);\n\t\t\t\t}\n\t\t\t\tmarkers = $.map(markers, function (val) {\n\t\t\t\t\treturn val.replace(/[.*+?|()\\[\\]{}\\\\]/g, '\\\\$&');\n\t\t\t\t});\n\t\t\t\treturn '(' + markers.join('|') + ')?';\n\t\t\t};\n\n\t\t\t// figure out position of time elements.. cause js cant do named captures\n\t\t\tvar getFormatPositions = function (timeFormat) {\n\t\t\t\tvar finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),\n\t\t\t\t\torders = {\n\t\t\t\t\t\th: -1,\n\t\t\t\t\t\tm: -1,\n\t\t\t\t\t\ts: -1,\n\t\t\t\t\t\tl: -1,\n\t\t\t\t\t\tc: -1,\n\t\t\t\t\t\tt: -1,\n\t\t\t\t\t\tz: -1\n\t\t\t\t\t};\n\n\t\t\t\tif (finds) {\n\t\t\t\t\tfor (var i = 0; i < finds.length;
2 i++) {\n\t\t\t\t\t\tif (orders[finds[i].toString().charAt(0)] === -1) {\n\t\t\t\t\t\t\torders[finds[i].toString().charAt(0)] = i + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn orders;\n\t\t\t};\n\n\t\t\tvar regstr = '^' + f.toString()\n\t\t\t\t\t.replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {\n\t\t\t\t\t\t\tvar ml = match.length;\n\t\t\t\t\t\t\tswitch (match.charAt(0).toLowerCase()) {\n\t\t\t\t\t\t\tcase 'h':\n\t\t\t\t\t\t\t\treturn ml === 1 ? '(\\\\d?\\\\d)' : '(\\\\d{' + ml + '})';\n\t\t\t\t\t\t\tcase 'm':\n\t\t\t\t\t\t\t\treturn ml === 1 ? '(\\\\d?\\\\d)' : '(\\\\d{' + ml + '})';\n\t\t\t\t\t\t\tcase 's':\n\t\t\t\t\t\t\t\treturn ml === 1 ? '(\\\\d?\\\\d)' : '(\\\\d{' + ml + '})';\n\t\t\t\t\t\t\tcase 'l':\n\t\t\t\t\t\t\t\treturn '(\\\\d?\\\\d?\\\\d)';\n\t\t\t\t\t\t\tcase 'c':\n\t\t\t\t\t\t\t\treturn '(\\\\d?\\\\d?\\\\d)';\n\t\t\t\t\t\t\tcase 'z':\n\t\t\t\t\t\t\t\treturn '(z|[-+]\\\\d\\\\d:?\\\\d\\\\d|\\\\S+)?';\n\t\t\t\t\t\t\tcase 't':\n\t\t\t\t\t\t\t\treturn getPatternAmpm(o.amNames, o.pmNames);\n\t\t\t\t\t\t\tdefault:    // literal escaped in quotes\n\t\t\t\t\t\t\t\treturn '(' + match.replace(/\\'/g, \"\").replace(/(\\.|\\$|\\^|\\\\|\\/|\\(|\\)|\\[|\\]|\\?|\\+|\\*)/g, function (m) { return \"\\\\\" + m; }) + ')?';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t.replace(/\\s/g, '\\\\s?') +\n\t\t\t\t\to.timeSuffix + '$',\n\t\t\t\torder = getFormatPositions(f),\n\t\t\t\tampm = '',\n\t\t\t\ttreg;\n\n\t\t\ttreg = s.match(new RegExp(regstr, 'i'));\n\n\t\t\tvar resTime = {\n\t\t\t\thour: 0,\n\t\t\t\tminute: 0,\n\t\t\t\tsecond: 0,\n\t\t\t\tmillisec: 0,\n\t\t\t\tmicrosec: 0\n\t\t\t};\n\n\t\t\tif (treg) {\n\t\t\t\tif (order.t !== -1) {\n\t\t\t\t\tif (treg[order.t] === undefined || treg[order.t].length === 0) {\n\t\t\t\t\t\tampm = '';\n\t\t\t\t\t\tresTime.ampm = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';\n\t\t\t\t\t\tresTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (order.h !== -1) {\n\t\t\t\t\tif (ampm === 'AM' && treg[order.h] === '12') {\n\t\t\t\t\t\tresTime.hour = 0; // 12am = 0 hour\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (ampm === 'PM' && treg[order.h] !== '12') {\n\t\t\t\t\t\t\tresTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresTime.hour = Number(treg[order.h]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (order.m !== -1) {\n\t\t\t\t\tresTime.minute = Number(treg[order.m]);\n\t\t\t\t}\n\t\t\t\tif (order.s !== -1) {\n\t\t\t\t\tresTime.second = Number(treg[order.s]);\n\t\t\t\t}\n\t\t\t\tif (order.l !== -1) {\n\t\t\t\t\tresTime.millisec = Number(treg[order.l]);\n\t\t\t\t}\n\t\t\t\tif (order.c !== -1) {\n\t\t\t\t\tresTime.microsec = Number(treg[order.c]);\n\t\t\t\t}\n\t\t\t\tif (order.z !== -1 && treg[order.z] !== undefined) {\n\t\t\t\t\tresTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);\n\t\t\t\t}\n\n\n\t\t\t\treturn resTime;\n\t\t\t}\n\t\t\treturn false;\n\t\t};// end strictParse\n\n\t\t// First try JS Date, if that fails, use strictParse\n\t\tvar looseParse = function (f, s, o) {\n\t\t\ttry {\n\t\t\t\tvar d = new Date('2012-01-01 ' + s);\n\t\t\t\tif (isNaN(d.getTime())) {\n\t\t\t\t\td = new Date('2012-01-01T' + s);\n\t\t\t\t\tif (isNaN(d.getTime())) {\n\t\t\t\t\t\td = new Date('01/01/2012 ' + s);\n\t\t\t\t\t\tif (isNaN(d.getTime())) {\n\t\t\t\t\t\t\tthrow \"Unable to parse time with native Date: \" + s;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\thour: d.getHours(),\n\t\t\t\t\tminute: d.getMinutes(),\n\t\t\t\t\tsecond: d.getSeconds(),\n\t\t\t\t\tmillisec: d.getMilliseconds(),\n\t\t\t\t\tmicrosec: d.getMicroseconds(),\n\t\t\t\t\ttimezone: d.getTimezoneOffset() * -1\n\t\t\t\t};\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\ttry {\n\t\t\t\t\treturn strictParse(f, s, o);\n\t\t\t\t}\n\t\t\t\tcatch (err2) {\n\t\t\t\t\t$.timepicker.log(\"Unable to parse \\ntimeString: \" + s + \"\\ntimeFormat: \" + f);\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\treturn false;\n\t\t}; // end looseParse\n\t\t\n\t\tif (typeof o.parse === \"function\") {\n\t\t\treturn o.parse(timeFormat, timeString, o);\n\t\t}\n\t\tif (o.parse === 'loose') {\n\t\t\treturn looseParse(timeFormat, timeString, o);\n\t\t}\n\t\treturn strictParse(timeFormat, timeString, o);\n\t};\n\n\t/**\n\t * Public utility to format the time\n\t * @param {string} format format of the time\n\t * @param {Object} time Object not a Date for timezones\n\t * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm\n\t * @returns {string} the formatted time\n\t */\n\t$.datepicker.formatTime = function (format, time, options) {\n\t\toptions = options || {};\n\t\toptions = $.extend({}, $.timepicker._defaults, options);\n\t\ttime = $.extend({\n\t\t\thour: 0,\n\t\t\tminute: 0,\n\t\t\tsecond: 0,\n\t\t\tmillisec: 0,\n\t\t\tmicrosec: 0,\n\t\t\ttimezone: null\n\t\t}, time);\n\n\t\tvar tmptime = format,\n\t\t\tampmName = options.amNames[0],\n\t\t\thour = parseInt(time.hour, 10);\n\n\t\tif (hour > 11) {\n\t\t\tampmName = options.pmNames[0];\n\t\t}\n\n\t\ttmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {\n\t\t\tswitch (match) {\n\t\t\tcase 'HH':\n\t\t\t\treturn ('0' + hour).slice(-2);\n\t\t\tcase 'H':\n\t\t\t\treturn hour;\n\t\t\tcase 'hh':\n\t\t\t\treturn ('0' + convert24to12(hour)).slice(-2);\n\t\t\tcase 'h':\n\t\t\t\treturn convert24to12(hour);\n\t\t\tcase 'mm':\n\t\t\t\treturn ('0' + time.minute).slice(-2);\n\t\t\tcase 'm':\n\t\t\t\treturn time.minute;\n\t\t\tcase 'ss':\n\t\t\t\treturn ('0' + time.second).slice(-2);\n\t\t\tcase 's':\n\t\t\t\treturn time.second;\n\t\t\tcase 'l':\n\t\t\t\treturn ('00' + time.millisec).slice(-3);\n\t\t\tcase 'c':\n\t\t\t\treturn ('00' + time.microsec).slice(-3);\n\t\t\tcase 'z':\n\t\t\t\treturn $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);\n\t\t\tcase 'Z':\n\t\t\t\treturn $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);\n\t\t\tcase 'T':\n\t\t\t\treturn ampmName.charAt(0).toUpperCase();\n\t\t\tcase 'TT':\n\t\t\t\treturn ampmName.toUpperCase();\n\t\t\tcase 't':\n\t\t\t\treturn ampmName.charAt(0).toLowerCase();\n\t\t\tcase 'tt':\n\t\t\t\treturn ampmName.toLowerCase();\n\t\t\tdefault:\n\t\t\t\treturn match.replace(/'/g, \"\");\n\t\t\t}\n\t\t});\n\n\t\treturn tmptime;
2\n\t};\n\n\t/*\n\t* the bad hack :/ override datepicker so it doesn't close on select\n\t// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378\n\t*/\n\t$.datepicker._base_selectDate = $.datepicker._selectDate;\n\t$.datepicker._selectDate = function (id, dateStr) {\n\t\tvar inst = this._getInst($(id)[0]),\n\t\t\ttp_inst = this._get(inst, 'timepicker');\n\n\t\tif (tp_inst) {\n\t\t\ttp_inst._limitMinMaxDateTime(inst, true);\n\t\t\tinst.inline = inst.stay_open = true;\n\t\t\t//This way the onSelect handler called from calendarpicker get the full dateTime\n\t\t\tthis._base_selectDate(id, dateStr);\n\t\t\tinst.inline = inst.stay_open = false;\n\t\t\tthis._notifyChange(inst);\n\t\t\tthis._updateDatepicker(inst);\n\t\t} else {\n\t\t\tthis._base_selectDate(id, dateStr);\n\t\t}\n\t};\n\n\t/*\n\t* second bad hack :/ override datepicker so it triggers an event when changing the input field\n\t* and does not redraw the datepicker on every selectDate event\n\t*/\n\t$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;\n\t$.datepicker._updateDatepicker = function (inst) {\n\n\t\t// don't popup the datepicker if there is another instance already opened\n\t\tvar input = inst.input[0];\n\t\tif ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {\n\n\t\t\tthis._base_updateDatepicker(inst);\n\n\t\t\t// Reload the time control when changing something in the input text field.\n\t\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\t\tif (tp_inst) {\n\t\t\t\ttp_inst._addTimePicker(inst);\n\t\t\t}\n\t\t}\n\t};\n\n\t/*\n\t* third bad hack :/ override datepicker so it allows spaces and colon in the input field\n\t*/\n\t$.datepicker._base_doKeyPress = $.datepicker._doKeyPress;\n\t$.datepicker._doKeyPress = function (event) {\n\t\tvar inst = $.datepicker._getInst(event.target),\n\t\t\ttp_inst = $.datepicker._get(inst, 'timepicker');\n\n\t\tif (tp_inst) {\n\t\t\tif ($.datepicker._get(inst, 'constrainInput')) {\n\t\t\t\tvar ampm = tp_inst.support.ampm,\n\t\t\t\t\ttz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,\n\t\t\t\t\tdateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),\n\t\t\t\t\tdatetimeChars = tp_inst._defaults.timeFormat.toString()\n\t\t\t\t\t\t\t\t\t\t\t.replace(/[hms]/g, '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/TT/g, ampm ? 'APM' : '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/Tt/g, ampm ? 'AaPpMm' : '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/tT/g, ampm ? 'AaPpMm' : '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/T/g, ampm ? 'AP' : '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/tt/g, ampm ? 'apm' : '')\n\t\t\t\t\t\t\t\t\t\t\t.replace(/t/g, ampm ? 'ap' : '') + \n\t\t\t\t\t\t\t\t\t\t\t\" \" + tp_inst._defaults.separator + \n\t\t\t\t\t\t\t\t\t\t\ttp_inst._defaults.timeSuffix + \n\t\t\t\t\t\t\t\t\t\t\t(tz ? tp_inst._defaults.timezoneList.join('') : '') + \n\t\t\t\t\t\t\t\t\t\t\t(tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) + \n\t\t\t\t\t\t\t\t\t\t\tdateChars,\n\t\t\t\t\tchr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);\n\t\t\t\treturn event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);\n\t\t\t}\n\t\t}\n\n\t\treturn $.datepicker._base_doKeyPress(event);\n\t};\n\n\t/*\n\t* Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField\n\t* Update any alternate field to synchronise with the main field.\n\t*/\n\t$.datepicker._base_updateAlternate = $.datepicker._updateAlternate;\n\t$.datepicker._updateAlternate = function (inst) {\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tif (tp_inst) {\n\t\t\tvar altField = tp_inst._defaults.altField;\n\t\t\tif (altField) { // update alternate field too\n\t\t\t\tvar altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,\n\t\t\t\t\tdate = this._getDate(inst),\n\t\t\t\t\tformatCfg = $.datepicker._getFormatConfig(inst),\n\t\t\t\t\taltFormattedDateTime = '', \n\t\t\t\t\taltSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator, \n\t\t\t\t\taltTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,\n\t\t\t\t\taltTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;\n\t\t\t\t\n\t\t\t\taltFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;\n\t\t\t\tif (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {\n\t\t\t\t\tif (tp_inst._defaults.altFormat) {\n\t\t\t\t\t\taltFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
2\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\taltFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$(altField).val(altFormattedDateTime);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$.datepicker._base_updateAlternate(inst);\n\t\t}\n\t};\n\n\t/*\n\t* Override key up event to sync manual input changes.\n\t*/\n\t$.datepicker._base_doKeyUp = $.datepicker._doKeyUp;\n\t$.datepicker._doKeyUp = function (event) {\n\t\tvar inst = $.datepicker._getInst(event.target),\n\t\t\ttp_inst = $.datepicker._get(inst, 'timepicker');\n\n\t\tif (tp_inst) {\n\t\t\tif (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {\n\t\t\t\ttry {\n\t\t\t\t\t$.datepicker._updateDatepicker(inst);\n\t\t\t\t} catch (err) {\n\t\t\t\t\t$.timepicker.log(err);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $.datepicker._base_doKeyUp(event);\n\t};\n\n\t/*\n\t* override \"Today\" button to also grab the time.\n\t*/\n\t$.datepicker._base_gotoToday = $.datepicker._gotoToday;\n\t$.datepicker._gotoToday = function (id) {\n\t\tvar inst = this._getInst($(id)[0]),\n\t\t\t$dp = inst.dpDiv;\n\t\tthis._base_gotoToday(id);\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tselectLocalTimezone(tp_inst);\n\t\tvar now = new Date();\n\t\tthis._setTime(inst, now);\n\t\t$('.ui-datepicker-today', $dp).click();\n\t};\n\n\t/*\n\t* Disable & enable the Time in the datetimepicker\n\t*/\n\t$.datepicker._disableTimepickerDatepicker = function (target) {\n\t\tvar inst = this._getInst(target);\n\t\tif (!inst) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\t$(target).datepicker('getDate'); // Init selected[Year|Month|Day]\n\t\tif (tp_inst) {\n\t\t\tinst.settings.showTimepicker = false;\n\t\t\ttp_inst._defaults.showTimepicker = false;\n\t\t\ttp_inst._updateDateTime(inst);\n\t\t}\n\t};\n\n\t$.datepicker._enableTimepickerDatepicker = function (target) {\n\t\tvar inst = this._getInst(target);\n\t\tif (!inst) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\t$(target).datepicker('getDate'); // Init selected[Year|Month|Day]\n\t\tif (tp_inst) {\n\t\t\tinst.settings.showTimepicker = true;\n\t\t\ttp_inst._defaults.showTimepicker = true;\n\t\t\ttp_inst._addTimePicker(inst); // Could be disabled on page load\n\t\t\ttp_inst._updateDateTime(inst);\n\t\t}\n\t};\n\n\t/*\n\t* Create our own set time function\n\t*/\n\t$.datepicker._setTime = function (inst, date) {\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tif (tp_inst) {\n\t\t\tvar defaults = tp_inst._defaults;\n\n\t\t\t// calling _setTime with no date sets time to defaults\n\t\t\ttp_inst.hour = date ? date.getHours() : defaults.hour;\n\t\t\ttp_inst.minute = date ? date.getMinutes() : defaults.minute;\n\t\t\ttp_inst.second = date ? date.getSeconds() : defaults.second;\n\t\t\ttp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;\n\t\t\ttp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;\n\n\t\t\t//check if within min/max times.. \n\t\t\ttp_inst._limitMinMaxDateTime(inst, true);\n\n\t\t\ttp_inst._onTimeChange();\n\t\t\ttp_inst._updateDateTime(inst);\n\t\t}\n\t};\n\n\t/*\n\t* Create new public method to set only time, callable as $().datepicker('setTime', date)\n\t*/\n\t$.datepicker._setTimeDatepicker = function (target, date, withDate) {\n\t\tvar inst = this._getInst(target);\n\t\tif (!inst) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\n\t\tif (tp_inst) {\n\t\t\tthis._setDateFromField(inst);\n\t\t\tvar tp_date;\n\t\t\tif (date) {\n\t\t\t\tif (typeof date === \"string\") {\n\t\t\t\t\ttp_inst._parseTime(date, withDate);\n\t\t\t\t\ttp_date = new Date();\n\t\t\t\t\ttp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);\n\t\t\t\t\ttp_date.setMicroseconds(tp_inst.microsec);\n\t\t\t\t} else {\n\t\t\t\t\ttp_date = new Date(date.getTime());\n\t\t\t\t\ttp_date.setMicroseconds(date.getMicroseconds());\n\t\t\t\t}\n\t\t\t\tif (tp_date.toString() === 'Invalid Date') {\n\t\t\t\t\ttp_date = undefined;\n\t\t\t\t}\n\t\t\t\tthis._setTime(inst, tp_date);\n\t\t\t}\n\t\t}\n\n\t};\n\n\t/*\n\t* override setDate() to allow setting time too within Date object\n\t*/\n\t$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;\n\t$.datepicker._setDateDatepicker = function (target, date) {\n\t\tvar inst = this._getInst(target);\n\t\tif (!inst) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof(date) === 'string') {\n\t\t\tdate = new Date(date);\n\t\t\tif (!date.getTime()) {\n\t\t\t\t$.timepicker.log(\"Error creating Date object from string.\");\n\t\t\t}\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tvar tp_date;\n\t\tif (date instanceof Date) {\n\t\t\ttp_date = new Date(date.getTime());\n\t\t\ttp_date.setMicroseconds(date.getMicroseconds());\n\t\t} else {\n\t\t\ttp_date = date;\n\t\t}\n\t\t\n\t\t// This is important if you are using the timezone option, javascript's Date \n\t\t// object will only return the timezone offset for the current locale, so we \n\t\t// adjust it accordingly.  If not using timezone option this won't matter..\n\t\t// If a timezone is different in tp, keep the timezone as is\n\t\tif (tp_inst && tp_date) {\n\t\t\t// look out for DST if tz wasn't specified\n\t\t\tif (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {\n\t\t\t\ttp_inst.timezone = tp_date.getTimezoneOffset() * -1;\n\t\t\t}\n\t\t\tdate = $.timepicker.timezoneAdjust(date, tp_inst.timezone);\n\t\t\ttp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);\n\t\t}\n\n\t\tthis._updateDatepicker(inst);\n\t\tthis._base_setDateDatepicker.apply(this, arguments);\n\t\tthis._setTimeDatepicker(target, tp_date, true);\n\t};\n\n\t/*\n\t* override getDate() to allow getting time too within Date object\n\t*/\n\t$.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;\n\t$.datepicker._getDateDatepicker = function (target, noDefault) {\n\t\tvar inst = this._getInst(target);\n\t\tif (!inst) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\n\t\tif (tp_inst) {\n\t\t\t// if it hasn't yet been defined, grab from field\n\t\t\tif (inst.lastVal === undefined) {\n\t\t\t\tthis._setDateFromField(inst, noDefault);\n\t\t\t}\n\n\t\t\tvar date = this._getDate(inst);\n\t\t\tif (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {\n\t\t\t\tdate.setHours(tp_inst.hour, tp_
2inst.minute, tp_inst.second, tp_inst.millisec);\n\t\t\t\tdate.setMicroseconds(tp_inst.microsec);\n\n\t\t\t\t// This is important if you are using the timezone option, javascript's Date \n\t\t\t\t// object will only return the timezone offset for the current locale, so we \n\t\t\t\t// adjust it accordingly.  If not using timezone option this won't matter..\n\t\t\t\tif (tp_inst.timezone != null) {\n\t\t\t\t\t// look out for DST if tz wasn't specified\n\t\t\t\t\tif (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {\n\t\t\t\t\t\ttp_inst.timezone = date.getTimezoneOffset() * -1;\n\t\t\t\t\t}\n\t\t\t\t\tdate = $.timepicker.timezoneAdjust(date, tp_inst.timezone);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn date;\n\t\t}\n\t\treturn this._base_getDateDatepicker(target, noDefault);\n\t};\n\n\t/*\n\t* override parseDate() because UI 1.8.14 throws an error about \"Extra characters\"\n\t* An option in datapicker to ignore extra format characters would be nicer.\n\t*/\n\t$.datepicker._base_parseDate = $.datepicker.parseDate;\n\t$.datepicker.parseDate = function (format, value, settings) {\n\t\tvar date;\n\t\ttry {\n\t\t\tdate = this._base_parseDate(format, value, settings);\n\t\t} catch (err) {\n\t\t\t// Hack!  The error message ends with a colon, a space, and\n\t\t\t// the \"extra\" characters.  We rely on that instead of\n\t\t\t// attempting to perfectly reproduce the parsing algorithm.\n\t\t\tif (err.indexOf(\":\") >= 0) {\n\t\t\t\tdate = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);\n\t\t\t\t$.timepicker.log(\"Error parsing the date string: \" + err + \"\\ndate string = \" + value + \"\\ndate format = \" + format);\n\t\t\t} else {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\treturn date;\n\t};\n\n\t/*\n\t* override formatDate to set date with time to the input\n\t*/\n\t$.datepicker._base_formatDate = $.datepicker._formatDate;\n\t$.datepicker._formatDate = function (inst, day, month, year) {\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tif (tp_inst) {\n\t\t\ttp_inst._updateDateTime(inst);\n\t\t\treturn tp_inst.$input.val();\n\t\t}\n\t\treturn this._base_formatDate(inst);\n\t};\n\n\t/*\n\t* override options setter to add time to maxDate(Time) and minDate(Time). MaxDate\n\t*/\n\t$.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;\n\t$.datepicker._optionDatepicker = function (target, name, value) {\n\t\tvar inst = this._getInst(target),\n\t\t\tname_clone;\n\t\tif (!inst) {\n\t\t\treturn null;\n\t\t}\n\n\t\tvar tp_inst = this._get(inst, 'timepicker');\n\t\tif (tp_inst) {\n\t\t\tvar min = null,\n\t\t\t\tmax = null,\n\t\t\t\tonselect = null,\n\t\t\t\toverrides = tp_inst._defaults.evnts,\n\t\t\t\tfns = {},\n\t\t\t\tprop;\n\t\t\tif (typeof name === 'string') { // if min/max was set with the string\n\t\t\t\tif (name === 'minDate' || name === 'minDateTime') {\n\t\t\t\t\tmin = value;\n\t\t\t\t} else if (name === 'maxDate' || name === 'maxDateTime') {\n\t\t\t\t\tmax = value;\n\t\t\t\t} else if (name === 'onSelect') {\n\t\t\t\t\tonselect = value;\n\t\t\t\t} else if (overrides.hasOwnProperty(name)) {\n\t\t\t\t\tif (typeof (value) === 'undefined') {\n\t\t\t\t\t\treturn overrides[name];\n\t\t\t\t\t}\n\t\t\t\t\tfns[name] = value;\n\t\t\t\t\tname_clone = {}; //empty results in exiting function after overrides updated\n\t\t\t\t}\n\t\t\t} else if (typeof name === 'object') { //if min/max was set with the JSON\n\t\t\t\tif (name.minDate) {\n\t\t\t\t\tmin = name.minDate;\n\t\t\t\t} else if (name.minDateTime) {\n\t\t\t\t\tmin = name.minDateTime;\n\t\t\t\t} else if (name.maxDate) {\n\t\t\t\t\tmax = name.maxDate;\n\t\t\t\t} else if (name.maxDateTime) {\n\t\t\t\t\tmax = name.maxDateTime;\n\t\t\t\t}\n\t\t\t\tfor (prop in overrides) {\n\t\t\t\t\tif (overrides.hasOwnProperty(prop) && name[prop]) {\n\t\t\t\t\t\tfns[prop] = name[prop];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}
2\n\t\t\tfor (prop in fns) {\n\t\t\t\tif (fns.hasOwnProperty(prop)) {\n\t\t\t\t\toverrides[prop] = fns[prop];\n\t\t\t\t\tif (!name_clone) { name_clone = $.extend({}, name); }\n\t\t\t\t\tdelete name_clone[prop];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (name_clone && isEmptyObject(name_clone)) { return; }\n\t\t\tif (min) { //if min was set\n\t\t\t\tif (min === 0) {\n\t\t\t\t\tmin = new Date();\n\t\t\t\t} else {\n\t\t\t\t\tmin = new Date(min);\n\t\t\t\t}\n\t\t\t\ttp_inst._defaults.minDate = min;\n\t\t\t\ttp_inst._defaults.minDateTime = min;\n\t\t\t} else if (max) { //if max was set\n\t\t\t\tif (max === 0) {\n\t\t\t\t\tmax = new Date();\n\t\t\t\t} else {\n\t\t\t\t\tmax = new Date(max);\n\t\t\t\t}\n\t\t\t\ttp_inst._defaults.maxDate = max;\n\t\t\t\ttp_inst._defaults.maxDateTime = max;\n\t\t\t} else if (onselect) {\n\t\t\t\ttp_inst._defaults.onSelect = onselect;\n\t\t\t}\n\t\t}\n\t\tif (value === undefined) {\n\t\t\treturn this._base_optionDatepicker.call($.datepicker, target, name);\n\t\t}\n\t\treturn this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);\n\t};\n\t\n\t/*\n\t* jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,\n\t* it will return false for all objects\n\t*/\n\tvar isEmptyObject = function (obj) {\n\t\tvar prop;\n\t\tfor (prop in obj) {\n\t\t\tif (obj.hasOwnProperty(prop)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t};\n\n\t/*\n\t* jQuery extend now ignores nulls!\n\t*/\n\tvar extendRemove = function (target, props) {\n\t\t$.extend(target, props);\n\t\tfor (var name in props) {\n\t\t\tif (props[name] === null || props[name] === undefined) {\n\t\t\t\ttarget[name] = props[name];\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t};\n\n\t/*\n\t* Determine by the time format which units are supported\n\t* Returns an object of booleans for each unit\n\t*/\n\tvar detectSupport = function (timeFormat) {\n\t\tvar tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals\n\t\t\tisIn = function (f, t) { // does the format contain the token?\n\t\t\t\t\treturn f.indexOf(t) !== -1 ? true : false;\n\t\t\t\t};\n\t\treturn {\n\t\t\t\thour: isIn(tf, 'h'),\n\t\t\t\tminute: isIn(tf, 'm'),\n\t\t\t\tsecond: isIn(tf, 's'),\n\t\t\t\tmillisec: isIn(tf, 'l'),\n\t\t\t\tmicrosec: isIn(tf, 'c'),\n\t\t\t\ttimezone: isIn(tf, 'z'),\n\t\t\t\tampm: isIn(tf, 't') && isIn(timeFormat, 'h'),\n\t\t\t\tiso8601: isIn(timeFormat, 'Z')\n\t\t\t};\n\t};\n\n\t/*\n\t* Converts 24 hour format into 12 hour\n\t* Returns 12 hour without leading 0\n\t*/\n\tvar convert24to12 = function (hour) {\n\t\thour %= 12;\n\n\t\tif (hour === 0) {\n\t\t\thour = 12;\n\t\t}\n\n\t\treturn String(hour);\n\t};\n\n\tvar computeEffectiveSetting = function (settings, property) {\n\t\treturn settings && settings[property] ? settings[property] : $.timepicker._defaults[property];\n\t};\n\n\t/*\n\t* Splits datetime string into date and time substrings.\n\t* Throws exception when date can't be parsed\n\t* Returns {dateString: dateString, timeString: timeStr
2ing}\n\t*/\n\tvar splitDateTime = function (dateTimeString, timeSettings) {\n\t\t// The idea is to get the number separator occurrences in datetime and the time format requested (since time has\n\t\t// fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.\n\t\tvar separator = computeEffectiveSetting(timeSettings, 'separator'),\n\t\t\tformat = computeEffectiveSetting(timeSettings, 'timeFormat'),\n\t\t\ttimeParts = format.split(separator), // how many occurrences of separator may be in our format?\n\t\t\ttimePartsLen = timeParts.length,\n\t\t\tallParts = dateTimeString.split(separator),\n\t\t\tallPartsLen = allParts.length;\n\n\t\tif (allPartsLen > 1) {\n\t\t\treturn {\n\t\t\t\tdateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),\n\t\t\t\ttimeString: allParts.splice(0, timePartsLen).join(separator)\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tdateString: dateTimeString,\n\t\t\ttimeString: ''\n\t\t};\n\t};\n\n\t/*\n\t* Internal function to parse datetime interval\n\t* Returns: {date: Date, timeObj: Object}, where\n\t*   date - parsed date without time (type Date)\n\t*   timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional\n\t*/\n\tvar parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {\n\t\tvar date,\n\t\t\tparts,\n\t\t\tparsedTime;\n\n\t\tparts = splitDateTime(dateTimeString, timeSettings);\n\t\tdate = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);\n\n\t\tif (parts.timeString === '') {\n\t\t\treturn {\n\t\t\t\tdate: date\n\t\t\t};\n\t\t}\n\n\t\tparsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);\n\n\t\tif (!parsedTime) {\n\t\t\tthrow 'Wrong time format';\n\t\t}\n\n\t\treturn {\n\t\t\tdate: date,\n\t\t\ttimeObj: parsedTime\n\t\t};\n\t};\n\n\t/*\n\t* Internal function to set timezone_select to the local timezone\n\t*/\n\tvar selectLocalTimezone = function (tp_inst, date) {\n\t\tif (tp_inst && tp_inst.timezone_select) {\n\t\t\tvar now = date || new Date();\n\t\t\ttp_inst.timezone_select.val(-now.getTimezoneOffset());\n\t\t}\n\t};\n\n\t/*\n\t* Create a Singleton Instance\n\t*/\n\t$.timepicker = new Timepicker();\n\n\t/**\n\t * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)\n\t * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned\n\t * @param {boolean} iso8601 if true formats in accordance to iso8601 \"+12:45\"\n\t * @return {string}\n\t */\n\t$.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {\n\t\tif (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {\n\t\t\treturn tzMinutes;\n\t\t}\n\n\t\tvar off = tzMinutes,\n\t\t\tminutes = off % 60,\n\t\t\thours = (off - minutes) / 60,\n\t\t\tiso = iso8601 ? ':' : '',\n\t\t\ttz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);\n\t\t\n\t\tif (tz === '+00:00') {\n\t\t\treturn 'Z';\n\t\t}\n\t\treturn tz;\n\t};\n\n\t/**\n\t * Get the number in minutes that represents a timezone string\n\t * @param  {string} tzString formatted like \"+0500\", \"-1245\", \"Z\"\n\t * @return {number} the offset minutes or the original string if it doesn't match expectations\n\t */\n\t$.timepicker.timezoneOffsetNumber = function (tzString) {\n\t\tvar normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with \"+1245\"\n\n\t\tif (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (!/^(\\-|\\+)\\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back\n\t\t\treturn tzString;\n\t\t}\n\n\t\treturn ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus\n\t\t\t\t\t((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)\n\t\t\t\t\tparseInt(normalized.substr(3, 2), 10))); // minutes\n\t};\n\n\t/**\n\t * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)\n\t * @param  {Date} date\n\t * @param  {string} toTimezone formatted like \"+0500\", \"-1245\"\n\t * @return {Date}\n\t */\n\t$.timepicker.timezoneAdjust = function (date, toTimezone) {\n\t\tvar toTz = $.timepicker.timezoneOffsetNumber(toTimezone);\n\t\tif (!isNaN(toTz)) {\n\t\t\tdate.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);\n\t\t}\n\t\treturn date;\n\t};\n\n\t/**\n\t * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to\n\t * enforce date range limits.\n\t * n.b. The input value must be correctly formatted (reformatting is not supported)\n\t * @param  {Element} startTime\n\t * @param  {Element} endTime\n\t * @param  {Object} options Options for the timepicker() call\n\t * @return {jQuery}\n\t */\n\t$.timepicker.timeRange = function (startTime, endTime, options) {\n\t\treturn $.timepicker.handleRange('timepicker', startTime, endTime, options);\n\t};\n\n\t/**\n\t * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to\n\t * enforce date range limits.\n\t * @param  {Element} startTime\n\t * @param  {Element} endTime\n\t * @param  {Object} options Options for the `timepicker()` call. Also supports `reformat`,\n\t *   a boolean value that can be used to reformat the input values to the `dateFormat`.\n\t * @param  {string} method Can be used to specify the type of picker to be added\n\t * @return {jQuery}\n\t */\n\t$.timepicker.datetimeRange = function (startTime, endTime, options) {\n\t\t$.timepicker.handleRange('datetimepicker', startTime, endTime, options);\n\t};\n\n\t/**\n\t * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to\n\t * enforce date range limits.\n\t * @param  {Element} startTime\n\t * @param  {Element} endTime\n\t * @param  {Object} options Options for the `timepicker()` call. Also supports `reformat`,\n\t *   a boolean value that can be used to reformat the input values to the `dateFormat`.\n\t * @return {jQuery}\n\t */\n\t$.timepicker.dateRange = function (startTime, endTime, options) {\n\t\t$.timepicker.handleRange('datepicker', startTime, endTime, options);\n\t};\n\n\t/**\n\t * Calls `method` on the `startTime` and `endTime` elements, and configures them to\n\t * enforce date range limits.\n\t * @param  {string} method Can be used to specify the type of picker to be added\n\t * @param  {Element} startTime\n\t * @param  {Element} endTime\n\t * @param  {Object} options Options for the `timepicker()` call. Also supports `reformat`,\n\t *   a boolean value that can be used to reformat the input values to the `dateFormat`.\n\t * @return {jQuery}\n\t */\n\t$.timepicker.handleRange = function (method, startTime, endTime, options) {\n\t\toptions = $.extend({}, {\n\t\t\tminInterval: 0, // min allowed interval in milliseconds\n\t\t\tmaxInterval: 0, // max allowed interval in milliseconds\n\t\t\tstart: {},      // options for start picker\n\t\t\tend: {}         // options for end picker\n\t\t}, options);\n\n\t\tfunction checkDates(changed, other) {\n\t\t\tvar startdt = startTime[method]('getDate'),\n\t\t\t\tenddt = endTime[method]('getDate'),\n\t\t\t\tchangeddt = changed[method]('getDate');\n\n\t\t\tif (startdt !== null) {\n\t\t\t\tvar minDate = new Date(startdt.getTime()),\n\t\t\t\t\tmaxDate = new Date(startdt.getTime());\n\n\t\t\t\tminDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);\n\t\t\t\tmaxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);\n\n\t\t\t\tif (options.minInterval > 0 && minDate > enddt) { // minInterval check\n\t\t\t\t\tendTime[method]('setDate', minDate);\n\t\t\t\t}\n\t\t\t\telse if (options.maxInterval > 0 && maxDate < enddt) { // max interval check\n\t\t\t\t\tendTime[method]('setDate', maxDate);\n\t\t\t\t}\n\t\t\t\telse if (startdt > enddt) {\n\t\t\t\t\tother[method]('setDate', changeddt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction selected(changed, other, option) {\n\t\t\tif (!changed.val()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar date = changed[method].call(changed, 'getDate');\n\t\t\tif (date !== null && options.minInterval > 0) {\n\t\t\t\tif (option === 'minDate') {\n\t\t\t\t\tdate.setMilliseconds(date.getMilliseconds() + options.minInterval);\n\t\t\t\t}\n\t\t\t\tif (option === 'maxDate') {\n\t\t\t\t\tdate.setMilliseconds(date.getMilliseconds() - options.minInterval);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (date.getTime) {\n\t\t\t\tother[method].call(other, 'option', option, date);\n\t\t\t}\n\t\t}\n\n\t\t$.fn[method].call(startTime, $.extend({\n\t\t\tonClose: function (dateText, inst) {\n\t\t\t\tcheckDates($(this), endTime);\n\t\t\t},\n\t\t\tonSelect: function (selectedDateTime) {\n\t\t\t\tselected($(this), endTime, 'minDate');\n\t\t\t}\n\t\t}, options, options.start));\n\t\t$.fn[method].call(endTime, $.extend({\n\t\t\tonClose: function (dateText, inst) {\n\t\t\t\tcheckDates($(this), startTime);\n\t\t\t},\n\t\t\tonSelect: function (selectedDateTime) {\n\t\t\t\tselected($(this), startTime, 'maxDate');\n\t\t\t}\n\t\t}, options, options.end));\n\n\t\tcheckDates(startTime, endTime);\n\t\tselected(startTime, endTime, 'minDate');\n\t\tselected(endTime, startTime, 'maxDate');\n\t\treturn $([startTime.get(0), endTime.get(0)]);\n\t};\n\n\t/**\n\t * Log error or data to the console during error or debugging\n\t * @param  {Object} err pass any type object to log to the console during error or debugging\n\t * @return {void}\n\t */\n\t$.timepicker.log = function (err) {\n\t\tif (window.console) {\n\t\t\twindow.console.log(err);\n\t\t}\n\t};\n\n\t/*\n\t * Add util object to allow access to private methods for testability.\n\t */\n\t$.timepicker._util = {\n\t\t_extendRemove: extendRemove,\n\t\t_isEmptyObject: isEmptyObject,\n\t\t_convert24to12: convert24to12,\n\t\t_detectSupport: detectSupport,\n\t\t_selectLocalTimezone: selectLocalTimezone,\n\t\t_computeEffectiveSetting: computeEffectiveSetting,\n\t\t_splitDateTime: splitDateTime,\n\t\t_parseDateTimeInternal: parseDateTimeInternal\n\t};\n\n\t/*\n\t* Microsecond support\n\t*/\n\tif (!Date.prototype.getMicroseconds) {\n\t\tDate.prototype.microseconds = 0;\n\t\tDate.prototype.getMicroseconds = function () { return this.microseconds; };\n\t\tDate.prototype.setMicroseconds = function (m) {\n\t\t\tthis.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));\n\t\t\tthis.microseconds = m % 1000;\n\t\t\treturn this;\n\t\t};\n\t}\n\n\t/*\n\t* Keep up with the version\n\t*/\n\t$.timepicker.version = \"1.4.3\";\n\n}));"}
3}});

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.