27086 lines
1.4 MiB
27086 lines
1.4 MiB
/*
|
||
Copyright (C) Federico Zivolo 2017
|
||
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
||
*/(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=window.getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetParent,i=o&&o.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(o.nodeName)&&'static'===t(o,'position')?r(o):o:window.document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,a=document.createRange();a.setStart(i,0),a.setEnd(n,0);var f=a.commonAncestorContainer;if(e!==f&&t!==f||i.contains(n))return p(f)?f:r(f);var l=s(e);return l.host?d(l.host,t):d(e,s(t).host)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',i=e.nodeName;if('BODY'===i||'HTML'===i){var n=window.document.documentElement,r=window.document.scrollingElement||n;return r[o]}return e[o]}function f(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=a(t,'top'),n=a(t,'left'),r=o?-1:1;return e.top+=i*r,e.bottom+=i*r,e.left+=n*r,e.right+=n*r,e}function l(e,t){var o='x'===t?'Left':'Top',i='Left'==o?'Right':'Bottom';return+e['border'+o+'Width'].split('px')[0]+ +e['border'+i+'Width'].split('px')[0]}function m(e,t,o,i){return _(t['offset'+e],o['client'+e],o['offset'+e],ie()?o['offset'+e]+i['margin'+('Height'===e?'Top':'Left')]+i['margin'+('Height'===e?'Bottom':'Right')]:0)}function h(){var e=window.document.body,t=window.document.documentElement,o=ie()&&window.getComputedStyle(t);return{height:m('Height',e,t,o),width:m('Width',e,t,o)}}function c(e){return se({},e,{right:e.left+e.width,bottom:e.top+e.height})}function g(e){var o={};if(ie())try{o=e.getBoundingClientRect();var i=a(e,'top'),n=a(e,'left');o.top+=i,o.left+=n,o.bottom+=i,o.right+=n}catch(e){}else o=e.getBoundingClientRect();var r={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},p='HTML'===e.nodeName?h():{},s=p.width||e.clientWidth||r.right-r.left,d=p.height||e.clientHeight||r.bottom-r.top,f=e.offsetWidth-s,m=e.offsetHeight-d;if(f||m){var g=t(e);f-=l(g,'x'),m-=l(g,'y'),r.width-=f,r.height-=m}return c(r)}function u(e,o){var i=ie(),r='HTML'===o.nodeName,p=g(e),s=g(o),d=n(e),a=t(o),l=+a.borderTopWidth.split('px')[0],m=+a.borderLeftWidth.split('px')[0],h=c({top:p.top-s.top-l,left:p.left-s.left-m,width:p.width,height:p.height});if(h.marginTop=0,h.marginLeft=0,!i&&r){var u=+a.marginTop.split('px')[0],b=+a.marginLeft.split('px')[0];h.top-=l-u,h.bottom-=l-u,h.left-=m-b,h.right-=m-b,h.marginTop=u,h.marginLeft=b}return(i?o.contains(d):o===d&&'BODY'!==d.nodeName)&&(h=f(h,o)),h}function b(e){var t=window.document.documentElement,o=u(e,t),i=_(t.clientWidth,window.innerWidth||0),n=_(t.clientHeight,window.innerHeight||0),r=a(t),p=a(t,'left'),s={top:r-o.top+o.marginTop,left:p-o.left+o.marginLeft,width:i,height:n};return c(s)}function y(e){var i=e.nodeName;return'BODY'===i||'HTML'===i?!1:'fixed'===t(e,'position')||y(o(e))}function w(e,t,i,r){var p={top:0,left:0},s=d(e,t);if('viewport'===r)p=b(s);else{var a;'scrollParent'===r?(a=n(o(e)),'BODY'===a.nodeName&&(a=window.document.documentElement)):'window'===r?a=window.document.documentElement:a=r;var f=u(a,s);if('HTML'===a.nodeName&&!y(s)){var l=h(),m=l.height,c=l.width;p.top+=f.top-f.marginTop,p.bottom=m+f.top,p.left+=f.left-f.marginLeft,p.right=c+f.left}else p=f}return p.left+=i,p.top+=i,p.right-=i,p.bottom-=i,p}function v(e){var t=e.width,o=e.height;return t*o}function E(e,t,o,i,n){var r=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var p=w(o,i,r,n),s={top:{width:p.width,height:t.top-p.top},right:{width:p.right-t.right,height:p.height},bottom:{width:p.width,height:p.bottom-t.bottom},left:{width:t.left-p.left,height:p.height}},d=Object.keys(s).map(function(e){return se({key:e},s[e],{area:v(s[e])})}).sort(function(e,t){return t.area-e.area}),a=d.filter(function(e){var t=e.width,i=e.height;return t>=o.clientWidth&&i>=o.clientHeight}),f=0<a.length?a[0].key:d[0].key,l=e.split('-')[1];return f+(l?'-'+l:'')}function x(e,t,o){var i=d(t,o);return u(o,i)}function O(e){var t=window.getComputedStyle(e),o=parseFloat(t.marginTop)+parseFloat(t.marginBottom),i=parseFloat(t.marginLeft)+parseFloat(t.marginRight),n={width:e.offsetWidth+i,height:e.offsetHeight+o};return n}function L(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function S(e,t,o){o=o.split('-')[0];var i=O(e),n={width:i.width,height:i.height},r=-1!==['right','left'].indexOf(o),p=r?'top':'left',s=r?'left':'top',d=r?'height':'width',a=r?'width':'height';return n[p]=t[p]+t[d]/2-i[d]/2,n[s]=o===s?t[s]-i[a]:t[L(s)],n}function T(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function C(e,t,o){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===o});var i=T(e,function(e){return e[t]===o});return e.indexOf(i)}function N(t,o,i){var n=void 0===i?t:t.slice(0,C(t,'name',i));return n.forEach(function(t){t.function&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var i=t.function||t.fn;t.enabled&&e(i)&&(o.offsets.popper=c(o.offsets.popper),o.offsets.reference=c(o.offsets.reference),o=i(o,t))}),o}function k(){if(!this.state.isDestroyed){var e={instance:this,styles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=x(this.state,this.popper,this.reference),e.placement=E(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=S(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position='absolute',e=N(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function W(e,t){return e.some(function(e){var o=e.name,i=e.enabled;return i&&o===t})}function B(e){for(var t=[!1,'ms','Webkit','Moz','O'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length-1;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof window.document.body.style[r])return r}return null}function D(){return this.state.isDestroyed=!0,W(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[B('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function H(e,t,o,i){var r='BODY'===e.nodeName,p=r?window:e;p.addEventListener(t,o,{passive:!0}),r||H(n(p.parentNode),t,o,i),i.push(p)}function P(e,t,o,i){o.updateBound=i,window.addEventListener('resize',o.updateBound,{passive:!0});var r=n(e);return H(r,'scroll',o.updateBound,o.scrollParents),o.scrollElement=r,o.eventsEnabled=!0,o}function A(){this.state.eventsEnabled||(this.state=P(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return window.removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function I(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function R(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function U(e,t){Object.keys(t).forEach(function(o){var i='';-1!==['width','height','top','right','bottom','left'].indexOf(o)&&R(t[o])&&(i='px'),e.style[o]=t[o]+i})}function Y(e,t){Object.keys(t).forEach(function(o){var i=t[o];!1===i?e.removeAttribute(o):e.setAttribute(o,t[o])})}function F(e,t,o){var i=T(e,function(e){var o=e.name;return o===t}),n=!!i&&e.some(function(e){return e.name===o&&e.enabled&&e.order<i.order});if(!n){var r='`'+t+'`';console.warn('`'+o+'`'+' modifier is required by '+r+' modifier in order to work, be sure to include it before '+r+'!')}return n}function j(e){return'end'===e?'start':'start'===e?'end':e}function K(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=ae.indexOf(e),i=ae.slice(o+1).concat(ae.slice(0,o));return t?i.reverse():i}function q(e,t,o,i){var n=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+n[1],p=n[2];if(!r)return e;if(0===p.indexOf('%')){var s;switch(p){case'%p':s=o;break;case'%':case'%r':default:s=i;}var d=c(s);return d[t]/100*r}if('vh'===p||'vw'===p){var a;return a='vh'===p?_(document.documentElement.clientHeight,window.innerHeight||0):_(document.documentElement.clientWidth,window.innerWidth||0),a/100*r}return r}function G(e,t,o,i){var n=[0,0],r=-1!==['right','left'].indexOf(i),p=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=p.indexOf(T(p,function(e){return-1!==e.search(/,|\s/)}));p[s]&&-1===p[s].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var d=/\s*,\s*|\s+/,a=-1===s?[p]:[p.slice(0,s).concat([p[s].split(d)[0]]),[p[s].split(d)[1]].concat(p.slice(s+1))];return a=a.map(function(e,i){var n=(1===i?!r:r)?'height':'width',p=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,p=!0,e):p?(e[e.length-1]+=t,p=!1,e):e.concat(t)},[]).map(function(e){return q(e,n,t,o)})}),a.forEach(function(e,t){e.forEach(function(o,i){R(o)&&(n[t]+=o*('-'===e[i-1]?-1:1))})}),n}for(var z=Math.min,V=Math.floor,_=Math.max,X=['native code','[object MutationObserverConstructor]'],Q=function(e){return X.some(function(t){return-1<(e||'').toString().indexOf(t)})},J='undefined'!=typeof window,Z=['Edge','Trident','Firefox'],$=0,ee=0;ee<Z.length;ee+=1)if(J&&0<=navigator.userAgent.indexOf(Z[ee])){$=1;break}var i,te=J&&Q(window.MutationObserver),oe=te?function(e){var t=!1,o=0,i=document.createElement('span'),n=new MutationObserver(function(){e(),t=!1});return n.observe(i,{attributes:!0}),function(){t||(t=!0,i.setAttribute('x-index',o),++o)}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},$))}},ie=function(){return void 0==i&&(i=-1!==navigator.appVersion.indexOf('MSIE 10')),i},ne=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},re=function(){function e(e,t){for(var o,n=0;n<t.length;n++)o=t[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),pe=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},se=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var i in t=arguments[o],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},de=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],ae=de.slice(3),fe={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},le=function(){function t(o,i){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};ne(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=oe(this.update.bind(this)),this.options=se({},t.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=o.jquery?o[0]:o,this.popper=i.jquery?i[0]:i,this.options.modifiers={},Object.keys(se({},t.Defaults.modifiers,r.modifiers)).forEach(function(e){n.options.modifiers[e]=se({},t.Defaults.modifiers[e]||{},r.modifiers?r.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return se({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(n.reference,n.popper,n.options,t,n.state)}),this.update();var p=this.options.eventsEnabled;p&&this.enableEventListeners(),this.state.eventsEnabled=p}return re(t,[{key:'update',value:function(){return k.call(this)}},{key:'destroy',value:function(){return D.call(this)}},{key:'enableEventListeners',value:function(){return A.call(this)}},{key:'disableEventListeners',value:function(){return I.call(this)}}]),t}();return le.Utils=('undefined'==typeof window?global:window).PopperUtils,le.placements=de,le.Defaults={placement:'bottom',eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,o=t.split('-')[0],i=t.split('-')[1];if(i){var n=e.offsets,r=n.reference,p=n.popper,s=-1!==['bottom','top'].indexOf(o),d=s?'left':'top',a=s?'width':'height',f={start:pe({},d,r[d]),end:pe({},d,r[d]+r[a]-p[a])};e.offsets.popper=se({},p,f[i])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var o,i=t.offset,n=e.placement,r=e.offsets,p=r.popper,s=r.reference,d=n.split('-')[0];return o=R(+i)?[+i,0]:G(i,p,s,d),'left'===d?(p.top+=o[0],p.left-=o[1]):'right'===d?(p.top+=o[0],p.left+=o[1]):'top'===d?(p.left+=o[0],p.top-=o[1]):'bottom'===d&&(p.left+=o[0],p.top+=o[1]),e.popper=p,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var o=t.boundariesElement||r(e.instance.popper);e.instance.reference===o&&(o=r(o));var i=w(e.instance.popper,e.instance.reference,t.padding,o);t.boundaries=i;var n=t.priority,p=e.offsets.popper,s={primary:function(e){var o=p[e];return p[e]<i[e]&&!t.escapeWithReference&&(o=_(p[e],i[e])),pe({},e,o)},secondary:function(e){var o='right'===e?'left':'top',n=p[o];return p[e]>i[e]&&!t.escapeWithReference&&(n=z(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=V,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]<r(i[d])&&(e.offsets.popper[d]=r(i[d])-o[a]),o[d]>r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){if(!F(e.instance.modifiers,'arrow','keepTogether'))return e;var o=t.element;if('string'==typeof o){if(o=e.instance.popper.querySelector(o),!o)return e;}else if(!e.instance.popper.contains(o))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var i=e.placement.split('-')[0],n=e.offsets,r=n.popper,p=n.reference,s=-1!==['left','right'].indexOf(i),d=s?'height':'width',a=s?'top':'left',f=s?'left':'top',l=s?'bottom':'right',m=O(o)[d];p[l]-m<r[a]&&(e.offsets.popper[a]-=r[a]-(p[l]-m)),p[a]+m>r[l]&&(e.offsets.popper[a]+=p[a]+m-r[l]);var h=p[a]+p[d]/2-m/2,g=h-c(e.offsets.popper)[a];return g=_(z(r[d]-m,g),0),e.arrowElement=o,e.offsets.arrow={},e.offsets.arrow[a]=Math.round(g),e.offsets.arrow[f]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),i=e.placement.split('-')[0],n=L(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.FLIP:p=[i,n];break;case fe.CLOCKWISE:p=K(i);break;case fe.COUNTERCLOCKWISE:p=K(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=L(i);var a=e.offsets.popper,f=e.offsets.reference,l=V,m='left'===i&&l(a.right)>l(f.left)||'right'===i&&l(a.left)<l(f.right)||'top'===i&&l(a.bottom)>l(f.top)||'bottom'===i&&l(a.top)<l(f.bottom),h=l(a.left)<l(o.left),c=l(a.right)>l(o.right),g=l(a.top)<l(o.top),u=l(a.bottom)>l(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexOf(i),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,S(e.instance.popper,e.offsets.reference,e.placement)),e=N(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[t]-(s?n[p?'width':'height']:0),e.placement=L(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!F(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=T(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<o.top||t.left>o.right||t.top>o.bottom||t.right<o.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var o=t.x,i=t.y,n=e.offsets.popper,p=T(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==p&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var s,d,a=void 0===p?t.gpuAcceleration:p,f=r(e.instance.popper),l=g(f),m={position:n.position},h={left:V(n.left),top:V(n.top),bottom:V(n.bottom),right:V(n.right)},c='bottom'===o?'top':'bottom',u='right'===i?'left':'right',b=B('transform');if(d='bottom'==c?-l.height+h.bottom:h.top,s='right'==u?-l.width+h.right:h.left,a&&b)m[b]='translate3d('+s+'px, '+d+'px, 0)',m[c]=0,m[u]=0,m.willChange='transform';else{var y='bottom'==c?-1:1,w='right'==u?-1:1;m[c]=d*y,m[u]=s*w,m.willChange=c+', '+u}var v={"x-placement":e.placement};return e.attributes=se({},v,e.attributes),e.styles=se({},m,e.styles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return U(e.instance.popper,e.styles),Y(e.instance.popper,e.attributes),e.offsets.arrow&&U(e.arrowElement,e.offsets.arrow),e},onLoad:function(e,t,o,i,n){var r=x(n,t,e),p=E(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('x-placement',p),U(t,{position:'absolute'}),o},gpuAcceleration:void 0}}},le});
|
||
//# sourceMappingURL=popper.min.js.map
|
||
|
||
/*!
|
||
* Bootstrap v4.3.1 (https://getbootstrap.com/)
|
||
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
*/
|
||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(o){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},e=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.forEach(function(t){var e,n,i;e=o,i=r[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return o}g=g&&g.hasOwnProperty("default")?g.default:g,u=u&&u.hasOwnProperty("default")?u.default:u;var e="transitionend";function n(t){var e=this,n=!1;return g(this).one(_.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||_.triggerTransitionEnd(e)},t),this}var _={TRANSITION_END:"bsTransitionEnd",getUID:function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():""}try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=g(t).css("transition-duration"),n=g(t).css("transition-delay"),i=parseFloat(e),o=parseFloat(n);return i||o?(e=e.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(e)+parseFloat(n))):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){g(t).trigger(e)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=e[i],s=r&&_.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(t){if(!document.documentElement.attachShadow)return null;if("function"!=typeof t.getRootNode)return t instanceof ShadowRoot?t:t.parentNode?_.findShadowRoot(t.parentNode):null;var e=t.getRootNode();return e instanceof ShadowRoot?e:null}};g.fn.emulateTransitionEnd=n,g.event.special[_.TRANSITION_END]={bindType:e,delegateType:e,handle:function(t){if(g(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var o="alert",r="bs.alert",a="."+r,c=g.fn[o],h={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",d="fade",m="show",p=function(){function i(t){this._element=t}var t=i.prototype;return t.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},t.dispose=function(){g.removeData(this._element,r),this._element=null},t._getRootElement=function(t){var e=_.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=g(t).closest("."+f)[0]),n},t._triggerCloseEvent=function(t){var e=g.Event(h.CLOSE);return g(t).trigger(e),e},t._removeElement=function(e){var n=this;if(g(e).removeClass(m),g(e).hasClass(d)){var t=_.getTransitionDurationFromElement(e);g(e).one(_.TRANSITION_END,function(t){return n._destroyElement(e,t)}).emulateTransitionEnd(t)}else this._destroyElement(e)},t._destroyElement=function(t){g(t).detach().trigger(h.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(r);e||(e=new i(this),t.data(r,e)),"close"===n&&e[n](this)})},i._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),i}();g(document).on(h.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),g.fn[o]=p._jQueryInterface,g.fn[o].Constructor=p,g.fn[o].noConflict=function(){return g.fn[o]=c,p._jQueryInterface};var v="button",y="bs.button",E="."+y,C=".data-api",T=g.fn[v],S="active",b="btn",I="focus",D='[data-toggle^="button"]',w='[data-toggle="buttons"]',A='input:not([type="hidden"])',N=".active",O=".btn",k={CLICK_DATA_API:"click"+E+C,FOCUS_BLUR_DATA_API:"focus"+E+C+" blur"+E+C},P=function(){function n(t){this._element=t}var t=n.prototype;return t.toggle=function(){var t=!0,e=!0,n=g(this._element).closest(w)[0];if(n){var i=this._element.querySelector(A);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(S))t=!1;else{var o=n.querySelector(N);o&&g(o).removeClass(S)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!this._element.classList.contains(S),g(i).trigger("change")}i.focus(),e=!1}}e&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(S)),t&&g(this._element).toggleClass(S)},t.dispose=function(){g.removeData(this._element,y),this._element=null},n._jQueryInterface=function(e){return this.each(function(){var t=g(this).data(y);t||(t=new n(this),g(this).data(y,t)),"toggle"===e&&t[e]()})},s(n,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),n}();g(document).on(k.CLICK_DATA_API,D,function(t){t.preventDefault();var e=t.target;g(e).hasClass(b)||(e=g(e).closest(O)),P._jQueryInterface.call(g(e),"toggle")}).on(k.FOCUS_BLUR_DATA_API,D,function(t){var e=g(t.target).closest(O)[0];g(e).toggleClass(I,/^focus(in)?$/.test(t.type))}),g.fn[v]=P._jQueryInterface,g.fn[v].Constructor=P,g.fn[v].noConflict=function(){return g.fn[v]=T,P._jQueryInterface};var L="carousel",j="bs.carousel",H="."+j,R=".data-api",x=g.fn[L],F={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},U={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},W="next",q="prev",M="left",K="right",Q={SLIDE:"slide"+H,SLID:"slid"+H,KEYDOWN:"keydown"+H,MOUSEENTER:"mouseenter"+H,MOUSELEAVE:"mouseleave"+H,TOUCHSTART:"touchstart"+H,TOUCHMOVE:"touchmove"+H,TOUCHEND:"touchend"+H,POINTERDOWN:"pointerdown"+H,POINTERUP:"pointerup"+H,DRAG_START:"dragstart"+H,LOAD_DATA_API:"load"+H+R,CLICK_DATA_API:"click"+H+R},B="carousel",V="active",Y="slide",z="carousel-item-right",X="carousel-item-left",$="carousel-item-next",G="carousel-item-prev",J="pointer-event",Z=".active",tt=".active.carousel-item",et=".carousel-item",nt=".carousel-item img",it=".carousel-item-next, .carousel-item-prev",ot=".carousel-indicators",rt="[data-slide], [data-slide-to]",st='[data-ride="carousel"]',at={TOUCH:"touch",PEN:"pen"},lt=function(){function r(t,e){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._element=t,this._indicatorsElement=this._element.querySelector(ot),this._touchSupported="ontouchstart"in document.documentElement||0<navigator.maxTouchPoints,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var t=r.prototype;return t.next=function(){this._isSliding||this._slide(W)},t.nextWhenVisible=function(){!document.hidden&&g(this._element).is(":visible")&&"hidden"!==g(this._element).css("visibility")&&this.next()},t.prev=function(){this._isSliding||this._slide(q)},t.pause=function(t){t||(this._isPaused=!0),this._element.querySelector(it)&&(_.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},t.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},t.to=function(t){var e=this;this._activeElement=this._element.querySelector(tt);var n=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)g(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=n<t?W:q;this._slide(i,this._items[t])}},t.dispose=function(){g(this._element).off(H),g.removeData(this._element,j),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},t._getConfig=function(t){return t=l({},F,t),_.typeCheckConfig(L,t,U),t},t._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;0<e&&this.prev(),e<0&&this.next()}},t._addEventListeners=function(){var e=this;this._config.keyboard&&g(this._element).on(Q.KEYDOWN,function(t){return e._keydown(t)}),"hover"===this._config.pause&&g(this._element).on(Q.MOUSEENTER,function(t){return e.pause(t)}).on(Q.MOUSELEAVE,function(t){return e.cycle(t)}),this._config.touch&&this._addTouchEventListeners()},t._addTouchEventListeners=function(){var n=this;if(this._touchSupported){var e=function(t){n._pointerEvent&&at[t.originalEvent.pointerType.toUpperCase()]?n.touchStartX=t.originalEvent.clientX:n._pointerEvent||(n.touchStartX=t.originalEvent.touches[0].clientX)},i=function(t){n._pointerEvent&&at[t.originalEvent.pointerType.toUpperCase()]&&(n.touchDeltaX=t.originalEvent.clientX-n.touchStartX),n._handleSwipe(),"hover"===n._config.pause&&(n.pause(),n.touchTimeout&&clearTimeout(n.touchTimeout),n.touchTimeout=setTimeout(function(t){return n.cycle(t)},500+n._config.interval))};g(this._element.querySelectorAll(nt)).on(Q.DRAG_START,function(t){return t.preventDefault()}),this._pointerEvent?(g(this._element).on(Q.POINTERDOWN,function(t){return e(t)}),g(this._element).on(Q.POINTERUP,function(t){return i(t)}),this._element.classList.add(J)):(g(this._element).on(Q.TOUCHSTART,function(t){return e(t)}),g(this._element).on(Q.TOUCHMOVE,function(t){var e;(e=t).originalEvent.touches&&1<e.originalEvent.touches.length?n.touchDeltaX=0:n.touchDeltaX=e.originalEvent.touches[0].clientX-n.touchStartX}),g(this._element).on(Q.TOUCHEND,function(t){return i(t)}))}},t._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},t._getItemIndex=function(t){return this._items=t&&t.parentNode?[].slice.call(t.parentNode.querySelectorAll(et)):[],this._items.indexOf(t)},t._getItemByDirection=function(t,e){var n=t===W,i=t===q,o=this._getItemIndex(e),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return e;var s=(o+(t===q?-1:1))%this._items.length;return-1===s?this._items[this._items.length-1]:this._items[s]},t._triggerSlideEvent=function(t,e){var n=this._getItemIndex(t),i=this._getItemIndex(this._element.querySelector(tt)),o=g.Event(Q.SLIDE,{relatedTarget:t,direction:e,from:i,to:n});return g(this._element).trigger(o),o},t._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var e=[].slice.call(this._indicatorsElement.querySelectorAll(Z));g(e).removeClass(V);var n=this._indicatorsElement.children[this._getItemIndex(t)];n&&g(n).addClass(V)}},t._slide=function(t,e){var n,i,o,r=this,s=this._element.querySelector(tt),a=this._getItemIndex(s),l=e||s&&this._getItemByDirection(t,s),c=this._getItemIndex(l),h=Boolean(this._interval);if(o=t===W?(n=X,i=$,M):(n=z,i=G,K),l&&g(l).hasClass(V))this._isSliding=!1;else if(!this._triggerSlideEvent(l,o).isDefaultPrevented()&&s&&l){this._isSliding=!0,h&&this.pause(),this._setActiveIndicatorElement(l);var u=g.Event(Q.SLID,{relatedTarget:l,direction:o,from:a,to:c});if(g(this._element).hasClass(Y)){g(l).addClass(i),_.reflow(l),g(s).addClass(n),g(l).addClass(n);var f=parseInt(l.getAttribute("data-interval"),10);this._config.interval=f?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,f):this._config.defaultInterval||this._config.interval;var d=_.getTransitionDurationFromElement(s);g(s).one(_.TRANSITION_END,function(){g(l).removeClass(n+" "+i).addClass(V),g(s).removeClass(V+" "+i+" "+n),r._isSliding=!1,setTimeout(function(){return g(r._element).trigger(u)},0)}).emulateTransitionEnd(d)}else g(s).removeClass(V),g(l).addClass(V),this._isSliding=!1,g(this._element).trigger(u);h&&this.cycle()}},r._jQueryInterface=function(i){return this.each(function(){var t=g(this).data(j),e=l({},F,g(this).data());"object"==typeof i&&(e=l({},e,i));var n="string"==typeof i?i:e.slide;if(t||(t=new r(this,e),g(this).data(j,t)),"number"==typeof i)t.to(i);else if("string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}else e.interval&&e.ride&&(t.pause(),t.cycle())})},r._dataApiClickHandler=function(t){var e=_.getSelectorFromElement(this);if(e){var n=g(e)[0];if(n&&g(n).hasClass(B)){var i=l({},g(n).data(),g(this).data()),o=this.getAttribute("data-slide-to");o&&(i.interval=!1),r._jQueryInterface.call(g(n),i),o&&g(n).data(j).to(o),t.preventDefault()}}},s(r,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return F}}]),r}();g(document).on(Q.CLICK_DATA_API,rt,lt._dataApiClickHandler),g(window).on(Q.LOAD_DATA_API,function(){for(var t=[].slice.call(document.querySelectorAll(st)),e=0,n=t.length;e<n;e++){var i=g(t[e]);lt._jQueryInterface.call(i,i.data())}}),g.fn[L]=lt._jQueryInterface,g.fn[L].Constructor=lt,g.fn[L].noConflict=function(){return g.fn[L]=x,lt._jQueryInterface};var ct="collapse",ht="bs.collapse",ut="."+ht,ft=g.fn[ct],dt={toggle:!0,parent:""},gt={toggle:"boolean",parent:"(string|element)"},_t={SHOW:"show"+ut,SHOWN:"shown"+ut,HIDE:"hide"+ut,HIDDEN:"hidden"+ut,CLICK_DATA_API:"click"+ut+".data-api"},mt="show",pt="collapse",vt="collapsing",yt="collapsed",Et="width",Ct="height",Tt=".show, .collapsing",St='[data-toggle="collapse"]',bt=function(){function a(e,t){this._isTransitioning=!1,this._element=e,this._config=this._getConfig(t),this._triggerArray=[].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'));for(var n=[].slice.call(document.querySelectorAll(St)),i=0,o=n.length;i<o;i++){var r=n[i],s=_.getSelectorFromElement(r),a=[].slice.call(document.querySelectorAll(s)).filter(function(t){return t===e});null!==s&&0<a.length&&(this._selector=s,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var t=a.prototype;return t.toggle=function(){g(this._element).hasClass(mt)?this.hide():this.show()},t.show=function(){var t,e,n=this;if(!this._isTransitioning&&!g(this._element).hasClass(mt)&&(this._parent&&0===(t=[].slice.call(this._parent.querySelectorAll(Tt)).filter(function(t){return"string"==typeof n._config.parent?t.getAttribute("data-parent")===n._config.parent:t.classList.contains(pt)})).length&&(t=null),!(t&&(e=g(t).not(this._selector).data(ht))&&e._isTransitioning))){var i=g.Event(_t.SHOW);if(g(this._element).trigger(i),!i.isDefaultPrevented()){t&&(a._jQueryInterface.call(g(t).not(this._selector),"hide"),e||g(t).data(ht,null));var o=this._getDimension();g(this._element).removeClass(pt).addClass(vt),this._element.style[o]=0,this._triggerArray.length&&g(this._triggerArray).removeClass(yt).attr("aria-expanded",!0),this.setTransitioning(!0);var r="scroll"+(o[0].toUpperCase()+o.slice(1)),s=_.getTransitionDurationFromElement(this._element);g(this._element).one(_.TRANSITION_END,function(){g(n._element).removeClass(vt).addClass(pt).addClass(mt),n._element.style[o]="",n.setTransitioning(!1),g(n._element).trigger(_t.SHOWN)}).emulateTransitionEnd(s),this._element.style[o]=this._element[r]+"px"}}},t.hide=function(){var t=this;if(!this._isTransitioning&&g(this._element).hasClass(mt)){var e=g.Event(_t.HIDE);if(g(this._element).trigger(e),!e.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",_.reflow(this._element),g(this._element).addClass(vt).removeClass(pt).removeClass(mt);var i=this._triggerArray.length;if(0<i)for(var o=0;o<i;o++){var r=this._triggerArray[o],s=_.getSelectorFromElement(r);if(null!==s)g([].slice.call(document.querySelectorAll(s))).hasClass(mt)||g(r).addClass(yt).attr("aria-expanded",!1)}this.setTransitioning(!0);this._element.style[n]="";var a=_.getTransitionDurationFromElement(this._element);g(this._element).one(_.TRANSITION_END,function(){t.setTransitioning(!1),g(t._element).removeClass(vt).addClass(pt).trigger(_t.HIDDEN)}).emulateTransitionEnd(a)}}},t.setTransitioning=function(t){this._isTransitioning=t},t.dispose=function(){g.removeData(this._element,ht),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},t._getConfig=function(t){return(t=l({},dt,t)).toggle=Boolean(t.toggle),_.typeCheckConfig(ct,t,gt),t},t._getDimension=function(){return g(this._element).hasClass(Et)?Et:Ct},t._getParent=function(){var t,n=this;_.isElement(this._config.parent)?(t=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(t=this._config.parent[0])):t=document.querySelector(this._config.parent);var e='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',i=[].slice.call(t.querySelectorAll(e));return g(i).each(function(t,e){n._addAriaAndCollapsedClass(a._getTargetFromElement(e),[e])}),t},t._addAriaAndCollapsedClass=function(t,e){var n=g(t).hasClass(mt);e.length&&g(e).toggleClass(yt,!n).attr("aria-expanded",n)},a._getTargetFromElement=function(t){var e=_.getSelectorFromElement(t);return e?document.querySelector(e):null},a._jQueryInterface=function(i){return this.each(function(){var t=g(this),e=t.data(ht),n=l({},dt,t.data(),"object"==typeof i&&i?i:{});if(!e&&n.toggle&&/show|hide/.test(i)&&(n.toggle=!1),e||(e=new a(this,n),t.data(ht,e)),"string"==typeof i){if("undefined"==typeof e[i])throw new TypeError('No method named "'+i+'"');e[i]()}})},s(a,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return dt}}]),a}();g(document).on(_t.CLICK_DATA_API,St,function(t){"A"===t.currentTarget.tagName&&t.preventDefault();var n=g(this),e=_.getSelectorFromElement(this),i=[].slice.call(document.querySelectorAll(e));g(i).each(function(){var t=g(this),e=t.data(ht)?"toggle":n.data();bt._jQueryInterface.call(t,e)})}),g.fn[ct]=bt._jQueryInterface,g.fn[ct].Constructor=bt,g.fn[ct].noConflict=function(){return g.fn[ct]=ft,bt._jQueryInterface};var It="dropdown",Dt="bs.dropdown",wt="."+Dt,At=".data-api",Nt=g.fn[It],Ot=new RegExp("38|40|27"),kt={HIDE:"hide"+wt,HIDDEN:"hidden"+wt,SHOW:"show"+wt,SHOWN:"shown"+wt,CLICK:"click"+wt,CLICK_DATA_API:"click"+wt+At,KEYDOWN_DATA_API:"keydown"+wt+At,KEYUP_DATA_API:"keyup"+wt+At},Pt="disabled",Lt="show",jt="dropup",Ht="dropright",Rt="dropleft",xt="dropdown-menu-right",Ft="position-static",Ut='[data-toggle="dropdown"]',Wt=".dropdown form",qt=".dropdown-menu",Mt=".navbar-nav",Kt=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",Qt="top-start",Bt="top-end",Vt="bottom-start",Yt="bottom-end",zt="right-start",Xt="left-start",$t={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic"},Gt={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string"},Jt=function(){function c(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var t=c.prototype;return t.toggle=function(){if(!this._element.disabled&&!g(this._element).hasClass(Pt)){var t=c._getParentFromElement(this._element),e=g(this._menu).hasClass(Lt);if(c._clearMenus(),!e){var n={relatedTarget:this._element},i=g.Event(kt.SHOW,n);if(g(t).trigger(i),!i.isDefaultPrevented()){if(!this._inNavbar){if("undefined"==typeof u)throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org/)");var o=this._element;"parent"===this._config.reference?o=t:_.isElement(this._config.reference)&&(o=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(o=this._config.reference[0])),"scrollParent"!==this._config.boundary&&g(t).addClass(Ft),this._popper=new u(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===g(t).closest(Mt).length&&g(document.body).children().on("mouseover",null,g.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),g(this._menu).toggleClass(Lt),g(t).toggleClass(Lt).trigger(g.Event(kt.SHOWN,n))}}}},t.show=function(){if(!(this._element.disabled||g(this._element).hasClass(Pt)||g(this._menu).hasClass(Lt))){var t={relatedTarget:this._element},e=g.Event(kt.SHOW,t),n=c._getParentFromElement(this._element);g(n).trigger(e),e.isDefaultPrevented()||(g(this._menu).toggleClass(Lt),g(n).toggleClass(Lt).trigger(g.Event(kt.SHOWN,t)))}},t.hide=function(){if(!this._element.disabled&&!g(this._element).hasClass(Pt)&&g(this._menu).hasClass(Lt)){var t={relatedTarget:this._element},e=g.Event(kt.HIDE,t),n=c._getParentFromElement(this._element);g(n).trigger(e),e.isDefaultPrevented()||(g(this._menu).toggleClass(Lt),g(n).toggleClass(Lt).trigger(g.Event(kt.HIDDEN,t)))}},t.dispose=function(){g.removeData(this._element,Dt),g(this._element).off(wt),this._element=null,(this._menu=null)!==this._popper&&(this._popper.destroy(),this._popper=null)},t.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},t._addEventListeners=function(){var e=this;g(this._element).on(kt.CLICK,function(t){t.preventDefault(),t.stopPropagation(),e.toggle()})},t._getConfig=function(t){return t=l({},this.constructor.Default,g(this._element).data(),t),_.typeCheckConfig(It,t,this.constructor.DefaultType),t},t._getMenuElement=function(){if(!this._menu){var t=c._getParentFromElement(this._element);t&&(this._menu=t.querySelector(qt))}return this._menu},t._getPlacement=function(){var t=g(this._element.parentNode),e=Vt;return t.hasClass(jt)?(e=Qt,g(this._menu).hasClass(xt)&&(e=Bt)):t.hasClass(Ht)?e=zt:t.hasClass(Rt)?e=Xt:g(this._menu).hasClass(xt)&&(e=Yt),e},t._detectNavbar=function(){return 0<g(this._element).closest(".navbar").length},t._getOffset=function(){var e=this,t={};return"function"==typeof this._config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e._config.offset(t.offsets,e._element)||{}),t}:t.offset=this._config.offset,t},t._getPopperConfig=function(){var t={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(t.modifiers.applyStyle={enabled:!1}),t},c._jQueryInterface=function(e){return this.each(function(){var t=g(this).data(Dt);if(t||(t=new c(this,"object"==typeof e?e:null),g(this).data(Dt,t)),"string"==typeof e){if("undefined"==typeof t[e])throw new TypeError('No method named "'+e+'"');t[e]()}})},c._clearMenus=function(t){if(!t||3!==t.which&&("keyup"!==t.type||9===t.which))for(var e=[].slice.call(document.querySelectorAll(Ut)),n=0,i=e.length;n<i;n++){var o=c._getParentFromElement(e[n]),r=g(e[n]).data(Dt),s={relatedTarget:e[n]};if(t&&"click"===t.type&&(s.clickEvent=t),r){var a=r._menu;if(g(o).hasClass(Lt)&&!(t&&("click"===t.type&&/input|textarea/i.test(t.target.tagName)||"keyup"===t.type&&9===t.which)&&g.contains(o,t.target))){var l=g.Event(kt.HIDE,s);g(o).trigger(l),l.isDefaultPrevented()||("ontouchstart"in document.documentElement&&g(document.body).children().off("mouseover",null,g.noop),e[n].setAttribute("aria-expanded","false"),g(a).removeClass(Lt),g(o).removeClass(Lt).trigger(g.Event(kt.HIDDEN,s)))}}}},c._getParentFromElement=function(t){var e,n=_.getSelectorFromElement(t);return n&&(e=document.querySelector(n)),e||t.parentNode},c._dataApiKeydownHandler=function(t){if((/input|textarea/i.test(t.target.tagName)?!(32===t.which||27!==t.which&&(40!==t.which&&38!==t.which||g(t.target).closest(qt).length)):Ot.test(t.which))&&(t.preventDefault(),t.stopPropagation(),!this.disabled&&!g(this).hasClass(Pt))){var e=c._getParentFromElement(this),n=g(e).hasClass(Lt);if(n&&(!n||27!==t.which&&32!==t.which)){var i=[].slice.call(e.querySelectorAll(Kt));if(0!==i.length){var o=i.indexOf(t.target);38===t.which&&0<o&&o--,40===t.which&&o<i.length-1&&o++,o<0&&(o=0),i[o].focus()}}else{if(27===t.which){var r=e.querySelector(Ut);g(r).trigger("focus")}g(this).trigger("click")}}},s(c,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return $t}},{key:"DefaultType",get:function(){return Gt}}]),c}();g(document).on(kt.KEYDOWN_DATA_API,Ut,Jt._dataApiKeydownHandler).on(kt.KEYDOWN_DATA_API,qt,Jt._dataApiKeydownHandler).on(kt.CLICK_DATA_API+" "+kt.KEYUP_DATA_API,Jt._clearMenus).on(kt.CLICK_DATA_API,Ut,function(t){t.preventDefault(),t.stopPropagation(),Jt._jQueryInterface.call(g(this),"toggle")}).on(kt.CLICK_DATA_API,Wt,function(t){t.stopPropagation()}),g.fn[It]=Jt._jQueryInterface,g.fn[It].Constructor=Jt,g.fn[It].noConflict=function(){return g.fn[It]=Nt,Jt._jQueryInterface};var Zt="modal",te="bs.modal",ee="."+te,ne=g.fn[Zt],ie={backdrop:!0,keyboard:!0,focus:!0,show:!0},oe={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},re={HIDE:"hide"+ee,HIDDEN:"hidden"+ee,SHOW:"show"+ee,SHOWN:"shown"+ee,FOCUSIN:"focusin"+ee,RESIZE:"resize"+ee,CLICK_DISMISS:"click.dismiss"+ee,KEYDOWN_DISMISS:"keydown.dismiss"+ee,MOUSEUP_DISMISS:"mouseup.dismiss"+ee,MOUSEDOWN_DISMISS:"mousedown.dismiss"+ee,CLICK_DATA_API:"click"+ee+".data-api"},se="modal-dialog-scrollable",ae="modal-scrollbar-measure",le="modal-backdrop",ce="modal-open",he="fade",ue="show",fe=".modal-dialog",de=".modal-body",ge='[data-toggle="modal"]',_e='[data-dismiss="modal"]',me=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",pe=".sticky-top",ve=function(){function o(t,e){this._config=this._getConfig(e),this._element=t,this._dialog=t.querySelector(fe),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}var t=o.prototype;return t.toggle=function(t){return this._isShown?this.hide():this.show(t)},t.show=function(t){var e=this;if(!this._isShown&&!this._isTransitioning){g(this._element).hasClass(he)&&(this._isTransitioning=!0);var n=g.Event(re.SHOW,{relatedTarget:t});g(this._element).trigger(n),this._isShown||n.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),g(this._element).on(re.CLICK_DISMISS,_e,function(t){return e.hide(t)}),g(this._dialog).on(re.MOUSEDOWN_DISMISS,function(){g(e._element).one(re.MOUSEUP_DISMISS,function(t){g(t.target).is(e._element)&&(e._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return e._showElement(t)}))}},t.hide=function(t){var e=this;if(t&&t.preventDefault(),this._isShown&&!this._isTransitioning){var n=g.Event(re.HIDE);if(g(this._element).trigger(n),this._isShown&&!n.isDefaultPrevented()){this._isShown=!1;var i=g(this._element).hasClass(he);if(i&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),g(document).off(re.FOCUSIN),g(this._element).removeClass(ue),g(this._element).off(re.CLICK_DISMISS),g(this._dialog).off(re.MOUSEDOWN_DISMISS),i){var o=_.getTransitionDurationFromElement(this._element);g(this._element).one(_.TRANSITION_END,function(t){return e._hideModal(t)}).emulateTransitionEnd(o)}else this._hideModal()}}},t.dispose=function(){[window,this._element,this._dialog].forEach(function(t){return g(t).off(ee)}),g(document).off(re.FOCUSIN),g.removeData(this._element,te),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null},t.handleUpdate=function(){this._adjustDialog()},t._getConfig=function(t){return t=l({},ie,t),_.typeCheckConfig(Zt,t,oe),t},t._showElement=function(t){var e=this,n=g(this._element).hasClass(he);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),g(this._dialog).hasClass(se)?this._dialog.querySelector(de).scrollTop=0:this._element.scrollTop=0,n&&_.reflow(this._element),g(this._element).addClass(ue),this._config.focus&&this._enforceFocus();var i=g.Event(re.SHOWN,{relatedTarget:t}),o=function(){e._config.focus&&e._element.focus(),e._isTransitioning=!1,g(e._element).trigger(i)};if(n){var r=_.getTransitionDurationFromElement(this._dialog);g(this._dialog).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o()},t._enforceFocus=function(){var e=this;g(document).off(re.FOCUSIN).on(re.FOCUSIN,function(t){document!==t.target&&e._element!==t.target&&0===g(e._element).has(t.target).length&&e._element.focus()})},t._setEscapeEvent=function(){var e=this;this._isShown&&this._config.keyboard?g(this._element).on(re.KEYDOWN_DISMISS,function(t){27===t.which&&(t.preventDefault(),e.hide())}):this._isShown||g(this._element).off(re.KEYDOWN_DISMISS)},t._setResizeEvent=function(){var e=this;this._isShown?g(window).on(re.RESIZE,function(t){return e.handleUpdate(t)}):g(window).off(re.RESIZE)},t._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._isTransitioning=!1,this._showBackdrop(function(){g(document.body).removeClass(ce),t._resetAdjustments(),t._resetScrollbar(),g(t._element).trigger(re.HIDDEN)})},t._removeBackdrop=function(){this._backdrop&&(g(this._backdrop).remove(),this._backdrop=null)},t._showBackdrop=function(t){var e=this,n=g(this._element).hasClass(he)?he:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className=le,n&&this._backdrop.classList.add(n),g(this._backdrop).appendTo(document.body),g(this._element).on(re.CLICK_DISMISS,function(t){e._ignoreBackdropClick?e._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===e._config.backdrop?e._element.focus():e.hide())}),n&&_.reflow(this._backdrop),g(this._backdrop).addClass(ue),!t)return;if(!n)return void t();var i=_.getTransitionDurationFromElement(this._backdrop);g(this._backdrop).one(_.TRANSITION_END,t).emulateTransitionEnd(i)}else if(!this._isShown&&this._backdrop){g(this._backdrop).removeClass(ue);var o=function(){e._removeBackdrop(),t&&t()};if(g(this._element).hasClass(he)){var r=_.getTransitionDurationFromElement(this._backdrop);g(this._backdrop).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o()}else t&&t()},t._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},t._setScrollbar=function(){var o=this;if(this._isBodyOverflowing){var t=[].slice.call(document.querySelectorAll(me)),e=[].slice.call(document.querySelectorAll(pe));g(t).each(function(t,e){var n=e.style.paddingRight,i=g(e).css("padding-right");g(e).data("padding-right",n).css("padding-right",parseFloat(i)+o._scrollbarWidth+"px")}),g(e).each(function(t,e){var n=e.style.marginRight,i=g(e).css("margin-right");g(e).data("margin-right",n).css("margin-right",parseFloat(i)-o._scrollbarWidth+"px")});var n=document.body.style.paddingRight,i=g(document.body).css("padding-right");g(document.body).data("padding-right",n).css("padding-right",parseFloat(i)+this._scrollbarWidth+"px")}g(document.body).addClass(ce)},t._resetScrollbar=function(){var t=[].slice.call(document.querySelectorAll(me));g(t).each(function(t,e){var n=g(e).data("padding-right");g(e).removeData("padding-right"),e.style.paddingRight=n||""});var e=[].slice.call(document.querySelectorAll(""+pe));g(e).each(function(t,e){var n=g(e).data("margin-right");"undefined"!=typeof n&&g(e).css("margin-right",n).removeData("margin-right")});var n=g(document.body).data("padding-right");g(document.body).removeData("padding-right"),document.body.style.paddingRight=n||""},t._getScrollbarWidth=function(){var t=document.createElement("div");t.className=ae,document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e},o._jQueryInterface=function(n,i){return this.each(function(){var t=g(this).data(te),e=l({},ie,g(this).data(),"object"==typeof n&&n?n:{});if(t||(t=new o(this,e),g(this).data(te,t)),"string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n](i)}else e.show&&t.show(i)})},s(o,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return ie}}]),o}();g(document).on(re.CLICK_DATA_API,ge,function(t){var e,n=this,i=_.getSelectorFromElement(this);i&&(e=document.querySelector(i));var o=g(e).data(te)?"toggle":l({},g(e).data(),g(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||t.preventDefault();var r=g(e).one(re.SHOW,function(t){t.isDefaultPrevented()||r.one(re.HIDDEN,function(){g(n).is(":visible")&&n.focus()})});ve._jQueryInterface.call(g(e),o,this)}),g.fn[Zt]=ve._jQueryInterface,g.fn[Zt].Constructor=ve,g.fn[Zt].noConflict=function(){return g.fn[Zt]=ne,ve._jQueryInterface};var ye=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],Ee={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Ce=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,Te=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function Se(t,s,e){if(0===t.length)return t;if(e&&"function"==typeof e)return e(t);for(var n=(new window.DOMParser).parseFromString(t,"text/html"),a=Object.keys(s),l=[].slice.call(n.body.querySelectorAll("*")),i=function(t,e){var n=l[t],i=n.nodeName.toLowerCase();if(-1===a.indexOf(n.nodeName.toLowerCase()))return n.parentNode.removeChild(n),"continue";var o=[].slice.call(n.attributes),r=[].concat(s["*"]||[],s[i]||[]);o.forEach(function(t){(function(t,e){var n=t.nodeName.toLowerCase();if(-1!==e.indexOf(n))return-1===ye.indexOf(n)||Boolean(t.nodeValue.match(Ce)||t.nodeValue.match(Te));for(var i=e.filter(function(t){return t instanceof RegExp}),o=0,r=i.length;o<r;o++)if(n.match(i[o]))return!0;return!1})(t,r)||n.removeAttribute(t.nodeName)})},o=0,r=l.length;o<r;o++)i(o);return n.body.innerHTML}var be="tooltip",Ie="bs.tooltip",De="."+Ie,we=g.fn[be],Ae="bs-tooltip",Ne=new RegExp("(^|\\s)"+Ae+"\\S+","g"),Oe=["sanitize","whiteList","sanitizeFn"],ke={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object"},Pe={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},Le={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Ee},je="show",He="out",Re={HIDE:"hide"+De,HIDDEN:"hidden"+De,SHOW:"show"+De,SHOWN:"shown"+De,INSERTED:"inserted"+De,CLICK:"click"+De,FOCUSIN:"focusin"+De,FOCUSOUT:"focusout"+De,MOUSEENTER:"mouseenter"+De,MOUSELEAVE:"mouseleave"+De},xe="fade",Fe="show",Ue=".tooltip-inner",We=".arrow",qe="hover",Me="focus",Ke="click",Qe="manual",Be=function(){function i(t,e){if("undefined"==typeof u)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=g(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(g(this.getTipElement()).hasClass(Fe))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),g.removeData(this.element,this.constructor.DATA_KEY),g(this.element).off(this.constructor.EVENT_KEY),g(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&g(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===g(this.element).css("display"))throw new Error("Please use show on visible elements");var t=g.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){g(this.element).trigger(t);var n=_.findShadowRoot(this.element),i=g.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=_.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&g(o).addClass(xe);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();g(o).data(this.constructor.DATA_KEY,this),g.contains(this.element.ownerDocument.documentElement,this.tip)||g(o).appendTo(l),g(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new u(this.element,o,{placement:a,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:We},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}}),g(o).addClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().on("mouseover",null,g.noop);var c=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,g(e.element).trigger(e.constructor.Event.SHOWN),t===He&&e._leave(null,e)};if(g(this.tip).hasClass(xe)){var h=_.getTransitionDurationFromElement(this.tip);g(this.tip).one(_.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=g.Event(this.constructor.Event.HIDE),o=function(){e._hoverState!==je&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),g(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(g(this.element).trigger(i),!i.isDefaultPrevented()){if(g(n).removeClass(Fe),"ontouchstart"in document.documentElement&&g(document.body).children().off("mouseover",null,g.noop),this._activeTrigger[Ke]=!1,this._activeTrigger[Me]=!1,this._activeTrigger[qe]=!1,g(this.tip).hasClass(xe)){var r=_.getTransitionDurationFromElement(n);g(n).one(_.TRANSITION_END,o).emulateTransitionEnd(r)}else o();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){g(this.getTipElement()).addClass(Ae+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},t.setContent=function(){var t=this.getTipElement();this.setElementContent(g(t.querySelectorAll(Ue)),this.getTitle()),g(t).removeClass(xe+" "+Fe)},t.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=Se(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?g(e).parent().is(t)||t.empty().append(e):t.text(g(e).text())},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getOffset=function(){var e=this,t={};return"function"==typeof this.config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e.config.offset(t.offsets,e.element)||{}),t}:t.offset=this.config.offset,t},t._getContainer=function(){return!1===this.config.container?document.body:_.isElement(this.config.container)?g(this.config.container):g(document).find(this.config.container)},t._getAttachment=function(t){return Pe[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)g(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==Qe){var e=t===qe?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===qe?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;g(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}}),g(this.element).closest(".modal").on("hide.bs.modal",function(){i.element&&i.hide()}),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Me:qe]=!0),g(e.getTipElement()).hasClass(Fe)||e._hoverState===je?e._hoverState=je:(clearTimeout(e._timeout),e._hoverState=je,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===je&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||g(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),g(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Me:qe]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=He,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===He&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){var e=g(this.element).data();return Object.keys(e).forEach(function(t){-1!==Oe.indexOf(t)&&delete e[t]}),"number"==typeof(t=l({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),_.typeCheckConfig(be,t,this.constructor.DefaultType),t.sanitize&&(t.template=Se(t.template,t.whiteList,t.sanitizeFn)),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ne);null!==e&&e.length&&t.removeClass(e.join(""))},t._handlePopperPlacementChange=function(t){var e=t.instance;this.tip=e.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},t._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(g(t).removeClass(xe),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},i._jQueryInterface=function(n){return this.each(function(){var t=g(this).data(Ie),e="object"==typeof n&&n;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),g(this).data(Ie,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return Le}},{key:"NAME",get:function(){return be}},{key:"DATA_KEY",get:function(){return Ie}},{key:"Event",get:function(){return Re}},{key:"EVENT_KEY",get:function(){return De}},{key:"DefaultType",get:function(){return ke}}]),i}();g.fn[be]=Be._jQueryInterface,g.fn[be].Constructor=Be,g.fn[be].noConflict=function(){return g.fn[be]=we,Be._jQueryInterface};var Ve="popover",Ye="bs.popover",ze="."+Ye,Xe=g.fn[Ve],$e="bs-popover",Ge=new RegExp("(^|\\s)"+$e+"\\S+","g"),Je=l({},Be.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),Ze=l({},Be.DefaultType,{content:"(string|element|function)"}),tn="fade",en="show",nn=".popover-header",on=".popover-body",rn={HIDE:"hide"+ze,HIDDEN:"hidden"+ze,SHOW:"show"+ze,SHOWN:"shown"+ze,INSERTED:"inserted"+ze,CLICK:"click"+ze,FOCUSIN:"focusin"+ze,FOCUSOUT:"focusout"+ze,MOUSEENTER:"mouseenter"+ze,MOUSELEAVE:"mouseleave"+ze},sn=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var o=i.prototype;return o.isWithContent=function(){return this.getTitle()||this._getContent()},o.addAttachmentClass=function(t){g(this.getTipElement()).addClass($e+"-"+t)},o.getTipElement=function(){return this.tip=this.tip||g(this.config.template)[0],this.tip},o.setContent=function(){var t=g(this.getTipElement());this.setElementContent(t.find(nn),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(on),e),t.removeClass(tn+" "+en)},o._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},o._cleanTipClass=function(){var t=g(this.getTipElement()),e=t.attr("class").match(Ge);null!==e&&0<e.length&&t.removeClass(e.join(""))},i._jQueryInterface=function(n){return this.each(function(){var t=g(this).data(Ye),e="object"==typeof n?n:null;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),g(this).data(Ye,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return Je}},{key:"NAME",get:function(){return Ve}},{key:"DATA_KEY",get:function(){return Ye}},{key:"Event",get:function(){return rn}},{key:"EVENT_KEY",get:function(){return ze}},{key:"DefaultType",get:function(){return Ze}}]),i}(Be);g.fn[Ve]=sn._jQueryInterface,g.fn[Ve].Constructor=sn,g.fn[Ve].noConflict=function(){return g.fn[Ve]=Xe,sn._jQueryInterface};var an="scrollspy",ln="bs.scrollspy",cn="."+ln,hn=g.fn[an],un={offset:10,method:"auto",target:""},fn={offset:"number",method:"string",target:"(string|element)"},dn={ACTIVATE:"activate"+cn,SCROLL:"scroll"+cn,LOAD_DATA_API:"load"+cn+".data-api"},gn="dropdown-item",_n="active",mn='[data-spy="scroll"]',pn=".nav, .list-group",vn=".nav-link",yn=".nav-item",En=".list-group-item",Cn=".dropdown",Tn=".dropdown-item",Sn=".dropdown-toggle",bn="offset",In="position",Dn=function(){function n(t,e){var n=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(e),this._selector=this._config.target+" "+vn+","+this._config.target+" "+En+","+this._config.target+" "+Tn,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,g(this._scrollElement).on(dn.SCROLL,function(t){return n._process(t)}),this.refresh(),this._process()}var t=n.prototype;return t.refresh=function(){var e=this,t=this._scrollElement===this._scrollElement.window?bn:In,o="auto"===this._config.method?t:this._config.method,r=o===In?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map(function(t){var e,n=_.getSelectorFromElement(t);if(n&&(e=document.querySelector(n)),e){var i=e.getBoundingClientRect();if(i.width||i.height)return[g(e)[o]().top+r,n]}return null}).filter(function(t){return t}).sort(function(t,e){return t[0]-e[0]}).forEach(function(t){e._offsets.push(t[0]),e._targets.push(t[1])})},t.dispose=function(){g.removeData(this._element,ln),g(this._scrollElement).off(cn),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},t._getConfig=function(t){if("string"!=typeof(t=l({},un,"object"==typeof t&&t?t:{})).target){var e=g(t.target).attr("id");e||(e=_.getUID(an),g(t.target).attr("id",e)),t.target="#"+e}return _.typeCheckConfig(an,t,fn),t},t._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},t._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},t._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},t._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),n<=t){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t<this._offsets[0]&&0<this._offsets[0])return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&t>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t<this._offsets[o+1])&&this._activate(this._targets[o])}}},t._activate=function(e){this._activeTarget=e,this._clear();var t=this._selector.split(",").map(function(t){return t+'[data-target="'+e+'"],'+t+'[href="'+e+'"]'}),n=g([].slice.call(document.querySelectorAll(t.join(","))));n.hasClass(gn)?(n.closest(Cn).find(Sn).addClass(_n),n.addClass(_n)):(n.addClass(_n),n.parents(pn).prev(vn+", "+En).addClass(_n),n.parents(pn).prev(yn).children(vn).addClass(_n)),g(this._scrollElement).trigger(dn.ACTIVATE,{relatedTarget:e})},t._clear=function(){[].slice.call(document.querySelectorAll(this._selector)).filter(function(t){return t.classList.contains(_n)}).forEach(function(t){return t.classList.remove(_n)})},n._jQueryInterface=function(e){return this.each(function(){var t=g(this).data(ln);if(t||(t=new n(this,"object"==typeof e&&e),g(this).data(ln,t)),"string"==typeof e){if("undefined"==typeof t[e])throw new TypeError('No method named "'+e+'"');t[e]()}})},s(n,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return un}}]),n}();g(window).on(dn.LOAD_DATA_API,function(){for(var t=[].slice.call(document.querySelectorAll(mn)),e=t.length;e--;){var n=g(t[e]);Dn._jQueryInterface.call(n,n.data())}}),g.fn[an]=Dn._jQueryInterface,g.fn[an].Constructor=Dn,g.fn[an].noConflict=function(){return g.fn[an]=hn,Dn._jQueryInterface};var wn="bs.tab",An="."+wn,Nn=g.fn.tab,On={HIDE:"hide"+An,HIDDEN:"hidden"+An,SHOW:"show"+An,SHOWN:"shown"+An,CLICK_DATA_API:"click"+An+".data-api"},kn="dropdown-menu",Pn="active",Ln="disabled",jn="fade",Hn="show",Rn=".dropdown",xn=".nav, .list-group",Fn=".active",Un="> li > .active",Wn='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',qn=".dropdown-toggle",Mn="> .dropdown-menu .active",Kn=function(){function i(t){this._element=t}var t=i.prototype;return t.show=function(){var n=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&g(this._element).hasClass(Pn)||g(this._element).hasClass(Ln))){var t,i,e=g(this._element).closest(xn)[0],o=_.getSelectorFromElement(this._element);if(e){var r="UL"===e.nodeName||"OL"===e.nodeName?Un:Fn;i=(i=g.makeArray(g(e).find(r)))[i.length-1]}var s=g.Event(On.HIDE,{relatedTarget:this._element}),a=g.Event(On.SHOW,{relatedTarget:i});if(i&&g(i).trigger(s),g(this._element).trigger(a),!a.isDefaultPrevented()&&!s.isDefaultPrevented()){o&&(t=document.querySelector(o)),this._activate(this._element,e);var l=function(){var t=g.Event(On.HIDDEN,{relatedTarget:n._element}),e=g.Event(On.SHOWN,{relatedTarget:i});g(i).trigger(t),g(n._element).trigger(e)};t?this._activate(t,t.parentNode,l):l()}}},t.dispose=function(){g.removeData(this._element,wn),this._element=null},t._activate=function(t,e,n){var i=this,o=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?g(e).children(Fn):g(e).find(Un))[0],r=n&&o&&g(o).hasClass(jn),s=function(){return i._transitionComplete(t,o,n)};if(o&&r){var a=_.getTransitionDurationFromElement(o);g(o).removeClass(Hn).one(_.TRANSITION_END,s).emulateTransitionEnd(a)}else s()},t._transitionComplete=function(t,e,n){if(e){g(e).removeClass(Pn);var i=g(e.parentNode).find(Mn)[0];i&&g(i).removeClass(Pn),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}if(g(t).addClass(Pn),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),_.reflow(t),t.classList.contains(jn)&&t.classList.add(Hn),t.parentNode&&g(t.parentNode).hasClass(kn)){var o=g(t).closest(Rn)[0];if(o){var r=[].slice.call(o.querySelectorAll(qn));g(r).addClass(Pn)}t.setAttribute("aria-expanded",!0)}n&&n()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(wn);if(e||(e=new i(this),t.data(wn,e)),"string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),i}();g(document).on(On.CLICK_DATA_API,Wn,function(t){t.preventDefault(),Kn._jQueryInterface.call(g(this),"show")}),g.fn.tab=Kn._jQueryInterface,g.fn.tab.Constructor=Kn,g.fn.tab.noConflict=function(){return g.fn.tab=Nn,Kn._jQueryInterface};var Qn="toast",Bn="bs.toast",Vn="."+Bn,Yn=g.fn[Qn],zn={CLICK_DISMISS:"click.dismiss"+Vn,HIDE:"hide"+Vn,HIDDEN:"hidden"+Vn,SHOW:"show"+Vn,SHOWN:"shown"+Vn},Xn="fade",$n="hide",Gn="show",Jn="showing",Zn={animation:"boolean",autohide:"boolean",delay:"number"},ti={animation:!0,autohide:!0,delay:500},ei='[data-dismiss="toast"]',ni=function(){function i(t,e){this._element=t,this._config=this._getConfig(e),this._timeout=null,this._setListeners()}var t=i.prototype;return t.show=function(){var t=this;g(this._element).trigger(zn.SHOW),this._config.animation&&this._element.classList.add(Xn);var e=function(){t._element.classList.remove(Jn),t._element.classList.add(Gn),g(t._element).trigger(zn.SHOWN),t._config.autohide&&t.hide()};if(this._element.classList.remove($n),this._element.classList.add(Jn),this._config.animation){var n=_.getTransitionDurationFromElement(this._element);g(this._element).one(_.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},t.hide=function(t){var e=this;this._element.classList.contains(Gn)&&(g(this._element).trigger(zn.HIDE),t?this._close():this._timeout=setTimeout(function(){e._close()},this._config.delay))},t.dispose=function(){clearTimeout(this._timeout),this._timeout=null,this._element.classList.contains(Gn)&&this._element.classList.remove(Gn),g(this._element).off(zn.CLICK_DISMISS),g.removeData(this._element,Bn),this._element=null,this._config=null},t._getConfig=function(t){return t=l({},ti,g(this._element).data(),"object"==typeof t&&t?t:{}),_.typeCheckConfig(Qn,t,this.constructor.DefaultType),t},t._setListeners=function(){var t=this;g(this._element).on(zn.CLICK_DISMISS,ei,function(){return t.hide(!0)})},t._close=function(){var t=this,e=function(){t._element.classList.add($n),g(t._element).trigger(zn.HIDDEN)};if(this._element.classList.remove(Gn),this._config.animation){var n=_.getTransitionDurationFromElement(this._element);g(this._element).one(_.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(Bn);if(e||(e=new i(this,"object"==typeof n&&n),t.data(Bn,e)),"string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n](this)}})},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}},{key:"DefaultType",get:function(){return Zn}},{key:"Default",get:function(){return ti}}]),i}();g.fn[Qn]=ni._jQueryInterface,g.fn[Qn].Constructor=ni,g.fn[Qn].noConflict=function(){return g.fn[Qn]=Yn,ni._jQueryInterface},function(){if("undefined"==typeof g)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var t=g.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1===t[0]&&9===t[1]&&t[2]<1||4<=t[0])throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}(),t.Util=_,t.Alert=p,t.Button=P,t.Carousel=lt,t.Collapse=bt,t.Dropdown=Jt,t.Modal=ve,t.Popover=sn,t.Scrollspy=Dn,t.Tab=Kn,t.Toast=ni,t.Tooltip=Be,Object.defineProperty(t,"__esModule",{value:!0})});
|
||
//# sourceMappingURL=bootstrap.min.js.map
|
||
/*!
|
||
* Vue.js v2.6.10
|
||
* (c) 2014-2019 Evan You
|
||
* Released under the MIT License.
|
||
*/
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||
typeof define === 'function' && define.amd ? define(factory) :
|
||
(global = global || self, global.Vue = factory());
|
||
}(this, function () { 'use strict';
|
||
|
||
/* */
|
||
|
||
var emptyObject = Object.freeze({});
|
||
|
||
// These helpers produce better VM code in JS engines due to their
|
||
// explicitness and function inlining.
|
||
function isUndef (v) {
|
||
return v === undefined || v === null
|
||
}
|
||
|
||
function isDef (v) {
|
||
return v !== undefined && v !== null
|
||
}
|
||
|
||
function isTrue (v) {
|
||
return v === true
|
||
}
|
||
|
||
function isFalse (v) {
|
||
return v === false
|
||
}
|
||
|
||
/**
|
||
* Check if value is primitive.
|
||
*/
|
||
function isPrimitive (value) {
|
||
return (
|
||
typeof value === 'string' ||
|
||
typeof value === 'number' ||
|
||
// $flow-disable-line
|
||
typeof value === 'symbol' ||
|
||
typeof value === 'boolean'
|
||
)
|
||
}
|
||
|
||
/**
|
||
* Quick object check - this is primarily used to tell
|
||
* Objects from primitive values when we know the value
|
||
* is a JSON-compliant type.
|
||
*/
|
||
function isObject (obj) {
|
||
return obj !== null && typeof obj === 'object'
|
||
}
|
||
|
||
/**
|
||
* Get the raw type string of a value, e.g., [object Object].
|
||
*/
|
||
var _toString = Object.prototype.toString;
|
||
|
||
function toRawType (value) {
|
||
return _toString.call(value).slice(8, -1)
|
||
}
|
||
|
||
/**
|
||
* Strict object type check. Only returns true
|
||
* for plain JavaScript objects.
|
||
*/
|
||
function isPlainObject (obj) {
|
||
return _toString.call(obj) === '[object Object]'
|
||
}
|
||
|
||
function isRegExp (v) {
|
||
return _toString.call(v) === '[object RegExp]'
|
||
}
|
||
|
||
/**
|
||
* Check if val is a valid array index.
|
||
*/
|
||
function isValidArrayIndex (val) {
|
||
var n = parseFloat(String(val));
|
||
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
||
}
|
||
|
||
function isPromise (val) {
|
||
return (
|
||
isDef(val) &&
|
||
typeof val.then === 'function' &&
|
||
typeof val.catch === 'function'
|
||
)
|
||
}
|
||
|
||
/**
|
||
* Convert a value to a string that is actually rendered.
|
||
*/
|
||
function toString (val) {
|
||
return val == null
|
||
? ''
|
||
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
||
? JSON.stringify(val, null, 2)
|
||
: String(val)
|
||
}
|
||
|
||
/**
|
||
* Convert an input value to a number for persistence.
|
||
* If the conversion fails, return original string.
|
||
*/
|
||
function toNumber (val) {
|
||
var n = parseFloat(val);
|
||
return isNaN(n) ? val : n
|
||
}
|
||
|
||
/**
|
||
* Make a map and return a function for checking if a key
|
||
* is in that map.
|
||
*/
|
||
function makeMap (
|
||
str,
|
||
expectsLowerCase
|
||
) {
|
||
var map = Object.create(null);
|
||
var list = str.split(',');
|
||
for (var i = 0; i < list.length; i++) {
|
||
map[list[i]] = true;
|
||
}
|
||
return expectsLowerCase
|
||
? function (val) { return map[val.toLowerCase()]; }
|
||
: function (val) { return map[val]; }
|
||
}
|
||
|
||
/**
|
||
* Check if a tag is a built-in tag.
|
||
*/
|
||
var isBuiltInTag = makeMap('slot,component', true);
|
||
|
||
/**
|
||
* Check if an attribute is a reserved attribute.
|
||
*/
|
||
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
||
|
||
/**
|
||
* Remove an item from an array.
|
||
*/
|
||
function remove (arr, item) {
|
||
if (arr.length) {
|
||
var index = arr.indexOf(item);
|
||
if (index > -1) {
|
||
return arr.splice(index, 1)
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Check whether an object has the property.
|
||
*/
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
function hasOwn (obj, key) {
|
||
return hasOwnProperty.call(obj, key)
|
||
}
|
||
|
||
/**
|
||
* Create a cached version of a pure function.
|
||
*/
|
||
function cached (fn) {
|
||
var cache = Object.create(null);
|
||
return (function cachedFn (str) {
|
||
var hit = cache[str];
|
||
return hit || (cache[str] = fn(str))
|
||
})
|
||
}
|
||
|
||
/**
|
||
* Camelize a hyphen-delimited string.
|
||
*/
|
||
var camelizeRE = /-(\w)/g;
|
||
var camelize = cached(function (str) {
|
||
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
||
});
|
||
|
||
/**
|
||
* Capitalize a string.
|
||
*/
|
||
var capitalize = cached(function (str) {
|
||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||
});
|
||
|
||
/**
|
||
* Hyphenate a camelCase string.
|
||
*/
|
||
var hyphenateRE = /\B([A-Z])/g;
|
||
var hyphenate = cached(function (str) {
|
||
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
||
});
|
||
|
||
/**
|
||
* Simple bind polyfill for environments that do not support it,
|
||
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
|
||
* since native bind is now performant enough in most browsers.
|
||
* But removing it would mean breaking code that was able to run in
|
||
* PhantomJS 1.x, so this must be kept for backward compatibility.
|
||
*/
|
||
|
||
/* istanbul ignore next */
|
||
function polyfillBind (fn, ctx) {
|
||
function boundFn (a) {
|
||
var l = arguments.length;
|
||
return l
|
||
? l > 1
|
||
? fn.apply(ctx, arguments)
|
||
: fn.call(ctx, a)
|
||
: fn.call(ctx)
|
||
}
|
||
|
||
boundFn._length = fn.length;
|
||
return boundFn
|
||
}
|
||
|
||
function nativeBind (fn, ctx) {
|
||
return fn.bind(ctx)
|
||
}
|
||
|
||
var bind = Function.prototype.bind
|
||
? nativeBind
|
||
: polyfillBind;
|
||
|
||
/**
|
||
* Convert an Array-like object to a real Array.
|
||
*/
|
||
function toArray (list, start) {
|
||
start = start || 0;
|
||
var i = list.length - start;
|
||
var ret = new Array(i);
|
||
while (i--) {
|
||
ret[i] = list[i + start];
|
||
}
|
||
return ret
|
||
}
|
||
|
||
/**
|
||
* Mix properties into target object.
|
||
*/
|
||
function extend (to, _from) {
|
||
for (var key in _from) {
|
||
to[key] = _from[key];
|
||
}
|
||
return to
|
||
}
|
||
|
||
/**
|
||
* Merge an Array of Objects into a single Object.
|
||
*/
|
||
function toObject (arr) {
|
||
var res = {};
|
||
for (var i = 0; i < arr.length; i++) {
|
||
if (arr[i]) {
|
||
extend(res, arr[i]);
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* eslint-disable no-unused-vars */
|
||
|
||
/**
|
||
* Perform no operation.
|
||
* Stubbing args to make Flow happy without leaving useless transpiled code
|
||
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
|
||
*/
|
||
function noop (a, b, c) {}
|
||
|
||
/**
|
||
* Always return false.
|
||
*/
|
||
var no = function (a, b, c) { return false; };
|
||
|
||
/* eslint-enable no-unused-vars */
|
||
|
||
/**
|
||
* Return the same value.
|
||
*/
|
||
var identity = function (_) { return _; };
|
||
|
||
/**
|
||
* Generate a string containing static keys from compiler modules.
|
||
*/
|
||
function genStaticKeys (modules) {
|
||
return modules.reduce(function (keys, m) {
|
||
return keys.concat(m.staticKeys || [])
|
||
}, []).join(',')
|
||
}
|
||
|
||
/**
|
||
* Check if two values are loosely equal - that is,
|
||
* if they are plain objects, do they have the same shape?
|
||
*/
|
||
function looseEqual (a, b) {
|
||
if (a === b) { return true }
|
||
var isObjectA = isObject(a);
|
||
var isObjectB = isObject(b);
|
||
if (isObjectA && isObjectB) {
|
||
try {
|
||
var isArrayA = Array.isArray(a);
|
||
var isArrayB = Array.isArray(b);
|
||
if (isArrayA && isArrayB) {
|
||
return a.length === b.length && a.every(function (e, i) {
|
||
return looseEqual(e, b[i])
|
||
})
|
||
} else if (a instanceof Date && b instanceof Date) {
|
||
return a.getTime() === b.getTime()
|
||
} else if (!isArrayA && !isArrayB) {
|
||
var keysA = Object.keys(a);
|
||
var keysB = Object.keys(b);
|
||
return keysA.length === keysB.length && keysA.every(function (key) {
|
||
return looseEqual(a[key], b[key])
|
||
})
|
||
} else {
|
||
/* istanbul ignore next */
|
||
return false
|
||
}
|
||
} catch (e) {
|
||
/* istanbul ignore next */
|
||
return false
|
||
}
|
||
} else if (!isObjectA && !isObjectB) {
|
||
return String(a) === String(b)
|
||
} else {
|
||
return false
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Return the first index at which a loosely equal value can be
|
||
* found in the array (if value is a plain object, the array must
|
||
* contain an object of the same shape), or -1 if it is not present.
|
||
*/
|
||
function looseIndexOf (arr, val) {
|
||
for (var i = 0; i < arr.length; i++) {
|
||
if (looseEqual(arr[i], val)) { return i }
|
||
}
|
||
return -1
|
||
}
|
||
|
||
/**
|
||
* Ensure a function is called only once.
|
||
*/
|
||
function once (fn) {
|
||
var called = false;
|
||
return function () {
|
||
if (!called) {
|
||
called = true;
|
||
fn.apply(this, arguments);
|
||
}
|
||
}
|
||
}
|
||
|
||
var SSR_ATTR = 'data-server-rendered';
|
||
|
||
var ASSET_TYPES = [
|
||
'component',
|
||
'directive',
|
||
'filter'
|
||
];
|
||
|
||
var LIFECYCLE_HOOKS = [
|
||
'beforeCreate',
|
||
'created',
|
||
'beforeMount',
|
||
'mounted',
|
||
'beforeUpdate',
|
||
'updated',
|
||
'beforeDestroy',
|
||
'destroyed',
|
||
'activated',
|
||
'deactivated',
|
||
'errorCaptured',
|
||
'serverPrefetch'
|
||
];
|
||
|
||
/* */
|
||
|
||
|
||
|
||
var config = ({
|
||
/**
|
||
* Option merge strategies (used in core/util/options)
|
||
*/
|
||
// $flow-disable-line
|
||
optionMergeStrategies: Object.create(null),
|
||
|
||
/**
|
||
* Whether to suppress warnings.
|
||
*/
|
||
silent: false,
|
||
|
||
/**
|
||
* Show production mode tip message on boot?
|
||
*/
|
||
productionTip: "development" !== 'production',
|
||
|
||
/**
|
||
* Whether to enable devtools
|
||
*/
|
||
devtools: "development" !== 'production',
|
||
|
||
/**
|
||
* Whether to record perf
|
||
*/
|
||
performance: false,
|
||
|
||
/**
|
||
* Error handler for watcher errors
|
||
*/
|
||
errorHandler: null,
|
||
|
||
/**
|
||
* Warn handler for watcher warns
|
||
*/
|
||
warnHandler: null,
|
||
|
||
/**
|
||
* Ignore certain custom elements
|
||
*/
|
||
ignoredElements: [],
|
||
|
||
/**
|
||
* Custom user key aliases for v-on
|
||
*/
|
||
// $flow-disable-line
|
||
keyCodes: Object.create(null),
|
||
|
||
/**
|
||
* Check if a tag is reserved so that it cannot be registered as a
|
||
* component. This is platform-dependent and may be overwritten.
|
||
*/
|
||
isReservedTag: no,
|
||
|
||
/**
|
||
* Check if an attribute is reserved so that it cannot be used as a component
|
||
* prop. This is platform-dependent and may be overwritten.
|
||
*/
|
||
isReservedAttr: no,
|
||
|
||
/**
|
||
* Check if a tag is an unknown element.
|
||
* Platform-dependent.
|
||
*/
|
||
isUnknownElement: no,
|
||
|
||
/**
|
||
* Get the namespace of an element
|
||
*/
|
||
getTagNamespace: noop,
|
||
|
||
/**
|
||
* Parse the real tag name for the specific platform.
|
||
*/
|
||
parsePlatformTagName: identity,
|
||
|
||
/**
|
||
* Check if an attribute must be bound using property, e.g. value
|
||
* Platform-dependent.
|
||
*/
|
||
mustUseProp: no,
|
||
|
||
/**
|
||
* Perform updates asynchronously. Intended to be used by Vue Test Utils
|
||
* This will significantly reduce performance if set to false.
|
||
*/
|
||
async: true,
|
||
|
||
/**
|
||
* Exposed for legacy reasons
|
||
*/
|
||
_lifecycleHooks: LIFECYCLE_HOOKS
|
||
});
|
||
|
||
/* */
|
||
|
||
/**
|
||
* unicode letters used for parsing html tags, component names and property paths.
|
||
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
||
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
||
*/
|
||
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
||
|
||
/**
|
||
* Check if a string starts with $ or _
|
||
*/
|
||
function isReserved (str) {
|
||
var c = (str + '').charCodeAt(0);
|
||
return c === 0x24 || c === 0x5F
|
||
}
|
||
|
||
/**
|
||
* Define a property.
|
||
*/
|
||
function def (obj, key, val, enumerable) {
|
||
Object.defineProperty(obj, key, {
|
||
value: val,
|
||
enumerable: !!enumerable,
|
||
writable: true,
|
||
configurable: true
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Parse simple path.
|
||
*/
|
||
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
||
function parsePath (path) {
|
||
if (bailRE.test(path)) {
|
||
return
|
||
}
|
||
var segments = path.split('.');
|
||
return function (obj) {
|
||
for (var i = 0; i < segments.length; i++) {
|
||
if (!obj) { return }
|
||
obj = obj[segments[i]];
|
||
}
|
||
return obj
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
// can we use __proto__?
|
||
var hasProto = '__proto__' in {};
|
||
|
||
// Browser environment sniffing
|
||
var inBrowser = typeof window !== 'undefined';
|
||
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
||
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
||
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
||
var isIE = UA && /msie|trident/.test(UA);
|
||
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
||
var isEdge = UA && UA.indexOf('edge/') > 0;
|
||
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
||
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
||
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
||
var isPhantomJS = UA && /phantomjs/.test(UA);
|
||
var isFF = UA && UA.match(/firefox\/(\d+)/);
|
||
|
||
// Firefox has a "watch" function on Object.prototype...
|
||
var nativeWatch = ({}).watch;
|
||
|
||
var supportsPassive = false;
|
||
if (inBrowser) {
|
||
try {
|
||
var opts = {};
|
||
Object.defineProperty(opts, 'passive', ({
|
||
get: function get () {
|
||
/* istanbul ignore next */
|
||
supportsPassive = true;
|
||
}
|
||
})); // https://github.com/facebook/flow/issues/285
|
||
window.addEventListener('test-passive', null, opts);
|
||
} catch (e) {}
|
||
}
|
||
|
||
// this needs to be lazy-evaled because vue may be required before
|
||
// vue-server-renderer can set VUE_ENV
|
||
var _isServer;
|
||
var isServerRendering = function () {
|
||
if (_isServer === undefined) {
|
||
/* istanbul ignore if */
|
||
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
||
// detect presence of vue-server-renderer and avoid
|
||
// Webpack shimming the process
|
||
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
||
} else {
|
||
_isServer = false;
|
||
}
|
||
}
|
||
return _isServer
|
||
};
|
||
|
||
// detect devtools
|
||
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
||
|
||
/* istanbul ignore next */
|
||
function isNative (Ctor) {
|
||
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
||
}
|
||
|
||
var hasSymbol =
|
||
typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
||
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
||
|
||
var _Set;
|
||
/* istanbul ignore if */ // $flow-disable-line
|
||
if (typeof Set !== 'undefined' && isNative(Set)) {
|
||
// use native Set when available.
|
||
_Set = Set;
|
||
} else {
|
||
// a non-standard Set polyfill that only works with primitive keys.
|
||
_Set = /*@__PURE__*/(function () {
|
||
function Set () {
|
||
this.set = Object.create(null);
|
||
}
|
||
Set.prototype.has = function has (key) {
|
||
return this.set[key] === true
|
||
};
|
||
Set.prototype.add = function add (key) {
|
||
this.set[key] = true;
|
||
};
|
||
Set.prototype.clear = function clear () {
|
||
this.set = Object.create(null);
|
||
};
|
||
|
||
return Set;
|
||
}());
|
||
}
|
||
|
||
/* */
|
||
|
||
var warn = noop;
|
||
var tip = noop;
|
||
var generateComponentTrace = (noop); // work around flow check
|
||
var formatComponentName = (noop);
|
||
|
||
{
|
||
var hasConsole = typeof console !== 'undefined';
|
||
var classifyRE = /(?:^|[-_])(\w)/g;
|
||
var classify = function (str) { return str
|
||
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
||
.replace(/[-_]/g, ''); };
|
||
|
||
warn = function (msg, vm) {
|
||
var trace = vm ? generateComponentTrace(vm) : '';
|
||
|
||
if (config.warnHandler) {
|
||
config.warnHandler.call(null, msg, vm, trace);
|
||
} else if (hasConsole && (!config.silent)) {
|
||
console.error(("[Vue warn]: " + msg + trace));
|
||
}
|
||
};
|
||
|
||
tip = function (msg, vm) {
|
||
if (hasConsole && (!config.silent)) {
|
||
console.warn("[Vue tip]: " + msg + (
|
||
vm ? generateComponentTrace(vm) : ''
|
||
));
|
||
}
|
||
};
|
||
|
||
formatComponentName = function (vm, includeFile) {
|
||
if (vm.$root === vm) {
|
||
return '<Root>'
|
||
}
|
||
var options = typeof vm === 'function' && vm.cid != null
|
||
? vm.options
|
||
: vm._isVue
|
||
? vm.$options || vm.constructor.options
|
||
: vm;
|
||
var name = options.name || options._componentTag;
|
||
var file = options.__file;
|
||
if (!name && file) {
|
||
var match = file.match(/([^/\\]+)\.vue$/);
|
||
name = match && match[1];
|
||
}
|
||
|
||
return (
|
||
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
||
(file && includeFile !== false ? (" at " + file) : '')
|
||
)
|
||
};
|
||
|
||
var repeat = function (str, n) {
|
||
var res = '';
|
||
while (n) {
|
||
if (n % 2 === 1) { res += str; }
|
||
if (n > 1) { str += str; }
|
||
n >>= 1;
|
||
}
|
||
return res
|
||
};
|
||
|
||
generateComponentTrace = function (vm) {
|
||
if (vm._isVue && vm.$parent) {
|
||
var tree = [];
|
||
var currentRecursiveSequence = 0;
|
||
while (vm) {
|
||
if (tree.length > 0) {
|
||
var last = tree[tree.length - 1];
|
||
if (last.constructor === vm.constructor) {
|
||
currentRecursiveSequence++;
|
||
vm = vm.$parent;
|
||
continue
|
||
} else if (currentRecursiveSequence > 0) {
|
||
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
||
currentRecursiveSequence = 0;
|
||
}
|
||
}
|
||
tree.push(vm);
|
||
vm = vm.$parent;
|
||
}
|
||
return '\n\nfound in\n\n' + tree
|
||
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
||
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
||
: formatComponentName(vm))); })
|
||
.join('\n')
|
||
} else {
|
||
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
||
}
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
var uid = 0;
|
||
|
||
/**
|
||
* A dep is an observable that can have multiple
|
||
* directives subscribing to it.
|
||
*/
|
||
var Dep = function Dep () {
|
||
this.id = uid++;
|
||
this.subs = [];
|
||
};
|
||
|
||
Dep.prototype.addSub = function addSub (sub) {
|
||
this.subs.push(sub);
|
||
};
|
||
|
||
Dep.prototype.removeSub = function removeSub (sub) {
|
||
remove(this.subs, sub);
|
||
};
|
||
|
||
Dep.prototype.depend = function depend () {
|
||
if (Dep.target) {
|
||
Dep.target.addDep(this);
|
||
}
|
||
};
|
||
|
||
Dep.prototype.notify = function notify () {
|
||
// stabilize the subscriber list first
|
||
var subs = this.subs.slice();
|
||
if (!config.async) {
|
||
// subs aren't sorted in scheduler if not running async
|
||
// we need to sort them now to make sure they fire in correct
|
||
// order
|
||
subs.sort(function (a, b) { return a.id - b.id; });
|
||
}
|
||
for (var i = 0, l = subs.length; i < l; i++) {
|
||
subs[i].update();
|
||
}
|
||
};
|
||
|
||
// The current target watcher being evaluated.
|
||
// This is globally unique because only one watcher
|
||
// can be evaluated at a time.
|
||
Dep.target = null;
|
||
var targetStack = [];
|
||
|
||
function pushTarget (target) {
|
||
targetStack.push(target);
|
||
Dep.target = target;
|
||
}
|
||
|
||
function popTarget () {
|
||
targetStack.pop();
|
||
Dep.target = targetStack[targetStack.length - 1];
|
||
}
|
||
|
||
/* */
|
||
|
||
var VNode = function VNode (
|
||
tag,
|
||
data,
|
||
children,
|
||
text,
|
||
elm,
|
||
context,
|
||
componentOptions,
|
||
asyncFactory
|
||
) {
|
||
this.tag = tag;
|
||
this.data = data;
|
||
this.children = children;
|
||
this.text = text;
|
||
this.elm = elm;
|
||
this.ns = undefined;
|
||
this.context = context;
|
||
this.fnContext = undefined;
|
||
this.fnOptions = undefined;
|
||
this.fnScopeId = undefined;
|
||
this.key = data && data.key;
|
||
this.componentOptions = componentOptions;
|
||
this.componentInstance = undefined;
|
||
this.parent = undefined;
|
||
this.raw = false;
|
||
this.isStatic = false;
|
||
this.isRootInsert = true;
|
||
this.isComment = false;
|
||
this.isCloned = false;
|
||
this.isOnce = false;
|
||
this.asyncFactory = asyncFactory;
|
||
this.asyncMeta = undefined;
|
||
this.isAsyncPlaceholder = false;
|
||
};
|
||
|
||
var prototypeAccessors = { child: { configurable: true } };
|
||
|
||
// DEPRECATED: alias for componentInstance for backwards compat.
|
||
/* istanbul ignore next */
|
||
prototypeAccessors.child.get = function () {
|
||
return this.componentInstance
|
||
};
|
||
|
||
Object.defineProperties( VNode.prototype, prototypeAccessors );
|
||
|
||
var createEmptyVNode = function (text) {
|
||
if ( text === void 0 ) text = '';
|
||
|
||
var node = new VNode();
|
||
node.text = text;
|
||
node.isComment = true;
|
||
return node
|
||
};
|
||
|
||
function createTextVNode (val) {
|
||
return new VNode(undefined, undefined, undefined, String(val))
|
||
}
|
||
|
||
// optimized shallow clone
|
||
// used for static nodes and slot nodes because they may be reused across
|
||
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
||
// on their elm reference.
|
||
function cloneVNode (vnode) {
|
||
var cloned = new VNode(
|
||
vnode.tag,
|
||
vnode.data,
|
||
// #7975
|
||
// clone children array to avoid mutating original in case of cloning
|
||
// a child.
|
||
vnode.children && vnode.children.slice(),
|
||
vnode.text,
|
||
vnode.elm,
|
||
vnode.context,
|
||
vnode.componentOptions,
|
||
vnode.asyncFactory
|
||
);
|
||
cloned.ns = vnode.ns;
|
||
cloned.isStatic = vnode.isStatic;
|
||
cloned.key = vnode.key;
|
||
cloned.isComment = vnode.isComment;
|
||
cloned.fnContext = vnode.fnContext;
|
||
cloned.fnOptions = vnode.fnOptions;
|
||
cloned.fnScopeId = vnode.fnScopeId;
|
||
cloned.asyncMeta = vnode.asyncMeta;
|
||
cloned.isCloned = true;
|
||
return cloned
|
||
}
|
||
|
||
/*
|
||
* not type checking this file because flow doesn't play well with
|
||
* dynamically accessing methods on Array prototype
|
||
*/
|
||
|
||
var arrayProto = Array.prototype;
|
||
var arrayMethods = Object.create(arrayProto);
|
||
|
||
var methodsToPatch = [
|
||
'push',
|
||
'pop',
|
||
'shift',
|
||
'unshift',
|
||
'splice',
|
||
'sort',
|
||
'reverse'
|
||
];
|
||
|
||
/**
|
||
* Intercept mutating methods and emit events
|
||
*/
|
||
methodsToPatch.forEach(function (method) {
|
||
// cache original method
|
||
var original = arrayProto[method];
|
||
def(arrayMethods, method, function mutator () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
var result = original.apply(this, args);
|
||
var ob = this.__ob__;
|
||
var inserted;
|
||
switch (method) {
|
||
case 'push':
|
||
case 'unshift':
|
||
inserted = args;
|
||
break
|
||
case 'splice':
|
||
inserted = args.slice(2);
|
||
break
|
||
}
|
||
if (inserted) { ob.observeArray(inserted); }
|
||
// notify change
|
||
ob.dep.notify();
|
||
return result
|
||
});
|
||
});
|
||
|
||
/* */
|
||
|
||
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
||
|
||
/**
|
||
* In some cases we may want to disable observation inside a component's
|
||
* update computation.
|
||
*/
|
||
var shouldObserve = true;
|
||
|
||
function toggleObserving (value) {
|
||
shouldObserve = value;
|
||
}
|
||
|
||
/**
|
||
* Observer class that is attached to each observed
|
||
* object. Once attached, the observer converts the target
|
||
* object's property keys into getter/setters that
|
||
* collect dependencies and dispatch updates.
|
||
*/
|
||
var Observer = function Observer (value) {
|
||
this.value = value;
|
||
this.dep = new Dep();
|
||
this.vmCount = 0;
|
||
def(value, '__ob__', this);
|
||
if (Array.isArray(value)) {
|
||
if (hasProto) {
|
||
protoAugment(value, arrayMethods);
|
||
} else {
|
||
copyAugment(value, arrayMethods, arrayKeys);
|
||
}
|
||
this.observeArray(value);
|
||
} else {
|
||
this.walk(value);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Walk through all properties and convert them into
|
||
* getter/setters. This method should only be called when
|
||
* value type is Object.
|
||
*/
|
||
Observer.prototype.walk = function walk (obj) {
|
||
var keys = Object.keys(obj);
|
||
for (var i = 0; i < keys.length; i++) {
|
||
defineReactive$$1(obj, keys[i]);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Observe a list of Array items.
|
||
*/
|
||
Observer.prototype.observeArray = function observeArray (items) {
|
||
for (var i = 0, l = items.length; i < l; i++) {
|
||
observe(items[i]);
|
||
}
|
||
};
|
||
|
||
// helpers
|
||
|
||
/**
|
||
* Augment a target Object or Array by intercepting
|
||
* the prototype chain using __proto__
|
||
*/
|
||
function protoAugment (target, src) {
|
||
/* eslint-disable no-proto */
|
||
target.__proto__ = src;
|
||
/* eslint-enable no-proto */
|
||
}
|
||
|
||
/**
|
||
* Augment a target Object or Array by defining
|
||
* hidden properties.
|
||
*/
|
||
/* istanbul ignore next */
|
||
function copyAugment (target, src, keys) {
|
||
for (var i = 0, l = keys.length; i < l; i++) {
|
||
var key = keys[i];
|
||
def(target, key, src[key]);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Attempt to create an observer instance for a value,
|
||
* returns the new observer if successfully observed,
|
||
* or the existing observer if the value already has one.
|
||
*/
|
||
function observe (value, asRootData) {
|
||
if (!isObject(value) || value instanceof VNode) {
|
||
return
|
||
}
|
||
var ob;
|
||
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
||
ob = value.__ob__;
|
||
} else if (
|
||
shouldObserve &&
|
||
!isServerRendering() &&
|
||
(Array.isArray(value) || isPlainObject(value)) &&
|
||
Object.isExtensible(value) &&
|
||
!value._isVue
|
||
) {
|
||
ob = new Observer(value);
|
||
}
|
||
if (asRootData && ob) {
|
||
ob.vmCount++;
|
||
}
|
||
return ob
|
||
}
|
||
|
||
/**
|
||
* Define a reactive property on an Object.
|
||
*/
|
||
function defineReactive$$1 (
|
||
obj,
|
||
key,
|
||
val,
|
||
customSetter,
|
||
shallow
|
||
) {
|
||
var dep = new Dep();
|
||
|
||
var property = Object.getOwnPropertyDescriptor(obj, key);
|
||
if (property && property.configurable === false) {
|
||
return
|
||
}
|
||
|
||
// cater for pre-defined getter/setters
|
||
var getter = property && property.get;
|
||
var setter = property && property.set;
|
||
if ((!getter || setter) && arguments.length === 2) {
|
||
val = obj[key];
|
||
}
|
||
|
||
var childOb = !shallow && observe(val);
|
||
Object.defineProperty(obj, key, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function reactiveGetter () {
|
||
var value = getter ? getter.call(obj) : val;
|
||
if (Dep.target) {
|
||
dep.depend();
|
||
if (childOb) {
|
||
childOb.dep.depend();
|
||
if (Array.isArray(value)) {
|
||
dependArray(value);
|
||
}
|
||
}
|
||
}
|
||
return value
|
||
},
|
||
set: function reactiveSetter (newVal) {
|
||
var value = getter ? getter.call(obj) : val;
|
||
/* eslint-disable no-self-compare */
|
||
if (newVal === value || (newVal !== newVal && value !== value)) {
|
||
return
|
||
}
|
||
/* eslint-enable no-self-compare */
|
||
if (customSetter) {
|
||
customSetter();
|
||
}
|
||
// #7981: for accessor properties without setter
|
||
if (getter && !setter) { return }
|
||
if (setter) {
|
||
setter.call(obj, newVal);
|
||
} else {
|
||
val = newVal;
|
||
}
|
||
childOb = !shallow && observe(newVal);
|
||
dep.notify();
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Set a property on an object. Adds the new property and
|
||
* triggers change notification if the property doesn't
|
||
* already exist.
|
||
*/
|
||
function set (target, key, val) {
|
||
if (isUndef(target) || isPrimitive(target)
|
||
) {
|
||
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
||
}
|
||
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
||
target.length = Math.max(target.length, key);
|
||
target.splice(key, 1, val);
|
||
return val
|
||
}
|
||
if (key in target && !(key in Object.prototype)) {
|
||
target[key] = val;
|
||
return val
|
||
}
|
||
var ob = (target).__ob__;
|
||
if (target._isVue || (ob && ob.vmCount)) {
|
||
warn(
|
||
'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
||
'at runtime - declare it upfront in the data option.'
|
||
);
|
||
return val
|
||
}
|
||
if (!ob) {
|
||
target[key] = val;
|
||
return val
|
||
}
|
||
defineReactive$$1(ob.value, key, val);
|
||
ob.dep.notify();
|
||
return val
|
||
}
|
||
|
||
/**
|
||
* Delete a property and trigger change if necessary.
|
||
*/
|
||
function del (target, key) {
|
||
if (isUndef(target) || isPrimitive(target)
|
||
) {
|
||
warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
||
}
|
||
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
||
target.splice(key, 1);
|
||
return
|
||
}
|
||
var ob = (target).__ob__;
|
||
if (target._isVue || (ob && ob.vmCount)) {
|
||
warn(
|
||
'Avoid deleting properties on a Vue instance or its root $data ' +
|
||
'- just set it to null.'
|
||
);
|
||
return
|
||
}
|
||
if (!hasOwn(target, key)) {
|
||
return
|
||
}
|
||
delete target[key];
|
||
if (!ob) {
|
||
return
|
||
}
|
||
ob.dep.notify();
|
||
}
|
||
|
||
/**
|
||
* Collect dependencies on array elements when the array is touched, since
|
||
* we cannot intercept array element access like property getters.
|
||
*/
|
||
function dependArray (value) {
|
||
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
||
e = value[i];
|
||
e && e.__ob__ && e.__ob__.dep.depend();
|
||
if (Array.isArray(e)) {
|
||
dependArray(e);
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Option overwriting strategies are functions that handle
|
||
* how to merge a parent option value and a child option
|
||
* value into the final value.
|
||
*/
|
||
var strats = config.optionMergeStrategies;
|
||
|
||
/**
|
||
* Options with restrictions
|
||
*/
|
||
{
|
||
strats.el = strats.propsData = function (parent, child, vm, key) {
|
||
if (!vm) {
|
||
warn(
|
||
"option \"" + key + "\" can only be used during instance " +
|
||
'creation with the `new` keyword.'
|
||
);
|
||
}
|
||
return defaultStrat(parent, child)
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Helper that recursively merges two data objects together.
|
||
*/
|
||
function mergeData (to, from) {
|
||
if (!from) { return to }
|
||
var key, toVal, fromVal;
|
||
|
||
var keys = hasSymbol
|
||
? Reflect.ownKeys(from)
|
||
: Object.keys(from);
|
||
|
||
for (var i = 0; i < keys.length; i++) {
|
||
key = keys[i];
|
||
// in case the object is already observed...
|
||
if (key === '__ob__') { continue }
|
||
toVal = to[key];
|
||
fromVal = from[key];
|
||
if (!hasOwn(to, key)) {
|
||
set(to, key, fromVal);
|
||
} else if (
|
||
toVal !== fromVal &&
|
||
isPlainObject(toVal) &&
|
||
isPlainObject(fromVal)
|
||
) {
|
||
mergeData(toVal, fromVal);
|
||
}
|
||
}
|
||
return to
|
||
}
|
||
|
||
/**
|
||
* Data
|
||
*/
|
||
function mergeDataOrFn (
|
||
parentVal,
|
||
childVal,
|
||
vm
|
||
) {
|
||
if (!vm) {
|
||
// in a Vue.extend merge, both should be functions
|
||
if (!childVal) {
|
||
return parentVal
|
||
}
|
||
if (!parentVal) {
|
||
return childVal
|
||
}
|
||
// when parentVal & childVal are both present,
|
||
// we need to return a function that returns the
|
||
// merged result of both functions... no need to
|
||
// check if parentVal is a function here because
|
||
// it has to be a function to pass previous merges.
|
||
return function mergedDataFn () {
|
||
return mergeData(
|
||
typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
||
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
||
)
|
||
}
|
||
} else {
|
||
return function mergedInstanceDataFn () {
|
||
// instance merge
|
||
var instanceData = typeof childVal === 'function'
|
||
? childVal.call(vm, vm)
|
||
: childVal;
|
||
var defaultData = typeof parentVal === 'function'
|
||
? parentVal.call(vm, vm)
|
||
: parentVal;
|
||
if (instanceData) {
|
||
return mergeData(instanceData, defaultData)
|
||
} else {
|
||
return defaultData
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
strats.data = function (
|
||
parentVal,
|
||
childVal,
|
||
vm
|
||
) {
|
||
if (!vm) {
|
||
if (childVal && typeof childVal !== 'function') {
|
||
warn(
|
||
'The "data" option should be a function ' +
|
||
'that returns a per-instance value in component ' +
|
||
'definitions.',
|
||
vm
|
||
);
|
||
|
||
return parentVal
|
||
}
|
||
return mergeDataOrFn(parentVal, childVal)
|
||
}
|
||
|
||
return mergeDataOrFn(parentVal, childVal, vm)
|
||
};
|
||
|
||
/**
|
||
* Hooks and props are merged as arrays.
|
||
*/
|
||
function mergeHook (
|
||
parentVal,
|
||
childVal
|
||
) {
|
||
var res = childVal
|
||
? parentVal
|
||
? parentVal.concat(childVal)
|
||
: Array.isArray(childVal)
|
||
? childVal
|
||
: [childVal]
|
||
: parentVal;
|
||
return res
|
||
? dedupeHooks(res)
|
||
: res
|
||
}
|
||
|
||
function dedupeHooks (hooks) {
|
||
var res = [];
|
||
for (var i = 0; i < hooks.length; i++) {
|
||
if (res.indexOf(hooks[i]) === -1) {
|
||
res.push(hooks[i]);
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
LIFECYCLE_HOOKS.forEach(function (hook) {
|
||
strats[hook] = mergeHook;
|
||
});
|
||
|
||
/**
|
||
* Assets
|
||
*
|
||
* When a vm is present (instance creation), we need to do
|
||
* a three-way merge between constructor options, instance
|
||
* options and parent options.
|
||
*/
|
||
function mergeAssets (
|
||
parentVal,
|
||
childVal,
|
||
vm,
|
||
key
|
||
) {
|
||
var res = Object.create(parentVal || null);
|
||
if (childVal) {
|
||
assertObjectType(key, childVal, vm);
|
||
return extend(res, childVal)
|
||
} else {
|
||
return res
|
||
}
|
||
}
|
||
|
||
ASSET_TYPES.forEach(function (type) {
|
||
strats[type + 's'] = mergeAssets;
|
||
});
|
||
|
||
/**
|
||
* Watchers.
|
||
*
|
||
* Watchers hashes should not overwrite one
|
||
* another, so we merge them as arrays.
|
||
*/
|
||
strats.watch = function (
|
||
parentVal,
|
||
childVal,
|
||
vm,
|
||
key
|
||
) {
|
||
// work around Firefox's Object.prototype.watch...
|
||
if (parentVal === nativeWatch) { parentVal = undefined; }
|
||
if (childVal === nativeWatch) { childVal = undefined; }
|
||
/* istanbul ignore if */
|
||
if (!childVal) { return Object.create(parentVal || null) }
|
||
{
|
||
assertObjectType(key, childVal, vm);
|
||
}
|
||
if (!parentVal) { return childVal }
|
||
var ret = {};
|
||
extend(ret, parentVal);
|
||
for (var key$1 in childVal) {
|
||
var parent = ret[key$1];
|
||
var child = childVal[key$1];
|
||
if (parent && !Array.isArray(parent)) {
|
||
parent = [parent];
|
||
}
|
||
ret[key$1] = parent
|
||
? parent.concat(child)
|
||
: Array.isArray(child) ? child : [child];
|
||
}
|
||
return ret
|
||
};
|
||
|
||
/**
|
||
* Other object hashes.
|
||
*/
|
||
strats.props =
|
||
strats.methods =
|
||
strats.inject =
|
||
strats.computed = function (
|
||
parentVal,
|
||
childVal,
|
||
vm,
|
||
key
|
||
) {
|
||
if (childVal && "development" !== 'production') {
|
||
assertObjectType(key, childVal, vm);
|
||
}
|
||
if (!parentVal) { return childVal }
|
||
var ret = Object.create(null);
|
||
extend(ret, parentVal);
|
||
if (childVal) { extend(ret, childVal); }
|
||
return ret
|
||
};
|
||
strats.provide = mergeDataOrFn;
|
||
|
||
/**
|
||
* Default strategy.
|
||
*/
|
||
var defaultStrat = function (parentVal, childVal) {
|
||
return childVal === undefined
|
||
? parentVal
|
||
: childVal
|
||
};
|
||
|
||
/**
|
||
* Validate component names
|
||
*/
|
||
function checkComponents (options) {
|
||
for (var key in options.components) {
|
||
validateComponentName(key);
|
||
}
|
||
}
|
||
|
||
function validateComponentName (name) {
|
||
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
||
warn(
|
||
'Invalid component name: "' + name + '". Component names ' +
|
||
'should conform to valid custom element name in html5 specification.'
|
||
);
|
||
}
|
||
if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
||
warn(
|
||
'Do not use built-in or reserved HTML elements as component ' +
|
||
'id: ' + name
|
||
);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Ensure all props option syntax are normalized into the
|
||
* Object-based format.
|
||
*/
|
||
function normalizeProps (options, vm) {
|
||
var props = options.props;
|
||
if (!props) { return }
|
||
var res = {};
|
||
var i, val, name;
|
||
if (Array.isArray(props)) {
|
||
i = props.length;
|
||
while (i--) {
|
||
val = props[i];
|
||
if (typeof val === 'string') {
|
||
name = camelize(val);
|
||
res[name] = { type: null };
|
||
} else {
|
||
warn('props must be strings when using array syntax.');
|
||
}
|
||
}
|
||
} else if (isPlainObject(props)) {
|
||
for (var key in props) {
|
||
val = props[key];
|
||
name = camelize(key);
|
||
res[name] = isPlainObject(val)
|
||
? val
|
||
: { type: val };
|
||
}
|
||
} else {
|
||
warn(
|
||
"Invalid value for option \"props\": expected an Array or an Object, " +
|
||
"but got " + (toRawType(props)) + ".",
|
||
vm
|
||
);
|
||
}
|
||
options.props = res;
|
||
}
|
||
|
||
/**
|
||
* Normalize all injections into Object-based format
|
||
*/
|
||
function normalizeInject (options, vm) {
|
||
var inject = options.inject;
|
||
if (!inject) { return }
|
||
var normalized = options.inject = {};
|
||
if (Array.isArray(inject)) {
|
||
for (var i = 0; i < inject.length; i++) {
|
||
normalized[inject[i]] = { from: inject[i] };
|
||
}
|
||
} else if (isPlainObject(inject)) {
|
||
for (var key in inject) {
|
||
var val = inject[key];
|
||
normalized[key] = isPlainObject(val)
|
||
? extend({ from: key }, val)
|
||
: { from: val };
|
||
}
|
||
} else {
|
||
warn(
|
||
"Invalid value for option \"inject\": expected an Array or an Object, " +
|
||
"but got " + (toRawType(inject)) + ".",
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Normalize raw function directives into object format.
|
||
*/
|
||
function normalizeDirectives (options) {
|
||
var dirs = options.directives;
|
||
if (dirs) {
|
||
for (var key in dirs) {
|
||
var def$$1 = dirs[key];
|
||
if (typeof def$$1 === 'function') {
|
||
dirs[key] = { bind: def$$1, update: def$$1 };
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function assertObjectType (name, value, vm) {
|
||
if (!isPlainObject(value)) {
|
||
warn(
|
||
"Invalid value for option \"" + name + "\": expected an Object, " +
|
||
"but got " + (toRawType(value)) + ".",
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Merge two option objects into a new one.
|
||
* Core utility used in both instantiation and inheritance.
|
||
*/
|
||
function mergeOptions (
|
||
parent,
|
||
child,
|
||
vm
|
||
) {
|
||
{
|
||
checkComponents(child);
|
||
}
|
||
|
||
if (typeof child === 'function') {
|
||
child = child.options;
|
||
}
|
||
|
||
normalizeProps(child, vm);
|
||
normalizeInject(child, vm);
|
||
normalizeDirectives(child);
|
||
|
||
// Apply extends and mixins on the child options,
|
||
// but only if it is a raw options object that isn't
|
||
// the result of another mergeOptions call.
|
||
// Only merged options has the _base property.
|
||
if (!child._base) {
|
||
if (child.extends) {
|
||
parent = mergeOptions(parent, child.extends, vm);
|
||
}
|
||
if (child.mixins) {
|
||
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
||
parent = mergeOptions(parent, child.mixins[i], vm);
|
||
}
|
||
}
|
||
}
|
||
|
||
var options = {};
|
||
var key;
|
||
for (key in parent) {
|
||
mergeField(key);
|
||
}
|
||
for (key in child) {
|
||
if (!hasOwn(parent, key)) {
|
||
mergeField(key);
|
||
}
|
||
}
|
||
function mergeField (key) {
|
||
var strat = strats[key] || defaultStrat;
|
||
options[key] = strat(parent[key], child[key], vm, key);
|
||
}
|
||
return options
|
||
}
|
||
|
||
/**
|
||
* Resolve an asset.
|
||
* This function is used because child instances need access
|
||
* to assets defined in its ancestor chain.
|
||
*/
|
||
function resolveAsset (
|
||
options,
|
||
type,
|
||
id,
|
||
warnMissing
|
||
) {
|
||
/* istanbul ignore if */
|
||
if (typeof id !== 'string') {
|
||
return
|
||
}
|
||
var assets = options[type];
|
||
// check local registration variations first
|
||
if (hasOwn(assets, id)) { return assets[id] }
|
||
var camelizedId = camelize(id);
|
||
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
||
var PascalCaseId = capitalize(camelizedId);
|
||
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
||
// fallback to prototype chain
|
||
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
||
if (warnMissing && !res) {
|
||
warn(
|
||
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
||
options
|
||
);
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
function validateProp (
|
||
key,
|
||
propOptions,
|
||
propsData,
|
||
vm
|
||
) {
|
||
var prop = propOptions[key];
|
||
var absent = !hasOwn(propsData, key);
|
||
var value = propsData[key];
|
||
// boolean casting
|
||
var booleanIndex = getTypeIndex(Boolean, prop.type);
|
||
if (booleanIndex > -1) {
|
||
if (absent && !hasOwn(prop, 'default')) {
|
||
value = false;
|
||
} else if (value === '' || value === hyphenate(key)) {
|
||
// only cast empty string / same name to boolean if
|
||
// boolean has higher priority
|
||
var stringIndex = getTypeIndex(String, prop.type);
|
||
if (stringIndex < 0 || booleanIndex < stringIndex) {
|
||
value = true;
|
||
}
|
||
}
|
||
}
|
||
// check default value
|
||
if (value === undefined) {
|
||
value = getPropDefaultValue(vm, prop, key);
|
||
// since the default value is a fresh copy,
|
||
// make sure to observe it.
|
||
var prevShouldObserve = shouldObserve;
|
||
toggleObserving(true);
|
||
observe(value);
|
||
toggleObserving(prevShouldObserve);
|
||
}
|
||
{
|
||
assertProp(prop, key, value, vm, absent);
|
||
}
|
||
return value
|
||
}
|
||
|
||
/**
|
||
* Get the default value of a prop.
|
||
*/
|
||
function getPropDefaultValue (vm, prop, key) {
|
||
// no default, return undefined
|
||
if (!hasOwn(prop, 'default')) {
|
||
return undefined
|
||
}
|
||
var def = prop.default;
|
||
// warn against non-factory defaults for Object & Array
|
||
if (isObject(def)) {
|
||
warn(
|
||
'Invalid default value for prop "' + key + '": ' +
|
||
'Props with type Object/Array must use a factory function ' +
|
||
'to return the default value.',
|
||
vm
|
||
);
|
||
}
|
||
// the raw prop value was also undefined from previous render,
|
||
// return previous default value to avoid unnecessary watcher trigger
|
||
if (vm && vm.$options.propsData &&
|
||
vm.$options.propsData[key] === undefined &&
|
||
vm._props[key] !== undefined
|
||
) {
|
||
return vm._props[key]
|
||
}
|
||
// call factory function for non-Function types
|
||
// a value is Function if its prototype is function even across different execution context
|
||
return typeof def === 'function' && getType(prop.type) !== 'Function'
|
||
? def.call(vm)
|
||
: def
|
||
}
|
||
|
||
/**
|
||
* Assert whether a prop is valid.
|
||
*/
|
||
function assertProp (
|
||
prop,
|
||
name,
|
||
value,
|
||
vm,
|
||
absent
|
||
) {
|
||
if (prop.required && absent) {
|
||
warn(
|
||
'Missing required prop: "' + name + '"',
|
||
vm
|
||
);
|
||
return
|
||
}
|
||
if (value == null && !prop.required) {
|
||
return
|
||
}
|
||
var type = prop.type;
|
||
var valid = !type || type === true;
|
||
var expectedTypes = [];
|
||
if (type) {
|
||
if (!Array.isArray(type)) {
|
||
type = [type];
|
||
}
|
||
for (var i = 0; i < type.length && !valid; i++) {
|
||
var assertedType = assertType(value, type[i]);
|
||
expectedTypes.push(assertedType.expectedType || '');
|
||
valid = assertedType.valid;
|
||
}
|
||
}
|
||
|
||
if (!valid) {
|
||
warn(
|
||
getInvalidTypeMessage(name, value, expectedTypes),
|
||
vm
|
||
);
|
||
return
|
||
}
|
||
var validator = prop.validator;
|
||
if (validator) {
|
||
if (!validator(value)) {
|
||
warn(
|
||
'Invalid prop: custom validator check failed for prop "' + name + '".',
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
||
|
||
function assertType (value, type) {
|
||
var valid;
|
||
var expectedType = getType(type);
|
||
if (simpleCheckRE.test(expectedType)) {
|
||
var t = typeof value;
|
||
valid = t === expectedType.toLowerCase();
|
||
// for primitive wrapper objects
|
||
if (!valid && t === 'object') {
|
||
valid = value instanceof type;
|
||
}
|
||
} else if (expectedType === 'Object') {
|
||
valid = isPlainObject(value);
|
||
} else if (expectedType === 'Array') {
|
||
valid = Array.isArray(value);
|
||
} else {
|
||
valid = value instanceof type;
|
||
}
|
||
return {
|
||
valid: valid,
|
||
expectedType: expectedType
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Use function string name to check built-in types,
|
||
* because a simple equality check will fail when running
|
||
* across different vms / iframes.
|
||
*/
|
||
function getType (fn) {
|
||
var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
||
return match ? match[1] : ''
|
||
}
|
||
|
||
function isSameType (a, b) {
|
||
return getType(a) === getType(b)
|
||
}
|
||
|
||
function getTypeIndex (type, expectedTypes) {
|
||
if (!Array.isArray(expectedTypes)) {
|
||
return isSameType(expectedTypes, type) ? 0 : -1
|
||
}
|
||
for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
||
if (isSameType(expectedTypes[i], type)) {
|
||
return i
|
||
}
|
||
}
|
||
return -1
|
||
}
|
||
|
||
function getInvalidTypeMessage (name, value, expectedTypes) {
|
||
var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
||
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
||
var expectedType = expectedTypes[0];
|
||
var receivedType = toRawType(value);
|
||
var expectedValue = styleValue(value, expectedType);
|
||
var receivedValue = styleValue(value, receivedType);
|
||
// check if we need to specify expected value
|
||
if (expectedTypes.length === 1 &&
|
||
isExplicable(expectedType) &&
|
||
!isBoolean(expectedType, receivedType)) {
|
||
message += " with value " + expectedValue;
|
||
}
|
||
message += ", got " + receivedType + " ";
|
||
// check if we need to specify received value
|
||
if (isExplicable(receivedType)) {
|
||
message += "with value " + receivedValue + ".";
|
||
}
|
||
return message
|
||
}
|
||
|
||
function styleValue (value, type) {
|
||
if (type === 'String') {
|
||
return ("\"" + value + "\"")
|
||
} else if (type === 'Number') {
|
||
return ("" + (Number(value)))
|
||
} else {
|
||
return ("" + value)
|
||
}
|
||
}
|
||
|
||
function isExplicable (value) {
|
||
var explicitTypes = ['string', 'number', 'boolean'];
|
||
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
||
}
|
||
|
||
function isBoolean () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
||
}
|
||
|
||
/* */
|
||
|
||
function handleError (err, vm, info) {
|
||
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
|
||
// See: https://github.com/vuejs/vuex/issues/1505
|
||
pushTarget();
|
||
try {
|
||
if (vm) {
|
||
var cur = vm;
|
||
while ((cur = cur.$parent)) {
|
||
var hooks = cur.$options.errorCaptured;
|
||
if (hooks) {
|
||
for (var i = 0; i < hooks.length; i++) {
|
||
try {
|
||
var capture = hooks[i].call(cur, err, vm, info) === false;
|
||
if (capture) { return }
|
||
} catch (e) {
|
||
globalHandleError(e, cur, 'errorCaptured hook');
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
globalHandleError(err, vm, info);
|
||
} finally {
|
||
popTarget();
|
||
}
|
||
}
|
||
|
||
function invokeWithErrorHandling (
|
||
handler,
|
||
context,
|
||
args,
|
||
vm,
|
||
info
|
||
) {
|
||
var res;
|
||
try {
|
||
res = args ? handler.apply(context, args) : handler.call(context);
|
||
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
||
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
||
// issue #9511
|
||
// avoid catch triggering multiple times when nested calls
|
||
res._handled = true;
|
||
}
|
||
} catch (e) {
|
||
handleError(e, vm, info);
|
||
}
|
||
return res
|
||
}
|
||
|
||
function globalHandleError (err, vm, info) {
|
||
if (config.errorHandler) {
|
||
try {
|
||
return config.errorHandler.call(null, err, vm, info)
|
||
} catch (e) {
|
||
// if the user intentionally throws the original error in the handler,
|
||
// do not log it twice
|
||
if (e !== err) {
|
||
logError(e, null, 'config.errorHandler');
|
||
}
|
||
}
|
||
}
|
||
logError(err, vm, info);
|
||
}
|
||
|
||
function logError (err, vm, info) {
|
||
{
|
||
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
||
}
|
||
/* istanbul ignore else */
|
||
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
||
console.error(err);
|
||
} else {
|
||
throw err
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var isUsingMicroTask = false;
|
||
|
||
var callbacks = [];
|
||
var pending = false;
|
||
|
||
function flushCallbacks () {
|
||
pending = false;
|
||
var copies = callbacks.slice(0);
|
||
callbacks.length = 0;
|
||
for (var i = 0; i < copies.length; i++) {
|
||
copies[i]();
|
||
}
|
||
}
|
||
|
||
// Here we have async deferring wrappers using microtasks.
|
||
// In 2.5 we used (macro) tasks (in combination with microtasks).
|
||
// However, it has subtle problems when state is changed right before repaint
|
||
// (e.g. #6813, out-in transitions).
|
||
// Also, using (macro) tasks in event handler would cause some weird behaviors
|
||
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
|
||
// So we now use microtasks everywhere, again.
|
||
// A major drawback of this tradeoff is that there are some scenarios
|
||
// where microtasks have too high a priority and fire in between supposedly
|
||
// sequential events (e.g. #4521, #6690, which have workarounds)
|
||
// or even between bubbling of the same event (#6566).
|
||
var timerFunc;
|
||
|
||
// The nextTick behavior leverages the microtask queue, which can be accessed
|
||
// via either native Promise.then or MutationObserver.
|
||
// MutationObserver has wider support, however it is seriously bugged in
|
||
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
|
||
// completely stops working after triggering a few times... so, if native
|
||
// Promise is available, we will use it:
|
||
/* istanbul ignore next, $flow-disable-line */
|
||
if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||
var p = Promise.resolve();
|
||
timerFunc = function () {
|
||
p.then(flushCallbacks);
|
||
// In problematic UIWebViews, Promise.then doesn't completely break, but
|
||
// it can get stuck in a weird state where callbacks are pushed into the
|
||
// microtask queue but the queue isn't being flushed, until the browser
|
||
// needs to do some other work, e.g. handle a timer. Therefore we can
|
||
// "force" the microtask queue to be flushed by adding an empty timer.
|
||
if (isIOS) { setTimeout(noop); }
|
||
};
|
||
isUsingMicroTask = true;
|
||
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
||
isNative(MutationObserver) ||
|
||
// PhantomJS and iOS 7.x
|
||
MutationObserver.toString() === '[object MutationObserverConstructor]'
|
||
)) {
|
||
// Use MutationObserver where native Promise is not available,
|
||
// e.g. PhantomJS, iOS7, Android 4.4
|
||
// (#6466 MutationObserver is unreliable in IE11)
|
||
var counter = 1;
|
||
var observer = new MutationObserver(flushCallbacks);
|
||
var textNode = document.createTextNode(String(counter));
|
||
observer.observe(textNode, {
|
||
characterData: true
|
||
});
|
||
timerFunc = function () {
|
||
counter = (counter + 1) % 2;
|
||
textNode.data = String(counter);
|
||
};
|
||
isUsingMicroTask = true;
|
||
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
||
// Fallback to setImmediate.
|
||
// Techinically it leverages the (macro) task queue,
|
||
// but it is still a better choice than setTimeout.
|
||
timerFunc = function () {
|
||
setImmediate(flushCallbacks);
|
||
};
|
||
} else {
|
||
// Fallback to setTimeout.
|
||
timerFunc = function () {
|
||
setTimeout(flushCallbacks, 0);
|
||
};
|
||
}
|
||
|
||
function nextTick (cb, ctx) {
|
||
var _resolve;
|
||
callbacks.push(function () {
|
||
if (cb) {
|
||
try {
|
||
cb.call(ctx);
|
||
} catch (e) {
|
||
handleError(e, ctx, 'nextTick');
|
||
}
|
||
} else if (_resolve) {
|
||
_resolve(ctx);
|
||
}
|
||
});
|
||
if (!pending) {
|
||
pending = true;
|
||
timerFunc();
|
||
}
|
||
// $flow-disable-line
|
||
if (!cb && typeof Promise !== 'undefined') {
|
||
return new Promise(function (resolve) {
|
||
_resolve = resolve;
|
||
})
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var mark;
|
||
var measure;
|
||
|
||
{
|
||
var perf = inBrowser && window.performance;
|
||
/* istanbul ignore if */
|
||
if (
|
||
perf &&
|
||
perf.mark &&
|
||
perf.measure &&
|
||
perf.clearMarks &&
|
||
perf.clearMeasures
|
||
) {
|
||
mark = function (tag) { return perf.mark(tag); };
|
||
measure = function (name, startTag, endTag) {
|
||
perf.measure(name, startTag, endTag);
|
||
perf.clearMarks(startTag);
|
||
perf.clearMarks(endTag);
|
||
// perf.clearMeasures(name)
|
||
};
|
||
}
|
||
}
|
||
|
||
/* not type checking this file because flow doesn't play well with Proxy */
|
||
|
||
var initProxy;
|
||
|
||
{
|
||
var allowedGlobals = makeMap(
|
||
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
||
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
||
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
||
'require' // for Webpack/Browserify
|
||
);
|
||
|
||
var warnNonPresent = function (target, key) {
|
||
warn(
|
||
"Property or method \"" + key + "\" is not defined on the instance but " +
|
||
'referenced during render. Make sure that this property is reactive, ' +
|
||
'either in the data option, or for class-based components, by ' +
|
||
'initializing the property. ' +
|
||
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
||
target
|
||
);
|
||
};
|
||
|
||
var warnReservedPrefix = function (target, key) {
|
||
warn(
|
||
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
||
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
||
'prevent conflicts with Vue internals' +
|
||
'See: https://vuejs.org/v2/api/#data',
|
||
target
|
||
);
|
||
};
|
||
|
||
var hasProxy =
|
||
typeof Proxy !== 'undefined' && isNative(Proxy);
|
||
|
||
if (hasProxy) {
|
||
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
||
config.keyCodes = new Proxy(config.keyCodes, {
|
||
set: function set (target, key, value) {
|
||
if (isBuiltInModifier(key)) {
|
||
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
||
return false
|
||
} else {
|
||
target[key] = value;
|
||
return true
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
var hasHandler = {
|
||
has: function has (target, key) {
|
||
var has = key in target;
|
||
var isAllowed = allowedGlobals(key) ||
|
||
(typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
||
if (!has && !isAllowed) {
|
||
if (key in target.$data) { warnReservedPrefix(target, key); }
|
||
else { warnNonPresent(target, key); }
|
||
}
|
||
return has || !isAllowed
|
||
}
|
||
};
|
||
|
||
var getHandler = {
|
||
get: function get (target, key) {
|
||
if (typeof key === 'string' && !(key in target)) {
|
||
if (key in target.$data) { warnReservedPrefix(target, key); }
|
||
else { warnNonPresent(target, key); }
|
||
}
|
||
return target[key]
|
||
}
|
||
};
|
||
|
||
initProxy = function initProxy (vm) {
|
||
if (hasProxy) {
|
||
// determine which proxy handler to use
|
||
var options = vm.$options;
|
||
var handlers = options.render && options.render._withStripped
|
||
? getHandler
|
||
: hasHandler;
|
||
vm._renderProxy = new Proxy(vm, handlers);
|
||
} else {
|
||
vm._renderProxy = vm;
|
||
}
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
var seenObjects = new _Set();
|
||
|
||
/**
|
||
* Recursively traverse an object to evoke all converted
|
||
* getters, so that every nested property inside the object
|
||
* is collected as a "deep" dependency.
|
||
*/
|
||
function traverse (val) {
|
||
_traverse(val, seenObjects);
|
||
seenObjects.clear();
|
||
}
|
||
|
||
function _traverse (val, seen) {
|
||
var i, keys;
|
||
var isA = Array.isArray(val);
|
||
if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
||
return
|
||
}
|
||
if (val.__ob__) {
|
||
var depId = val.__ob__.dep.id;
|
||
if (seen.has(depId)) {
|
||
return
|
||
}
|
||
seen.add(depId);
|
||
}
|
||
if (isA) {
|
||
i = val.length;
|
||
while (i--) { _traverse(val[i], seen); }
|
||
} else {
|
||
keys = Object.keys(val);
|
||
i = keys.length;
|
||
while (i--) { _traverse(val[keys[i]], seen); }
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var normalizeEvent = cached(function (name) {
|
||
var passive = name.charAt(0) === '&';
|
||
name = passive ? name.slice(1) : name;
|
||
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
|
||
name = once$$1 ? name.slice(1) : name;
|
||
var capture = name.charAt(0) === '!';
|
||
name = capture ? name.slice(1) : name;
|
||
return {
|
||
name: name,
|
||
once: once$$1,
|
||
capture: capture,
|
||
passive: passive
|
||
}
|
||
});
|
||
|
||
function createFnInvoker (fns, vm) {
|
||
function invoker () {
|
||
var arguments$1 = arguments;
|
||
|
||
var fns = invoker.fns;
|
||
if (Array.isArray(fns)) {
|
||
var cloned = fns.slice();
|
||
for (var i = 0; i < cloned.length; i++) {
|
||
invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
||
}
|
||
} else {
|
||
// return handler return value for single handlers
|
||
return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
||
}
|
||
}
|
||
invoker.fns = fns;
|
||
return invoker
|
||
}
|
||
|
||
function updateListeners (
|
||
on,
|
||
oldOn,
|
||
add,
|
||
remove$$1,
|
||
createOnceHandler,
|
||
vm
|
||
) {
|
||
var name, def$$1, cur, old, event;
|
||
for (name in on) {
|
||
def$$1 = cur = on[name];
|
||
old = oldOn[name];
|
||
event = normalizeEvent(name);
|
||
if (isUndef(cur)) {
|
||
warn(
|
||
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
||
vm
|
||
);
|
||
} else if (isUndef(old)) {
|
||
if (isUndef(cur.fns)) {
|
||
cur = on[name] = createFnInvoker(cur, vm);
|
||
}
|
||
if (isTrue(event.once)) {
|
||
cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
||
}
|
||
add(event.name, cur, event.capture, event.passive, event.params);
|
||
} else if (cur !== old) {
|
||
old.fns = cur;
|
||
on[name] = old;
|
||
}
|
||
}
|
||
for (name in oldOn) {
|
||
if (isUndef(on[name])) {
|
||
event = normalizeEvent(name);
|
||
remove$$1(event.name, oldOn[name], event.capture);
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function mergeVNodeHook (def, hookKey, hook) {
|
||
if (def instanceof VNode) {
|
||
def = def.data.hook || (def.data.hook = {});
|
||
}
|
||
var invoker;
|
||
var oldHook = def[hookKey];
|
||
|
||
function wrappedHook () {
|
||
hook.apply(this, arguments);
|
||
// important: remove merged hook to ensure it's called only once
|
||
// and prevent memory leak
|
||
remove(invoker.fns, wrappedHook);
|
||
}
|
||
|
||
if (isUndef(oldHook)) {
|
||
// no existing hook
|
||
invoker = createFnInvoker([wrappedHook]);
|
||
} else {
|
||
/* istanbul ignore if */
|
||
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
||
// already a merged invoker
|
||
invoker = oldHook;
|
||
invoker.fns.push(wrappedHook);
|
||
} else {
|
||
// existing plain hook
|
||
invoker = createFnInvoker([oldHook, wrappedHook]);
|
||
}
|
||
}
|
||
|
||
invoker.merged = true;
|
||
def[hookKey] = invoker;
|
||
}
|
||
|
||
/* */
|
||
|
||
function extractPropsFromVNodeData (
|
||
data,
|
||
Ctor,
|
||
tag
|
||
) {
|
||
// we are only extracting raw values here.
|
||
// validation and default values are handled in the child
|
||
// component itself.
|
||
var propOptions = Ctor.options.props;
|
||
if (isUndef(propOptions)) {
|
||
return
|
||
}
|
||
var res = {};
|
||
var attrs = data.attrs;
|
||
var props = data.props;
|
||
if (isDef(attrs) || isDef(props)) {
|
||
for (var key in propOptions) {
|
||
var altKey = hyphenate(key);
|
||
{
|
||
var keyInLowerCase = key.toLowerCase();
|
||
if (
|
||
key !== keyInLowerCase &&
|
||
attrs && hasOwn(attrs, keyInLowerCase)
|
||
) {
|
||
tip(
|
||
"Prop \"" + keyInLowerCase + "\" is passed to component " +
|
||
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
||
" \"" + key + "\". " +
|
||
"Note that HTML attributes are case-insensitive and camelCased " +
|
||
"props need to use their kebab-case equivalents when using in-DOM " +
|
||
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
||
);
|
||
}
|
||
}
|
||
checkProp(res, props, key, altKey, true) ||
|
||
checkProp(res, attrs, key, altKey, false);
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
function checkProp (
|
||
res,
|
||
hash,
|
||
key,
|
||
altKey,
|
||
preserve
|
||
) {
|
||
if (isDef(hash)) {
|
||
if (hasOwn(hash, key)) {
|
||
res[key] = hash[key];
|
||
if (!preserve) {
|
||
delete hash[key];
|
||
}
|
||
return true
|
||
} else if (hasOwn(hash, altKey)) {
|
||
res[key] = hash[altKey];
|
||
if (!preserve) {
|
||
delete hash[altKey];
|
||
}
|
||
return true
|
||
}
|
||
}
|
||
return false
|
||
}
|
||
|
||
/* */
|
||
|
||
// The template compiler attempts to minimize the need for normalization by
|
||
// statically analyzing the template at compile time.
|
||
//
|
||
// For plain HTML markup, normalization can be completely skipped because the
|
||
// generated render function is guaranteed to return Array<VNode>. There are
|
||
// two cases where extra normalization is needed:
|
||
|
||
// 1. When the children contains components - because a functional component
|
||
// may return an Array instead of a single root. In this case, just a simple
|
||
// normalization is needed - if any child is an Array, we flatten the whole
|
||
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
||
// because functional components already normalize their own children.
|
||
function simpleNormalizeChildren (children) {
|
||
for (var i = 0; i < children.length; i++) {
|
||
if (Array.isArray(children[i])) {
|
||
return Array.prototype.concat.apply([], children)
|
||
}
|
||
}
|
||
return children
|
||
}
|
||
|
||
// 2. When the children contains constructs that always generated nested Arrays,
|
||
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
||
// with hand-written render functions / JSX. In such cases a full normalization
|
||
// is needed to cater to all possible types of children values.
|
||
function normalizeChildren (children) {
|
||
return isPrimitive(children)
|
||
? [createTextVNode(children)]
|
||
: Array.isArray(children)
|
||
? normalizeArrayChildren(children)
|
||
: undefined
|
||
}
|
||
|
||
function isTextNode (node) {
|
||
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
||
}
|
||
|
||
function normalizeArrayChildren (children, nestedIndex) {
|
||
var res = [];
|
||
var i, c, lastIndex, last;
|
||
for (i = 0; i < children.length; i++) {
|
||
c = children[i];
|
||
if (isUndef(c) || typeof c === 'boolean') { continue }
|
||
lastIndex = res.length - 1;
|
||
last = res[lastIndex];
|
||
// nested
|
||
if (Array.isArray(c)) {
|
||
if (c.length > 0) {
|
||
c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
||
// merge adjacent text nodes
|
||
if (isTextNode(c[0]) && isTextNode(last)) {
|
||
res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
||
c.shift();
|
||
}
|
||
res.push.apply(res, c);
|
||
}
|
||
} else if (isPrimitive(c)) {
|
||
if (isTextNode(last)) {
|
||
// merge adjacent text nodes
|
||
// this is necessary for SSR hydration because text nodes are
|
||
// essentially merged when rendered to HTML strings
|
||
res[lastIndex] = createTextVNode(last.text + c);
|
||
} else if (c !== '') {
|
||
// convert primitive to vnode
|
||
res.push(createTextVNode(c));
|
||
}
|
||
} else {
|
||
if (isTextNode(c) && isTextNode(last)) {
|
||
// merge adjacent text nodes
|
||
res[lastIndex] = createTextVNode(last.text + c.text);
|
||
} else {
|
||
// default key for nested array children (likely generated by v-for)
|
||
if (isTrue(children._isVList) &&
|
||
isDef(c.tag) &&
|
||
isUndef(c.key) &&
|
||
isDef(nestedIndex)) {
|
||
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
||
}
|
||
res.push(c);
|
||
}
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* */
|
||
|
||
function initProvide (vm) {
|
||
var provide = vm.$options.provide;
|
||
if (provide) {
|
||
vm._provided = typeof provide === 'function'
|
||
? provide.call(vm)
|
||
: provide;
|
||
}
|
||
}
|
||
|
||
function initInjections (vm) {
|
||
var result = resolveInject(vm.$options.inject, vm);
|
||
if (result) {
|
||
toggleObserving(false);
|
||
Object.keys(result).forEach(function (key) {
|
||
/* istanbul ignore else */
|
||
{
|
||
defineReactive$$1(vm, key, result[key], function () {
|
||
warn(
|
||
"Avoid mutating an injected value directly since the changes will be " +
|
||
"overwritten whenever the provided component re-renders. " +
|
||
"injection being mutated: \"" + key + "\"",
|
||
vm
|
||
);
|
||
});
|
||
}
|
||
});
|
||
toggleObserving(true);
|
||
}
|
||
}
|
||
|
||
function resolveInject (inject, vm) {
|
||
if (inject) {
|
||
// inject is :any because flow is not smart enough to figure out cached
|
||
var result = Object.create(null);
|
||
var keys = hasSymbol
|
||
? Reflect.ownKeys(inject)
|
||
: Object.keys(inject);
|
||
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
// #6574 in case the inject object is observed...
|
||
if (key === '__ob__') { continue }
|
||
var provideKey = inject[key].from;
|
||
var source = vm;
|
||
while (source) {
|
||
if (source._provided && hasOwn(source._provided, provideKey)) {
|
||
result[key] = source._provided[provideKey];
|
||
break
|
||
}
|
||
source = source.$parent;
|
||
}
|
||
if (!source) {
|
||
if ('default' in inject[key]) {
|
||
var provideDefault = inject[key].default;
|
||
result[key] = typeof provideDefault === 'function'
|
||
? provideDefault.call(vm)
|
||
: provideDefault;
|
||
} else {
|
||
warn(("Injection \"" + key + "\" not found"), vm);
|
||
}
|
||
}
|
||
}
|
||
return result
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
/**
|
||
* Runtime helper for resolving raw children VNodes into a slot object.
|
||
*/
|
||
function resolveSlots (
|
||
children,
|
||
context
|
||
) {
|
||
if (!children || !children.length) {
|
||
return {}
|
||
}
|
||
var slots = {};
|
||
for (var i = 0, l = children.length; i < l; i++) {
|
||
var child = children[i];
|
||
var data = child.data;
|
||
// remove slot attribute if the node is resolved as a Vue slot node
|
||
if (data && data.attrs && data.attrs.slot) {
|
||
delete data.attrs.slot;
|
||
}
|
||
// named slots should only be respected if the vnode was rendered in the
|
||
// same context.
|
||
if ((child.context === context || child.fnContext === context) &&
|
||
data && data.slot != null
|
||
) {
|
||
var name = data.slot;
|
||
var slot = (slots[name] || (slots[name] = []));
|
||
if (child.tag === 'template') {
|
||
slot.push.apply(slot, child.children || []);
|
||
} else {
|
||
slot.push(child);
|
||
}
|
||
} else {
|
||
(slots.default || (slots.default = [])).push(child);
|
||
}
|
||
}
|
||
// ignore slots that contains only whitespace
|
||
for (var name$1 in slots) {
|
||
if (slots[name$1].every(isWhitespace)) {
|
||
delete slots[name$1];
|
||
}
|
||
}
|
||
return slots
|
||
}
|
||
|
||
function isWhitespace (node) {
|
||
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
||
}
|
||
|
||
/* */
|
||
|
||
function normalizeScopedSlots (
|
||
slots,
|
||
normalSlots,
|
||
prevSlots
|
||
) {
|
||
var res;
|
||
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
||
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
||
var key = slots && slots.$key;
|
||
if (!slots) {
|
||
res = {};
|
||
} else if (slots._normalized) {
|
||
// fast path 1: child component re-render only, parent did not change
|
||
return slots._normalized
|
||
} else if (
|
||
isStable &&
|
||
prevSlots &&
|
||
prevSlots !== emptyObject &&
|
||
key === prevSlots.$key &&
|
||
!hasNormalSlots &&
|
||
!prevSlots.$hasNormal
|
||
) {
|
||
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
||
// only need to normalize once
|
||
return prevSlots
|
||
} else {
|
||
res = {};
|
||
for (var key$1 in slots) {
|
||
if (slots[key$1] && key$1[0] !== '$') {
|
||
res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
||
}
|
||
}
|
||
}
|
||
// expose normal slots on scopedSlots
|
||
for (var key$2 in normalSlots) {
|
||
if (!(key$2 in res)) {
|
||
res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
||
}
|
||
}
|
||
// avoriaz seems to mock a non-extensible $scopedSlots object
|
||
// and when that is passed down this would cause an error
|
||
if (slots && Object.isExtensible(slots)) {
|
||
(slots)._normalized = res;
|
||
}
|
||
def(res, '$stable', isStable);
|
||
def(res, '$key', key);
|
||
def(res, '$hasNormal', hasNormalSlots);
|
||
return res
|
||
}
|
||
|
||
function normalizeScopedSlot(normalSlots, key, fn) {
|
||
var normalized = function () {
|
||
var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
||
res = res && typeof res === 'object' && !Array.isArray(res)
|
||
? [res] // single vnode
|
||
: normalizeChildren(res);
|
||
return res && (
|
||
res.length === 0 ||
|
||
(res.length === 1 && res[0].isComment) // #9658
|
||
) ? undefined
|
||
: res
|
||
};
|
||
// this is a slot using the new v-slot syntax without scope. although it is
|
||
// compiled as a scoped slot, render fn users would expect it to be present
|
||
// on this.$slots because the usage is semantically a normal slot.
|
||
if (fn.proxy) {
|
||
Object.defineProperty(normalSlots, key, {
|
||
get: normalized,
|
||
enumerable: true,
|
||
configurable: true
|
||
});
|
||
}
|
||
return normalized
|
||
}
|
||
|
||
function proxyNormalSlot(slots, key) {
|
||
return function () { return slots[key]; }
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Runtime helper for rendering v-for lists.
|
||
*/
|
||
function renderList (
|
||
val,
|
||
render
|
||
) {
|
||
var ret, i, l, keys, key;
|
||
if (Array.isArray(val) || typeof val === 'string') {
|
||
ret = new Array(val.length);
|
||
for (i = 0, l = val.length; i < l; i++) {
|
||
ret[i] = render(val[i], i);
|
||
}
|
||
} else if (typeof val === 'number') {
|
||
ret = new Array(val);
|
||
for (i = 0; i < val; i++) {
|
||
ret[i] = render(i + 1, i);
|
||
}
|
||
} else if (isObject(val)) {
|
||
if (hasSymbol && val[Symbol.iterator]) {
|
||
ret = [];
|
||
var iterator = val[Symbol.iterator]();
|
||
var result = iterator.next();
|
||
while (!result.done) {
|
||
ret.push(render(result.value, ret.length));
|
||
result = iterator.next();
|
||
}
|
||
} else {
|
||
keys = Object.keys(val);
|
||
ret = new Array(keys.length);
|
||
for (i = 0, l = keys.length; i < l; i++) {
|
||
key = keys[i];
|
||
ret[i] = render(val[key], key, i);
|
||
}
|
||
}
|
||
}
|
||
if (!isDef(ret)) {
|
||
ret = [];
|
||
}
|
||
(ret)._isVList = true;
|
||
return ret
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Runtime helper for rendering <slot>
|
||
*/
|
||
function renderSlot (
|
||
name,
|
||
fallback,
|
||
props,
|
||
bindObject
|
||
) {
|
||
var scopedSlotFn = this.$scopedSlots[name];
|
||
var nodes;
|
||
if (scopedSlotFn) { // scoped slot
|
||
props = props || {};
|
||
if (bindObject) {
|
||
if (!isObject(bindObject)) {
|
||
warn(
|
||
'slot v-bind without argument expects an Object',
|
||
this
|
||
);
|
||
}
|
||
props = extend(extend({}, bindObject), props);
|
||
}
|
||
nodes = scopedSlotFn(props) || fallback;
|
||
} else {
|
||
nodes = this.$slots[name] || fallback;
|
||
}
|
||
|
||
var target = props && props.slot;
|
||
if (target) {
|
||
return this.$createElement('template', { slot: target }, nodes)
|
||
} else {
|
||
return nodes
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Runtime helper for resolving filters
|
||
*/
|
||
function resolveFilter (id) {
|
||
return resolveAsset(this.$options, 'filters', id, true) || identity
|
||
}
|
||
|
||
/* */
|
||
|
||
function isKeyNotMatch (expect, actual) {
|
||
if (Array.isArray(expect)) {
|
||
return expect.indexOf(actual) === -1
|
||
} else {
|
||
return expect !== actual
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Runtime helper for checking keyCodes from config.
|
||
* exposed as Vue.prototype._k
|
||
* passing in eventKeyName as last argument separately for backwards compat
|
||
*/
|
||
function checkKeyCodes (
|
||
eventKeyCode,
|
||
key,
|
||
builtInKeyCode,
|
||
eventKeyName,
|
||
builtInKeyName
|
||
) {
|
||
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
||
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
||
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
||
} else if (mappedKeyCode) {
|
||
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
||
} else if (eventKeyName) {
|
||
return hyphenate(eventKeyName) !== key
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Runtime helper for merging v-bind="object" into a VNode's data.
|
||
*/
|
||
function bindObjectProps (
|
||
data,
|
||
tag,
|
||
value,
|
||
asProp,
|
||
isSync
|
||
) {
|
||
if (value) {
|
||
if (!isObject(value)) {
|
||
warn(
|
||
'v-bind without argument expects an Object or Array value',
|
||
this
|
||
);
|
||
} else {
|
||
if (Array.isArray(value)) {
|
||
value = toObject(value);
|
||
}
|
||
var hash;
|
||
var loop = function ( key ) {
|
||
if (
|
||
key === 'class' ||
|
||
key === 'style' ||
|
||
isReservedAttribute(key)
|
||
) {
|
||
hash = data;
|
||
} else {
|
||
var type = data.attrs && data.attrs.type;
|
||
hash = asProp || config.mustUseProp(tag, type, key)
|
||
? data.domProps || (data.domProps = {})
|
||
: data.attrs || (data.attrs = {});
|
||
}
|
||
var camelizedKey = camelize(key);
|
||
var hyphenatedKey = hyphenate(key);
|
||
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
||
hash[key] = value[key];
|
||
|
||
if (isSync) {
|
||
var on = data.on || (data.on = {});
|
||
on[("update:" + key)] = function ($event) {
|
||
value[key] = $event;
|
||
};
|
||
}
|
||
}
|
||
};
|
||
|
||
for (var key in value) loop( key );
|
||
}
|
||
}
|
||
return data
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Runtime helper for rendering static trees.
|
||
*/
|
||
function renderStatic (
|
||
index,
|
||
isInFor
|
||
) {
|
||
var cached = this._staticTrees || (this._staticTrees = []);
|
||
var tree = cached[index];
|
||
// if has already-rendered static tree and not inside v-for,
|
||
// we can reuse the same tree.
|
||
if (tree && !isInFor) {
|
||
return tree
|
||
}
|
||
// otherwise, render a fresh tree.
|
||
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
||
this._renderProxy,
|
||
null,
|
||
this // for render fns generated for functional component templates
|
||
);
|
||
markStatic(tree, ("__static__" + index), false);
|
||
return tree
|
||
}
|
||
|
||
/**
|
||
* Runtime helper for v-once.
|
||
* Effectively it means marking the node as static with a unique key.
|
||
*/
|
||
function markOnce (
|
||
tree,
|
||
index,
|
||
key
|
||
) {
|
||
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
||
return tree
|
||
}
|
||
|
||
function markStatic (
|
||
tree,
|
||
key,
|
||
isOnce
|
||
) {
|
||
if (Array.isArray(tree)) {
|
||
for (var i = 0; i < tree.length; i++) {
|
||
if (tree[i] && typeof tree[i] !== 'string') {
|
||
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
||
}
|
||
}
|
||
} else {
|
||
markStaticNode(tree, key, isOnce);
|
||
}
|
||
}
|
||
|
||
function markStaticNode (node, key, isOnce) {
|
||
node.isStatic = true;
|
||
node.key = key;
|
||
node.isOnce = isOnce;
|
||
}
|
||
|
||
/* */
|
||
|
||
function bindObjectListeners (data, value) {
|
||
if (value) {
|
||
if (!isPlainObject(value)) {
|
||
warn(
|
||
'v-on without argument expects an Object value',
|
||
this
|
||
);
|
||
} else {
|
||
var on = data.on = data.on ? extend({}, data.on) : {};
|
||
for (var key in value) {
|
||
var existing = on[key];
|
||
var ours = value[key];
|
||
on[key] = existing ? [].concat(existing, ours) : ours;
|
||
}
|
||
}
|
||
}
|
||
return data
|
||
}
|
||
|
||
/* */
|
||
|
||
function resolveScopedSlots (
|
||
fns, // see flow/vnode
|
||
res,
|
||
// the following are added in 2.6
|
||
hasDynamicKeys,
|
||
contentHashKey
|
||
) {
|
||
res = res || { $stable: !hasDynamicKeys };
|
||
for (var i = 0; i < fns.length; i++) {
|
||
var slot = fns[i];
|
||
if (Array.isArray(slot)) {
|
||
resolveScopedSlots(slot, res, hasDynamicKeys);
|
||
} else if (slot) {
|
||
// marker for reverse proxying v-slot without scope on this.$slots
|
||
if (slot.proxy) {
|
||
slot.fn.proxy = true;
|
||
}
|
||
res[slot.key] = slot.fn;
|
||
}
|
||
}
|
||
if (contentHashKey) {
|
||
(res).$key = contentHashKey;
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* */
|
||
|
||
function bindDynamicKeys (baseObj, values) {
|
||
for (var i = 0; i < values.length; i += 2) {
|
||
var key = values[i];
|
||
if (typeof key === 'string' && key) {
|
||
baseObj[values[i]] = values[i + 1];
|
||
} else if (key !== '' && key !== null) {
|
||
// null is a speical value for explicitly removing a binding
|
||
warn(
|
||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||
this
|
||
);
|
||
}
|
||
}
|
||
return baseObj
|
||
}
|
||
|
||
// helper to dynamically append modifier runtime markers to event names.
|
||
// ensure only append when value is already string, otherwise it will be cast
|
||
// to string and cause the type check to miss.
|
||
function prependModifier (value, symbol) {
|
||
return typeof value === 'string' ? symbol + value : value
|
||
}
|
||
|
||
/* */
|
||
|
||
function installRenderHelpers (target) {
|
||
target._o = markOnce;
|
||
target._n = toNumber;
|
||
target._s = toString;
|
||
target._l = renderList;
|
||
target._t = renderSlot;
|
||
target._q = looseEqual;
|
||
target._i = looseIndexOf;
|
||
target._m = renderStatic;
|
||
target._f = resolveFilter;
|
||
target._k = checkKeyCodes;
|
||
target._b = bindObjectProps;
|
||
target._v = createTextVNode;
|
||
target._e = createEmptyVNode;
|
||
target._u = resolveScopedSlots;
|
||
target._g = bindObjectListeners;
|
||
target._d = bindDynamicKeys;
|
||
target._p = prependModifier;
|
||
}
|
||
|
||
/* */
|
||
|
||
function FunctionalRenderContext (
|
||
data,
|
||
props,
|
||
children,
|
||
parent,
|
||
Ctor
|
||
) {
|
||
var this$1 = this;
|
||
|
||
var options = Ctor.options;
|
||
// ensure the createElement function in functional components
|
||
// gets a unique context - this is necessary for correct named slot check
|
||
var contextVm;
|
||
if (hasOwn(parent, '_uid')) {
|
||
contextVm = Object.create(parent);
|
||
// $flow-disable-line
|
||
contextVm._original = parent;
|
||
} else {
|
||
// the context vm passed in is a functional context as well.
|
||
// in this case we want to make sure we are able to get a hold to the
|
||
// real context instance.
|
||
contextVm = parent;
|
||
// $flow-disable-line
|
||
parent = parent._original;
|
||
}
|
||
var isCompiled = isTrue(options._compiled);
|
||
var needNormalization = !isCompiled;
|
||
|
||
this.data = data;
|
||
this.props = props;
|
||
this.children = children;
|
||
this.parent = parent;
|
||
this.listeners = data.on || emptyObject;
|
||
this.injections = resolveInject(options.inject, parent);
|
||
this.slots = function () {
|
||
if (!this$1.$slots) {
|
||
normalizeScopedSlots(
|
||
data.scopedSlots,
|
||
this$1.$slots = resolveSlots(children, parent)
|
||
);
|
||
}
|
||
return this$1.$slots
|
||
};
|
||
|
||
Object.defineProperty(this, 'scopedSlots', ({
|
||
enumerable: true,
|
||
get: function get () {
|
||
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
||
}
|
||
}));
|
||
|
||
// support for compiled functional template
|
||
if (isCompiled) {
|
||
// exposing $options for renderStatic()
|
||
this.$options = options;
|
||
// pre-resolve slots for renderSlot()
|
||
this.$slots = this.slots();
|
||
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
||
}
|
||
|
||
if (options._scopeId) {
|
||
this._c = function (a, b, c, d) {
|
||
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
||
if (vnode && !Array.isArray(vnode)) {
|
||
vnode.fnScopeId = options._scopeId;
|
||
vnode.fnContext = parent;
|
||
}
|
||
return vnode
|
||
};
|
||
} else {
|
||
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
||
}
|
||
}
|
||
|
||
installRenderHelpers(FunctionalRenderContext.prototype);
|
||
|
||
function createFunctionalComponent (
|
||
Ctor,
|
||
propsData,
|
||
data,
|
||
contextVm,
|
||
children
|
||
) {
|
||
var options = Ctor.options;
|
||
var props = {};
|
||
var propOptions = options.props;
|
||
if (isDef(propOptions)) {
|
||
for (var key in propOptions) {
|
||
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
||
}
|
||
} else {
|
||
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
||
if (isDef(data.props)) { mergeProps(props, data.props); }
|
||
}
|
||
|
||
var renderContext = new FunctionalRenderContext(
|
||
data,
|
||
props,
|
||
children,
|
||
contextVm,
|
||
Ctor
|
||
);
|
||
|
||
var vnode = options.render.call(null, renderContext._c, renderContext);
|
||
|
||
if (vnode instanceof VNode) {
|
||
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
||
} else if (Array.isArray(vnode)) {
|
||
var vnodes = normalizeChildren(vnode) || [];
|
||
var res = new Array(vnodes.length);
|
||
for (var i = 0; i < vnodes.length; i++) {
|
||
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
||
}
|
||
return res
|
||
}
|
||
}
|
||
|
||
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
||
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
||
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
||
// that should not be matched to match.
|
||
var clone = cloneVNode(vnode);
|
||
clone.fnContext = contextVm;
|
||
clone.fnOptions = options;
|
||
{
|
||
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
||
}
|
||
if (data.slot) {
|
||
(clone.data || (clone.data = {})).slot = data.slot;
|
||
}
|
||
return clone
|
||
}
|
||
|
||
function mergeProps (to, from) {
|
||
for (var key in from) {
|
||
to[camelize(key)] = from[key];
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
/* */
|
||
|
||
/* */
|
||
|
||
/* */
|
||
|
||
// inline hooks to be invoked on component VNodes during patch
|
||
var componentVNodeHooks = {
|
||
init: function init (vnode, hydrating) {
|
||
if (
|
||
vnode.componentInstance &&
|
||
!vnode.componentInstance._isDestroyed &&
|
||
vnode.data.keepAlive
|
||
) {
|
||
// kept-alive components, treat as a patch
|
||
var mountedNode = vnode; // work around flow
|
||
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
||
} else {
|
||
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
||
vnode,
|
||
activeInstance
|
||
);
|
||
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
||
}
|
||
},
|
||
|
||
prepatch: function prepatch (oldVnode, vnode) {
|
||
var options = vnode.componentOptions;
|
||
var child = vnode.componentInstance = oldVnode.componentInstance;
|
||
updateChildComponent(
|
||
child,
|
||
options.propsData, // updated props
|
||
options.listeners, // updated listeners
|
||
vnode, // new parent vnode
|
||
options.children // new children
|
||
);
|
||
},
|
||
|
||
insert: function insert (vnode) {
|
||
var context = vnode.context;
|
||
var componentInstance = vnode.componentInstance;
|
||
if (!componentInstance._isMounted) {
|
||
componentInstance._isMounted = true;
|
||
callHook(componentInstance, 'mounted');
|
||
}
|
||
if (vnode.data.keepAlive) {
|
||
if (context._isMounted) {
|
||
// vue-router#1212
|
||
// During updates, a kept-alive component's child components may
|
||
// change, so directly walking the tree here may call activated hooks
|
||
// on incorrect children. Instead we push them into a queue which will
|
||
// be processed after the whole patch process ended.
|
||
queueActivatedComponent(componentInstance);
|
||
} else {
|
||
activateChildComponent(componentInstance, true /* direct */);
|
||
}
|
||
}
|
||
},
|
||
|
||
destroy: function destroy (vnode) {
|
||
var componentInstance = vnode.componentInstance;
|
||
if (!componentInstance._isDestroyed) {
|
||
if (!vnode.data.keepAlive) {
|
||
componentInstance.$destroy();
|
||
} else {
|
||
deactivateChildComponent(componentInstance, true /* direct */);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
var hooksToMerge = Object.keys(componentVNodeHooks);
|
||
|
||
function createComponent (
|
||
Ctor,
|
||
data,
|
||
context,
|
||
children,
|
||
tag
|
||
) {
|
||
if (isUndef(Ctor)) {
|
||
return
|
||
}
|
||
|
||
var baseCtor = context.$options._base;
|
||
|
||
// plain options object: turn it into a constructor
|
||
if (isObject(Ctor)) {
|
||
Ctor = baseCtor.extend(Ctor);
|
||
}
|
||
|
||
// if at this stage it's not a constructor or an async component factory,
|
||
// reject.
|
||
if (typeof Ctor !== 'function') {
|
||
{
|
||
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
||
}
|
||
return
|
||
}
|
||
|
||
// async component
|
||
var asyncFactory;
|
||
if (isUndef(Ctor.cid)) {
|
||
asyncFactory = Ctor;
|
||
Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
||
if (Ctor === undefined) {
|
||
// return a placeholder node for async component, which is rendered
|
||
// as a comment node but preserves all the raw information for the node.
|
||
// the information will be used for async server-rendering and hydration.
|
||
return createAsyncPlaceholder(
|
||
asyncFactory,
|
||
data,
|
||
context,
|
||
children,
|
||
tag
|
||
)
|
||
}
|
||
}
|
||
|
||
data = data || {};
|
||
|
||
// resolve constructor options in case global mixins are applied after
|
||
// component constructor creation
|
||
resolveConstructorOptions(Ctor);
|
||
|
||
// transform component v-model data into props & events
|
||
if (isDef(data.model)) {
|
||
transformModel(Ctor.options, data);
|
||
}
|
||
|
||
// extract props
|
||
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
||
|
||
// functional component
|
||
if (isTrue(Ctor.options.functional)) {
|
||
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
||
}
|
||
|
||
// extract listeners, since these needs to be treated as
|
||
// child component listeners instead of DOM listeners
|
||
var listeners = data.on;
|
||
// replace with listeners with .native modifier
|
||
// so it gets processed during parent component patch.
|
||
data.on = data.nativeOn;
|
||
|
||
if (isTrue(Ctor.options.abstract)) {
|
||
// abstract components do not keep anything
|
||
// other than props & listeners & slot
|
||
|
||
// work around flow
|
||
var slot = data.slot;
|
||
data = {};
|
||
if (slot) {
|
||
data.slot = slot;
|
||
}
|
||
}
|
||
|
||
// install component management hooks onto the placeholder node
|
||
installComponentHooks(data);
|
||
|
||
// return a placeholder vnode
|
||
var name = Ctor.options.name || tag;
|
||
var vnode = new VNode(
|
||
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
||
data, undefined, undefined, undefined, context,
|
||
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
||
asyncFactory
|
||
);
|
||
|
||
return vnode
|
||
}
|
||
|
||
function createComponentInstanceForVnode (
|
||
vnode, // we know it's MountedComponentVNode but flow doesn't
|
||
parent // activeInstance in lifecycle state
|
||
) {
|
||
var options = {
|
||
_isComponent: true,
|
||
_parentVnode: vnode,
|
||
parent: parent
|
||
};
|
||
// check inline-template render functions
|
||
var inlineTemplate = vnode.data.inlineTemplate;
|
||
if (isDef(inlineTemplate)) {
|
||
options.render = inlineTemplate.render;
|
||
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
||
}
|
||
return new vnode.componentOptions.Ctor(options)
|
||
}
|
||
|
||
function installComponentHooks (data) {
|
||
var hooks = data.hook || (data.hook = {});
|
||
for (var i = 0; i < hooksToMerge.length; i++) {
|
||
var key = hooksToMerge[i];
|
||
var existing = hooks[key];
|
||
var toMerge = componentVNodeHooks[key];
|
||
if (existing !== toMerge && !(existing && existing._merged)) {
|
||
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
||
}
|
||
}
|
||
}
|
||
|
||
function mergeHook$1 (f1, f2) {
|
||
var merged = function (a, b) {
|
||
// flow complains about extra args which is why we use any
|
||
f1(a, b);
|
||
f2(a, b);
|
||
};
|
||
merged._merged = true;
|
||
return merged
|
||
}
|
||
|
||
// transform component v-model info (value and callback) into
|
||
// prop and event handler respectively.
|
||
function transformModel (options, data) {
|
||
var prop = (options.model && options.model.prop) || 'value';
|
||
var event = (options.model && options.model.event) || 'input'
|
||
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
||
var on = data.on || (data.on = {});
|
||
var existing = on[event];
|
||
var callback = data.model.callback;
|
||
if (isDef(existing)) {
|
||
if (
|
||
Array.isArray(existing)
|
||
? existing.indexOf(callback) === -1
|
||
: existing !== callback
|
||
) {
|
||
on[event] = [callback].concat(existing);
|
||
}
|
||
} else {
|
||
on[event] = callback;
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var SIMPLE_NORMALIZE = 1;
|
||
var ALWAYS_NORMALIZE = 2;
|
||
|
||
// wrapper function for providing a more flexible interface
|
||
// without getting yelled at by flow
|
||
function createElement (
|
||
context,
|
||
tag,
|
||
data,
|
||
children,
|
||
normalizationType,
|
||
alwaysNormalize
|
||
) {
|
||
if (Array.isArray(data) || isPrimitive(data)) {
|
||
normalizationType = children;
|
||
children = data;
|
||
data = undefined;
|
||
}
|
||
if (isTrue(alwaysNormalize)) {
|
||
normalizationType = ALWAYS_NORMALIZE;
|
||
}
|
||
return _createElement(context, tag, data, children, normalizationType)
|
||
}
|
||
|
||
function _createElement (
|
||
context,
|
||
tag,
|
||
data,
|
||
children,
|
||
normalizationType
|
||
) {
|
||
if (isDef(data) && isDef((data).__ob__)) {
|
||
warn(
|
||
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
||
'Always create fresh vnode data objects in each render!',
|
||
context
|
||
);
|
||
return createEmptyVNode()
|
||
}
|
||
// object syntax in v-bind
|
||
if (isDef(data) && isDef(data.is)) {
|
||
tag = data.is;
|
||
}
|
||
if (!tag) {
|
||
// in case of component :is set to falsy value
|
||
return createEmptyVNode()
|
||
}
|
||
// warn against non-primitive key
|
||
if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
||
) {
|
||
{
|
||
warn(
|
||
'Avoid using non-primitive value as key, ' +
|
||
'use string/number value instead.',
|
||
context
|
||
);
|
||
}
|
||
}
|
||
// support single function children as default scoped slot
|
||
if (Array.isArray(children) &&
|
||
typeof children[0] === 'function'
|
||
) {
|
||
data = data || {};
|
||
data.scopedSlots = { default: children[0] };
|
||
children.length = 0;
|
||
}
|
||
if (normalizationType === ALWAYS_NORMALIZE) {
|
||
children = normalizeChildren(children);
|
||
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
||
children = simpleNormalizeChildren(children);
|
||
}
|
||
var vnode, ns;
|
||
if (typeof tag === 'string') {
|
||
var Ctor;
|
||
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
||
if (config.isReservedTag(tag)) {
|
||
// platform built-in elements
|
||
vnode = new VNode(
|
||
config.parsePlatformTagName(tag), data, children,
|
||
undefined, undefined, context
|
||
);
|
||
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
||
// component
|
||
vnode = createComponent(Ctor, data, context, children, tag);
|
||
} else {
|
||
// unknown or unlisted namespaced elements
|
||
// check at runtime because it may get assigned a namespace when its
|
||
// parent normalizes children
|
||
vnode = new VNode(
|
||
tag, data, children,
|
||
undefined, undefined, context
|
||
);
|
||
}
|
||
} else {
|
||
// direct component options / constructor
|
||
vnode = createComponent(tag, data, context, children);
|
||
}
|
||
if (Array.isArray(vnode)) {
|
||
return vnode
|
||
} else if (isDef(vnode)) {
|
||
if (isDef(ns)) { applyNS(vnode, ns); }
|
||
if (isDef(data)) { registerDeepBindings(data); }
|
||
return vnode
|
||
} else {
|
||
return createEmptyVNode()
|
||
}
|
||
}
|
||
|
||
function applyNS (vnode, ns, force) {
|
||
vnode.ns = ns;
|
||
if (vnode.tag === 'foreignObject') {
|
||
// use default namespace inside foreignObject
|
||
ns = undefined;
|
||
force = true;
|
||
}
|
||
if (isDef(vnode.children)) {
|
||
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
||
var child = vnode.children[i];
|
||
if (isDef(child.tag) && (
|
||
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
||
applyNS(child, ns, force);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// ref #5318
|
||
// necessary to ensure parent re-render when deep bindings like :style and
|
||
// :class are used on slot nodes
|
||
function registerDeepBindings (data) {
|
||
if (isObject(data.style)) {
|
||
traverse(data.style);
|
||
}
|
||
if (isObject(data.class)) {
|
||
traverse(data.class);
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function initRender (vm) {
|
||
vm._vnode = null; // the root of the child tree
|
||
vm._staticTrees = null; // v-once cached trees
|
||
var options = vm.$options;
|
||
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
|
||
var renderContext = parentVnode && parentVnode.context;
|
||
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
||
vm.$scopedSlots = emptyObject;
|
||
// bind the createElement fn to this instance
|
||
// so that we get proper render context inside it.
|
||
// args order: tag, data, children, normalizationType, alwaysNormalize
|
||
// internal version is used by render functions compiled from templates
|
||
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
||
// normalization is always applied for the public version, used in
|
||
// user-written render functions.
|
||
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
||
|
||
// $attrs & $listeners are exposed for easier HOC creation.
|
||
// they need to be reactive so that HOCs using them are always updated
|
||
var parentData = parentVnode && parentVnode.data;
|
||
|
||
/* istanbul ignore else */
|
||
{
|
||
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
||
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
||
}, true);
|
||
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
||
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
||
}, true);
|
||
}
|
||
}
|
||
|
||
var currentRenderingInstance = null;
|
||
|
||
function renderMixin (Vue) {
|
||
// install runtime convenience helpers
|
||
installRenderHelpers(Vue.prototype);
|
||
|
||
Vue.prototype.$nextTick = function (fn) {
|
||
return nextTick(fn, this)
|
||
};
|
||
|
||
Vue.prototype._render = function () {
|
||
var vm = this;
|
||
var ref = vm.$options;
|
||
var render = ref.render;
|
||
var _parentVnode = ref._parentVnode;
|
||
|
||
if (_parentVnode) {
|
||
vm.$scopedSlots = normalizeScopedSlots(
|
||
_parentVnode.data.scopedSlots,
|
||
vm.$slots,
|
||
vm.$scopedSlots
|
||
);
|
||
}
|
||
|
||
// set parent vnode. this allows render functions to have access
|
||
// to the data on the placeholder node.
|
||
vm.$vnode = _parentVnode;
|
||
// render self
|
||
var vnode;
|
||
try {
|
||
// There's no need to maintain a stack becaues all render fns are called
|
||
// separately from one another. Nested component's render fns are called
|
||
// when parent component is patched.
|
||
currentRenderingInstance = vm;
|
||
vnode = render.call(vm._renderProxy, vm.$createElement);
|
||
} catch (e) {
|
||
handleError(e, vm, "render");
|
||
// return error render result,
|
||
// or previous vnode to prevent render error causing blank component
|
||
/* istanbul ignore else */
|
||
if (vm.$options.renderError) {
|
||
try {
|
||
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
||
} catch (e) {
|
||
handleError(e, vm, "renderError");
|
||
vnode = vm._vnode;
|
||
}
|
||
} else {
|
||
vnode = vm._vnode;
|
||
}
|
||
} finally {
|
||
currentRenderingInstance = null;
|
||
}
|
||
// if the returned array contains only a single node, allow it
|
||
if (Array.isArray(vnode) && vnode.length === 1) {
|
||
vnode = vnode[0];
|
||
}
|
||
// return empty vnode in case the render function errored out
|
||
if (!(vnode instanceof VNode)) {
|
||
if (Array.isArray(vnode)) {
|
||
warn(
|
||
'Multiple root nodes returned from render function. Render function ' +
|
||
'should return a single root node.',
|
||
vm
|
||
);
|
||
}
|
||
vnode = createEmptyVNode();
|
||
}
|
||
// set parent
|
||
vnode.parent = _parentVnode;
|
||
return vnode
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
function ensureCtor (comp, base) {
|
||
if (
|
||
comp.__esModule ||
|
||
(hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
||
) {
|
||
comp = comp.default;
|
||
}
|
||
return isObject(comp)
|
||
? base.extend(comp)
|
||
: comp
|
||
}
|
||
|
||
function createAsyncPlaceholder (
|
||
factory,
|
||
data,
|
||
context,
|
||
children,
|
||
tag
|
||
) {
|
||
var node = createEmptyVNode();
|
||
node.asyncFactory = factory;
|
||
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
||
return node
|
||
}
|
||
|
||
function resolveAsyncComponent (
|
||
factory,
|
||
baseCtor
|
||
) {
|
||
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
||
return factory.errorComp
|
||
}
|
||
|
||
if (isDef(factory.resolved)) {
|
||
return factory.resolved
|
||
}
|
||
|
||
var owner = currentRenderingInstance;
|
||
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
||
// already pending
|
||
factory.owners.push(owner);
|
||
}
|
||
|
||
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
||
return factory.loadingComp
|
||
}
|
||
|
||
if (owner && !isDef(factory.owners)) {
|
||
var owners = factory.owners = [owner];
|
||
var sync = true;
|
||
var timerLoading = null;
|
||
var timerTimeout = null
|
||
|
||
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
||
|
||
var forceRender = function (renderCompleted) {
|
||
for (var i = 0, l = owners.length; i < l; i++) {
|
||
(owners[i]).$forceUpdate();
|
||
}
|
||
|
||
if (renderCompleted) {
|
||
owners.length = 0;
|
||
if (timerLoading !== null) {
|
||
clearTimeout(timerLoading);
|
||
timerLoading = null;
|
||
}
|
||
if (timerTimeout !== null) {
|
||
clearTimeout(timerTimeout);
|
||
timerTimeout = null;
|
||
}
|
||
}
|
||
};
|
||
|
||
var resolve = once(function (res) {
|
||
// cache resolved
|
||
factory.resolved = ensureCtor(res, baseCtor);
|
||
// invoke callbacks only if this is not a synchronous resolve
|
||
// (async resolves are shimmed as synchronous during SSR)
|
||
if (!sync) {
|
||
forceRender(true);
|
||
} else {
|
||
owners.length = 0;
|
||
}
|
||
});
|
||
|
||
var reject = once(function (reason) {
|
||
warn(
|
||
"Failed to resolve async component: " + (String(factory)) +
|
||
(reason ? ("\nReason: " + reason) : '')
|
||
);
|
||
if (isDef(factory.errorComp)) {
|
||
factory.error = true;
|
||
forceRender(true);
|
||
}
|
||
});
|
||
|
||
var res = factory(resolve, reject);
|
||
|
||
if (isObject(res)) {
|
||
if (isPromise(res)) {
|
||
// () => Promise
|
||
if (isUndef(factory.resolved)) {
|
||
res.then(resolve, reject);
|
||
}
|
||
} else if (isPromise(res.component)) {
|
||
res.component.then(resolve, reject);
|
||
|
||
if (isDef(res.error)) {
|
||
factory.errorComp = ensureCtor(res.error, baseCtor);
|
||
}
|
||
|
||
if (isDef(res.loading)) {
|
||
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
||
if (res.delay === 0) {
|
||
factory.loading = true;
|
||
} else {
|
||
timerLoading = setTimeout(function () {
|
||
timerLoading = null;
|
||
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
||
factory.loading = true;
|
||
forceRender(false);
|
||
}
|
||
}, res.delay || 200);
|
||
}
|
||
}
|
||
|
||
if (isDef(res.timeout)) {
|
||
timerTimeout = setTimeout(function () {
|
||
timerTimeout = null;
|
||
if (isUndef(factory.resolved)) {
|
||
reject(
|
||
"timeout (" + (res.timeout) + "ms)"
|
||
);
|
||
}
|
||
}, res.timeout);
|
||
}
|
||
}
|
||
}
|
||
|
||
sync = false;
|
||
// return in case resolved synchronously
|
||
return factory.loading
|
||
? factory.loadingComp
|
||
: factory.resolved
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function isAsyncPlaceholder (node) {
|
||
return node.isComment && node.asyncFactory
|
||
}
|
||
|
||
/* */
|
||
|
||
function getFirstComponentChild (children) {
|
||
if (Array.isArray(children)) {
|
||
for (var i = 0; i < children.length; i++) {
|
||
var c = children[i];
|
||
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
||
return c
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
/* */
|
||
|
||
function initEvents (vm) {
|
||
vm._events = Object.create(null);
|
||
vm._hasHookEvent = false;
|
||
// init parent attached events
|
||
var listeners = vm.$options._parentListeners;
|
||
if (listeners) {
|
||
updateComponentListeners(vm, listeners);
|
||
}
|
||
}
|
||
|
||
var target;
|
||
|
||
function add (event, fn) {
|
||
target.$on(event, fn);
|
||
}
|
||
|
||
function remove$1 (event, fn) {
|
||
target.$off(event, fn);
|
||
}
|
||
|
||
function createOnceHandler (event, fn) {
|
||
var _target = target;
|
||
return function onceHandler () {
|
||
var res = fn.apply(null, arguments);
|
||
if (res !== null) {
|
||
_target.$off(event, onceHandler);
|
||
}
|
||
}
|
||
}
|
||
|
||
function updateComponentListeners (
|
||
vm,
|
||
listeners,
|
||
oldListeners
|
||
) {
|
||
target = vm;
|
||
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
||
target = undefined;
|
||
}
|
||
|
||
function eventsMixin (Vue) {
|
||
var hookRE = /^hook:/;
|
||
Vue.prototype.$on = function (event, fn) {
|
||
var vm = this;
|
||
if (Array.isArray(event)) {
|
||
for (var i = 0, l = event.length; i < l; i++) {
|
||
vm.$on(event[i], fn);
|
||
}
|
||
} else {
|
||
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
||
// optimize hook:event cost by using a boolean flag marked at registration
|
||
// instead of a hash lookup
|
||
if (hookRE.test(event)) {
|
||
vm._hasHookEvent = true;
|
||
}
|
||
}
|
||
return vm
|
||
};
|
||
|
||
Vue.prototype.$once = function (event, fn) {
|
||
var vm = this;
|
||
function on () {
|
||
vm.$off(event, on);
|
||
fn.apply(vm, arguments);
|
||
}
|
||
on.fn = fn;
|
||
vm.$on(event, on);
|
||
return vm
|
||
};
|
||
|
||
Vue.prototype.$off = function (event, fn) {
|
||
var vm = this;
|
||
// all
|
||
if (!arguments.length) {
|
||
vm._events = Object.create(null);
|
||
return vm
|
||
}
|
||
// array of events
|
||
if (Array.isArray(event)) {
|
||
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
||
vm.$off(event[i$1], fn);
|
||
}
|
||
return vm
|
||
}
|
||
// specific event
|
||
var cbs = vm._events[event];
|
||
if (!cbs) {
|
||
return vm
|
||
}
|
||
if (!fn) {
|
||
vm._events[event] = null;
|
||
return vm
|
||
}
|
||
// specific handler
|
||
var cb;
|
||
var i = cbs.length;
|
||
while (i--) {
|
||
cb = cbs[i];
|
||
if (cb === fn || cb.fn === fn) {
|
||
cbs.splice(i, 1);
|
||
break
|
||
}
|
||
}
|
||
return vm
|
||
};
|
||
|
||
Vue.prototype.$emit = function (event) {
|
||
var vm = this;
|
||
{
|
||
var lowerCaseEvent = event.toLowerCase();
|
||
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
||
tip(
|
||
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
||
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
||
"Note that HTML attributes are case-insensitive and you cannot use " +
|
||
"v-on to listen to camelCase events when using in-DOM templates. " +
|
||
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
||
);
|
||
}
|
||
}
|
||
var cbs = vm._events[event];
|
||
if (cbs) {
|
||
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
||
var args = toArray(arguments, 1);
|
||
var info = "event handler for \"" + event + "\"";
|
||
for (var i = 0, l = cbs.length; i < l; i++) {
|
||
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
||
}
|
||
}
|
||
return vm
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
var activeInstance = null;
|
||
var isUpdatingChildComponent = false;
|
||
|
||
function setActiveInstance(vm) {
|
||
var prevActiveInstance = activeInstance;
|
||
activeInstance = vm;
|
||
return function () {
|
||
activeInstance = prevActiveInstance;
|
||
}
|
||
}
|
||
|
||
function initLifecycle (vm) {
|
||
var options = vm.$options;
|
||
|
||
// locate first non-abstract parent
|
||
var parent = options.parent;
|
||
if (parent && !options.abstract) {
|
||
while (parent.$options.abstract && parent.$parent) {
|
||
parent = parent.$parent;
|
||
}
|
||
parent.$children.push(vm);
|
||
}
|
||
|
||
vm.$parent = parent;
|
||
vm.$root = parent ? parent.$root : vm;
|
||
|
||
vm.$children = [];
|
||
vm.$refs = {};
|
||
|
||
vm._watcher = null;
|
||
vm._inactive = null;
|
||
vm._directInactive = false;
|
||
vm._isMounted = false;
|
||
vm._isDestroyed = false;
|
||
vm._isBeingDestroyed = false;
|
||
}
|
||
|
||
function lifecycleMixin (Vue) {
|
||
Vue.prototype._update = function (vnode, hydrating) {
|
||
var vm = this;
|
||
var prevEl = vm.$el;
|
||
var prevVnode = vm._vnode;
|
||
var restoreActiveInstance = setActiveInstance(vm);
|
||
vm._vnode = vnode;
|
||
// Vue.prototype.__patch__ is injected in entry points
|
||
// based on the rendering backend used.
|
||
if (!prevVnode) {
|
||
// initial render
|
||
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
||
} else {
|
||
// updates
|
||
vm.$el = vm.__patch__(prevVnode, vnode);
|
||
}
|
||
restoreActiveInstance();
|
||
// update __vue__ reference
|
||
if (prevEl) {
|
||
prevEl.__vue__ = null;
|
||
}
|
||
if (vm.$el) {
|
||
vm.$el.__vue__ = vm;
|
||
}
|
||
// if parent is an HOC, update its $el as well
|
||
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
||
vm.$parent.$el = vm.$el;
|
||
}
|
||
// updated hook is called by the scheduler to ensure that children are
|
||
// updated in a parent's updated hook.
|
||
};
|
||
|
||
Vue.prototype.$forceUpdate = function () {
|
||
var vm = this;
|
||
if (vm._watcher) {
|
||
vm._watcher.update();
|
||
}
|
||
};
|
||
|
||
Vue.prototype.$destroy = function () {
|
||
var vm = this;
|
||
if (vm._isBeingDestroyed) {
|
||
return
|
||
}
|
||
callHook(vm, 'beforeDestroy');
|
||
vm._isBeingDestroyed = true;
|
||
// remove self from parent
|
||
var parent = vm.$parent;
|
||
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
||
remove(parent.$children, vm);
|
||
}
|
||
// teardown watchers
|
||
if (vm._watcher) {
|
||
vm._watcher.teardown();
|
||
}
|
||
var i = vm._watchers.length;
|
||
while (i--) {
|
||
vm._watchers[i].teardown();
|
||
}
|
||
// remove reference from data ob
|
||
// frozen object may not have observer.
|
||
if (vm._data.__ob__) {
|
||
vm._data.__ob__.vmCount--;
|
||
}
|
||
// call the last hook...
|
||
vm._isDestroyed = true;
|
||
// invoke destroy hooks on current rendered tree
|
||
vm.__patch__(vm._vnode, null);
|
||
// fire destroyed hook
|
||
callHook(vm, 'destroyed');
|
||
// turn off all instance listeners.
|
||
vm.$off();
|
||
// remove __vue__ reference
|
||
if (vm.$el) {
|
||
vm.$el.__vue__ = null;
|
||
}
|
||
// release circular reference (#6759)
|
||
if (vm.$vnode) {
|
||
vm.$vnode.parent = null;
|
||
}
|
||
};
|
||
}
|
||
|
||
function mountComponent (
|
||
vm,
|
||
el,
|
||
hydrating
|
||
) {
|
||
vm.$el = el;
|
||
if (!vm.$options.render) {
|
||
vm.$options.render = createEmptyVNode;
|
||
{
|
||
/* istanbul ignore if */
|
||
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
||
vm.$options.el || el) {
|
||
warn(
|
||
'You are using the runtime-only build of Vue where the template ' +
|
||
'compiler is not available. Either pre-compile the templates into ' +
|
||
'render functions, or use the compiler-included build.',
|
||
vm
|
||
);
|
||
} else {
|
||
warn(
|
||
'Failed to mount component: template or render function not defined.',
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
}
|
||
callHook(vm, 'beforeMount');
|
||
|
||
var updateComponent;
|
||
/* istanbul ignore if */
|
||
if (config.performance && mark) {
|
||
updateComponent = function () {
|
||
var name = vm._name;
|
||
var id = vm._uid;
|
||
var startTag = "vue-perf-start:" + id;
|
||
var endTag = "vue-perf-end:" + id;
|
||
|
||
mark(startTag);
|
||
var vnode = vm._render();
|
||
mark(endTag);
|
||
measure(("vue " + name + " render"), startTag, endTag);
|
||
|
||
mark(startTag);
|
||
vm._update(vnode, hydrating);
|
||
mark(endTag);
|
||
measure(("vue " + name + " patch"), startTag, endTag);
|
||
};
|
||
} else {
|
||
updateComponent = function () {
|
||
vm._update(vm._render(), hydrating);
|
||
};
|
||
}
|
||
|
||
// we set this to vm._watcher inside the watcher's constructor
|
||
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
||
// component's mounted hook), which relies on vm._watcher being already defined
|
||
new Watcher(vm, updateComponent, noop, {
|
||
before: function before () {
|
||
if (vm._isMounted && !vm._isDestroyed) {
|
||
callHook(vm, 'beforeUpdate');
|
||
}
|
||
}
|
||
}, true /* isRenderWatcher */);
|
||
hydrating = false;
|
||
|
||
// manually mounted instance, call mounted on self
|
||
// mounted is called for render-created child components in its inserted hook
|
||
if (vm.$vnode == null) {
|
||
vm._isMounted = true;
|
||
callHook(vm, 'mounted');
|
||
}
|
||
return vm
|
||
}
|
||
|
||
function updateChildComponent (
|
||
vm,
|
||
propsData,
|
||
listeners,
|
||
parentVnode,
|
||
renderChildren
|
||
) {
|
||
{
|
||
isUpdatingChildComponent = true;
|
||
}
|
||
|
||
// determine whether component has slot children
|
||
// we need to do this before overwriting $options._renderChildren.
|
||
|
||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||
// dynamic slot names). Static scoped slots compiled from template has the
|
||
// "$stable" marker.
|
||
var newScopedSlots = parentVnode.data.scopedSlots;
|
||
var oldScopedSlots = vm.$scopedSlots;
|
||
var hasDynamicScopedSlot = !!(
|
||
(newScopedSlots && !newScopedSlots.$stable) ||
|
||
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
||
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
||
);
|
||
|
||
// Any static slot children from the parent may have changed during parent's
|
||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||
// update is necessary to ensure correctness.
|
||
var needsForceUpdate = !!(
|
||
renderChildren || // has new static slots
|
||
vm.$options._renderChildren || // has old static slots
|
||
hasDynamicScopedSlot
|
||
);
|
||
|
||
vm.$options._parentVnode = parentVnode;
|
||
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
||
|
||
if (vm._vnode) { // update child tree's parent
|
||
vm._vnode.parent = parentVnode;
|
||
}
|
||
vm.$options._renderChildren = renderChildren;
|
||
|
||
// update $attrs and $listeners hash
|
||
// these are also reactive so they may trigger child update if the child
|
||
// used them during render
|
||
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
||
vm.$listeners = listeners || emptyObject;
|
||
|
||
// update props
|
||
if (propsData && vm.$options.props) {
|
||
toggleObserving(false);
|
||
var props = vm._props;
|
||
var propKeys = vm.$options._propKeys || [];
|
||
for (var i = 0; i < propKeys.length; i++) {
|
||
var key = propKeys[i];
|
||
var propOptions = vm.$options.props; // wtf flow?
|
||
props[key] = validateProp(key, propOptions, propsData, vm);
|
||
}
|
||
toggleObserving(true);
|
||
// keep a copy of raw propsData
|
||
vm.$options.propsData = propsData;
|
||
}
|
||
|
||
// update listeners
|
||
listeners = listeners || emptyObject;
|
||
var oldListeners = vm.$options._parentListeners;
|
||
vm.$options._parentListeners = listeners;
|
||
updateComponentListeners(vm, listeners, oldListeners);
|
||
|
||
// resolve slots + force update if has children
|
||
if (needsForceUpdate) {
|
||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||
vm.$forceUpdate();
|
||
}
|
||
|
||
{
|
||
isUpdatingChildComponent = false;
|
||
}
|
||
}
|
||
|
||
function isInInactiveTree (vm) {
|
||
while (vm && (vm = vm.$parent)) {
|
||
if (vm._inactive) { return true }
|
||
}
|
||
return false
|
||
}
|
||
|
||
function activateChildComponent (vm, direct) {
|
||
if (direct) {
|
||
vm._directInactive = false;
|
||
if (isInInactiveTree(vm)) {
|
||
return
|
||
}
|
||
} else if (vm._directInactive) {
|
||
return
|
||
}
|
||
if (vm._inactive || vm._inactive === null) {
|
||
vm._inactive = false;
|
||
for (var i = 0; i < vm.$children.length; i++) {
|
||
activateChildComponent(vm.$children[i]);
|
||
}
|
||
callHook(vm, 'activated');
|
||
}
|
||
}
|
||
|
||
function deactivateChildComponent (vm, direct) {
|
||
if (direct) {
|
||
vm._directInactive = true;
|
||
if (isInInactiveTree(vm)) {
|
||
return
|
||
}
|
||
}
|
||
if (!vm._inactive) {
|
||
vm._inactive = true;
|
||
for (var i = 0; i < vm.$children.length; i++) {
|
||
deactivateChildComponent(vm.$children[i]);
|
||
}
|
||
callHook(vm, 'deactivated');
|
||
}
|
||
}
|
||
|
||
function callHook (vm, hook) {
|
||
// #7573 disable dep collection when invoking lifecycle hooks
|
||
pushTarget();
|
||
var handlers = vm.$options[hook];
|
||
var info = hook + " hook";
|
||
if (handlers) {
|
||
for (var i = 0, j = handlers.length; i < j; i++) {
|
||
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
||
}
|
||
}
|
||
if (vm._hasHookEvent) {
|
||
vm.$emit('hook:' + hook);
|
||
}
|
||
popTarget();
|
||
}
|
||
|
||
/* */
|
||
|
||
var MAX_UPDATE_COUNT = 100;
|
||
|
||
var queue = [];
|
||
var activatedChildren = [];
|
||
var has = {};
|
||
var circular = {};
|
||
var waiting = false;
|
||
var flushing = false;
|
||
var index = 0;
|
||
|
||
/**
|
||
* Reset the scheduler's state.
|
||
*/
|
||
function resetSchedulerState () {
|
||
index = queue.length = activatedChildren.length = 0;
|
||
has = {};
|
||
{
|
||
circular = {};
|
||
}
|
||
waiting = flushing = false;
|
||
}
|
||
|
||
// Async edge case #6566 requires saving the timestamp when event listeners are
|
||
// attached. However, calling performance.now() has a perf overhead especially
|
||
// if the page has thousands of event listeners. Instead, we take a timestamp
|
||
// every time the scheduler flushes and use that for all event listeners
|
||
// attached during that flush.
|
||
var currentFlushTimestamp = 0;
|
||
|
||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||
var getNow = Date.now;
|
||
|
||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||
// timestamp can either be hi-res (relative to page load) or low-res
|
||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||
// same timestamp type when saving the flush timestamp.
|
||
// All IE versions use low-res event timestamps, and have problematic clock
|
||
// implementations (#9632)
|
||
if (inBrowser && !isIE) {
|
||
var performance = window.performance;
|
||
if (
|
||
performance &&
|
||
typeof performance.now === 'function' &&
|
||
getNow() > document.createEvent('Event').timeStamp
|
||
) {
|
||
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
||
// smaller than it, it means the event is using a hi-res timestamp,
|
||
// and we need to use the hi-res version for event listener timestamps as
|
||
// well.
|
||
getNow = function () { return performance.now(); };
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Flush both queues and run the watchers.
|
||
*/
|
||
function flushSchedulerQueue () {
|
||
currentFlushTimestamp = getNow();
|
||
flushing = true;
|
||
var watcher, id;
|
||
|
||
// Sort queue before flush.
|
||
// This ensures that:
|
||
// 1. Components are updated from parent to child. (because parent is always
|
||
// created before the child)
|
||
// 2. A component's user watchers are run before its render watcher (because
|
||
// user watchers are created before the render watcher)
|
||
// 3. If a component is destroyed during a parent component's watcher run,
|
||
// its watchers can be skipped.
|
||
queue.sort(function (a, b) { return a.id - b.id; });
|
||
|
||
// do not cache length because more watchers might be pushed
|
||
// as we run existing watchers
|
||
for (index = 0; index < queue.length; index++) {
|
||
watcher = queue[index];
|
||
if (watcher.before) {
|
||
watcher.before();
|
||
}
|
||
id = watcher.id;
|
||
has[id] = null;
|
||
watcher.run();
|
||
// in dev build, check and stop circular updates.
|
||
if (has[id] != null) {
|
||
circular[id] = (circular[id] || 0) + 1;
|
||
if (circular[id] > MAX_UPDATE_COUNT) {
|
||
warn(
|
||
'You may have an infinite update loop ' + (
|
||
watcher.user
|
||
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
||
: "in a component render function."
|
||
),
|
||
watcher.vm
|
||
);
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
// keep copies of post queues before resetting state
|
||
var activatedQueue = activatedChildren.slice();
|
||
var updatedQueue = queue.slice();
|
||
|
||
resetSchedulerState();
|
||
|
||
// call component updated and activated hooks
|
||
callActivatedHooks(activatedQueue);
|
||
callUpdatedHooks(updatedQueue);
|
||
|
||
// devtool hook
|
||
/* istanbul ignore if */
|
||
if (devtools && config.devtools) {
|
||
devtools.emit('flush');
|
||
}
|
||
}
|
||
|
||
function callUpdatedHooks (queue) {
|
||
var i = queue.length;
|
||
while (i--) {
|
||
var watcher = queue[i];
|
||
var vm = watcher.vm;
|
||
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
||
callHook(vm, 'updated');
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Queue a kept-alive component that was activated during patch.
|
||
* The queue will be processed after the entire tree has been patched.
|
||
*/
|
||
function queueActivatedComponent (vm) {
|
||
// setting _inactive to false here so that a render function can
|
||
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
||
vm._inactive = false;
|
||
activatedChildren.push(vm);
|
||
}
|
||
|
||
function callActivatedHooks (queue) {
|
||
for (var i = 0; i < queue.length; i++) {
|
||
queue[i]._inactive = true;
|
||
activateChildComponent(queue[i], true /* true */);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Push a watcher into the watcher queue.
|
||
* Jobs with duplicate IDs will be skipped unless it's
|
||
* pushed when the queue is being flushed.
|
||
*/
|
||
function queueWatcher (watcher) {
|
||
var id = watcher.id;
|
||
if (has[id] == null) {
|
||
has[id] = true;
|
||
if (!flushing) {
|
||
queue.push(watcher);
|
||
} else {
|
||
// if already flushing, splice the watcher based on its id
|
||
// if already past its id, it will be run next immediately.
|
||
var i = queue.length - 1;
|
||
while (i > index && queue[i].id > watcher.id) {
|
||
i--;
|
||
}
|
||
queue.splice(i + 1, 0, watcher);
|
||
}
|
||
// queue the flush
|
||
if (!waiting) {
|
||
waiting = true;
|
||
|
||
if (!config.async) {
|
||
flushSchedulerQueue();
|
||
return
|
||
}
|
||
nextTick(flushSchedulerQueue);
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
var uid$2 = 0;
|
||
|
||
/**
|
||
* A watcher parses an expression, collects dependencies,
|
||
* and fires callback when the expression value changes.
|
||
* This is used for both the $watch() api and directives.
|
||
*/
|
||
var Watcher = function Watcher (
|
||
vm,
|
||
expOrFn,
|
||
cb,
|
||
options,
|
||
isRenderWatcher
|
||
) {
|
||
this.vm = vm;
|
||
if (isRenderWatcher) {
|
||
vm._watcher = this;
|
||
}
|
||
vm._watchers.push(this);
|
||
// options
|
||
if (options) {
|
||
this.deep = !!options.deep;
|
||
this.user = !!options.user;
|
||
this.lazy = !!options.lazy;
|
||
this.sync = !!options.sync;
|
||
this.before = options.before;
|
||
} else {
|
||
this.deep = this.user = this.lazy = this.sync = false;
|
||
}
|
||
this.cb = cb;
|
||
this.id = ++uid$2; // uid for batching
|
||
this.active = true;
|
||
this.dirty = this.lazy; // for lazy watchers
|
||
this.deps = [];
|
||
this.newDeps = [];
|
||
this.depIds = new _Set();
|
||
this.newDepIds = new _Set();
|
||
this.expression = expOrFn.toString();
|
||
// parse expression for getter
|
||
if (typeof expOrFn === 'function') {
|
||
this.getter = expOrFn;
|
||
} else {
|
||
this.getter = parsePath(expOrFn);
|
||
if (!this.getter) {
|
||
this.getter = noop;
|
||
warn(
|
||
"Failed watching path: \"" + expOrFn + "\" " +
|
||
'Watcher only accepts simple dot-delimited paths. ' +
|
||
'For full control, use a function instead.',
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
this.value = this.lazy
|
||
? undefined
|
||
: this.get();
|
||
};
|
||
|
||
/**
|
||
* Evaluate the getter, and re-collect dependencies.
|
||
*/
|
||
Watcher.prototype.get = function get () {
|
||
pushTarget(this);
|
||
var value;
|
||
var vm = this.vm;
|
||
try {
|
||
value = this.getter.call(vm, vm);
|
||
} catch (e) {
|
||
if (this.user) {
|
||
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
||
} else {
|
||
throw e
|
||
}
|
||
} finally {
|
||
// "touch" every property so they are all tracked as
|
||
// dependencies for deep watching
|
||
if (this.deep) {
|
||
traverse(value);
|
||
}
|
||
popTarget();
|
||
this.cleanupDeps();
|
||
}
|
||
return value
|
||
};
|
||
|
||
/**
|
||
* Add a dependency to this directive.
|
||
*/
|
||
Watcher.prototype.addDep = function addDep (dep) {
|
||
var id = dep.id;
|
||
if (!this.newDepIds.has(id)) {
|
||
this.newDepIds.add(id);
|
||
this.newDeps.push(dep);
|
||
if (!this.depIds.has(id)) {
|
||
dep.addSub(this);
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Clean up for dependency collection.
|
||
*/
|
||
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
||
var i = this.deps.length;
|
||
while (i--) {
|
||
var dep = this.deps[i];
|
||
if (!this.newDepIds.has(dep.id)) {
|
||
dep.removeSub(this);
|
||
}
|
||
}
|
||
var tmp = this.depIds;
|
||
this.depIds = this.newDepIds;
|
||
this.newDepIds = tmp;
|
||
this.newDepIds.clear();
|
||
tmp = this.deps;
|
||
this.deps = this.newDeps;
|
||
this.newDeps = tmp;
|
||
this.newDeps.length = 0;
|
||
};
|
||
|
||
/**
|
||
* Subscriber interface.
|
||
* Will be called when a dependency changes.
|
||
*/
|
||
Watcher.prototype.update = function update () {
|
||
/* istanbul ignore else */
|
||
if (this.lazy) {
|
||
this.dirty = true;
|
||
} else if (this.sync) {
|
||
this.run();
|
||
} else {
|
||
queueWatcher(this);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Scheduler job interface.
|
||
* Will be called by the scheduler.
|
||
*/
|
||
Watcher.prototype.run = function run () {
|
||
if (this.active) {
|
||
var value = this.get();
|
||
if (
|
||
value !== this.value ||
|
||
// Deep watchers and watchers on Object/Arrays should fire even
|
||
// when the value is the same, because the value may
|
||
// have mutated.
|
||
isObject(value) ||
|
||
this.deep
|
||
) {
|
||
// set new value
|
||
var oldValue = this.value;
|
||
this.value = value;
|
||
if (this.user) {
|
||
try {
|
||
this.cb.call(this.vm, value, oldValue);
|
||
} catch (e) {
|
||
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
||
}
|
||
} else {
|
||
this.cb.call(this.vm, value, oldValue);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Evaluate the value of the watcher.
|
||
* This only gets called for lazy watchers.
|
||
*/
|
||
Watcher.prototype.evaluate = function evaluate () {
|
||
this.value = this.get();
|
||
this.dirty = false;
|
||
};
|
||
|
||
/**
|
||
* Depend on all deps collected by this watcher.
|
||
*/
|
||
Watcher.prototype.depend = function depend () {
|
||
var i = this.deps.length;
|
||
while (i--) {
|
||
this.deps[i].depend();
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Remove self from all dependencies' subscriber list.
|
||
*/
|
||
Watcher.prototype.teardown = function teardown () {
|
||
if (this.active) {
|
||
// remove self from vm's watcher list
|
||
// this is a somewhat expensive operation so we skip it
|
||
// if the vm is being destroyed.
|
||
if (!this.vm._isBeingDestroyed) {
|
||
remove(this.vm._watchers, this);
|
||
}
|
||
var i = this.deps.length;
|
||
while (i--) {
|
||
this.deps[i].removeSub(this);
|
||
}
|
||
this.active = false;
|
||
}
|
||
};
|
||
|
||
/* */
|
||
|
||
var sharedPropertyDefinition = {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: noop,
|
||
set: noop
|
||
};
|
||
|
||
function proxy (target, sourceKey, key) {
|
||
sharedPropertyDefinition.get = function proxyGetter () {
|
||
return this[sourceKey][key]
|
||
};
|
||
sharedPropertyDefinition.set = function proxySetter (val) {
|
||
this[sourceKey][key] = val;
|
||
};
|
||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
||
}
|
||
|
||
function initState (vm) {
|
||
vm._watchers = [];
|
||
var opts = vm.$options;
|
||
if (opts.props) { initProps(vm, opts.props); }
|
||
if (opts.methods) { initMethods(vm, opts.methods); }
|
||
if (opts.data) {
|
||
initData(vm);
|
||
} else {
|
||
observe(vm._data = {}, true /* asRootData */);
|
||
}
|
||
if (opts.computed) { initComputed(vm, opts.computed); }
|
||
if (opts.watch && opts.watch !== nativeWatch) {
|
||
initWatch(vm, opts.watch);
|
||
}
|
||
}
|
||
|
||
function initProps (vm, propsOptions) {
|
||
var propsData = vm.$options.propsData || {};
|
||
var props = vm._props = {};
|
||
// cache prop keys so that future props updates can iterate using Array
|
||
// instead of dynamic object key enumeration.
|
||
var keys = vm.$options._propKeys = [];
|
||
var isRoot = !vm.$parent;
|
||
// root instance props should be converted
|
||
if (!isRoot) {
|
||
toggleObserving(false);
|
||
}
|
||
var loop = function ( key ) {
|
||
keys.push(key);
|
||
var value = validateProp(key, propsOptions, propsData, vm);
|
||
/* istanbul ignore else */
|
||
{
|
||
var hyphenatedKey = hyphenate(key);
|
||
if (isReservedAttribute(hyphenatedKey) ||
|
||
config.isReservedAttr(hyphenatedKey)) {
|
||
warn(
|
||
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
||
vm
|
||
);
|
||
}
|
||
defineReactive$$1(props, key, value, function () {
|
||
if (!isRoot && !isUpdatingChildComponent) {
|
||
warn(
|
||
"Avoid mutating a prop directly since the value will be " +
|
||
"overwritten whenever the parent component re-renders. " +
|
||
"Instead, use a data or computed property based on the prop's " +
|
||
"value. Prop being mutated: \"" + key + "\"",
|
||
vm
|
||
);
|
||
}
|
||
});
|
||
}
|
||
// static props are already proxied on the component's prototype
|
||
// during Vue.extend(). We only need to proxy props defined at
|
||
// instantiation here.
|
||
if (!(key in vm)) {
|
||
proxy(vm, "_props", key);
|
||
}
|
||
};
|
||
|
||
for (var key in propsOptions) loop( key );
|
||
toggleObserving(true);
|
||
}
|
||
|
||
function initData (vm) {
|
||
var data = vm.$options.data;
|
||
data = vm._data = typeof data === 'function'
|
||
? getData(data, vm)
|
||
: data || {};
|
||
if (!isPlainObject(data)) {
|
||
data = {};
|
||
warn(
|
||
'data functions should return an object:\n' +
|
||
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
||
vm
|
||
);
|
||
}
|
||
// proxy data on instance
|
||
var keys = Object.keys(data);
|
||
var props = vm.$options.props;
|
||
var methods = vm.$options.methods;
|
||
var i = keys.length;
|
||
while (i--) {
|
||
var key = keys[i];
|
||
{
|
||
if (methods && hasOwn(methods, key)) {
|
||
warn(
|
||
("Method \"" + key + "\" has already been defined as a data property."),
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
if (props && hasOwn(props, key)) {
|
||
warn(
|
||
"The data property \"" + key + "\" is already declared as a prop. " +
|
||
"Use prop default value instead.",
|
||
vm
|
||
);
|
||
} else if (!isReserved(key)) {
|
||
proxy(vm, "_data", key);
|
||
}
|
||
}
|
||
// observe data
|
||
observe(data, true /* asRootData */);
|
||
}
|
||
|
||
function getData (data, vm) {
|
||
// #7573 disable dep collection when invoking data getters
|
||
pushTarget();
|
||
try {
|
||
return data.call(vm, vm)
|
||
} catch (e) {
|
||
handleError(e, vm, "data()");
|
||
return {}
|
||
} finally {
|
||
popTarget();
|
||
}
|
||
}
|
||
|
||
var computedWatcherOptions = { lazy: true };
|
||
|
||
function initComputed (vm, computed) {
|
||
// $flow-disable-line
|
||
var watchers = vm._computedWatchers = Object.create(null);
|
||
// computed properties are just getters during SSR
|
||
var isSSR = isServerRendering();
|
||
|
||
for (var key in computed) {
|
||
var userDef = computed[key];
|
||
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
||
if (getter == null) {
|
||
warn(
|
||
("Getter is missing for computed property \"" + key + "\"."),
|
||
vm
|
||
);
|
||
}
|
||
|
||
if (!isSSR) {
|
||
// create internal watcher for the computed property.
|
||
watchers[key] = new Watcher(
|
||
vm,
|
||
getter || noop,
|
||
noop,
|
||
computedWatcherOptions
|
||
);
|
||
}
|
||
|
||
// component-defined computed properties are already defined on the
|
||
// component prototype. We only need to define computed properties defined
|
||
// at instantiation here.
|
||
if (!(key in vm)) {
|
||
defineComputed(vm, key, userDef);
|
||
} else {
|
||
if (key in vm.$data) {
|
||
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
||
} else if (vm.$options.props && key in vm.$options.props) {
|
||
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function defineComputed (
|
||
target,
|
||
key,
|
||
userDef
|
||
) {
|
||
var shouldCache = !isServerRendering();
|
||
if (typeof userDef === 'function') {
|
||
sharedPropertyDefinition.get = shouldCache
|
||
? createComputedGetter(key)
|
||
: createGetterInvoker(userDef);
|
||
sharedPropertyDefinition.set = noop;
|
||
} else {
|
||
sharedPropertyDefinition.get = userDef.get
|
||
? shouldCache && userDef.cache !== false
|
||
? createComputedGetter(key)
|
||
: createGetterInvoker(userDef.get)
|
||
: noop;
|
||
sharedPropertyDefinition.set = userDef.set || noop;
|
||
}
|
||
if (sharedPropertyDefinition.set === noop) {
|
||
sharedPropertyDefinition.set = function () {
|
||
warn(
|
||
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
||
this
|
||
);
|
||
};
|
||
}
|
||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
||
}
|
||
|
||
function createComputedGetter (key) {
|
||
return function computedGetter () {
|
||
var watcher = this._computedWatchers && this._computedWatchers[key];
|
||
if (watcher) {
|
||
if (watcher.dirty) {
|
||
watcher.evaluate();
|
||
}
|
||
if (Dep.target) {
|
||
watcher.depend();
|
||
}
|
||
return watcher.value
|
||
}
|
||
}
|
||
}
|
||
|
||
function createGetterInvoker(fn) {
|
||
return function computedGetter () {
|
||
return fn.call(this, this)
|
||
}
|
||
}
|
||
|
||
function initMethods (vm, methods) {
|
||
var props = vm.$options.props;
|
||
for (var key in methods) {
|
||
{
|
||
if (typeof methods[key] !== 'function') {
|
||
warn(
|
||
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
||
"Did you reference the function correctly?",
|
||
vm
|
||
);
|
||
}
|
||
if (props && hasOwn(props, key)) {
|
||
warn(
|
||
("Method \"" + key + "\" has already been defined as a prop."),
|
||
vm
|
||
);
|
||
}
|
||
if ((key in vm) && isReserved(key)) {
|
||
warn(
|
||
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
||
"Avoid defining component methods that start with _ or $."
|
||
);
|
||
}
|
||
}
|
||
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
||
}
|
||
}
|
||
|
||
function initWatch (vm, watch) {
|
||
for (var key in watch) {
|
||
var handler = watch[key];
|
||
if (Array.isArray(handler)) {
|
||
for (var i = 0; i < handler.length; i++) {
|
||
createWatcher(vm, key, handler[i]);
|
||
}
|
||
} else {
|
||
createWatcher(vm, key, handler);
|
||
}
|
||
}
|
||
}
|
||
|
||
function createWatcher (
|
||
vm,
|
||
expOrFn,
|
||
handler,
|
||
options
|
||
) {
|
||
if (isPlainObject(handler)) {
|
||
options = handler;
|
||
handler = handler.handler;
|
||
}
|
||
if (typeof handler === 'string') {
|
||
handler = vm[handler];
|
||
}
|
||
return vm.$watch(expOrFn, handler, options)
|
||
}
|
||
|
||
function stateMixin (Vue) {
|
||
// flow somehow has problems with directly declared definition object
|
||
// when using Object.defineProperty, so we have to procedurally build up
|
||
// the object here.
|
||
var dataDef = {};
|
||
dataDef.get = function () { return this._data };
|
||
var propsDef = {};
|
||
propsDef.get = function () { return this._props };
|
||
{
|
||
dataDef.set = function () {
|
||
warn(
|
||
'Avoid replacing instance root $data. ' +
|
||
'Use nested data properties instead.',
|
||
this
|
||
);
|
||
};
|
||
propsDef.set = function () {
|
||
warn("$props is readonly.", this);
|
||
};
|
||
}
|
||
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
||
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
||
|
||
Vue.prototype.$set = set;
|
||
Vue.prototype.$delete = del;
|
||
|
||
Vue.prototype.$watch = function (
|
||
expOrFn,
|
||
cb,
|
||
options
|
||
) {
|
||
var vm = this;
|
||
if (isPlainObject(cb)) {
|
||
return createWatcher(vm, expOrFn, cb, options)
|
||
}
|
||
options = options || {};
|
||
options.user = true;
|
||
var watcher = new Watcher(vm, expOrFn, cb, options);
|
||
if (options.immediate) {
|
||
try {
|
||
cb.call(vm, watcher.value);
|
||
} catch (error) {
|
||
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
||
}
|
||
}
|
||
return function unwatchFn () {
|
||
watcher.teardown();
|
||
}
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
var uid$3 = 0;
|
||
|
||
function initMixin (Vue) {
|
||
Vue.prototype._init = function (options) {
|
||
var vm = this;
|
||
// a uid
|
||
vm._uid = uid$3++;
|
||
|
||
var startTag, endTag;
|
||
/* istanbul ignore if */
|
||
if (config.performance && mark) {
|
||
startTag = "vue-perf-start:" + (vm._uid);
|
||
endTag = "vue-perf-end:" + (vm._uid);
|
||
mark(startTag);
|
||
}
|
||
|
||
// a flag to avoid this being observed
|
||
vm._isVue = true;
|
||
// merge options
|
||
if (options && options._isComponent) {
|
||
// optimize internal component instantiation
|
||
// since dynamic options merging is pretty slow, and none of the
|
||
// internal component options needs special treatment.
|
||
initInternalComponent(vm, options);
|
||
} else {
|
||
vm.$options = mergeOptions(
|
||
resolveConstructorOptions(vm.constructor),
|
||
options || {},
|
||
vm
|
||
);
|
||
}
|
||
/* istanbul ignore else */
|
||
{
|
||
initProxy(vm);
|
||
}
|
||
// expose real self
|
||
vm._self = vm;
|
||
initLifecycle(vm);
|
||
initEvents(vm);
|
||
initRender(vm);
|
||
callHook(vm, 'beforeCreate');
|
||
initInjections(vm); // resolve injections before data/props
|
||
initState(vm);
|
||
initProvide(vm); // resolve provide after data/props
|
||
callHook(vm, 'created');
|
||
|
||
/* istanbul ignore if */
|
||
if (config.performance && mark) {
|
||
vm._name = formatComponentName(vm, false);
|
||
mark(endTag);
|
||
measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
||
}
|
||
|
||
if (vm.$options.el) {
|
||
vm.$mount(vm.$options.el);
|
||
}
|
||
};
|
||
}
|
||
|
||
function initInternalComponent (vm, options) {
|
||
var opts = vm.$options = Object.create(vm.constructor.options);
|
||
// doing this because it's faster than dynamic enumeration.
|
||
var parentVnode = options._parentVnode;
|
||
opts.parent = options.parent;
|
||
opts._parentVnode = parentVnode;
|
||
|
||
var vnodeComponentOptions = parentVnode.componentOptions;
|
||
opts.propsData = vnodeComponentOptions.propsData;
|
||
opts._parentListeners = vnodeComponentOptions.listeners;
|
||
opts._renderChildren = vnodeComponentOptions.children;
|
||
opts._componentTag = vnodeComponentOptions.tag;
|
||
|
||
if (options.render) {
|
||
opts.render = options.render;
|
||
opts.staticRenderFns = options.staticRenderFns;
|
||
}
|
||
}
|
||
|
||
function resolveConstructorOptions (Ctor) {
|
||
var options = Ctor.options;
|
||
if (Ctor.super) {
|
||
var superOptions = resolveConstructorOptions(Ctor.super);
|
||
var cachedSuperOptions = Ctor.superOptions;
|
||
if (superOptions !== cachedSuperOptions) {
|
||
// super option changed,
|
||
// need to resolve new options.
|
||
Ctor.superOptions = superOptions;
|
||
// check if there are any late-modified/attached options (#4976)
|
||
var modifiedOptions = resolveModifiedOptions(Ctor);
|
||
// update base extend options
|
||
if (modifiedOptions) {
|
||
extend(Ctor.extendOptions, modifiedOptions);
|
||
}
|
||
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
||
if (options.name) {
|
||
options.components[options.name] = Ctor;
|
||
}
|
||
}
|
||
}
|
||
return options
|
||
}
|
||
|
||
function resolveModifiedOptions (Ctor) {
|
||
var modified;
|
||
var latest = Ctor.options;
|
||
var sealed = Ctor.sealedOptions;
|
||
for (var key in latest) {
|
||
if (latest[key] !== sealed[key]) {
|
||
if (!modified) { modified = {}; }
|
||
modified[key] = latest[key];
|
||
}
|
||
}
|
||
return modified
|
||
}
|
||
|
||
function Vue (options) {
|
||
if (!(this instanceof Vue)
|
||
) {
|
||
warn('Vue is a constructor and should be called with the `new` keyword');
|
||
}
|
||
this._init(options);
|
||
}
|
||
|
||
initMixin(Vue);
|
||
stateMixin(Vue);
|
||
eventsMixin(Vue);
|
||
lifecycleMixin(Vue);
|
||
renderMixin(Vue);
|
||
|
||
/* */
|
||
|
||
function initUse (Vue) {
|
||
Vue.use = function (plugin) {
|
||
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
||
if (installedPlugins.indexOf(plugin) > -1) {
|
||
return this
|
||
}
|
||
|
||
// additional parameters
|
||
var args = toArray(arguments, 1);
|
||
args.unshift(this);
|
||
if (typeof plugin.install === 'function') {
|
||
plugin.install.apply(plugin, args);
|
||
} else if (typeof plugin === 'function') {
|
||
plugin.apply(null, args);
|
||
}
|
||
installedPlugins.push(plugin);
|
||
return this
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
function initMixin$1 (Vue) {
|
||
Vue.mixin = function (mixin) {
|
||
this.options = mergeOptions(this.options, mixin);
|
||
return this
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
function initExtend (Vue) {
|
||
/**
|
||
* Each instance constructor, including Vue, has a unique
|
||
* cid. This enables us to create wrapped "child
|
||
* constructors" for prototypal inheritance and cache them.
|
||
*/
|
||
Vue.cid = 0;
|
||
var cid = 1;
|
||
|
||
/**
|
||
* Class inheritance
|
||
*/
|
||
Vue.extend = function (extendOptions) {
|
||
extendOptions = extendOptions || {};
|
||
var Super = this;
|
||
var SuperId = Super.cid;
|
||
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
||
if (cachedCtors[SuperId]) {
|
||
return cachedCtors[SuperId]
|
||
}
|
||
|
||
var name = extendOptions.name || Super.options.name;
|
||
if (name) {
|
||
validateComponentName(name);
|
||
}
|
||
|
||
var Sub = function VueComponent (options) {
|
||
this._init(options);
|
||
};
|
||
Sub.prototype = Object.create(Super.prototype);
|
||
Sub.prototype.constructor = Sub;
|
||
Sub.cid = cid++;
|
||
Sub.options = mergeOptions(
|
||
Super.options,
|
||
extendOptions
|
||
);
|
||
Sub['super'] = Super;
|
||
|
||
// For props and computed properties, we define the proxy getters on
|
||
// the Vue instances at extension time, on the extended prototype. This
|
||
// avoids Object.defineProperty calls for each instance created.
|
||
if (Sub.options.props) {
|
||
initProps$1(Sub);
|
||
}
|
||
if (Sub.options.computed) {
|
||
initComputed$1(Sub);
|
||
}
|
||
|
||
// allow further extension/mixin/plugin usage
|
||
Sub.extend = Super.extend;
|
||
Sub.mixin = Super.mixin;
|
||
Sub.use = Super.use;
|
||
|
||
// create asset registers, so extended classes
|
||
// can have their private assets too.
|
||
ASSET_TYPES.forEach(function (type) {
|
||
Sub[type] = Super[type];
|
||
});
|
||
// enable recursive self-lookup
|
||
if (name) {
|
||
Sub.options.components[name] = Sub;
|
||
}
|
||
|
||
// keep a reference to the super options at extension time.
|
||
// later at instantiation we can check if Super's options have
|
||
// been updated.
|
||
Sub.superOptions = Super.options;
|
||
Sub.extendOptions = extendOptions;
|
||
Sub.sealedOptions = extend({}, Sub.options);
|
||
|
||
// cache constructor
|
||
cachedCtors[SuperId] = Sub;
|
||
return Sub
|
||
};
|
||
}
|
||
|
||
function initProps$1 (Comp) {
|
||
var props = Comp.options.props;
|
||
for (var key in props) {
|
||
proxy(Comp.prototype, "_props", key);
|
||
}
|
||
}
|
||
|
||
function initComputed$1 (Comp) {
|
||
var computed = Comp.options.computed;
|
||
for (var key in computed) {
|
||
defineComputed(Comp.prototype, key, computed[key]);
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function initAssetRegisters (Vue) {
|
||
/**
|
||
* Create asset registration methods.
|
||
*/
|
||
ASSET_TYPES.forEach(function (type) {
|
||
Vue[type] = function (
|
||
id,
|
||
definition
|
||
) {
|
||
if (!definition) {
|
||
return this.options[type + 's'][id]
|
||
} else {
|
||
/* istanbul ignore if */
|
||
if (type === 'component') {
|
||
validateComponentName(id);
|
||
}
|
||
if (type === 'component' && isPlainObject(definition)) {
|
||
definition.name = definition.name || id;
|
||
definition = this.options._base.extend(definition);
|
||
}
|
||
if (type === 'directive' && typeof definition === 'function') {
|
||
definition = { bind: definition, update: definition };
|
||
}
|
||
this.options[type + 's'][id] = definition;
|
||
return definition
|
||
}
|
||
};
|
||
});
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
function getComponentName (opts) {
|
||
return opts && (opts.Ctor.options.name || opts.tag)
|
||
}
|
||
|
||
function matches (pattern, name) {
|
||
if (Array.isArray(pattern)) {
|
||
return pattern.indexOf(name) > -1
|
||
} else if (typeof pattern === 'string') {
|
||
return pattern.split(',').indexOf(name) > -1
|
||
} else if (isRegExp(pattern)) {
|
||
return pattern.test(name)
|
||
}
|
||
/* istanbul ignore next */
|
||
return false
|
||
}
|
||
|
||
function pruneCache (keepAliveInstance, filter) {
|
||
var cache = keepAliveInstance.cache;
|
||
var keys = keepAliveInstance.keys;
|
||
var _vnode = keepAliveInstance._vnode;
|
||
for (var key in cache) {
|
||
var cachedNode = cache[key];
|
||
if (cachedNode) {
|
||
var name = getComponentName(cachedNode.componentOptions);
|
||
if (name && !filter(name)) {
|
||
pruneCacheEntry(cache, key, keys, _vnode);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function pruneCacheEntry (
|
||
cache,
|
||
key,
|
||
keys,
|
||
current
|
||
) {
|
||
var cached$$1 = cache[key];
|
||
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
||
cached$$1.componentInstance.$destroy();
|
||
}
|
||
cache[key] = null;
|
||
remove(keys, key);
|
||
}
|
||
|
||
var patternTypes = [String, RegExp, Array];
|
||
|
||
var KeepAlive = {
|
||
name: 'keep-alive',
|
||
abstract: true,
|
||
|
||
props: {
|
||
include: patternTypes,
|
||
exclude: patternTypes,
|
||
max: [String, Number]
|
||
},
|
||
|
||
created: function created () {
|
||
this.cache = Object.create(null);
|
||
this.keys = [];
|
||
},
|
||
|
||
destroyed: function destroyed () {
|
||
for (var key in this.cache) {
|
||
pruneCacheEntry(this.cache, key, this.keys);
|
||
}
|
||
},
|
||
|
||
mounted: function mounted () {
|
||
var this$1 = this;
|
||
|
||
this.$watch('include', function (val) {
|
||
pruneCache(this$1, function (name) { return matches(val, name); });
|
||
});
|
||
this.$watch('exclude', function (val) {
|
||
pruneCache(this$1, function (name) { return !matches(val, name); });
|
||
});
|
||
},
|
||
|
||
render: function render () {
|
||
var slot = this.$slots.default;
|
||
var vnode = getFirstComponentChild(slot);
|
||
var componentOptions = vnode && vnode.componentOptions;
|
||
if (componentOptions) {
|
||
// check pattern
|
||
var name = getComponentName(componentOptions);
|
||
var ref = this;
|
||
var include = ref.include;
|
||
var exclude = ref.exclude;
|
||
if (
|
||
// not included
|
||
(include && (!name || !matches(include, name))) ||
|
||
// excluded
|
||
(exclude && name && matches(exclude, name))
|
||
) {
|
||
return vnode
|
||
}
|
||
|
||
var ref$1 = this;
|
||
var cache = ref$1.cache;
|
||
var keys = ref$1.keys;
|
||
var key = vnode.key == null
|
||
// same constructor may get registered as different local components
|
||
// so cid alone is not enough (#3269)
|
||
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
||
: vnode.key;
|
||
if (cache[key]) {
|
||
vnode.componentInstance = cache[key].componentInstance;
|
||
// make current key freshest
|
||
remove(keys, key);
|
||
keys.push(key);
|
||
} else {
|
||
cache[key] = vnode;
|
||
keys.push(key);
|
||
// prune oldest entry
|
||
if (this.max && keys.length > parseInt(this.max)) {
|
||
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
||
}
|
||
}
|
||
|
||
vnode.data.keepAlive = true;
|
||
}
|
||
return vnode || (slot && slot[0])
|
||
}
|
||
};
|
||
|
||
var builtInComponents = {
|
||
KeepAlive: KeepAlive
|
||
};
|
||
|
||
/* */
|
||
|
||
function initGlobalAPI (Vue) {
|
||
// config
|
||
var configDef = {};
|
||
configDef.get = function () { return config; };
|
||
{
|
||
configDef.set = function () {
|
||
warn(
|
||
'Do not replace the Vue.config object, set individual fields instead.'
|
||
);
|
||
};
|
||
}
|
||
Object.defineProperty(Vue, 'config', configDef);
|
||
|
||
// exposed util methods.
|
||
// NOTE: these are not considered part of the public API - avoid relying on
|
||
// them unless you are aware of the risk.
|
||
Vue.util = {
|
||
warn: warn,
|
||
extend: extend,
|
||
mergeOptions: mergeOptions,
|
||
defineReactive: defineReactive$$1
|
||
};
|
||
|
||
Vue.set = set;
|
||
Vue.delete = del;
|
||
Vue.nextTick = nextTick;
|
||
|
||
// 2.6 explicit observable API
|
||
Vue.observable = function (obj) {
|
||
observe(obj);
|
||
return obj
|
||
};
|
||
|
||
Vue.options = Object.create(null);
|
||
ASSET_TYPES.forEach(function (type) {
|
||
Vue.options[type + 's'] = Object.create(null);
|
||
});
|
||
|
||
// this is used to identify the "base" constructor to extend all plain-object
|
||
// components with in Weex's multi-instance scenarios.
|
||
Vue.options._base = Vue;
|
||
|
||
extend(Vue.options.components, builtInComponents);
|
||
|
||
initUse(Vue);
|
||
initMixin$1(Vue);
|
||
initExtend(Vue);
|
||
initAssetRegisters(Vue);
|
||
}
|
||
|
||
initGlobalAPI(Vue);
|
||
|
||
Object.defineProperty(Vue.prototype, '$isServer', {
|
||
get: isServerRendering
|
||
});
|
||
|
||
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
||
get: function get () {
|
||
/* istanbul ignore next */
|
||
return this.$vnode && this.$vnode.ssrContext
|
||
}
|
||
});
|
||
|
||
// expose FunctionalRenderContext for ssr runtime helper installation
|
||
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
||
value: FunctionalRenderContext
|
||
});
|
||
|
||
Vue.version = '2.6.10';
|
||
|
||
/* */
|
||
|
||
// these are reserved for web because they are directly compiled away
|
||
// during template compilation
|
||
var isReservedAttr = makeMap('style,class');
|
||
|
||
// attributes that should be using props for binding
|
||
var acceptValue = makeMap('input,textarea,option,select,progress');
|
||
var mustUseProp = function (tag, type, attr) {
|
||
return (
|
||
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
||
(attr === 'selected' && tag === 'option') ||
|
||
(attr === 'checked' && tag === 'input') ||
|
||
(attr === 'muted' && tag === 'video')
|
||
)
|
||
};
|
||
|
||
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
||
|
||
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
||
|
||
var convertEnumeratedValue = function (key, value) {
|
||
return isFalsyAttrValue(value) || value === 'false'
|
||
? 'false'
|
||
// allow arbitrary string value for contenteditable
|
||
: key === 'contenteditable' && isValidContentEditableValue(value)
|
||
? value
|
||
: 'true'
|
||
};
|
||
|
||
var isBooleanAttr = makeMap(
|
||
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
||
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
||
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
||
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
||
'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
||
'truespeed,typemustmatch,visible'
|
||
);
|
||
|
||
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
||
|
||
var isXlink = function (name) {
|
||
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
||
};
|
||
|
||
var getXlinkProp = function (name) {
|
||
return isXlink(name) ? name.slice(6, name.length) : ''
|
||
};
|
||
|
||
var isFalsyAttrValue = function (val) {
|
||
return val == null || val === false
|
||
};
|
||
|
||
/* */
|
||
|
||
function genClassForVnode (vnode) {
|
||
var data = vnode.data;
|
||
var parentNode = vnode;
|
||
var childNode = vnode;
|
||
while (isDef(childNode.componentInstance)) {
|
||
childNode = childNode.componentInstance._vnode;
|
||
if (childNode && childNode.data) {
|
||
data = mergeClassData(childNode.data, data);
|
||
}
|
||
}
|
||
while (isDef(parentNode = parentNode.parent)) {
|
||
if (parentNode && parentNode.data) {
|
||
data = mergeClassData(data, parentNode.data);
|
||
}
|
||
}
|
||
return renderClass(data.staticClass, data.class)
|
||
}
|
||
|
||
function mergeClassData (child, parent) {
|
||
return {
|
||
staticClass: concat(child.staticClass, parent.staticClass),
|
||
class: isDef(child.class)
|
||
? [child.class, parent.class]
|
||
: parent.class
|
||
}
|
||
}
|
||
|
||
function renderClass (
|
||
staticClass,
|
||
dynamicClass
|
||
) {
|
||
if (isDef(staticClass) || isDef(dynamicClass)) {
|
||
return concat(staticClass, stringifyClass(dynamicClass))
|
||
}
|
||
/* istanbul ignore next */
|
||
return ''
|
||
}
|
||
|
||
function concat (a, b) {
|
||
return a ? b ? (a + ' ' + b) : a : (b || '')
|
||
}
|
||
|
||
function stringifyClass (value) {
|
||
if (Array.isArray(value)) {
|
||
return stringifyArray(value)
|
||
}
|
||
if (isObject(value)) {
|
||
return stringifyObject(value)
|
||
}
|
||
if (typeof value === 'string') {
|
||
return value
|
||
}
|
||
/* istanbul ignore next */
|
||
return ''
|
||
}
|
||
|
||
function stringifyArray (value) {
|
||
var res = '';
|
||
var stringified;
|
||
for (var i = 0, l = value.length; i < l; i++) {
|
||
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
||
if (res) { res += ' '; }
|
||
res += stringified;
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
function stringifyObject (value) {
|
||
var res = '';
|
||
for (var key in value) {
|
||
if (value[key]) {
|
||
if (res) { res += ' '; }
|
||
res += key;
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* */
|
||
|
||
var namespaceMap = {
|
||
svg: 'http://www.w3.org/2000/svg',
|
||
math: 'http://www.w3.org/1998/Math/MathML'
|
||
};
|
||
|
||
var isHTMLTag = makeMap(
|
||
'html,body,base,head,link,meta,style,title,' +
|
||
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
||
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
||
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
||
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
||
'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
||
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
||
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
||
'output,progress,select,textarea,' +
|
||
'details,dialog,menu,menuitem,summary,' +
|
||
'content,element,shadow,template,blockquote,iframe,tfoot'
|
||
);
|
||
|
||
// this map is intentionally selective, only covering SVG elements that may
|
||
// contain child elements.
|
||
var isSVG = makeMap(
|
||
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
||
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
||
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
||
true
|
||
);
|
||
|
||
var isPreTag = function (tag) { return tag === 'pre'; };
|
||
|
||
var isReservedTag = function (tag) {
|
||
return isHTMLTag(tag) || isSVG(tag)
|
||
};
|
||
|
||
function getTagNamespace (tag) {
|
||
if (isSVG(tag)) {
|
||
return 'svg'
|
||
}
|
||
// basic support for MathML
|
||
// note it doesn't support other MathML elements being component roots
|
||
if (tag === 'math') {
|
||
return 'math'
|
||
}
|
||
}
|
||
|
||
var unknownElementCache = Object.create(null);
|
||
function isUnknownElement (tag) {
|
||
/* istanbul ignore if */
|
||
if (!inBrowser) {
|
||
return true
|
||
}
|
||
if (isReservedTag(tag)) {
|
||
return false
|
||
}
|
||
tag = tag.toLowerCase();
|
||
/* istanbul ignore if */
|
||
if (unknownElementCache[tag] != null) {
|
||
return unknownElementCache[tag]
|
||
}
|
||
var el = document.createElement(tag);
|
||
if (tag.indexOf('-') > -1) {
|
||
// http://stackoverflow.com/a/28210364/1070244
|
||
return (unknownElementCache[tag] = (
|
||
el.constructor === window.HTMLUnknownElement ||
|
||
el.constructor === window.HTMLElement
|
||
))
|
||
} else {
|
||
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
||
}
|
||
}
|
||
|
||
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Query an element selector if it's not an element already.
|
||
*/
|
||
function query (el) {
|
||
if (typeof el === 'string') {
|
||
var selected = document.querySelector(el);
|
||
if (!selected) {
|
||
warn(
|
||
'Cannot find element: ' + el
|
||
);
|
||
return document.createElement('div')
|
||
}
|
||
return selected
|
||
} else {
|
||
return el
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function createElement$1 (tagName, vnode) {
|
||
var elm = document.createElement(tagName);
|
||
if (tagName !== 'select') {
|
||
return elm
|
||
}
|
||
// false or null will remove the attribute but undefined will not
|
||
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
||
elm.setAttribute('multiple', 'multiple');
|
||
}
|
||
return elm
|
||
}
|
||
|
||
function createElementNS (namespace, tagName) {
|
||
return document.createElementNS(namespaceMap[namespace], tagName)
|
||
}
|
||
|
||
function createTextNode (text) {
|
||
return document.createTextNode(text)
|
||
}
|
||
|
||
function createComment (text) {
|
||
return document.createComment(text)
|
||
}
|
||
|
||
function insertBefore (parentNode, newNode, referenceNode) {
|
||
parentNode.insertBefore(newNode, referenceNode);
|
||
}
|
||
|
||
function removeChild (node, child) {
|
||
node.removeChild(child);
|
||
}
|
||
|
||
function appendChild (node, child) {
|
||
node.appendChild(child);
|
||
}
|
||
|
||
function parentNode (node) {
|
||
return node.parentNode
|
||
}
|
||
|
||
function nextSibling (node) {
|
||
return node.nextSibling
|
||
}
|
||
|
||
function tagName (node) {
|
||
return node.tagName
|
||
}
|
||
|
||
function setTextContent (node, text) {
|
||
node.textContent = text;
|
||
}
|
||
|
||
function setStyleScope (node, scopeId) {
|
||
node.setAttribute(scopeId, '');
|
||
}
|
||
|
||
var nodeOps = /*#__PURE__*/Object.freeze({
|
||
createElement: createElement$1,
|
||
createElementNS: createElementNS,
|
||
createTextNode: createTextNode,
|
||
createComment: createComment,
|
||
insertBefore: insertBefore,
|
||
removeChild: removeChild,
|
||
appendChild: appendChild,
|
||
parentNode: parentNode,
|
||
nextSibling: nextSibling,
|
||
tagName: tagName,
|
||
setTextContent: setTextContent,
|
||
setStyleScope: setStyleScope
|
||
});
|
||
|
||
/* */
|
||
|
||
var ref = {
|
||
create: function create (_, vnode) {
|
||
registerRef(vnode);
|
||
},
|
||
update: function update (oldVnode, vnode) {
|
||
if (oldVnode.data.ref !== vnode.data.ref) {
|
||
registerRef(oldVnode, true);
|
||
registerRef(vnode);
|
||
}
|
||
},
|
||
destroy: function destroy (vnode) {
|
||
registerRef(vnode, true);
|
||
}
|
||
};
|
||
|
||
function registerRef (vnode, isRemoval) {
|
||
var key = vnode.data.ref;
|
||
if (!isDef(key)) { return }
|
||
|
||
var vm = vnode.context;
|
||
var ref = vnode.componentInstance || vnode.elm;
|
||
var refs = vm.$refs;
|
||
if (isRemoval) {
|
||
if (Array.isArray(refs[key])) {
|
||
remove(refs[key], ref);
|
||
} else if (refs[key] === ref) {
|
||
refs[key] = undefined;
|
||
}
|
||
} else {
|
||
if (vnode.data.refInFor) {
|
||
if (!Array.isArray(refs[key])) {
|
||
refs[key] = [ref];
|
||
} else if (refs[key].indexOf(ref) < 0) {
|
||
// $flow-disable-line
|
||
refs[key].push(ref);
|
||
}
|
||
} else {
|
||
refs[key] = ref;
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Virtual DOM patching algorithm based on Snabbdom by
|
||
* Simon Friis Vindum (@paldepind)
|
||
* Licensed under the MIT License
|
||
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
|
||
*
|
||
* modified by Evan You (@yyx990803)
|
||
*
|
||
* Not type-checking this because this file is perf-critical and the cost
|
||
* of making flow understand it is not worth it.
|
||
*/
|
||
|
||
var emptyNode = new VNode('', {}, []);
|
||
|
||
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
||
|
||
function sameVnode (a, b) {
|
||
return (
|
||
a.key === b.key && (
|
||
(
|
||
a.tag === b.tag &&
|
||
a.isComment === b.isComment &&
|
||
isDef(a.data) === isDef(b.data) &&
|
||
sameInputType(a, b)
|
||
) || (
|
||
isTrue(a.isAsyncPlaceholder) &&
|
||
a.asyncFactory === b.asyncFactory &&
|
||
isUndef(b.asyncFactory.error)
|
||
)
|
||
)
|
||
)
|
||
}
|
||
|
||
function sameInputType (a, b) {
|
||
if (a.tag !== 'input') { return true }
|
||
var i;
|
||
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
||
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
||
return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
||
}
|
||
|
||
function createKeyToOldIdx (children, beginIdx, endIdx) {
|
||
var i, key;
|
||
var map = {};
|
||
for (i = beginIdx; i <= endIdx; ++i) {
|
||
key = children[i].key;
|
||
if (isDef(key)) { map[key] = i; }
|
||
}
|
||
return map
|
||
}
|
||
|
||
function createPatchFunction (backend) {
|
||
var i, j;
|
||
var cbs = {};
|
||
|
||
var modules = backend.modules;
|
||
var nodeOps = backend.nodeOps;
|
||
|
||
for (i = 0; i < hooks.length; ++i) {
|
||
cbs[hooks[i]] = [];
|
||
for (j = 0; j < modules.length; ++j) {
|
||
if (isDef(modules[j][hooks[i]])) {
|
||
cbs[hooks[i]].push(modules[j][hooks[i]]);
|
||
}
|
||
}
|
||
}
|
||
|
||
function emptyNodeAt (elm) {
|
||
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
||
}
|
||
|
||
function createRmCb (childElm, listeners) {
|
||
function remove$$1 () {
|
||
if (--remove$$1.listeners === 0) {
|
||
removeNode(childElm);
|
||
}
|
||
}
|
||
remove$$1.listeners = listeners;
|
||
return remove$$1
|
||
}
|
||
|
||
function removeNode (el) {
|
||
var parent = nodeOps.parentNode(el);
|
||
// element may have already been removed due to v-html / v-text
|
||
if (isDef(parent)) {
|
||
nodeOps.removeChild(parent, el);
|
||
}
|
||
}
|
||
|
||
function isUnknownElement$$1 (vnode, inVPre) {
|
||
return (
|
||
!inVPre &&
|
||
!vnode.ns &&
|
||
!(
|
||
config.ignoredElements.length &&
|
||
config.ignoredElements.some(function (ignore) {
|
||
return isRegExp(ignore)
|
||
? ignore.test(vnode.tag)
|
||
: ignore === vnode.tag
|
||
})
|
||
) &&
|
||
config.isUnknownElement(vnode.tag)
|
||
)
|
||
}
|
||
|
||
var creatingElmInVPre = 0;
|
||
|
||
function createElm (
|
||
vnode,
|
||
insertedVnodeQueue,
|
||
parentElm,
|
||
refElm,
|
||
nested,
|
||
ownerArray,
|
||
index
|
||
) {
|
||
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
||
// This vnode was used in a previous render!
|
||
// now it's used as a new node, overwriting its elm would cause
|
||
// potential patch errors down the road when it's used as an insertion
|
||
// reference node. Instead, we clone the node on-demand before creating
|
||
// associated DOM element for it.
|
||
vnode = ownerArray[index] = cloneVNode(vnode);
|
||
}
|
||
|
||
vnode.isRootInsert = !nested; // for transition enter check
|
||
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
||
return
|
||
}
|
||
|
||
var data = vnode.data;
|
||
var children = vnode.children;
|
||
var tag = vnode.tag;
|
||
if (isDef(tag)) {
|
||
{
|
||
if (data && data.pre) {
|
||
creatingElmInVPre++;
|
||
}
|
||
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
||
warn(
|
||
'Unknown custom element: <' + tag + '> - did you ' +
|
||
'register the component correctly? For recursive components, ' +
|
||
'make sure to provide the "name" option.',
|
||
vnode.context
|
||
);
|
||
}
|
||
}
|
||
|
||
vnode.elm = vnode.ns
|
||
? nodeOps.createElementNS(vnode.ns, tag)
|
||
: nodeOps.createElement(tag, vnode);
|
||
setScope(vnode);
|
||
|
||
/* istanbul ignore if */
|
||
{
|
||
createChildren(vnode, children, insertedVnodeQueue);
|
||
if (isDef(data)) {
|
||
invokeCreateHooks(vnode, insertedVnodeQueue);
|
||
}
|
||
insert(parentElm, vnode.elm, refElm);
|
||
}
|
||
|
||
if (data && data.pre) {
|
||
creatingElmInVPre--;
|
||
}
|
||
} else if (isTrue(vnode.isComment)) {
|
||
vnode.elm = nodeOps.createComment(vnode.text);
|
||
insert(parentElm, vnode.elm, refElm);
|
||
} else {
|
||
vnode.elm = nodeOps.createTextNode(vnode.text);
|
||
insert(parentElm, vnode.elm, refElm);
|
||
}
|
||
}
|
||
|
||
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
||
var i = vnode.data;
|
||
if (isDef(i)) {
|
||
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
||
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
||
i(vnode, false /* hydrating */);
|
||
}
|
||
// after calling the init hook, if the vnode is a child component
|
||
// it should've created a child instance and mounted it. the child
|
||
// component also has set the placeholder vnode's elm.
|
||
// in that case we can just return the element and be done.
|
||
if (isDef(vnode.componentInstance)) {
|
||
initComponent(vnode, insertedVnodeQueue);
|
||
insert(parentElm, vnode.elm, refElm);
|
||
if (isTrue(isReactivated)) {
|
||
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
||
}
|
||
return true
|
||
}
|
||
}
|
||
}
|
||
|
||
function initComponent (vnode, insertedVnodeQueue) {
|
||
if (isDef(vnode.data.pendingInsert)) {
|
||
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
||
vnode.data.pendingInsert = null;
|
||
}
|
||
vnode.elm = vnode.componentInstance.$el;
|
||
if (isPatchable(vnode)) {
|
||
invokeCreateHooks(vnode, insertedVnodeQueue);
|
||
setScope(vnode);
|
||
} else {
|
||
// empty component root.
|
||
// skip all element-related modules except for ref (#3455)
|
||
registerRef(vnode);
|
||
// make sure to invoke the insert hook
|
||
insertedVnodeQueue.push(vnode);
|
||
}
|
||
}
|
||
|
||
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
||
var i;
|
||
// hack for #4339: a reactivated component with inner transition
|
||
// does not trigger because the inner node's created hooks are not called
|
||
// again. It's not ideal to involve module-specific logic in here but
|
||
// there doesn't seem to be a better way to do it.
|
||
var innerNode = vnode;
|
||
while (innerNode.componentInstance) {
|
||
innerNode = innerNode.componentInstance._vnode;
|
||
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
||
for (i = 0; i < cbs.activate.length; ++i) {
|
||
cbs.activate[i](emptyNode, innerNode);
|
||
}
|
||
insertedVnodeQueue.push(innerNode);
|
||
break
|
||
}
|
||
}
|
||
// unlike a newly created component,
|
||
// a reactivated keep-alive component doesn't insert itself
|
||
insert(parentElm, vnode.elm, refElm);
|
||
}
|
||
|
||
function insert (parent, elm, ref$$1) {
|
||
if (isDef(parent)) {
|
||
if (isDef(ref$$1)) {
|
||
if (nodeOps.parentNode(ref$$1) === parent) {
|
||
nodeOps.insertBefore(parent, elm, ref$$1);
|
||
}
|
||
} else {
|
||
nodeOps.appendChild(parent, elm);
|
||
}
|
||
}
|
||
}
|
||
|
||
function createChildren (vnode, children, insertedVnodeQueue) {
|
||
if (Array.isArray(children)) {
|
||
{
|
||
checkDuplicateKeys(children);
|
||
}
|
||
for (var i = 0; i < children.length; ++i) {
|
||
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
||
}
|
||
} else if (isPrimitive(vnode.text)) {
|
||
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
||
}
|
||
}
|
||
|
||
function isPatchable (vnode) {
|
||
while (vnode.componentInstance) {
|
||
vnode = vnode.componentInstance._vnode;
|
||
}
|
||
return isDef(vnode.tag)
|
||
}
|
||
|
||
function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
||
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
||
cbs.create[i$1](emptyNode, vnode);
|
||
}
|
||
i = vnode.data.hook; // Reuse variable
|
||
if (isDef(i)) {
|
||
if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
||
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
||
}
|
||
}
|
||
|
||
// set scope id attribute for scoped CSS.
|
||
// this is implemented as a special case to avoid the overhead
|
||
// of going through the normal attribute patching process.
|
||
function setScope (vnode) {
|
||
var i;
|
||
if (isDef(i = vnode.fnScopeId)) {
|
||
nodeOps.setStyleScope(vnode.elm, i);
|
||
} else {
|
||
var ancestor = vnode;
|
||
while (ancestor) {
|
||
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
||
nodeOps.setStyleScope(vnode.elm, i);
|
||
}
|
||
ancestor = ancestor.parent;
|
||
}
|
||
}
|
||
// for slot content they should also get the scopeId from the host instance.
|
||
if (isDef(i = activeInstance) &&
|
||
i !== vnode.context &&
|
||
i !== vnode.fnContext &&
|
||
isDef(i = i.$options._scopeId)
|
||
) {
|
||
nodeOps.setStyleScope(vnode.elm, i);
|
||
}
|
||
}
|
||
|
||
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
||
for (; startIdx <= endIdx; ++startIdx) {
|
||
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
||
}
|
||
}
|
||
|
||
function invokeDestroyHook (vnode) {
|
||
var i, j;
|
||
var data = vnode.data;
|
||
if (isDef(data)) {
|
||
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
||
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
||
}
|
||
if (isDef(i = vnode.children)) {
|
||
for (j = 0; j < vnode.children.length; ++j) {
|
||
invokeDestroyHook(vnode.children[j]);
|
||
}
|
||
}
|
||
}
|
||
|
||
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
||
for (; startIdx <= endIdx; ++startIdx) {
|
||
var ch = vnodes[startIdx];
|
||
if (isDef(ch)) {
|
||
if (isDef(ch.tag)) {
|
||
removeAndInvokeRemoveHook(ch);
|
||
invokeDestroyHook(ch);
|
||
} else { // Text node
|
||
removeNode(ch.elm);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function removeAndInvokeRemoveHook (vnode, rm) {
|
||
if (isDef(rm) || isDef(vnode.data)) {
|
||
var i;
|
||
var listeners = cbs.remove.length + 1;
|
||
if (isDef(rm)) {
|
||
// we have a recursively passed down rm callback
|
||
// increase the listeners count
|
||
rm.listeners += listeners;
|
||
} else {
|
||
// directly removing
|
||
rm = createRmCb(vnode.elm, listeners);
|
||
}
|
||
// recursively invoke hooks on child component root node
|
||
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
||
removeAndInvokeRemoveHook(i, rm);
|
||
}
|
||
for (i = 0; i < cbs.remove.length; ++i) {
|
||
cbs.remove[i](vnode, rm);
|
||
}
|
||
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
||
i(vnode, rm);
|
||
} else {
|
||
rm();
|
||
}
|
||
} else {
|
||
removeNode(vnode.elm);
|
||
}
|
||
}
|
||
|
||
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
||
var oldStartIdx = 0;
|
||
var newStartIdx = 0;
|
||
var oldEndIdx = oldCh.length - 1;
|
||
var oldStartVnode = oldCh[0];
|
||
var oldEndVnode = oldCh[oldEndIdx];
|
||
var newEndIdx = newCh.length - 1;
|
||
var newStartVnode = newCh[0];
|
||
var newEndVnode = newCh[newEndIdx];
|
||
var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
||
|
||
// removeOnly is a special flag used only by <transition-group>
|
||
// to ensure removed elements stay in correct relative positions
|
||
// during leaving transitions
|
||
var canMove = !removeOnly;
|
||
|
||
{
|
||
checkDuplicateKeys(newCh);
|
||
}
|
||
|
||
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
||
if (isUndef(oldStartVnode)) {
|
||
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
|
||
} else if (isUndef(oldEndVnode)) {
|
||
oldEndVnode = oldCh[--oldEndIdx];
|
||
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
||
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
||
oldStartVnode = oldCh[++oldStartIdx];
|
||
newStartVnode = newCh[++newStartIdx];
|
||
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
||
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
||
oldEndVnode = oldCh[--oldEndIdx];
|
||
newEndVnode = newCh[--newEndIdx];
|
||
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
|
||
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
||
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
||
oldStartVnode = oldCh[++oldStartIdx];
|
||
newEndVnode = newCh[--newEndIdx];
|
||
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
|
||
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
||
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
||
oldEndVnode = oldCh[--oldEndIdx];
|
||
newStartVnode = newCh[++newStartIdx];
|
||
} else {
|
||
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
||
idxInOld = isDef(newStartVnode.key)
|
||
? oldKeyToIdx[newStartVnode.key]
|
||
: findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
||
if (isUndef(idxInOld)) { // New element
|
||
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
||
} else {
|
||
vnodeToMove = oldCh[idxInOld];
|
||
if (sameVnode(vnodeToMove, newStartVnode)) {
|
||
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
||
oldCh[idxInOld] = undefined;
|
||
canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
||
} else {
|
||
// same key but different element. treat as new element
|
||
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
||
}
|
||
}
|
||
newStartVnode = newCh[++newStartIdx];
|
||
}
|
||
}
|
||
if (oldStartIdx > oldEndIdx) {
|
||
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
||
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
||
} else if (newStartIdx > newEndIdx) {
|
||
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
||
}
|
||
}
|
||
|
||
function checkDuplicateKeys (children) {
|
||
var seenKeys = {};
|
||
for (var i = 0; i < children.length; i++) {
|
||
var vnode = children[i];
|
||
var key = vnode.key;
|
||
if (isDef(key)) {
|
||
if (seenKeys[key]) {
|
||
warn(
|
||
("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
||
vnode.context
|
||
);
|
||
} else {
|
||
seenKeys[key] = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function findIdxInOld (node, oldCh, start, end) {
|
||
for (var i = start; i < end; i++) {
|
||
var c = oldCh[i];
|
||
if (isDef(c) && sameVnode(node, c)) { return i }
|
||
}
|
||
}
|
||
|
||
function patchVnode (
|
||
oldVnode,
|
||
vnode,
|
||
insertedVnodeQueue,
|
||
ownerArray,
|
||
index,
|
||
removeOnly
|
||
) {
|
||
if (oldVnode === vnode) {
|
||
return
|
||
}
|
||
|
||
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
||
// clone reused vnode
|
||
vnode = ownerArray[index] = cloneVNode(vnode);
|
||
}
|
||
|
||
var elm = vnode.elm = oldVnode.elm;
|
||
|
||
if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
||
if (isDef(vnode.asyncFactory.resolved)) {
|
||
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
||
} else {
|
||
vnode.isAsyncPlaceholder = true;
|
||
}
|
||
return
|
||
}
|
||
|
||
// reuse element for static trees.
|
||
// note we only do this if the vnode is cloned -
|
||
// if the new node is not cloned it means the render functions have been
|
||
// reset by the hot-reload-api and we need to do a proper re-render.
|
||
if (isTrue(vnode.isStatic) &&
|
||
isTrue(oldVnode.isStatic) &&
|
||
vnode.key === oldVnode.key &&
|
||
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
||
) {
|
||
vnode.componentInstance = oldVnode.componentInstance;
|
||
return
|
||
}
|
||
|
||
var i;
|
||
var data = vnode.data;
|
||
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
||
i(oldVnode, vnode);
|
||
}
|
||
|
||
var oldCh = oldVnode.children;
|
||
var ch = vnode.children;
|
||
if (isDef(data) && isPatchable(vnode)) {
|
||
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
||
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
||
}
|
||
if (isUndef(vnode.text)) {
|
||
if (isDef(oldCh) && isDef(ch)) {
|
||
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
||
} else if (isDef(ch)) {
|
||
{
|
||
checkDuplicateKeys(ch);
|
||
}
|
||
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
||
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
||
} else if (isDef(oldCh)) {
|
||
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
||
} else if (isDef(oldVnode.text)) {
|
||
nodeOps.setTextContent(elm, '');
|
||
}
|
||
} else if (oldVnode.text !== vnode.text) {
|
||
nodeOps.setTextContent(elm, vnode.text);
|
||
}
|
||
if (isDef(data)) {
|
||
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
||
}
|
||
}
|
||
|
||
function invokeInsertHook (vnode, queue, initial) {
|
||
// delay insert hooks for component root nodes, invoke them after the
|
||
// element is really inserted
|
||
if (isTrue(initial) && isDef(vnode.parent)) {
|
||
vnode.parent.data.pendingInsert = queue;
|
||
} else {
|
||
for (var i = 0; i < queue.length; ++i) {
|
||
queue[i].data.hook.insert(queue[i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
var hydrationBailed = false;
|
||
// list of modules that can skip create hook during hydration because they
|
||
// are already rendered on the client or has no need for initialization
|
||
// Note: style is excluded because it relies on initial clone for future
|
||
// deep updates (#7063).
|
||
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
||
|
||
// Note: this is a browser-only function so we can assume elms are DOM nodes.
|
||
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
||
var i;
|
||
var tag = vnode.tag;
|
||
var data = vnode.data;
|
||
var children = vnode.children;
|
||
inVPre = inVPre || (data && data.pre);
|
||
vnode.elm = elm;
|
||
|
||
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
||
vnode.isAsyncPlaceholder = true;
|
||
return true
|
||
}
|
||
// assert node match
|
||
{
|
||
if (!assertNodeMatch(elm, vnode, inVPre)) {
|
||
return false
|
||
}
|
||
}
|
||
if (isDef(data)) {
|
||
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
|
||
if (isDef(i = vnode.componentInstance)) {
|
||
// child component. it should have hydrated its own tree.
|
||
initComponent(vnode, insertedVnodeQueue);
|
||
return true
|
||
}
|
||
}
|
||
if (isDef(tag)) {
|
||
if (isDef(children)) {
|
||
// empty element, allow client to pick up and populate children
|
||
if (!elm.hasChildNodes()) {
|
||
createChildren(vnode, children, insertedVnodeQueue);
|
||
} else {
|
||
// v-html and domProps: innerHTML
|
||
if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
||
if (i !== elm.innerHTML) {
|
||
/* istanbul ignore if */
|
||
if (typeof console !== 'undefined' &&
|
||
!hydrationBailed
|
||
) {
|
||
hydrationBailed = true;
|
||
console.warn('Parent: ', elm);
|
||
console.warn('server innerHTML: ', i);
|
||
console.warn('client innerHTML: ', elm.innerHTML);
|
||
}
|
||
return false
|
||
}
|
||
} else {
|
||
// iterate and compare children lists
|
||
var childrenMatch = true;
|
||
var childNode = elm.firstChild;
|
||
for (var i$1 = 0; i$1 < children.length; i$1++) {
|
||
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
||
childrenMatch = false;
|
||
break
|
||
}
|
||
childNode = childNode.nextSibling;
|
||
}
|
||
// if childNode is not null, it means the actual childNodes list is
|
||
// longer than the virtual children list.
|
||
if (!childrenMatch || childNode) {
|
||
/* istanbul ignore if */
|
||
if (typeof console !== 'undefined' &&
|
||
!hydrationBailed
|
||
) {
|
||
hydrationBailed = true;
|
||
console.warn('Parent: ', elm);
|
||
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
||
}
|
||
return false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (isDef(data)) {
|
||
var fullInvoke = false;
|
||
for (var key in data) {
|
||
if (!isRenderedModule(key)) {
|
||
fullInvoke = true;
|
||
invokeCreateHooks(vnode, insertedVnodeQueue);
|
||
break
|
||
}
|
||
}
|
||
if (!fullInvoke && data['class']) {
|
||
// ensure collecting deps for deep class bindings for future updates
|
||
traverse(data['class']);
|
||
}
|
||
}
|
||
} else if (elm.data !== vnode.text) {
|
||
elm.data = vnode.text;
|
||
}
|
||
return true
|
||
}
|
||
|
||
function assertNodeMatch (node, vnode, inVPre) {
|
||
if (isDef(vnode.tag)) {
|
||
return vnode.tag.indexOf('vue-component') === 0 || (
|
||
!isUnknownElement$$1(vnode, inVPre) &&
|
||
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
||
)
|
||
} else {
|
||
return node.nodeType === (vnode.isComment ? 8 : 3)
|
||
}
|
||
}
|
||
|
||
return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
||
if (isUndef(vnode)) {
|
||
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
||
return
|
||
}
|
||
|
||
var isInitialPatch = false;
|
||
var insertedVnodeQueue = [];
|
||
|
||
if (isUndef(oldVnode)) {
|
||
// empty mount (likely as component), create new root element
|
||
isInitialPatch = true;
|
||
createElm(vnode, insertedVnodeQueue);
|
||
} else {
|
||
var isRealElement = isDef(oldVnode.nodeType);
|
||
if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
||
// patch existing root node
|
||
patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
||
} else {
|
||
if (isRealElement) {
|
||
// mounting to a real element
|
||
// check if this is server-rendered content and if we can perform
|
||
// a successful hydration.
|
||
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
||
oldVnode.removeAttribute(SSR_ATTR);
|
||
hydrating = true;
|
||
}
|
||
if (isTrue(hydrating)) {
|
||
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
||
invokeInsertHook(vnode, insertedVnodeQueue, true);
|
||
return oldVnode
|
||
} else {
|
||
warn(
|
||
'The client-side rendered virtual DOM tree is not matching ' +
|
||
'server-rendered content. This is likely caused by incorrect ' +
|
||
'HTML markup, for example nesting block-level elements inside ' +
|
||
'<p>, or missing <tbody>. Bailing hydration and performing ' +
|
||
'full client-side render.'
|
||
);
|
||
}
|
||
}
|
||
// either not server-rendered, or hydration failed.
|
||
// create an empty node and replace it
|
||
oldVnode = emptyNodeAt(oldVnode);
|
||
}
|
||
|
||
// replacing existing element
|
||
var oldElm = oldVnode.elm;
|
||
var parentElm = nodeOps.parentNode(oldElm);
|
||
|
||
// create new node
|
||
createElm(
|
||
vnode,
|
||
insertedVnodeQueue,
|
||
// extremely rare edge case: do not insert if old element is in a
|
||
// leaving transition. Only happens when combining transition +
|
||
// keep-alive + HOCs. (#4590)
|
||
oldElm._leaveCb ? null : parentElm,
|
||
nodeOps.nextSibling(oldElm)
|
||
);
|
||
|
||
// update parent placeholder node element, recursively
|
||
if (isDef(vnode.parent)) {
|
||
var ancestor = vnode.parent;
|
||
var patchable = isPatchable(vnode);
|
||
while (ancestor) {
|
||
for (var i = 0; i < cbs.destroy.length; ++i) {
|
||
cbs.destroy[i](ancestor);
|
||
}
|
||
ancestor.elm = vnode.elm;
|
||
if (patchable) {
|
||
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
||
cbs.create[i$1](emptyNode, ancestor);
|
||
}
|
||
// #6513
|
||
// invoke insert hooks that may have been merged by create hooks.
|
||
// e.g. for directives that uses the "inserted" hook.
|
||
var insert = ancestor.data.hook.insert;
|
||
if (insert.merged) {
|
||
// start at index 1 to avoid re-invoking component mounted hook
|
||
for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
||
insert.fns[i$2]();
|
||
}
|
||
}
|
||
} else {
|
||
registerRef(ancestor);
|
||
}
|
||
ancestor = ancestor.parent;
|
||
}
|
||
}
|
||
|
||
// destroy old node
|
||
if (isDef(parentElm)) {
|
||
removeVnodes(parentElm, [oldVnode], 0, 0);
|
||
} else if (isDef(oldVnode.tag)) {
|
||
invokeDestroyHook(oldVnode);
|
||
}
|
||
}
|
||
}
|
||
|
||
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
||
return vnode.elm
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var directives = {
|
||
create: updateDirectives,
|
||
update: updateDirectives,
|
||
destroy: function unbindDirectives (vnode) {
|
||
updateDirectives(vnode, emptyNode);
|
||
}
|
||
};
|
||
|
||
function updateDirectives (oldVnode, vnode) {
|
||
if (oldVnode.data.directives || vnode.data.directives) {
|
||
_update(oldVnode, vnode);
|
||
}
|
||
}
|
||
|
||
function _update (oldVnode, vnode) {
|
||
var isCreate = oldVnode === emptyNode;
|
||
var isDestroy = vnode === emptyNode;
|
||
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
||
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
||
|
||
var dirsWithInsert = [];
|
||
var dirsWithPostpatch = [];
|
||
|
||
var key, oldDir, dir;
|
||
for (key in newDirs) {
|
||
oldDir = oldDirs[key];
|
||
dir = newDirs[key];
|
||
if (!oldDir) {
|
||
// new directive, bind
|
||
callHook$1(dir, 'bind', vnode, oldVnode);
|
||
if (dir.def && dir.def.inserted) {
|
||
dirsWithInsert.push(dir);
|
||
}
|
||
} else {
|
||
// existing directive, update
|
||
dir.oldValue = oldDir.value;
|
||
dir.oldArg = oldDir.arg;
|
||
callHook$1(dir, 'update', vnode, oldVnode);
|
||
if (dir.def && dir.def.componentUpdated) {
|
||
dirsWithPostpatch.push(dir);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (dirsWithInsert.length) {
|
||
var callInsert = function () {
|
||
for (var i = 0; i < dirsWithInsert.length; i++) {
|
||
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
||
}
|
||
};
|
||
if (isCreate) {
|
||
mergeVNodeHook(vnode, 'insert', callInsert);
|
||
} else {
|
||
callInsert();
|
||
}
|
||
}
|
||
|
||
if (dirsWithPostpatch.length) {
|
||
mergeVNodeHook(vnode, 'postpatch', function () {
|
||
for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
||
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
||
}
|
||
});
|
||
}
|
||
|
||
if (!isCreate) {
|
||
for (key in oldDirs) {
|
||
if (!newDirs[key]) {
|
||
// no longer present, unbind
|
||
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
var emptyModifiers = Object.create(null);
|
||
|
||
function normalizeDirectives$1 (
|
||
dirs,
|
||
vm
|
||
) {
|
||
var res = Object.create(null);
|
||
if (!dirs) {
|
||
// $flow-disable-line
|
||
return res
|
||
}
|
||
var i, dir;
|
||
for (i = 0; i < dirs.length; i++) {
|
||
dir = dirs[i];
|
||
if (!dir.modifiers) {
|
||
// $flow-disable-line
|
||
dir.modifiers = emptyModifiers;
|
||
}
|
||
res[getRawDirName(dir)] = dir;
|
||
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
||
}
|
||
// $flow-disable-line
|
||
return res
|
||
}
|
||
|
||
function getRawDirName (dir) {
|
||
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
||
}
|
||
|
||
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
||
var fn = dir.def && dir.def[hook];
|
||
if (fn) {
|
||
try {
|
||
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
||
} catch (e) {
|
||
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
||
}
|
||
}
|
||
}
|
||
|
||
var baseModules = [
|
||
ref,
|
||
directives
|
||
];
|
||
|
||
/* */
|
||
|
||
function updateAttrs (oldVnode, vnode) {
|
||
var opts = vnode.componentOptions;
|
||
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
||
return
|
||
}
|
||
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
||
return
|
||
}
|
||
var key, cur, old;
|
||
var elm = vnode.elm;
|
||
var oldAttrs = oldVnode.data.attrs || {};
|
||
var attrs = vnode.data.attrs || {};
|
||
// clone observed objects, as the user probably wants to mutate it
|
||
if (isDef(attrs.__ob__)) {
|
||
attrs = vnode.data.attrs = extend({}, attrs);
|
||
}
|
||
|
||
for (key in attrs) {
|
||
cur = attrs[key];
|
||
old = oldAttrs[key];
|
||
if (old !== cur) {
|
||
setAttr(elm, key, cur);
|
||
}
|
||
}
|
||
// #4391: in IE9, setting type can reset value for input[type=radio]
|
||
// #6666: IE/Edge forces progress value down to 1 before setting a max
|
||
/* istanbul ignore if */
|
||
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
||
setAttr(elm, 'value', attrs.value);
|
||
}
|
||
for (key in oldAttrs) {
|
||
if (isUndef(attrs[key])) {
|
||
if (isXlink(key)) {
|
||
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
||
} else if (!isEnumeratedAttr(key)) {
|
||
elm.removeAttribute(key);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function setAttr (el, key, value) {
|
||
if (el.tagName.indexOf('-') > -1) {
|
||
baseSetAttr(el, key, value);
|
||
} else if (isBooleanAttr(key)) {
|
||
// set attribute for blank value
|
||
// e.g. <option disabled>Select one</option>
|
||
if (isFalsyAttrValue(value)) {
|
||
el.removeAttribute(key);
|
||
} else {
|
||
// technically allowfullscreen is a boolean attribute for <iframe>,
|
||
// but Flash expects a value of "true" when used on <embed> tag
|
||
value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
||
? 'true'
|
||
: key;
|
||
el.setAttribute(key, value);
|
||
}
|
||
} else if (isEnumeratedAttr(key)) {
|
||
el.setAttribute(key, convertEnumeratedValue(key, value));
|
||
} else if (isXlink(key)) {
|
||
if (isFalsyAttrValue(value)) {
|
||
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
||
} else {
|
||
el.setAttributeNS(xlinkNS, key, value);
|
||
}
|
||
} else {
|
||
baseSetAttr(el, key, value);
|
||
}
|
||
}
|
||
|
||
function baseSetAttr (el, key, value) {
|
||
if (isFalsyAttrValue(value)) {
|
||
el.removeAttribute(key);
|
||
} else {
|
||
// #7138: IE10 & 11 fires input event when setting placeholder on
|
||
// <textarea>... block the first input event and remove the blocker
|
||
// immediately.
|
||
/* istanbul ignore if */
|
||
if (
|
||
isIE && !isIE9 &&
|
||
el.tagName === 'TEXTAREA' &&
|
||
key === 'placeholder' && value !== '' && !el.__ieph
|
||
) {
|
||
var blocker = function (e) {
|
||
e.stopImmediatePropagation();
|
||
el.removeEventListener('input', blocker);
|
||
};
|
||
el.addEventListener('input', blocker);
|
||
// $flow-disable-line
|
||
el.__ieph = true; /* IE placeholder patched */
|
||
}
|
||
el.setAttribute(key, value);
|
||
}
|
||
}
|
||
|
||
var attrs = {
|
||
create: updateAttrs,
|
||
update: updateAttrs
|
||
};
|
||
|
||
/* */
|
||
|
||
function updateClass (oldVnode, vnode) {
|
||
var el = vnode.elm;
|
||
var data = vnode.data;
|
||
var oldData = oldVnode.data;
|
||
if (
|
||
isUndef(data.staticClass) &&
|
||
isUndef(data.class) && (
|
||
isUndef(oldData) || (
|
||
isUndef(oldData.staticClass) &&
|
||
isUndef(oldData.class)
|
||
)
|
||
)
|
||
) {
|
||
return
|
||
}
|
||
|
||
var cls = genClassForVnode(vnode);
|
||
|
||
// handle transition classes
|
||
var transitionClass = el._transitionClasses;
|
||
if (isDef(transitionClass)) {
|
||
cls = concat(cls, stringifyClass(transitionClass));
|
||
}
|
||
|
||
// set the class
|
||
if (cls !== el._prevClass) {
|
||
el.setAttribute('class', cls);
|
||
el._prevClass = cls;
|
||
}
|
||
}
|
||
|
||
var klass = {
|
||
create: updateClass,
|
||
update: updateClass
|
||
};
|
||
|
||
/* */
|
||
|
||
var validDivisionCharRE = /[\w).+\-_$\]]/;
|
||
|
||
function parseFilters (exp) {
|
||
var inSingle = false;
|
||
var inDouble = false;
|
||
var inTemplateString = false;
|
||
var inRegex = false;
|
||
var curly = 0;
|
||
var square = 0;
|
||
var paren = 0;
|
||
var lastFilterIndex = 0;
|
||
var c, prev, i, expression, filters;
|
||
|
||
for (i = 0; i < exp.length; i++) {
|
||
prev = c;
|
||
c = exp.charCodeAt(i);
|
||
if (inSingle) {
|
||
if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
||
} else if (inDouble) {
|
||
if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
||
} else if (inTemplateString) {
|
||
if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
||
} else if (inRegex) {
|
||
if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
||
} else if (
|
||
c === 0x7C && // pipe
|
||
exp.charCodeAt(i + 1) !== 0x7C &&
|
||
exp.charCodeAt(i - 1) !== 0x7C &&
|
||
!curly && !square && !paren
|
||
) {
|
||
if (expression === undefined) {
|
||
// first filter, end of expression
|
||
lastFilterIndex = i + 1;
|
||
expression = exp.slice(0, i).trim();
|
||
} else {
|
||
pushFilter();
|
||
}
|
||
} else {
|
||
switch (c) {
|
||
case 0x22: inDouble = true; break // "
|
||
case 0x27: inSingle = true; break // '
|
||
case 0x60: inTemplateString = true; break // `
|
||
case 0x28: paren++; break // (
|
||
case 0x29: paren--; break // )
|
||
case 0x5B: square++; break // [
|
||
case 0x5D: square--; break // ]
|
||
case 0x7B: curly++; break // {
|
||
case 0x7D: curly--; break // }
|
||
}
|
||
if (c === 0x2f) { // /
|
||
var j = i - 1;
|
||
var p = (void 0);
|
||
// find first non-whitespace prev char
|
||
for (; j >= 0; j--) {
|
||
p = exp.charAt(j);
|
||
if (p !== ' ') { break }
|
||
}
|
||
if (!p || !validDivisionCharRE.test(p)) {
|
||
inRegex = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (expression === undefined) {
|
||
expression = exp.slice(0, i).trim();
|
||
} else if (lastFilterIndex !== 0) {
|
||
pushFilter();
|
||
}
|
||
|
||
function pushFilter () {
|
||
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
||
lastFilterIndex = i + 1;
|
||
}
|
||
|
||
if (filters) {
|
||
for (i = 0; i < filters.length; i++) {
|
||
expression = wrapFilter(expression, filters[i]);
|
||
}
|
||
}
|
||
|
||
return expression
|
||
}
|
||
|
||
function wrapFilter (exp, filter) {
|
||
var i = filter.indexOf('(');
|
||
if (i < 0) {
|
||
// _f: resolveFilter
|
||
return ("_f(\"" + filter + "\")(" + exp + ")")
|
||
} else {
|
||
var name = filter.slice(0, i);
|
||
var args = filter.slice(i + 1);
|
||
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
/* eslint-disable no-unused-vars */
|
||
function baseWarn (msg, range) {
|
||
console.error(("[Vue compiler]: " + msg));
|
||
}
|
||
/* eslint-enable no-unused-vars */
|
||
|
||
function pluckModuleFunction (
|
||
modules,
|
||
key
|
||
) {
|
||
return modules
|
||
? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
||
: []
|
||
}
|
||
|
||
function addProp (el, name, value, range, dynamic) {
|
||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||
el.plain = false;
|
||
}
|
||
|
||
function addAttr (el, name, value, range, dynamic) {
|
||
var attrs = dynamic
|
||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||
: (el.attrs || (el.attrs = []));
|
||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||
el.plain = false;
|
||
}
|
||
|
||
// add a raw attr (use this in preTransforms)
|
||
function addRawAttr (el, name, value, range) {
|
||
el.attrsMap[name] = value;
|
||
el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
||
}
|
||
|
||
function addDirective (
|
||
el,
|
||
name,
|
||
rawName,
|
||
value,
|
||
arg,
|
||
isDynamicArg,
|
||
modifiers,
|
||
range
|
||
) {
|
||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||
name: name,
|
||
rawName: rawName,
|
||
value: value,
|
||
arg: arg,
|
||
isDynamicArg: isDynamicArg,
|
||
modifiers: modifiers
|
||
}, range));
|
||
el.plain = false;
|
||
}
|
||
|
||
function prependModifierMarker (symbol, name, dynamic) {
|
||
return dynamic
|
||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||
: symbol + name // mark the event as captured
|
||
}
|
||
|
||
function addHandler (
|
||
el,
|
||
name,
|
||
value,
|
||
modifiers,
|
||
important,
|
||
warn,
|
||
range,
|
||
dynamic
|
||
) {
|
||
modifiers = modifiers || emptyObject;
|
||
// warn prevent and passive modifier
|
||
/* istanbul ignore if */
|
||
if (
|
||
warn &&
|
||
modifiers.prevent && modifiers.passive
|
||
) {
|
||
warn(
|
||
'passive and prevent can\'t be used together. ' +
|
||
'Passive handler can\'t prevent default event.',
|
||
range
|
||
);
|
||
}
|
||
|
||
// normalize click.right and click.middle since they don't actually fire
|
||
// this is technically browser-specific, but at least for now browsers are
|
||
// the only target envs that have right/middle clicks.
|
||
if (modifiers.right) {
|
||
if (dynamic) {
|
||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||
} else if (name === 'click') {
|
||
name = 'contextmenu';
|
||
delete modifiers.right;
|
||
}
|
||
} else if (modifiers.middle) {
|
||
if (dynamic) {
|
||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||
} else if (name === 'click') {
|
||
name = 'mouseup';
|
||
}
|
||
}
|
||
|
||
// check capture modifier
|
||
if (modifiers.capture) {
|
||
delete modifiers.capture;
|
||
name = prependModifierMarker('!', name, dynamic);
|
||
}
|
||
if (modifiers.once) {
|
||
delete modifiers.once;
|
||
name = prependModifierMarker('~', name, dynamic);
|
||
}
|
||
/* istanbul ignore if */
|
||
if (modifiers.passive) {
|
||
delete modifiers.passive;
|
||
name = prependModifierMarker('&', name, dynamic);
|
||
}
|
||
|
||
var events;
|
||
if (modifiers.native) {
|
||
delete modifiers.native;
|
||
events = el.nativeEvents || (el.nativeEvents = {});
|
||
} else {
|
||
events = el.events || (el.events = {});
|
||
}
|
||
|
||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||
if (modifiers !== emptyObject) {
|
||
newHandler.modifiers = modifiers;
|
||
}
|
||
|
||
var handlers = events[name];
|
||
/* istanbul ignore if */
|
||
if (Array.isArray(handlers)) {
|
||
important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
||
} else if (handlers) {
|
||
events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
||
} else {
|
||
events[name] = newHandler;
|
||
}
|
||
|
||
el.plain = false;
|
||
}
|
||
|
||
function getRawBindingAttr (
|
||
el,
|
||
name
|
||
) {
|
||
return el.rawAttrsMap[':' + name] ||
|
||
el.rawAttrsMap['v-bind:' + name] ||
|
||
el.rawAttrsMap[name]
|
||
}
|
||
|
||
function getBindingAttr (
|
||
el,
|
||
name,
|
||
getStatic
|
||
) {
|
||
var dynamicValue =
|
||
getAndRemoveAttr(el, ':' + name) ||
|
||
getAndRemoveAttr(el, 'v-bind:' + name);
|
||
if (dynamicValue != null) {
|
||
return parseFilters(dynamicValue)
|
||
} else if (getStatic !== false) {
|
||
var staticValue = getAndRemoveAttr(el, name);
|
||
if (staticValue != null) {
|
||
return JSON.stringify(staticValue)
|
||
}
|
||
}
|
||
}
|
||
|
||
// note: this only removes the attr from the Array (attrsList) so that it
|
||
// doesn't get processed by processAttrs.
|
||
// By default it does NOT remove it from the map (attrsMap) because the map is
|
||
// needed during codegen.
|
||
function getAndRemoveAttr (
|
||
el,
|
||
name,
|
||
removeFromMap
|
||
) {
|
||
var val;
|
||
if ((val = el.attrsMap[name]) != null) {
|
||
var list = el.attrsList;
|
||
for (var i = 0, l = list.length; i < l; i++) {
|
||
if (list[i].name === name) {
|
||
list.splice(i, 1);
|
||
break
|
||
}
|
||
}
|
||
}
|
||
if (removeFromMap) {
|
||
delete el.attrsMap[name];
|
||
}
|
||
return val
|
||
}
|
||
|
||
function getAndRemoveAttrByRegex (
|
||
el,
|
||
name
|
||
) {
|
||
var list = el.attrsList;
|
||
for (var i = 0, l = list.length; i < l; i++) {
|
||
var attr = list[i];
|
||
if (name.test(attr.name)) {
|
||
list.splice(i, 1);
|
||
return attr
|
||
}
|
||
}
|
||
}
|
||
|
||
function rangeSetItem (
|
||
item,
|
||
range
|
||
) {
|
||
if (range) {
|
||
if (range.start != null) {
|
||
item.start = range.start;
|
||
}
|
||
if (range.end != null) {
|
||
item.end = range.end;
|
||
}
|
||
}
|
||
return item
|
||
}
|
||
|
||
/* */
|
||
|
||
/**
|
||
* Cross-platform code generation for component v-model
|
||
*/
|
||
function genComponentModel (
|
||
el,
|
||
value,
|
||
modifiers
|
||
) {
|
||
var ref = modifiers || {};
|
||
var number = ref.number;
|
||
var trim = ref.trim;
|
||
|
||
var baseValueExpression = '$$v';
|
||
var valueExpression = baseValueExpression;
|
||
if (trim) {
|
||
valueExpression =
|
||
"(typeof " + baseValueExpression + " === 'string'" +
|
||
"? " + baseValueExpression + ".trim()" +
|
||
": " + baseValueExpression + ")";
|
||
}
|
||
if (number) {
|
||
valueExpression = "_n(" + valueExpression + ")";
|
||
}
|
||
var assignment = genAssignmentCode(value, valueExpression);
|
||
|
||
el.model = {
|
||
value: ("(" + value + ")"),
|
||
expression: JSON.stringify(value),
|
||
callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Cross-platform codegen helper for generating v-model value assignment code.
|
||
*/
|
||
function genAssignmentCode (
|
||
value,
|
||
assignment
|
||
) {
|
||
var res = parseModel(value);
|
||
if (res.key === null) {
|
||
return (value + "=" + assignment)
|
||
} else {
|
||
return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Parse a v-model expression into a base path and a final key segment.
|
||
* Handles both dot-path and possible square brackets.
|
||
*
|
||
* Possible cases:
|
||
*
|
||
* - test
|
||
* - test[key]
|
||
* - test[test1[key]]
|
||
* - test["a"][key]
|
||
* - xxx.test[a[a].test1[key]]
|
||
* - test.xxx.a["asa"][test1[key]]
|
||
*
|
||
*/
|
||
|
||
var len, str, chr, index$1, expressionPos, expressionEndPos;
|
||
|
||
|
||
|
||
function parseModel (val) {
|
||
// Fix https://github.com/vuejs/vue/pull/7730
|
||
// allow v-model="obj.val " (trailing whitespace)
|
||
val = val.trim();
|
||
len = val.length;
|
||
|
||
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
||
index$1 = val.lastIndexOf('.');
|
||
if (index$1 > -1) {
|
||
return {
|
||
exp: val.slice(0, index$1),
|
||
key: '"' + val.slice(index$1 + 1) + '"'
|
||
}
|
||
} else {
|
||
return {
|
||
exp: val,
|
||
key: null
|
||
}
|
||
}
|
||
}
|
||
|
||
str = val;
|
||
index$1 = expressionPos = expressionEndPos = 0;
|
||
|
||
while (!eof()) {
|
||
chr = next();
|
||
/* istanbul ignore if */
|
||
if (isStringStart(chr)) {
|
||
parseString(chr);
|
||
} else if (chr === 0x5B) {
|
||
parseBracket(chr);
|
||
}
|
||
}
|
||
|
||
return {
|
||
exp: val.slice(0, expressionPos),
|
||
key: val.slice(expressionPos + 1, expressionEndPos)
|
||
}
|
||
}
|
||
|
||
function next () {
|
||
return str.charCodeAt(++index$1)
|
||
}
|
||
|
||
function eof () {
|
||
return index$1 >= len
|
||
}
|
||
|
||
function isStringStart (chr) {
|
||
return chr === 0x22 || chr === 0x27
|
||
}
|
||
|
||
function parseBracket (chr) {
|
||
var inBracket = 1;
|
||
expressionPos = index$1;
|
||
while (!eof()) {
|
||
chr = next();
|
||
if (isStringStart(chr)) {
|
||
parseString(chr);
|
||
continue
|
||
}
|
||
if (chr === 0x5B) { inBracket++; }
|
||
if (chr === 0x5D) { inBracket--; }
|
||
if (inBracket === 0) {
|
||
expressionEndPos = index$1;
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
function parseString (chr) {
|
||
var stringQuote = chr;
|
||
while (!eof()) {
|
||
chr = next();
|
||
if (chr === stringQuote) {
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var warn$1;
|
||
|
||
// in some cases, the event used has to be determined at runtime
|
||
// so we used some reserved tokens during compile.
|
||
var RANGE_TOKEN = '__r';
|
||
var CHECKBOX_RADIO_TOKEN = '__c';
|
||
|
||
function model (
|
||
el,
|
||
dir,
|
||
_warn
|
||
) {
|
||
warn$1 = _warn;
|
||
var value = dir.value;
|
||
var modifiers = dir.modifiers;
|
||
var tag = el.tag;
|
||
var type = el.attrsMap.type;
|
||
|
||
{
|
||
// inputs with type="file" are read only and setting the input's
|
||
// value will throw an error.
|
||
if (tag === 'input' && type === 'file') {
|
||
warn$1(
|
||
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
||
"File inputs are read only. Use a v-on:change listener instead.",
|
||
el.rawAttrsMap['v-model']
|
||
);
|
||
}
|
||
}
|
||
|
||
if (el.component) {
|
||
genComponentModel(el, value, modifiers);
|
||
// component v-model doesn't need extra runtime
|
||
return false
|
||
} else if (tag === 'select') {
|
||
genSelect(el, value, modifiers);
|
||
} else if (tag === 'input' && type === 'checkbox') {
|
||
genCheckboxModel(el, value, modifiers);
|
||
} else if (tag === 'input' && type === 'radio') {
|
||
genRadioModel(el, value, modifiers);
|
||
} else if (tag === 'input' || tag === 'textarea') {
|
||
genDefaultModel(el, value, modifiers);
|
||
} else if (!config.isReservedTag(tag)) {
|
||
genComponentModel(el, value, modifiers);
|
||
// component v-model doesn't need extra runtime
|
||
return false
|
||
} else {
|
||
warn$1(
|
||
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
||
"v-model is not supported on this element type. " +
|
||
'If you are working with contenteditable, it\'s recommended to ' +
|
||
'wrap a library dedicated for that purpose inside a custom component.',
|
||
el.rawAttrsMap['v-model']
|
||
);
|
||
}
|
||
|
||
// ensure runtime directive metadata
|
||
return true
|
||
}
|
||
|
||
function genCheckboxModel (
|
||
el,
|
||
value,
|
||
modifiers
|
||
) {
|
||
var number = modifiers && modifiers.number;
|
||
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
||
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
||
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
||
addProp(el, 'checked',
|
||
"Array.isArray(" + value + ")" +
|
||
"?_i(" + value + "," + valueBinding + ")>-1" + (
|
||
trueValueBinding === 'true'
|
||
? (":(" + value + ")")
|
||
: (":_q(" + value + "," + trueValueBinding + ")")
|
||
)
|
||
);
|
||
addHandler(el, 'change',
|
||
"var $$a=" + value + "," +
|
||
'$$el=$event.target,' +
|
||
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
||
'if(Array.isArray($$a)){' +
|
||
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
||
'$$i=_i($$a,$$v);' +
|
||
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
||
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
||
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
||
null, true
|
||
);
|
||
}
|
||
|
||
function genRadioModel (
|
||
el,
|
||
value,
|
||
modifiers
|
||
) {
|
||
var number = modifiers && modifiers.number;
|
||
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
||
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
||
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
||
addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
||
}
|
||
|
||
function genSelect (
|
||
el,
|
||
value,
|
||
modifiers
|
||
) {
|
||
var number = modifiers && modifiers.number;
|
||
var selectedVal = "Array.prototype.filter" +
|
||
".call($event.target.options,function(o){return o.selected})" +
|
||
".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
||
"return " + (number ? '_n(val)' : 'val') + "})";
|
||
|
||
var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
||
var code = "var $$selectedVal = " + selectedVal + ";";
|
||
code = code + " " + (genAssignmentCode(value, assignment));
|
||
addHandler(el, 'change', code, null, true);
|
||
}
|
||
|
||
function genDefaultModel (
|
||
el,
|
||
value,
|
||
modifiers
|
||
) {
|
||
var type = el.attrsMap.type;
|
||
|
||
// warn if v-bind:value conflicts with v-model
|
||
// except for inputs with v-bind:type
|
||
{
|
||
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
||
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
||
if (value$1 && !typeBinding) {
|
||
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
||
warn$1(
|
||
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
||
'because the latter already expands to a value binding internally',
|
||
el.rawAttrsMap[binding]
|
||
);
|
||
}
|
||
}
|
||
|
||
var ref = modifiers || {};
|
||
var lazy = ref.lazy;
|
||
var number = ref.number;
|
||
var trim = ref.trim;
|
||
var needCompositionGuard = !lazy && type !== 'range';
|
||
var event = lazy
|
||
? 'change'
|
||
: type === 'range'
|
||
? RANGE_TOKEN
|
||
: 'input';
|
||
|
||
var valueExpression = '$event.target.value';
|
||
if (trim) {
|
||
valueExpression = "$event.target.value.trim()";
|
||
}
|
||
if (number) {
|
||
valueExpression = "_n(" + valueExpression + ")";
|
||
}
|
||
|
||
var code = genAssignmentCode(value, valueExpression);
|
||
if (needCompositionGuard) {
|
||
code = "if($event.target.composing)return;" + code;
|
||
}
|
||
|
||
addProp(el, 'value', ("(" + value + ")"));
|
||
addHandler(el, event, code, null, true);
|
||
if (trim || number) {
|
||
addHandler(el, 'blur', '$forceUpdate()');
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
// normalize v-model event tokens that can only be determined at runtime.
|
||
// it's important to place the event as the first in the array because
|
||
// the whole point is ensuring the v-model callback gets called before
|
||
// user-attached handlers.
|
||
function normalizeEvents (on) {
|
||
/* istanbul ignore if */
|
||
if (isDef(on[RANGE_TOKEN])) {
|
||
// IE input[type=range] only supports `change` event
|
||
var event = isIE ? 'change' : 'input';
|
||
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
||
delete on[RANGE_TOKEN];
|
||
}
|
||
// This was originally intended to fix #4521 but no longer necessary
|
||
// after 2.5. Keeping it for backwards compat with generated code from < 2.4
|
||
/* istanbul ignore if */
|
||
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
||
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
||
delete on[CHECKBOX_RADIO_TOKEN];
|
||
}
|
||
}
|
||
|
||
var target$1;
|
||
|
||
function createOnceHandler$1 (event, handler, capture) {
|
||
var _target = target$1; // save current target element in closure
|
||
return function onceHandler () {
|
||
var res = handler.apply(null, arguments);
|
||
if (res !== null) {
|
||
remove$2(event, onceHandler, capture, _target);
|
||
}
|
||
}
|
||
}
|
||
|
||
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
||
// implementation and does not fire microtasks in between event propagation, so
|
||
// safe to exclude.
|
||
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
||
|
||
function add$1 (
|
||
name,
|
||
handler,
|
||
capture,
|
||
passive
|
||
) {
|
||
// async edge case #6566: inner click event triggers patch, event handler
|
||
// attached to outer element during patch, and triggered again. This
|
||
// happens because browsers fire microtask ticks between event propagation.
|
||
// the solution is simple: we save the timestamp when a handler is attached,
|
||
// and the handler would only fire if the event passed to it was fired
|
||
// AFTER it was attached.
|
||
if (useMicrotaskFix) {
|
||
var attachedTimestamp = currentFlushTimestamp;
|
||
var original = handler;
|
||
handler = original._wrapper = function (e) {
|
||
if (
|
||
// no bubbling, should always fire.
|
||
// this is just a safety net in case event.timeStamp is unreliable in
|
||
// certain weird environments...
|
||
e.target === e.currentTarget ||
|
||
// event is fired after handler attachment
|
||
e.timeStamp >= attachedTimestamp ||
|
||
// bail for environments that have buggy event.timeStamp implementations
|
||
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
||
// #9681 QtWebEngine event.timeStamp is negative value
|
||
e.timeStamp <= 0 ||
|
||
// #9448 bail if event is fired in another document in a multi-page
|
||
// electron/nw.js app, since event.timeStamp will be using a different
|
||
// starting reference
|
||
e.target.ownerDocument !== document
|
||
) {
|
||
return original.apply(this, arguments)
|
||
}
|
||
};
|
||
}
|
||
target$1.addEventListener(
|
||
name,
|
||
handler,
|
||
supportsPassive
|
||
? { capture: capture, passive: passive }
|
||
: capture
|
||
);
|
||
}
|
||
|
||
function remove$2 (
|
||
name,
|
||
handler,
|
||
capture,
|
||
_target
|
||
) {
|
||
(_target || target$1).removeEventListener(
|
||
name,
|
||
handler._wrapper || handler,
|
||
capture
|
||
);
|
||
}
|
||
|
||
function updateDOMListeners (oldVnode, vnode) {
|
||
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
||
return
|
||
}
|
||
var on = vnode.data.on || {};
|
||
var oldOn = oldVnode.data.on || {};
|
||
target$1 = vnode.elm;
|
||
normalizeEvents(on);
|
||
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
||
target$1 = undefined;
|
||
}
|
||
|
||
var events = {
|
||
create: updateDOMListeners,
|
||
update: updateDOMListeners
|
||
};
|
||
|
||
/* */
|
||
|
||
var svgContainer;
|
||
|
||
function updateDOMProps (oldVnode, vnode) {
|
||
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
||
return
|
||
}
|
||
var key, cur;
|
||
var elm = vnode.elm;
|
||
var oldProps = oldVnode.data.domProps || {};
|
||
var props = vnode.data.domProps || {};
|
||
// clone observed objects, as the user probably wants to mutate it
|
||
if (isDef(props.__ob__)) {
|
||
props = vnode.data.domProps = extend({}, props);
|
||
}
|
||
|
||
for (key in oldProps) {
|
||
if (!(key in props)) {
|
||
elm[key] = '';
|
||
}
|
||
}
|
||
|
||
for (key in props) {
|
||
cur = props[key];
|
||
// ignore children if the node has textContent or innerHTML,
|
||
// as these will throw away existing DOM nodes and cause removal errors
|
||
// on subsequent patches (#3360)
|
||
if (key === 'textContent' || key === 'innerHTML') {
|
||
if (vnode.children) { vnode.children.length = 0; }
|
||
if (cur === oldProps[key]) { continue }
|
||
// #6601 work around Chrome version <= 55 bug where single textNode
|
||
// replaced by innerHTML/textContent retains its parentNode property
|
||
if (elm.childNodes.length === 1) {
|
||
elm.removeChild(elm.childNodes[0]);
|
||
}
|
||
}
|
||
|
||
if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
||
// store value as _value as well since
|
||
// non-string values will be stringified
|
||
elm._value = cur;
|
||
// avoid resetting cursor position when value is the same
|
||
var strCur = isUndef(cur) ? '' : String(cur);
|
||
if (shouldUpdateValue(elm, strCur)) {
|
||
elm.value = strCur;
|
||
}
|
||
} else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
||
// IE doesn't support innerHTML for SVG elements
|
||
svgContainer = svgContainer || document.createElement('div');
|
||
svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
||
var svg = svgContainer.firstChild;
|
||
while (elm.firstChild) {
|
||
elm.removeChild(elm.firstChild);
|
||
}
|
||
while (svg.firstChild) {
|
||
elm.appendChild(svg.firstChild);
|
||
}
|
||
} else if (
|
||
// skip the update if old and new VDOM state is the same.
|
||
// `value` is handled separately because the DOM value may be temporarily
|
||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||
// This #4521 by skipping the unnecesarry `checked` update.
|
||
cur !== oldProps[key]
|
||
) {
|
||
// some property updates can throw
|
||
// e.g. `value` on <progress> w/ non-finite value
|
||
try {
|
||
elm[key] = cur;
|
||
} catch (e) {}
|
||
}
|
||
}
|
||
}
|
||
|
||
// check platforms/web/util/attrs.js acceptValue
|
||
|
||
|
||
function shouldUpdateValue (elm, checkVal) {
|
||
return (!elm.composing && (
|
||
elm.tagName === 'OPTION' ||
|
||
isNotInFocusAndDirty(elm, checkVal) ||
|
||
isDirtyWithModifiers(elm, checkVal)
|
||
))
|
||
}
|
||
|
||
function isNotInFocusAndDirty (elm, checkVal) {
|
||
// return true when textbox (.number and .trim) loses focus and its value is
|
||
// not equal to the updated value
|
||
var notInFocus = true;
|
||
// #6157
|
||
// work around IE bug when accessing document.activeElement in an iframe
|
||
try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
||
return notInFocus && elm.value !== checkVal
|
||
}
|
||
|
||
function isDirtyWithModifiers (elm, newVal) {
|
||
var value = elm.value;
|
||
var modifiers = elm._vModifiers; // injected by v-model runtime
|
||
if (isDef(modifiers)) {
|
||
if (modifiers.number) {
|
||
return toNumber(value) !== toNumber(newVal)
|
||
}
|
||
if (modifiers.trim) {
|
||
return value.trim() !== newVal.trim()
|
||
}
|
||
}
|
||
return value !== newVal
|
||
}
|
||
|
||
var domProps = {
|
||
create: updateDOMProps,
|
||
update: updateDOMProps
|
||
};
|
||
|
||
/* */
|
||
|
||
var parseStyleText = cached(function (cssText) {
|
||
var res = {};
|
||
var listDelimiter = /;(?![^(]*\))/g;
|
||
var propertyDelimiter = /:(.+)/;
|
||
cssText.split(listDelimiter).forEach(function (item) {
|
||
if (item) {
|
||
var tmp = item.split(propertyDelimiter);
|
||
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
||
}
|
||
});
|
||
return res
|
||
});
|
||
|
||
// merge static and dynamic style data on the same vnode
|
||
function normalizeStyleData (data) {
|
||
var style = normalizeStyleBinding(data.style);
|
||
// static style is pre-processed into an object during compilation
|
||
// and is always a fresh object, so it's safe to merge into it
|
||
return data.staticStyle
|
||
? extend(data.staticStyle, style)
|
||
: style
|
||
}
|
||
|
||
// normalize possible array / string values into Object
|
||
function normalizeStyleBinding (bindingStyle) {
|
||
if (Array.isArray(bindingStyle)) {
|
||
return toObject(bindingStyle)
|
||
}
|
||
if (typeof bindingStyle === 'string') {
|
||
return parseStyleText(bindingStyle)
|
||
}
|
||
return bindingStyle
|
||
}
|
||
|
||
/**
|
||
* parent component style should be after child's
|
||
* so that parent component's style could override it
|
||
*/
|
||
function getStyle (vnode, checkChild) {
|
||
var res = {};
|
||
var styleData;
|
||
|
||
if (checkChild) {
|
||
var childNode = vnode;
|
||
while (childNode.componentInstance) {
|
||
childNode = childNode.componentInstance._vnode;
|
||
if (
|
||
childNode && childNode.data &&
|
||
(styleData = normalizeStyleData(childNode.data))
|
||
) {
|
||
extend(res, styleData);
|
||
}
|
||
}
|
||
}
|
||
|
||
if ((styleData = normalizeStyleData(vnode.data))) {
|
||
extend(res, styleData);
|
||
}
|
||
|
||
var parentNode = vnode;
|
||
while ((parentNode = parentNode.parent)) {
|
||
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
||
extend(res, styleData);
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
/* */
|
||
|
||
var cssVarRE = /^--/;
|
||
var importantRE = /\s*!important$/;
|
||
var setProp = function (el, name, val) {
|
||
/* istanbul ignore if */
|
||
if (cssVarRE.test(name)) {
|
||
el.style.setProperty(name, val);
|
||
} else if (importantRE.test(val)) {
|
||
el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
||
} else {
|
||
var normalizedName = normalize(name);
|
||
if (Array.isArray(val)) {
|
||
// Support values array created by autoprefixer, e.g.
|
||
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
|
||
// Set them one by one, and the browser will only set those it can recognize
|
||
for (var i = 0, len = val.length; i < len; i++) {
|
||
el.style[normalizedName] = val[i];
|
||
}
|
||
} else {
|
||
el.style[normalizedName] = val;
|
||
}
|
||
}
|
||
};
|
||
|
||
var vendorNames = ['Webkit', 'Moz', 'ms'];
|
||
|
||
var emptyStyle;
|
||
var normalize = cached(function (prop) {
|
||
emptyStyle = emptyStyle || document.createElement('div').style;
|
||
prop = camelize(prop);
|
||
if (prop !== 'filter' && (prop in emptyStyle)) {
|
||
return prop
|
||
}
|
||
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
||
for (var i = 0; i < vendorNames.length; i++) {
|
||
var name = vendorNames[i] + capName;
|
||
if (name in emptyStyle) {
|
||
return name
|
||
}
|
||
}
|
||
});
|
||
|
||
function updateStyle (oldVnode, vnode) {
|
||
var data = vnode.data;
|
||
var oldData = oldVnode.data;
|
||
|
||
if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
||
isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
||
) {
|
||
return
|
||
}
|
||
|
||
var cur, name;
|
||
var el = vnode.elm;
|
||
var oldStaticStyle = oldData.staticStyle;
|
||
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
||
|
||
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
|
||
var oldStyle = oldStaticStyle || oldStyleBinding;
|
||
|
||
var style = normalizeStyleBinding(vnode.data.style) || {};
|
||
|
||
// store normalized style under a different key for next diff
|
||
// make sure to clone it if it's reactive, since the user likely wants
|
||
// to mutate it.
|
||
vnode.data.normalizedStyle = isDef(style.__ob__)
|
||
? extend({}, style)
|
||
: style;
|
||
|
||
var newStyle = getStyle(vnode, true);
|
||
|
||
for (name in oldStyle) {
|
||
if (isUndef(newStyle[name])) {
|
||
setProp(el, name, '');
|
||
}
|
||
}
|
||
for (name in newStyle) {
|
||
cur = newStyle[name];
|
||
if (cur !== oldStyle[name]) {
|
||
// ie9 setting to null has no effect, must use empty string
|
||
setProp(el, name, cur == null ? '' : cur);
|
||
}
|
||
}
|
||
}
|
||
|
||
var style = {
|
||
create: updateStyle,
|
||
update: updateStyle
|
||
};
|
||
|
||
/* */
|
||
|
||
var whitespaceRE = /\s+/;
|
||
|
||
/**
|
||
* Add class with compatibility for SVG since classList is not supported on
|
||
* SVG elements in IE
|
||
*/
|
||
function addClass (el, cls) {
|
||
/* istanbul ignore if */
|
||
if (!cls || !(cls = cls.trim())) {
|
||
return
|
||
}
|
||
|
||
/* istanbul ignore else */
|
||
if (el.classList) {
|
||
if (cls.indexOf(' ') > -1) {
|
||
cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
||
} else {
|
||
el.classList.add(cls);
|
||
}
|
||
} else {
|
||
var cur = " " + (el.getAttribute('class') || '') + " ";
|
||
if (cur.indexOf(' ' + cls + ' ') < 0) {
|
||
el.setAttribute('class', (cur + cls).trim());
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Remove class with compatibility for SVG since classList is not supported on
|
||
* SVG elements in IE
|
||
*/
|
||
function removeClass (el, cls) {
|
||
/* istanbul ignore if */
|
||
if (!cls || !(cls = cls.trim())) {
|
||
return
|
||
}
|
||
|
||
/* istanbul ignore else */
|
||
if (el.classList) {
|
||
if (cls.indexOf(' ') > -1) {
|
||
cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
||
} else {
|
||
el.classList.remove(cls);
|
||
}
|
||
if (!el.classList.length) {
|
||
el.removeAttribute('class');
|
||
}
|
||
} else {
|
||
var cur = " " + (el.getAttribute('class') || '') + " ";
|
||
var tar = ' ' + cls + ' ';
|
||
while (cur.indexOf(tar) >= 0) {
|
||
cur = cur.replace(tar, ' ');
|
||
}
|
||
cur = cur.trim();
|
||
if (cur) {
|
||
el.setAttribute('class', cur);
|
||
} else {
|
||
el.removeAttribute('class');
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function resolveTransition (def$$1) {
|
||
if (!def$$1) {
|
||
return
|
||
}
|
||
/* istanbul ignore else */
|
||
if (typeof def$$1 === 'object') {
|
||
var res = {};
|
||
if (def$$1.css !== false) {
|
||
extend(res, autoCssTransition(def$$1.name || 'v'));
|
||
}
|
||
extend(res, def$$1);
|
||
return res
|
||
} else if (typeof def$$1 === 'string') {
|
||
return autoCssTransition(def$$1)
|
||
}
|
||
}
|
||
|
||
var autoCssTransition = cached(function (name) {
|
||
return {
|
||
enterClass: (name + "-enter"),
|
||
enterToClass: (name + "-enter-to"),
|
||
enterActiveClass: (name + "-enter-active"),
|
||
leaveClass: (name + "-leave"),
|
||
leaveToClass: (name + "-leave-to"),
|
||
leaveActiveClass: (name + "-leave-active")
|
||
}
|
||
});
|
||
|
||
var hasTransition = inBrowser && !isIE9;
|
||
var TRANSITION = 'transition';
|
||
var ANIMATION = 'animation';
|
||
|
||
// Transition property/event sniffing
|
||
var transitionProp = 'transition';
|
||
var transitionEndEvent = 'transitionend';
|
||
var animationProp = 'animation';
|
||
var animationEndEvent = 'animationend';
|
||
if (hasTransition) {
|
||
/* istanbul ignore if */
|
||
if (window.ontransitionend === undefined &&
|
||
window.onwebkittransitionend !== undefined
|
||
) {
|
||
transitionProp = 'WebkitTransition';
|
||
transitionEndEvent = 'webkitTransitionEnd';
|
||
}
|
||
if (window.onanimationend === undefined &&
|
||
window.onwebkitanimationend !== undefined
|
||
) {
|
||
animationProp = 'WebkitAnimation';
|
||
animationEndEvent = 'webkitAnimationEnd';
|
||
}
|
||
}
|
||
|
||
// binding to window is necessary to make hot reload work in IE in strict mode
|
||
var raf = inBrowser
|
||
? window.requestAnimationFrame
|
||
? window.requestAnimationFrame.bind(window)
|
||
: setTimeout
|
||
: /* istanbul ignore next */ function (fn) { return fn(); };
|
||
|
||
function nextFrame (fn) {
|
||
raf(function () {
|
||
raf(fn);
|
||
});
|
||
}
|
||
|
||
function addTransitionClass (el, cls) {
|
||
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
||
if (transitionClasses.indexOf(cls) < 0) {
|
||
transitionClasses.push(cls);
|
||
addClass(el, cls);
|
||
}
|
||
}
|
||
|
||
function removeTransitionClass (el, cls) {
|
||
if (el._transitionClasses) {
|
||
remove(el._transitionClasses, cls);
|
||
}
|
||
removeClass(el, cls);
|
||
}
|
||
|
||
function whenTransitionEnds (
|
||
el,
|
||
expectedType,
|
||
cb
|
||
) {
|
||
var ref = getTransitionInfo(el, expectedType);
|
||
var type = ref.type;
|
||
var timeout = ref.timeout;
|
||
var propCount = ref.propCount;
|
||
if (!type) { return cb() }
|
||
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
||
var ended = 0;
|
||
var end = function () {
|
||
el.removeEventListener(event, onEnd);
|
||
cb();
|
||
};
|
||
var onEnd = function (e) {
|
||
if (e.target === el) {
|
||
if (++ended >= propCount) {
|
||
end();
|
||
}
|
||
}
|
||
};
|
||
setTimeout(function () {
|
||
if (ended < propCount) {
|
||
end();
|
||
}
|
||
}, timeout + 1);
|
||
el.addEventListener(event, onEnd);
|
||
}
|
||
|
||
var transformRE = /\b(transform|all)(,|$)/;
|
||
|
||
function getTransitionInfo (el, expectedType) {
|
||
var styles = window.getComputedStyle(el);
|
||
// JSDOM may return undefined for transition properties
|
||
var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
||
var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
||
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
||
var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
||
var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
||
var animationTimeout = getTimeout(animationDelays, animationDurations);
|
||
|
||
var type;
|
||
var timeout = 0;
|
||
var propCount = 0;
|
||
/* istanbul ignore if */
|
||
if (expectedType === TRANSITION) {
|
||
if (transitionTimeout > 0) {
|
||
type = TRANSITION;
|
||
timeout = transitionTimeout;
|
||
propCount = transitionDurations.length;
|
||
}
|
||
} else if (expectedType === ANIMATION) {
|
||
if (animationTimeout > 0) {
|
||
type = ANIMATION;
|
||
timeout = animationTimeout;
|
||
propCount = animationDurations.length;
|
||
}
|
||
} else {
|
||
timeout = Math.max(transitionTimeout, animationTimeout);
|
||
type = timeout > 0
|
||
? transitionTimeout > animationTimeout
|
||
? TRANSITION
|
||
: ANIMATION
|
||
: null;
|
||
propCount = type
|
||
? type === TRANSITION
|
||
? transitionDurations.length
|
||
: animationDurations.length
|
||
: 0;
|
||
}
|
||
var hasTransform =
|
||
type === TRANSITION &&
|
||
transformRE.test(styles[transitionProp + 'Property']);
|
||
return {
|
||
type: type,
|
||
timeout: timeout,
|
||
propCount: propCount,
|
||
hasTransform: hasTransform
|
||
}
|
||
}
|
||
|
||
function getTimeout (delays, durations) {
|
||
/* istanbul ignore next */
|
||
while (delays.length < durations.length) {
|
||
delays = delays.concat(delays);
|
||
}
|
||
|
||
return Math.max.apply(null, durations.map(function (d, i) {
|
||
return toMs(d) + toMs(delays[i])
|
||
}))
|
||
}
|
||
|
||
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
||
// in a locale-dependent way, using a comma instead of a dot.
|
||
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
||
// as a floor function) causing unexpected behaviors
|
||
function toMs (s) {
|
||
return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
||
}
|
||
|
||
/* */
|
||
|
||
function enter (vnode, toggleDisplay) {
|
||
var el = vnode.elm;
|
||
|
||
// call leave callback now
|
||
if (isDef(el._leaveCb)) {
|
||
el._leaveCb.cancelled = true;
|
||
el._leaveCb();
|
||
}
|
||
|
||
var data = resolveTransition(vnode.data.transition);
|
||
if (isUndef(data)) {
|
||
return
|
||
}
|
||
|
||
/* istanbul ignore if */
|
||
if (isDef(el._enterCb) || el.nodeType !== 1) {
|
||
return
|
||
}
|
||
|
||
var css = data.css;
|
||
var type = data.type;
|
||
var enterClass = data.enterClass;
|
||
var enterToClass = data.enterToClass;
|
||
var enterActiveClass = data.enterActiveClass;
|
||
var appearClass = data.appearClass;
|
||
var appearToClass = data.appearToClass;
|
||
var appearActiveClass = data.appearActiveClass;
|
||
var beforeEnter = data.beforeEnter;
|
||
var enter = data.enter;
|
||
var afterEnter = data.afterEnter;
|
||
var enterCancelled = data.enterCancelled;
|
||
var beforeAppear = data.beforeAppear;
|
||
var appear = data.appear;
|
||
var afterAppear = data.afterAppear;
|
||
var appearCancelled = data.appearCancelled;
|
||
var duration = data.duration;
|
||
|
||
// activeInstance will always be the <transition> component managing this
|
||
// transition. One edge case to check is when the <transition> is placed
|
||
// as the root node of a child component. In that case we need to check
|
||
// <transition>'s parent for appear check.
|
||
var context = activeInstance;
|
||
var transitionNode = activeInstance.$vnode;
|
||
while (transitionNode && transitionNode.parent) {
|
||
context = transitionNode.context;
|
||
transitionNode = transitionNode.parent;
|
||
}
|
||
|
||
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
||
|
||
if (isAppear && !appear && appear !== '') {
|
||
return
|
||
}
|
||
|
||
var startClass = isAppear && appearClass
|
||
? appearClass
|
||
: enterClass;
|
||
var activeClass = isAppear && appearActiveClass
|
||
? appearActiveClass
|
||
: enterActiveClass;
|
||
var toClass = isAppear && appearToClass
|
||
? appearToClass
|
||
: enterToClass;
|
||
|
||
var beforeEnterHook = isAppear
|
||
? (beforeAppear || beforeEnter)
|
||
: beforeEnter;
|
||
var enterHook = isAppear
|
||
? (typeof appear === 'function' ? appear : enter)
|
||
: enter;
|
||
var afterEnterHook = isAppear
|
||
? (afterAppear || afterEnter)
|
||
: afterEnter;
|
||
var enterCancelledHook = isAppear
|
||
? (appearCancelled || enterCancelled)
|
||
: enterCancelled;
|
||
|
||
var explicitEnterDuration = toNumber(
|
||
isObject(duration)
|
||
? duration.enter
|
||
: duration
|
||
);
|
||
|
||
if (explicitEnterDuration != null) {
|
||
checkDuration(explicitEnterDuration, 'enter', vnode);
|
||
}
|
||
|
||
var expectsCSS = css !== false && !isIE9;
|
||
var userWantsControl = getHookArgumentsLength(enterHook);
|
||
|
||
var cb = el._enterCb = once(function () {
|
||
if (expectsCSS) {
|
||
removeTransitionClass(el, toClass);
|
||
removeTransitionClass(el, activeClass);
|
||
}
|
||
if (cb.cancelled) {
|
||
if (expectsCSS) {
|
||
removeTransitionClass(el, startClass);
|
||
}
|
||
enterCancelledHook && enterCancelledHook(el);
|
||
} else {
|
||
afterEnterHook && afterEnterHook(el);
|
||
}
|
||
el._enterCb = null;
|
||
});
|
||
|
||
if (!vnode.data.show) {
|
||
// remove pending leave element on enter by injecting an insert hook
|
||
mergeVNodeHook(vnode, 'insert', function () {
|
||
var parent = el.parentNode;
|
||
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
||
if (pendingNode &&
|
||
pendingNode.tag === vnode.tag &&
|
||
pendingNode.elm._leaveCb
|
||
) {
|
||
pendingNode.elm._leaveCb();
|
||
}
|
||
enterHook && enterHook(el, cb);
|
||
});
|
||
}
|
||
|
||
// start enter transition
|
||
beforeEnterHook && beforeEnterHook(el);
|
||
if (expectsCSS) {
|
||
addTransitionClass(el, startClass);
|
||
addTransitionClass(el, activeClass);
|
||
nextFrame(function () {
|
||
removeTransitionClass(el, startClass);
|
||
if (!cb.cancelled) {
|
||
addTransitionClass(el, toClass);
|
||
if (!userWantsControl) {
|
||
if (isValidDuration(explicitEnterDuration)) {
|
||
setTimeout(cb, explicitEnterDuration);
|
||
} else {
|
||
whenTransitionEnds(el, type, cb);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
if (vnode.data.show) {
|
||
toggleDisplay && toggleDisplay();
|
||
enterHook && enterHook(el, cb);
|
||
}
|
||
|
||
if (!expectsCSS && !userWantsControl) {
|
||
cb();
|
||
}
|
||
}
|
||
|
||
function leave (vnode, rm) {
|
||
var el = vnode.elm;
|
||
|
||
// call enter callback now
|
||
if (isDef(el._enterCb)) {
|
||
el._enterCb.cancelled = true;
|
||
el._enterCb();
|
||
}
|
||
|
||
var data = resolveTransition(vnode.data.transition);
|
||
if (isUndef(data) || el.nodeType !== 1) {
|
||
return rm()
|
||
}
|
||
|
||
/* istanbul ignore if */
|
||
if (isDef(el._leaveCb)) {
|
||
return
|
||
}
|
||
|
||
var css = data.css;
|
||
var type = data.type;
|
||
var leaveClass = data.leaveClass;
|
||
var leaveToClass = data.leaveToClass;
|
||
var leaveActiveClass = data.leaveActiveClass;
|
||
var beforeLeave = data.beforeLeave;
|
||
var leave = data.leave;
|
||
var afterLeave = data.afterLeave;
|
||
var leaveCancelled = data.leaveCancelled;
|
||
var delayLeave = data.delayLeave;
|
||
var duration = data.duration;
|
||
|
||
var expectsCSS = css !== false && !isIE9;
|
||
var userWantsControl = getHookArgumentsLength(leave);
|
||
|
||
var explicitLeaveDuration = toNumber(
|
||
isObject(duration)
|
||
? duration.leave
|
||
: duration
|
||
);
|
||
|
||
if (isDef(explicitLeaveDuration)) {
|
||
checkDuration(explicitLeaveDuration, 'leave', vnode);
|
||
}
|
||
|
||
var cb = el._leaveCb = once(function () {
|
||
if (el.parentNode && el.parentNode._pending) {
|
||
el.parentNode._pending[vnode.key] = null;
|
||
}
|
||
if (expectsCSS) {
|
||
removeTransitionClass(el, leaveToClass);
|
||
removeTransitionClass(el, leaveActiveClass);
|
||
}
|
||
if (cb.cancelled) {
|
||
if (expectsCSS) {
|
||
removeTransitionClass(el, leaveClass);
|
||
}
|
||
leaveCancelled && leaveCancelled(el);
|
||
} else {
|
||
rm();
|
||
afterLeave && afterLeave(el);
|
||
}
|
||
el._leaveCb = null;
|
||
});
|
||
|
||
if (delayLeave) {
|
||
delayLeave(performLeave);
|
||
} else {
|
||
performLeave();
|
||
}
|
||
|
||
function performLeave () {
|
||
// the delayed leave may have already been cancelled
|
||
if (cb.cancelled) {
|
||
return
|
||
}
|
||
// record leaving element
|
||
if (!vnode.data.show && el.parentNode) {
|
||
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
||
}
|
||
beforeLeave && beforeLeave(el);
|
||
if (expectsCSS) {
|
||
addTransitionClass(el, leaveClass);
|
||
addTransitionClass(el, leaveActiveClass);
|
||
nextFrame(function () {
|
||
removeTransitionClass(el, leaveClass);
|
||
if (!cb.cancelled) {
|
||
addTransitionClass(el, leaveToClass);
|
||
if (!userWantsControl) {
|
||
if (isValidDuration(explicitLeaveDuration)) {
|
||
setTimeout(cb, explicitLeaveDuration);
|
||
} else {
|
||
whenTransitionEnds(el, type, cb);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
leave && leave(el, cb);
|
||
if (!expectsCSS && !userWantsControl) {
|
||
cb();
|
||
}
|
||
}
|
||
}
|
||
|
||
// only used in dev mode
|
||
function checkDuration (val, name, vnode) {
|
||
if (typeof val !== 'number') {
|
||
warn(
|
||
"<transition> explicit " + name + " duration is not a valid number - " +
|
||
"got " + (JSON.stringify(val)) + ".",
|
||
vnode.context
|
||
);
|
||
} else if (isNaN(val)) {
|
||
warn(
|
||
"<transition> explicit " + name + " duration is NaN - " +
|
||
'the duration expression might be incorrect.',
|
||
vnode.context
|
||
);
|
||
}
|
||
}
|
||
|
||
function isValidDuration (val) {
|
||
return typeof val === 'number' && !isNaN(val)
|
||
}
|
||
|
||
/**
|
||
* Normalize a transition hook's argument length. The hook may be:
|
||
* - a merged hook (invoker) with the original in .fns
|
||
* - a wrapped component method (check ._length)
|
||
* - a plain function (.length)
|
||
*/
|
||
function getHookArgumentsLength (fn) {
|
||
if (isUndef(fn)) {
|
||
return false
|
||
}
|
||
var invokerFns = fn.fns;
|
||
if (isDef(invokerFns)) {
|
||
// invoker
|
||
return getHookArgumentsLength(
|
||
Array.isArray(invokerFns)
|
||
? invokerFns[0]
|
||
: invokerFns
|
||
)
|
||
} else {
|
||
return (fn._length || fn.length) > 1
|
||
}
|
||
}
|
||
|
||
function _enter (_, vnode) {
|
||
if (vnode.data.show !== true) {
|
||
enter(vnode);
|
||
}
|
||
}
|
||
|
||
var transition = inBrowser ? {
|
||
create: _enter,
|
||
activate: _enter,
|
||
remove: function remove$$1 (vnode, rm) {
|
||
/* istanbul ignore else */
|
||
if (vnode.data.show !== true) {
|
||
leave(vnode, rm);
|
||
} else {
|
||
rm();
|
||
}
|
||
}
|
||
} : {};
|
||
|
||
var platformModules = [
|
||
attrs,
|
||
klass,
|
||
events,
|
||
domProps,
|
||
style,
|
||
transition
|
||
];
|
||
|
||
/* */
|
||
|
||
// the directive module should be applied last, after all
|
||
// built-in modules have been applied.
|
||
var modules = platformModules.concat(baseModules);
|
||
|
||
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
||
|
||
/**
|
||
* Not type checking this file because flow doesn't like attaching
|
||
* properties to Elements.
|
||
*/
|
||
|
||
/* istanbul ignore if */
|
||
if (isIE9) {
|
||
// http://www.matts411.com/post/internet-explorer-9-oninput/
|
||
document.addEventListener('selectionchange', function () {
|
||
var el = document.activeElement;
|
||
if (el && el.vmodel) {
|
||
trigger(el, 'input');
|
||
}
|
||
});
|
||
}
|
||
|
||
var directive = {
|
||
inserted: function inserted (el, binding, vnode, oldVnode) {
|
||
if (vnode.tag === 'select') {
|
||
// #6903
|
||
if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
||
mergeVNodeHook(vnode, 'postpatch', function () {
|
||
directive.componentUpdated(el, binding, vnode);
|
||
});
|
||
} else {
|
||
setSelected(el, binding, vnode.context);
|
||
}
|
||
el._vOptions = [].map.call(el.options, getValue);
|
||
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
||
el._vModifiers = binding.modifiers;
|
||
if (!binding.modifiers.lazy) {
|
||
el.addEventListener('compositionstart', onCompositionStart);
|
||
el.addEventListener('compositionend', onCompositionEnd);
|
||
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
||
// switching focus before confirming composition choice
|
||
// this also fixes the issue where some browsers e.g. iOS Chrome
|
||
// fires "change" instead of "input" on autocomplete.
|
||
el.addEventListener('change', onCompositionEnd);
|
||
/* istanbul ignore if */
|
||
if (isIE9) {
|
||
el.vmodel = true;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
componentUpdated: function componentUpdated (el, binding, vnode) {
|
||
if (vnode.tag === 'select') {
|
||
setSelected(el, binding, vnode.context);
|
||
// in case the options rendered by v-for have changed,
|
||
// it's possible that the value is out-of-sync with the rendered options.
|
||
// detect such cases and filter out values that no longer has a matching
|
||
// option in the DOM.
|
||
var prevOptions = el._vOptions;
|
||
var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
||
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
||
// trigger change event if
|
||
// no matching option found for at least one value
|
||
var needReset = el.multiple
|
||
? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
||
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
||
if (needReset) {
|
||
trigger(el, 'change');
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
function setSelected (el, binding, vm) {
|
||
actuallySetSelected(el, binding, vm);
|
||
/* istanbul ignore if */
|
||
if (isIE || isEdge) {
|
||
setTimeout(function () {
|
||
actuallySetSelected(el, binding, vm);
|
||
}, 0);
|
||
}
|
||
}
|
||
|
||
function actuallySetSelected (el, binding, vm) {
|
||
var value = binding.value;
|
||
var isMultiple = el.multiple;
|
||
if (isMultiple && !Array.isArray(value)) {
|
||
warn(
|
||
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
||
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
||
vm
|
||
);
|
||
return
|
||
}
|
||
var selected, option;
|
||
for (var i = 0, l = el.options.length; i < l; i++) {
|
||
option = el.options[i];
|
||
if (isMultiple) {
|
||
selected = looseIndexOf(value, getValue(option)) > -1;
|
||
if (option.selected !== selected) {
|
||
option.selected = selected;
|
||
}
|
||
} else {
|
||
if (looseEqual(getValue(option), value)) {
|
||
if (el.selectedIndex !== i) {
|
||
el.selectedIndex = i;
|
||
}
|
||
return
|
||
}
|
||
}
|
||
}
|
||
if (!isMultiple) {
|
||
el.selectedIndex = -1;
|
||
}
|
||
}
|
||
|
||
function hasNoMatchingOption (value, options) {
|
||
return options.every(function (o) { return !looseEqual(o, value); })
|
||
}
|
||
|
||
function getValue (option) {
|
||
return '_value' in option
|
||
? option._value
|
||
: option.value
|
||
}
|
||
|
||
function onCompositionStart (e) {
|
||
e.target.composing = true;
|
||
}
|
||
|
||
function onCompositionEnd (e) {
|
||
// prevent triggering an input event for no reason
|
||
if (!e.target.composing) { return }
|
||
e.target.composing = false;
|
||
trigger(e.target, 'input');
|
||
}
|
||
|
||
function trigger (el, type) {
|
||
var e = document.createEvent('HTMLEvents');
|
||
e.initEvent(type, true, true);
|
||
el.dispatchEvent(e);
|
||
}
|
||
|
||
/* */
|
||
|
||
// recursively search for possible transition defined inside the component root
|
||
function locateNode (vnode) {
|
||
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
||
? locateNode(vnode.componentInstance._vnode)
|
||
: vnode
|
||
}
|
||
|
||
var show = {
|
||
bind: function bind (el, ref, vnode) {
|
||
var value = ref.value;
|
||
|
||
vnode = locateNode(vnode);
|
||
var transition$$1 = vnode.data && vnode.data.transition;
|
||
var originalDisplay = el.__vOriginalDisplay =
|
||
el.style.display === 'none' ? '' : el.style.display;
|
||
if (value && transition$$1) {
|
||
vnode.data.show = true;
|
||
enter(vnode, function () {
|
||
el.style.display = originalDisplay;
|
||
});
|
||
} else {
|
||
el.style.display = value ? originalDisplay : 'none';
|
||
}
|
||
},
|
||
|
||
update: function update (el, ref, vnode) {
|
||
var value = ref.value;
|
||
var oldValue = ref.oldValue;
|
||
|
||
/* istanbul ignore if */
|
||
if (!value === !oldValue) { return }
|
||
vnode = locateNode(vnode);
|
||
var transition$$1 = vnode.data && vnode.data.transition;
|
||
if (transition$$1) {
|
||
vnode.data.show = true;
|
||
if (value) {
|
||
enter(vnode, function () {
|
||
el.style.display = el.__vOriginalDisplay;
|
||
});
|
||
} else {
|
||
leave(vnode, function () {
|
||
el.style.display = 'none';
|
||
});
|
||
}
|
||
} else {
|
||
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
||
}
|
||
},
|
||
|
||
unbind: function unbind (
|
||
el,
|
||
binding,
|
||
vnode,
|
||
oldVnode,
|
||
isDestroy
|
||
) {
|
||
if (!isDestroy) {
|
||
el.style.display = el.__vOriginalDisplay;
|
||
}
|
||
}
|
||
};
|
||
|
||
var platformDirectives = {
|
||
model: directive,
|
||
show: show
|
||
};
|
||
|
||
/* */
|
||
|
||
var transitionProps = {
|
||
name: String,
|
||
appear: Boolean,
|
||
css: Boolean,
|
||
mode: String,
|
||
type: String,
|
||
enterClass: String,
|
||
leaveClass: String,
|
||
enterToClass: String,
|
||
leaveToClass: String,
|
||
enterActiveClass: String,
|
||
leaveActiveClass: String,
|
||
appearClass: String,
|
||
appearActiveClass: String,
|
||
appearToClass: String,
|
||
duration: [Number, String, Object]
|
||
};
|
||
|
||
// in case the child is also an abstract component, e.g. <keep-alive>
|
||
// we want to recursively retrieve the real component to be rendered
|
||
function getRealChild (vnode) {
|
||
var compOptions = vnode && vnode.componentOptions;
|
||
if (compOptions && compOptions.Ctor.options.abstract) {
|
||
return getRealChild(getFirstComponentChild(compOptions.children))
|
||
} else {
|
||
return vnode
|
||
}
|
||
}
|
||
|
||
function extractTransitionData (comp) {
|
||
var data = {};
|
||
var options = comp.$options;
|
||
// props
|
||
for (var key in options.propsData) {
|
||
data[key] = comp[key];
|
||
}
|
||
// events.
|
||
// extract listeners and pass them directly to the transition methods
|
||
var listeners = options._parentListeners;
|
||
for (var key$1 in listeners) {
|
||
data[camelize(key$1)] = listeners[key$1];
|
||
}
|
||
return data
|
||
}
|
||
|
||
function placeholder (h, rawChild) {
|
||
if (/\d-keep-alive$/.test(rawChild.tag)) {
|
||
return h('keep-alive', {
|
||
props: rawChild.componentOptions.propsData
|
||
})
|
||
}
|
||
}
|
||
|
||
function hasParentTransition (vnode) {
|
||
while ((vnode = vnode.parent)) {
|
||
if (vnode.data.transition) {
|
||
return true
|
||
}
|
||
}
|
||
}
|
||
|
||
function isSameChild (child, oldChild) {
|
||
return oldChild.key === child.key && oldChild.tag === child.tag
|
||
}
|
||
|
||
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
||
|
||
var isVShowDirective = function (d) { return d.name === 'show'; };
|
||
|
||
var Transition = {
|
||
name: 'transition',
|
||
props: transitionProps,
|
||
abstract: true,
|
||
|
||
render: function render (h) {
|
||
var this$1 = this;
|
||
|
||
var children = this.$slots.default;
|
||
if (!children) {
|
||
return
|
||
}
|
||
|
||
// filter out text nodes (possible whitespaces)
|
||
children = children.filter(isNotTextNode);
|
||
/* istanbul ignore if */
|
||
if (!children.length) {
|
||
return
|
||
}
|
||
|
||
// warn multiple elements
|
||
if (children.length > 1) {
|
||
warn(
|
||
'<transition> can only be used on a single element. Use ' +
|
||
'<transition-group> for lists.',
|
||
this.$parent
|
||
);
|
||
}
|
||
|
||
var mode = this.mode;
|
||
|
||
// warn invalid mode
|
||
if (mode && mode !== 'in-out' && mode !== 'out-in'
|
||
) {
|
||
warn(
|
||
'invalid <transition> mode: ' + mode,
|
||
this.$parent
|
||
);
|
||
}
|
||
|
||
var rawChild = children[0];
|
||
|
||
// if this is a component root node and the component's
|
||
// parent container node also has transition, skip.
|
||
if (hasParentTransition(this.$vnode)) {
|
||
return rawChild
|
||
}
|
||
|
||
// apply transition data to child
|
||
// use getRealChild() to ignore abstract components e.g. keep-alive
|
||
var child = getRealChild(rawChild);
|
||
/* istanbul ignore if */
|
||
if (!child) {
|
||
return rawChild
|
||
}
|
||
|
||
if (this._leaving) {
|
||
return placeholder(h, rawChild)
|
||
}
|
||
|
||
// ensure a key that is unique to the vnode type and to this transition
|
||
// component instance. This key will be used to remove pending leaving nodes
|
||
// during entering.
|
||
var id = "__transition-" + (this._uid) + "-";
|
||
child.key = child.key == null
|
||
? child.isComment
|
||
? id + 'comment'
|
||
: id + child.tag
|
||
: isPrimitive(child.key)
|
||
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
||
: child.key;
|
||
|
||
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
||
var oldRawChild = this._vnode;
|
||
var oldChild = getRealChild(oldRawChild);
|
||
|
||
// mark v-show
|
||
// so that the transition module can hand over the control to the directive
|
||
if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
||
child.data.show = true;
|
||
}
|
||
|
||
if (
|
||
oldChild &&
|
||
oldChild.data &&
|
||
!isSameChild(child, oldChild) &&
|
||
!isAsyncPlaceholder(oldChild) &&
|
||
// #6687 component root is a comment node
|
||
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
||
) {
|
||
// replace old child transition data with fresh one
|
||
// important for dynamic transitions!
|
||
var oldData = oldChild.data.transition = extend({}, data);
|
||
// handle transition mode
|
||
if (mode === 'out-in') {
|
||
// return placeholder node and queue update when leave finishes
|
||
this._leaving = true;
|
||
mergeVNodeHook(oldData, 'afterLeave', function () {
|
||
this$1._leaving = false;
|
||
this$1.$forceUpdate();
|
||
});
|
||
return placeholder(h, rawChild)
|
||
} else if (mode === 'in-out') {
|
||
if (isAsyncPlaceholder(child)) {
|
||
return oldRawChild
|
||
}
|
||
var delayedLeave;
|
||
var performLeave = function () { delayedLeave(); };
|
||
mergeVNodeHook(data, 'afterEnter', performLeave);
|
||
mergeVNodeHook(data, 'enterCancelled', performLeave);
|
||
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
||
}
|
||
}
|
||
|
||
return rawChild
|
||
}
|
||
};
|
||
|
||
/* */
|
||
|
||
var props = extend({
|
||
tag: String,
|
||
moveClass: String
|
||
}, transitionProps);
|
||
|
||
delete props.mode;
|
||
|
||
var TransitionGroup = {
|
||
props: props,
|
||
|
||
beforeMount: function beforeMount () {
|
||
var this$1 = this;
|
||
|
||
var update = this._update;
|
||
this._update = function (vnode, hydrating) {
|
||
var restoreActiveInstance = setActiveInstance(this$1);
|
||
// force removing pass
|
||
this$1.__patch__(
|
||
this$1._vnode,
|
||
this$1.kept,
|
||
false, // hydrating
|
||
true // removeOnly (!important, avoids unnecessary moves)
|
||
);
|
||
this$1._vnode = this$1.kept;
|
||
restoreActiveInstance();
|
||
update.call(this$1, vnode, hydrating);
|
||
};
|
||
},
|
||
|
||
render: function render (h) {
|
||
var tag = this.tag || this.$vnode.data.tag || 'span';
|
||
var map = Object.create(null);
|
||
var prevChildren = this.prevChildren = this.children;
|
||
var rawChildren = this.$slots.default || [];
|
||
var children = this.children = [];
|
||
var transitionData = extractTransitionData(this);
|
||
|
||
for (var i = 0; i < rawChildren.length; i++) {
|
||
var c = rawChildren[i];
|
||
if (c.tag) {
|
||
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
||
children.push(c);
|
||
map[c.key] = c
|
||
;(c.data || (c.data = {})).transition = transitionData;
|
||
} else {
|
||
var opts = c.componentOptions;
|
||
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
||
warn(("<transition-group> children must be keyed: <" + name + ">"));
|
||
}
|
||
}
|
||
}
|
||
|
||
if (prevChildren) {
|
||
var kept = [];
|
||
var removed = [];
|
||
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
||
var c$1 = prevChildren[i$1];
|
||
c$1.data.transition = transitionData;
|
||
c$1.data.pos = c$1.elm.getBoundingClientRect();
|
||
if (map[c$1.key]) {
|
||
kept.push(c$1);
|
||
} else {
|
||
removed.push(c$1);
|
||
}
|
||
}
|
||
this.kept = h(tag, null, kept);
|
||
this.removed = removed;
|
||
}
|
||
|
||
return h(tag, null, children)
|
||
},
|
||
|
||
updated: function updated () {
|
||
var children = this.prevChildren;
|
||
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
||
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
||
return
|
||
}
|
||
|
||
// we divide the work into three loops to avoid mixing DOM reads and writes
|
||
// in each iteration - which helps prevent layout thrashing.
|
||
children.forEach(callPendingCbs);
|
||
children.forEach(recordPosition);
|
||
children.forEach(applyTranslation);
|
||
|
||
// force reflow to put everything in position
|
||
// assign to this to avoid being removed in tree-shaking
|
||
// $flow-disable-line
|
||
this._reflow = document.body.offsetHeight;
|
||
|
||
children.forEach(function (c) {
|
||
if (c.data.moved) {
|
||
var el = c.elm;
|
||
var s = el.style;
|
||
addTransitionClass(el, moveClass);
|
||
s.transform = s.WebkitTransform = s.transitionDuration = '';
|
||
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
||
if (e && e.target !== el) {
|
||
return
|
||
}
|
||
if (!e || /transform$/.test(e.propertyName)) {
|
||
el.removeEventListener(transitionEndEvent, cb);
|
||
el._moveCb = null;
|
||
removeTransitionClass(el, moveClass);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
methods: {
|
||
hasMove: function hasMove (el, moveClass) {
|
||
/* istanbul ignore if */
|
||
if (!hasTransition) {
|
||
return false
|
||
}
|
||
/* istanbul ignore if */
|
||
if (this._hasMove) {
|
||
return this._hasMove
|
||
}
|
||
// Detect whether an element with the move class applied has
|
||
// CSS transitions. Since the element may be inside an entering
|
||
// transition at this very moment, we make a clone of it and remove
|
||
// all other transition classes applied to ensure only the move class
|
||
// is applied.
|
||
var clone = el.cloneNode();
|
||
if (el._transitionClasses) {
|
||
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
||
}
|
||
addClass(clone, moveClass);
|
||
clone.style.display = 'none';
|
||
this.$el.appendChild(clone);
|
||
var info = getTransitionInfo(clone);
|
||
this.$el.removeChild(clone);
|
||
return (this._hasMove = info.hasTransform)
|
||
}
|
||
}
|
||
};
|
||
|
||
function callPendingCbs (c) {
|
||
/* istanbul ignore if */
|
||
if (c.elm._moveCb) {
|
||
c.elm._moveCb();
|
||
}
|
||
/* istanbul ignore if */
|
||
if (c.elm._enterCb) {
|
||
c.elm._enterCb();
|
||
}
|
||
}
|
||
|
||
function recordPosition (c) {
|
||
c.data.newPos = c.elm.getBoundingClientRect();
|
||
}
|
||
|
||
function applyTranslation (c) {
|
||
var oldPos = c.data.pos;
|
||
var newPos = c.data.newPos;
|
||
var dx = oldPos.left - newPos.left;
|
||
var dy = oldPos.top - newPos.top;
|
||
if (dx || dy) {
|
||
c.data.moved = true;
|
||
var s = c.elm.style;
|
||
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
||
s.transitionDuration = '0s';
|
||
}
|
||
}
|
||
|
||
var platformComponents = {
|
||
Transition: Transition,
|
||
TransitionGroup: TransitionGroup
|
||
};
|
||
|
||
/* */
|
||
|
||
// install platform specific utils
|
||
Vue.config.mustUseProp = mustUseProp;
|
||
Vue.config.isReservedTag = isReservedTag;
|
||
Vue.config.isReservedAttr = isReservedAttr;
|
||
Vue.config.getTagNamespace = getTagNamespace;
|
||
Vue.config.isUnknownElement = isUnknownElement;
|
||
|
||
// install platform runtime directives & components
|
||
extend(Vue.options.directives, platformDirectives);
|
||
extend(Vue.options.components, platformComponents);
|
||
|
||
// install platform patch function
|
||
Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
||
|
||
// public mount method
|
||
Vue.prototype.$mount = function (
|
||
el,
|
||
hydrating
|
||
) {
|
||
el = el && inBrowser ? query(el) : undefined;
|
||
return mountComponent(this, el, hydrating)
|
||
};
|
||
|
||
// devtools global hook
|
||
/* istanbul ignore next */
|
||
if (inBrowser) {
|
||
setTimeout(function () {
|
||
if (config.devtools) {
|
||
if (devtools) {
|
||
devtools.emit('init', Vue);
|
||
} else {
|
||
console[console.info ? 'info' : 'log'](
|
||
'Download the Vue Devtools extension for a better development experience:\n' +
|
||
'https://github.com/vuejs/vue-devtools'
|
||
);
|
||
}
|
||
}
|
||
if (config.productionTip !== false &&
|
||
typeof console !== 'undefined'
|
||
) {
|
||
console[console.info ? 'info' : 'log'](
|
||
"You are running Vue in development mode.\n" +
|
||
"Make sure to turn on production mode when deploying for production.\n" +
|
||
"See more tips at https://vuejs.org/guide/deployment.html"
|
||
);
|
||
}
|
||
}, 0);
|
||
}
|
||
|
||
/* */
|
||
|
||
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
||
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
||
|
||
var buildRegex = cached(function (delimiters) {
|
||
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
||
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
||
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
||
});
|
||
|
||
|
||
|
||
function parseText (
|
||
text,
|
||
delimiters
|
||
) {
|
||
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
||
if (!tagRE.test(text)) {
|
||
return
|
||
}
|
||
var tokens = [];
|
||
var rawTokens = [];
|
||
var lastIndex = tagRE.lastIndex = 0;
|
||
var match, index, tokenValue;
|
||
while ((match = tagRE.exec(text))) {
|
||
index = match.index;
|
||
// push text token
|
||
if (index > lastIndex) {
|
||
rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
||
tokens.push(JSON.stringify(tokenValue));
|
||
}
|
||
// tag token
|
||
var exp = parseFilters(match[1].trim());
|
||
tokens.push(("_s(" + exp + ")"));
|
||
rawTokens.push({ '@binding': exp });
|
||
lastIndex = index + match[0].length;
|
||
}
|
||
if (lastIndex < text.length) {
|
||
rawTokens.push(tokenValue = text.slice(lastIndex));
|
||
tokens.push(JSON.stringify(tokenValue));
|
||
}
|
||
return {
|
||
expression: tokens.join('+'),
|
||
tokens: rawTokens
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function transformNode (el, options) {
|
||
var warn = options.warn || baseWarn;
|
||
var staticClass = getAndRemoveAttr(el, 'class');
|
||
if (staticClass) {
|
||
var res = parseText(staticClass, options.delimiters);
|
||
if (res) {
|
||
warn(
|
||
"class=\"" + staticClass + "\": " +
|
||
'Interpolation inside attributes has been removed. ' +
|
||
'Use v-bind or the colon shorthand instead. For example, ' +
|
||
'instead of <div class="{{ val }}">, use <div :class="val">.',
|
||
el.rawAttrsMap['class']
|
||
);
|
||
}
|
||
}
|
||
if (staticClass) {
|
||
el.staticClass = JSON.stringify(staticClass);
|
||
}
|
||
var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
|
||
if (classBinding) {
|
||
el.classBinding = classBinding;
|
||
}
|
||
}
|
||
|
||
function genData (el) {
|
||
var data = '';
|
||
if (el.staticClass) {
|
||
data += "staticClass:" + (el.staticClass) + ",";
|
||
}
|
||
if (el.classBinding) {
|
||
data += "class:" + (el.classBinding) + ",";
|
||
}
|
||
return data
|
||
}
|
||
|
||
var klass$1 = {
|
||
staticKeys: ['staticClass'],
|
||
transformNode: transformNode,
|
||
genData: genData
|
||
};
|
||
|
||
/* */
|
||
|
||
function transformNode$1 (el, options) {
|
||
var warn = options.warn || baseWarn;
|
||
var staticStyle = getAndRemoveAttr(el, 'style');
|
||
if (staticStyle) {
|
||
/* istanbul ignore if */
|
||
{
|
||
var res = parseText(staticStyle, options.delimiters);
|
||
if (res) {
|
||
warn(
|
||
"style=\"" + staticStyle + "\": " +
|
||
'Interpolation inside attributes has been removed. ' +
|
||
'Use v-bind or the colon shorthand instead. For example, ' +
|
||
'instead of <div style="{{ val }}">, use <div :style="val">.',
|
||
el.rawAttrsMap['style']
|
||
);
|
||
}
|
||
}
|
||
el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
||
}
|
||
|
||
var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
|
||
if (styleBinding) {
|
||
el.styleBinding = styleBinding;
|
||
}
|
||
}
|
||
|
||
function genData$1 (el) {
|
||
var data = '';
|
||
if (el.staticStyle) {
|
||
data += "staticStyle:" + (el.staticStyle) + ",";
|
||
}
|
||
if (el.styleBinding) {
|
||
data += "style:(" + (el.styleBinding) + "),";
|
||
}
|
||
return data
|
||
}
|
||
|
||
var style$1 = {
|
||
staticKeys: ['staticStyle'],
|
||
transformNode: transformNode$1,
|
||
genData: genData$1
|
||
};
|
||
|
||
/* */
|
||
|
||
var decoder;
|
||
|
||
var he = {
|
||
decode: function decode (html) {
|
||
decoder = decoder || document.createElement('div');
|
||
decoder.innerHTML = html;
|
||
return decoder.textContent
|
||
}
|
||
};
|
||
|
||
/* */
|
||
|
||
var isUnaryTag = makeMap(
|
||
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
||
'link,meta,param,source,track,wbr'
|
||
);
|
||
|
||
// Elements that you can, intentionally, leave open
|
||
// (and which close themselves)
|
||
var canBeLeftOpenTag = makeMap(
|
||
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
||
);
|
||
|
||
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
||
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
||
var isNonPhrasingTag = makeMap(
|
||
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
||
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
||
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
||
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
||
'title,tr,track'
|
||
);
|
||
|
||
/**
|
||
* Not type-checking this file because it's mostly vendor code.
|
||
*/
|
||
|
||
// Regular Expressions for parsing tags and attributes
|
||
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
||
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
||
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
||
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
||
var startTagOpen = new RegExp(("^<" + qnameCapture));
|
||
var startTagClose = /^\s*(\/?)>/;
|
||
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
||
var doctype = /^<!DOCTYPE [^>]+>/i;
|
||
// #7298: escape - to avoid being pased as HTML comment when inlined in page
|
||
var comment = /^<!\--/;
|
||
var conditionalComment = /^<!\[/;
|
||
|
||
// Special Elements (can contain anything)
|
||
var isPlainTextElement = makeMap('script,style,textarea', true);
|
||
var reCache = {};
|
||
|
||
var decodingMap = {
|
||
'<': '<',
|
||
'>': '>',
|
||
'"': '"',
|
||
'&': '&',
|
||
' ': '\n',
|
||
'	': '\t',
|
||
''': "'"
|
||
};
|
||
var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
||
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
||
|
||
// #5992
|
||
var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
||
var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
||
|
||
function decodeAttr (value, shouldDecodeNewlines) {
|
||
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
||
return value.replace(re, function (match) { return decodingMap[match]; })
|
||
}
|
||
|
||
function parseHTML (html, options) {
|
||
var stack = [];
|
||
var expectHTML = options.expectHTML;
|
||
var isUnaryTag$$1 = options.isUnaryTag || no;
|
||
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
||
var index = 0;
|
||
var last, lastTag;
|
||
while (html) {
|
||
last = html;
|
||
// Make sure we're not in a plaintext content element like script/style
|
||
if (!lastTag || !isPlainTextElement(lastTag)) {
|
||
var textEnd = html.indexOf('<');
|
||
if (textEnd === 0) {
|
||
// Comment:
|
||
if (comment.test(html)) {
|
||
var commentEnd = html.indexOf('-->');
|
||
|
||
if (commentEnd >= 0) {
|
||
if (options.shouldKeepComment) {
|
||
options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
||
}
|
||
advance(commentEnd + 3);
|
||
continue
|
||
}
|
||
}
|
||
|
||
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
|
||
if (conditionalComment.test(html)) {
|
||
var conditionalEnd = html.indexOf(']>');
|
||
|
||
if (conditionalEnd >= 0) {
|
||
advance(conditionalEnd + 2);
|
||
continue
|
||
}
|
||
}
|
||
|
||
// Doctype:
|
||
var doctypeMatch = html.match(doctype);
|
||
if (doctypeMatch) {
|
||
advance(doctypeMatch[0].length);
|
||
continue
|
||
}
|
||
|
||
// End tag:
|
||
var endTagMatch = html.match(endTag);
|
||
if (endTagMatch) {
|
||
var curIndex = index;
|
||
advance(endTagMatch[0].length);
|
||
parseEndTag(endTagMatch[1], curIndex, index);
|
||
continue
|
||
}
|
||
|
||
// Start tag:
|
||
var startTagMatch = parseStartTag();
|
||
if (startTagMatch) {
|
||
handleStartTag(startTagMatch);
|
||
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
||
advance(1);
|
||
}
|
||
continue
|
||
}
|
||
}
|
||
|
||
var text = (void 0), rest = (void 0), next = (void 0);
|
||
if (textEnd >= 0) {
|
||
rest = html.slice(textEnd);
|
||
while (
|
||
!endTag.test(rest) &&
|
||
!startTagOpen.test(rest) &&
|
||
!comment.test(rest) &&
|
||
!conditionalComment.test(rest)
|
||
) {
|
||
// < in plain text, be forgiving and treat it as text
|
||
next = rest.indexOf('<', 1);
|
||
if (next < 0) { break }
|
||
textEnd += next;
|
||
rest = html.slice(textEnd);
|
||
}
|
||
text = html.substring(0, textEnd);
|
||
}
|
||
|
||
if (textEnd < 0) {
|
||
text = html;
|
||
}
|
||
|
||
if (text) {
|
||
advance(text.length);
|
||
}
|
||
|
||
if (options.chars && text) {
|
||
options.chars(text, index - text.length, index);
|
||
}
|
||
} else {
|
||
var endTagLength = 0;
|
||
var stackedTag = lastTag.toLowerCase();
|
||
var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
||
var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
||
endTagLength = endTag.length;
|
||
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
||
text = text
|
||
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
|
||
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
||
}
|
||
if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
||
text = text.slice(1);
|
||
}
|
||
if (options.chars) {
|
||
options.chars(text);
|
||
}
|
||
return ''
|
||
});
|
||
index += html.length - rest$1.length;
|
||
html = rest$1;
|
||
parseEndTag(stackedTag, index - endTagLength, index);
|
||
}
|
||
|
||
if (html === last) {
|
||
options.chars && options.chars(html);
|
||
if (!stack.length && options.warn) {
|
||
options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
||
}
|
||
break
|
||
}
|
||
}
|
||
|
||
// Clean up any remaining tags
|
||
parseEndTag();
|
||
|
||
function advance (n) {
|
||
index += n;
|
||
html = html.substring(n);
|
||
}
|
||
|
||
function parseStartTag () {
|
||
var start = html.match(startTagOpen);
|
||
if (start) {
|
||
var match = {
|
||
tagName: start[1],
|
||
attrs: [],
|
||
start: index
|
||
};
|
||
advance(start[0].length);
|
||
var end, attr;
|
||
while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
||
attr.start = index;
|
||
advance(attr[0].length);
|
||
attr.end = index;
|
||
match.attrs.push(attr);
|
||
}
|
||
if (end) {
|
||
match.unarySlash = end[1];
|
||
advance(end[0].length);
|
||
match.end = index;
|
||
return match
|
||
}
|
||
}
|
||
}
|
||
|
||
function handleStartTag (match) {
|
||
var tagName = match.tagName;
|
||
var unarySlash = match.unarySlash;
|
||
|
||
if (expectHTML) {
|
||
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
||
parseEndTag(lastTag);
|
||
}
|
||
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
||
parseEndTag(tagName);
|
||
}
|
||
}
|
||
|
||
var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
||
|
||
var l = match.attrs.length;
|
||
var attrs = new Array(l);
|
||
for (var i = 0; i < l; i++) {
|
||
var args = match.attrs[i];
|
||
var value = args[3] || args[4] || args[5] || '';
|
||
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
||
? options.shouldDecodeNewlinesForHref
|
||
: options.shouldDecodeNewlines;
|
||
attrs[i] = {
|
||
name: args[1],
|
||
value: decodeAttr(value, shouldDecodeNewlines)
|
||
};
|
||
if (options.outputSourceRange) {
|
||
attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
||
attrs[i].end = args.end;
|
||
}
|
||
}
|
||
|
||
if (!unary) {
|
||
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
||
lastTag = tagName;
|
||
}
|
||
|
||
if (options.start) {
|
||
options.start(tagName, attrs, unary, match.start, match.end);
|
||
}
|
||
}
|
||
|
||
function parseEndTag (tagName, start, end) {
|
||
var pos, lowerCasedTagName;
|
||
if (start == null) { start = index; }
|
||
if (end == null) { end = index; }
|
||
|
||
// Find the closest opened tag of the same type
|
||
if (tagName) {
|
||
lowerCasedTagName = tagName.toLowerCase();
|
||
for (pos = stack.length - 1; pos >= 0; pos--) {
|
||
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
||
break
|
||
}
|
||
}
|
||
} else {
|
||
// If no tag name is provided, clean shop
|
||
pos = 0;
|
||
}
|
||
|
||
if (pos >= 0) {
|
||
// Close all the open elements, up the stack
|
||
for (var i = stack.length - 1; i >= pos; i--) {
|
||
if (i > pos || !tagName &&
|
||
options.warn
|
||
) {
|
||
options.warn(
|
||
("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
||
{ start: stack[i].start, end: stack[i].end }
|
||
);
|
||
}
|
||
if (options.end) {
|
||
options.end(stack[i].tag, start, end);
|
||
}
|
||
}
|
||
|
||
// Remove the open elements from the stack
|
||
stack.length = pos;
|
||
lastTag = pos && stack[pos - 1].tag;
|
||
} else if (lowerCasedTagName === 'br') {
|
||
if (options.start) {
|
||
options.start(tagName, [], true, start, end);
|
||
}
|
||
} else if (lowerCasedTagName === 'p') {
|
||
if (options.start) {
|
||
options.start(tagName, [], false, start, end);
|
||
}
|
||
if (options.end) {
|
||
options.end(tagName, start, end);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var onRE = /^@|^v-on:/;
|
||
var dirRE = /^v-|^@|^:/;
|
||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||
var stripParensRE = /^\(|\)$/g;
|
||
var dynamicArgRE = /^\[.*\]$/;
|
||
|
||
var argRE = /:(.*)$/;
|
||
var bindRE = /^:|^\.|^v-bind:/;
|
||
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
||
|
||
var slotRE = /^v-slot(:|$)|^#/;
|
||
|
||
var lineBreakRE = /[\r\n]/;
|
||
var whitespaceRE$1 = /\s+/g;
|
||
|
||
var invalidAttributeRE = /[\s"'<>\/=]/;
|
||
|
||
var decodeHTMLCached = cached(he.decode);
|
||
|
||
var emptySlotScopeToken = "_empty_";
|
||
|
||
// configurable state
|
||
var warn$2;
|
||
var delimiters;
|
||
var transforms;
|
||
var preTransforms;
|
||
var postTransforms;
|
||
var platformIsPreTag;
|
||
var platformMustUseProp;
|
||
var platformGetTagNamespace;
|
||
var maybeComponent;
|
||
|
||
function createASTElement (
|
||
tag,
|
||
attrs,
|
||
parent
|
||
) {
|
||
return {
|
||
type: 1,
|
||
tag: tag,
|
||
attrsList: attrs,
|
||
attrsMap: makeAttrsMap(attrs),
|
||
rawAttrsMap: {},
|
||
parent: parent,
|
||
children: []
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Convert HTML string to AST.
|
||
*/
|
||
function parse (
|
||
template,
|
||
options
|
||
) {
|
||
warn$2 = options.warn || baseWarn;
|
||
|
||
platformIsPreTag = options.isPreTag || no;
|
||
platformMustUseProp = options.mustUseProp || no;
|
||
platformGetTagNamespace = options.getTagNamespace || no;
|
||
var isReservedTag = options.isReservedTag || no;
|
||
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||
|
||
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
||
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
||
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
||
|
||
delimiters = options.delimiters;
|
||
|
||
var stack = [];
|
||
var preserveWhitespace = options.preserveWhitespace !== false;
|
||
var whitespaceOption = options.whitespace;
|
||
var root;
|
||
var currentParent;
|
||
var inVPre = false;
|
||
var inPre = false;
|
||
var warned = false;
|
||
|
||
function warnOnce (msg, range) {
|
||
if (!warned) {
|
||
warned = true;
|
||
warn$2(msg, range);
|
||
}
|
||
}
|
||
|
||
function closeElement (element) {
|
||
trimEndingWhitespace(element);
|
||
if (!inVPre && !element.processed) {
|
||
element = processElement(element, options);
|
||
}
|
||
// tree management
|
||
if (!stack.length && element !== root) {
|
||
// allow root elements with v-if, v-else-if and v-else
|
||
if (root.if && (element.elseif || element.else)) {
|
||
{
|
||
checkRootConstraints(element);
|
||
}
|
||
addIfCondition(root, {
|
||
exp: element.elseif,
|
||
block: element
|
||
});
|
||
} else {
|
||
warnOnce(
|
||
"Component template should contain exactly one root element. " +
|
||
"If you are using v-if on multiple elements, " +
|
||
"use v-else-if to chain them instead.",
|
||
{ start: element.start }
|
||
);
|
||
}
|
||
}
|
||
if (currentParent && !element.forbidden) {
|
||
if (element.elseif || element.else) {
|
||
processIfConditions(element, currentParent);
|
||
} else {
|
||
if (element.slotScope) {
|
||
// scoped slot
|
||
// keep it in the children list so that v-else(-if) conditions can
|
||
// find it as the prev node.
|
||
var name = element.slotTarget || '"default"'
|
||
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
||
}
|
||
currentParent.children.push(element);
|
||
element.parent = currentParent;
|
||
}
|
||
}
|
||
|
||
// final children cleanup
|
||
// filter out scoped slots
|
||
element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
||
// remove trailing whitespace node again
|
||
trimEndingWhitespace(element);
|
||
|
||
// check pre state
|
||
if (element.pre) {
|
||
inVPre = false;
|
||
}
|
||
if (platformIsPreTag(element.tag)) {
|
||
inPre = false;
|
||
}
|
||
// apply post-transforms
|
||
for (var i = 0; i < postTransforms.length; i++) {
|
||
postTransforms[i](element, options);
|
||
}
|
||
}
|
||
|
||
function trimEndingWhitespace (el) {
|
||
// remove trailing whitespace node
|
||
if (!inPre) {
|
||
var lastNode;
|
||
while (
|
||
(lastNode = el.children[el.children.length - 1]) &&
|
||
lastNode.type === 3 &&
|
||
lastNode.text === ' '
|
||
) {
|
||
el.children.pop();
|
||
}
|
||
}
|
||
}
|
||
|
||
function checkRootConstraints (el) {
|
||
if (el.tag === 'slot' || el.tag === 'template') {
|
||
warnOnce(
|
||
"Cannot use <" + (el.tag) + "> as component root element because it may " +
|
||
'contain multiple nodes.',
|
||
{ start: el.start }
|
||
);
|
||
}
|
||
if (el.attrsMap.hasOwnProperty('v-for')) {
|
||
warnOnce(
|
||
'Cannot use v-for on stateful component root element because ' +
|
||
'it renders multiple elements.',
|
||
el.rawAttrsMap['v-for']
|
||
);
|
||
}
|
||
}
|
||
|
||
parseHTML(template, {
|
||
warn: warn$2,
|
||
expectHTML: options.expectHTML,
|
||
isUnaryTag: options.isUnaryTag,
|
||
canBeLeftOpenTag: options.canBeLeftOpenTag,
|
||
shouldDecodeNewlines: options.shouldDecodeNewlines,
|
||
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
||
shouldKeepComment: options.comments,
|
||
outputSourceRange: options.outputSourceRange,
|
||
start: function start (tag, attrs, unary, start$1, end) {
|
||
// check namespace.
|
||
// inherit parent ns if there is one
|
||
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
||
|
||
// handle IE svg bug
|
||
/* istanbul ignore if */
|
||
if (isIE && ns === 'svg') {
|
||
attrs = guardIESVGBug(attrs);
|
||
}
|
||
|
||
var element = createASTElement(tag, attrs, currentParent);
|
||
if (ns) {
|
||
element.ns = ns;
|
||
}
|
||
|
||
{
|
||
if (options.outputSourceRange) {
|
||
element.start = start$1;
|
||
element.end = end;
|
||
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
||
cumulated[attr.name] = attr;
|
||
return cumulated
|
||
}, {});
|
||
}
|
||
attrs.forEach(function (attr) {
|
||
if (invalidAttributeRE.test(attr.name)) {
|
||
warn$2(
|
||
"Invalid dynamic argument expression: attribute names cannot contain " +
|
||
"spaces, quotes, <, >, / or =.",
|
||
{
|
||
start: attr.start + attr.name.indexOf("["),
|
||
end: attr.start + attr.name.length
|
||
}
|
||
);
|
||
}
|
||
});
|
||
}
|
||
|
||
if (isForbiddenTag(element) && !isServerRendering()) {
|
||
element.forbidden = true;
|
||
warn$2(
|
||
'Templates should only be responsible for mapping the state to the ' +
|
||
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
||
"<" + tag + ">" + ', as they will not be parsed.',
|
||
{ start: element.start }
|
||
);
|
||
}
|
||
|
||
// apply pre-transforms
|
||
for (var i = 0; i < preTransforms.length; i++) {
|
||
element = preTransforms[i](element, options) || element;
|
||
}
|
||
|
||
if (!inVPre) {
|
||
processPre(element);
|
||
if (element.pre) {
|
||
inVPre = true;
|
||
}
|
||
}
|
||
if (platformIsPreTag(element.tag)) {
|
||
inPre = true;
|
||
}
|
||
if (inVPre) {
|
||
processRawAttrs(element);
|
||
} else if (!element.processed) {
|
||
// structural directives
|
||
processFor(element);
|
||
processIf(element);
|
||
processOnce(element);
|
||
}
|
||
|
||
if (!root) {
|
||
root = element;
|
||
{
|
||
checkRootConstraints(root);
|
||
}
|
||
}
|
||
|
||
if (!unary) {
|
||
currentParent = element;
|
||
stack.push(element);
|
||
} else {
|
||
closeElement(element);
|
||
}
|
||
},
|
||
|
||
end: function end (tag, start, end$1) {
|
||
var element = stack[stack.length - 1];
|
||
// pop stack
|
||
stack.length -= 1;
|
||
currentParent = stack[stack.length - 1];
|
||
if (options.outputSourceRange) {
|
||
element.end = end$1;
|
||
}
|
||
closeElement(element);
|
||
},
|
||
|
||
chars: function chars (text, start, end) {
|
||
if (!currentParent) {
|
||
{
|
||
if (text === template) {
|
||
warnOnce(
|
||
'Component template requires a root element, rather than just text.',
|
||
{ start: start }
|
||
);
|
||
} else if ((text = text.trim())) {
|
||
warnOnce(
|
||
("text \"" + text + "\" outside root element will be ignored."),
|
||
{ start: start }
|
||
);
|
||
}
|
||
}
|
||
return
|
||
}
|
||
// IE textarea placeholder bug
|
||
/* istanbul ignore if */
|
||
if (isIE &&
|
||
currentParent.tag === 'textarea' &&
|
||
currentParent.attrsMap.placeholder === text
|
||
) {
|
||
return
|
||
}
|
||
var children = currentParent.children;
|
||
if (inPre || text.trim()) {
|
||
text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
||
} else if (!children.length) {
|
||
// remove the whitespace-only node right after an opening tag
|
||
text = '';
|
||
} else if (whitespaceOption) {
|
||
if (whitespaceOption === 'condense') {
|
||
// in condense mode, remove the whitespace node if it contains
|
||
// line break, otherwise condense to a single space
|
||
text = lineBreakRE.test(text) ? '' : ' ';
|
||
} else {
|
||
text = ' ';
|
||
}
|
||
} else {
|
||
text = preserveWhitespace ? ' ' : '';
|
||
}
|
||
if (text) {
|
||
if (!inPre && whitespaceOption === 'condense') {
|
||
// condense consecutive whitespaces into single space
|
||
text = text.replace(whitespaceRE$1, ' ');
|
||
}
|
||
var res;
|
||
var child;
|
||
if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
||
child = {
|
||
type: 2,
|
||
expression: res.expression,
|
||
tokens: res.tokens,
|
||
text: text
|
||
};
|
||
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
||
child = {
|
||
type: 3,
|
||
text: text
|
||
};
|
||
}
|
||
if (child) {
|
||
if (options.outputSourceRange) {
|
||
child.start = start;
|
||
child.end = end;
|
||
}
|
||
children.push(child);
|
||
}
|
||
}
|
||
},
|
||
comment: function comment (text, start, end) {
|
||
// adding anyting as a sibling to the root node is forbidden
|
||
// comments should still be allowed, but ignored
|
||
if (currentParent) {
|
||
var child = {
|
||
type: 3,
|
||
text: text,
|
||
isComment: true
|
||
};
|
||
if (options.outputSourceRange) {
|
||
child.start = start;
|
||
child.end = end;
|
||
}
|
||
currentParent.children.push(child);
|
||
}
|
||
}
|
||
});
|
||
return root
|
||
}
|
||
|
||
function processPre (el) {
|
||
if (getAndRemoveAttr(el, 'v-pre') != null) {
|
||
el.pre = true;
|
||
}
|
||
}
|
||
|
||
function processRawAttrs (el) {
|
||
var list = el.attrsList;
|
||
var len = list.length;
|
||
if (len) {
|
||
var attrs = el.attrs = new Array(len);
|
||
for (var i = 0; i < len; i++) {
|
||
attrs[i] = {
|
||
name: list[i].name,
|
||
value: JSON.stringify(list[i].value)
|
||
};
|
||
if (list[i].start != null) {
|
||
attrs[i].start = list[i].start;
|
||
attrs[i].end = list[i].end;
|
||
}
|
||
}
|
||
} else if (!el.pre) {
|
||
// non root node in pre blocks with no attributes
|
||
el.plain = true;
|
||
}
|
||
}
|
||
|
||
function processElement (
|
||
element,
|
||
options
|
||
) {
|
||
processKey(element);
|
||
|
||
// determine whether this is a plain element after
|
||
// removing structural attributes
|
||
element.plain = (
|
||
!element.key &&
|
||
!element.scopedSlots &&
|
||
!element.attrsList.length
|
||
);
|
||
|
||
processRef(element);
|
||
processSlotContent(element);
|
||
processSlotOutlet(element);
|
||
processComponent(element);
|
||
for (var i = 0; i < transforms.length; i++) {
|
||
element = transforms[i](element, options) || element;
|
||
}
|
||
processAttrs(element);
|
||
return element
|
||
}
|
||
|
||
function processKey (el) {
|
||
var exp = getBindingAttr(el, 'key');
|
||
if (exp) {
|
||
{
|
||
if (el.tag === 'template') {
|
||
warn$2(
|
||
"<template> cannot be keyed. Place the key on real elements instead.",
|
||
getRawBindingAttr(el, 'key')
|
||
);
|
||
}
|
||
if (el.for) {
|
||
var iterator = el.iterator2 || el.iterator1;
|
||
var parent = el.parent;
|
||
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
||
warn$2(
|
||
"Do not use v-for index as key on <transition-group> children, " +
|
||
"this is the same as not using keys.",
|
||
getRawBindingAttr(el, 'key'),
|
||
true /* tip */
|
||
);
|
||
}
|
||
}
|
||
}
|
||
el.key = exp;
|
||
}
|
||
}
|
||
|
||
function processRef (el) {
|
||
var ref = getBindingAttr(el, 'ref');
|
||
if (ref) {
|
||
el.ref = ref;
|
||
el.refInFor = checkInFor(el);
|
||
}
|
||
}
|
||
|
||
function processFor (el) {
|
||
var exp;
|
||
if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
||
var res = parseFor(exp);
|
||
if (res) {
|
||
extend(el, res);
|
||
} else {
|
||
warn$2(
|
||
("Invalid v-for expression: " + exp),
|
||
el.rawAttrsMap['v-for']
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
function parseFor (exp) {
|
||
var inMatch = exp.match(forAliasRE);
|
||
if (!inMatch) { return }
|
||
var res = {};
|
||
res.for = inMatch[2].trim();
|
||
var alias = inMatch[1].trim().replace(stripParensRE, '');
|
||
var iteratorMatch = alias.match(forIteratorRE);
|
||
if (iteratorMatch) {
|
||
res.alias = alias.replace(forIteratorRE, '').trim();
|
||
res.iterator1 = iteratorMatch[1].trim();
|
||
if (iteratorMatch[2]) {
|
||
res.iterator2 = iteratorMatch[2].trim();
|
||
}
|
||
} else {
|
||
res.alias = alias;
|
||
}
|
||
return res
|
||
}
|
||
|
||
function processIf (el) {
|
||
var exp = getAndRemoveAttr(el, 'v-if');
|
||
if (exp) {
|
||
el.if = exp;
|
||
addIfCondition(el, {
|
||
exp: exp,
|
||
block: el
|
||
});
|
||
} else {
|
||
if (getAndRemoveAttr(el, 'v-else') != null) {
|
||
el.else = true;
|
||
}
|
||
var elseif = getAndRemoveAttr(el, 'v-else-if');
|
||
if (elseif) {
|
||
el.elseif = elseif;
|
||
}
|
||
}
|
||
}
|
||
|
||
function processIfConditions (el, parent) {
|
||
var prev = findPrevElement(parent.children);
|
||
if (prev && prev.if) {
|
||
addIfCondition(prev, {
|
||
exp: el.elseif,
|
||
block: el
|
||
});
|
||
} else {
|
||
warn$2(
|
||
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
||
"used on element <" + (el.tag) + "> without corresponding v-if.",
|
||
el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
||
);
|
||
}
|
||
}
|
||
|
||
function findPrevElement (children) {
|
||
var i = children.length;
|
||
while (i--) {
|
||
if (children[i].type === 1) {
|
||
return children[i]
|
||
} else {
|
||
if (children[i].text !== ' ') {
|
||
warn$2(
|
||
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
||
"will be ignored.",
|
||
children[i]
|
||
);
|
||
}
|
||
children.pop();
|
||
}
|
||
}
|
||
}
|
||
|
||
function addIfCondition (el, condition) {
|
||
if (!el.ifConditions) {
|
||
el.ifConditions = [];
|
||
}
|
||
el.ifConditions.push(condition);
|
||
}
|
||
|
||
function processOnce (el) {
|
||
var once$$1 = getAndRemoveAttr(el, 'v-once');
|
||
if (once$$1 != null) {
|
||
el.once = true;
|
||
}
|
||
}
|
||
|
||
// handle content being passed to a component as slot,
|
||
// e.g. <template slot="xxx">, <div slot-scope="xxx">
|
||
function processSlotContent (el) {
|
||
var slotScope;
|
||
if (el.tag === 'template') {
|
||
slotScope = getAndRemoveAttr(el, 'scope');
|
||
/* istanbul ignore if */
|
||
if (slotScope) {
|
||
warn$2(
|
||
"the \"scope\" attribute for scoped slots have been deprecated and " +
|
||
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
||
"can also be used on plain elements in addition to <template> to " +
|
||
"denote scoped slots.",
|
||
el.rawAttrsMap['scope'],
|
||
true
|
||
);
|
||
}
|
||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||
/* istanbul ignore if */
|
||
if (el.attrsMap['v-for']) {
|
||
warn$2(
|
||
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
||
"(v-for takes higher priority). Use a wrapper <template> for the " +
|
||
"scoped slot to make it clearer.",
|
||
el.rawAttrsMap['slot-scope'],
|
||
true
|
||
);
|
||
}
|
||
el.slotScope = slotScope;
|
||
}
|
||
|
||
// slot="xxx"
|
||
var slotTarget = getBindingAttr(el, 'slot');
|
||
if (slotTarget) {
|
||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||
// preserve slot as an attribute for native shadow DOM compat
|
||
// only for non-scoped slots.
|
||
if (el.tag !== 'template' && !el.slotScope) {
|
||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||
}
|
||
}
|
||
|
||
// 2.6 v-slot syntax
|
||
{
|
||
if (el.tag === 'template') {
|
||
// v-slot on <template>
|
||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||
if (slotBinding) {
|
||
{
|
||
if (el.slotTarget || el.slotScope) {
|
||
warn$2(
|
||
"Unexpected mixed usage of different slot syntaxes.",
|
||
el
|
||
);
|
||
}
|
||
if (el.parent && !maybeComponent(el.parent)) {
|
||
warn$2(
|
||
"<template v-slot> can only appear at the root level inside " +
|
||
"the receiving the component",
|
||
el
|
||
);
|
||
}
|
||
}
|
||
var ref = getSlotName(slotBinding);
|
||
var name = ref.name;
|
||
var dynamic = ref.dynamic;
|
||
el.slotTarget = name;
|
||
el.slotTargetDynamic = dynamic;
|
||
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
|
||
}
|
||
} else {
|
||
// v-slot on component, denotes default slot
|
||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||
if (slotBinding$1) {
|
||
{
|
||
if (!maybeComponent(el)) {
|
||
warn$2(
|
||
"v-slot can only be used on components or <template>.",
|
||
slotBinding$1
|
||
);
|
||
}
|
||
if (el.slotScope || el.slotTarget) {
|
||
warn$2(
|
||
"Unexpected mixed usage of different slot syntaxes.",
|
||
el
|
||
);
|
||
}
|
||
if (el.scopedSlots) {
|
||
warn$2(
|
||
"To avoid scope ambiguity, the default slot should also use " +
|
||
"<template> syntax when there are other named slots.",
|
||
slotBinding$1
|
||
);
|
||
}
|
||
}
|
||
// add the component's children to its default slot
|
||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||
var ref$1 = getSlotName(slotBinding$1);
|
||
var name$1 = ref$1.name;
|
||
var dynamic$1 = ref$1.dynamic;
|
||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||
slotContainer.slotTarget = name$1;
|
||
slotContainer.slotTargetDynamic = dynamic$1;
|
||
slotContainer.children = el.children.filter(function (c) {
|
||
if (!c.slotScope) {
|
||
c.parent = slotContainer;
|
||
return true
|
||
}
|
||
});
|
||
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
||
// remove children as they are returned from scopedSlots now
|
||
el.children = [];
|
||
// mark el non-plain so data gets generated
|
||
el.plain = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function getSlotName (binding) {
|
||
var name = binding.name.replace(slotRE, '');
|
||
if (!name) {
|
||
if (binding.name[0] !== '#') {
|
||
name = 'default';
|
||
} else {
|
||
warn$2(
|
||
"v-slot shorthand syntax requires a slot name.",
|
||
binding
|
||
);
|
||
}
|
||
}
|
||
return dynamicArgRE.test(name)
|
||
// dynamic [name]
|
||
? { name: name.slice(1, -1), dynamic: true }
|
||
// static name
|
||
: { name: ("\"" + name + "\""), dynamic: false }
|
||
}
|
||
|
||
// handle <slot/> outlets
|
||
function processSlotOutlet (el) {
|
||
if (el.tag === 'slot') {
|
||
el.slotName = getBindingAttr(el, 'name');
|
||
if (el.key) {
|
||
warn$2(
|
||
"`key` does not work on <slot> because slots are abstract outlets " +
|
||
"and can possibly expand into multiple elements. " +
|
||
"Use the key on a wrapping element instead.",
|
||
getRawBindingAttr(el, 'key')
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
function processComponent (el) {
|
||
var binding;
|
||
if ((binding = getBindingAttr(el, 'is'))) {
|
||
el.component = binding;
|
||
}
|
||
if (getAndRemoveAttr(el, 'inline-template') != null) {
|
||
el.inlineTemplate = true;
|
||
}
|
||
}
|
||
|
||
function processAttrs (el) {
|
||
var list = el.attrsList;
|
||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||
for (i = 0, l = list.length; i < l; i++) {
|
||
name = rawName = list[i].name;
|
||
value = list[i].value;
|
||
if (dirRE.test(name)) {
|
||
// mark element as dynamic
|
||
el.hasBindings = true;
|
||
// modifiers
|
||
modifiers = parseModifiers(name.replace(dirRE, ''));
|
||
// support .foo shorthand syntax for the .prop modifier
|
||
if (modifiers) {
|
||
name = name.replace(modifierRE, '');
|
||
}
|
||
if (bindRE.test(name)) { // v-bind
|
||
name = name.replace(bindRE, '');
|
||
value = parseFilters(value);
|
||
isDynamic = dynamicArgRE.test(name);
|
||
if (isDynamic) {
|
||
name = name.slice(1, -1);
|
||
}
|
||
if (
|
||
value.trim().length === 0
|
||
) {
|
||
warn$2(
|
||
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
||
);
|
||
}
|
||
if (modifiers) {
|
||
if (modifiers.prop && !isDynamic) {
|
||
name = camelize(name);
|
||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||
}
|
||
if (modifiers.camel && !isDynamic) {
|
||
name = camelize(name);
|
||
}
|
||
if (modifiers.sync) {
|
||
syncGen = genAssignmentCode(value, "$event");
|
||
if (!isDynamic) {
|
||
addHandler(
|
||
el,
|
||
("update:" + (camelize(name))),
|
||
syncGen,
|
||
null,
|
||
false,
|
||
warn$2,
|
||
list[i]
|
||
);
|
||
if (hyphenate(name) !== camelize(name)) {
|
||
addHandler(
|
||
el,
|
||
("update:" + (hyphenate(name))),
|
||
syncGen,
|
||
null,
|
||
false,
|
||
warn$2,
|
||
list[i]
|
||
);
|
||
}
|
||
} else {
|
||
// handler w/ dynamic event name
|
||
addHandler(
|
||
el,
|
||
("\"update:\"+(" + name + ")"),
|
||
syncGen,
|
||
null,
|
||
false,
|
||
warn$2,
|
||
list[i],
|
||
true // dynamic
|
||
);
|
||
}
|
||
}
|
||
}
|
||
if ((modifiers && modifiers.prop) || (
|
||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||
)) {
|
||
addProp(el, name, value, list[i], isDynamic);
|
||
} else {
|
||
addAttr(el, name, value, list[i], isDynamic);
|
||
}
|
||
} else if (onRE.test(name)) { // v-on
|
||
name = name.replace(onRE, '');
|
||
isDynamic = dynamicArgRE.test(name);
|
||
if (isDynamic) {
|
||
name = name.slice(1, -1);
|
||
}
|
||
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
||
} else { // normal directives
|
||
name = name.replace(dirRE, '');
|
||
// parse arg
|
||
var argMatch = name.match(argRE);
|
||
var arg = argMatch && argMatch[1];
|
||
isDynamic = false;
|
||
if (arg) {
|
||
name = name.slice(0, -(arg.length + 1));
|
||
if (dynamicArgRE.test(arg)) {
|
||
arg = arg.slice(1, -1);
|
||
isDynamic = true;
|
||
}
|
||
}
|
||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||
if (name === 'model') {
|
||
checkForAliasModel(el, value);
|
||
}
|
||
}
|
||
} else {
|
||
// literal attribute
|
||
{
|
||
var res = parseText(value, delimiters);
|
||
if (res) {
|
||
warn$2(
|
||
name + "=\"" + value + "\": " +
|
||
'Interpolation inside attributes has been removed. ' +
|
||
'Use v-bind or the colon shorthand instead. For example, ' +
|
||
'instead of <div id="{{ val }}">, use <div :id="val">.',
|
||
list[i]
|
||
);
|
||
}
|
||
}
|
||
addAttr(el, name, JSON.stringify(value), list[i]);
|
||
// #6887 firefox doesn't update muted state if set via attribute
|
||
// even immediately after element creation
|
||
if (!el.component &&
|
||
name === 'muted' &&
|
||
platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
||
addProp(el, name, 'true', list[i]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function checkInFor (el) {
|
||
var parent = el;
|
||
while (parent) {
|
||
if (parent.for !== undefined) {
|
||
return true
|
||
}
|
||
parent = parent.parent;
|
||
}
|
||
return false
|
||
}
|
||
|
||
function parseModifiers (name) {
|
||
var match = name.match(modifierRE);
|
||
if (match) {
|
||
var ret = {};
|
||
match.forEach(function (m) { ret[m.slice(1)] = true; });
|
||
return ret
|
||
}
|
||
}
|
||
|
||
function makeAttrsMap (attrs) {
|
||
var map = {};
|
||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||
if (
|
||
map[attrs[i].name] && !isIE && !isEdge
|
||
) {
|
||
warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
||
}
|
||
map[attrs[i].name] = attrs[i].value;
|
||
}
|
||
return map
|
||
}
|
||
|
||
// for script (e.g. type="x/template") or style, do not decode content
|
||
function isTextTag (el) {
|
||
return el.tag === 'script' || el.tag === 'style'
|
||
}
|
||
|
||
function isForbiddenTag (el) {
|
||
return (
|
||
el.tag === 'style' ||
|
||
(el.tag === 'script' && (
|
||
!el.attrsMap.type ||
|
||
el.attrsMap.type === 'text/javascript'
|
||
))
|
||
)
|
||
}
|
||
|
||
var ieNSBug = /^xmlns:NS\d+/;
|
||
var ieNSPrefix = /^NS\d+:/;
|
||
|
||
/* istanbul ignore next */
|
||
function guardIESVGBug (attrs) {
|
||
var res = [];
|
||
for (var i = 0; i < attrs.length; i++) {
|
||
var attr = attrs[i];
|
||
if (!ieNSBug.test(attr.name)) {
|
||
attr.name = attr.name.replace(ieNSPrefix, '');
|
||
res.push(attr);
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
function checkForAliasModel (el, value) {
|
||
var _el = el;
|
||
while (_el) {
|
||
if (_el.for && _el.alias === value) {
|
||
warn$2(
|
||
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
||
"You are binding v-model directly to a v-for iteration alias. " +
|
||
"This will not be able to modify the v-for source array because " +
|
||
"writing to the alias is like modifying a function local variable. " +
|
||
"Consider using an array of objects and use v-model on an object property instead.",
|
||
el.rawAttrsMap['v-model']
|
||
);
|
||
}
|
||
_el = _el.parent;
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function preTransformNode (el, options) {
|
||
if (el.tag === 'input') {
|
||
var map = el.attrsMap;
|
||
if (!map['v-model']) {
|
||
return
|
||
}
|
||
|
||
var typeBinding;
|
||
if (map[':type'] || map['v-bind:type']) {
|
||
typeBinding = getBindingAttr(el, 'type');
|
||
}
|
||
if (!map.type && !typeBinding && map['v-bind']) {
|
||
typeBinding = "(" + (map['v-bind']) + ").type";
|
||
}
|
||
|
||
if (typeBinding) {
|
||
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
||
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
||
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
||
var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
||
// 1. checkbox
|
||
var branch0 = cloneASTElement(el);
|
||
// process for on the main node
|
||
processFor(branch0);
|
||
addRawAttr(branch0, 'type', 'checkbox');
|
||
processElement(branch0, options);
|
||
branch0.processed = true; // prevent it from double-processed
|
||
branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
||
addIfCondition(branch0, {
|
||
exp: branch0.if,
|
||
block: branch0
|
||
});
|
||
// 2. add radio else-if condition
|
||
var branch1 = cloneASTElement(el);
|
||
getAndRemoveAttr(branch1, 'v-for', true);
|
||
addRawAttr(branch1, 'type', 'radio');
|
||
processElement(branch1, options);
|
||
addIfCondition(branch0, {
|
||
exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
||
block: branch1
|
||
});
|
||
// 3. other
|
||
var branch2 = cloneASTElement(el);
|
||
getAndRemoveAttr(branch2, 'v-for', true);
|
||
addRawAttr(branch2, ':type', typeBinding);
|
||
processElement(branch2, options);
|
||
addIfCondition(branch0, {
|
||
exp: ifCondition,
|
||
block: branch2
|
||
});
|
||
|
||
if (hasElse) {
|
||
branch0.else = true;
|
||
} else if (elseIfCondition) {
|
||
branch0.elseif = elseIfCondition;
|
||
}
|
||
|
||
return branch0
|
||
}
|
||
}
|
||
}
|
||
|
||
function cloneASTElement (el) {
|
||
return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
||
}
|
||
|
||
var model$1 = {
|
||
preTransformNode: preTransformNode
|
||
};
|
||
|
||
var modules$1 = [
|
||
klass$1,
|
||
style$1,
|
||
model$1
|
||
];
|
||
|
||
/* */
|
||
|
||
function text (el, dir) {
|
||
if (dir.value) {
|
||
addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function html (el, dir) {
|
||
if (dir.value) {
|
||
addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
||
}
|
||
}
|
||
|
||
var directives$1 = {
|
||
model: model,
|
||
text: text,
|
||
html: html
|
||
};
|
||
|
||
/* */
|
||
|
||
var baseOptions = {
|
||
expectHTML: true,
|
||
modules: modules$1,
|
||
directives: directives$1,
|
||
isPreTag: isPreTag,
|
||
isUnaryTag: isUnaryTag,
|
||
mustUseProp: mustUseProp,
|
||
canBeLeftOpenTag: canBeLeftOpenTag,
|
||
isReservedTag: isReservedTag,
|
||
getTagNamespace: getTagNamespace,
|
||
staticKeys: genStaticKeys(modules$1)
|
||
};
|
||
|
||
/* */
|
||
|
||
var isStaticKey;
|
||
var isPlatformReservedTag;
|
||
|
||
var genStaticKeysCached = cached(genStaticKeys$1);
|
||
|
||
/**
|
||
* Goal of the optimizer: walk the generated template AST tree
|
||
* and detect sub-trees that are purely static, i.e. parts of
|
||
* the DOM that never needs to change.
|
||
*
|
||
* Once we detect these sub-trees, we can:
|
||
*
|
||
* 1. Hoist them into constants, so that we no longer need to
|
||
* create fresh nodes for them on each re-render;
|
||
* 2. Completely skip them in the patching process.
|
||
*/
|
||
function optimize (root, options) {
|
||
if (!root) { return }
|
||
isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
||
isPlatformReservedTag = options.isReservedTag || no;
|
||
// first pass: mark all non-static nodes.
|
||
markStatic$1(root);
|
||
// second pass: mark static roots.
|
||
markStaticRoots(root, false);
|
||
}
|
||
|
||
function genStaticKeys$1 (keys) {
|
||
return makeMap(
|
||
'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
||
(keys ? ',' + keys : '')
|
||
)
|
||
}
|
||
|
||
function markStatic$1 (node) {
|
||
node.static = isStatic(node);
|
||
if (node.type === 1) {
|
||
// do not make component slot content static. this avoids
|
||
// 1. components not able to mutate slot nodes
|
||
// 2. static slot content fails for hot-reloading
|
||
if (
|
||
!isPlatformReservedTag(node.tag) &&
|
||
node.tag !== 'slot' &&
|
||
node.attrsMap['inline-template'] == null
|
||
) {
|
||
return
|
||
}
|
||
for (var i = 0, l = node.children.length; i < l; i++) {
|
||
var child = node.children[i];
|
||
markStatic$1(child);
|
||
if (!child.static) {
|
||
node.static = false;
|
||
}
|
||
}
|
||
if (node.ifConditions) {
|
||
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
||
var block = node.ifConditions[i$1].block;
|
||
markStatic$1(block);
|
||
if (!block.static) {
|
||
node.static = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function markStaticRoots (node, isInFor) {
|
||
if (node.type === 1) {
|
||
if (node.static || node.once) {
|
||
node.staticInFor = isInFor;
|
||
}
|
||
// For a node to qualify as a static root, it should have children that
|
||
// are not just static text. Otherwise the cost of hoisting out will
|
||
// outweigh the benefits and it's better off to just always render it fresh.
|
||
if (node.static && node.children.length && !(
|
||
node.children.length === 1 &&
|
||
node.children[0].type === 3
|
||
)) {
|
||
node.staticRoot = true;
|
||
return
|
||
} else {
|
||
node.staticRoot = false;
|
||
}
|
||
if (node.children) {
|
||
for (var i = 0, l = node.children.length; i < l; i++) {
|
||
markStaticRoots(node.children[i], isInFor || !!node.for);
|
||
}
|
||
}
|
||
if (node.ifConditions) {
|
||
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
||
markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function isStatic (node) {
|
||
if (node.type === 2) { // expression
|
||
return false
|
||
}
|
||
if (node.type === 3) { // text
|
||
return true
|
||
}
|
||
return !!(node.pre || (
|
||
!node.hasBindings && // no dynamic bindings
|
||
!node.if && !node.for && // not v-if or v-for or v-else
|
||
!isBuiltInTag(node.tag) && // not a built-in
|
||
isPlatformReservedTag(node.tag) && // not a component
|
||
!isDirectChildOfTemplateFor(node) &&
|
||
Object.keys(node).every(isStaticKey)
|
||
))
|
||
}
|
||
|
||
function isDirectChildOfTemplateFor (node) {
|
||
while (node.parent) {
|
||
node = node.parent;
|
||
if (node.tag !== 'template') {
|
||
return false
|
||
}
|
||
if (node.for) {
|
||
return true
|
||
}
|
||
}
|
||
return false
|
||
}
|
||
|
||
/* */
|
||
|
||
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
|
||
var fnInvokeRE = /\([^)]*?\);*$/;
|
||
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
||
|
||
// KeyboardEvent.keyCode aliases
|
||
var keyCodes = {
|
||
esc: 27,
|
||
tab: 9,
|
||
enter: 13,
|
||
space: 32,
|
||
up: 38,
|
||
left: 37,
|
||
right: 39,
|
||
down: 40,
|
||
'delete': [8, 46]
|
||
};
|
||
|
||
// KeyboardEvent.key aliases
|
||
var keyNames = {
|
||
// #7880: IE11 and Edge use `Esc` for Escape key name.
|
||
esc: ['Esc', 'Escape'],
|
||
tab: 'Tab',
|
||
enter: 'Enter',
|
||
// #9112: IE11 uses `Spacebar` for Space key name.
|
||
space: [' ', 'Spacebar'],
|
||
// #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
|
||
up: ['Up', 'ArrowUp'],
|
||
left: ['Left', 'ArrowLeft'],
|
||
right: ['Right', 'ArrowRight'],
|
||
down: ['Down', 'ArrowDown'],
|
||
// #9112: IE11 uses `Del` for Delete key name.
|
||
'delete': ['Backspace', 'Delete', 'Del']
|
||
};
|
||
|
||
// #4868: modifiers that prevent the execution of the listener
|
||
// need to explicitly return null so that we can determine whether to remove
|
||
// the listener for .once
|
||
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
||
|
||
var modifierCode = {
|
||
stop: '$event.stopPropagation();',
|
||
prevent: '$event.preventDefault();',
|
||
self: genGuard("$event.target !== $event.currentTarget"),
|
||
ctrl: genGuard("!$event.ctrlKey"),
|
||
shift: genGuard("!$event.shiftKey"),
|
||
alt: genGuard("!$event.altKey"),
|
||
meta: genGuard("!$event.metaKey"),
|
||
left: genGuard("'button' in $event && $event.button !== 0"),
|
||
middle: genGuard("'button' in $event && $event.button !== 1"),
|
||
right: genGuard("'button' in $event && $event.button !== 2")
|
||
};
|
||
|
||
function genHandlers (
|
||
events,
|
||
isNative
|
||
) {
|
||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||
var staticHandlers = "";
|
||
var dynamicHandlers = "";
|
||
for (var name in events) {
|
||
var handlerCode = genHandler(events[name]);
|
||
if (events[name] && events[name].dynamic) {
|
||
dynamicHandlers += name + "," + handlerCode + ",";
|
||
} else {
|
||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||
}
|
||
}
|
||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||
if (dynamicHandlers) {
|
||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||
} else {
|
||
return prefix + staticHandlers
|
||
}
|
||
}
|
||
|
||
function genHandler (handler) {
|
||
if (!handler) {
|
||
return 'function(){}'
|
||
}
|
||
|
||
if (Array.isArray(handler)) {
|
||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||
}
|
||
|
||
var isMethodPath = simplePathRE.test(handler.value);
|
||
var isFunctionExpression = fnExpRE.test(handler.value);
|
||
var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
||
|
||
if (!handler.modifiers) {
|
||
if (isMethodPath || isFunctionExpression) {
|
||
return handler.value
|
||
}
|
||
return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
|
||
} else {
|
||
var code = '';
|
||
var genModifierCode = '';
|
||
var keys = [];
|
||
for (var key in handler.modifiers) {
|
||
if (modifierCode[key]) {
|
||
genModifierCode += modifierCode[key];
|
||
// left/right
|
||
if (keyCodes[key]) {
|
||
keys.push(key);
|
||
}
|
||
} else if (key === 'exact') {
|
||
var modifiers = (handler.modifiers);
|
||
genModifierCode += genGuard(
|
||
['ctrl', 'shift', 'alt', 'meta']
|
||
.filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
||
.map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
||
.join('||')
|
||
);
|
||
} else {
|
||
keys.push(key);
|
||
}
|
||
}
|
||
if (keys.length) {
|
||
code += genKeyFilter(keys);
|
||
}
|
||
// Make sure modifiers like prevent and stop get executed after key filtering
|
||
if (genModifierCode) {
|
||
code += genModifierCode;
|
||
}
|
||
var handlerCode = isMethodPath
|
||
? ("return " + (handler.value) + "($event)")
|
||
: isFunctionExpression
|
||
? ("return (" + (handler.value) + ")($event)")
|
||
: isFunctionInvocation
|
||
? ("return " + (handler.value))
|
||
: handler.value;
|
||
return ("function($event){" + code + handlerCode + "}")
|
||
}
|
||
}
|
||
|
||
function genKeyFilter (keys) {
|
||
return (
|
||
// make sure the key filters only apply to KeyboardEvents
|
||
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
|
||
// key events that do not have keyCode property...
|
||
"if(!$event.type.indexOf('key')&&" +
|
||
(keys.map(genFilterCode).join('&&')) + ")return null;"
|
||
)
|
||
}
|
||
|
||
function genFilterCode (key) {
|
||
var keyVal = parseInt(key, 10);
|
||
if (keyVal) {
|
||
return ("$event.keyCode!==" + keyVal)
|
||
}
|
||
var keyCode = keyCodes[key];
|
||
var keyName = keyNames[key];
|
||
return (
|
||
"_k($event.keyCode," +
|
||
(JSON.stringify(key)) + "," +
|
||
(JSON.stringify(keyCode)) + "," +
|
||
"$event.key," +
|
||
"" + (JSON.stringify(keyName)) +
|
||
")"
|
||
)
|
||
}
|
||
|
||
/* */
|
||
|
||
function on (el, dir) {
|
||
if (dir.modifiers) {
|
||
warn("v-on without argument does not support modifiers.");
|
||
}
|
||
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
||
}
|
||
|
||
/* */
|
||
|
||
function bind$1 (el, dir) {
|
||
el.wrapData = function (code) {
|
||
return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
||
};
|
||
}
|
||
|
||
/* */
|
||
|
||
var baseDirectives = {
|
||
on: on,
|
||
bind: bind$1,
|
||
cloak: noop
|
||
};
|
||
|
||
/* */
|
||
|
||
|
||
|
||
|
||
|
||
var CodegenState = function CodegenState (options) {
|
||
this.options = options;
|
||
this.warn = options.warn || baseWarn;
|
||
this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
||
this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
||
this.directives = extend(extend({}, baseDirectives), options.directives);
|
||
var isReservedTag = options.isReservedTag || no;
|
||
this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||
this.onceId = 0;
|
||
this.staticRenderFns = [];
|
||
this.pre = false;
|
||
};
|
||
|
||
|
||
|
||
function generate (
|
||
ast,
|
||
options
|
||
) {
|
||
var state = new CodegenState(options);
|
||
var code = ast ? genElement(ast, state) : '_c("div")';
|
||
return {
|
||
render: ("with(this){return " + code + "}"),
|
||
staticRenderFns: state.staticRenderFns
|
||
}
|
||
}
|
||
|
||
function genElement (el, state) {
|
||
if (el.parent) {
|
||
el.pre = el.pre || el.parent.pre;
|
||
}
|
||
|
||
if (el.staticRoot && !el.staticProcessed) {
|
||
return genStatic(el, state)
|
||
} else if (el.once && !el.onceProcessed) {
|
||
return genOnce(el, state)
|
||
} else if (el.for && !el.forProcessed) {
|
||
return genFor(el, state)
|
||
} else if (el.if && !el.ifProcessed) {
|
||
return genIf(el, state)
|
||
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
||
return genChildren(el, state) || 'void 0'
|
||
} else if (el.tag === 'slot') {
|
||
return genSlot(el, state)
|
||
} else {
|
||
// component or element
|
||
var code;
|
||
if (el.component) {
|
||
code = genComponent(el.component, el, state);
|
||
} else {
|
||
var data;
|
||
if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
||
data = genData$2(el, state);
|
||
}
|
||
|
||
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
||
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
||
}
|
||
// module transforms
|
||
for (var i = 0; i < state.transforms.length; i++) {
|
||
code = state.transforms[i](el, code);
|
||
}
|
||
return code
|
||
}
|
||
}
|
||
|
||
// hoist static sub-trees out
|
||
function genStatic (el, state) {
|
||
el.staticProcessed = true;
|
||
// Some elements (templates) need to behave differently inside of a v-pre
|
||
// node. All pre nodes are static roots, so we can use this as a location to
|
||
// wrap a state change and reset it upon exiting the pre node.
|
||
var originalPreState = state.pre;
|
||
if (el.pre) {
|
||
state.pre = el.pre;
|
||
}
|
||
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
||
state.pre = originalPreState;
|
||
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
||
}
|
||
|
||
// v-once
|
||
function genOnce (el, state) {
|
||
el.onceProcessed = true;
|
||
if (el.if && !el.ifProcessed) {
|
||
return genIf(el, state)
|
||
} else if (el.staticInFor) {
|
||
var key = '';
|
||
var parent = el.parent;
|
||
while (parent) {
|
||
if (parent.for) {
|
||
key = parent.key;
|
||
break
|
||
}
|
||
parent = parent.parent;
|
||
}
|
||
if (!key) {
|
||
state.warn(
|
||
"v-once can only be used inside v-for that is keyed. ",
|
||
el.rawAttrsMap['v-once']
|
||
);
|
||
return genElement(el, state)
|
||
}
|
||
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
||
} else {
|
||
return genStatic(el, state)
|
||
}
|
||
}
|
||
|
||
function genIf (
|
||
el,
|
||
state,
|
||
altGen,
|
||
altEmpty
|
||
) {
|
||
el.ifProcessed = true; // avoid recursion
|
||
return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
||
}
|
||
|
||
function genIfConditions (
|
||
conditions,
|
||
state,
|
||
altGen,
|
||
altEmpty
|
||
) {
|
||
if (!conditions.length) {
|
||
return altEmpty || '_e()'
|
||
}
|
||
|
||
var condition = conditions.shift();
|
||
if (condition.exp) {
|
||
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
||
} else {
|
||
return ("" + (genTernaryExp(condition.block)))
|
||
}
|
||
|
||
// v-if with v-once should generate code like (a)?_m(0):_m(1)
|
||
function genTernaryExp (el) {
|
||
return altGen
|
||
? altGen(el, state)
|
||
: el.once
|
||
? genOnce(el, state)
|
||
: genElement(el, state)
|
||
}
|
||
}
|
||
|
||
function genFor (
|
||
el,
|
||
state,
|
||
altGen,
|
||
altHelper
|
||
) {
|
||
var exp = el.for;
|
||
var alias = el.alias;
|
||
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
||
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
||
|
||
if (state.maybeComponent(el) &&
|
||
el.tag !== 'slot' &&
|
||
el.tag !== 'template' &&
|
||
!el.key
|
||
) {
|
||
state.warn(
|
||
"<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
||
"v-for should have explicit keys. " +
|
||
"See https://vuejs.org/guide/list.html#key for more info.",
|
||
el.rawAttrsMap['v-for'],
|
||
true /* tip */
|
||
);
|
||
}
|
||
|
||
el.forProcessed = true; // avoid recursion
|
||
return (altHelper || '_l') + "((" + exp + ")," +
|
||
"function(" + alias + iterator1 + iterator2 + "){" +
|
||
"return " + ((altGen || genElement)(el, state)) +
|
||
'})'
|
||
}
|
||
|
||
function genData$2 (el, state) {
|
||
var data = '{';
|
||
|
||
// directives first.
|
||
// directives may mutate the el's other properties before they are generated.
|
||
var dirs = genDirectives(el, state);
|
||
if (dirs) { data += dirs + ','; }
|
||
|
||
// key
|
||
if (el.key) {
|
||
data += "key:" + (el.key) + ",";
|
||
}
|
||
// ref
|
||
if (el.ref) {
|
||
data += "ref:" + (el.ref) + ",";
|
||
}
|
||
if (el.refInFor) {
|
||
data += "refInFor:true,";
|
||
}
|
||
// pre
|
||
if (el.pre) {
|
||
data += "pre:true,";
|
||
}
|
||
// record original tag name for components using "is" attribute
|
||
if (el.component) {
|
||
data += "tag:\"" + (el.tag) + "\",";
|
||
}
|
||
// module data generation functions
|
||
for (var i = 0; i < state.dataGenFns.length; i++) {
|
||
data += state.dataGenFns[i](el);
|
||
}
|
||
// attributes
|
||
if (el.attrs) {
|
||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||
}
|
||
// DOM props
|
||
if (el.props) {
|
||
data += "domProps:" + (genProps(el.props)) + ",";
|
||
}
|
||
// event handlers
|
||
if (el.events) {
|
||
data += (genHandlers(el.events, false)) + ",";
|
||
}
|
||
if (el.nativeEvents) {
|
||
data += (genHandlers(el.nativeEvents, true)) + ",";
|
||
}
|
||
// slot target
|
||
// only for non-scoped slots
|
||
if (el.slotTarget && !el.slotScope) {
|
||
data += "slot:" + (el.slotTarget) + ",";
|
||
}
|
||
// scoped slots
|
||
if (el.scopedSlots) {
|
||
data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
||
}
|
||
// component v-model
|
||
if (el.model) {
|
||
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
||
}
|
||
// inline-template
|
||
if (el.inlineTemplate) {
|
||
var inlineTemplate = genInlineTemplate(el, state);
|
||
if (inlineTemplate) {
|
||
data += inlineTemplate + ",";
|
||
}
|
||
}
|
||
data = data.replace(/,$/, '') + '}';
|
||
// v-bind dynamic argument wrap
|
||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||
if (el.dynamicAttrs) {
|
||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||
}
|
||
// v-bind data wrap
|
||
if (el.wrapData) {
|
||
data = el.wrapData(data);
|
||
}
|
||
// v-on data wrap
|
||
if (el.wrapListeners) {
|
||
data = el.wrapListeners(data);
|
||
}
|
||
return data
|
||
}
|
||
|
||
function genDirectives (el, state) {
|
||
var dirs = el.directives;
|
||
if (!dirs) { return }
|
||
var res = 'directives:[';
|
||
var hasRuntime = false;
|
||
var i, l, dir, needRuntime;
|
||
for (i = 0, l = dirs.length; i < l; i++) {
|
||
dir = dirs[i];
|
||
needRuntime = true;
|
||
var gen = state.directives[dir.name];
|
||
if (gen) {
|
||
// compile-time directive that manipulates AST.
|
||
// returns true if it also needs a runtime counterpart.
|
||
needRuntime = !!gen(el, dir, state.warn);
|
||
}
|
||
if (needRuntime) {
|
||
hasRuntime = true;
|
||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||
}
|
||
}
|
||
if (hasRuntime) {
|
||
return res.slice(0, -1) + ']'
|
||
}
|
||
}
|
||
|
||
function genInlineTemplate (el, state) {
|
||
var ast = el.children[0];
|
||
if (el.children.length !== 1 || ast.type !== 1) {
|
||
state.warn(
|
||
'Inline-template components must have exactly one child element.',
|
||
{ start: el.start }
|
||
);
|
||
}
|
||
if (ast && ast.type === 1) {
|
||
var inlineRenderFns = generate(ast, state.options);
|
||
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
||
}
|
||
}
|
||
|
||
function genScopedSlots (
|
||
el,
|
||
slots,
|
||
state
|
||
) {
|
||
// by default scoped slots are considered "stable", this allows child
|
||
// components with only scoped slots to skip forced updates from parent.
|
||
// but in some cases we have to bail-out of this optimization
|
||
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
||
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
|
||
var slot = slots[key];
|
||
return (
|
||
slot.slotTargetDynamic ||
|
||
slot.if ||
|
||
slot.for ||
|
||
containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
||
)
|
||
});
|
||
|
||
// #9534: if a component with scoped slots is inside a conditional branch,
|
||
// it's possible for the same component to be reused but with different
|
||
// compiled slot content. To avoid that, we generate a unique key based on
|
||
// the generated code of all the slot contents.
|
||
var needsKey = !!el.if;
|
||
|
||
// OR when it is inside another scoped slot or v-for (the reactivity may be
|
||
// disconnected due to the intermediate scope variable)
|
||
// #9438, #9506
|
||
// TODO: this can be further optimized by properly analyzing in-scope bindings
|
||
// and skip force updating ones that do not actually use scope variables.
|
||
if (!needsForceUpdate) {
|
||
var parent = el.parent;
|
||
while (parent) {
|
||
if (
|
||
(parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
||
parent.for
|
||
) {
|
||
needsForceUpdate = true;
|
||
break
|
||
}
|
||
if (parent.if) {
|
||
needsKey = true;
|
||
}
|
||
parent = parent.parent;
|
||
}
|
||
}
|
||
|
||
var generatedSlots = Object.keys(slots)
|
||
.map(function (key) { return genScopedSlot(slots[key], state); })
|
||
.join(',');
|
||
|
||
return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
|
||
}
|
||
|
||
function hash(str) {
|
||
var hash = 5381;
|
||
var i = str.length;
|
||
while(i) {
|
||
hash = (hash * 33) ^ str.charCodeAt(--i);
|
||
}
|
||
return hash >>> 0
|
||
}
|
||
|
||
function containsSlotChild (el) {
|
||
if (el.type === 1) {
|
||
if (el.tag === 'slot') {
|
||
return true
|
||
}
|
||
return el.children.some(containsSlotChild)
|
||
}
|
||
return false
|
||
}
|
||
|
||
function genScopedSlot (
|
||
el,
|
||
state
|
||
) {
|
||
var isLegacySyntax = el.attrsMap['slot-scope'];
|
||
if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
||
return genIf(el, state, genScopedSlot, "null")
|
||
}
|
||
if (el.for && !el.forProcessed) {
|
||
return genFor(el, state, genScopedSlot)
|
||
}
|
||
var slotScope = el.slotScope === emptySlotScopeToken
|
||
? ""
|
||
: String(el.slotScope);
|
||
var fn = "function(" + slotScope + "){" +
|
||
"return " + (el.tag === 'template'
|
||
? el.if && isLegacySyntax
|
||
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
||
: genChildren(el, state) || 'undefined'
|
||
: genElement(el, state)) + "}";
|
||
// reverse proxy v-slot without scope on this.$slots
|
||
var reverseProxy = slotScope ? "" : ",proxy:true";
|
||
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
||
}
|
||
|
||
function genChildren (
|
||
el,
|
||
state,
|
||
checkSkip,
|
||
altGenElement,
|
||
altGenNode
|
||
) {
|
||
var children = el.children;
|
||
if (children.length) {
|
||
var el$1 = children[0];
|
||
// optimize single v-for
|
||
if (children.length === 1 &&
|
||
el$1.for &&
|
||
el$1.tag !== 'template' &&
|
||
el$1.tag !== 'slot'
|
||
) {
|
||
var normalizationType = checkSkip
|
||
? state.maybeComponent(el$1) ? ",1" : ",0"
|
||
: "";
|
||
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
||
}
|
||
var normalizationType$1 = checkSkip
|
||
? getNormalizationType(children, state.maybeComponent)
|
||
: 0;
|
||
var gen = altGenNode || genNode;
|
||
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
||
}
|
||
}
|
||
|
||
// determine the normalization needed for the children array.
|
||
// 0: no normalization needed
|
||
// 1: simple normalization needed (possible 1-level deep nested array)
|
||
// 2: full normalization needed
|
||
function getNormalizationType (
|
||
children,
|
||
maybeComponent
|
||
) {
|
||
var res = 0;
|
||
for (var i = 0; i < children.length; i++) {
|
||
var el = children[i];
|
||
if (el.type !== 1) {
|
||
continue
|
||
}
|
||
if (needsNormalization(el) ||
|
||
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
||
res = 2;
|
||
break
|
||
}
|
||
if (maybeComponent(el) ||
|
||
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
||
res = 1;
|
||
}
|
||
}
|
||
return res
|
||
}
|
||
|
||
function needsNormalization (el) {
|
||
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
||
}
|
||
|
||
function genNode (node, state) {
|
||
if (node.type === 1) {
|
||
return genElement(node, state)
|
||
} else if (node.type === 3 && node.isComment) {
|
||
return genComment(node)
|
||
} else {
|
||
return genText(node)
|
||
}
|
||
}
|
||
|
||
function genText (text) {
|
||
return ("_v(" + (text.type === 2
|
||
? text.expression // no need for () because already wrapped in _s()
|
||
: transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
||
}
|
||
|
||
function genComment (comment) {
|
||
return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
||
}
|
||
|
||
function genSlot (el, state) {
|
||
var slotName = el.slotName || '"default"';
|
||
var children = genChildren(el, state);
|
||
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
||
var attrs = el.attrs || el.dynamicAttrs
|
||
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
||
// slot props are camelized
|
||
name: camelize(attr.name),
|
||
value: attr.value,
|
||
dynamic: attr.dynamic
|
||
}); }))
|
||
: null;
|
||
var bind$$1 = el.attrsMap['v-bind'];
|
||
if ((attrs || bind$$1) && !children) {
|
||
res += ",null";
|
||
}
|
||
if (attrs) {
|
||
res += "," + attrs;
|
||
}
|
||
if (bind$$1) {
|
||
res += (attrs ? '' : ',null') + "," + bind$$1;
|
||
}
|
||
return res + ')'
|
||
}
|
||
|
||
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
||
function genComponent (
|
||
componentName,
|
||
el,
|
||
state
|
||
) {
|
||
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
||
return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
||
}
|
||
|
||
function genProps (props) {
|
||
var staticProps = "";
|
||
var dynamicProps = "";
|
||
for (var i = 0; i < props.length; i++) {
|
||
var prop = props[i];
|
||
var value = transformSpecialNewlines(prop.value);
|
||
if (prop.dynamic) {
|
||
dynamicProps += (prop.name) + "," + value + ",";
|
||
} else {
|
||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||
}
|
||
}
|
||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||
if (dynamicProps) {
|
||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||
} else {
|
||
return staticProps
|
||
}
|
||
}
|
||
|
||
// #3895, #4268
|
||
function transformSpecialNewlines (text) {
|
||
return text
|
||
.replace(/\u2028/g, '\\u2028')
|
||
.replace(/\u2029/g, '\\u2029')
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
// these keywords should not appear inside expressions, but operators like
|
||
// typeof, instanceof and in are allowed
|
||
var prohibitedKeywordRE = new RegExp('\\b' + (
|
||
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
||
'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
||
'extends,finally,continue,debugger,function,arguments'
|
||
).split(',').join('\\b|\\b') + '\\b');
|
||
|
||
// these unary operators should not be used as property/method names
|
||
var unaryOperatorsRE = new RegExp('\\b' + (
|
||
'delete,typeof,void'
|
||
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
||
|
||
// strip strings in expressions
|
||
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
||
|
||
// detect problematic expressions in a template
|
||
function detectErrors (ast, warn) {
|
||
if (ast) {
|
||
checkNode(ast, warn);
|
||
}
|
||
}
|
||
|
||
function checkNode (node, warn) {
|
||
if (node.type === 1) {
|
||
for (var name in node.attrsMap) {
|
||
if (dirRE.test(name)) {
|
||
var value = node.attrsMap[name];
|
||
if (value) {
|
||
var range = node.rawAttrsMap[name];
|
||
if (name === 'v-for') {
|
||
checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
||
} else if (onRE.test(name)) {
|
||
checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
||
} else {
|
||
checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (node.children) {
|
||
for (var i = 0; i < node.children.length; i++) {
|
||
checkNode(node.children[i], warn);
|
||
}
|
||
}
|
||
} else if (node.type === 2) {
|
||
checkExpression(node.expression, node.text, warn, node);
|
||
}
|
||
}
|
||
|
||
function checkEvent (exp, text, warn, range) {
|
||
var stipped = exp.replace(stripStringRE, '');
|
||
var keywordMatch = stipped.match(unaryOperatorsRE);
|
||
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
||
warn(
|
||
"avoid using JavaScript unary operator as property name: " +
|
||
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
||
range
|
||
);
|
||
}
|
||
checkExpression(exp, text, warn, range);
|
||
}
|
||
|
||
function checkFor (node, text, warn, range) {
|
||
checkExpression(node.for || '', text, warn, range);
|
||
checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
||
checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
||
checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
||
}
|
||
|
||
function checkIdentifier (
|
||
ident,
|
||
type,
|
||
text,
|
||
warn,
|
||
range
|
||
) {
|
||
if (typeof ident === 'string') {
|
||
try {
|
||
new Function(("var " + ident + "=_"));
|
||
} catch (e) {
|
||
warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
||
}
|
||
}
|
||
}
|
||
|
||
function checkExpression (exp, text, warn, range) {
|
||
try {
|
||
new Function(("return " + exp));
|
||
} catch (e) {
|
||
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
||
if (keywordMatch) {
|
||
warn(
|
||
"avoid using JavaScript keyword as property name: " +
|
||
"\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
||
range
|
||
);
|
||
} else {
|
||
warn(
|
||
"invalid expression: " + (e.message) + " in\n\n" +
|
||
" " + exp + "\n\n" +
|
||
" Raw expression: " + (text.trim()) + "\n",
|
||
range
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
var range = 2;
|
||
|
||
function generateCodeFrame (
|
||
source,
|
||
start,
|
||
end
|
||
) {
|
||
if ( start === void 0 ) start = 0;
|
||
if ( end === void 0 ) end = source.length;
|
||
|
||
var lines = source.split(/\r?\n/);
|
||
var count = 0;
|
||
var res = [];
|
||
for (var i = 0; i < lines.length; i++) {
|
||
count += lines[i].length + 1;
|
||
if (count >= start) {
|
||
for (var j = i - range; j <= i + range || end > count; j++) {
|
||
if (j < 0 || j >= lines.length) { continue }
|
||
res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
||
var lineLength = lines[j].length;
|
||
if (j === i) {
|
||
// push underline
|
||
var pad = start - (count - lineLength) + 1;
|
||
var length = end > count ? lineLength - pad : end - start;
|
||
res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
||
} else if (j > i) {
|
||
if (end > count) {
|
||
var length$1 = Math.min(end - count, lineLength);
|
||
res.push(" | " + repeat$1("^", length$1));
|
||
}
|
||
count += lineLength + 1;
|
||
}
|
||
}
|
||
break
|
||
}
|
||
}
|
||
return res.join('\n')
|
||
}
|
||
|
||
function repeat$1 (str, n) {
|
||
var result = '';
|
||
if (n > 0) {
|
||
while (true) { // eslint-disable-line
|
||
if (n & 1) { result += str; }
|
||
n >>>= 1;
|
||
if (n <= 0) { break }
|
||
str += str;
|
||
}
|
||
}
|
||
return result
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
|
||
function createFunction (code, errors) {
|
||
try {
|
||
return new Function(code)
|
||
} catch (err) {
|
||
errors.push({ err: err, code: code });
|
||
return noop
|
||
}
|
||
}
|
||
|
||
function createCompileToFunctionFn (compile) {
|
||
var cache = Object.create(null);
|
||
|
||
return function compileToFunctions (
|
||
template,
|
||
options,
|
||
vm
|
||
) {
|
||
options = extend({}, options);
|
||
var warn$$1 = options.warn || warn;
|
||
delete options.warn;
|
||
|
||
/* istanbul ignore if */
|
||
{
|
||
// detect possible CSP restriction
|
||
try {
|
||
new Function('return 1');
|
||
} catch (e) {
|
||
if (e.toString().match(/unsafe-eval|CSP/)) {
|
||
warn$$1(
|
||
'It seems you are using the standalone build of Vue.js in an ' +
|
||
'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
||
'The template compiler cannot work in this environment. Consider ' +
|
||
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
||
'templates into render functions.'
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
// check cache
|
||
var key = options.delimiters
|
||
? String(options.delimiters) + template
|
||
: template;
|
||
if (cache[key]) {
|
||
return cache[key]
|
||
}
|
||
|
||
// compile
|
||
var compiled = compile(template, options);
|
||
|
||
// check compilation errors/tips
|
||
{
|
||
if (compiled.errors && compiled.errors.length) {
|
||
if (options.outputSourceRange) {
|
||
compiled.errors.forEach(function (e) {
|
||
warn$$1(
|
||
"Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
||
generateCodeFrame(template, e.start, e.end),
|
||
vm
|
||
);
|
||
});
|
||
} else {
|
||
warn$$1(
|
||
"Error compiling template:\n\n" + template + "\n\n" +
|
||
compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
if (compiled.tips && compiled.tips.length) {
|
||
if (options.outputSourceRange) {
|
||
compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
||
} else {
|
||
compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
||
}
|
||
}
|
||
}
|
||
|
||
// turn code into functions
|
||
var res = {};
|
||
var fnGenErrors = [];
|
||
res.render = createFunction(compiled.render, fnGenErrors);
|
||
res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
||
return createFunction(code, fnGenErrors)
|
||
});
|
||
|
||
// check function generation errors.
|
||
// this should only happen if there is a bug in the compiler itself.
|
||
// mostly for codegen development use
|
||
/* istanbul ignore if */
|
||
{
|
||
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
||
warn$$1(
|
||
"Failed to generate render function:\n\n" +
|
||
fnGenErrors.map(function (ref) {
|
||
var err = ref.err;
|
||
var code = ref.code;
|
||
|
||
return ((err.toString()) + " in\n\n" + code + "\n");
|
||
}).join('\n'),
|
||
vm
|
||
);
|
||
}
|
||
}
|
||
|
||
return (cache[key] = res)
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
function createCompilerCreator (baseCompile) {
|
||
return function createCompiler (baseOptions) {
|
||
function compile (
|
||
template,
|
||
options
|
||
) {
|
||
var finalOptions = Object.create(baseOptions);
|
||
var errors = [];
|
||
var tips = [];
|
||
|
||
var warn = function (msg, range, tip) {
|
||
(tip ? tips : errors).push(msg);
|
||
};
|
||
|
||
if (options) {
|
||
if (options.outputSourceRange) {
|
||
// $flow-disable-line
|
||
var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
||
|
||
warn = function (msg, range, tip) {
|
||
var data = { msg: msg };
|
||
if (range) {
|
||
if (range.start != null) {
|
||
data.start = range.start + leadingSpaceLength;
|
||
}
|
||
if (range.end != null) {
|
||
data.end = range.end + leadingSpaceLength;
|
||
}
|
||
}
|
||
(tip ? tips : errors).push(data);
|
||
};
|
||
}
|
||
// merge custom modules
|
||
if (options.modules) {
|
||
finalOptions.modules =
|
||
(baseOptions.modules || []).concat(options.modules);
|
||
}
|
||
// merge custom directives
|
||
if (options.directives) {
|
||
finalOptions.directives = extend(
|
||
Object.create(baseOptions.directives || null),
|
||
options.directives
|
||
);
|
||
}
|
||
// copy other options
|
||
for (var key in options) {
|
||
if (key !== 'modules' && key !== 'directives') {
|
||
finalOptions[key] = options[key];
|
||
}
|
||
}
|
||
}
|
||
|
||
finalOptions.warn = warn;
|
||
|
||
var compiled = baseCompile(template.trim(), finalOptions);
|
||
{
|
||
detectErrors(compiled.ast, warn);
|
||
}
|
||
compiled.errors = errors;
|
||
compiled.tips = tips;
|
||
return compiled
|
||
}
|
||
|
||
return {
|
||
compile: compile,
|
||
compileToFunctions: createCompileToFunctionFn(compile)
|
||
}
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
// `createCompilerCreator` allows creating compilers that use alternative
|
||
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
|
||
// Here we just export a default compiler using the default parts.
|
||
var createCompiler = createCompilerCreator(function baseCompile (
|
||
template,
|
||
options
|
||
) {
|
||
var ast = parse(template.trim(), options);
|
||
if (options.optimize !== false) {
|
||
optimize(ast, options);
|
||
}
|
||
var code = generate(ast, options);
|
||
return {
|
||
ast: ast,
|
||
render: code.render,
|
||
staticRenderFns: code.staticRenderFns
|
||
}
|
||
});
|
||
|
||
/* */
|
||
|
||
var ref$1 = createCompiler(baseOptions);
|
||
var compile = ref$1.compile;
|
||
var compileToFunctions = ref$1.compileToFunctions;
|
||
|
||
/* */
|
||
|
||
// check whether current browser encodes a char inside attribute values
|
||
var div;
|
||
function getShouldDecode (href) {
|
||
div = div || document.createElement('div');
|
||
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
||
return div.innerHTML.indexOf(' ') > 0
|
||
}
|
||
|
||
// #3663: IE encodes newlines inside attribute values while other browsers don't
|
||
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
||
// #6828: chrome encodes content in a[href]
|
||
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
||
|
||
/* */
|
||
|
||
var idToTemplate = cached(function (id) {
|
||
var el = query(id);
|
||
return el && el.innerHTML
|
||
});
|
||
|
||
var mount = Vue.prototype.$mount;
|
||
Vue.prototype.$mount = function (
|
||
el,
|
||
hydrating
|
||
) {
|
||
el = el && query(el);
|
||
|
||
/* istanbul ignore if */
|
||
if (el === document.body || el === document.documentElement) {
|
||
warn(
|
||
"Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
||
);
|
||
return this
|
||
}
|
||
|
||
var options = this.$options;
|
||
// resolve template/el and convert to render function
|
||
if (!options.render) {
|
||
var template = options.template;
|
||
if (template) {
|
||
if (typeof template === 'string') {
|
||
if (template.charAt(0) === '#') {
|
||
template = idToTemplate(template);
|
||
/* istanbul ignore if */
|
||
if (!template) {
|
||
warn(
|
||
("Template element not found or is empty: " + (options.template)),
|
||
this
|
||
);
|
||
}
|
||
}
|
||
} else if (template.nodeType) {
|
||
template = template.innerHTML;
|
||
} else {
|
||
{
|
||
warn('invalid template option:' + template, this);
|
||
}
|
||
return this
|
||
}
|
||
} else if (el) {
|
||
template = getOuterHTML(el);
|
||
}
|
||
if (template) {
|
||
/* istanbul ignore if */
|
||
if (config.performance && mark) {
|
||
mark('compile');
|
||
}
|
||
|
||
var ref = compileToFunctions(template, {
|
||
outputSourceRange: "development" !== 'production',
|
||
shouldDecodeNewlines: shouldDecodeNewlines,
|
||
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
||
delimiters: options.delimiters,
|
||
comments: options.comments
|
||
}, this);
|
||
var render = ref.render;
|
||
var staticRenderFns = ref.staticRenderFns;
|
||
options.render = render;
|
||
options.staticRenderFns = staticRenderFns;
|
||
|
||
/* istanbul ignore if */
|
||
if (config.performance && mark) {
|
||
mark('compile end');
|
||
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
||
}
|
||
}
|
||
}
|
||
return mount.call(this, el, hydrating)
|
||
};
|
||
|
||
/**
|
||
* Get outerHTML of elements, taking care
|
||
* of SVG elements in IE as well.
|
||
*/
|
||
function getOuterHTML (el) {
|
||
if (el.outerHTML) {
|
||
return el.outerHTML
|
||
} else {
|
||
var container = document.createElement('div');
|
||
container.appendChild(el.cloneNode(true));
|
||
return container.innerHTML
|
||
}
|
||
}
|
||
|
||
Vue.compile = compileToFunctions;
|
||
|
||
return Vue;
|
||
|
||
}));
|
||
|
||
/* axios v0.19.0-beta.1 | (c) 2018 by Matt Zabriskie */
|
||
(function webpackUniversalModuleDefinition(root, factory) {
|
||
if(typeof exports === 'object' && typeof module === 'object')
|
||
module.exports = factory();
|
||
else if(typeof define === 'function' && define.amd)
|
||
define([], factory);
|
||
else if(typeof exports === 'object')
|
||
exports["axios"] = factory();
|
||
else
|
||
root["axios"] = factory();
|
||
})(this, function() {
|
||
return /******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId])
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ exports: {},
|
||
/******/ id: moduleId,
|
||
/******/ loaded: false
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.loaded = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(0);
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ([
|
||
/* 0 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__(1);
|
||
|
||
/***/ }),
|
||
/* 1 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
var bind = __webpack_require__(3);
|
||
var Axios = __webpack_require__(5);
|
||
var mergeConfig = __webpack_require__(22);
|
||
var defaults = __webpack_require__(11);
|
||
|
||
/**
|
||
* Create an instance of Axios
|
||
*
|
||
* @param {Object} defaultConfig The default config for the instance
|
||
* @return {Axios} A new instance of Axios
|
||
*/
|
||
function createInstance(defaultConfig) {
|
||
var context = new Axios(defaultConfig);
|
||
var instance = bind(Axios.prototype.request, context);
|
||
|
||
// Copy axios.prototype to instance
|
||
utils.extend(instance, Axios.prototype, context);
|
||
|
||
// Copy context to instance
|
||
utils.extend(instance, context);
|
||
|
||
return instance;
|
||
}
|
||
|
||
// Create the default instance to be exported
|
||
var axios = createInstance(defaults);
|
||
|
||
// Expose Axios class to allow class inheritance
|
||
axios.Axios = Axios;
|
||
|
||
// Factory for creating new instances
|
||
axios.create = function create(instanceConfig) {
|
||
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
||
};
|
||
|
||
// Expose Cancel & CancelToken
|
||
axios.Cancel = __webpack_require__(23);
|
||
axios.CancelToken = __webpack_require__(24);
|
||
axios.isCancel = __webpack_require__(10);
|
||
|
||
// Expose all/spread
|
||
axios.all = function all(promises) {
|
||
return Promise.all(promises);
|
||
};
|
||
axios.spread = __webpack_require__(25);
|
||
|
||
module.exports = axios;
|
||
|
||
// Allow use of default import syntax in TypeScript
|
||
module.exports.default = axios;
|
||
|
||
|
||
/***/ }),
|
||
/* 2 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var bind = __webpack_require__(3);
|
||
var isBuffer = __webpack_require__(4);
|
||
|
||
/*global toString:true*/
|
||
|
||
// utils is a library of generic helper functions non-specific to axios
|
||
|
||
var toString = Object.prototype.toString;
|
||
|
||
/**
|
||
* Determine if a value is an Array
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is an Array, otherwise false
|
||
*/
|
||
function isArray(val) {
|
||
return toString.call(val) === '[object Array]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is an ArrayBuffer
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||
*/
|
||
function isArrayBuffer(val) {
|
||
return toString.call(val) === '[object ArrayBuffer]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a FormData
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is an FormData, otherwise false
|
||
*/
|
||
function isFormData(val) {
|
||
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a view on an ArrayBuffer
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
||
*/
|
||
function isArrayBufferView(val) {
|
||
var result;
|
||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||
result = ArrayBuffer.isView(val);
|
||
} else {
|
||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a String
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a String, otherwise false
|
||
*/
|
||
function isString(val) {
|
||
return typeof val === 'string';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a Number
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a Number, otherwise false
|
||
*/
|
||
function isNumber(val) {
|
||
return typeof val === 'number';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is undefined
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if the value is undefined, otherwise false
|
||
*/
|
||
function isUndefined(val) {
|
||
return typeof val === 'undefined';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is an Object
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is an Object, otherwise false
|
||
*/
|
||
function isObject(val) {
|
||
return val !== null && typeof val === 'object';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a Date
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a Date, otherwise false
|
||
*/
|
||
function isDate(val) {
|
||
return toString.call(val) === '[object Date]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a File
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a File, otherwise false
|
||
*/
|
||
function isFile(val) {
|
||
return toString.call(val) === '[object File]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a Blob
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a Blob, otherwise false
|
||
*/
|
||
function isBlob(val) {
|
||
return toString.call(val) === '[object Blob]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a Function
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a Function, otherwise false
|
||
*/
|
||
function isFunction(val) {
|
||
return toString.call(val) === '[object Function]';
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a Stream
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a Stream, otherwise false
|
||
*/
|
||
function isStream(val) {
|
||
return isObject(val) && isFunction(val.pipe);
|
||
}
|
||
|
||
/**
|
||
* Determine if a value is a URLSearchParams object
|
||
*
|
||
* @param {Object} val The value to test
|
||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||
*/
|
||
function isURLSearchParams(val) {
|
||
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||
}
|
||
|
||
/**
|
||
* Trim excess whitespace off the beginning and end of a string
|
||
*
|
||
* @param {String} str The String to trim
|
||
* @returns {String} The String freed of excess whitespace
|
||
*/
|
||
function trim(str) {
|
||
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
||
}
|
||
|
||
/**
|
||
* Determine if we're running in a standard browser environment
|
||
*
|
||
* This allows axios to run in a web worker, and react-native.
|
||
* Both environments support XMLHttpRequest, but not fully standard globals.
|
||
*
|
||
* web workers:
|
||
* typeof window -> undefined
|
||
* typeof document -> undefined
|
||
*
|
||
* react-native:
|
||
* navigator.product -> 'ReactNative'
|
||
* nativescript
|
||
* navigator.product -> 'NativeScript' or 'NS'
|
||
*/
|
||
function isStandardBrowserEnv() {
|
||
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
||
navigator.product === 'NativeScript' ||
|
||
navigator.product === 'NS')) {
|
||
return false;
|
||
}
|
||
return (
|
||
typeof window !== 'undefined' &&
|
||
typeof document !== 'undefined'
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Iterate over an Array or an Object invoking a function for each item.
|
||
*
|
||
* If `obj` is an Array callback will be called passing
|
||
* the value, index, and complete array for each item.
|
||
*
|
||
* If 'obj' is an Object callback will be called passing
|
||
* the value, key, and complete object for each property.
|
||
*
|
||
* @param {Object|Array} obj The object to iterate
|
||
* @param {Function} fn The callback to invoke for each item
|
||
*/
|
||
function forEach(obj, fn) {
|
||
// Don't bother if no value provided
|
||
if (obj === null || typeof obj === 'undefined') {
|
||
return;
|
||
}
|
||
|
||
// Force an array if not already something iterable
|
||
if (typeof obj !== 'object') {
|
||
/*eslint no-param-reassign:0*/
|
||
obj = [obj];
|
||
}
|
||
|
||
if (isArray(obj)) {
|
||
// Iterate over array values
|
||
for (var i = 0, l = obj.length; i < l; i++) {
|
||
fn.call(null, obj[i], i, obj);
|
||
}
|
||
} else {
|
||
// Iterate over object keys
|
||
for (var key in obj) {
|
||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||
fn.call(null, obj[key], key, obj);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Accepts varargs expecting each argument to be an object, then
|
||
* immutably merges the properties of each object and returns result.
|
||
*
|
||
* When multiple objects contain the same key the later object in
|
||
* the arguments list will take precedence.
|
||
*
|
||
* Example:
|
||
*
|
||
* ```js
|
||
* var result = merge({foo: 123}, {foo: 456});
|
||
* console.log(result.foo); // outputs 456
|
||
* ```
|
||
*
|
||
* @param {Object} obj1 Object to merge
|
||
* @returns {Object} Result of all merge properties
|
||
*/
|
||
function merge(/* obj1, obj2, obj3, ... */) {
|
||
var result = {};
|
||
function assignValue(val, key) {
|
||
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||
result[key] = merge(result[key], val);
|
||
} else {
|
||
result[key] = val;
|
||
}
|
||
}
|
||
|
||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||
forEach(arguments[i], assignValue);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/**
|
||
* Function equal to merge with the difference being that no reference
|
||
* to original objects is kept.
|
||
*
|
||
* @see merge
|
||
* @param {Object} obj1 Object to merge
|
||
* @returns {Object} Result of all merge properties
|
||
*/
|
||
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
||
var result = {};
|
||
function assignValue(val, key) {
|
||
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||
result[key] = deepMerge(result[key], val);
|
||
} else if (typeof val === 'object') {
|
||
result[key] = deepMerge({}, val);
|
||
} else {
|
||
result[key] = val;
|
||
}
|
||
}
|
||
|
||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||
forEach(arguments[i], assignValue);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/**
|
||
* Extends object a by mutably adding to it the properties of object b.
|
||
*
|
||
* @param {Object} a The object to be extended
|
||
* @param {Object} b The object to copy properties from
|
||
* @param {Object} thisArg The object to bind function to
|
||
* @return {Object} The resulting value of object a
|
||
*/
|
||
function extend(a, b, thisArg) {
|
||
forEach(b, function assignValue(val, key) {
|
||
if (thisArg && typeof val === 'function') {
|
||
a[key] = bind(val, thisArg);
|
||
} else {
|
||
a[key] = val;
|
||
}
|
||
});
|
||
return a;
|
||
}
|
||
|
||
module.exports = {
|
||
isArray: isArray,
|
||
isArrayBuffer: isArrayBuffer,
|
||
isBuffer: isBuffer,
|
||
isFormData: isFormData,
|
||
isArrayBufferView: isArrayBufferView,
|
||
isString: isString,
|
||
isNumber: isNumber,
|
||
isObject: isObject,
|
||
isUndefined: isUndefined,
|
||
isDate: isDate,
|
||
isFile: isFile,
|
||
isBlob: isBlob,
|
||
isFunction: isFunction,
|
||
isStream: isStream,
|
||
isURLSearchParams: isURLSearchParams,
|
||
isStandardBrowserEnv: isStandardBrowserEnv,
|
||
forEach: forEach,
|
||
merge: merge,
|
||
deepMerge: deepMerge,
|
||
extend: extend,
|
||
trim: trim
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
module.exports = function bind(fn, thisArg) {
|
||
return function wrap() {
|
||
var args = new Array(arguments.length);
|
||
for (var i = 0; i < args.length; i++) {
|
||
args[i] = arguments[i];
|
||
}
|
||
return fn.apply(thisArg, args);
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 4 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*!
|
||
* Determine if an object is a Buffer
|
||
*
|
||
* @author Feross Aboukhadijeh <https://feross.org>
|
||
* @license MIT
|
||
*/
|
||
|
||
module.exports = function isBuffer (obj) {
|
||
return obj != null && obj.constructor != null &&
|
||
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
/* 5 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
var buildURL = __webpack_require__(6);
|
||
var InterceptorManager = __webpack_require__(7);
|
||
var dispatchRequest = __webpack_require__(8);
|
||
var mergeConfig = __webpack_require__(22);
|
||
|
||
/**
|
||
* Create a new instance of Axios
|
||
*
|
||
* @param {Object} instanceConfig The default config for the instance
|
||
*/
|
||
function Axios(instanceConfig) {
|
||
this.defaults = instanceConfig;
|
||
this.interceptors = {
|
||
request: new InterceptorManager(),
|
||
response: new InterceptorManager()
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Dispatch a request
|
||
*
|
||
* @param {Object} config The config specific for this request (merged with this.defaults)
|
||
*/
|
||
Axios.prototype.request = function request(config) {
|
||
/*eslint no-param-reassign:0*/
|
||
// Allow for axios('example/url'[, config]) a la fetch API
|
||
if (typeof config === 'string') {
|
||
config = arguments[1] || {};
|
||
config.url = arguments[0];
|
||
} else {
|
||
config = config || {};
|
||
}
|
||
|
||
config = mergeConfig(this.defaults, config);
|
||
config.method = config.method ? config.method.toLowerCase() : 'get';
|
||
|
||
// Hook up interceptors middleware
|
||
var chain = [dispatchRequest, undefined];
|
||
var promise = Promise.resolve(config);
|
||
|
||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||
});
|
||
|
||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||
chain.push(interceptor.fulfilled, interceptor.rejected);
|
||
});
|
||
|
||
while (chain.length) {
|
||
promise = promise.then(chain.shift(), chain.shift());
|
||
}
|
||
|
||
return promise;
|
||
};
|
||
|
||
Axios.prototype.getUri = function getUri(config) {
|
||
config = mergeConfig(this.defaults, config);
|
||
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
||
};
|
||
|
||
// Provide aliases for supported request methods
|
||
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||
/*eslint func-names:0*/
|
||
Axios.prototype[method] = function(url, config) {
|
||
return this.request(utils.merge(config || {}, {
|
||
method: method,
|
||
url: url
|
||
}));
|
||
};
|
||
});
|
||
|
||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||
/*eslint func-names:0*/
|
||
Axios.prototype[method] = function(url, data, config) {
|
||
return this.request(utils.merge(config || {}, {
|
||
method: method,
|
||
url: url,
|
||
data: data
|
||
}));
|
||
};
|
||
});
|
||
|
||
module.exports = Axios;
|
||
|
||
|
||
/***/ }),
|
||
/* 6 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
function encode(val) {
|
||
return encodeURIComponent(val).
|
||
replace(/%40/gi, '@').
|
||
replace(/%3A/gi, ':').
|
||
replace(/%24/g, '$').
|
||
replace(/%2C/gi, ',').
|
||
replace(/%20/g, '+').
|
||
replace(/%5B/gi, '[').
|
||
replace(/%5D/gi, ']');
|
||
}
|
||
|
||
/**
|
||
* Build a URL by appending params to the end
|
||
*
|
||
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||
* @param {object} [params] The params to be appended
|
||
* @returns {string} The formatted url
|
||
*/
|
||
module.exports = function buildURL(url, params, paramsSerializer) {
|
||
/*eslint no-param-reassign:0*/
|
||
if (!params) {
|
||
return url;
|
||
}
|
||
|
||
var serializedParams;
|
||
if (paramsSerializer) {
|
||
serializedParams = paramsSerializer(params);
|
||
} else if (utils.isURLSearchParams(params)) {
|
||
serializedParams = params.toString();
|
||
} else {
|
||
var parts = [];
|
||
|
||
utils.forEach(params, function serialize(val, key) {
|
||
if (val === null || typeof val === 'undefined') {
|
||
return;
|
||
}
|
||
|
||
if (utils.isArray(val)) {
|
||
key = key + '[]';
|
||
} else {
|
||
val = [val];
|
||
}
|
||
|
||
utils.forEach(val, function parseValue(v) {
|
||
if (utils.isDate(v)) {
|
||
v = v.toISOString();
|
||
} else if (utils.isObject(v)) {
|
||
v = JSON.stringify(v);
|
||
}
|
||
parts.push(encode(key) + '=' + encode(v));
|
||
});
|
||
});
|
||
|
||
serializedParams = parts.join('&');
|
||
}
|
||
|
||
if (serializedParams) {
|
||
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||
}
|
||
|
||
return url;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
function InterceptorManager() {
|
||
this.handlers = [];
|
||
}
|
||
|
||
/**
|
||
* Add a new interceptor to the stack
|
||
*
|
||
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||
*
|
||
* @return {Number} An ID used to remove interceptor later
|
||
*/
|
||
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||
this.handlers.push({
|
||
fulfilled: fulfilled,
|
||
rejected: rejected
|
||
});
|
||
return this.handlers.length - 1;
|
||
};
|
||
|
||
/**
|
||
* Remove an interceptor from the stack
|
||
*
|
||
* @param {Number} id The ID that was returned by `use`
|
||
*/
|
||
InterceptorManager.prototype.eject = function eject(id) {
|
||
if (this.handlers[id]) {
|
||
this.handlers[id] = null;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Iterate over all the registered interceptors
|
||
*
|
||
* This method is particularly useful for skipping over any
|
||
* interceptors that may have become `null` calling `eject`.
|
||
*
|
||
* @param {Function} fn The function to call for each interceptor
|
||
*/
|
||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||
utils.forEach(this.handlers, function forEachHandler(h) {
|
||
if (h !== null) {
|
||
fn(h);
|
||
}
|
||
});
|
||
};
|
||
|
||
module.exports = InterceptorManager;
|
||
|
||
|
||
/***/ }),
|
||
/* 8 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
var transformData = __webpack_require__(9);
|
||
var isCancel = __webpack_require__(10);
|
||
var defaults = __webpack_require__(11);
|
||
var isAbsoluteURL = __webpack_require__(20);
|
||
var combineURLs = __webpack_require__(21);
|
||
|
||
/**
|
||
* Throws a `Cancel` if cancellation has been requested.
|
||
*/
|
||
function throwIfCancellationRequested(config) {
|
||
if (config.cancelToken) {
|
||
config.cancelToken.throwIfRequested();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Dispatch a request to the server using the configured adapter.
|
||
*
|
||
* @param {object} config The config that is to be used for the request
|
||
* @returns {Promise} The Promise to be fulfilled
|
||
*/
|
||
module.exports = function dispatchRequest(config) {
|
||
throwIfCancellationRequested(config);
|
||
|
||
// Support baseURL config
|
||
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
||
config.url = combineURLs(config.baseURL, config.url);
|
||
}
|
||
|
||
// Ensure headers exist
|
||
config.headers = config.headers || {};
|
||
|
||
// Transform request data
|
||
config.data = transformData(
|
||
config.data,
|
||
config.headers,
|
||
config.transformRequest
|
||
);
|
||
|
||
// Flatten headers
|
||
config.headers = utils.merge(
|
||
config.headers.common || {},
|
||
config.headers[config.method] || {},
|
||
config.headers || {}
|
||
);
|
||
|
||
utils.forEach(
|
||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||
function cleanHeaderConfig(method) {
|
||
delete config.headers[method];
|
||
}
|
||
);
|
||
|
||
var adapter = config.adapter || defaults.adapter;
|
||
|
||
return adapter(config).then(function onAdapterResolution(response) {
|
||
throwIfCancellationRequested(config);
|
||
|
||
// Transform response data
|
||
response.data = transformData(
|
||
response.data,
|
||
response.headers,
|
||
config.transformResponse
|
||
);
|
||
|
||
return response;
|
||
}, function onAdapterRejection(reason) {
|
||
if (!isCancel(reason)) {
|
||
throwIfCancellationRequested(config);
|
||
|
||
// Transform response data
|
||
if (reason && reason.response) {
|
||
reason.response.data = transformData(
|
||
reason.response.data,
|
||
reason.response.headers,
|
||
config.transformResponse
|
||
);
|
||
}
|
||
}
|
||
|
||
return Promise.reject(reason);
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 9 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
/**
|
||
* Transform the data for a request or a response
|
||
*
|
||
* @param {Object|String} data The data to be transformed
|
||
* @param {Array} headers The headers for the request or response
|
||
* @param {Array|Function} fns A single function or Array of functions
|
||
* @returns {*} The resulting transformed data
|
||
*/
|
||
module.exports = function transformData(data, headers, fns) {
|
||
/*eslint no-param-reassign:0*/
|
||
utils.forEach(fns, function transform(fn) {
|
||
data = fn(data, headers);
|
||
});
|
||
|
||
return data;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 10 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
module.exports = function isCancel(value) {
|
||
return !!(value && value.__CANCEL__);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 11 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
var normalizeHeaderName = __webpack_require__(12);
|
||
|
||
var DEFAULT_CONTENT_TYPE = {
|
||
'Content-Type': 'application/x-www-form-urlencoded'
|
||
};
|
||
|
||
function setContentTypeIfUnset(headers, value) {
|
||
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||
headers['Content-Type'] = value;
|
||
}
|
||
}
|
||
|
||
function getDefaultAdapter() {
|
||
var adapter;
|
||
// Only Node.JS has a process variable that is of [[Class]] process
|
||
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
||
// For node use HTTP adapter
|
||
adapter = __webpack_require__(13);
|
||
} else if (typeof XMLHttpRequest !== 'undefined') {
|
||
// For browsers use XHR adapter
|
||
adapter = __webpack_require__(13);
|
||
}
|
||
return adapter;
|
||
}
|
||
|
||
var defaults = {
|
||
adapter: getDefaultAdapter(),
|
||
|
||
transformRequest: [function transformRequest(data, headers) {
|
||
normalizeHeaderName(headers, 'Accept');
|
||
normalizeHeaderName(headers, 'Content-Type');
|
||
if (utils.isFormData(data) ||
|
||
utils.isArrayBuffer(data) ||
|
||
utils.isBuffer(data) ||
|
||
utils.isStream(data) ||
|
||
utils.isFile(data) ||
|
||
utils.isBlob(data)
|
||
) {
|
||
return data;
|
||
}
|
||
if (utils.isArrayBufferView(data)) {
|
||
return data.buffer;
|
||
}
|
||
if (utils.isURLSearchParams(data)) {
|
||
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
||
return data.toString();
|
||
}
|
||
if (utils.isObject(data)) {
|
||
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
||
return JSON.stringify(data);
|
||
}
|
||
return data;
|
||
}],
|
||
|
||
transformResponse: [function transformResponse(data) {
|
||
/*eslint no-param-reassign:0*/
|
||
if (typeof data === 'string') {
|
||
try {
|
||
data = JSON.parse(data);
|
||
} catch (e) { /* Ignore */ }
|
||
}
|
||
return data;
|
||
}],
|
||
|
||
/**
|
||
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
||
* timeout is not created.
|
||
*/
|
||
timeout: 0,
|
||
|
||
xsrfCookieName: 'XSRF-TOKEN',
|
||
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||
|
||
maxContentLength: -1,
|
||
|
||
validateStatus: function validateStatus(status) {
|
||
return status >= 200 && status < 300;
|
||
}
|
||
};
|
||
|
||
defaults.headers = {
|
||
common: {
|
||
'Accept': 'application/json, text/plain, */*'
|
||
}
|
||
};
|
||
|
||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||
defaults.headers[method] = {};
|
||
});
|
||
|
||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||
});
|
||
|
||
module.exports = defaults;
|
||
|
||
|
||
/***/ }),
|
||
/* 12 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
||
utils.forEach(headers, function processHeader(value, name) {
|
||
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
||
headers[normalizedName] = value;
|
||
delete headers[name];
|
||
}
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 13 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
var settle = __webpack_require__(14);
|
||
var buildURL = __webpack_require__(6);
|
||
var parseHeaders = __webpack_require__(17);
|
||
var isURLSameOrigin = __webpack_require__(18);
|
||
var createError = __webpack_require__(15);
|
||
|
||
module.exports = function xhrAdapter(config) {
|
||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||
var requestData = config.data;
|
||
var requestHeaders = config.headers;
|
||
|
||
if (utils.isFormData(requestData)) {
|
||
delete requestHeaders['Content-Type']; // Let the browser set it
|
||
}
|
||
|
||
var request = new XMLHttpRequest();
|
||
|
||
// HTTP basic authentication
|
||
if (config.auth) {
|
||
var username = config.auth.username || '';
|
||
var password = config.auth.password || '';
|
||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||
}
|
||
|
||
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
|
||
|
||
// Set the request timeout in MS
|
||
request.timeout = config.timeout;
|
||
|
||
// Listen for ready state
|
||
request.onreadystatechange = function handleLoad() {
|
||
if (!request || request.readyState !== 4) {
|
||
return;
|
||
}
|
||
|
||
// The request errored out and we didn't get a response, this will be
|
||
// handled by onerror instead
|
||
// With one exception: request that using file: protocol, most browsers
|
||
// will return status as 0 even though it's a successful request
|
||
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
||
return;
|
||
}
|
||
|
||
// Prepare the response
|
||
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
||
var response = {
|
||
data: responseData,
|
||
status: request.status,
|
||
statusText: request.statusText,
|
||
headers: responseHeaders,
|
||
config: config,
|
||
request: request
|
||
};
|
||
|
||
settle(resolve, reject, response);
|
||
|
||
// Clean up request
|
||
request = null;
|
||
};
|
||
|
||
// Handle browser request cancellation (as opposed to a manual cancellation)
|
||
request.onabort = function handleAbort() {
|
||
if (!request) {
|
||
return;
|
||
}
|
||
|
||
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
||
|
||
// Clean up request
|
||
request = null;
|
||
};
|
||
|
||
// Handle low level network errors
|
||
request.onerror = function handleError() {
|
||
// Real errors are hidden from us by the browser
|
||
// onerror should only fire if it's a network error
|
||
reject(createError('Network Error', config, null, request));
|
||
|
||
// Clean up request
|
||
request = null;
|
||
};
|
||
|
||
// Handle timeout
|
||
request.ontimeout = function handleTimeout() {
|
||
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
|
||
request));
|
||
|
||
// Clean up request
|
||
request = null;
|
||
};
|
||
|
||
// Add xsrf header
|
||
// This is only done if running in a standard browser environment.
|
||
// Specifically not if we're in a web worker, or react-native.
|
||
if (utils.isStandardBrowserEnv()) {
|
||
var cookies = __webpack_require__(19);
|
||
|
||
// Add xsrf header
|
||
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
|
||
cookies.read(config.xsrfCookieName) :
|
||
undefined;
|
||
|
||
if (xsrfValue) {
|
||
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
||
}
|
||
}
|
||
|
||
// Add headers to the request
|
||
if ('setRequestHeader' in request) {
|
||
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
||
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
||
// Remove Content-Type if data is undefined
|
||
delete requestHeaders[key];
|
||
} else {
|
||
// Otherwise add header to the request
|
||
request.setRequestHeader(key, val);
|
||
}
|
||
});
|
||
}
|
||
|
||
// Add withCredentials to request if needed
|
||
if (config.withCredentials) {
|
||
request.withCredentials = true;
|
||
}
|
||
|
||
// Add responseType to request if needed
|
||
if (config.responseType) {
|
||
try {
|
||
request.responseType = config.responseType;
|
||
} catch (e) {
|
||
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
||
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
||
if (config.responseType !== 'json') {
|
||
throw e;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Handle progress if needed
|
||
if (typeof config.onDownloadProgress === 'function') {
|
||
request.addEventListener('progress', config.onDownloadProgress);
|
||
}
|
||
|
||
// Not all browsers support upload events
|
||
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||
request.upload.addEventListener('progress', config.onUploadProgress);
|
||
}
|
||
|
||
if (config.cancelToken) {
|
||
// Handle cancellation
|
||
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||
if (!request) {
|
||
return;
|
||
}
|
||
|
||
request.abort();
|
||
reject(cancel);
|
||
// Clean up request
|
||
request = null;
|
||
});
|
||
}
|
||
|
||
if (requestData === undefined) {
|
||
requestData = null;
|
||
}
|
||
|
||
// Send the request
|
||
request.send(requestData);
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 14 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var createError = __webpack_require__(15);
|
||
|
||
/**
|
||
* Resolve or reject a Promise based on response status.
|
||
*
|
||
* @param {Function} resolve A function that resolves the promise.
|
||
* @param {Function} reject A function that rejects the promise.
|
||
* @param {object} response The response.
|
||
*/
|
||
module.exports = function settle(resolve, reject, response) {
|
||
var validateStatus = response.config.validateStatus;
|
||
if (!validateStatus || validateStatus(response.status)) {
|
||
resolve(response);
|
||
} else {
|
||
reject(createError(
|
||
'Request failed with status code ' + response.status,
|
||
response.config,
|
||
null,
|
||
response.request,
|
||
response
|
||
));
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 15 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var enhanceError = __webpack_require__(16);
|
||
|
||
/**
|
||
* Create an Error with the specified message, config, error code, request and response.
|
||
*
|
||
* @param {string} message The error message.
|
||
* @param {Object} config The config.
|
||
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||
* @param {Object} [request] The request.
|
||
* @param {Object} [response] The response.
|
||
* @returns {Error} The created error.
|
||
*/
|
||
module.exports = function createError(message, config, code, request, response) {
|
||
var error = new Error(message);
|
||
return enhanceError(error, config, code, request, response);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 16 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
/**
|
||
* Update an Error with the specified config, error code, and response.
|
||
*
|
||
* @param {Error} error The error to update.
|
||
* @param {Object} config The config.
|
||
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||
* @param {Object} [request] The request.
|
||
* @param {Object} [response] The response.
|
||
* @returns {Error} The error.
|
||
*/
|
||
module.exports = function enhanceError(error, config, code, request, response) {
|
||
error.config = config;
|
||
if (code) {
|
||
error.code = code;
|
||
}
|
||
error.request = request;
|
||
error.response = response;
|
||
error.toJSON = function() {
|
||
return {
|
||
// Standard
|
||
message: this.message,
|
||
name: this.name,
|
||
// Microsoft
|
||
description: this.description,
|
||
number: this.number,
|
||
// Mozilla
|
||
fileName: this.fileName,
|
||
lineNumber: this.lineNumber,
|
||
columnNumber: this.columnNumber,
|
||
stack: this.stack,
|
||
// Axios
|
||
config: this.config,
|
||
code: this.code
|
||
};
|
||
};
|
||
return error;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 17 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
// Headers whose duplicates are ignored by node
|
||
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
||
var ignoreDuplicateOf = [
|
||
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
||
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
||
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
||
'referer', 'retry-after', 'user-agent'
|
||
];
|
||
|
||
/**
|
||
* Parse headers into an object
|
||
*
|
||
* ```
|
||
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
||
* Content-Type: application/json
|
||
* Connection: keep-alive
|
||
* Transfer-Encoding: chunked
|
||
* ```
|
||
*
|
||
* @param {String} headers Headers needing to be parsed
|
||
* @returns {Object} Headers parsed into an object
|
||
*/
|
||
module.exports = function parseHeaders(headers) {
|
||
var parsed = {};
|
||
var key;
|
||
var val;
|
||
var i;
|
||
|
||
if (!headers) { return parsed; }
|
||
|
||
utils.forEach(headers.split('\n'), function parser(line) {
|
||
i = line.indexOf(':');
|
||
key = utils.trim(line.substr(0, i)).toLowerCase();
|
||
val = utils.trim(line.substr(i + 1));
|
||
|
||
if (key) {
|
||
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
||
return;
|
||
}
|
||
if (key === 'set-cookie') {
|
||
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
||
} else {
|
||
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
||
}
|
||
}
|
||
});
|
||
|
||
return parsed;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 18 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
module.exports = (
|
||
utils.isStandardBrowserEnv() ?
|
||
|
||
// Standard browser envs have full support of the APIs needed to test
|
||
// whether the request URL is of the same origin as current location.
|
||
(function standardBrowserEnv() {
|
||
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
||
var urlParsingNode = document.createElement('a');
|
||
var originURL;
|
||
|
||
/**
|
||
* Parse a URL to discover it's components
|
||
*
|
||
* @param {String} url The URL to be parsed
|
||
* @returns {Object}
|
||
*/
|
||
function resolveURL(url) {
|
||
var href = url;
|
||
|
||
if (msie) {
|
||
// IE needs attribute set twice to normalize properties
|
||
urlParsingNode.setAttribute('href', href);
|
||
href = urlParsingNode.href;
|
||
}
|
||
|
||
urlParsingNode.setAttribute('href', href);
|
||
|
||
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
||
return {
|
||
href: urlParsingNode.href,
|
||
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
||
host: urlParsingNode.host,
|
||
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
||
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
||
hostname: urlParsingNode.hostname,
|
||
port: urlParsingNode.port,
|
||
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
||
urlParsingNode.pathname :
|
||
'/' + urlParsingNode.pathname
|
||
};
|
||
}
|
||
|
||
originURL = resolveURL(window.location.href);
|
||
|
||
/**
|
||
* Determine if a URL shares the same origin as the current location
|
||
*
|
||
* @param {String} requestURL The URL to test
|
||
* @returns {boolean} True if URL shares the same origin, otherwise false
|
||
*/
|
||
return function isURLSameOrigin(requestURL) {
|
||
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
||
return (parsed.protocol === originURL.protocol &&
|
||
parsed.host === originURL.host);
|
||
};
|
||
})() :
|
||
|
||
// Non standard browser envs (web workers, react-native) lack needed support.
|
||
(function nonStandardBrowserEnv() {
|
||
return function isURLSameOrigin() {
|
||
return true;
|
||
};
|
||
})()
|
||
);
|
||
|
||
|
||
/***/ }),
|
||
/* 19 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
module.exports = (
|
||
utils.isStandardBrowserEnv() ?
|
||
|
||
// Standard browser envs support document.cookie
|
||
(function standardBrowserEnv() {
|
||
return {
|
||
write: function write(name, value, expires, path, domain, secure) {
|
||
var cookie = [];
|
||
cookie.push(name + '=' + encodeURIComponent(value));
|
||
|
||
if (utils.isNumber(expires)) {
|
||
cookie.push('expires=' + new Date(expires).toGMTString());
|
||
}
|
||
|
||
if (utils.isString(path)) {
|
||
cookie.push('path=' + path);
|
||
}
|
||
|
||
if (utils.isString(domain)) {
|
||
cookie.push('domain=' + domain);
|
||
}
|
||
|
||
if (secure === true) {
|
||
cookie.push('secure');
|
||
}
|
||
|
||
document.cookie = cookie.join('; ');
|
||
},
|
||
|
||
read: function read(name) {
|
||
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||
return (match ? decodeURIComponent(match[3]) : null);
|
||
},
|
||
|
||
remove: function remove(name) {
|
||
this.write(name, '', Date.now() - 86400000);
|
||
}
|
||
};
|
||
})() :
|
||
|
||
// Non standard browser env (web workers, react-native) lack needed support.
|
||
(function nonStandardBrowserEnv() {
|
||
return {
|
||
write: function write() {},
|
||
read: function read() { return null; },
|
||
remove: function remove() {}
|
||
};
|
||
})()
|
||
);
|
||
|
||
|
||
/***/ }),
|
||
/* 20 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
/**
|
||
* Determines whether the specified URL is absolute
|
||
*
|
||
* @param {string} url The URL to test
|
||
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
||
*/
|
||
module.exports = function isAbsoluteURL(url) {
|
||
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||
// by any combination of letters, digits, plus, period, or hyphen.
|
||
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 21 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
/**
|
||
* Creates a new URL by combining the specified URLs
|
||
*
|
||
* @param {string} baseURL The base URL
|
||
* @param {string} relativeURL The relative URL
|
||
* @returns {string} The combined URL
|
||
*/
|
||
module.exports = function combineURLs(baseURL, relativeURL) {
|
||
return relativeURL
|
||
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||
: baseURL;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 22 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var utils = __webpack_require__(2);
|
||
|
||
/**
|
||
* Config-specific merge-function which creates a new config-object
|
||
* by merging two configuration objects together.
|
||
*
|
||
* @param {Object} config1
|
||
* @param {Object} config2
|
||
* @returns {Object} New object resulting from merging config2 to config1
|
||
*/
|
||
module.exports = function mergeConfig(config1, config2) {
|
||
// eslint-disable-next-line no-param-reassign
|
||
config2 = config2 || {};
|
||
var config = {};
|
||
|
||
utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
|
||
if (typeof config2[prop] !== 'undefined') {
|
||
config[prop] = config2[prop];
|
||
}
|
||
});
|
||
|
||
utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
|
||
if (utils.isObject(config2[prop])) {
|
||
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
|
||
} else if (typeof config2[prop] !== 'undefined') {
|
||
config[prop] = config2[prop];
|
||
} else if (utils.isObject(config1[prop])) {
|
||
config[prop] = utils.deepMerge(config1[prop]);
|
||
} else if (typeof config1[prop] !== 'undefined') {
|
||
config[prop] = config1[prop];
|
||
}
|
||
});
|
||
|
||
utils.forEach([
|
||
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
||
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
||
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
|
||
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
|
||
'socketPath'
|
||
], function defaultToConfig2(prop) {
|
||
if (typeof config2[prop] !== 'undefined') {
|
||
config[prop] = config2[prop];
|
||
} else if (typeof config1[prop] !== 'undefined') {
|
||
config[prop] = config1[prop];
|
||
}
|
||
});
|
||
|
||
return config;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 23 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
/**
|
||
* A `Cancel` is an object that is thrown when an operation is canceled.
|
||
*
|
||
* @class
|
||
* @param {string=} message The message.
|
||
*/
|
||
function Cancel(message) {
|
||
this.message = message;
|
||
}
|
||
|
||
Cancel.prototype.toString = function toString() {
|
||
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
||
};
|
||
|
||
Cancel.prototype.__CANCEL__ = true;
|
||
|
||
module.exports = Cancel;
|
||
|
||
|
||
/***/ }),
|
||
/* 24 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
'use strict';
|
||
|
||
var Cancel = __webpack_require__(23);
|
||
|
||
/**
|
||
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||
*
|
||
* @class
|
||
* @param {Function} executor The executor function.
|
||
*/
|
||
function CancelToken(executor) {
|
||
if (typeof executor !== 'function') {
|
||
throw new TypeError('executor must be a function.');
|
||
}
|
||
|
||
var resolvePromise;
|
||
this.promise = new Promise(function promiseExecutor(resolve) {
|
||
resolvePromise = resolve;
|
||
});
|
||
|
||
var token = this;
|
||
executor(function cancel(message) {
|
||
if (token.reason) {
|
||
// Cancellation has already been requested
|
||
return;
|
||
}
|
||
|
||
token.reason = new Cancel(message);
|
||
resolvePromise(token.reason);
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Throws a `Cancel` if cancellation has been requested.
|
||
*/
|
||
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||
if (this.reason) {
|
||
throw this.reason;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||
* cancels the `CancelToken`.
|
||
*/
|
||
CancelToken.source = function source() {
|
||
var cancel;
|
||
var token = new CancelToken(function executor(c) {
|
||
cancel = c;
|
||
});
|
||
return {
|
||
token: token,
|
||
cancel: cancel
|
||
};
|
||
};
|
||
|
||
module.exports = CancelToken;
|
||
|
||
|
||
/***/ }),
|
||
/* 25 */
|
||
/***/ (function(module, exports) {
|
||
|
||
'use strict';
|
||
|
||
/**
|
||
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||
*
|
||
* Common use case would be to use `Function.prototype.apply`.
|
||
*
|
||
* ```js
|
||
* function f(x, y, z) {}
|
||
* var args = [1, 2, 3];
|
||
* f.apply(null, args);
|
||
* ```
|
||
*
|
||
* With `spread` this example can be re-written.
|
||
*
|
||
* ```js
|
||
* spread(function(x, y, z) {})([1, 2, 3]);
|
||
* ```
|
||
*
|
||
* @param {Function} callback
|
||
* @returns {Function}
|
||
*/
|
||
module.exports = function spread(callback) {
|
||
return function wrap(arr) {
|
||
return callback.apply(null, arr);
|
||
};
|
||
};
|
||
|
||
|
||
/***/ })
|
||
/******/ ])
|
||
});
|
||
;
|
||
//# sourceMappingURL=axios.map
|
||
/*!
|
||
* vue-textarea-autosize v1.1.1
|
||
* (c) 2019 Saymon
|
||
* Released under the MIT License.
|
||
*/
|
||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self,t.VueTextareaAutosize=e())}(this,function(){"use strict";function t(t,e,i,n,o,r,a,s,u,c){"boolean"!=typeof a&&(u=s,s=a,a=!1);var h="function"==typeof i?i.options:i;t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,o&&(h.functional=!0)),n&&(h._scopeId=n);var l;if(r?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,u(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},h._ssrRegister=l):e&&(l=a?function(){e.call(this,c(this.$root.$options.shadowRoot))}:function(t){e.call(this,s(t))}),l)if(h.functional){var d=h.render;h.render=function(t,e){return l.call(e),d(t,e)}}else{var f=h.beforeCreate;h.beforeCreate=f?[].concat(f,l):[l]}return i}var e={name:"TextareaAutosize",props:{value:{type:[String,Number],default:""},autosize:{type:Boolean,default:!0},minHeight:{type:[Number],default:null},maxHeight:{type:[Number],default:null},important:{type:[Boolean,Array],default:!1}},data:function(){return{val:null,maxHeightScroll:!1,height:"auto"}},computed:{computedStyles:function(){return this.autosize?{resize:this.isResizeImportant?"none !important":"none",height:this.height,overflow:this.maxHeightScroll?"auto":this.isOverflowImportant?"hidden !important":"hidden"}:{}},isResizeImportant:function(){var t=this.important;return!0===t||Array.isArray(t)&&t.includes("resize")},isOverflowImportant:function(){var t=this.important;return!0===t||Array.isArray(t)&&t.includes("overflow")},isHeightImportant:function(){var t=this.important;return!0===t||Array.isArray(t)&&t.includes("height")}},watch:{value:function(t){this.val=t},val:function(t){this.$nextTick(this.resize),this.$emit("input",t)},minHeight:function(){this.$nextTick(this.resize)},maxHeight:function(){this.$nextTick(this.resize)},autosize:function(t){t&&this.resize()}},methods:{resize:function(){var t=this,e=this.isHeightImportant?"important":"";return this.height="auto".concat(e?" !important":""),this.$nextTick(function(){var i=t.$el.scrollHeight+1;t.minHeight&&(i=i<t.minHeight?t.minHeight:i),t.maxHeight&&(i>t.maxHeight?(i=t.maxHeight,t.maxHeightScroll=!0):t.maxHeightScroll=!1);var n=i+"px";t.height="".concat(n).concat(e?" !important":"")}),this}},created:function(){this.val=this.value},mounted:function(){this.resize()}},i=t;const n=e;var o=function(){var t=this,e=t.$createElement;return(t._self._c||e)("textarea",{directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],style:t.computedStyles,domProps:{value:t.val},on:{focus:t.resize,input:function(e){e.target.composing||(t.val=e.target.value)}}})},r=[];var a=i({render:o,staticRenderFns:r},void 0,n,void 0,!1,void 0,void 0,void 0),s=function(t){t.component("TextareaAutosize",a)},u={install:s,version:"1.1.1"};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(u),u});
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueRecaptcha=t()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var t,n=(t=function(){var e=!1,t=[];return{resolved:function(){return e},resolve:function(n){if(!e){e=!0;for(var i=0,r=t.length;i<r;i++)t[i](n)}},promise:{then:function(n){e?n():t.push(n)}}}}(),{notify:function(){t.resolve()},wait:function(){return t.promise},render:function(e,t,n){this.wait().then(function(){n(window.grecaptcha.render(e,t))})},reset:function(e){void 0!==e&&(this.assertLoaded(),this.wait().then(function(){return window.grecaptcha.reset(e)}))},execute:function(e){void 0!==e&&(this.assertLoaded(),this.wait().then(function(){return window.grecaptcha.execute(e)}))},checkRecaptchaLoad:function(){window.hasOwnProperty("grecaptcha")&&window.grecaptcha.hasOwnProperty("render")&&this.notify()},assertLoaded:function(){if(!t.resolved())throw new Error("ReCAPTCHA has not been loaded")}});return"undefined"!=typeof window&&(window.vueRecaptchaApiLoaded=n.notify),{name:"VueRecaptcha",props:{sitekey:{type:String,required:!0},theme:{type:String},badge:{type:String},type:{type:String},size:{type:String},tabindex:{type:String}},mounted:function(){var t=this;n.checkRecaptchaLoad();var i=e({},this.$props,{callback:this.emitVerify,"expired-callback":this.emitExpired}),r=this.$slots.default?this.$el.children[0]:this.$el;n.render(r,i,function(e){t.$widgetId=e,t.$emit("render",e)})},methods:{reset:function(){n.reset(this.$widgetId)},execute:function(){n.execute(this.$widgetId)},emitVerify:function(e){this.$emit("verify",e)},emitExpired:function(){this.$emit("expired")}},render:function(e){return e("div",{},this.$slots.default)}}});
|
||
|
||
/**
|
||
* vee-validate v2.1.0-beta.6
|
||
* (c) 2018 Abdelrahman Awad
|
||
* @license MIT
|
||
*/
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||
typeof define === 'function' && define.amd ? define(factory) :
|
||
(global.VeeValidate = factory());
|
||
}(this, (function () { 'use strict';
|
||
|
||
var MILLISECONDS_IN_HOUR = 3600000;
|
||
var MILLISECONDS_IN_MINUTE = 60000;
|
||
var DEFAULT_ADDITIONAL_DIGITS = 2;
|
||
|
||
var patterns = {
|
||
dateTimeDelimeter: /[T ]/,
|
||
plainTime: /:/,
|
||
|
||
// year tokens
|
||
YY: /^(\d{2})$/,
|
||
YYY: [
|
||
/^([+-]\d{2})$/, // 0 additional digits
|
||
/^([+-]\d{3})$/, // 1 additional digit
|
||
/^([+-]\d{4})$/ // 2 additional digits
|
||
],
|
||
YYYY: /^(\d{4})/,
|
||
YYYYY: [
|
||
/^([+-]\d{4})/, // 0 additional digits
|
||
/^([+-]\d{5})/, // 1 additional digit
|
||
/^([+-]\d{6})/ // 2 additional digits
|
||
],
|
||
|
||
// date tokens
|
||
MM: /^-(\d{2})$/,
|
||
DDD: /^-?(\d{3})$/,
|
||
MMDD: /^-?(\d{2})-?(\d{2})$/,
|
||
Www: /^-?W(\d{2})$/,
|
||
WwwD: /^-?W(\d{2})-?(\d{1})$/,
|
||
|
||
HH: /^(\d{2}([.,]\d*)?)$/,
|
||
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
||
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
||
|
||
// timezone tokens
|
||
timezone: /([Z+-].*)$/,
|
||
timezoneZ: /^(Z)$/,
|
||
timezoneHH: /^([+-])(\d{2})$/,
|
||
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
|
||
};
|
||
|
||
/**
|
||
* @name toDate
|
||
* @category Common Helpers
|
||
* @summary Convert the given argument to an instance of Date.
|
||
*
|
||
* @description
|
||
* Convert the given argument to an instance of Date.
|
||
*
|
||
* If the argument is an instance of Date, the function returns its clone.
|
||
*
|
||
* If the argument is a number, it is treated as a timestamp.
|
||
*
|
||
* If an argument is a string, the function tries to parse it.
|
||
* Function accepts complete ISO 8601 formats as well as partial implementations.
|
||
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
||
*
|
||
* If the argument is null, it is treated as an invalid date.
|
||
*
|
||
* If all above fails, the function passes the given argument to Date constructor.
|
||
*
|
||
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
||
* All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.
|
||
*
|
||
* @param {*} argument - the value to convert
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
|
||
* @returns {Date} the parsed date in the local time zone
|
||
* @throws {TypeError} 1 argument required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Convert string '2014-02-11T11:30:30' to date:
|
||
* var result = toDate('2014-02-11T11:30:30')
|
||
* //=> Tue Feb 11 2014 11:30:30
|
||
*
|
||
* @example
|
||
* // Convert string '+02014101' to date,
|
||
* // if the additional number of digits in the extended year format is 1:
|
||
* var result = toDate('+02014101', {additionalDigits: 1})
|
||
* //=> Fri Apr 11 2014 00:00:00
|
||
*/
|
||
function toDate (argument, dirtyOptions) {
|
||
if (arguments.length < 1) {
|
||
throw new TypeError('1 argument required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
if (argument === null) {
|
||
return new Date(NaN)
|
||
}
|
||
|
||
var options = dirtyOptions || {};
|
||
|
||
var additionalDigits = options.additionalDigits === undefined ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits);
|
||
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
|
||
throw new RangeError('additionalDigits must be 0, 1 or 2')
|
||
}
|
||
|
||
// Clone the date
|
||
if (argument instanceof Date) {
|
||
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
||
return new Date(argument.getTime())
|
||
} else if (typeof argument !== 'string') {
|
||
return new Date(argument)
|
||
}
|
||
|
||
var dateStrings = splitDateString(argument);
|
||
|
||
var parseYearResult = parseYear(dateStrings.date, additionalDigits);
|
||
var year = parseYearResult.year;
|
||
var restDateString = parseYearResult.restDateString;
|
||
|
||
var date = parseDate(restDateString, year);
|
||
|
||
if (date) {
|
||
var timestamp = date.getTime();
|
||
var time = 0;
|
||
var offset;
|
||
|
||
if (dateStrings.time) {
|
||
time = parseTime(dateStrings.time);
|
||
}
|
||
|
||
if (dateStrings.timezone) {
|
||
offset = parseTimezone(dateStrings.timezone);
|
||
} else {
|
||
// get offset accurate to hour in timezones that change offset
|
||
offset = new Date(timestamp + time).getTimezoneOffset();
|
||
offset = new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset();
|
||
}
|
||
|
||
return new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE)
|
||
} else {
|
||
return new Date(argument)
|
||
}
|
||
}
|
||
|
||
function splitDateString (dateString) {
|
||
var dateStrings = {};
|
||
var array = dateString.split(patterns.dateTimeDelimeter);
|
||
var timeString;
|
||
|
||
if (patterns.plainTime.test(array[0])) {
|
||
dateStrings.date = null;
|
||
timeString = array[0];
|
||
} else {
|
||
dateStrings.date = array[0];
|
||
timeString = array[1];
|
||
}
|
||
|
||
if (timeString) {
|
||
var token = patterns.timezone.exec(timeString);
|
||
if (token) {
|
||
dateStrings.time = timeString.replace(token[1], '');
|
||
dateStrings.timezone = token[1];
|
||
} else {
|
||
dateStrings.time = timeString;
|
||
}
|
||
}
|
||
|
||
return dateStrings
|
||
}
|
||
|
||
function parseYear (dateString, additionalDigits) {
|
||
var patternYYY = patterns.YYY[additionalDigits];
|
||
var patternYYYYY = patterns.YYYYY[additionalDigits];
|
||
|
||
var token;
|
||
|
||
// YYYY or ±YYYYY
|
||
token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);
|
||
if (token) {
|
||
var yearString = token[1];
|
||
return {
|
||
year: parseInt(yearString, 10),
|
||
restDateString: dateString.slice(yearString.length)
|
||
}
|
||
}
|
||
|
||
// YY or ±YYY
|
||
token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);
|
||
if (token) {
|
||
var centuryString = token[1];
|
||
return {
|
||
year: parseInt(centuryString, 10) * 100,
|
||
restDateString: dateString.slice(centuryString.length)
|
||
}
|
||
}
|
||
|
||
// Invalid ISO-formatted year
|
||
return {
|
||
year: null
|
||
}
|
||
}
|
||
|
||
function parseDate (dateString, year) {
|
||
// Invalid ISO-formatted year
|
||
if (year === null) {
|
||
return null
|
||
}
|
||
|
||
var token;
|
||
var date;
|
||
var month;
|
||
var week;
|
||
|
||
// YYYY
|
||
if (dateString.length === 0) {
|
||
date = new Date(0);
|
||
date.setUTCFullYear(year);
|
||
return date
|
||
}
|
||
|
||
// YYYY-MM
|
||
token = patterns.MM.exec(dateString);
|
||
if (token) {
|
||
date = new Date(0);
|
||
month = parseInt(token[1], 10) - 1;
|
||
date.setUTCFullYear(year, month);
|
||
return date
|
||
}
|
||
|
||
// YYYY-DDD or YYYYDDD
|
||
token = patterns.DDD.exec(dateString);
|
||
if (token) {
|
||
date = new Date(0);
|
||
var dayOfYear = parseInt(token[1], 10);
|
||
date.setUTCFullYear(year, 0, dayOfYear);
|
||
return date
|
||
}
|
||
|
||
// YYYY-MM-DD or YYYYMMDD
|
||
token = patterns.MMDD.exec(dateString);
|
||
if (token) {
|
||
date = new Date(0);
|
||
month = parseInt(token[1], 10) - 1;
|
||
var day = parseInt(token[2], 10);
|
||
date.setUTCFullYear(year, month, day);
|
||
return date
|
||
}
|
||
|
||
// YYYY-Www or YYYYWww
|
||
token = patterns.Www.exec(dateString);
|
||
if (token) {
|
||
week = parseInt(token[1], 10) - 1;
|
||
return dayOfISOYear(year, week)
|
||
}
|
||
|
||
// YYYY-Www-D or YYYYWwwD
|
||
token = patterns.WwwD.exec(dateString);
|
||
if (token) {
|
||
week = parseInt(token[1], 10) - 1;
|
||
var dayOfWeek = parseInt(token[2], 10) - 1;
|
||
return dayOfISOYear(year, week, dayOfWeek)
|
||
}
|
||
|
||
// Invalid ISO-formatted date
|
||
return null
|
||
}
|
||
|
||
function parseTime (timeString) {
|
||
var token;
|
||
var hours;
|
||
var minutes;
|
||
|
||
// hh
|
||
token = patterns.HH.exec(timeString);
|
||
if (token) {
|
||
hours = parseFloat(token[1].replace(',', '.'));
|
||
return (hours % 24) * MILLISECONDS_IN_HOUR
|
||
}
|
||
|
||
// hh:mm or hhmm
|
||
token = patterns.HHMM.exec(timeString);
|
||
if (token) {
|
||
hours = parseInt(token[1], 10);
|
||
minutes = parseFloat(token[2].replace(',', '.'));
|
||
return (hours % 24) * MILLISECONDS_IN_HOUR +
|
||
minutes * MILLISECONDS_IN_MINUTE
|
||
}
|
||
|
||
// hh:mm:ss or hhmmss
|
||
token = patterns.HHMMSS.exec(timeString);
|
||
if (token) {
|
||
hours = parseInt(token[1], 10);
|
||
minutes = parseInt(token[2], 10);
|
||
var seconds = parseFloat(token[3].replace(',', '.'));
|
||
return (hours % 24) * MILLISECONDS_IN_HOUR +
|
||
minutes * MILLISECONDS_IN_MINUTE +
|
||
seconds * 1000
|
||
}
|
||
|
||
// Invalid ISO-formatted time
|
||
return null
|
||
}
|
||
|
||
function parseTimezone (timezoneString) {
|
||
var token;
|
||
var absoluteOffset;
|
||
|
||
// Z
|
||
token = patterns.timezoneZ.exec(timezoneString);
|
||
if (token) {
|
||
return 0
|
||
}
|
||
|
||
// ±hh
|
||
token = patterns.timezoneHH.exec(timezoneString);
|
||
if (token) {
|
||
absoluteOffset = parseInt(token[2], 10) * 60;
|
||
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
|
||
}
|
||
|
||
// ±hh:mm or ±hhmm
|
||
token = patterns.timezoneHHMM.exec(timezoneString);
|
||
if (token) {
|
||
absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10);
|
||
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
|
||
}
|
||
|
||
return 0
|
||
}
|
||
|
||
function dayOfISOYear (isoYear, week, day) {
|
||
week = week || 0;
|
||
day = day || 0;
|
||
var date = new Date(0);
|
||
date.setUTCFullYear(isoYear, 0, 4);
|
||
var fourthOfJanuaryDay = date.getUTCDay() || 7;
|
||
var diff = week * 7 + day + 1 - fourthOfJanuaryDay;
|
||
date.setUTCDate(date.getUTCDate() + diff);
|
||
return date
|
||
}
|
||
|
||
/**
|
||
* @name addMilliseconds
|
||
* @category Millisecond Helpers
|
||
* @summary Add the specified number of milliseconds to the given date.
|
||
*
|
||
* @description
|
||
* Add the specified number of milliseconds to the given date.
|
||
*
|
||
* @param {Date|String|Number} date - the date to be changed
|
||
* @param {Number} amount - the amount of milliseconds to be added
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Date} the new date with the milliseconds added
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
||
* var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
||
* //=> Thu Jul 10 2014 12:45:30.750
|
||
*/
|
||
function addMilliseconds (dirtyDate, dirtyAmount, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var timestamp = toDate(dirtyDate, dirtyOptions).getTime();
|
||
var amount = Number(dirtyAmount);
|
||
return new Date(timestamp + amount)
|
||
}
|
||
|
||
function cloneObject (dirtyObject) {
|
||
dirtyObject = dirtyObject || {};
|
||
var object = {};
|
||
|
||
for (var property in dirtyObject) {
|
||
if (dirtyObject.hasOwnProperty(property)) {
|
||
object[property] = dirtyObject[property];
|
||
}
|
||
}
|
||
|
||
return object
|
||
}
|
||
|
||
var MILLISECONDS_IN_MINUTE$2 = 60000;
|
||
|
||
/**
|
||
* @name addMinutes
|
||
* @category Minute Helpers
|
||
* @summary Add the specified number of minutes to the given date.
|
||
*
|
||
* @description
|
||
* Add the specified number of minutes to the given date.
|
||
*
|
||
* @param {Date|String|Number} date - the date to be changed
|
||
* @param {Number} amount - the amount of minutes to be added
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Date} the new date with the minutes added
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Add 30 minutes to 10 July 2014 12:00:00:
|
||
* var result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
||
* //=> Thu Jul 10 2014 12:30:00
|
||
*/
|
||
function addMinutes (dirtyDate, dirtyAmount, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var amount = Number(dirtyAmount);
|
||
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE$2, dirtyOptions)
|
||
}
|
||
|
||
/**
|
||
* @name isValid
|
||
* @category Common Helpers
|
||
* @summary Is the given date valid?
|
||
*
|
||
* @description
|
||
* Returns false if argument is Invalid Date and true otherwise.
|
||
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* Invalid Date is a Date, whose time value is NaN.
|
||
*
|
||
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
||
*
|
||
* @param {*} date - the date to check
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Boolean} the date is valid
|
||
* @throws {TypeError} 1 argument required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // For the valid date:
|
||
* var result = isValid(new Date(2014, 1, 31))
|
||
* //=> true
|
||
*
|
||
* @example
|
||
* // For the value, convertable into a date:
|
||
* var result = isValid('2014-02-31')
|
||
* //=> true
|
||
*
|
||
* @example
|
||
* // For the invalid date:
|
||
* var result = isValid(new Date(''))
|
||
* //=> false
|
||
*/
|
||
function isValid (dirtyDate, dirtyOptions) {
|
||
if (arguments.length < 1) {
|
||
throw new TypeError('1 argument required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
return !isNaN(date)
|
||
}
|
||
|
||
var formatDistanceLocale = {
|
||
lessThanXSeconds: {
|
||
one: 'less than a second',
|
||
other: 'less than {{count}} seconds'
|
||
},
|
||
|
||
xSeconds: {
|
||
one: '1 second',
|
||
other: '{{count}} seconds'
|
||
},
|
||
|
||
halfAMinute: 'half a minute',
|
||
|
||
lessThanXMinutes: {
|
||
one: 'less than a minute',
|
||
other: 'less than {{count}} minutes'
|
||
},
|
||
|
||
xMinutes: {
|
||
one: '1 minute',
|
||
other: '{{count}} minutes'
|
||
},
|
||
|
||
aboutXHours: {
|
||
one: 'about 1 hour',
|
||
other: 'about {{count}} hours'
|
||
},
|
||
|
||
xHours: {
|
||
one: '1 hour',
|
||
other: '{{count}} hours'
|
||
},
|
||
|
||
xDays: {
|
||
one: '1 day',
|
||
other: '{{count}} days'
|
||
},
|
||
|
||
aboutXMonths: {
|
||
one: 'about 1 month',
|
||
other: 'about {{count}} months'
|
||
},
|
||
|
||
xMonths: {
|
||
one: '1 month',
|
||
other: '{{count}} months'
|
||
},
|
||
|
||
aboutXYears: {
|
||
one: 'about 1 year',
|
||
other: 'about {{count}} years'
|
||
},
|
||
|
||
xYears: {
|
||
one: '1 year',
|
||
other: '{{count}} years'
|
||
},
|
||
|
||
overXYears: {
|
||
one: 'over 1 year',
|
||
other: 'over {{count}} years'
|
||
},
|
||
|
||
almostXYears: {
|
||
one: 'almost 1 year',
|
||
other: 'almost {{count}} years'
|
||
}
|
||
};
|
||
|
||
function formatDistance (token, count, options) {
|
||
options = options || {};
|
||
|
||
var result;
|
||
if (typeof formatDistanceLocale[token] === 'string') {
|
||
result = formatDistanceLocale[token];
|
||
} else if (count === 1) {
|
||
result = formatDistanceLocale[token].one;
|
||
} else {
|
||
result = formatDistanceLocale[token].other.replace('{{count}}', count);
|
||
}
|
||
|
||
if (options.addSuffix) {
|
||
if (options.comparison > 0) {
|
||
return 'in ' + result
|
||
} else {
|
||
return result + ' ago'
|
||
}
|
||
}
|
||
|
||
return result
|
||
}
|
||
|
||
var tokensToBeShortedPattern = /MMMM|MM|DD|dddd/g;
|
||
|
||
function buildShortLongFormat (format) {
|
||
return format.replace(tokensToBeShortedPattern, function (token) {
|
||
return token.slice(1)
|
||
})
|
||
}
|
||
|
||
/**
|
||
* @name buildFormatLongFn
|
||
* @category Locale Helpers
|
||
* @summary Build `formatLong` property for locale used by `format`, `formatRelative` and `parse` functions.
|
||
*
|
||
* @description
|
||
* Build `formatLong` property for locale used by `format`, `formatRelative` and `parse` functions.
|
||
* Returns a function which takes one of the following tokens as the argument:
|
||
* `'LTS'`, `'LT'`, `'L'`, `'LL'`, `'LLL'`, `'l'`, `'ll'`, `'lll'`, `'llll'`
|
||
* and returns a long format string written as `format` token strings.
|
||
* See [format]{@link https://date-fns.org/docs/format}
|
||
*
|
||
* `'l'`, `'ll'`, `'lll'` and `'llll'` formats are built automatically
|
||
* by shortening some of the tokens from corresponding unshortened formats
|
||
* (e.g., if `LL` is `'MMMM DD YYYY'` then `ll` will be `MMM D YYYY`)
|
||
*
|
||
* @param {Object} obj - the object with long formats written as `format` token strings
|
||
* @param {String} obj.LT - time format: hours and minutes
|
||
* @param {String} obj.LTS - time format: hours, minutes and seconds
|
||
* @param {String} obj.L - short date format: numeric day, month and year
|
||
* @param {String} [obj.l] - short date format: numeric day, month and year (shortened)
|
||
* @param {String} obj.LL - long date format: day, month in words, and year
|
||
* @param {String} [obj.ll] - long date format: day, month in words, and year (shortened)
|
||
* @param {String} obj.LLL - long date and time format
|
||
* @param {String} [obj.lll] - long date and time format (shortened)
|
||
* @param {String} obj.LLLL - long date, time and weekday format
|
||
* @param {String} [obj.llll] - long date, time and weekday format (shortened)
|
||
* @returns {Function} `formatLong` property of the locale
|
||
*
|
||
* @example
|
||
* // For `en-US` locale:
|
||
* locale.formatLong = buildFormatLongFn({
|
||
* LT: 'h:mm aa',
|
||
* LTS: 'h:mm:ss aa',
|
||
* L: 'MM/DD/YYYY',
|
||
* LL: 'MMMM D YYYY',
|
||
* LLL: 'MMMM D YYYY h:mm aa',
|
||
* LLLL: 'dddd, MMMM D YYYY h:mm aa'
|
||
* })
|
||
*/
|
||
function buildFormatLongFn (obj) {
|
||
var formatLongLocale = {
|
||
LTS: obj.LTS,
|
||
LT: obj.LT,
|
||
L: obj.L,
|
||
LL: obj.LL,
|
||
LLL: obj.LLL,
|
||
LLLL: obj.LLLL,
|
||
l: obj.l || buildShortLongFormat(obj.L),
|
||
ll: obj.ll || buildShortLongFormat(obj.LL),
|
||
lll: obj.lll || buildShortLongFormat(obj.LLL),
|
||
llll: obj.llll || buildShortLongFormat(obj.LLLL)
|
||
};
|
||
|
||
return function (token) {
|
||
return formatLongLocale[token]
|
||
}
|
||
}
|
||
|
||
var formatLong = buildFormatLongFn({
|
||
LT: 'h:mm aa',
|
||
LTS: 'h:mm:ss aa',
|
||
L: 'MM/DD/YYYY',
|
||
LL: 'MMMM D YYYY',
|
||
LLL: 'MMMM D YYYY h:mm aa',
|
||
LLLL: 'dddd, MMMM D YYYY h:mm aa'
|
||
});
|
||
|
||
var formatRelativeLocale = {
|
||
lastWeek: '[last] dddd [at] LT',
|
||
yesterday: '[yesterday at] LT',
|
||
today: '[today at] LT',
|
||
tomorrow: '[tomorrow at] LT',
|
||
nextWeek: 'dddd [at] LT',
|
||
other: 'L'
|
||
};
|
||
|
||
function formatRelative (token, date, baseDate, options) {
|
||
return formatRelativeLocale[token]
|
||
}
|
||
|
||
/**
|
||
* @name buildLocalizeFn
|
||
* @category Locale Helpers
|
||
* @summary Build `localize.weekday`, `localize.month` and `localize.timeOfDay` properties for the locale.
|
||
*
|
||
* @description
|
||
* Build `localize.weekday`, `localize.month` and `localize.timeOfDay` properties for the locale
|
||
* used by `format` function.
|
||
* If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
|
||
*
|
||
* `localize.weekday` function takes the weekday index as argument (0 - Sunday).
|
||
* `localize.month` takes the month index (0 - January).
|
||
* `localize.timeOfDay` takes the hours. Use `indexCallback` to convert them to an array index (see example).
|
||
*
|
||
* @param {Object} values - the object with arrays of values
|
||
* @param {String} defaultType - the default type for the localize function
|
||
* @param {Function} [indexCallback] - the callback which takes the resulting function argument
|
||
* and converts it into value array index
|
||
* @returns {Function} the resulting function
|
||
*
|
||
* @example
|
||
* var timeOfDayValues = {
|
||
* uppercase: ['AM', 'PM'],
|
||
* lowercase: ['am', 'pm'],
|
||
* long: ['a.m.', 'p.m.']
|
||
* }
|
||
* locale.localize.timeOfDay = buildLocalizeFn(timeOfDayValues, 'long', function (hours) {
|
||
* // 0 is a.m. array index, 1 is p.m. array index
|
||
* return (hours / 12) >= 1 ? 1 : 0
|
||
* })
|
||
* locale.localize.timeOfDay(16, {type: 'uppercase'}) //=> 'PM'
|
||
* locale.localize.timeOfDay(5) //=> 'a.m.'
|
||
*/
|
||
function buildLocalizeFn (values, defaultType, indexCallback) {
|
||
return function (dirtyIndex, dirtyOptions) {
|
||
var options = dirtyOptions || {};
|
||
var type = options.type ? String(options.type) : defaultType;
|
||
var valuesArray = values[type] || values[defaultType];
|
||
var index = indexCallback ? indexCallback(Number(dirtyIndex)) : Number(dirtyIndex);
|
||
return valuesArray[index]
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @name buildLocalizeArrayFn
|
||
* @category Locale Helpers
|
||
* @summary Build `localize.weekdays`, `localize.months` and `localize.timesOfDay` properties for the locale.
|
||
*
|
||
* @description
|
||
* Build `localize.weekdays`, `localize.months` and `localize.timesOfDay` properties for the locale.
|
||
* If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
|
||
*
|
||
* @param {Object} values - the object with arrays of values
|
||
* @param {String} defaultType - the default type for the localize function
|
||
* @returns {Function} the resulting function
|
||
*
|
||
* @example
|
||
* var weekdayValues = {
|
||
* narrow: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||
* short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||
* long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
||
* }
|
||
* locale.localize.weekdays = buildLocalizeArrayFn(weekdayValues, 'long')
|
||
* locale.localize.weekdays({type: 'narrow'}) //=> ['Su', 'Mo', ...]
|
||
* locale.localize.weekdays() //=> ['Sunday', 'Monday', ...]
|
||
*/
|
||
function buildLocalizeArrayFn (values, defaultType) {
|
||
return function (dirtyOptions) {
|
||
var options = dirtyOptions || {};
|
||
var type = options.type ? String(options.type) : defaultType;
|
||
return values[type] || values[defaultType]
|
||
}
|
||
}
|
||
|
||
// Note: in English, the names of days of the week and months are capitalized.
|
||
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
||
// Generally, formatted dates should look like they are in the middle of a sentence,
|
||
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
||
var weekdayValues = {
|
||
narrow: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||
long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
||
};
|
||
|
||
var monthValues = {
|
||
short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||
long: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
||
};
|
||
|
||
// `timeOfDay` is used to designate which part of the day it is, when used with 12-hour clock.
|
||
// Use the system which is used the most commonly in the locale.
|
||
// For example, if the country doesn't use a.m./p.m., you can use `night`/`morning`/`afternoon`/`evening`:
|
||
//
|
||
// var timeOfDayValues = {
|
||
// any: ['in the night', 'in the morning', 'in the afternoon', 'in the evening']
|
||
// }
|
||
//
|
||
// And later:
|
||
//
|
||
// var localize = {
|
||
// // The callback takes the hours as the argument and returns the array index
|
||
// timeOfDay: buildLocalizeFn(timeOfDayValues, 'any', function (hours) {
|
||
// if (hours >= 17) {
|
||
// return 3
|
||
// } else if (hours >= 12) {
|
||
// return 2
|
||
// } else if (hours >= 4) {
|
||
// return 1
|
||
// } else {
|
||
// return 0
|
||
// }
|
||
// }),
|
||
// timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'any')
|
||
// }
|
||
var timeOfDayValues = {
|
||
uppercase: ['AM', 'PM'],
|
||
lowercase: ['am', 'pm'],
|
||
long: ['a.m.', 'p.m.']
|
||
};
|
||
|
||
function ordinalNumber (dirtyNumber, dirtyOptions) {
|
||
var number = Number(dirtyNumber);
|
||
|
||
// If ordinal numbers depend on context, for example,
|
||
// if they are different for different grammatical genders,
|
||
// use `options.unit`:
|
||
//
|
||
// var options = dirtyOptions || {}
|
||
// var unit = String(options.unit)
|
||
//
|
||
// where `unit` can be 'month', 'quarter', 'week', 'isoWeek', 'dayOfYear',
|
||
// 'dayOfMonth' or 'dayOfWeek'
|
||
|
||
var rem100 = number % 100;
|
||
if (rem100 > 20 || rem100 < 10) {
|
||
switch (rem100 % 10) {
|
||
case 1:
|
||
return number + 'st'
|
||
case 2:
|
||
return number + 'nd'
|
||
case 3:
|
||
return number + 'rd'
|
||
}
|
||
}
|
||
return number + 'th'
|
||
}
|
||
|
||
var localize = {
|
||
ordinalNumber: ordinalNumber,
|
||
weekday: buildLocalizeFn(weekdayValues, 'long'),
|
||
weekdays: buildLocalizeArrayFn(weekdayValues, 'long'),
|
||
month: buildLocalizeFn(monthValues, 'long'),
|
||
months: buildLocalizeArrayFn(monthValues, 'long'),
|
||
timeOfDay: buildLocalizeFn(timeOfDayValues, 'long', function (hours) {
|
||
return (hours / 12) >= 1 ? 1 : 0
|
||
}),
|
||
timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'long')
|
||
};
|
||
|
||
/**
|
||
* @name buildMatchFn
|
||
* @category Locale Helpers
|
||
* @summary Build `match.weekdays`, `match.months` and `match.timesOfDay` properties for the locale.
|
||
*
|
||
* @description
|
||
* Build `match.weekdays`, `match.months` and `match.timesOfDay` properties for the locale used by `parse` function.
|
||
* If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
|
||
* The result of the match function will be passed into corresponding parser function
|
||
* (`match.weekday`, `match.month` or `match.timeOfDay` respectively. See `buildParseFn`).
|
||
*
|
||
* @param {Object} values - the object with RegExps
|
||
* @param {String} defaultType - the default type for the match function
|
||
* @returns {Function} the resulting function
|
||
*
|
||
* @example
|
||
* var matchWeekdaysPatterns = {
|
||
* narrow: /^(su|mo|tu|we|th|fr|sa)/i,
|
||
* short: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
||
* long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
||
* }
|
||
* locale.match.weekdays = buildMatchFn(matchWeekdaysPatterns, 'long')
|
||
* locale.match.weekdays('Sunday', {type: 'narrow'}) //=> ['Su', 'Su', ...]
|
||
* locale.match.weekdays('Sunday') //=> ['Sunday', 'Sunday', ...]
|
||
*/
|
||
function buildMatchFn (patterns, defaultType) {
|
||
return function (dirtyString, dirtyOptions) {
|
||
var options = dirtyOptions || {};
|
||
var type = options.type ? String(options.type) : defaultType;
|
||
var pattern = patterns[type] || patterns[defaultType];
|
||
var string = String(dirtyString);
|
||
return string.match(pattern)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @name buildParseFn
|
||
* @category Locale Helpers
|
||
* @summary Build `match.weekday`, `match.month` and `match.timeOfDay` properties for the locale.
|
||
*
|
||
* @description
|
||
* Build `match.weekday`, `match.month` and `match.timeOfDay` properties for the locale used by `parse` function.
|
||
* The argument of the resulting function is the result of the corresponding match function
|
||
* (`match.weekdays`, `match.months` or `match.timesOfDay` respectively. See `buildMatchFn`).
|
||
*
|
||
* @param {Object} values - the object with arrays of RegExps
|
||
* @param {String} defaultType - the default type for the parser function
|
||
* @returns {Function} the resulting function
|
||
*
|
||
* @example
|
||
* var parseWeekdayPatterns = {
|
||
* any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
||
* }
|
||
* locale.match.weekday = buildParseFn(matchWeekdaysPatterns, 'long')
|
||
* var matchResult = locale.match.weekdays('Friday')
|
||
* locale.match.weekday(matchResult) //=> 5
|
||
*/
|
||
function buildParseFn (patterns, defaultType) {
|
||
return function (matchResult, dirtyOptions) {
|
||
var options = dirtyOptions || {};
|
||
var type = options.type ? String(options.type) : defaultType;
|
||
var patternsArray = patterns[type] || patterns[defaultType];
|
||
var string = matchResult[1];
|
||
|
||
return patternsArray.findIndex(function (pattern) {
|
||
return pattern.test(string)
|
||
})
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @name buildMatchPatternFn
|
||
* @category Locale Helpers
|
||
* @summary Build match function from a single RegExp.
|
||
*
|
||
* @description
|
||
* Build match function from a single RegExp.
|
||
* Usually used for building `match.ordinalNumbers` property of the locale.
|
||
*
|
||
* @param {Object} pattern - the RegExp
|
||
* @returns {Function} the resulting function
|
||
*
|
||
* @example
|
||
* locale.match.ordinalNumbers = buildMatchPatternFn(/^(\d+)(th|st|nd|rd)?/i)
|
||
* locale.match.ordinalNumbers('3rd') //=> ['3rd', '3', 'rd', ...]
|
||
*/
|
||
function buildMatchPatternFn (pattern) {
|
||
return function (dirtyString) {
|
||
var string = String(dirtyString);
|
||
return string.match(pattern)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @name parseDecimal
|
||
* @category Locale Helpers
|
||
* @summary Parses the match result into decimal number.
|
||
*
|
||
* @description
|
||
* Parses the match result into decimal number.
|
||
* Uses the string matched with the first set of parentheses of match RegExp.
|
||
*
|
||
* @param {Array} matchResult - the object returned by matching function
|
||
* @returns {Number} the parsed value
|
||
*
|
||
* @example
|
||
* locale.match = {
|
||
* ordinalNumbers: (dirtyString) {
|
||
* return String(dirtyString).match(/^(\d+)(th|st|nd|rd)?/i)
|
||
* },
|
||
* ordinalNumber: parseDecimal
|
||
* }
|
||
*/
|
||
function parseDecimal (matchResult) {
|
||
return parseInt(matchResult[1], 10)
|
||
}
|
||
|
||
var matchOrdinalNumbersPattern = /^(\d+)(th|st|nd|rd)?/i;
|
||
|
||
var matchWeekdaysPatterns = {
|
||
narrow: /^(su|mo|tu|we|th|fr|sa)/i,
|
||
short: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
||
long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
||
};
|
||
|
||
var parseWeekdayPatterns = {
|
||
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
||
};
|
||
|
||
var matchMonthsPatterns = {
|
||
short: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
||
long: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
||
};
|
||
|
||
var parseMonthPatterns = {
|
||
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
||
};
|
||
|
||
// `timeOfDay` is used to designate which part of the day it is, when used with 12-hour clock.
|
||
// Use the system which is used the most commonly in the locale.
|
||
// For example, if the country doesn't use a.m./p.m., you can use `night`/`morning`/`afternoon`/`evening`:
|
||
//
|
||
// var matchTimesOfDayPatterns = {
|
||
// long: /^((in the)? (night|morning|afternoon|evening?))/i
|
||
// }
|
||
//
|
||
// var parseTimeOfDayPatterns = {
|
||
// any: [/(night|morning)/i, /(afternoon|evening)/i]
|
||
// }
|
||
var matchTimesOfDayPatterns = {
|
||
short: /^(am|pm)/i,
|
||
long: /^([ap]\.?\s?m\.?)/i
|
||
};
|
||
|
||
var parseTimeOfDayPatterns = {
|
||
any: [/^a/i, /^p/i]
|
||
};
|
||
|
||
var match = {
|
||
ordinalNumbers: buildMatchPatternFn(matchOrdinalNumbersPattern),
|
||
ordinalNumber: parseDecimal,
|
||
weekdays: buildMatchFn(matchWeekdaysPatterns, 'long'),
|
||
weekday: buildParseFn(parseWeekdayPatterns, 'any'),
|
||
months: buildMatchFn(matchMonthsPatterns, 'long'),
|
||
month: buildParseFn(parseMonthPatterns, 'any'),
|
||
timesOfDay: buildMatchFn(matchTimesOfDayPatterns, 'long'),
|
||
timeOfDay: buildParseFn(parseTimeOfDayPatterns, 'any')
|
||
};
|
||
|
||
/**
|
||
* @type {Locale}
|
||
* @category Locales
|
||
* @summary English locale (United States).
|
||
* @language English
|
||
* @iso-639-2 eng
|
||
*/
|
||
var locale = {
|
||
formatDistance: formatDistance,
|
||
formatLong: formatLong,
|
||
formatRelative: formatRelative,
|
||
localize: localize,
|
||
match: match,
|
||
options: {
|
||
weekStartsOn: 0 /* Sunday */,
|
||
firstWeekContainsDate: 1
|
||
}
|
||
};
|
||
|
||
var MILLISECONDS_IN_DAY$1 = 86400000;
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function getUTCDayOfYear (dirtyDate, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var timestamp = date.getTime();
|
||
date.setUTCMonth(0, 1);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
var startOfYearTimestamp = date.getTime();
|
||
var difference = timestamp - startOfYearTimestamp;
|
||
return Math.floor(difference / MILLISECONDS_IN_DAY$1) + 1
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function startOfUTCISOWeek (dirtyDate, dirtyOptions) {
|
||
var weekStartsOn = 1;
|
||
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var day = date.getUTCDay();
|
||
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
||
|
||
date.setUTCDate(date.getUTCDate() - diff);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
return date
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function getUTCISOWeekYear (dirtyDate, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var year = date.getUTCFullYear();
|
||
|
||
var fourthOfJanuaryOfNextYear = new Date(0);
|
||
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
||
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
|
||
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear, dirtyOptions);
|
||
|
||
var fourthOfJanuaryOfThisYear = new Date(0);
|
||
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
|
||
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
|
||
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear, dirtyOptions);
|
||
|
||
if (date.getTime() >= startOfNextYear.getTime()) {
|
||
return year + 1
|
||
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
||
return year
|
||
} else {
|
||
return year - 1
|
||
}
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function startOfUTCISOWeekYear (dirtyDate, dirtyOptions) {
|
||
var year = getUTCISOWeekYear(dirtyDate, dirtyOptions);
|
||
var fourthOfJanuary = new Date(0);
|
||
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
||
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
||
var date = startOfUTCISOWeek(fourthOfJanuary, dirtyOptions);
|
||
return date
|
||
}
|
||
|
||
var MILLISECONDS_IN_WEEK$2 = 604800000;
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function getUTCISOWeek (dirtyDate, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var diff = startOfUTCISOWeek(date, dirtyOptions).getTime() - startOfUTCISOWeekYear(date, dirtyOptions).getTime();
|
||
|
||
// Round the number of days to the nearest integer
|
||
// because the number of milliseconds in a week is not constant
|
||
// (e.g. it's different in the week of the daylight saving time clock shift)
|
||
return Math.round(diff / MILLISECONDS_IN_WEEK$2) + 1
|
||
}
|
||
|
||
var formatters = {
|
||
// Month: 1, 2, ..., 12
|
||
'M': function (date) {
|
||
return date.getUTCMonth() + 1
|
||
},
|
||
|
||
// Month: 1st, 2nd, ..., 12th
|
||
'Mo': function (date, options) {
|
||
var month = date.getUTCMonth() + 1;
|
||
return options.locale.localize.ordinalNumber(month, {unit: 'month'})
|
||
},
|
||
|
||
// Month: 01, 02, ..., 12
|
||
'MM': function (date) {
|
||
return addLeadingZeros(date.getUTCMonth() + 1, 2)
|
||
},
|
||
|
||
// Month: Jan, Feb, ..., Dec
|
||
'MMM': function (date, options) {
|
||
return options.locale.localize.month(date.getUTCMonth(), {type: 'short'})
|
||
},
|
||
|
||
// Month: January, February, ..., December
|
||
'MMMM': function (date, options) {
|
||
return options.locale.localize.month(date.getUTCMonth(), {type: 'long'})
|
||
},
|
||
|
||
// Quarter: 1, 2, 3, 4
|
||
'Q': function (date) {
|
||
return Math.ceil((date.getUTCMonth() + 1) / 3)
|
||
},
|
||
|
||
// Quarter: 1st, 2nd, 3rd, 4th
|
||
'Qo': function (date, options) {
|
||
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
||
return options.locale.localize.ordinalNumber(quarter, {unit: 'quarter'})
|
||
},
|
||
|
||
// Day of month: 1, 2, ..., 31
|
||
'D': function (date) {
|
||
return date.getUTCDate()
|
||
},
|
||
|
||
// Day of month: 1st, 2nd, ..., 31st
|
||
'Do': function (date, options) {
|
||
return options.locale.localize.ordinalNumber(date.getUTCDate(), {unit: 'dayOfMonth'})
|
||
},
|
||
|
||
// Day of month: 01, 02, ..., 31
|
||
'DD': function (date) {
|
||
return addLeadingZeros(date.getUTCDate(), 2)
|
||
},
|
||
|
||
// Day of year: 1, 2, ..., 366
|
||
'DDD': function (date) {
|
||
return getUTCDayOfYear(date)
|
||
},
|
||
|
||
// Day of year: 1st, 2nd, ..., 366th
|
||
'DDDo': function (date, options) {
|
||
return options.locale.localize.ordinalNumber(getUTCDayOfYear(date), {unit: 'dayOfYear'})
|
||
},
|
||
|
||
// Day of year: 001, 002, ..., 366
|
||
'DDDD': function (date) {
|
||
return addLeadingZeros(getUTCDayOfYear(date), 3)
|
||
},
|
||
|
||
// Day of week: Su, Mo, ..., Sa
|
||
'dd': function (date, options) {
|
||
return options.locale.localize.weekday(date.getUTCDay(), {type: 'narrow'})
|
||
},
|
||
|
||
// Day of week: Sun, Mon, ..., Sat
|
||
'ddd': function (date, options) {
|
||
return options.locale.localize.weekday(date.getUTCDay(), {type: 'short'})
|
||
},
|
||
|
||
// Day of week: Sunday, Monday, ..., Saturday
|
||
'dddd': function (date, options) {
|
||
return options.locale.localize.weekday(date.getUTCDay(), {type: 'long'})
|
||
},
|
||
|
||
// Day of week: 0, 1, ..., 6
|
||
'd': function (date) {
|
||
return date.getUTCDay()
|
||
},
|
||
|
||
// Day of week: 0th, 1st, 2nd, ..., 6th
|
||
'do': function (date, options) {
|
||
return options.locale.localize.ordinalNumber(date.getUTCDay(), {unit: 'dayOfWeek'})
|
||
},
|
||
|
||
// Day of ISO week: 1, 2, ..., 7
|
||
'E': function (date) {
|
||
return date.getUTCDay() || 7
|
||
},
|
||
|
||
// ISO week: 1, 2, ..., 53
|
||
'W': function (date) {
|
||
return getUTCISOWeek(date)
|
||
},
|
||
|
||
// ISO week: 1st, 2nd, ..., 53th
|
||
'Wo': function (date, options) {
|
||
return options.locale.localize.ordinalNumber(getUTCISOWeek(date), {unit: 'isoWeek'})
|
||
},
|
||
|
||
// ISO week: 01, 02, ..., 53
|
||
'WW': function (date) {
|
||
return addLeadingZeros(getUTCISOWeek(date), 2)
|
||
},
|
||
|
||
// Year: 00, 01, ..., 99
|
||
'YY': function (date) {
|
||
return addLeadingZeros(date.getUTCFullYear(), 4).substr(2)
|
||
},
|
||
|
||
// Year: 1900, 1901, ..., 2099
|
||
'YYYY': function (date) {
|
||
return addLeadingZeros(date.getUTCFullYear(), 4)
|
||
},
|
||
|
||
// ISO week-numbering year: 00, 01, ..., 99
|
||
'GG': function (date) {
|
||
return String(getUTCISOWeekYear(date)).substr(2)
|
||
},
|
||
|
||
// ISO week-numbering year: 1900, 1901, ..., 2099
|
||
'GGGG': function (date) {
|
||
return getUTCISOWeekYear(date)
|
||
},
|
||
|
||
// Hour: 0, 1, ... 23
|
||
'H': function (date) {
|
||
return date.getUTCHours()
|
||
},
|
||
|
||
// Hour: 00, 01, ..., 23
|
||
'HH': function (date) {
|
||
return addLeadingZeros(date.getUTCHours(), 2)
|
||
},
|
||
|
||
// Hour: 1, 2, ..., 12
|
||
'h': function (date) {
|
||
var hours = date.getUTCHours();
|
||
if (hours === 0) {
|
||
return 12
|
||
} else if (hours > 12) {
|
||
return hours % 12
|
||
} else {
|
||
return hours
|
||
}
|
||
},
|
||
|
||
// Hour: 01, 02, ..., 12
|
||
'hh': function (date) {
|
||
return addLeadingZeros(formatters['h'](date), 2)
|
||
},
|
||
|
||
// Minute: 0, 1, ..., 59
|
||
'm': function (date) {
|
||
return date.getUTCMinutes()
|
||
},
|
||
|
||
// Minute: 00, 01, ..., 59
|
||
'mm': function (date) {
|
||
return addLeadingZeros(date.getUTCMinutes(), 2)
|
||
},
|
||
|
||
// Second: 0, 1, ..., 59
|
||
's': function (date) {
|
||
return date.getUTCSeconds()
|
||
},
|
||
|
||
// Second: 00, 01, ..., 59
|
||
'ss': function (date) {
|
||
return addLeadingZeros(date.getUTCSeconds(), 2)
|
||
},
|
||
|
||
// 1/10 of second: 0, 1, ..., 9
|
||
'S': function (date) {
|
||
return Math.floor(date.getUTCMilliseconds() / 100)
|
||
},
|
||
|
||
// 1/100 of second: 00, 01, ..., 99
|
||
'SS': function (date) {
|
||
return addLeadingZeros(Math.floor(date.getUTCMilliseconds() / 10), 2)
|
||
},
|
||
|
||
// Millisecond: 000, 001, ..., 999
|
||
'SSS': function (date) {
|
||
return addLeadingZeros(date.getUTCMilliseconds(), 3)
|
||
},
|
||
|
||
// Timezone: -01:00, +00:00, ... +12:00
|
||
'Z': function (date, options) {
|
||
var originalDate = options._originalDate || date;
|
||
return formatTimezone(originalDate.getTimezoneOffset(), ':')
|
||
},
|
||
|
||
// Timezone: -0100, +0000, ... +1200
|
||
'ZZ': function (date, options) {
|
||
var originalDate = options._originalDate || date;
|
||
return formatTimezone(originalDate.getTimezoneOffset())
|
||
},
|
||
|
||
// Seconds timestamp: 512969520
|
||
'X': function (date, options) {
|
||
var originalDate = options._originalDate || date;
|
||
return Math.floor(originalDate.getTime() / 1000)
|
||
},
|
||
|
||
// Milliseconds timestamp: 512969520900
|
||
'x': function (date, options) {
|
||
var originalDate = options._originalDate || date;
|
||
return originalDate.getTime()
|
||
},
|
||
|
||
// AM, PM
|
||
'A': function (date, options) {
|
||
return options.locale.localize.timeOfDay(date.getUTCHours(), {type: 'uppercase'})
|
||
},
|
||
|
||
// am, pm
|
||
'a': function (date, options) {
|
||
return options.locale.localize.timeOfDay(date.getUTCHours(), {type: 'lowercase'})
|
||
},
|
||
|
||
// a.m., p.m.
|
||
'aa': function (date, options) {
|
||
return options.locale.localize.timeOfDay(date.getUTCHours(), {type: 'long'})
|
||
}
|
||
};
|
||
|
||
function formatTimezone (offset, delimeter) {
|
||
delimeter = delimeter || '';
|
||
var sign = offset > 0 ? '-' : '+';
|
||
var absOffset = Math.abs(offset);
|
||
var hours = Math.floor(absOffset / 60);
|
||
var minutes = absOffset % 60;
|
||
return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2)
|
||
}
|
||
|
||
function addLeadingZeros (number, targetLength) {
|
||
var output = Math.abs(number).toString();
|
||
while (output.length < targetLength) {
|
||
output = '0' + output;
|
||
}
|
||
return output
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function addUTCMinutes (dirtyDate, dirtyAmount, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var amount = Number(dirtyAmount);
|
||
date.setUTCMinutes(date.getUTCMinutes() + amount);
|
||
return date
|
||
}
|
||
|
||
var longFormattingTokensRegExp = /(\[[^[]*])|(\\)?(LTS|LT|LLLL|LLL|LL|L|llll|lll|ll|l)/g;
|
||
var defaultFormattingTokensRegExp = /(\[[^[]*])|(\\)?(x|ss|s|mm|m|hh|h|do|dddd|ddd|dd|d|aa|a|ZZ|Z|YYYY|YY|X|Wo|WW|W|SSS|SS|S|Qo|Q|Mo|MMMM|MMM|MM|M|HH|H|GGGG|GG|E|Do|DDDo|DDDD|DDD|DD|D|A|.)/g;
|
||
|
||
/**
|
||
* @name format
|
||
* @category Common Helpers
|
||
* @summary Format the date.
|
||
*
|
||
* @description
|
||
* Return the formatted date string in the given format.
|
||
*
|
||
* Accepted tokens:
|
||
* | Unit | Token | Result examples |
|
||
* |-------------------------|-------|----------------------------------|
|
||
* | Month | M | 1, 2, ..., 12 |
|
||
* | | Mo | 1st, 2nd, ..., 12th |
|
||
* | | MM | 01, 02, ..., 12 |
|
||
* | | MMM | Jan, Feb, ..., Dec |
|
||
* | | MMMM | January, February, ..., December |
|
||
* | Quarter | Q | 1, 2, 3, 4 |
|
||
* | | Qo | 1st, 2nd, 3rd, 4th |
|
||
* | Day of month | D | 1, 2, ..., 31 |
|
||
* | | Do | 1st, 2nd, ..., 31st |
|
||
* | | DD | 01, 02, ..., 31 |
|
||
* | Day of year | DDD | 1, 2, ..., 366 |
|
||
* | | DDDo | 1st, 2nd, ..., 366th |
|
||
* | | DDDD | 001, 002, ..., 366 |
|
||
* | Day of week | d | 0, 1, ..., 6 |
|
||
* | | do | 0th, 1st, ..., 6th |
|
||
* | | dd | Su, Mo, ..., Sa |
|
||
* | | ddd | Sun, Mon, ..., Sat |
|
||
* | | dddd | Sunday, Monday, ..., Saturday |
|
||
* | Day of ISO week | E | 1, 2, ..., 7 |
|
||
* | ISO week | W | 1, 2, ..., 53 |
|
||
* | | Wo | 1st, 2nd, ..., 53rd |
|
||
* | | WW | 01, 02, ..., 53 |
|
||
* | Year | YY | 00, 01, ..., 99 |
|
||
* | | YYYY | 1900, 1901, ..., 2099 |
|
||
* | ISO week-numbering year | GG | 00, 01, ..., 99 |
|
||
* | | GGGG | 1900, 1901, ..., 2099 |
|
||
* | AM/PM | A | AM, PM |
|
||
* | | a | am, pm |
|
||
* | | aa | a.m., p.m. |
|
||
* | Hour | H | 0, 1, ... 23 |
|
||
* | | HH | 00, 01, ... 23 |
|
||
* | | h | 1, 2, ..., 12 |
|
||
* | | hh | 01, 02, ..., 12 |
|
||
* | Minute | m | 0, 1, ..., 59 |
|
||
* | | mm | 00, 01, ..., 59 |
|
||
* | Second | s | 0, 1, ..., 59 |
|
||
* | | ss | 00, 01, ..., 59 |
|
||
* | 1/10 of second | S | 0, 1, ..., 9 |
|
||
* | 1/100 of second | SS | 00, 01, ..., 99 |
|
||
* | Millisecond | SSS | 000, 001, ..., 999 |
|
||
* | Timezone | Z | -01:00, +00:00, ... +12:00 |
|
||
* | | ZZ | -0100, +0000, ..., +1200 |
|
||
* | Seconds timestamp | X | 512969520 |
|
||
* | Milliseconds timestamp | x | 512969520900 |
|
||
* | Long format | LT | 05:30 a.m. |
|
||
* | | LTS | 05:30:15 a.m. |
|
||
* | | L | 07/02/1995 |
|
||
* | | l | 7/2/1995 |
|
||
* | | LL | July 2 1995 |
|
||
* | | ll | Jul 2 1995 |
|
||
* | | LLL | July 2 1995 05:30 a.m. |
|
||
* | | lll | Jul 2 1995 05:30 a.m. |
|
||
* | | LLLL | Sunday, July 2 1995 05:30 a.m. |
|
||
* | | llll | Sun, Jul 2 1995 05:30 a.m. |
|
||
*
|
||
* The characters wrapped in square brackets are escaped.
|
||
*
|
||
* The result may vary by locale.
|
||
*
|
||
* @param {Date|String|Number} date - the original date
|
||
* @param {String} format - the string of tokens
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
||
* @returns {String} the formatted date string
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
* @throws {RangeError} `options.locale` must contain `localize` property
|
||
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
||
*
|
||
* @example
|
||
* // Represent 11 February 2014 in middle-endian format:
|
||
* var result = format(
|
||
* new Date(2014, 1, 11),
|
||
* 'MM/DD/YYYY'
|
||
* )
|
||
* //=> '02/11/2014'
|
||
*
|
||
* @example
|
||
* // Represent 2 July 2014 in Esperanto:
|
||
* import { eoLocale } from 'date-fns/locale/eo'
|
||
* var result = format(
|
||
* new Date(2014, 6, 2),
|
||
* 'Do [de] MMMM YYYY',
|
||
* {locale: eoLocale}
|
||
* )
|
||
* //=> '2-a de julio 2014'
|
||
*/
|
||
function format (dirtyDate, dirtyFormatStr, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var formatStr = String(dirtyFormatStr);
|
||
var options = dirtyOptions || {};
|
||
|
||
var locale$$1 = options.locale || locale;
|
||
|
||
if (!locale$$1.localize) {
|
||
throw new RangeError('locale must contain localize property')
|
||
}
|
||
|
||
if (!locale$$1.formatLong) {
|
||
throw new RangeError('locale must contain formatLong property')
|
||
}
|
||
|
||
var localeFormatters = locale$$1.formatters || {};
|
||
var formattingTokensRegExp = locale$$1.formattingTokensRegExp || defaultFormattingTokensRegExp;
|
||
var formatLong = locale$$1.formatLong;
|
||
|
||
var originalDate = toDate(dirtyDate, options);
|
||
|
||
if (!isValid(originalDate, options)) {
|
||
return 'Invalid Date'
|
||
}
|
||
|
||
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
||
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
||
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
||
var timezoneOffset = originalDate.getTimezoneOffset();
|
||
var utcDate = addUTCMinutes(originalDate, -timezoneOffset, options);
|
||
|
||
var formatterOptions = cloneObject(options);
|
||
formatterOptions.locale = locale$$1;
|
||
formatterOptions.formatters = formatters;
|
||
|
||
// When UTC functions will be implemented, options._originalDate will likely be a part of public API.
|
||
// Right now, please don't use it in locales. If you have to use an original date,
|
||
// please restore it from `date`, adding a timezone offset to it.
|
||
formatterOptions._originalDate = originalDate;
|
||
|
||
var result = formatStr
|
||
.replace(longFormattingTokensRegExp, function (substring) {
|
||
if (substring[0] === '[') {
|
||
return substring
|
||
}
|
||
|
||
if (substring[0] === '\\') {
|
||
return cleanEscapedString(substring)
|
||
}
|
||
|
||
return formatLong(substring)
|
||
})
|
||
.replace(formattingTokensRegExp, function (substring) {
|
||
var formatter = localeFormatters[substring] || formatters[substring];
|
||
|
||
if (formatter) {
|
||
return formatter(utcDate, formatterOptions)
|
||
} else {
|
||
return cleanEscapedString(substring)
|
||
}
|
||
});
|
||
|
||
return result
|
||
}
|
||
|
||
function cleanEscapedString (input) {
|
||
if (input.match(/\[[\s\S]/)) {
|
||
return input.replace(/^\[|]$/g, '')
|
||
}
|
||
return input.replace(/\\/g, '')
|
||
}
|
||
|
||
/**
|
||
* @name subMinutes
|
||
* @category Minute Helpers
|
||
* @summary Subtract the specified number of minutes from the given date.
|
||
*
|
||
* @description
|
||
* Subtract the specified number of minutes from the given date.
|
||
*
|
||
* @param {Date|String|Number} date - the date to be changed
|
||
* @param {Number} amount - the amount of minutes to be subtracted
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Date} the new date with the mintues subtracted
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Subtract 30 minutes from 10 July 2014 12:00:00:
|
||
* var result = subMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
||
* //=> Thu Jul 10 2014 11:30:00
|
||
*/
|
||
function subMinutes (dirtyDate, dirtyAmount, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var amount = Number(dirtyAmount);
|
||
return addMinutes(dirtyDate, -amount, dirtyOptions)
|
||
}
|
||
|
||
/**
|
||
* @name isAfter
|
||
* @category Common Helpers
|
||
* @summary Is the first date after the second one?
|
||
*
|
||
* @description
|
||
* Is the first date after the second one?
|
||
*
|
||
* @param {Date|String|Number} date - the date that should be after the other one to return true
|
||
* @param {Date|String|Number} dateToCompare - the date to compare with
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Boolean} the first date is after the second date
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Is 10 July 1989 after 11 February 1987?
|
||
* var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
||
* //=> true
|
||
*/
|
||
function isAfter (dirtyDate, dirtyDateToCompare, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);
|
||
return date.getTime() > dateToCompare.getTime()
|
||
}
|
||
|
||
/**
|
||
* @name isBefore
|
||
* @category Common Helpers
|
||
* @summary Is the first date before the second one?
|
||
*
|
||
* @description
|
||
* Is the first date before the second one?
|
||
*
|
||
* @param {Date|String|Number} date - the date that should be before the other one to return true
|
||
* @param {Date|String|Number} dateToCompare - the date to compare with
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Boolean} the first date is before the second date
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Is 10 July 1989 before 11 February 1987?
|
||
* var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
||
* //=> false
|
||
*/
|
||
function isBefore (dirtyDate, dirtyDateToCompare, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);
|
||
return date.getTime() < dateToCompare.getTime()
|
||
}
|
||
|
||
/**
|
||
* @name isEqual
|
||
* @category Common Helpers
|
||
* @summary Are the given dates equal?
|
||
*
|
||
* @description
|
||
* Are the given dates equal?
|
||
*
|
||
* @param {Date|String|Number} dateLeft - the first date to compare
|
||
* @param {Date|String|Number} dateRight - the second date to compare
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @returns {Boolean} the dates are equal
|
||
* @throws {TypeError} 2 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
*
|
||
* @example
|
||
* // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
|
||
* var result = isEqual(
|
||
* new Date(2014, 6, 2, 6, 30, 45, 0)
|
||
* new Date(2014, 6, 2, 6, 30, 45, 500)
|
||
* )
|
||
* //=> false
|
||
*/
|
||
function isEqual (dirtyLeftDate, dirtyRightDate, dirtyOptions) {
|
||
if (arguments.length < 2) {
|
||
throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var dateLeft = toDate(dirtyLeftDate, dirtyOptions);
|
||
var dateRight = toDate(dirtyRightDate, dirtyOptions);
|
||
return dateLeft.getTime() === dateRight.getTime()
|
||
}
|
||
|
||
var patterns$1 = {
|
||
'M': /^(1[0-2]|0?\d)/, // 0 to 12
|
||
'D': /^(3[0-1]|[0-2]?\d)/, // 0 to 31
|
||
'DDD': /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, // 0 to 366
|
||
'W': /^(5[0-3]|[0-4]?\d)/, // 0 to 53
|
||
'YYYY': /^(\d{1,4})/, // 0 to 9999
|
||
'H': /^(2[0-3]|[0-1]?\d)/, // 0 to 23
|
||
'm': /^([0-5]?\d)/, // 0 to 59
|
||
'Z': /^([+-])(\d{2}):(\d{2})/,
|
||
'ZZ': /^([+-])(\d{2})(\d{2})/,
|
||
singleDigit: /^(\d)/,
|
||
twoDigits: /^(\d{2})/,
|
||
threeDigits: /^(\d{3})/,
|
||
fourDigits: /^(\d{4})/,
|
||
anyDigits: /^(\d+)/
|
||
};
|
||
|
||
function parseDecimal$1 (matchResult) {
|
||
return parseInt(matchResult[1], 10)
|
||
}
|
||
|
||
var parsers = {
|
||
// Year: 00, 01, ..., 99
|
||
'YY': {
|
||
unit: 'twoDigitYear',
|
||
match: patterns$1.twoDigits,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult)
|
||
}
|
||
},
|
||
|
||
// Year: 1900, 1901, ..., 2099
|
||
'YYYY': {
|
||
unit: 'year',
|
||
match: patterns$1.YYYY,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// ISO week-numbering year: 00, 01, ..., 99
|
||
'GG': {
|
||
unit: 'isoYear',
|
||
match: patterns$1.twoDigits,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) + 1900
|
||
}
|
||
},
|
||
|
||
// ISO week-numbering year: 1900, 1901, ..., 2099
|
||
'GGGG': {
|
||
unit: 'isoYear',
|
||
match: patterns$1.YYYY,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Quarter: 1, 2, 3, 4
|
||
'Q': {
|
||
unit: 'quarter',
|
||
match: patterns$1.singleDigit,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Ordinal quarter
|
||
'Qo': {
|
||
unit: 'quarter',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'quarter'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'quarter'})
|
||
}
|
||
},
|
||
|
||
// Month: 1, 2, ..., 12
|
||
'M': {
|
||
unit: 'month',
|
||
match: patterns$1.M,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) - 1
|
||
}
|
||
},
|
||
|
||
// Ordinal month
|
||
'Mo': {
|
||
unit: 'month',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'month'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'month'}) - 1
|
||
}
|
||
},
|
||
|
||
// Month: 01, 02, ..., 12
|
||
'MM': {
|
||
unit: 'month',
|
||
match: patterns$1.twoDigits,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) - 1
|
||
}
|
||
},
|
||
|
||
// Month: Jan, Feb, ..., Dec
|
||
'MMM': {
|
||
unit: 'month',
|
||
match: function (string, options) {
|
||
return options.locale.match.months(string, {type: 'short'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.month(matchResult, {type: 'short'})
|
||
}
|
||
},
|
||
|
||
// Month: January, February, ..., December
|
||
'MMMM': {
|
||
unit: 'month',
|
||
match: function (string, options) {
|
||
return options.locale.match.months(string, {type: 'long'}) ||
|
||
options.locale.match.months(string, {type: 'short'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
var parseResult = options.locale.match.month(matchResult, {type: 'long'});
|
||
|
||
if (parseResult == null) {
|
||
parseResult = options.locale.match.month(matchResult, {type: 'short'});
|
||
}
|
||
|
||
return parseResult
|
||
}
|
||
},
|
||
|
||
// ISO week: 1, 2, ..., 53
|
||
'W': {
|
||
unit: 'isoWeek',
|
||
match: patterns$1.W,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Ordinal ISO week
|
||
'Wo': {
|
||
unit: 'isoWeek',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'isoWeek'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'isoWeek'})
|
||
}
|
||
},
|
||
|
||
// ISO week: 01, 02, ..., 53
|
||
'WW': {
|
||
unit: 'isoWeek',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Day of week: 0, 1, ..., 6
|
||
'd': {
|
||
unit: 'dayOfWeek',
|
||
match: patterns$1.singleDigit,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Ordinal day of week
|
||
'do': {
|
||
unit: 'dayOfWeek',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'dayOfWeek'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'dayOfWeek'})
|
||
}
|
||
},
|
||
|
||
// Day of week: Su, Mo, ..., Sa
|
||
'dd': {
|
||
unit: 'dayOfWeek',
|
||
match: function (string, options) {
|
||
return options.locale.match.weekdays(string, {type: 'narrow'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.weekday(matchResult, {type: 'narrow'})
|
||
}
|
||
},
|
||
|
||
// Day of week: Sun, Mon, ..., Sat
|
||
'ddd': {
|
||
unit: 'dayOfWeek',
|
||
match: function (string, options) {
|
||
return options.locale.match.weekdays(string, {type: 'short'}) ||
|
||
options.locale.match.weekdays(string, {type: 'narrow'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
var parseResult = options.locale.match.weekday(matchResult, {type: 'short'});
|
||
|
||
if (parseResult == null) {
|
||
parseResult = options.locale.match.weekday(matchResult, {type: 'narrow'});
|
||
}
|
||
|
||
return parseResult
|
||
}
|
||
},
|
||
|
||
// Day of week: Sunday, Monday, ..., Saturday
|
||
'dddd': {
|
||
unit: 'dayOfWeek',
|
||
match: function (string, options) {
|
||
return options.locale.match.weekdays(string, {type: 'long'}) ||
|
||
options.locale.match.weekdays(string, {type: 'short'}) ||
|
||
options.locale.match.weekdays(string, {type: 'narrow'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
var parseResult = options.locale.match.weekday(matchResult, {type: 'long'});
|
||
|
||
if (parseResult == null) {
|
||
parseResult = options.locale.match.weekday(matchResult, {type: 'short'});
|
||
|
||
if (parseResult == null) {
|
||
parseResult = options.locale.match.weekday(matchResult, {type: 'narrow'});
|
||
}
|
||
}
|
||
|
||
return parseResult
|
||
}
|
||
},
|
||
|
||
// Day of ISO week: 1, 2, ..., 7
|
||
'E': {
|
||
unit: 'dayOfISOWeek',
|
||
match: patterns$1.singleDigit,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult)
|
||
}
|
||
},
|
||
|
||
// Day of month: 1, 2, ..., 31
|
||
'D': {
|
||
unit: 'dayOfMonth',
|
||
match: patterns$1.D,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Ordinal day of month
|
||
'Do': {
|
||
unit: 'dayOfMonth',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'dayOfMonth'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'dayOfMonth'})
|
||
}
|
||
},
|
||
|
||
// Day of month: 01, 02, ..., 31
|
||
'DD': {
|
||
unit: 'dayOfMonth',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Day of year: 1, 2, ..., 366
|
||
'DDD': {
|
||
unit: 'dayOfYear',
|
||
match: patterns$1.DDD,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Ordinal day of year
|
||
'DDDo': {
|
||
unit: 'dayOfYear',
|
||
match: function (string, options) {
|
||
return options.locale.match.ordinalNumbers(string, {unit: 'dayOfYear'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.ordinalNumber(matchResult, {unit: 'dayOfYear'})
|
||
}
|
||
},
|
||
|
||
// Day of year: 001, 002, ..., 366
|
||
'DDDD': {
|
||
unit: 'dayOfYear',
|
||
match: patterns$1.threeDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// AM, PM
|
||
'A': {
|
||
unit: 'timeOfDay',
|
||
match: function (string, options) {
|
||
return options.locale.match.timesOfDay(string, {type: 'short'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
return options.locale.match.timeOfDay(matchResult, {type: 'short'})
|
||
}
|
||
},
|
||
|
||
// a.m., p.m.
|
||
'aa': {
|
||
unit: 'timeOfDay',
|
||
match: function (string, options) {
|
||
return options.locale.match.timesOfDay(string, {type: 'long'}) ||
|
||
options.locale.match.timesOfDay(string, {type: 'short'})
|
||
},
|
||
parse: function (matchResult, options) {
|
||
var parseResult = options.locale.match.timeOfDay(matchResult, {type: 'long'});
|
||
|
||
if (parseResult == null) {
|
||
parseResult = options.locale.match.timeOfDay(matchResult, {type: 'short'});
|
||
}
|
||
|
||
return parseResult
|
||
}
|
||
},
|
||
|
||
// Hour: 0, 1, ... 23
|
||
'H': {
|
||
unit: 'hours',
|
||
match: patterns$1.H,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Hour: 00, 01, ..., 23
|
||
'HH': {
|
||
unit: 'hours',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Hour: 1, 2, ..., 12
|
||
'h': {
|
||
unit: 'timeOfDayHours',
|
||
match: patterns$1.M,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Hour: 01, 02, ..., 12
|
||
'hh': {
|
||
unit: 'timeOfDayHours',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Minute: 0, 1, ..., 59
|
||
'm': {
|
||
unit: 'minutes',
|
||
match: patterns$1.m,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Minute: 00, 01, ..., 59
|
||
'mm': {
|
||
unit: 'minutes',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Second: 0, 1, ..., 59
|
||
's': {
|
||
unit: 'seconds',
|
||
match: patterns$1.m,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Second: 00, 01, ..., 59
|
||
'ss': {
|
||
unit: 'seconds',
|
||
match: patterns$1.twoDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// 1/10 of second: 0, 1, ..., 9
|
||
'S': {
|
||
unit: 'milliseconds',
|
||
match: patterns$1.singleDigit,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) * 100
|
||
}
|
||
},
|
||
|
||
// 1/100 of second: 00, 01, ..., 99
|
||
'SS': {
|
||
unit: 'milliseconds',
|
||
match: patterns$1.twoDigits,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) * 10
|
||
}
|
||
},
|
||
|
||
// Millisecond: 000, 001, ..., 999
|
||
'SSS': {
|
||
unit: 'milliseconds',
|
||
match: patterns$1.threeDigits,
|
||
parse: parseDecimal$1
|
||
},
|
||
|
||
// Timezone: -01:00, +00:00, ... +12:00
|
||
'Z': {
|
||
unit: 'timezone',
|
||
match: patterns$1.Z,
|
||
parse: function (matchResult) {
|
||
var sign = matchResult[1];
|
||
var hours = parseInt(matchResult[2], 10);
|
||
var minutes = parseInt(matchResult[3], 10);
|
||
var absoluteOffset = hours * 60 + minutes;
|
||
return (sign === '+') ? absoluteOffset : -absoluteOffset
|
||
}
|
||
},
|
||
|
||
// Timezone: -0100, +0000, ... +1200
|
||
'ZZ': {
|
||
unit: 'timezone',
|
||
match: patterns$1.ZZ,
|
||
parse: function (matchResult) {
|
||
var sign = matchResult[1];
|
||
var hours = parseInt(matchResult[2], 10);
|
||
var minutes = parseInt(matchResult[3], 10);
|
||
var absoluteOffset = hours * 60 + minutes;
|
||
return (sign === '+') ? absoluteOffset : -absoluteOffset
|
||
}
|
||
},
|
||
|
||
// Seconds timestamp: 512969520
|
||
'X': {
|
||
unit: 'timestamp',
|
||
match: patterns$1.anyDigits,
|
||
parse: function (matchResult) {
|
||
return parseDecimal$1(matchResult) * 1000
|
||
}
|
||
},
|
||
|
||
// Milliseconds timestamp: 512969520900
|
||
'x': {
|
||
unit: 'timestamp',
|
||
match: patterns$1.anyDigits,
|
||
parse: parseDecimal$1
|
||
}
|
||
};
|
||
|
||
parsers['a'] = parsers['A'];
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function setUTCDay (dirtyDate, dirtyDay, dirtyOptions) {
|
||
var options = dirtyOptions || {};
|
||
var locale = options.locale;
|
||
var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
|
||
var defaultWeekStartsOn = localeWeekStartsOn === undefined ? 0 : Number(localeWeekStartsOn);
|
||
var weekStartsOn = options.weekStartsOn === undefined ? defaultWeekStartsOn : Number(options.weekStartsOn);
|
||
|
||
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
||
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
||
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')
|
||
}
|
||
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var day = Number(dirtyDay);
|
||
|
||
var currentDay = date.getUTCDay();
|
||
|
||
var remainder = day % 7;
|
||
var dayIndex = (remainder + 7) % 7;
|
||
|
||
var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
|
||
|
||
date.setUTCDate(date.getUTCDate() + diff);
|
||
return date
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {
|
||
var day = Number(dirtyDay);
|
||
|
||
if (day % 7 === 0) {
|
||
day = day - 7;
|
||
}
|
||
|
||
var weekStartsOn = 1;
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var currentDay = date.getUTCDay();
|
||
|
||
var remainder = day % 7;
|
||
var dayIndex = (remainder + 7) % 7;
|
||
|
||
var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
|
||
|
||
date.setUTCDate(date.getUTCDate() + diff);
|
||
return date
|
||
}
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function setUTCISOWeek (dirtyDate, dirtyISOWeek, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var isoWeek = Number(dirtyISOWeek);
|
||
var diff = getUTCISOWeek(date, dirtyOptions) - isoWeek;
|
||
date.setUTCDate(date.getUTCDate() - diff * 7);
|
||
return date
|
||
}
|
||
|
||
var MILLISECONDS_IN_DAY$3 = 86400000;
|
||
|
||
// This function will be a part of public API when UTC function will be implemented.
|
||
// See issue: https://github.com/date-fns/date-fns/issues/376
|
||
function setUTCISOWeekYear (dirtyDate, dirtyISOYear, dirtyOptions) {
|
||
var date = toDate(dirtyDate, dirtyOptions);
|
||
var isoYear = Number(dirtyISOYear);
|
||
var dateStartOfYear = startOfUTCISOWeekYear(date, dirtyOptions);
|
||
var diff = Math.floor((date.getTime() - dateStartOfYear.getTime()) / MILLISECONDS_IN_DAY$3);
|
||
var fourthOfJanuary = new Date(0);
|
||
fourthOfJanuary.setUTCFullYear(isoYear, 0, 4);
|
||
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
||
date = startOfUTCISOWeekYear(fourthOfJanuary, dirtyOptions);
|
||
date.setUTCDate(date.getUTCDate() + diff);
|
||
return date
|
||
}
|
||
|
||
var MILLISECONDS_IN_MINUTE$6 = 60000;
|
||
|
||
function setTimeOfDay (hours, timeOfDay) {
|
||
var isAM = timeOfDay === 0;
|
||
|
||
if (isAM) {
|
||
if (hours === 12) {
|
||
return 0
|
||
}
|
||
} else {
|
||
if (hours !== 12) {
|
||
return 12 + hours
|
||
}
|
||
}
|
||
|
||
return hours
|
||
}
|
||
|
||
var units = {
|
||
twoDigitYear: {
|
||
priority: 10,
|
||
set: function (dateValues, value) {
|
||
var century = Math.floor(dateValues.date.getUTCFullYear() / 100);
|
||
var year = century * 100 + value;
|
||
dateValues.date.setUTCFullYear(year, 0, 1);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
year: {
|
||
priority: 10,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCFullYear(value, 0, 1);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
isoYear: {
|
||
priority: 10,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.date = startOfUTCISOWeekYear(setUTCISOWeekYear(dateValues.date, value, options), options);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
quarter: {
|
||
priority: 20,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCMonth((value - 1) * 3, 1);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
month: {
|
||
priority: 30,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCMonth(value, 1);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
isoWeek: {
|
||
priority: 40,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.date = startOfUTCISOWeek(setUTCISOWeek(dateValues.date, value, options), options);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
dayOfWeek: {
|
||
priority: 50,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.date = setUTCDay(dateValues.date, value, options);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
dayOfISOWeek: {
|
||
priority: 50,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.date = setUTCISODay(dateValues.date, value, options);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
dayOfMonth: {
|
||
priority: 50,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCDate(value);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
dayOfYear: {
|
||
priority: 50,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCMonth(0, value);
|
||
dateValues.date.setUTCHours(0, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
timeOfDay: {
|
||
priority: 60,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.timeOfDay = value;
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
hours: {
|
||
priority: 70,
|
||
set: function (dateValues, value, options) {
|
||
dateValues.date.setUTCHours(value, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
timeOfDayHours: {
|
||
priority: 70,
|
||
set: function (dateValues, value, options) {
|
||
var timeOfDay = dateValues.timeOfDay;
|
||
if (timeOfDay != null) {
|
||
value = setTimeOfDay(value, timeOfDay);
|
||
}
|
||
dateValues.date.setUTCHours(value, 0, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
minutes: {
|
||
priority: 80,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCMinutes(value, 0, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
seconds: {
|
||
priority: 90,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCSeconds(value, 0);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
milliseconds: {
|
||
priority: 100,
|
||
set: function (dateValues, value) {
|
||
dateValues.date.setUTCMilliseconds(value);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
timezone: {
|
||
priority: 110,
|
||
set: function (dateValues, value) {
|
||
dateValues.date = new Date(dateValues.date.getTime() - value * MILLISECONDS_IN_MINUTE$6);
|
||
return dateValues
|
||
}
|
||
},
|
||
|
||
timestamp: {
|
||
priority: 120,
|
||
set: function (dateValues, value) {
|
||
dateValues.date = new Date(value);
|
||
return dateValues
|
||
}
|
||
}
|
||
};
|
||
|
||
var TIMEZONE_UNIT_PRIORITY = 110;
|
||
var MILLISECONDS_IN_MINUTE$7 = 60000;
|
||
|
||
var longFormattingTokensRegExp$1 = /(\[[^[]*])|(\\)?(LTS|LT|LLLL|LLL|LL|L|llll|lll|ll|l)/g;
|
||
var defaultParsingTokensRegExp = /(\[[^[]*])|(\\)?(x|ss|s|mm|m|hh|h|do|dddd|ddd|dd|d|aa|a|ZZ|Z|YYYY|YY|X|Wo|WW|W|SSS|SS|S|Qo|Q|Mo|MMMM|MMM|MM|M|HH|H|GGGG|GG|E|Do|DDDo|DDDD|DDD|DD|D|A|.)/g;
|
||
|
||
/**
|
||
* @name parse
|
||
* @category Common Helpers
|
||
* @summary Parse the date.
|
||
*
|
||
* @description
|
||
* Return the date parsed from string using the given format.
|
||
*
|
||
* Accepted format tokens:
|
||
* | Unit | Priority | Token | Input examples |
|
||
* |-------------------------|----------|-------|----------------------------------|
|
||
* | Year | 10 | YY | 00, 01, ..., 99 |
|
||
* | | | YYYY | 1900, 1901, ..., 2099 |
|
||
* | ISO week-numbering year | 10 | GG | 00, 01, ..., 99 |
|
||
* | | | GGGG | 1900, 1901, ..., 2099 |
|
||
* | Quarter | 20 | Q | 1, 2, 3, 4 |
|
||
* | | | Qo | 1st, 2nd, 3rd, 4th |
|
||
* | Month | 30 | M | 1, 2, ..., 12 |
|
||
* | | | Mo | 1st, 2nd, ..., 12th |
|
||
* | | | MM | 01, 02, ..., 12 |
|
||
* | | | MMM | Jan, Feb, ..., Dec |
|
||
* | | | MMMM | January, February, ..., December |
|
||
* | ISO week | 40 | W | 1, 2, ..., 53 |
|
||
* | | | Wo | 1st, 2nd, ..., 53rd |
|
||
* | | | WW | 01, 02, ..., 53 |
|
||
* | Day of week | 50 | d | 0, 1, ..., 6 |
|
||
* | | | do | 0th, 1st, ..., 6th |
|
||
* | | | dd | Su, Mo, ..., Sa |
|
||
* | | | ddd | Sun, Mon, ..., Sat |
|
||
* | | | dddd | Sunday, Monday, ..., Saturday |
|
||
* | Day of ISO week | 50 | E | 1, 2, ..., 7 |
|
||
* | Day of month | 50 | D | 1, 2, ..., 31 |
|
||
* | | | Do | 1st, 2nd, ..., 31st |
|
||
* | | | DD | 01, 02, ..., 31 |
|
||
* | Day of year | 50 | DDD | 1, 2, ..., 366 |
|
||
* | | | DDDo | 1st, 2nd, ..., 366th |
|
||
* | | | DDDD | 001, 002, ..., 366 |
|
||
* | Time of day | 60 | A | AM, PM |
|
||
* | | | a | am, pm |
|
||
* | | | aa | a.m., p.m. |
|
||
* | Hour | 70 | H | 0, 1, ... 23 |
|
||
* | | | HH | 00, 01, ... 23 |
|
||
* | Time of day hour | 70 | h | 1, 2, ..., 12 |
|
||
* | | | hh | 01, 02, ..., 12 |
|
||
* | Minute | 80 | m | 0, 1, ..., 59 |
|
||
* | | | mm | 00, 01, ..., 59 |
|
||
* | Second | 90 | s | 0, 1, ..., 59 |
|
||
* | | | ss | 00, 01, ..., 59 |
|
||
* | 1/10 of second | 100 | S | 0, 1, ..., 9 |
|
||
* | 1/100 of second | 100 | SS | 00, 01, ..., 99 |
|
||
* | Millisecond | 100 | SSS | 000, 001, ..., 999 |
|
||
* | Timezone | 110 | Z | -01:00, +00:00, ... +12:00 |
|
||
* | | | ZZ | -0100, +0000, ..., +1200 |
|
||
* | Seconds timestamp | 120 | X | 512969520 |
|
||
* | Milliseconds timestamp | 120 | x | 512969520900 |
|
||
*
|
||
* Values will be assigned to the date in the ascending order of its unit's priority.
|
||
* Units of an equal priority overwrite each other in the order of appearance.
|
||
*
|
||
* If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
|
||
* the values will be taken from 3rd argument `baseDate` which works as a context of parsing.
|
||
*
|
||
* `baseDate` must be passed for correct work of the function.
|
||
* If you're not sure which `baseDate` to supply, create a new instance of Date:
|
||
* `parse('02/11/2014', 'MM/DD/YYYY', new Date())`
|
||
* In this case parsing will be done in the context of the current date.
|
||
* If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`,
|
||
* then `Invalid Date` will be returned.
|
||
*
|
||
* Also, `parse` unfolds long formats like those in [format]{@link https://date-fns.org/docs/format}:
|
||
* | Token | Input examples |
|
||
* |-------|--------------------------------|
|
||
* | LT | 05:30 a.m. |
|
||
* | LTS | 05:30:15 a.m. |
|
||
* | L | 07/02/1995 |
|
||
* | l | 7/2/1995 |
|
||
* | LL | July 2 1995 |
|
||
* | ll | Jul 2 1995 |
|
||
* | LLL | July 2 1995 05:30 a.m. |
|
||
* | lll | Jul 2 1995 05:30 a.m. |
|
||
* | LLLL | Sunday, July 2 1995 05:30 a.m. |
|
||
* | llll | Sun, Jul 2 1995 05:30 a.m. |
|
||
*
|
||
* The characters wrapped in square brackets in the format string are escaped.
|
||
*
|
||
* The result may vary by locale.
|
||
*
|
||
* If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned.
|
||
*
|
||
* If parsing failed, `Invalid Date` will be returned.
|
||
* Invalid Date is a Date, whose time value is NaN.
|
||
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
||
*
|
||
* @param {String} dateString - the string to parse
|
||
* @param {String} formatString - the string of tokens
|
||
* @param {Date|String|Number} baseDate - the date to took the missing higher priority values from
|
||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
|
||
* @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
||
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
||
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
||
* @returns {Date} the parsed date
|
||
* @throws {TypeError} 3 arguments required
|
||
* @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
|
||
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
||
* @throws {RangeError} `options.locale` must contain `match` property
|
||
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
||
*
|
||
* @example
|
||
* // Parse 11 February 2014 from middle-endian format:
|
||
* var result = parse(
|
||
* '02/11/2014',
|
||
* 'MM/DD/YYYY',
|
||
* new Date()
|
||
* )
|
||
* //=> Tue Feb 11 2014 00:00:00
|
||
*
|
||
* @example
|
||
* // Parse 28th of February in English locale in the context of 2010 year:
|
||
* import eoLocale from 'date-fns/locale/eo'
|
||
* var result = parse(
|
||
* '28-a de februaro',
|
||
* 'Do [de] MMMM',
|
||
* new Date(2010, 0, 1)
|
||
* {locale: eoLocale}
|
||
* )
|
||
* //=> Sun Feb 28 2010 00:00:00
|
||
*/
|
||
function parse (dirtyDateString, dirtyFormatString, dirtyBaseDate, dirtyOptions) {
|
||
if (arguments.length < 3) {
|
||
throw new TypeError('3 arguments required, but only ' + arguments.length + ' present')
|
||
}
|
||
|
||
var dateString = String(dirtyDateString);
|
||
var options = dirtyOptions || {};
|
||
|
||
var weekStartsOn = options.weekStartsOn === undefined ? 0 : Number(options.weekStartsOn);
|
||
|
||
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
||
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
||
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')
|
||
}
|
||
|
||
var locale$$1 = options.locale || locale;
|
||
var localeParsers = locale$$1.parsers || {};
|
||
var localeUnits = locale$$1.units || {};
|
||
|
||
if (!locale$$1.match) {
|
||
throw new RangeError('locale must contain match property')
|
||
}
|
||
|
||
if (!locale$$1.formatLong) {
|
||
throw new RangeError('locale must contain formatLong property')
|
||
}
|
||
|
||
var formatString = String(dirtyFormatString)
|
||
.replace(longFormattingTokensRegExp$1, function (substring) {
|
||
if (substring[0] === '[') {
|
||
return substring
|
||
}
|
||
|
||
if (substring[0] === '\\') {
|
||
return cleanEscapedString$1(substring)
|
||
}
|
||
|
||
return locale$$1.formatLong(substring)
|
||
});
|
||
|
||
if (formatString === '') {
|
||
if (dateString === '') {
|
||
return toDate(dirtyBaseDate, options)
|
||
} else {
|
||
return new Date(NaN)
|
||
}
|
||
}
|
||
|
||
var subFnOptions = cloneObject(options);
|
||
subFnOptions.locale = locale$$1;
|
||
|
||
var tokens = formatString.match(locale$$1.parsingTokensRegExp || defaultParsingTokensRegExp);
|
||
var tokensLength = tokens.length;
|
||
|
||
// If timezone isn't specified, it will be set to the system timezone
|
||
var setters = [{
|
||
priority: TIMEZONE_UNIT_PRIORITY,
|
||
set: dateToSystemTimezone,
|
||
index: 0
|
||
}];
|
||
|
||
var i;
|
||
for (i = 0; i < tokensLength; i++) {
|
||
var token = tokens[i];
|
||
var parser = localeParsers[token] || parsers[token];
|
||
if (parser) {
|
||
var matchResult;
|
||
|
||
if (parser.match instanceof RegExp) {
|
||
matchResult = parser.match.exec(dateString);
|
||
} else {
|
||
matchResult = parser.match(dateString, subFnOptions);
|
||
}
|
||
|
||
if (!matchResult) {
|
||
return new Date(NaN)
|
||
}
|
||
|
||
var unitName = parser.unit;
|
||
var unit = localeUnits[unitName] || units[unitName];
|
||
|
||
setters.push({
|
||
priority: unit.priority,
|
||
set: unit.set,
|
||
value: parser.parse(matchResult, subFnOptions),
|
||
index: setters.length
|
||
});
|
||
|
||
var substring = matchResult[0];
|
||
dateString = dateString.slice(substring.length);
|
||
} else {
|
||
var head = tokens[i].match(/^\[.*]$/) ? tokens[i].replace(/^\[|]$/g, '') : tokens[i];
|
||
if (dateString.indexOf(head) === 0) {
|
||
dateString = dateString.slice(head.length);
|
||
} else {
|
||
return new Date(NaN)
|
||
}
|
||
}
|
||
}
|
||
|
||
var uniquePrioritySetters = setters
|
||
.map(function (setter) {
|
||
return setter.priority
|
||
})
|
||
.sort(function (a, b) {
|
||
return a - b
|
||
})
|
||
.filter(function (priority, index, array) {
|
||
return array.indexOf(priority) === index
|
||
})
|
||
.map(function (priority) {
|
||
return setters
|
||
.filter(function (setter) {
|
||
return setter.priority === priority
|
||
})
|
||
.reverse()
|
||
})
|
||
.map(function (setterArray) {
|
||
return setterArray[0]
|
||
});
|
||
|
||
var date = toDate(dirtyBaseDate, options);
|
||
|
||
if (isNaN(date)) {
|
||
return new Date(NaN)
|
||
}
|
||
|
||
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
||
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
||
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37
|
||
var utcDate = subMinutes(date, date.getTimezoneOffset());
|
||
|
||
var dateValues = {date: utcDate};
|
||
|
||
var settersLength = uniquePrioritySetters.length;
|
||
for (i = 0; i < settersLength; i++) {
|
||
var setter = uniquePrioritySetters[i];
|
||
dateValues = setter.set(dateValues, setter.value, subFnOptions);
|
||
}
|
||
|
||
return dateValues.date
|
||
}
|
||
|
||
function dateToSystemTimezone (dateValues) {
|
||
var date = dateValues.date;
|
||
var time = date.getTime();
|
||
|
||
// Get the system timezone offset at (moment of time - offset)
|
||
var offset = date.getTimezoneOffset();
|
||
|
||
// Get the system timezone offset at the exact moment of time
|
||
offset = new Date(time + offset * MILLISECONDS_IN_MINUTE$7).getTimezoneOffset();
|
||
|
||
// Convert date in timezone "UTC+00:00" to the system timezone
|
||
dateValues.date = new Date(time + offset * MILLISECONDS_IN_MINUTE$7);
|
||
|
||
return dateValues
|
||
}
|
||
|
||
function cleanEscapedString$1 (input) {
|
||
if (input.match(/\[[\s\S]/)) {
|
||
return input.replace(/^\[|]$/g, '')
|
||
}
|
||
return input.replace(/\\/g, '')
|
||
}
|
||
|
||
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.
|
||
|
||
//
|
||
|
||
/**
|
||
* Custom parse behavior on top of date-fns parse function.
|
||
*/
|
||
function parseDate$1 (date, format$$1) {
|
||
if (typeof date !== 'string') {
|
||
return isValid(date) ? date : null;
|
||
}
|
||
|
||
var parsed = parse(date, format$$1, new Date());
|
||
|
||
// if date is not valid or the formatted output after parsing does not match
|
||
// the string value passed in (avoids overflows)
|
||
if (!isValid(parsed) || format(parsed, format$$1) !== date) {
|
||
return null;
|
||
}
|
||
|
||
return parsed;
|
||
}
|
||
|
||
var afterValidator = function (value, ref) {
|
||
var otherValue = ref[0];
|
||
var inclusion = ref[1];
|
||
var format$$1 = ref[2];
|
||
|
||
if (typeof format$$1 === 'undefined') {
|
||
format$$1 = inclusion;
|
||
inclusion = false;
|
||
}
|
||
value = parseDate$1(value, format$$1);
|
||
otherValue = parseDate$1(otherValue, format$$1);
|
||
|
||
// if either is not valid.
|
||
if (!value || !otherValue) {
|
||
return false;
|
||
}
|
||
|
||
return isAfter(value, otherValue) || (inclusion && isEqual(value, otherValue));
|
||
};
|
||
|
||
var options = {
|
||
hasTarget: true,
|
||
isDate: true
|
||
};
|
||
|
||
var after = {
|
||
validate: afterValidator,
|
||
options: options
|
||
};
|
||
|
||
/**
|
||
* Some Alpha Regex helpers.
|
||
* https://github.com/chriso/validator.js/blob/master/src/lib/alpha.js
|
||
*/
|
||
|
||
var alpha = {
|
||
en: /^[A-Z]*$/i,
|
||
cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,
|
||
da: /^[A-ZÆØÅ]*$/i,
|
||
de: /^[A-ZÄÖÜß]*$/i,
|
||
es: /^[A-ZÁÉÍÑÓÚÜ]*$/i,
|
||
fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,
|
||
lt: /^[A-ZĄČĘĖĮŠŲŪŽ]*$/i,
|
||
nl: /^[A-ZÉËÏÓÖÜ]*$/i,
|
||
hu: /^[A-ZÁÉÍÓÖŐÚÜŰ]*$/i,
|
||
pl: /^[A-ZĄĆĘŚŁŃÓŻŹ]*$/i,
|
||
pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,
|
||
ru: /^[А-ЯЁ]*$/i,
|
||
sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,
|
||
sr: /^[A-ZČĆŽŠĐ]*$/i,
|
||
tr: /^[A-ZÇĞİıÖŞÜ]*$/i,
|
||
uk: /^[А-ЩЬЮЯЄІЇҐ]*$/i,
|
||
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/
|
||
};
|
||
|
||
var alphaSpaces = {
|
||
en: /^[A-Z\s]*$/i,
|
||
cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ\s]*$/i,
|
||
da: /^[A-ZÆØÅ\s]*$/i,
|
||
de: /^[A-ZÄÖÜß\s]*$/i,
|
||
es: /^[A-ZÁÉÍÑÓÚÜ\s]*$/i,
|
||
fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ\s]*$/i,
|
||
lt: /^[A-ZĄČĘĖĮŠŲŪŽ\s]*$/i,
|
||
nl: /^[A-ZÉËÏÓÖÜ\s]*$/i,
|
||
hu: /^[A-ZÁÉÍÓÖŐÚÜŰ\s]*$/i,
|
||
pl: /^[A-ZĄĆĘŚŁŃÓŻŹ\s]*$/i,
|
||
pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ\s]*$/i,
|
||
ru: /^[А-ЯЁ\s]*$/i,
|
||
sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ\s]*$/i,
|
||
sr: /^[A-ZČĆŽŠĐ\s]*$/i,
|
||
tr: /^[A-ZÇĞİıÖŞÜ\s]*$/i,
|
||
uk: /^[А-ЩЬЮЯЄІЇҐ\s]*$/i,
|
||
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ\s]*$/
|
||
};
|
||
|
||
var alphanumeric = {
|
||
en: /^[0-9A-Z]*$/i,
|
||
cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,
|
||
da: /^[0-9A-ZÆØÅ]$/i,
|
||
de: /^[0-9A-ZÄÖÜß]*$/i,
|
||
es: /^[0-9A-ZÁÉÍÑÓÚÜ]*$/i,
|
||
fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,
|
||
lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ]*$/i,
|
||
hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]*$/i,
|
||
nl: /^[0-9A-ZÉËÏÓÖÜ]*$/i,
|
||
pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]*$/i,
|
||
pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,
|
||
ru: /^[0-9А-ЯЁ]*$/i,
|
||
sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,
|
||
sr: /^[0-9A-ZČĆŽŠĐ]*$/i,
|
||
tr: /^[0-9A-ZÇĞİıÖŞÜ]*$/i,
|
||
uk: /^[0-9А-ЩЬЮЯЄІЇҐ]*$/i,
|
||
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/
|
||
};
|
||
|
||
var alphaDash = {
|
||
en: /^[0-9A-Z_-]*$/i,
|
||
cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ_-]*$/i,
|
||
da: /^[0-9A-ZÆØÅ_-]*$/i,
|
||
de: /^[0-9A-ZÄÖÜß_-]*$/i,
|
||
es: /^[0-9A-ZÁÉÍÑÓÚÜ_-]*$/i,
|
||
fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ_-]*$/i,
|
||
lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ_-]*$/i,
|
||
nl: /^[0-9A-ZÉËÏÓÖÜ_-]*$/i,
|
||
hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ_-]*$/i,
|
||
pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ_-]*$/i,
|
||
pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ_-]*$/i,
|
||
ru: /^[0-9А-ЯЁ_-]*$/i,
|
||
sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ_-]*$/i,
|
||
sr: /^[0-9A-ZČĆŽŠĐ_-]*$/i,
|
||
tr: /^[0-9A-ZÇĞİıÖŞÜ_-]*$/i,
|
||
uk: /^[0-9А-ЩЬЮЯЄІЇҐ_-]*$/i,
|
||
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ_-]*$/
|
||
};
|
||
|
||
var validate = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var locale = ref[0]; if ( locale === void 0 ) locale = null;
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate(val, [locale]); });
|
||
}
|
||
|
||
// Match at least one locale.
|
||
if (! locale) {
|
||
return Object.keys(alpha).some(function (loc) { return alpha[loc].test(value); });
|
||
}
|
||
|
||
return (alpha[locale] || alpha.en).test(value);
|
||
};
|
||
|
||
var alpha$1 = {
|
||
validate: validate
|
||
};
|
||
|
||
var validate$1 = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var locale = ref[0]; if ( locale === void 0 ) locale = null;
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$1(val, [locale]); });
|
||
}
|
||
|
||
// Match at least one locale.
|
||
if (! locale) {
|
||
return Object.keys(alphaDash).some(function (loc) { return alphaDash[loc].test(value); });
|
||
}
|
||
|
||
return (alphaDash[locale] || alphaDash.en).test(value);
|
||
};
|
||
|
||
var alpha_dash = {
|
||
validate: validate$1
|
||
};
|
||
|
||
var validate$2 = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var locale = ref[0]; if ( locale === void 0 ) locale = null;
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$2(val, [locale]); });
|
||
}
|
||
|
||
// Match at least one locale.
|
||
if (! locale) {
|
||
return Object.keys(alphanumeric).some(function (loc) { return alphanumeric[loc].test(value); });
|
||
}
|
||
|
||
return (alphanumeric[locale] || alphanumeric.en).test(value);
|
||
};
|
||
|
||
var alpha_num = {
|
||
validate: validate$2
|
||
};
|
||
|
||
var validate$3 = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var locale = ref[0]; if ( locale === void 0 ) locale = null;
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$3(val, [locale]); });
|
||
}
|
||
|
||
// Match at least one locale.
|
||
if (! locale) {
|
||
return Object.keys(alphaSpaces).some(function (loc) { return alphaSpaces[loc].test(value); });
|
||
}
|
||
|
||
return (alphaSpaces[locale] || alphaSpaces.en).test(value);
|
||
};
|
||
|
||
var alpha_spaces = {
|
||
validate: validate$3
|
||
};
|
||
|
||
var validate$4 = function (value, ref) {
|
||
var otherValue = ref[0];
|
||
var inclusion = ref[1];
|
||
var format$$1 = ref[2];
|
||
|
||
if (typeof format$$1 === 'undefined') {
|
||
format$$1 = inclusion;
|
||
inclusion = false;
|
||
}
|
||
value = parseDate$1(value, format$$1);
|
||
otherValue = parseDate$1(otherValue, format$$1);
|
||
|
||
// if either is not valid.
|
||
if (!value || !otherValue) {
|
||
return false;
|
||
}
|
||
|
||
return isBefore(value, otherValue) || (inclusion && isEqual(value, otherValue));
|
||
};
|
||
|
||
var options$1 = {
|
||
hasTarget: true,
|
||
isDate: true
|
||
};
|
||
|
||
var before = {
|
||
validate: validate$4,
|
||
options: options$1
|
||
};
|
||
|
||
var validate$5 = function (value, ref) {
|
||
var min = ref[0];
|
||
var max = ref[1];
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$5(val, [min, max]); });
|
||
}
|
||
|
||
return Number(min) <= value && Number(max) >= value;
|
||
};
|
||
|
||
var between = {
|
||
validate: validate$5
|
||
};
|
||
|
||
var validate$6 = function (value, other) { return String(value) === String(other); };
|
||
var options$2 = {
|
||
hasTarget: true
|
||
};
|
||
|
||
var confirmed = {
|
||
validate: validate$6,
|
||
options: options$2
|
||
};
|
||
|
||
function unwrapExports (x) {
|
||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
||
}
|
||
|
||
function createCommonjsModule(fn, module) {
|
||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||
}
|
||
|
||
var assertString_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = assertString;
|
||
function assertString(input) {
|
||
var isString = typeof input === 'string' || input instanceof String;
|
||
|
||
if (!isString) {
|
||
throw new TypeError('This library (validator.js) validates strings only');
|
||
}
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
unwrapExports(assertString_1);
|
||
|
||
var isCreditCard_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = isCreditCard;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* eslint-disable max-len */
|
||
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/;
|
||
/* eslint-enable max-len */
|
||
|
||
function isCreditCard(str) {
|
||
(0, _assertString2.default)(str);
|
||
var sanitized = str.replace(/[- ]+/g, '');
|
||
if (!creditCard.test(sanitized)) {
|
||
return false;
|
||
}
|
||
var sum = 0;
|
||
var digit = void 0;
|
||
var tmpNum = void 0;
|
||
var shouldDouble = void 0;
|
||
for (var i = sanitized.length - 1; i >= 0; i--) {
|
||
digit = sanitized.substring(i, i + 1);
|
||
tmpNum = parseInt(digit, 10);
|
||
if (shouldDouble) {
|
||
tmpNum *= 2;
|
||
if (tmpNum >= 10) {
|
||
sum += tmpNum % 10 + 1;
|
||
} else {
|
||
sum += tmpNum;
|
||
}
|
||
} else {
|
||
sum += tmpNum;
|
||
}
|
||
shouldDouble = !shouldDouble;
|
||
}
|
||
return !!(sum % 10 === 0 ? sanitized : false);
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
var isCreditCard = unwrapExports(isCreditCard_1);
|
||
|
||
var validate$7 = function (value) { return isCreditCard(String(value)); };
|
||
|
||
var credit_card = {
|
||
validate: validate$7
|
||
};
|
||
|
||
var validate$8 = function (value, params) {
|
||
var assign, assign$1;
|
||
|
||
var min$$1;
|
||
var max$$1;
|
||
var format$$1;
|
||
var inclusivity = '()';
|
||
|
||
if (params.length > 3) {
|
||
(assign = params, min$$1 = assign[0], max$$1 = assign[1], inclusivity = assign[2], format$$1 = assign[3]);
|
||
} else {
|
||
(assign$1 = params, min$$1 = assign$1[0], max$$1 = assign$1[1], format$$1 = assign$1[2]);
|
||
}
|
||
|
||
var minDate = parseDate$1(String(min$$1), format$$1);
|
||
var maxDate = parseDate$1(String(max$$1), format$$1);
|
||
var dateVal = parseDate$1(String(value), format$$1);
|
||
|
||
if (!minDate || !maxDate || !dateVal) {
|
||
return false;
|
||
}
|
||
|
||
if (inclusivity === '()') {
|
||
return isAfter(dateVal, minDate) && isBefore(dateVal, maxDate);
|
||
}
|
||
|
||
if (inclusivity === '(]') {
|
||
return isAfter(dateVal, minDate) && (isEqual(dateVal, maxDate) || isBefore(dateVal, maxDate));
|
||
}
|
||
|
||
if (inclusivity === '[)') {
|
||
return isBefore(dateVal, maxDate) && (isEqual(dateVal, minDate) || isAfter(dateVal, minDate));
|
||
}
|
||
|
||
return isEqual(dateVal, maxDate) || isEqual(dateVal, minDate) ||
|
||
(isBefore(dateVal, maxDate) && isAfter(dateVal, minDate));
|
||
};
|
||
|
||
var options$3 = {
|
||
isDate: true
|
||
};
|
||
|
||
var date_between = {
|
||
validate: validate$8,
|
||
options: options$3
|
||
};
|
||
|
||
var validate$9 = function (value, ref) {
|
||
var format = ref[0];
|
||
|
||
return !!parseDate$1(value, format);
|
||
};
|
||
|
||
var options$4 = {
|
||
isDate: true
|
||
};
|
||
|
||
var date_format = {
|
||
validate: validate$9,
|
||
options: options$4
|
||
};
|
||
|
||
var validate$a = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var decimals = ref[0]; if ( decimals === void 0 ) decimals = '*';
|
||
var separator = ref[1]; if ( separator === void 0 ) separator = '.';
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$a(val, [decimals, separator]); });
|
||
}
|
||
|
||
if (value === null || value === undefined || value === '') {
|
||
return true;
|
||
}
|
||
|
||
// if is 0.
|
||
if (Number(decimals) === 0) {
|
||
return /^-?\d*$/.test(value);
|
||
}
|
||
|
||
var regexPart = decimals === '*' ? '+' : ("{1," + decimals + "}");
|
||
var regex = new RegExp(("^-?\\d*(\\" + separator + "\\d" + regexPart + ")?$"));
|
||
|
||
if (! regex.test(value)) {
|
||
return false;
|
||
}
|
||
|
||
var parsedValue = parseFloat(value);
|
||
|
||
// eslint-disable-next-line
|
||
return parsedValue === parsedValue;
|
||
};
|
||
|
||
var decimal = {
|
||
validate: validate$a
|
||
};
|
||
|
||
var validate$b = function (value, ref) {
|
||
var length = ref[0];
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$b(val, [length]); });
|
||
}
|
||
var strVal = String(value);
|
||
|
||
return /^[0-9]*$/.test(strVal) && strVal.length === Number(length);
|
||
};
|
||
|
||
var digits = {
|
||
validate: validate$b
|
||
};
|
||
|
||
var validateImage = function (file, width, height) {
|
||
var URL = window.URL || window.webkitURL;
|
||
return new Promise(function (resolve) {
|
||
var image = new Image();
|
||
image.onerror = function () { return resolve({ valid: false }); };
|
||
image.onload = function () { return resolve({
|
||
valid: image.width === Number(width) && image.height === Number(height)
|
||
}); };
|
||
|
||
image.src = URL.createObjectURL(file);
|
||
});
|
||
};
|
||
|
||
var validate$c = function (files, ref) {
|
||
var width = ref[0];
|
||
var height = ref[1];
|
||
|
||
var list = [];
|
||
for (var i = 0; i < files.length; i++) {
|
||
// if file is not an image, reject.
|
||
if (! /\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(files[i].name)) {
|
||
return false;
|
||
}
|
||
|
||
list.push(files[i]);
|
||
}
|
||
|
||
return Promise.all(list.map(function (file) { return validateImage(file, width, height); }));
|
||
};
|
||
|
||
var dimensions = {
|
||
validate: validate$c
|
||
};
|
||
|
||
var merge_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = merge;
|
||
function merge() {
|
||
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
var defaults = arguments[1];
|
||
|
||
for (var key in defaults) {
|
||
if (typeof obj[key] === 'undefined') {
|
||
obj[key] = defaults[key];
|
||
}
|
||
}
|
||
return obj;
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
unwrapExports(merge_1);
|
||
|
||
var isByteLength_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
||
exports.default = isByteLength;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* eslint-disable prefer-rest-params */
|
||
function isByteLength(str, options) {
|
||
(0, _assertString2.default)(str);
|
||
var min = void 0;
|
||
var max = void 0;
|
||
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
|
||
min = options.min || 0;
|
||
max = options.max;
|
||
} else {
|
||
// backwards compatibility: isByteLength(str, min [, max])
|
||
min = arguments[1];
|
||
max = arguments[2];
|
||
}
|
||
var len = encodeURI(str).split(/%..|./).length - 1;
|
||
return len >= min && (typeof max === 'undefined' || len <= max);
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
unwrapExports(isByteLength_1);
|
||
|
||
var isFQDN_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = isFQDN;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
|
||
|
||
var _merge2 = _interopRequireDefault(merge_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
var default_fqdn_options = {
|
||
require_tld: true,
|
||
allow_underscores: false,
|
||
allow_trailing_dot: false
|
||
};
|
||
|
||
function isFQDN(str, options) {
|
||
(0, _assertString2.default)(str);
|
||
options = (0, _merge2.default)(options, default_fqdn_options);
|
||
|
||
/* Remove the optional trailing dot before checking validity */
|
||
if (options.allow_trailing_dot && str[str.length - 1] === '.') {
|
||
str = str.substring(0, str.length - 1);
|
||
}
|
||
var parts = str.split('.');
|
||
for (var i = 0; i < parts.length; i++) {
|
||
if (parts[i].length > 63) {
|
||
return false;
|
||
}
|
||
}
|
||
if (options.require_tld) {
|
||
var tld = parts.pop();
|
||
if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
|
||
return false;
|
||
}
|
||
// disallow spaces
|
||
if (/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(tld)) {
|
||
return false;
|
||
}
|
||
}
|
||
for (var part, _i = 0; _i < parts.length; _i++) {
|
||
part = parts[_i];
|
||
if (options.allow_underscores) {
|
||
part = part.replace(/_/g, '');
|
||
}
|
||
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
|
||
return false;
|
||
}
|
||
// disallow full-width chars
|
||
if (/[\uff01-\uff5e]/.test(part)) {
|
||
return false;
|
||
}
|
||
if (part[0] === '-' || part[part.length - 1] === '-') {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
unwrapExports(isFQDN_1);
|
||
|
||
var isEmail_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = isEmail;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
|
||
|
||
var _merge2 = _interopRequireDefault(merge_1);
|
||
|
||
|
||
|
||
var _isByteLength2 = _interopRequireDefault(isByteLength_1);
|
||
|
||
|
||
|
||
var _isFQDN2 = _interopRequireDefault(isFQDN_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
var default_email_options = {
|
||
allow_display_name: false,
|
||
require_display_name: false,
|
||
allow_utf8_local_part: true,
|
||
require_tld: true
|
||
};
|
||
|
||
/* eslint-disable max-len */
|
||
/* eslint-disable no-control-regex */
|
||
var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\,\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i;
|
||
var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
|
||
var gmailUserPart = /^[a-z\d]+$/;
|
||
var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
|
||
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
|
||
var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
|
||
/* eslint-enable max-len */
|
||
/* eslint-enable no-control-regex */
|
||
|
||
function isEmail(str, options) {
|
||
(0, _assertString2.default)(str);
|
||
options = (0, _merge2.default)(options, default_email_options);
|
||
|
||
if (options.require_display_name || options.allow_display_name) {
|
||
var display_email = str.match(displayName);
|
||
if (display_email) {
|
||
str = display_email[1];
|
||
} else if (options.require_display_name) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
var parts = str.split('@');
|
||
var domain = parts.pop();
|
||
var user = parts.join('@');
|
||
|
||
var lower_domain = domain.toLowerCase();
|
||
|
||
if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {
|
||
/*
|
||
Previously we removed dots for gmail addresses before validating.
|
||
This was removed because it allows `multiple..dots@gmail.com`
|
||
to be reported as valid, but it is not.
|
||
Gmail only normalizes single dots, removing them from here is pointless,
|
||
should be done in normalizeEmail
|
||
*/
|
||
user = user.toLowerCase();
|
||
|
||
// Removing sub-address from username before gmail validation
|
||
var username = user.split('+')[0];
|
||
|
||
// Dots are not included in gmail length restriction
|
||
if (!(0, _isByteLength2.default)(username.replace('.', ''), { min: 6, max: 30 })) {
|
||
return false;
|
||
}
|
||
|
||
var _user_parts = username.split('.');
|
||
for (var i = 0; i < _user_parts.length; i++) {
|
||
if (!gmailUserPart.test(_user_parts[i])) {
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 254 })) {
|
||
return false;
|
||
}
|
||
|
||
if (!(0, _isFQDN2.default)(domain, { require_tld: options.require_tld })) {
|
||
return false;
|
||
}
|
||
|
||
if (user[0] === '"') {
|
||
user = user.slice(1, user.length - 1);
|
||
return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
|
||
}
|
||
|
||
var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;
|
||
|
||
var user_parts = user.split('.');
|
||
for (var _i = 0; _i < user_parts.length; _i++) {
|
||
if (!pattern.test(user_parts[_i])) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
var isEmail = unwrapExports(isEmail_1);
|
||
|
||
var validate$d = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var multiple = ref[0]; if ( multiple === void 0 ) multiple = false;
|
||
|
||
if (multiple) {
|
||
value = value.split(',').map(function (emailStr) { return emailStr.trim(); });
|
||
}
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return isEmail(String(val)); });
|
||
}
|
||
|
||
return isEmail(String(value));
|
||
};
|
||
|
||
var email = {
|
||
validate: validate$d
|
||
};
|
||
|
||
//
|
||
|
||
var supportsPassive = true;
|
||
|
||
var detectPassiveSupport = function () {
|
||
try {
|
||
var opts = Object.defineProperty({}, 'passive', {
|
||
get: function get () {
|
||
supportsPassive = true;
|
||
}
|
||
});
|
||
window.addEventListener('testPassive', null, opts);
|
||
window.removeEventListener('testPassive', null, opts);
|
||
} catch (e) {
|
||
supportsPassive = false;
|
||
}
|
||
return supportsPassive;
|
||
};
|
||
|
||
var addEventListener = function (el, eventName, cb) {
|
||
el.addEventListener(eventName, cb, supportsPassive ? { passive: true } : false);
|
||
};
|
||
|
||
var isTextInput = function (el) {
|
||
return includes(['text', 'password', 'search', 'email', 'tel', 'url', 'textarea'], el.type);
|
||
};
|
||
|
||
var isCheckboxOrRadioInput = function (el) {
|
||
return includes(['radio', 'checkbox'], el.type);
|
||
};
|
||
|
||
var isDateInput = function (el) {
|
||
return includes(['date', 'week', 'month', 'datetime-local', 'time'], el.type);
|
||
};
|
||
|
||
/**
|
||
* Gets the data attribute. the name must be kebab-case.
|
||
*/
|
||
var getDataAttribute = function (el, name) { return el.getAttribute(("data-vv-" + name)); };
|
||
|
||
/**
|
||
* Checks if the values are either null or undefined.
|
||
*/
|
||
var isNullOrUndefined = function () {
|
||
var values = [], len = arguments.length;
|
||
while ( len-- ) values[ len ] = arguments[ len ];
|
||
|
||
return values.every(function (value) {
|
||
return value === null || value === undefined;
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Creates the default flags object.
|
||
*/
|
||
var createFlags = function () { return ({
|
||
untouched: true,
|
||
touched: false,
|
||
dirty: false,
|
||
pristine: true,
|
||
valid: null,
|
||
invalid: null,
|
||
validated: false,
|
||
pending: false,
|
||
required: false,
|
||
changed: false
|
||
}); };
|
||
|
||
/**
|
||
* Shallow object comparison.
|
||
*/
|
||
var isEqual$1 = function (lhs, rhs) {
|
||
if (lhs instanceof RegExp && rhs instanceof RegExp) {
|
||
return isEqual$1(lhs.source, rhs.source) && isEqual$1(lhs.flags, rhs.flags);
|
||
}
|
||
|
||
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
||
if (lhs.length !== rhs.length) { return false; }
|
||
|
||
for (var i = 0; i < lhs.length; i++) {
|
||
if (!isEqual$1(lhs[i], rhs[i])) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
// if both are objects, compare each key recursively.
|
||
if (isObject(lhs) && isObject(rhs)) {
|
||
return Object.keys(lhs).every(function (key) {
|
||
return isEqual$1(lhs[key], rhs[key]);
|
||
}) && Object.keys(rhs).every(function (key) {
|
||
return isEqual$1(lhs[key], rhs[key]);
|
||
});
|
||
}
|
||
|
||
return lhs === rhs;
|
||
};
|
||
|
||
/**
|
||
* Determines the input field scope.
|
||
*/
|
||
var getScope = function (el) {
|
||
var scope = getDataAttribute(el, 'scope');
|
||
if (isNullOrUndefined(scope)) {
|
||
var form = getForm(el);
|
||
|
||
if (form) {
|
||
scope = getDataAttribute(form, 'scope');
|
||
}
|
||
}
|
||
|
||
return !isNullOrUndefined(scope) ? scope : null;
|
||
};
|
||
|
||
/**
|
||
* Get the closest form element.
|
||
*/
|
||
var getForm = function (el) {
|
||
if (isNullOrUndefined(el)) { return null; }
|
||
|
||
if (el.tagName === 'FORM') { return el; }
|
||
|
||
if (!isNullOrUndefined(el.form)) { return el.form; }
|
||
|
||
return !isNullOrUndefined(el.parentNode) ? getForm(el.parentNode) : null;
|
||
};
|
||
|
||
/**
|
||
* Gets the value in an object safely.
|
||
*/
|
||
var getPath = function (path, target, def) {
|
||
if ( def === void 0 ) def = undefined;
|
||
|
||
if (!path || !target) { return def; }
|
||
|
||
var value = target;
|
||
path.split('.').every(function (prop) {
|
||
if (prop in value) {
|
||
value = value[prop];
|
||
|
||
return true;
|
||
}
|
||
|
||
value = def;
|
||
|
||
return false;
|
||
});
|
||
|
||
return value;
|
||
};
|
||
|
||
/**
|
||
* Checks if path exists within an object.
|
||
*/
|
||
var hasPath = function (path, target) {
|
||
var obj = target;
|
||
return path.split('.').every(function (prop) {
|
||
if (prop in obj) {
|
||
obj = obj[prop];
|
||
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Parses a rule string expression.
|
||
*/
|
||
var parseRule = function (rule) {
|
||
var params = [];
|
||
var name = rule.split(':')[0];
|
||
|
||
if (includes(rule, ':')) {
|
||
params = rule.split(':').slice(1).join(':').split(',');
|
||
}
|
||
|
||
return { name: name, params: params };
|
||
};
|
||
|
||
/**
|
||
* Debounces a function.
|
||
*/
|
||
var debounce = function (fn, wait, immediate, token) {
|
||
if ( wait === void 0 ) wait = 0;
|
||
if ( immediate === void 0 ) immediate = false;
|
||
if ( token === void 0 ) token = { cancelled: false };
|
||
|
||
if (wait === 0) {
|
||
return fn;
|
||
}
|
||
|
||
var timeout;
|
||
|
||
return function () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
var later = function () {
|
||
timeout = null;
|
||
|
||
if (!immediate && !token.cancelled) { fn.apply(void 0, args); }
|
||
};
|
||
/* istanbul ignore next */
|
||
var callNow = immediate && !timeout;
|
||
clearTimeout(timeout);
|
||
timeout = setTimeout(later, wait);
|
||
/* istanbul ignore next */
|
||
if (callNow) { fn.apply(void 0, args); }
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Appends a rule definition to a list of rules.
|
||
*/
|
||
var appendRule = function (rule, rules) {
|
||
if (!rules) {
|
||
return rule;
|
||
}
|
||
|
||
if (!rule) {
|
||
return rules;
|
||
}
|
||
|
||
if (typeof rules === 'string') {
|
||
return (rules + "|" + rule);
|
||
}
|
||
|
||
return assign({}, rules, normalizeRules(rule));
|
||
};
|
||
|
||
/**
|
||
* Normalizes the given rules expression.
|
||
*/
|
||
var normalizeRules = function (rules) {
|
||
// if falsy value return an empty object.
|
||
if (!rules) {
|
||
return {};
|
||
}
|
||
|
||
if (isObject(rules)) {
|
||
// $FlowFixMe
|
||
return Object.keys(rules).reduce(function (prev, curr) {
|
||
var params = [];
|
||
// $FlowFixMe
|
||
if (rules[curr] === true) {
|
||
params = [];
|
||
} else if (Array.isArray(rules[curr])) {
|
||
params = rules[curr];
|
||
} else {
|
||
params = [rules[curr]];
|
||
}
|
||
|
||
// $FlowFixMe
|
||
if (rules[curr] !== false) {
|
||
prev[curr] = params;
|
||
}
|
||
|
||
return prev;
|
||
}, {});
|
||
}
|
||
|
||
if (typeof rules !== 'string') {
|
||
warn('rules must be either a string or an object.');
|
||
return {};
|
||
}
|
||
|
||
return rules.split('|').reduce(function (prev, rule) {
|
||
var parsedRule = parseRule(rule);
|
||
if (!parsedRule.name) {
|
||
return prev;
|
||
}
|
||
|
||
prev[parsedRule.name] = parsedRule.params;
|
||
return prev;
|
||
}, {});
|
||
};
|
||
|
||
/**
|
||
* Emits a warning to the console.
|
||
*/
|
||
var warn = function (message) {
|
||
console.warn(("[vee-validate] " + message)); // eslint-disable-line
|
||
};
|
||
|
||
/**
|
||
* Creates a branded error object.
|
||
*/
|
||
var createError = function (message) { return new Error(("[vee-validate] " + message)); };
|
||
|
||
/**
|
||
* Checks if the value is an object.
|
||
*/
|
||
var isObject = function (obj) { return obj !== null && obj && typeof obj === 'object' && ! Array.isArray(obj); };
|
||
|
||
/**
|
||
* Checks if a function is callable.
|
||
*/
|
||
var isCallable = function (func) { return typeof func === 'function'; };
|
||
|
||
/**
|
||
* Check if element has the css class on it.
|
||
*/
|
||
var hasClass = function (el, className) {
|
||
if (el.classList) {
|
||
return el.classList.contains(className);
|
||
}
|
||
|
||
return !!el.className.match(new RegExp(("(\\s|^)" + className + "(\\s|$)")));
|
||
};
|
||
|
||
/**
|
||
* Adds the provided css className to the element.
|
||
*/
|
||
var addClass = function (el, className) {
|
||
if (el.classList) {
|
||
el.classList.add(className);
|
||
return;
|
||
}
|
||
|
||
if (!hasClass(el, className)) {
|
||
el.className += " " + className;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Remove the provided css className from the element.
|
||
*/
|
||
var removeClass = function (el, className) {
|
||
if (el.classList) {
|
||
el.classList.remove(className);
|
||
return;
|
||
}
|
||
|
||
if (hasClass(el, className)) {
|
||
var reg = new RegExp(("(\\s|^)" + className + "(\\s|$)"));
|
||
el.className = el.className.replace(reg, ' ');
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Adds or removes a class name on the input depending on the status flag.
|
||
*/
|
||
var toggleClass = function (el, className, status) {
|
||
if (!el || !className) { return; }
|
||
|
||
if (Array.isArray(className)) {
|
||
className.forEach(function (item) { return toggleClass(el, item, status); });
|
||
return;
|
||
}
|
||
|
||
if (status) {
|
||
return addClass(el, className);
|
||
}
|
||
|
||
removeClass(el, className);
|
||
};
|
||
|
||
/**
|
||
* Converts an array-like object to array, provides a simple polyfill for Array.from
|
||
*/
|
||
var toArray = function (arrayLike) {
|
||
if (isCallable(Array.from)) {
|
||
return Array.from(arrayLike);
|
||
}
|
||
|
||
var array = [];
|
||
var length = arrayLike.length;
|
||
/* istanbul ignore next */
|
||
for (var i = 0; i < length; i++) {
|
||
array.push(arrayLike[i]);
|
||
}
|
||
|
||
/* istanbul ignore next */
|
||
return array;
|
||
};
|
||
|
||
/**
|
||
* Assign polyfill from the mdn.
|
||
*/
|
||
var assign = function (target) {
|
||
var others = [], len = arguments.length - 1;
|
||
while ( len-- > 0 ) others[ len ] = arguments[ len + 1 ];
|
||
|
||
/* istanbul ignore else */
|
||
if (isCallable(Object.assign)) {
|
||
return Object.assign.apply(Object, [ target ].concat( others ));
|
||
}
|
||
|
||
/* istanbul ignore next */
|
||
if (target == null) {
|
||
throw new TypeError('Cannot convert undefined or null to object');
|
||
}
|
||
|
||
/* istanbul ignore next */
|
||
var to = Object(target);
|
||
/* istanbul ignore next */
|
||
others.forEach(function (arg) {
|
||
// Skip over if undefined or null
|
||
if (arg != null) {
|
||
Object.keys(arg).forEach(function (key) {
|
||
to[key] = arg[key];
|
||
});
|
||
}
|
||
});
|
||
/* istanbul ignore next */
|
||
return to;
|
||
};
|
||
|
||
var id = 0;
|
||
var idTemplate = '{id}';
|
||
|
||
/**
|
||
* Generates a unique id.
|
||
*/
|
||
var uniqId = function () {
|
||
// handle too many uses of uniqId, although unlikely.
|
||
if (id >= 9999) {
|
||
id = 0;
|
||
// shift the template.
|
||
idTemplate = idTemplate.replace('{id}', '_{id}');
|
||
}
|
||
|
||
id++;
|
||
var newId = idTemplate.replace('{id}', String(id));
|
||
|
||
return newId;
|
||
};
|
||
|
||
/**
|
||
* finds the first element that satisfies the predicate callback, polyfills array.find
|
||
*/
|
||
var find = function (arrayLike, predicate) {
|
||
var array = Array.isArray(arrayLike) ? arrayLike : toArray(arrayLike);
|
||
for (var i = 0; i < array.length; i++) {
|
||
if (predicate(array[i])) {
|
||
return array[i];
|
||
}
|
||
}
|
||
|
||
return undefined;
|
||
};
|
||
|
||
var isBuiltInComponent = function (vnode) {
|
||
if (!vnode) {
|
||
return false;
|
||
}
|
||
|
||
var tag = vnode.componentOptions.tag;
|
||
|
||
return /^(keep-alive|transition|transition-group)$/.test(tag);
|
||
};
|
||
|
||
var makeEventsArray = function (events) {
|
||
return (typeof events === 'string' && events.length) ? events.split('|') : [];
|
||
};
|
||
|
||
var makeDelayObject = function (events, delay, delayConfig) {
|
||
if (typeof delay === 'number') {
|
||
return events.reduce(function (prev, e) {
|
||
prev[e] = delay;
|
||
return prev;
|
||
}, {});
|
||
}
|
||
|
||
return events.reduce(function (prev, e) {
|
||
if (typeof delay === 'object' && e in delay) {
|
||
prev[e] = delay[e];
|
||
return prev;
|
||
}
|
||
|
||
if (typeof delayConfig === 'number') {
|
||
prev[e] = delayConfig;
|
||
return prev;
|
||
}
|
||
|
||
prev[e] = (delayConfig && delayConfig[e]) || 0;
|
||
|
||
return prev;
|
||
}, {});
|
||
};
|
||
|
||
var deepParseInt = function (input) {
|
||
if (typeof input === 'number') { return input; }
|
||
|
||
if (typeof input === 'string') { return parseInt(input); }
|
||
|
||
var map = {};
|
||
for (var element in input) {
|
||
map[element] = parseInt(input[element]);
|
||
}
|
||
|
||
return map;
|
||
};
|
||
|
||
var merge$1 = function (target, source) {
|
||
if (! (isObject(target) && isObject(source))) {
|
||
return target;
|
||
}
|
||
|
||
Object.keys(source).forEach(function (key) {
|
||
var obj, obj$1;
|
||
|
||
if (isObject(source[key])) {
|
||
if (! target[key]) {
|
||
assign(target, ( obj = {}, obj[key] = {}, obj ));
|
||
}
|
||
|
||
merge$1(target[key], source[key]);
|
||
return;
|
||
}
|
||
|
||
assign(target, ( obj$1 = {}, obj$1[key] = source[key], obj$1 ));
|
||
});
|
||
|
||
return target;
|
||
};
|
||
|
||
var fillRulesFromElement = function (el, rules) {
|
||
if (el.required) {
|
||
rules = appendRule('required', rules);
|
||
}
|
||
|
||
if (isTextInput(el)) {
|
||
if (el.type === 'email') {
|
||
rules = appendRule(("email" + (el.multiple ? ':multiple' : '')), rules);
|
||
}
|
||
|
||
if (el.pattern) {
|
||
rules = appendRule(("regex:" + (el.pattern)), rules);
|
||
}
|
||
|
||
// 524288 is the max on some browsers and test environments.
|
||
if (el.maxLength >= 0 && el.maxLength < 524288) {
|
||
rules = appendRule(("max:" + (el.maxLength)), rules);
|
||
}
|
||
|
||
if (el.minLength > 0) {
|
||
rules = appendRule(("min:" + (el.minLength)), rules);
|
||
}
|
||
|
||
return rules;
|
||
}
|
||
|
||
if (el.type === 'number') {
|
||
rules = appendRule('decimal', rules);
|
||
if (el.min !== '') {
|
||
rules = appendRule(("min_value:" + (el.min)), rules);
|
||
}
|
||
|
||
if (el.max !== '') {
|
||
rules = appendRule(("max_value:" + (el.max)), rules);
|
||
}
|
||
|
||
return rules;
|
||
}
|
||
|
||
if (isDateInput(el)) {
|
||
var timeFormat = el.step && Number(el.step) < 60 ? 'HH:mm:ss' : 'HH:mm';
|
||
|
||
if (el.type === 'date') {
|
||
return appendRule('date_format:YYYY-MM-DD', rules);
|
||
}
|
||
|
||
if (el.type === 'datetime-local') {
|
||
return appendRule(("date_format:YYYY-MM-DDT" + timeFormat), rules);
|
||
}
|
||
|
||
if (el.type === 'month') {
|
||
return appendRule('date_format:YYYY-MM', rules);
|
||
}
|
||
|
||
if (el.type === 'week') {
|
||
return appendRule('date_format:YYYY-[W]WW', rules);
|
||
}
|
||
|
||
if (el.type === 'time') {
|
||
return appendRule(("date_format:" + timeFormat), rules);
|
||
}
|
||
}
|
||
|
||
return rules;
|
||
};
|
||
|
||
var values = function (obj) {
|
||
if (isCallable(Object.values)) {
|
||
return Object.values(obj);
|
||
}
|
||
|
||
// fallback to keys()
|
||
/* istanbul ignore next */
|
||
return obj[Object.keys(obj)[0]];
|
||
};
|
||
|
||
var parseSelector = function (selector) {
|
||
var rule = null;
|
||
if (includes(selector, ':')) {
|
||
rule = selector.split(':').pop();
|
||
selector = selector.replace((":" + rule), '');
|
||
}
|
||
|
||
if (selector[0] === '#') {
|
||
return {
|
||
id: selector.slice(1),
|
||
rule: rule,
|
||
name: null,
|
||
scope: null
|
||
};
|
||
}
|
||
|
||
var scope = null;
|
||
var name = selector;
|
||
if (includes(selector, '.')) {
|
||
var parts = selector.split('.');
|
||
scope = parts[0];
|
||
name = parts.slice(1).join('.');
|
||
}
|
||
|
||
return {
|
||
id: null,
|
||
scope: scope,
|
||
name: name,
|
||
rule: rule
|
||
};
|
||
};
|
||
|
||
var includes = function (collection, item) {
|
||
return collection.indexOf(item) !== -1;
|
||
};
|
||
|
||
var validate$e = function (value, options) {
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return validate$e(val, options); });
|
||
}
|
||
|
||
return toArray(options).some(function (item) {
|
||
// eslint-disable-next-line
|
||
return item == value;
|
||
});
|
||
};
|
||
|
||
var included = {
|
||
validate: validate$e
|
||
};
|
||
|
||
var validate$f = function () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
return !validate$e.apply(void 0, args);
|
||
};
|
||
|
||
var excluded = {
|
||
validate: validate$f
|
||
};
|
||
|
||
var validate$g = function (files, extensions) {
|
||
var regex = new RegExp((".(" + (extensions.join('|')) + ")$"), 'i');
|
||
|
||
return files.every(function (file) { return regex.test(file.name); });
|
||
};
|
||
|
||
var ext = {
|
||
validate: validate$g
|
||
};
|
||
|
||
var validate$h = function (files) { return files.every(function (file) { return /\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(file.name); }); };
|
||
|
||
var image = {
|
||
validate: validate$h
|
||
};
|
||
|
||
var validate$i = function (value) {
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return /^-?[0-9]+$/.test(String(val)); });
|
||
}
|
||
|
||
return /^-?[0-9]+$/.test(String(value));
|
||
};
|
||
|
||
var integer = {
|
||
validate: validate$i
|
||
};
|
||
|
||
var isIP_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = isIP;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
||
var ipv6Block = /^[0-9A-F]{1,4}$/i;
|
||
|
||
function isIP(str) {
|
||
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||
|
||
(0, _assertString2.default)(str);
|
||
version = String(version);
|
||
if (!version) {
|
||
return isIP(str, 4) || isIP(str, 6);
|
||
} else if (version === '4') {
|
||
if (!ipv4Maybe.test(str)) {
|
||
return false;
|
||
}
|
||
var parts = str.split('.').sort(function (a, b) {
|
||
return a - b;
|
||
});
|
||
return parts[3] <= 255;
|
||
} else if (version === '6') {
|
||
var blocks = str.split(':');
|
||
var foundOmissionBlock = false; // marker to indicate ::
|
||
|
||
// At least some OS accept the last 32 bits of an IPv6 address
|
||
// (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says
|
||
// that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,
|
||
// and '::a.b.c.d' is deprecated, but also valid.
|
||
var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);
|
||
var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;
|
||
|
||
if (blocks.length > expectedNumberOfBlocks) {
|
||
return false;
|
||
}
|
||
// initial or final ::
|
||
if (str === '::') {
|
||
return true;
|
||
} else if (str.substr(0, 2) === '::') {
|
||
blocks.shift();
|
||
blocks.shift();
|
||
foundOmissionBlock = true;
|
||
} else if (str.substr(str.length - 2) === '::') {
|
||
blocks.pop();
|
||
blocks.pop();
|
||
foundOmissionBlock = true;
|
||
}
|
||
|
||
for (var i = 0; i < blocks.length; ++i) {
|
||
// test for a :: which can not be at the string start/end
|
||
// since those cases have been handled above
|
||
if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {
|
||
if (foundOmissionBlock) {
|
||
return false; // multiple :: in address
|
||
}
|
||
foundOmissionBlock = true;
|
||
} else if (foundIPv4TransitionBlock && i === blocks.length - 1) ; else if (!ipv6Block.test(blocks[i])) {
|
||
return false;
|
||
}
|
||
}
|
||
if (foundOmissionBlock) {
|
||
return blocks.length >= 1;
|
||
}
|
||
return blocks.length === expectedNumberOfBlocks;
|
||
}
|
||
return false;
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
var isIP = unwrapExports(isIP_1);
|
||
|
||
var validate$j = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var version = ref[0]; if ( version === void 0 ) version = 4;
|
||
|
||
if (isNullOrUndefined(value)) {
|
||
value = '';
|
||
}
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return isIP(val, version); });
|
||
}
|
||
|
||
return isIP(value, version);
|
||
};
|
||
|
||
var ip = {
|
||
validate: validate$j
|
||
};
|
||
|
||
var validate$k = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var other = ref[0];
|
||
|
||
return value === other;
|
||
};
|
||
|
||
var is = {
|
||
validate: validate$k
|
||
};
|
||
|
||
var validate$l = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var other = ref[0];
|
||
|
||
return value !== other;
|
||
};
|
||
|
||
var is_not = {
|
||
validate: validate$l
|
||
};
|
||
|
||
/**
|
||
* @param {Array|String} value
|
||
* @param {Number} length
|
||
* @param {Number} max
|
||
*/
|
||
var compare = function (value, length, max) {
|
||
if (max === undefined) {
|
||
return value.length === length;
|
||
}
|
||
|
||
// cast to number.
|
||
max = Number(max);
|
||
|
||
return value.length >= length && value.length <= max;
|
||
};
|
||
|
||
var validate$m = function (value, ref) {
|
||
var length = ref[0];
|
||
var max = ref[1]; if ( max === void 0 ) max = undefined;
|
||
|
||
length = Number(length);
|
||
if (value === undefined || value === null) {
|
||
return false;
|
||
}
|
||
|
||
if (typeof value === 'number') {
|
||
value = String(value);
|
||
}
|
||
|
||
if (!value.length) {
|
||
value = toArray(value);
|
||
}
|
||
|
||
return compare(value, length, max);
|
||
};
|
||
|
||
var length = {
|
||
validate: validate$m
|
||
};
|
||
|
||
var validate$n = function (value, ref) {
|
||
var length = ref[0];
|
||
|
||
if (value === undefined || value === null) {
|
||
return length >= 0;
|
||
}
|
||
|
||
return String(value).length <= length;
|
||
};
|
||
|
||
var max$1 = {
|
||
validate: validate$n
|
||
};
|
||
|
||
var validate$o = function (value, ref) {
|
||
var max = ref[0];
|
||
|
||
if (Array.isArray(value) || value === null || value === undefined || value === '') {
|
||
return false;
|
||
}
|
||
|
||
return Number(value) <= max;
|
||
};
|
||
|
||
var max_value = {
|
||
validate: validate$o
|
||
};
|
||
|
||
var validate$p = function (files, mimes) {
|
||
var regex = new RegExp(((mimes.join('|').replace('*', '.+')) + "$"), 'i');
|
||
|
||
return files.every(function (file) { return regex.test(file.type); });
|
||
};
|
||
|
||
var mimes = {
|
||
validate: validate$p
|
||
};
|
||
|
||
var validate$q = function (value, ref) {
|
||
var length = ref[0];
|
||
|
||
if (value === undefined || value === null) {
|
||
return false;
|
||
}
|
||
return String(value).length >= length;
|
||
};
|
||
|
||
var min$1 = {
|
||
validate: validate$q
|
||
};
|
||
|
||
var validate$r = function (value, ref) {
|
||
var min = ref[0];
|
||
|
||
if (Array.isArray(value) || value === null || value === undefined || value === '') {
|
||
return false;
|
||
}
|
||
|
||
return Number(value) >= min;
|
||
};
|
||
|
||
var min_value = {
|
||
validate: validate$r
|
||
};
|
||
|
||
var validate$s = function (value) {
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return /^[0-9]+$/.test(String(val)); });
|
||
}
|
||
|
||
return /^[0-9]+$/.test(String(value));
|
||
};
|
||
|
||
var numeric = {
|
||
validate: validate$s
|
||
};
|
||
|
||
var validate$t = function (value, ref) {
|
||
var regex = ref[0];
|
||
var flags = ref.slice(1);
|
||
|
||
if (regex instanceof RegExp) {
|
||
return regex.test(value);
|
||
}
|
||
|
||
return new RegExp(regex, flags).test(String(value));
|
||
};
|
||
|
||
var regex = {
|
||
validate: validate$t
|
||
};
|
||
|
||
var validate$u = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var invalidateFalse = ref[0]; if ( invalidateFalse === void 0 ) invalidateFalse = false;
|
||
|
||
if (Array.isArray(value)) {
|
||
return !!value.length;
|
||
}
|
||
|
||
// incase a field considers `false` as an empty value like checkboxes.
|
||
if (value === false && invalidateFalse) {
|
||
return false;
|
||
}
|
||
|
||
if (value === undefined || value === null) {
|
||
return false;
|
||
}
|
||
|
||
return !!String(value).trim().length;
|
||
};
|
||
|
||
var required = {
|
||
validate: validate$u
|
||
};
|
||
|
||
var validate$v = function (files, ref) {
|
||
var size = ref[0];
|
||
|
||
if (isNaN(size)) {
|
||
return false;
|
||
}
|
||
|
||
var nSize = Number(size) * 1024;
|
||
for (var i = 0; i < files.length; i++) {
|
||
if (files[i].size > nSize) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
};
|
||
|
||
var size = {
|
||
validate: validate$v
|
||
};
|
||
|
||
var isURL_1 = createCommonjsModule(function (module, exports) {
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = isURL;
|
||
|
||
|
||
|
||
var _assertString2 = _interopRequireDefault(assertString_1);
|
||
|
||
|
||
|
||
var _isFQDN2 = _interopRequireDefault(isFQDN_1);
|
||
|
||
|
||
|
||
var _isIP2 = _interopRequireDefault(isIP_1);
|
||
|
||
|
||
|
||
var _merge2 = _interopRequireDefault(merge_1);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
var default_url_options = {
|
||
protocols: ['http', 'https', 'ftp'],
|
||
require_tld: true,
|
||
require_protocol: false,
|
||
require_host: true,
|
||
require_valid_protocol: true,
|
||
allow_underscores: false,
|
||
allow_trailing_dot: false,
|
||
allow_protocol_relative_urls: false
|
||
};
|
||
|
||
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
|
||
|
||
function isRegExp(obj) {
|
||
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
||
}
|
||
|
||
function checkHost(host, matches) {
|
||
for (var i = 0; i < matches.length; i++) {
|
||
var match = matches[i];
|
||
if (host === match || isRegExp(match) && match.test(host)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
function isURL(url, options) {
|
||
(0, _assertString2.default)(url);
|
||
if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
|
||
return false;
|
||
}
|
||
if (url.indexOf('mailto:') === 0) {
|
||
return false;
|
||
}
|
||
options = (0, _merge2.default)(options, default_url_options);
|
||
var protocol = void 0,
|
||
auth = void 0,
|
||
host = void 0,
|
||
hostname = void 0,
|
||
port = void 0,
|
||
port_str = void 0,
|
||
split = void 0,
|
||
ipv6 = void 0;
|
||
|
||
split = url.split('#');
|
||
url = split.shift();
|
||
|
||
split = url.split('?');
|
||
url = split.shift();
|
||
|
||
split = url.split('://');
|
||
if (split.length > 1) {
|
||
protocol = split.shift();
|
||
if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
|
||
return false;
|
||
}
|
||
} else if (options.require_protocol) {
|
||
return false;
|
||
} else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {
|
||
split[0] = url.substr(2);
|
||
}
|
||
url = split.join('://');
|
||
|
||
if (url === '') {
|
||
return false;
|
||
}
|
||
|
||
split = url.split('/');
|
||
url = split.shift();
|
||
|
||
if (url === '' && !options.require_host) {
|
||
return true;
|
||
}
|
||
|
||
split = url.split('@');
|
||
if (split.length > 1) {
|
||
auth = split.shift();
|
||
if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
|
||
return false;
|
||
}
|
||
}
|
||
hostname = split.join('@');
|
||
|
||
port_str = null;
|
||
ipv6 = null;
|
||
var ipv6_match = hostname.match(wrapped_ipv6);
|
||
if (ipv6_match) {
|
||
host = '';
|
||
ipv6 = ipv6_match[1];
|
||
port_str = ipv6_match[2] || null;
|
||
} else {
|
||
split = hostname.split(':');
|
||
host = split.shift();
|
||
if (split.length) {
|
||
port_str = split.join(':');
|
||
}
|
||
}
|
||
|
||
if (port_str !== null) {
|
||
port = parseInt(port_str, 10);
|
||
if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if (!(0, _isIP2.default)(host) && !(0, _isFQDN2.default)(host, options) && (!ipv6 || !(0, _isIP2.default)(ipv6, 6))) {
|
||
return false;
|
||
}
|
||
|
||
host = host || ipv6;
|
||
|
||
if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
|
||
return false;
|
||
}
|
||
if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
module.exports = exports['default'];
|
||
});
|
||
|
||
var isURL = unwrapExports(isURL_1);
|
||
|
||
var validate$w = function (value, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var requireProtocol = ref[0]; if ( requireProtocol === void 0 ) requireProtocol = false;
|
||
|
||
var options = { require_protocol: !!requireProtocol, allow_underscores: true };
|
||
if (isNullOrUndefined(value)) {
|
||
value = '';
|
||
}
|
||
|
||
if (Array.isArray(value)) {
|
||
return value.every(function (val) { return isURL(val, options); });
|
||
}
|
||
|
||
return isURL(value, options);
|
||
};
|
||
|
||
var url = {
|
||
validate: validate$w
|
||
};
|
||
|
||
/* eslint-disable camelcase */
|
||
|
||
var Rules = /*#__PURE__*/Object.freeze({
|
||
after: after,
|
||
alpha_dash: alpha_dash,
|
||
alpha_num: alpha_num,
|
||
alpha_spaces: alpha_spaces,
|
||
alpha: alpha$1,
|
||
before: before,
|
||
between: between,
|
||
confirmed: confirmed,
|
||
credit_card: credit_card,
|
||
date_between: date_between,
|
||
date_format: date_format,
|
||
decimal: decimal,
|
||
digits: digits,
|
||
dimensions: dimensions,
|
||
email: email,
|
||
ext: ext,
|
||
image: image,
|
||
included: included,
|
||
integer: integer,
|
||
length: length,
|
||
ip: ip,
|
||
is_not: is_not,
|
||
is: is,
|
||
max: max$1,
|
||
max_value: max_value,
|
||
mimes: mimes,
|
||
min: min$1,
|
||
min_value: min_value,
|
||
excluded: excluded,
|
||
numeric: numeric,
|
||
regex: regex,
|
||
required: required,
|
||
size: size,
|
||
url: url
|
||
});
|
||
|
||
/**
|
||
* Formates file size.
|
||
*
|
||
* @param {Number|String} size
|
||
*/
|
||
var formatFileSize = function (size) {
|
||
var units = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||
var threshold = 1024;
|
||
size = Number(size) * threshold;
|
||
var i = size === 0 ? 0 : Math.floor(Math.log(size) / Math.log(threshold));
|
||
return (((size / Math.pow(threshold, i)).toFixed(2) * 1) + " " + (units[i]));
|
||
};
|
||
|
||
/**
|
||
* Checks if vee-validate is defined globally.
|
||
*/
|
||
var isDefinedGlobally = function () {
|
||
return typeof VeeValidate !== 'undefined';
|
||
};
|
||
|
||
var obj;
|
||
|
||
var messages = {
|
||
_default: function (field) { return ("The " + field + " value is not valid."); },
|
||
after: function (field, ref) {
|
||
var target = ref[0];
|
||
var inclusion = ref[1];
|
||
|
||
return ("The " + field + " must be after " + (inclusion ? 'or equal to ' : '') + target + ".");
|
||
},
|
||
alpha_dash: function (field) { return ("The " + field + " field may contain alpha-numeric characters as well as dashes and underscores."); },
|
||
alpha_num: function (field) { return ("The " + field + " field may only contain alpha-numeric characters."); },
|
||
alpha_spaces: function (field) { return ("The " + field + " field may only contain alphabetic characters as well as spaces."); },
|
||
alpha: function (field) { return ("The " + field + " field may only contain alphabetic characters."); },
|
||
before: function (field, ref) {
|
||
var target = ref[0];
|
||
var inclusion = ref[1];
|
||
|
||
return ("The " + field + " must be before " + (inclusion ? 'or equal to ' : '') + target + ".");
|
||
},
|
||
between: function (field, ref) {
|
||
var min = ref[0];
|
||
var max = ref[1];
|
||
|
||
return ("The " + field + " field must be between " + min + " and " + max + ".");
|
||
},
|
||
confirmed: function (field) { return ("The " + field + " confirmation does not match."); },
|
||
credit_card: function (field) { return ("The " + field + " field is invalid."); },
|
||
date_between: function (field, ref) {
|
||
var min = ref[0];
|
||
var max = ref[1];
|
||
|
||
return ("The " + field + " must be between " + min + " and " + max + ".");
|
||
},
|
||
date_format: function (field, ref) {
|
||
var format = ref[0];
|
||
|
||
return ("The " + field + " must be in the format " + format + ".");
|
||
},
|
||
decimal: function (field, ref) {
|
||
if ( ref === void 0 ) ref = [];
|
||
var decimals = ref[0]; if ( decimals === void 0 ) decimals = '*';
|
||
|
||
return ("The " + field + " field must be numeric and may contain " + (!decimals || decimals === '*' ? '' : decimals) + " decimal points.");
|
||
},
|
||
digits: function (field, ref) {
|
||
var length = ref[0];
|
||
|
||
return ("The " + field + " field must be numeric and exactly contain " + length + " digits.");
|
||
},
|
||
dimensions: function (field, ref) {
|
||
var width = ref[0];
|
||
var height = ref[1];
|
||
|
||
return ("The " + field + " field must be " + width + " pixels by " + height + " pixels.");
|
||
},
|
||
email: function (field) { return ("The " + field + " field must be a valid email."); },
|
||
ext: function (field) { return ("The " + field + " field must be a valid file."); },
|
||
image: function (field) { return ("The " + field + " field must be an image."); },
|
||
included: function (field) { return ("The " + field + " field must be a valid value."); },
|
||
integer: function (field) { return ("The " + field + " field must be an integer."); },
|
||
ip: function (field) { return ("The " + field + " field must be a valid ip address."); },
|
||
length: function (field, ref) {
|
||
var length = ref[0];
|
||
var max = ref[1];
|
||
|
||
if (max) {
|
||
return ("The " + field + " length must be between " + length + " and " + max + ".");
|
||
}
|
||
|
||
return ("The " + field + " length must be " + length + ".");
|
||
},
|
||
max: function (field, ref) {
|
||
var length = ref[0];
|
||
|
||
return ("The " + field + " field may not be greater than " + length + " characters.");
|
||
},
|
||
max_value: function (field, ref) {
|
||
var max = ref[0];
|
||
|
||
return ("The " + field + " field must be " + max + " or less.");
|
||
},
|
||
mimes: function (field) { return ("The " + field + " field must have a valid file type."); },
|
||
min: function (field, ref) {
|
||
var length = ref[0];
|
||
|
||
return ("The " + field + " field must be at least " + length + " characters.");
|
||
},
|
||
min_value: function (field, ref) {
|
||
var min = ref[0];
|
||
|
||
return ("The " + field + " field must be " + min + " or more.");
|
||
},
|
||
excluded: function (field) { return ("The " + field + " field must be a valid value."); },
|
||
numeric: function (field) { return ("The " + field + " field may only contain numeric characters."); },
|
||
regex: function (field) { return ("The " + field + " field format is invalid."); },
|
||
required: function (field) { return ("The " + field + " field is required."); },
|
||
size: function (field, ref) {
|
||
var size = ref[0];
|
||
|
||
return ("The " + field + " size must be less than " + (formatFileSize(size)) + ".");
|
||
},
|
||
url: function (field) { return ("The " + field + " field is not a valid URL."); }
|
||
};
|
||
|
||
var locale$1 = {
|
||
name: 'en',
|
||
messages: messages,
|
||
attributes: {}
|
||
};
|
||
|
||
if (isDefinedGlobally()) {
|
||
// eslint-disable-next-line
|
||
VeeValidate.Validator.localize(( obj = {}, obj[locale$1.name] = locale$1, obj ));
|
||
}
|
||
|
||
//
|
||
|
||
var LOCALE = 'en';
|
||
|
||
var Dictionary = function Dictionary (dictionary) {
|
||
if ( dictionary === void 0 ) dictionary = {};
|
||
|
||
this.container = {};
|
||
this.merge(dictionary);
|
||
};
|
||
|
||
var prototypeAccessors = { locale: { configurable: true } };
|
||
|
||
prototypeAccessors.locale.get = function () {
|
||
return LOCALE;
|
||
};
|
||
|
||
prototypeAccessors.locale.set = function (value) {
|
||
LOCALE = value || 'en';
|
||
};
|
||
|
||
Dictionary.prototype.hasLocale = function hasLocale (locale) {
|
||
return !!this.container[locale];
|
||
};
|
||
|
||
Dictionary.prototype.setDateFormat = function setDateFormat (locale, format) {
|
||
if (!this.container[locale]) {
|
||
this.container[locale] = {};
|
||
}
|
||
|
||
this.container[locale].dateFormat = format;
|
||
};
|
||
|
||
Dictionary.prototype.getDateFormat = function getDateFormat (locale) {
|
||
if (!this.container[locale] || !this.container[locale].dateFormat) {
|
||
return null;
|
||
}
|
||
|
||
return this.container[locale].dateFormat;
|
||
};
|
||
|
||
Dictionary.prototype.getMessage = function getMessage (locale, key, data) {
|
||
var message = null;
|
||
if (!this.hasMessage(locale, key)) {
|
||
message = this._getDefaultMessage(locale);
|
||
} else {
|
||
message = this.container[locale].messages[key];
|
||
}
|
||
|
||
return isCallable(message) ? message.apply(void 0, data) : message;
|
||
};
|
||
|
||
/**
|
||
* Gets a specific message for field. falls back to the rule message.
|
||
*/
|
||
Dictionary.prototype.getFieldMessage = function getFieldMessage (locale, field, key, data) {
|
||
if (!this.hasLocale(locale)) {
|
||
return this.getMessage(locale, key, data);
|
||
}
|
||
|
||
var dict = this.container[locale].custom && this.container[locale].custom[field];
|
||
if (!dict || !dict[key]) {
|
||
return this.getMessage(locale, key, data);
|
||
}
|
||
|
||
var message = dict[key];
|
||
return isCallable(message) ? message.apply(void 0, data) : message;
|
||
};
|
||
|
||
Dictionary.prototype._getDefaultMessage = function _getDefaultMessage (locale) {
|
||
if (this.hasMessage(locale, '_default')) {
|
||
return this.container[locale].messages._default;
|
||
}
|
||
|
||
return this.container.en.messages._default;
|
||
};
|
||
|
||
Dictionary.prototype.getAttribute = function getAttribute (locale, key, fallback) {
|
||
if ( fallback === void 0 ) fallback = '';
|
||
|
||
if (!this.hasAttribute(locale, key)) {
|
||
return fallback;
|
||
}
|
||
|
||
return this.container[locale].attributes[key];
|
||
};
|
||
|
||
Dictionary.prototype.hasMessage = function hasMessage (locale, key) {
|
||
return !! (
|
||
this.hasLocale(locale) &&
|
||
this.container[locale].messages &&
|
||
this.container[locale].messages[key]
|
||
);
|
||
};
|
||
|
||
Dictionary.prototype.hasAttribute = function hasAttribute (locale, key) {
|
||
return !! (
|
||
this.hasLocale(locale) &&
|
||
this.container[locale].attributes &&
|
||
this.container[locale].attributes[key]
|
||
);
|
||
};
|
||
|
||
Dictionary.prototype.merge = function merge$1$$1 (dictionary) {
|
||
merge$1(this.container, dictionary);
|
||
};
|
||
|
||
Dictionary.prototype.setMessage = function setMessage (locale, key, message) {
|
||
if (! this.hasLocale(locale)) {
|
||
this.container[locale] = {
|
||
messages: {},
|
||
attributes: {}
|
||
};
|
||
}
|
||
|
||
this.container[locale].messages[key] = message;
|
||
};
|
||
|
||
Dictionary.prototype.setAttribute = function setAttribute (locale, key, attribute) {
|
||
if (! this.hasLocale(locale)) {
|
||
this.container[locale] = {
|
||
messages: {},
|
||
attributes: {}
|
||
};
|
||
}
|
||
|
||
this.container[locale].attributes[key] = attribute;
|
||
};
|
||
|
||
Object.defineProperties( Dictionary.prototype, prototypeAccessors );
|
||
|
||
//
|
||
|
||
var normalizeValue = function (value) {
|
||
if (isObject(value)) {
|
||
return Object.keys(value).reduce(function (prev, key) {
|
||
prev[key] = normalizeValue(value[key]);
|
||
|
||
return prev;
|
||
}, {});
|
||
}
|
||
|
||
if (isCallable(value)) {
|
||
return value('{0}', ['{1}', '{2}', '{3}']);
|
||
}
|
||
|
||
return value;
|
||
};
|
||
|
||
var normalizeFormat = function (locale) {
|
||
// normalize messages
|
||
var dictionary = {};
|
||
if (locale.messages) {
|
||
dictionary.messages = normalizeValue(locale.messages);
|
||
}
|
||
|
||
if (locale.custom) {
|
||
dictionary.custom = normalizeValue(locale.custom);
|
||
}
|
||
|
||
if (locale.attributes) {
|
||
dictionary.attributes = locale.attributes;
|
||
}
|
||
|
||
if (!isNullOrUndefined(locale.dateFormat)) {
|
||
dictionary.dateFormat = locale.dateFormat;
|
||
}
|
||
|
||
return dictionary;
|
||
};
|
||
|
||
var I18nDictionary = function I18nDictionary (i18n, rootKey) {
|
||
this.i18n = i18n;
|
||
this.rootKey = rootKey;
|
||
};
|
||
|
||
var prototypeAccessors$1 = { locale: { configurable: true } };
|
||
|
||
prototypeAccessors$1.locale.get = function () {
|
||
return this.i18n.locale;
|
||
};
|
||
|
||
prototypeAccessors$1.locale.set = function (value) {
|
||
warn('Cannot set locale from the validator when using vue-i18n, use i18n.locale setter instead');
|
||
};
|
||
|
||
I18nDictionary.prototype.getDateFormat = function getDateFormat (locale) {
|
||
return this.i18n.getDateTimeFormat(locale || this.locale);
|
||
};
|
||
|
||
I18nDictionary.prototype.setDateFormat = function setDateFormat (locale, value) {
|
||
this.i18n.setDateTimeFormat(locale || this.locale, value);
|
||
};
|
||
|
||
I18nDictionary.prototype.getMessage = function getMessage (locale, key, data) {
|
||
var path = (this.rootKey) + ".messages." + key;
|
||
if (!this.i18n.te(path)) {
|
||
return this.i18n.t(((this.rootKey) + ".messages._default"), locale, data);
|
||
}
|
||
|
||
return this.i18n.t(path, locale, data);
|
||
};
|
||
|
||
I18nDictionary.prototype.getAttribute = function getAttribute (locale, key, fallback) {
|
||
if ( fallback === void 0 ) fallback = '';
|
||
|
||
var path = (this.rootKey) + ".attributes." + key;
|
||
if (!this.i18n.te(path)) {
|
||
return fallback;
|
||
}
|
||
|
||
return this.i18n.t(path, locale);
|
||
};
|
||
|
||
I18nDictionary.prototype.getFieldMessage = function getFieldMessage (locale, field, key, data) {
|
||
var path = (this.rootKey) + ".custom." + field + "." + key;
|
||
if (this.i18n.te(path)) {
|
||
return this.i18n.t(path);
|
||
}
|
||
|
||
return this.getMessage(locale, key, data);
|
||
};
|
||
|
||
I18nDictionary.prototype.merge = function merge$1$$1 (dictionary) {
|
||
var this$1 = this;
|
||
|
||
Object.keys(dictionary).forEach(function (localeKey) {
|
||
var obj;
|
||
|
||
// i18n doesn't deep merge
|
||
// first clone the existing locale (avoid mutations to locale)
|
||
var clone = merge$1({}, getPath((localeKey + "." + (this$1.rootKey)), this$1.i18n.messages, {}));
|
||
// Merge cloned locale with new one
|
||
var locale = merge$1(clone, normalizeFormat(dictionary[localeKey]));
|
||
this$1.i18n.mergeLocaleMessage(localeKey, ( obj = {}, obj[this$1.rootKey] = locale, obj ));
|
||
if (locale.dateFormat) {
|
||
this$1.i18n.setDateTimeFormat(localeKey, locale.dateFormat);
|
||
}
|
||
});
|
||
};
|
||
|
||
I18nDictionary.prototype.setMessage = function setMessage (locale, key, value) {
|
||
var obj, obj$1;
|
||
|
||
this.merge(( obj$1 = {}, obj$1[locale] = {
|
||
messages: ( obj = {}, obj[key] = value, obj )
|
||
}, obj$1 ));
|
||
};
|
||
|
||
I18nDictionary.prototype.setAttribute = function setAttribute (locale, key, value) {
|
||
var obj, obj$1;
|
||
|
||
this.merge(( obj$1 = {}, obj$1[locale] = {
|
||
attributes: ( obj = {}, obj[key] = value, obj )
|
||
}, obj$1 ));
|
||
};
|
||
|
||
Object.defineProperties( I18nDictionary.prototype, prototypeAccessors$1 );
|
||
|
||
//
|
||
|
||
var defaultConfig = {
|
||
locale: 'en',
|
||
delay: 0,
|
||
errorBagName: 'errors',
|
||
dictionary: null,
|
||
strict: true,
|
||
fieldsBagName: 'fields',
|
||
classes: false,
|
||
classNames: null,
|
||
events: 'input',
|
||
inject: true,
|
||
fastExit: true,
|
||
aria: true,
|
||
validity: false,
|
||
i18n: null,
|
||
i18nRootKey: 'validation'
|
||
};
|
||
|
||
var currentConfig = assign({}, defaultConfig);
|
||
var dependencies = {
|
||
dictionary: new Dictionary({
|
||
en: {
|
||
messages: {},
|
||
attributes: {},
|
||
custom: {}
|
||
}
|
||
})
|
||
};
|
||
|
||
var Config = function Config () {};
|
||
|
||
var staticAccessors = { default: { configurable: true },current: { configurable: true } };
|
||
|
||
staticAccessors.default.get = function () {
|
||
return defaultConfig;
|
||
};
|
||
|
||
staticAccessors.current.get = function () {
|
||
return currentConfig;
|
||
};
|
||
|
||
Config.dependency = function dependency (key) {
|
||
return dependencies[key];
|
||
};
|
||
|
||
/**
|
||
* Merges the config with a new one.
|
||
*/
|
||
Config.merge = function merge (config) {
|
||
currentConfig = assign({}, currentConfig, config);
|
||
if (currentConfig.i18n) {
|
||
Config.register('dictionary', new I18nDictionary(currentConfig.i18n, currentConfig.i18nRootKey));
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Registers a dependency.
|
||
*/
|
||
Config.register = function register (key, value) {
|
||
dependencies[key] = value;
|
||
};
|
||
|
||
/**
|
||
* Resolves the working config from a Vue instance.
|
||
*/
|
||
Config.resolve = function resolve (context) {
|
||
var selfConfig = getPath('$options.$_veeValidate', context, {});
|
||
|
||
return assign({}, Config.current, selfConfig);
|
||
};
|
||
|
||
Object.defineProperties( Config, staticAccessors );
|
||
|
||
//
|
||
|
||
var ErrorBag = function ErrorBag (errorBag, id) {
|
||
if ( errorBag === void 0 ) errorBag = null;
|
||
if ( id === void 0 ) id = null;
|
||
|
||
this.vmId = id || null;
|
||
// make this bag a mirror of the provided one, sharing the same items reference.
|
||
if (errorBag && errorBag instanceof ErrorBag) {
|
||
this.items = errorBag.items;
|
||
} else {
|
||
this.items = [];
|
||
}
|
||
};
|
||
|
||
ErrorBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {
|
||
var this$1 = this;
|
||
|
||
var index = 0;
|
||
return {
|
||
next: function () {
|
||
return { value: this$1.items[index++], done: index > this$1.items.length };
|
||
}
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Adds an error to the internal array.
|
||
*/
|
||
ErrorBag.prototype.add = function add (error) {
|
||
var ref;
|
||
|
||
(ref = this.items).push.apply(
|
||
ref, this._normalizeError(error)
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Normalizes passed errors to an error array.
|
||
*/
|
||
ErrorBag.prototype._normalizeError = function _normalizeError (error) {
|
||
var this$1 = this;
|
||
|
||
if (Array.isArray(error)) {
|
||
return error.map(function (e) {
|
||
e.scope = !isNullOrUndefined(e.scope) ? e.scope : null;
|
||
e.vmId = !isNullOrUndefined(e.vmId) ? e.vmId : (this$1.vmId || null);
|
||
|
||
return e;
|
||
});
|
||
}
|
||
|
||
error.scope = !isNullOrUndefined(error.scope) ? error.scope : null;
|
||
error.vmId = !isNullOrUndefined(error.vmId) ? error.vmId : (this.vmId || null);
|
||
|
||
return [error];
|
||
};
|
||
|
||
/**
|
||
* Regenrates error messages if they have a generator function.
|
||
*/
|
||
ErrorBag.prototype.regenerate = function regenerate () {
|
||
this.items.forEach(function (i) {
|
||
i.msg = isCallable(i.regenerate) ? i.regenerate() : i.msg;
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Updates a field error with the new field scope.
|
||
*/
|
||
ErrorBag.prototype.update = function update (id, error) {
|
||
var item = find(this.items, function (i) { return i.id === id; });
|
||
if (!item) {
|
||
return;
|
||
}
|
||
|
||
var idx = this.items.indexOf(item);
|
||
this.items.splice(idx, 1);
|
||
item.scope = error.scope;
|
||
this.items.push(item);
|
||
};
|
||
|
||
/**
|
||
* Gets all error messages from the internal array.
|
||
*/
|
||
ErrorBag.prototype.all = function all (scope) {
|
||
var this$1 = this;
|
||
|
||
var filterFn = function (item) {
|
||
var matchesScope = true;
|
||
var matchesVM = true;
|
||
if (!isNullOrUndefined(scope)) {
|
||
matchesScope = item.scope === scope;
|
||
}
|
||
|
||
if (!isNullOrUndefined(this$1.vmId)) {
|
||
matchesVM = item.vmId === this$1.vmId;
|
||
}
|
||
|
||
return matchesVM && matchesScope;
|
||
};
|
||
|
||
return this.items.filter(filterFn).map(function (e) { return e.msg; });
|
||
};
|
||
|
||
/**
|
||
* Checks if there are any errors in the internal array.
|
||
*/
|
||
ErrorBag.prototype.any = function any (scope) {
|
||
var this$1 = this;
|
||
|
||
var filterFn = function (item) {
|
||
var matchesScope = true;
|
||
if (!isNullOrUndefined(scope)) {
|
||
matchesScope = item.scope === scope;
|
||
}
|
||
|
||
if (!isNullOrUndefined(this$1.vmId)) {
|
||
matchesScope = item.vmId === this$1.vmId;
|
||
}
|
||
|
||
return matchesScope;
|
||
};
|
||
|
||
return !!this.items.filter(filterFn).length;
|
||
};
|
||
|
||
/**
|
||
* Removes all items from the internal array.
|
||
*/
|
||
ErrorBag.prototype.clear = function clear (scope) {
|
||
var this$1 = this;
|
||
|
||
var matchesVM = isNullOrUndefined(this.id) ? function () { return true; } : function (i) { return i.vmId === this$1.vmId; };
|
||
if (isNullOrUndefined(scope)) {
|
||
scope = null;
|
||
}
|
||
|
||
for (var i = 0; i < this.items.length; ++i) {
|
||
if (matchesVM(this$1.items[i]) && this$1.items[i].scope === scope) {
|
||
this$1.items.splice(i, 1);
|
||
--i;
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Collects errors into groups or for a specific field.
|
||
*/
|
||
ErrorBag.prototype.collect = function collect (field, scope, map) {
|
||
if ( map === void 0 ) map = true;
|
||
|
||
var groupErrors = function (items) {
|
||
var fieldsCount = 0;
|
||
var errors = items.reduce(function (collection, error) {
|
||
if (!collection[error.field]) {
|
||
collection[error.field] = [];
|
||
fieldsCount++;
|
||
}
|
||
|
||
collection[error.field].push(map ? error.msg : error);
|
||
|
||
return collection;
|
||
}, {});
|
||
|
||
// reduce the collection to be a single array.
|
||
if (fieldsCount <= 1) {
|
||
return values(errors)[0] || [];
|
||
}
|
||
|
||
return errors;
|
||
};
|
||
|
||
if (isNullOrUndefined(field)) {
|
||
return groupErrors(this.items);
|
||
}
|
||
|
||
var selector = isNullOrUndefined(scope) ? String(field) : (scope + "." + field);
|
||
var ref = this._makeCandidateFilters(selector);
|
||
var isPrimary = ref.isPrimary;
|
||
var isAlt = ref.isAlt;
|
||
|
||
var collected = this.items.reduce(function (prev, curr) {
|
||
if (isPrimary(curr)) {
|
||
prev.primary.push(curr);
|
||
}
|
||
|
||
if (isAlt(curr)) {
|
||
prev.alt.push(curr);
|
||
}
|
||
|
||
return prev;
|
||
}, { primary: [], alt: [] });
|
||
|
||
collected = collected.primary.length ? collected.primary : collected.alt;
|
||
|
||
return groupErrors(collected);
|
||
};
|
||
|
||
/**
|
||
* Gets the internal array length.
|
||
*/
|
||
ErrorBag.prototype.count = function count () {
|
||
var this$1 = this;
|
||
|
||
if (this.vmId) {
|
||
return this.items.filter(function (e) { return e.vmId === this$1.vmId; }).length;
|
||
}
|
||
|
||
return this.items.length;
|
||
};
|
||
|
||
/**
|
||
* Finds and fetches the first error message for the specified field id.
|
||
*/
|
||
ErrorBag.prototype.firstById = function firstById (id) {
|
||
var error = find(this.items, function (i) { return i.id === id; });
|
||
|
||
return error ? error.msg : undefined;
|
||
};
|
||
|
||
/**
|
||
* Gets the first error message for a specific field.
|
||
*/
|
||
ErrorBag.prototype.first = function first (field, scope) {
|
||
if ( scope === void 0 ) scope = null;
|
||
|
||
var selector = isNullOrUndefined(scope) ? field : (scope + "." + field);
|
||
var match = this._match(selector);
|
||
|
||
return match && match.msg;
|
||
};
|
||
|
||
/**
|
||
* Returns the first error rule for the specified field
|
||
*/
|
||
ErrorBag.prototype.firstRule = function firstRule (field, scope) {
|
||
var errors = this.collect(field, scope, false);
|
||
|
||
return (errors.length && errors[0].rule) || undefined;
|
||
};
|
||
|
||
/**
|
||
* Checks if the internal array has at least one error for the specified field.
|
||
*/
|
||
ErrorBag.prototype.has = function has (field, scope) {
|
||
if ( scope === void 0 ) scope = null;
|
||
|
||
return !!this.first(field, scope);
|
||
};
|
||
|
||
/**
|
||
* Gets the first error message for a specific field and a rule.
|
||
*/
|
||
ErrorBag.prototype.firstByRule = function firstByRule (name, rule, scope) {
|
||
if ( scope === void 0 ) scope = null;
|
||
|
||
var error = this.collect(name, scope, false).filter(function (e) { return e.rule === rule; })[0];
|
||
|
||
return (error && error.msg) || undefined;
|
||
};
|
||
|
||
/**
|
||
* Gets the first error message for a specific field that not match the rule.
|
||
*/
|
||
ErrorBag.prototype.firstNot = function firstNot (name, rule, scope) {
|
||
if ( rule === void 0 ) rule = 'required';
|
||
if ( scope === void 0 ) scope = null;
|
||
|
||
var error = this.collect(name, scope, false).filter(function (e) { return e.rule !== rule; })[0];
|
||
|
||
return (error && error.msg) || undefined;
|
||
};
|
||
|
||
/**
|
||
* Removes errors by matching against the id or ids.
|
||
*/
|
||
ErrorBag.prototype.removeById = function removeById (id) {
|
||
var this$1 = this;
|
||
|
||
var condition = function (item) { return item.id === id; };
|
||
if (Array.isArray(id)) {
|
||
condition = function (item) { return id.indexOf(item.id) !== -1; };
|
||
}
|
||
|
||
for (var i = 0; i < this.items.length; ++i) {
|
||
if (condition(this$1.items[i])) {
|
||
this$1.items.splice(i, 1);
|
||
--i;
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Removes all error messages associated with a specific field.
|
||
*/
|
||
ErrorBag.prototype.remove = function remove (field, scope) {
|
||
var this$1 = this;
|
||
|
||
if (isNullOrUndefined(field)) {
|
||
return;
|
||
}
|
||
|
||
var selector = isNullOrUndefined(scope) ? String(field) : (scope + "." + field);
|
||
var ref = this._makeCandidateFilters(selector);
|
||
var isPrimary = ref.isPrimary;
|
||
|
||
for (var i = 0; i < this.items.length; ++i) {
|
||
if (isPrimary(this$1.items[i])) {
|
||
this$1.items.splice(i, 1);
|
||
--i;
|
||
}
|
||
}
|
||
};
|
||
|
||
ErrorBag.prototype._makeCandidateFilters = function _makeCandidateFilters (selector) {
|
||
var this$1 = this;
|
||
|
||
var matchesRule = function () { return true; };
|
||
var matchesScope = function () { return true; };
|
||
var matchesName = function () { return true; };
|
||
var matchesVM = function () { return true; };
|
||
|
||
var ref = parseSelector(selector);
|
||
var id = ref.id;
|
||
var rule = ref.rule;
|
||
var scope = ref.scope;
|
||
var name = ref.name;
|
||
|
||
if (rule) {
|
||
matchesRule = function (item) { return item.rule === rule; };
|
||
}
|
||
|
||
// match by id, can be combined with rule selection.
|
||
if (id) {
|
||
return {
|
||
isPrimary: function (item) { return matchesRule(item) && (function (item) { return id === item.id; }); },
|
||
isAlt: function () { return false; }
|
||
};
|
||
}
|
||
|
||
if (isNullOrUndefined(scope)) {
|
||
// if no scope specified, make sure the found error has no scope.
|
||
matchesScope = function (item) { return isNullOrUndefined(item.scope); };
|
||
} else {
|
||
matchesScope = function (item) { return item.scope === scope; };
|
||
}
|
||
|
||
if (!isNullOrUndefined(name) && name !== '*') {
|
||
matchesName = function (item) { return item.field === name; };
|
||
}
|
||
|
||
if (!isNullOrUndefined(this.vmId)) {
|
||
matchesVM = function (item) { return item.vmId === this$1.vmId; };
|
||
}
|
||
|
||
// matches the first candidate.
|
||
var isPrimary = function (item) {
|
||
return matchesVM(item) && matchesName(item) && matchesRule(item) && matchesScope(item);
|
||
};
|
||
|
||
// matches a second candidate, which is a field with a name containing the '.' character.
|
||
var isAlt = function (item) {
|
||
return matchesVM(item) && matchesRule(item) && item.field === (scope + "." + name);
|
||
};
|
||
|
||
return {
|
||
isPrimary: isPrimary,
|
||
isAlt: isAlt
|
||
};
|
||
};
|
||
|
||
ErrorBag.prototype._match = function _match (selector) {
|
||
if (isNullOrUndefined(selector)) {
|
||
return undefined;
|
||
}
|
||
|
||
var ref = this._makeCandidateFilters(selector);
|
||
var isPrimary = ref.isPrimary;
|
||
var isAlt = ref.isAlt;
|
||
|
||
return this.items.reduce(function (prev, item, idx, arr) {
|
||
var isLast = idx === arr.length - 1;
|
||
if (prev.primary) {
|
||
return isLast ? prev.primary : prev;
|
||
}
|
||
|
||
if (isPrimary(item)) {
|
||
prev.primary = item;
|
||
}
|
||
|
||
if (isAlt(item)) {
|
||
prev.alt = item;
|
||
}
|
||
|
||
// keep going.
|
||
if (!isLast) {
|
||
return prev;
|
||
}
|
||
|
||
return prev.primary || prev.alt;
|
||
}, {});
|
||
};
|
||
|
||
/**
|
||
* Generates the options required to construct a field.
|
||
*/
|
||
var Resolver = function Resolver () {};
|
||
|
||
Resolver.generate = function generate (el, binding, vnode) {
|
||
var model = Resolver.resolveModel(binding, vnode);
|
||
var options = Config.resolve(vnode.context);
|
||
|
||
return {
|
||
name: Resolver.resolveName(el, vnode),
|
||
el: el,
|
||
listen: !binding.modifiers.disable,
|
||
bails: binding.modifiers.bails ? true : (binding.modifiers.continues === true ? false : undefined),
|
||
scope: Resolver.resolveScope(el, binding, vnode),
|
||
vm: Resolver.makeVM(vnode.context),
|
||
expression: binding.value,
|
||
component: vnode.componentInstance,
|
||
classes: options.classes,
|
||
classNames: options.classNames,
|
||
getter: Resolver.resolveGetter(el, vnode, model),
|
||
events: Resolver.resolveEvents(el, vnode) || options.events,
|
||
model: model,
|
||
delay: Resolver.resolveDelay(el, vnode, options),
|
||
rules: Resolver.resolveRules(el, binding, vnode),
|
||
immediate: !!binding.modifiers.initial || !!binding.modifiers.immediate,
|
||
validity: options.validity,
|
||
aria: options.aria,
|
||
initialValue: Resolver.resolveInitialValue(vnode)
|
||
};
|
||
};
|
||
|
||
Resolver.getCtorConfig = function getCtorConfig (vnode) {
|
||
if (!vnode.componentInstance) { return null; }
|
||
|
||
var config = getPath('componentInstance.$options.$_veeValidate', vnode);
|
||
|
||
return config;
|
||
};
|
||
|
||
/**
|
||
* Resolves the rules defined on an element.
|
||
*/
|
||
Resolver.resolveRules = function resolveRules (el, binding, vnode) {
|
||
var rules = '';
|
||
if (!binding.value && (!binding || !binding.expression)) {
|
||
rules = getDataAttribute(el, 'rules');
|
||
}
|
||
|
||
if (binding.value && includes(['string', 'object'], typeof binding.value.rules)) {
|
||
rules = binding.value.rules;
|
||
} else if (binding.value) {
|
||
rules = binding.value;
|
||
}
|
||
|
||
if (vnode.componentInstance) {
|
||
return rules;
|
||
}
|
||
|
||
return fillRulesFromElement(el, rules);
|
||
};
|
||
|
||
/**
|
||
* @param {*} vnode
|
||
*/
|
||
Resolver.resolveInitialValue = function resolveInitialValue (vnode) {
|
||
var model = vnode.data.model || find(vnode.data.directives, function (d) { return d.name === 'model'; });
|
||
|
||
return model && model.value;
|
||
};
|
||
|
||
/**
|
||
* Creates a non-circular partial VM instance from a Vue instance.
|
||
* @param {*} vm
|
||
*/
|
||
Resolver.makeVM = function makeVM (vm) {
|
||
return {
|
||
get $el () {
|
||
return vm.$el;
|
||
},
|
||
get $refs () {
|
||
return vm.$refs;
|
||
},
|
||
$watch: vm.$watch ? vm.$watch.bind(vm) : function () {},
|
||
$validator: vm.$validator ? {
|
||
errors: vm.$validator.errors,
|
||
validate: vm.$validator.validate.bind(vm.$validator),
|
||
update: vm.$validator.update.bind(vm.$validator)
|
||
} : null
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Resolves the delay value.
|
||
* @param {*} el
|
||
* @param {*} vnode
|
||
* @param {Object} options
|
||
*/
|
||
Resolver.resolveDelay = function resolveDelay (el, vnode, options) {
|
||
var delay = getDataAttribute(el, 'delay');
|
||
var globalDelay = (options && 'delay' in options) ? options.delay : 0;
|
||
|
||
if (!delay && vnode.componentInstance && vnode.componentInstance.$attrs) {
|
||
delay = vnode.componentInstance.$attrs['data-vv-delay'];
|
||
}
|
||
|
||
if (!isObject(globalDelay)) {
|
||
return deepParseInt(delay || globalDelay);
|
||
}
|
||
|
||
if (!isNullOrUndefined(delay)) {
|
||
globalDelay.input = delay;
|
||
}
|
||
|
||
return deepParseInt(globalDelay);
|
||
};
|
||
|
||
/**
|
||
* Resolves the events to validate in response to.
|
||
* @param {*} el
|
||
* @param {*} vnode
|
||
*/
|
||
Resolver.resolveEvents = function resolveEvents (el, vnode) {
|
||
// resolve it from the root element.
|
||
var events = getDataAttribute(el, 'validate-on');
|
||
|
||
// resolve from data-vv-validate-on if its a vue component.
|
||
if (!events && vnode.componentInstance && vnode.componentInstance.$attrs) {
|
||
events = vnode.componentInstance.$attrs['data-vv-validate-on'];
|
||
}
|
||
|
||
// resolve it from $_veeValidate options.
|
||
if (!events && vnode.componentInstance) {
|
||
var config = Resolver.getCtorConfig(vnode);
|
||
events = config && config.events;
|
||
}
|
||
|
||
if (!events && Config.current.events) {
|
||
events = Config.current.events;
|
||
}
|
||
|
||
// resolve the model event if its configured for custom components.
|
||
if (events && vnode.componentInstance && includes(events, 'input')) {
|
||
var ref = vnode.componentInstance.$options.model || { event: 'input' };
|
||
var event = ref.event;
|
||
events = events.replace('input', event);
|
||
}
|
||
|
||
return events;
|
||
};
|
||
|
||
/**
|
||
* Resolves the scope for the field.
|
||
* @param {*} el
|
||
* @param {*} binding
|
||
*/
|
||
Resolver.resolveScope = function resolveScope (el, binding, vnode) {
|
||
if ( vnode === void 0 ) vnode = {};
|
||
|
||
var scope = null;
|
||
if (vnode.componentInstance && isNullOrUndefined(scope)) {
|
||
scope = vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-scope'];
|
||
}
|
||
|
||
return !isNullOrUndefined(scope) ? scope : getScope(el);
|
||
};
|
||
|
||
/**
|
||
* Checks if the node directives contains a v-model or a specified arg.
|
||
* Args take priority over models.
|
||
*
|
||
* @return {Object}
|
||
*/
|
||
Resolver.resolveModel = function resolveModel (binding, vnode) {
|
||
if (binding.arg) {
|
||
return { expression: binding.arg };
|
||
}
|
||
|
||
var model = vnode.data.model || find(vnode.data.directives, function (d) { return d.name === 'model'; });
|
||
if (!model) {
|
||
return null;
|
||
}
|
||
|
||
// https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L26
|
||
var watchable = !/[^\w.$]/.test(model.expression) && hasPath(model.expression, vnode.context);
|
||
var lazy = !!(model.modifiers && model.modifiers.lazy);
|
||
|
||
if (!watchable) {
|
||
return { expression: null, lazy: lazy };
|
||
}
|
||
|
||
return { expression: model.expression, lazy: lazy };
|
||
};
|
||
|
||
/**
|
||
* Resolves the field name to trigger validations.
|
||
* @return {String} The field name.
|
||
*/
|
||
Resolver.resolveName = function resolveName (el, vnode) {
|
||
var name = getDataAttribute(el, 'name');
|
||
|
||
if (!name && !vnode.componentInstance) {
|
||
return el.name;
|
||
}
|
||
|
||
if (!name && vnode.componentInstance && vnode.componentInstance.$attrs) {
|
||
name = vnode.componentInstance.$attrs['data-vv-name'] || vnode.componentInstance.$attrs['name'];
|
||
}
|
||
|
||
if (!name && vnode.componentInstance) {
|
||
var config = Resolver.getCtorConfig(vnode);
|
||
if (config && isCallable(config.name)) {
|
||
var boundGetter = config.name.bind(vnode.componentInstance);
|
||
|
||
return boundGetter();
|
||
}
|
||
|
||
return vnode.componentInstance.name;
|
||
}
|
||
|
||
return name;
|
||
};
|
||
|
||
/**
|
||
* Returns a value getter input type.
|
||
*/
|
||
Resolver.resolveGetter = function resolveGetter (el, vnode, model) {
|
||
if (model && model.expression) {
|
||
return function () {
|
||
return getPath(model.expression, vnode.context);
|
||
};
|
||
}
|
||
|
||
if (vnode.componentInstance) {
|
||
var path = getDataAttribute(el, 'value-path') || (vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-value-path']);
|
||
if (path) {
|
||
return function () {
|
||
return getPath(path, vnode.componentInstance);
|
||
};
|
||
}
|
||
|
||
var config = Resolver.getCtorConfig(vnode);
|
||
if (config && isCallable(config.value)) {
|
||
var boundGetter = config.value.bind(vnode.componentInstance);
|
||
|
||
return function () {
|
||
return boundGetter();
|
||
};
|
||
}
|
||
|
||
var ref = vnode.componentInstance.$options.model || { prop: 'value' };
|
||
var prop = ref.prop;
|
||
|
||
return function () {
|
||
return vnode.componentInstance[prop];
|
||
};
|
||
}
|
||
|
||
switch (el.type) {
|
||
case 'checkbox': return function () {
|
||
var els = document.querySelectorAll(("input[name=\"" + (el.name) + "\"]"));
|
||
|
||
els = toArray(els).filter(function (el) { return el.checked; });
|
||
if (!els.length) { return undefined; }
|
||
|
||
return els.map(function (checkbox) { return checkbox.value; });
|
||
};
|
||
case 'radio': return function () {
|
||
var els = document.querySelectorAll(("input[name=\"" + (el.name) + "\"]"));
|
||
var elm = find(els, function (el) { return el.checked; });
|
||
|
||
return elm && elm.value;
|
||
};
|
||
case 'file': return function (context) {
|
||
return toArray(el.files);
|
||
};
|
||
case 'select-multiple': return function () {
|
||
return toArray(el.options).filter(function (opt) { return opt.selected; }).map(function (opt) { return opt.value; });
|
||
};
|
||
default: return function () {
|
||
return el && el.value;
|
||
};
|
||
}
|
||
};
|
||
|
||
//
|
||
|
||
var RULES = {};
|
||
var STRICT_MODE = true;
|
||
|
||
var Validator = function Validator (validations, options) {
|
||
if ( options === void 0 ) options = { fastExit: true };
|
||
|
||
this.strict = STRICT_MODE;
|
||
this.errors = new ErrorBag();
|
||
this.fields = new FieldBag();
|
||
this._createFields(validations);
|
||
this.paused = false;
|
||
this.fastExit = !isNullOrUndefined(options && options.fastExit) ? options.fastExit : true;
|
||
};
|
||
|
||
var prototypeAccessors$2 = { rules: { configurable: true },flags: { configurable: true },dictionary: { configurable: true },_vm: { configurable: true },locale: { configurable: true } };
|
||
var staticAccessors$1 = { rules: { configurable: true },dictionary: { configurable: true },locale: { configurable: true } };
|
||
|
||
staticAccessors$1.rules.get = function () {
|
||
return RULES;
|
||
};
|
||
|
||
prototypeAccessors$2.rules.get = function () {
|
||
return RULES;
|
||
};
|
||
|
||
prototypeAccessors$2.flags.get = function () {
|
||
return this.fields.items.reduce(function (acc, field) {
|
||
var obj;
|
||
|
||
if (field.scope) {
|
||
acc[("$" + (field.scope))] = ( obj = {}, obj[field.name] = field.flags, obj );
|
||
|
||
return acc;
|
||
}
|
||
|
||
acc[field.name] = field.flags;
|
||
|
||
return acc;
|
||
}, {});
|
||
};
|
||
|
||
/**
|
||
* Getter for the dictionary.
|
||
*/
|
||
prototypeAccessors$2.dictionary.get = function () {
|
||
return Config.dependency('dictionary');
|
||
};
|
||
|
||
staticAccessors$1.dictionary.get = function () {
|
||
return Config.dependency('dictionary');
|
||
};
|
||
|
||
prototypeAccessors$2._vm.get = function () {
|
||
return Config.dependency('vm');
|
||
};
|
||
|
||
/**
|
||
* Getter for the current locale.
|
||
*/
|
||
prototypeAccessors$2.locale.get = function () {
|
||
return Validator.locale;
|
||
};
|
||
|
||
/**
|
||
* Setter for the validator locale.
|
||
*/
|
||
prototypeAccessors$2.locale.set = function (value) {
|
||
Validator.locale = value;
|
||
};
|
||
|
||
staticAccessors$1.locale.get = function () {
|
||
return this.dictionary.locale;
|
||
};
|
||
|
||
/**
|
||
* Setter for the validator locale.
|
||
*/
|
||
staticAccessors$1.locale.set = function (value) {
|
||
var hasChanged = value !== Validator.dictionary.locale;
|
||
Validator.dictionary.locale = value;
|
||
if (hasChanged && Config.dependency('vm')) {
|
||
Config.dependency('vm').$emit('localeChanged');
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Static constructor.
|
||
*/
|
||
Validator.create = function create (validations, options) {
|
||
return new Validator(validations, options);
|
||
};
|
||
|
||
/**
|
||
* Adds a custom validator to the list of validation rules.
|
||
*/
|
||
Validator.extend = function extend (name, validator, options) {
|
||
if ( options === void 0 ) options = {};
|
||
|
||
Validator._guardExtend(name, validator);
|
||
Validator._merge(name, {
|
||
validator: validator,
|
||
options: assign({}, { hasTarget: false, immediate: true }, options || {})
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Removes a rule from the list of validators.
|
||
*/
|
||
Validator.remove = function remove (name) {
|
||
delete RULES[name];
|
||
};
|
||
|
||
/**
|
||
* Checks if the given rule name is a rule that targets other fields.
|
||
*/
|
||
Validator.isTargetRule = function isTargetRule (name) {
|
||
return !!RULES[name] && RULES[name].options.hasTarget;
|
||
};
|
||
|
||
/**
|
||
* Sets the operating mode for all newly created validators.
|
||
* strictMode = true: Values without a rule are invalid and cause failure.
|
||
* strictMode = false: Values without a rule are valid and are skipped.
|
||
*/
|
||
Validator.setStrictMode = function setStrictMode (strictMode) {
|
||
if ( strictMode === void 0 ) strictMode = true;
|
||
|
||
STRICT_MODE = strictMode;
|
||
};
|
||
|
||
/**
|
||
* Adds and sets the current locale for the validator.
|
||
*/
|
||
Validator.prototype.localize = function localize (lang, dictionary) {
|
||
Validator.localize(lang, dictionary);
|
||
};
|
||
|
||
/**
|
||
* Adds and sets the current locale for the validator.
|
||
*/
|
||
Validator.localize = function localize (lang, dictionary) {
|
||
var obj;
|
||
|
||
if (isObject(lang)) {
|
||
Validator.dictionary.merge(lang);
|
||
return;
|
||
}
|
||
|
||
// merge the dictionary.
|
||
if (dictionary) {
|
||
var locale = lang || dictionary.name;
|
||
dictionary = assign({}, dictionary);
|
||
Validator.dictionary.merge(( obj = {}, obj[locale] = dictionary, obj ));
|
||
}
|
||
|
||
if (lang) {
|
||
// set the locale.
|
||
Validator.locale = lang;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Registers a field to be validated.
|
||
*/
|
||
Validator.prototype.attach = function attach (fieldOpts) {
|
||
// fixes initial value detection with v-model and select elements.
|
||
var value = fieldOpts.initialValue;
|
||
var field = new Field(fieldOpts);
|
||
this.fields.push(field);
|
||
|
||
// validate the field initially
|
||
if (field.immediate) {
|
||
this.validate(("#" + (field.id)), value || field.value);
|
||
} else {
|
||
this._validate(field, value || field.value, { initial: true }).then(function (result) {
|
||
field.flags.valid = result.valid;
|
||
field.flags.invalid = !result.valid;
|
||
});
|
||
}
|
||
|
||
return field;
|
||
};
|
||
|
||
/**
|
||
* Sets the flags on a field.
|
||
*/
|
||
Validator.prototype.flag = function flag (name, flags, uid) {
|
||
if ( uid === void 0 ) uid = null;
|
||
|
||
var field = this._resolveField(name, undefined, uid);
|
||
if (!field || !flags) {
|
||
return;
|
||
}
|
||
|
||
field.setFlags(flags);
|
||
};
|
||
|
||
/**
|
||
* Removes a field from the validator.
|
||
*/
|
||
Validator.prototype.detach = function detach (name, scope, uid) {
|
||
var field = isCallable(name.destroy) ? name : this._resolveField(name, scope, uid);
|
||
if (!field) { return; }
|
||
|
||
field.destroy();
|
||
this.errors.remove(field.name, field.scope, field.id);
|
||
this.fields.remove(field);
|
||
};
|
||
|
||
/**
|
||
* Adds a custom validator to the list of validation rules.
|
||
*/
|
||
Validator.prototype.extend = function extend (name, validator, options) {
|
||
if ( options === void 0 ) options = {};
|
||
|
||
Validator.extend(name, validator, options);
|
||
};
|
||
|
||
Validator.prototype.reset = function reset (matcher) {
|
||
var this$1 = this;
|
||
|
||
// two ticks
|
||
return this._vm.$nextTick().then(function () {
|
||
return this$1._vm.$nextTick();
|
||
}).then(function () {
|
||
this$1.fields.filter(matcher).forEach(function (field) {
|
||
field.reset(); // reset field flags.
|
||
this$1.errors.remove(field.name, field.scope, field.id);
|
||
});
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Updates a field, updating both errors and flags.
|
||
*/
|
||
Validator.prototype.update = function update (id, ref) {
|
||
var scope = ref.scope;
|
||
|
||
var field = this._resolveField(("#" + id));
|
||
if (!field) { return; }
|
||
|
||
// remove old scope.
|
||
this.errors.update(id, { scope: scope });
|
||
};
|
||
|
||
/**
|
||
* Removes a rule from the list of validators.
|
||
*/
|
||
Validator.prototype.remove = function remove (name) {
|
||
Validator.remove(name);
|
||
};
|
||
|
||
/**
|
||
* Validates a value against a registered field validations.
|
||
*/
|
||
Validator.prototype.validate = function validate (fieldDescriptor, value, ref) {
|
||
var this$1 = this;
|
||
if ( ref === void 0 ) ref = {};
|
||
var silent = ref.silent;
|
||
var vmId = ref.vmId;
|
||
|
||
if (this.paused) { return Promise.resolve(true); }
|
||
|
||
// overload to validate all.
|
||
if (isNullOrUndefined(fieldDescriptor)) {
|
||
return this.validateScopes({ silent: silent, vmId: vmId });
|
||
}
|
||
|
||
// overload to validate scope-less fields.
|
||
if (fieldDescriptor === '*') {
|
||
return this.validateAll(undefined, { silent: silent, vmId: vmId });
|
||
}
|
||
|
||
// if scope validation was requested.
|
||
if (/^(.+)\.\*$/.test(fieldDescriptor)) {
|
||
var matched = fieldDescriptor.match(/^(.+)\.\*$/)[1];
|
||
return this.validateAll(matched);
|
||
}
|
||
|
||
var field = this._resolveField(fieldDescriptor);
|
||
if (!field) {
|
||
return this._handleFieldNotFound(name);
|
||
}
|
||
|
||
if (!silent) { field.flags.pending = true; }
|
||
if (value === undefined) {
|
||
value = field.value;
|
||
}
|
||
|
||
return this._validate(field, value).then(function (result) {
|
||
if (!silent) {
|
||
this$1._handleValidationResults([result]);
|
||
}
|
||
|
||
return result.valid;
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Pauses the validator.
|
||
*/
|
||
Validator.prototype.pause = function pause () {
|
||
this.paused = true;
|
||
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Resumes the validator.
|
||
*/
|
||
Validator.prototype.resume = function resume () {
|
||
this.paused = false;
|
||
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Validates each value against the corresponding field validations.
|
||
*/
|
||
Validator.prototype.validateAll = function validateAll (values$$1, ref) {
|
||
var this$1 = this;
|
||
if ( ref === void 0 ) ref = {};
|
||
var silent = ref.silent;
|
||
var vmId = ref.vmId;
|
||
|
||
if (this.paused) { return Promise.resolve(true); }
|
||
|
||
var matcher = null;
|
||
var providedValues = false;
|
||
|
||
if (typeof values$$1 === 'string') {
|
||
matcher = { scope: values$$1, vmId: vmId };
|
||
} else if (isObject(values$$1)) {
|
||
matcher = Object.keys(values$$1).map(function (key) {
|
||
return { name: key, vmId: vmId, scope: null };
|
||
});
|
||
providedValues = true;
|
||
} else if (Array.isArray(values$$1)) {
|
||
matcher = values$$1.map(function (key) {
|
||
return { name: key, vmId: vmId };
|
||
});
|
||
} else {
|
||
matcher = { scope: null, vmId: vmId };
|
||
}
|
||
|
||
return Promise.all(
|
||
this.fields.filter(matcher).map(function (field) { return this$1._validate(field, providedValues ? values$$1[field.name] : field.value); })
|
||
).then(function (results) {
|
||
if (!silent) {
|
||
this$1._handleValidationResults(results);
|
||
}
|
||
|
||
return results.every(function (t) { return t.valid; });
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Validates all scopes.
|
||
*/
|
||
Validator.prototype.validateScopes = function validateScopes (ref) {
|
||
var this$1 = this;
|
||
if ( ref === void 0 ) ref = {};
|
||
var silent = ref.silent;
|
||
var vmId = ref.vmId;
|
||
|
||
if (this.paused) { return Promise.resolve(true); }
|
||
|
||
return Promise.all(
|
||
this.fields.filter({ vmId: vmId }).map(function (field) { return this$1._validate(field, field.value); })
|
||
).then(function (results) {
|
||
if (!silent) {
|
||
this$1._handleValidationResults(results);
|
||
}
|
||
|
||
return results.every(function (t) { return t.valid; });
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Perform cleanup.
|
||
*/
|
||
Validator.prototype.destroy = function destroy () {
|
||
this._vm.$off('localeChanged');
|
||
};
|
||
|
||
/**
|
||
* Creates the fields to be validated.
|
||
*/
|
||
Validator.prototype._createFields = function _createFields (validations) {
|
||
var this$1 = this;
|
||
|
||
if (!validations) { return; }
|
||
|
||
Object.keys(validations).forEach(function (field) {
|
||
var options = assign({}, { name: field, rules: validations[field] });
|
||
this$1.attach(options);
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Date rules need the existence of a format, so date_format must be supplied.
|
||
*/
|
||
Validator.prototype._getDateFormat = function _getDateFormat (validations) {
|
||
var format = null;
|
||
if (validations.date_format && Array.isArray(validations.date_format)) {
|
||
format = validations.date_format[0];
|
||
}
|
||
|
||
return format || this.dictionary.getDateFormat(this.locale);
|
||
};
|
||
|
||
/**
|
||
* Formats an error message for field and a rule.
|
||
*/
|
||
Validator.prototype._formatErrorMessage = function _formatErrorMessage (field, rule, data, targetName) {
|
||
if ( data === void 0 ) data = {};
|
||
if ( targetName === void 0 ) targetName = null;
|
||
|
||
var name = this._getFieldDisplayName(field);
|
||
var params = this._getLocalizedParams(rule, targetName);
|
||
|
||
return this.dictionary.getFieldMessage(this.locale, field.name, rule.name, [name, params, data]);
|
||
};
|
||
|
||
/**
|
||
* Translates the parameters passed to the rule (mainly for target fields).
|
||
*/
|
||
Validator.prototype._getLocalizedParams = function _getLocalizedParams (rule, targetName) {
|
||
if ( targetName === void 0 ) targetName = null;
|
||
|
||
if (rule.options.hasTarget && rule.params && rule.params[0]) {
|
||
var localizedName = targetName || this.dictionary.getAttribute(this.locale, rule.params[0], rule.params[0]);
|
||
return [localizedName].concat(rule.params.slice(1));
|
||
}
|
||
|
||
return rule.params;
|
||
};
|
||
|
||
/**
|
||
* Resolves an appropriate display name, first checking 'data-as' or the registered 'prettyName'
|
||
*/
|
||
Validator.prototype._getFieldDisplayName = function _getFieldDisplayName (field) {
|
||
return field.alias || this.dictionary.getAttribute(this.locale, field.name, field.name);
|
||
};
|
||
|
||
/**
|
||
* Tests a single input value against a rule.
|
||
*/
|
||
Validator.prototype._test = function _test (field, value, rule) {
|
||
var this$1 = this;
|
||
|
||
var validator = RULES[rule.name] ? RULES[rule.name].validate : null;
|
||
var params = Array.isArray(rule.params) ? toArray(rule.params) : [];
|
||
var targetName = null;
|
||
if (!validator || typeof validator !== 'function') {
|
||
return Promise.reject(createError(("No such validator '" + (rule.name) + "' exists.")));
|
||
}
|
||
|
||
// has field dependencies.
|
||
if (rule.options.hasTarget) {
|
||
var target = find(field.dependencies, function (d) { return d.name === rule.name; });
|
||
if (target) {
|
||
targetName = target.field.alias;
|
||
params = [target.field.value].concat(params.slice(1));
|
||
}
|
||
} else if (rule.name === 'required' && field.rejectsFalse) {
|
||
// invalidate false if no args were specified and the field rejects false by default.
|
||
params = params.length ? params : [true];
|
||
}
|
||
|
||
if (rule.options.isDate) {
|
||
var dateFormat = this._getDateFormat(field.rules);
|
||
if (rule.name !== 'date_format') {
|
||
params.push(dateFormat);
|
||
}
|
||
}
|
||
|
||
var result = validator(value, params);
|
||
|
||
// If it is a promise.
|
||
if (isCallable(result.then)) {
|
||
return result.then(function (values$$1) {
|
||
var allValid = true;
|
||
var data = {};
|
||
if (Array.isArray(values$$1)) {
|
||
allValid = values$$1.every(function (t) { return (isObject(t) ? t.valid : t); });
|
||
} else { // Is a single object/boolean.
|
||
allValid = isObject(values$$1) ? values$$1.valid : values$$1;
|
||
data = values$$1.data;
|
||
}
|
||
|
||
return {
|
||
valid: allValid,
|
||
errors: allValid ? [] : [this$1._createFieldError(field, rule, data, targetName)]
|
||
};
|
||
});
|
||
}
|
||
|
||
if (!isObject(result)) {
|
||
result = { valid: result, data: {} };
|
||
}
|
||
|
||
return {
|
||
valid: result.valid,
|
||
errors: result.valid ? [] : [this._createFieldError(field, rule, result.data, targetName)]
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Merges a validator object into the RULES and Messages.
|
||
*/
|
||
Validator._merge = function _merge (name, ref) {
|
||
var validator = ref.validator;
|
||
var options = ref.options;
|
||
|
||
var validate = isCallable(validator) ? validator : validator.validate;
|
||
if (validator.getMessage) {
|
||
Validator.dictionary.setMessage(Validator.locale, name, validator.getMessage);
|
||
}
|
||
|
||
RULES[name] = {
|
||
validate: validate,
|
||
options: options
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Guards from extension violations.
|
||
*/
|
||
Validator._guardExtend = function _guardExtend (name, validator) {
|
||
if (isCallable(validator)) {
|
||
return;
|
||
}
|
||
|
||
if (!isCallable(validator.validate)) {
|
||
throw createError(
|
||
("Extension Error: The validator '" + name + "' must be a function or have a 'validate' method.")
|
||
);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Creates a Field Error Object.
|
||
*/
|
||
Validator.prototype._createFieldError = function _createFieldError (field, rule, data, targetName) {
|
||
var this$1 = this;
|
||
|
||
return {
|
||
id: field.id,
|
||
vmId: field.vmId,
|
||
field: field.name,
|
||
msg: this._formatErrorMessage(field, rule, data, targetName),
|
||
rule: rule.name,
|
||
scope: field.scope,
|
||
regenerate: function () {
|
||
return this$1._formatErrorMessage(field, rule, data, targetName);
|
||
}
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Tries different strategies to find a field.
|
||
*/
|
||
Validator.prototype._resolveField = function _resolveField (name, scope, uid) {
|
||
if (name[0] === '#') {
|
||
return this.fields.find({ id: name.slice(1) });
|
||
}
|
||
|
||
if (!isNullOrUndefined(scope)) {
|
||
return this.fields.find({ name: name, scope: scope, vmId: uid });
|
||
}
|
||
|
||
if (includes(name, '.')) {
|
||
var ref = name.split('.');
|
||
var fieldScope = ref[0];
|
||
var fieldName = ref.slice(1);
|
||
var field = this.fields.find({ name: fieldName.join('.'), scope: fieldScope, vmId: uid });
|
||
if (field) {
|
||
return field;
|
||
}
|
||
}
|
||
|
||
return this.fields.find({ name: name, scope: null, vmId: uid });
|
||
};
|
||
|
||
/**
|
||
* Handles when a field is not found depending on the strict flag.
|
||
*/
|
||
Validator.prototype._handleFieldNotFound = function _handleFieldNotFound (name, scope) {
|
||
if (!this.strict) { return Promise.resolve(true); }
|
||
|
||
var fullName = isNullOrUndefined(scope) ? name : ("" + (!isNullOrUndefined(scope) ? scope + '.' : '') + name);
|
||
|
||
return Promise.reject(createError(
|
||
("Validating a non-existent field: \"" + fullName + "\". Use \"attach()\" first.")
|
||
));
|
||
};
|
||
|
||
/**
|
||
* Handles validation results.
|
||
*/
|
||
Validator.prototype._handleValidationResults = function _handleValidationResults (results) {
|
||
var this$1 = this;
|
||
|
||
var matchers = results.map(function (result) { return ({ id: result.id }); });
|
||
this.errors.removeById(matchers.map(function (m) { return m.id; }));
|
||
// remove by name and scope to remove any custom errors added.
|
||
results.forEach(function (result) {
|
||
this$1.errors.remove(result.field, result.scope);
|
||
});
|
||
var allErrors = results.reduce(function (prev, curr) {
|
||
prev.push.apply(prev, curr.errors);
|
||
|
||
return prev;
|
||
}, []);
|
||
|
||
this.errors.add(allErrors);
|
||
|
||
// handle flags.
|
||
this.fields.filter(matchers).forEach(function (field) {
|
||
var result = find(results, function (r) { return r.id === field.id; });
|
||
field.setFlags({
|
||
pending: false,
|
||
valid: result.valid,
|
||
validated: true
|
||
});
|
||
});
|
||
};
|
||
|
||
Validator.prototype._shouldSkip = function _shouldSkip (field, value) {
|
||
// field is configured to run through the pipeline regardless
|
||
if (field.bails === false) {
|
||
return false;
|
||
}
|
||
|
||
// disabled fields are skipped
|
||
if (field.isDisabled) {
|
||
return true;
|
||
}
|
||
|
||
// skip if the field is not required and has an empty value.
|
||
return !field.isRequired && (isNullOrUndefined(value) || value === '');
|
||
};
|
||
|
||
Validator.prototype._shouldBail = function _shouldBail (field, value) {
|
||
// if the field was configured explicitly.
|
||
if (field.bails !== undefined) {
|
||
return field.bails;
|
||
}
|
||
|
||
return this.fastExit;
|
||
};
|
||
|
||
/**
|
||
* Starts the validation process.
|
||
*/
|
||
Validator.prototype._validate = function _validate (field, value, ref) {
|
||
var this$1 = this;
|
||
if ( ref === void 0 ) ref = {};
|
||
var initial = ref.initial;
|
||
|
||
if (this._shouldSkip(field, value)) {
|
||
return Promise.resolve({ valid: true, id: field.id, field: field.name, scope: field.scope, errors: [] });
|
||
}
|
||
|
||
var promises = [];
|
||
var errors = [];
|
||
var isExitEarly = false;
|
||
// use of '.some()' is to break iteration in middle by returning true
|
||
Object.keys(field.rules).filter(function (rule) {
|
||
if (!initial || !RULES[rule]) { return true; }
|
||
|
||
return RULES[rule].options.immediate;
|
||
}).some(function (rule) {
|
||
var ruleOptions = RULES[rule] ? RULES[rule].options : {};
|
||
var result = this$1._test(field, value, { name: rule, params: field.rules[rule], options: ruleOptions });
|
||
if (isCallable(result.then)) {
|
||
promises.push(result);
|
||
} else if (!result.valid && this$1._shouldBail(field, value)) {
|
||
errors.push.apply(errors, result.errors);
|
||
isExitEarly = true;
|
||
} else {
|
||
// promisify the result.
|
||
promises.push(new Promise(function (resolve) { return resolve(result); }));
|
||
}
|
||
|
||
return isExitEarly;
|
||
});
|
||
|
||
if (isExitEarly) {
|
||
return Promise.resolve({ valid: false, errors: errors, id: field.id, field: field.name, scope: field.scope });
|
||
}
|
||
|
||
return Promise.all(promises).then(function (results) {
|
||
return results.reduce(function (prev, v) {
|
||
var ref;
|
||
|
||
if (!v.valid) {
|
||
(ref = prev.errors).push.apply(ref, v.errors);
|
||
}
|
||
|
||
prev.valid = prev.valid && v.valid;
|
||
|
||
return prev;
|
||
}, { valid: true, errors: errors, id: field.id, field: field.name, scope: field.scope });
|
||
});
|
||
};
|
||
|
||
Object.defineProperties( Validator.prototype, prototypeAccessors$2 );
|
||
Object.defineProperties( Validator, staticAccessors$1 );
|
||
|
||
//
|
||
|
||
var DEFAULT_OPTIONS = {
|
||
targetOf: null,
|
||
immediate: false,
|
||
scope: null,
|
||
listen: true,
|
||
name: null,
|
||
rules: {},
|
||
vm: null,
|
||
classes: false,
|
||
validity: true,
|
||
aria: true,
|
||
events: 'input|blur',
|
||
delay: 0,
|
||
classNames: {
|
||
touched: 'touched', // the control has been blurred
|
||
untouched: 'untouched', // the control hasn't been blurred
|
||
valid: 'valid', // model is valid
|
||
invalid: 'invalid', // model is invalid
|
||
pristine: 'pristine', // control has not been interacted with
|
||
dirty: 'dirty' // control has been interacted with
|
||
}
|
||
};
|
||
|
||
var Field = function Field (options) {
|
||
if ( options === void 0 ) options = {};
|
||
|
||
this.id = uniqId();
|
||
this.el = options.el;
|
||
this.updated = false;
|
||
this.dependencies = [];
|
||
this.vmId = options.vmId;
|
||
this.watchers = [];
|
||
this.events = [];
|
||
this.delay = 0;
|
||
this.rules = {};
|
||
this._cacheId(options);
|
||
this.classNames = assign({}, DEFAULT_OPTIONS.classNames);
|
||
options = assign({}, DEFAULT_OPTIONS, options);
|
||
this._delay = !isNullOrUndefined(options.delay) ? options.delay : 0; // cache initial delay
|
||
this.validity = options.validity;
|
||
this.aria = options.aria;
|
||
this.flags = createFlags();
|
||
this.vm = options.vm;
|
||
this.componentInstance = options.component;
|
||
this.ctorConfig = this.componentInstance ? getPath('$options.$_veeValidate', this.componentInstance) : undefined;
|
||
this.update(options);
|
||
// set initial value.
|
||
this.initialValue = this.value;
|
||
this.updated = false;
|
||
};
|
||
|
||
var prototypeAccessors$3 = { validator: { configurable: true },isRequired: { configurable: true },isDisabled: { configurable: true },alias: { configurable: true },value: { configurable: true },bails: { configurable: true },rejectsFalse: { configurable: true } };
|
||
|
||
prototypeAccessors$3.validator.get = function () {
|
||
if (!this.vm || !this.vm.$validator) {
|
||
return { validate: function () {} };
|
||
}
|
||
|
||
return this.vm.$validator;
|
||
};
|
||
|
||
prototypeAccessors$3.isRequired.get = function () {
|
||
return !!this.rules.required;
|
||
};
|
||
|
||
prototypeAccessors$3.isDisabled.get = function () {
|
||
return !!(this.componentInstance && this.componentInstance.disabled) || !!(this.el && this.el.disabled);
|
||
};
|
||
|
||
/**
|
||
* Gets the display name (user-friendly name).
|
||
*/
|
||
prototypeAccessors$3.alias.get = function () {
|
||
if (this._alias) {
|
||
return this._alias;
|
||
}
|
||
|
||
var alias = null;
|
||
if (this.el) {
|
||
alias = getDataAttribute(this.el, 'as');
|
||
}
|
||
|
||
if (!alias && this.componentInstance) {
|
||
return this.componentInstance.$attrs && this.componentInstance.$attrs['data-vv-as'];
|
||
}
|
||
|
||
return alias;
|
||
};
|
||
|
||
/**
|
||
* Gets the input value.
|
||
*/
|
||
|
||
prototypeAccessors$3.value.get = function () {
|
||
if (!isCallable(this.getter)) {
|
||
return undefined;
|
||
}
|
||
|
||
return this.getter();
|
||
};
|
||
|
||
prototypeAccessors$3.bails.get = function () {
|
||
return this._bails;
|
||
};
|
||
|
||
/**
|
||
* If the field rejects false as a valid value for the required rule.
|
||
*/
|
||
|
||
prototypeAccessors$3.rejectsFalse.get = function () {
|
||
if (this.componentInstance && this.ctorConfig) {
|
||
return !!this.ctorConfig.rejectsFalse;
|
||
}
|
||
|
||
if (!this.el) {
|
||
return false;
|
||
}
|
||
|
||
return this.el.type === 'checkbox';
|
||
};
|
||
|
||
/**
|
||
* Determines if the instance matches the options provided.
|
||
*/
|
||
Field.prototype.matches = function matches (options) {
|
||
var this$1 = this;
|
||
|
||
if (!options) {
|
||
return true;
|
||
}
|
||
|
||
if (options.id) {
|
||
return this.id === options.id;
|
||
}
|
||
|
||
var matchesComponentId = isNullOrUndefined(options.vmId) ? function () { return true; } : function (id) { return id === this$1.vmId; };
|
||
if (!matchesComponentId(options.vmId)) {
|
||
return false;
|
||
}
|
||
|
||
if (options.name === undefined && options.scope === undefined) {
|
||
return true;
|
||
}
|
||
|
||
if (options.scope === undefined) {
|
||
return this.name === options.name;
|
||
}
|
||
|
||
if (options.name === undefined) {
|
||
return this.scope === options.scope;
|
||
}
|
||
|
||
return options.name === this.name && options.scope === this.scope;
|
||
};
|
||
|
||
/**
|
||
* Caches the field id.
|
||
*/
|
||
Field.prototype._cacheId = function _cacheId (options) {
|
||
if (this.el && !options.targetOf) {
|
||
this.el._veeValidateId = this.id;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Updates the field with changed data.
|
||
*/
|
||
Field.prototype.update = function update (options) {
|
||
this.targetOf = options.targetOf || null;
|
||
this.immediate = options.immediate || this.immediate || false;
|
||
|
||
// update errors scope if the field scope was changed.
|
||
if (!isNullOrUndefined(options.scope) && options.scope !== this.scope && isCallable(this.validator.update)) {
|
||
this.validator.update(this.id, { scope: options.scope });
|
||
}
|
||
this.scope = !isNullOrUndefined(options.scope) ? options.scope
|
||
: !isNullOrUndefined(this.scope) ? this.scope : null;
|
||
this.name = (!isNullOrUndefined(options.name) ? String(options.name) : options.name) || this.name || null;
|
||
this.rules = options.rules !== undefined ? normalizeRules(options.rules) : this.rules;
|
||
this._bails = options.bails !== undefined ? options.bails : this._bails;
|
||
this.model = options.model || this.model;
|
||
this.listen = options.listen !== undefined ? options.listen : this.listen;
|
||
this.classes = (options.classes || this.classes || false) && !this.componentInstance;
|
||
this.classNames = isObject(options.classNames) ? merge$1(this.classNames, options.classNames) : this.classNames;
|
||
this.getter = isCallable(options.getter) ? options.getter : this.getter;
|
||
this._alias = options.alias || this._alias;
|
||
this.events = (options.events) ? makeEventsArray(options.events) : this.events;
|
||
this.delay = makeDelayObject(this.events, options.delay || this.delay, this._delay);
|
||
this.updateDependencies();
|
||
this.addActionListeners();
|
||
|
||
if (!this.name && !this.targetOf) {
|
||
warn('A field is missing a "name" or "data-vv-name" attribute');
|
||
}
|
||
|
||
// update required flag flags
|
||
if (options.rules !== undefined) {
|
||
this.flags.required = this.isRequired;
|
||
}
|
||
|
||
// validate if it was validated before and field was updated and there was a rules mutation.
|
||
if (this.flags.validated && options.rules !== undefined && this.updated) {
|
||
this.validator.validate(("#" + (this.id)));
|
||
}
|
||
|
||
this.updated = true;
|
||
this.addValueListeners();
|
||
|
||
// no need to continue.
|
||
if (!this.el) {
|
||
return;
|
||
}
|
||
this.updateClasses();
|
||
this.updateAriaAttrs();
|
||
};
|
||
|
||
/**
|
||
* Resets field flags and errors.
|
||
*/
|
||
Field.prototype.reset = function reset () {
|
||
var this$1 = this;
|
||
|
||
if (this._cancellationToken) {
|
||
this._cancellationToken.cancelled = true;
|
||
delete this._cancellationToken;
|
||
}
|
||
|
||
var defaults = createFlags();
|
||
Object.keys(this.flags).filter(function (flag) { return flag !== 'required'; }).forEach(function (flag) {
|
||
this$1.flags[flag] = defaults[flag];
|
||
});
|
||
|
||
this.addActionListeners();
|
||
this.updateClasses();
|
||
this.updateAriaAttrs();
|
||
this.updateCustomValidity();
|
||
};
|
||
|
||
/**
|
||
* Sets the flags and their negated counterparts, and updates the classes and re-adds action listeners.
|
||
*/
|
||
Field.prototype.setFlags = function setFlags (flags) {
|
||
var this$1 = this;
|
||
|
||
var negated = {
|
||
pristine: 'dirty',
|
||
dirty: 'pristine',
|
||
valid: 'invalid',
|
||
invalid: 'valid',
|
||
touched: 'untouched',
|
||
untouched: 'touched'
|
||
};
|
||
|
||
Object.keys(flags).forEach(function (flag) {
|
||
this$1.flags[flag] = flags[flag];
|
||
// if it has a negation and was not specified, set it as well.
|
||
if (negated[flag] && flags[negated[flag]] === undefined) {
|
||
this$1.flags[negated[flag]] = !flags[flag];
|
||
}
|
||
});
|
||
|
||
if (
|
||
flags.untouched !== undefined ||
|
||
flags.touched !== undefined ||
|
||
flags.dirty !== undefined ||
|
||
flags.pristine !== undefined
|
||
) {
|
||
this.addActionListeners();
|
||
}
|
||
this.updateClasses();
|
||
this.updateAriaAttrs();
|
||
this.updateCustomValidity();
|
||
};
|
||
|
||
/**
|
||
* Determines if the field requires references to target fields.
|
||
*/
|
||
Field.prototype.updateDependencies = function updateDependencies () {
|
||
var this$1 = this;
|
||
|
||
// reset dependencies.
|
||
this.dependencies.forEach(function (d) { return d.field.destroy(); });
|
||
this.dependencies = [];
|
||
|
||
// we get the selectors for each field.
|
||
var fields = Object.keys(this.rules).reduce(function (prev, r) {
|
||
if (Validator.isTargetRule(r)) {
|
||
prev.push({ selector: this$1.rules[r][0], name: r });
|
||
}
|
||
|
||
return prev;
|
||
}, []);
|
||
|
||
if (!fields.length || !this.vm || !this.vm.$el) { return; }
|
||
|
||
// must be contained within the same component, so we use the vm root element constrain our dom search.
|
||
fields.forEach(function (ref$1) {
|
||
var selector = ref$1.selector;
|
||
var name = ref$1.name;
|
||
|
||
var ref = this$1.vm.$refs[selector];
|
||
var el = Array.isArray(ref) ? ref[0] : ref;
|
||
if (!el) {
|
||
return;
|
||
}
|
||
|
||
var options = {
|
||
vm: this$1.vm,
|
||
classes: this$1.classes,
|
||
classNames: this$1.classNames,
|
||
delay: this$1.delay,
|
||
scope: this$1.scope,
|
||
events: this$1.events.join('|'),
|
||
immediate: this$1.immediate,
|
||
targetOf: this$1.id
|
||
};
|
||
|
||
// probably a component.
|
||
if (isCallable(el.$watch)) {
|
||
options.component = el;
|
||
options.el = el.$el;
|
||
options.getter = Resolver.resolveGetter(el.$el, el.$vnode);
|
||
} else {
|
||
options.el = el;
|
||
options.getter = Resolver.resolveGetter(el, {});
|
||
}
|
||
|
||
this$1.dependencies.push({ name: name, field: new Field(options) });
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Removes listeners.
|
||
*/
|
||
Field.prototype.unwatch = function unwatch (tag) {
|
||
if ( tag === void 0 ) tag = null;
|
||
|
||
if (!tag) {
|
||
this.watchers.forEach(function (w) { return w.unwatch(); });
|
||
this.watchers = [];
|
||
return;
|
||
}
|
||
|
||
this.watchers.filter(function (w) { return tag.test(w.tag); }).forEach(function (w) { return w.unwatch(); });
|
||
this.watchers = this.watchers.filter(function (w) { return !tag.test(w.tag); });
|
||
};
|
||
|
||
/**
|
||
* Updates the element classes depending on each field flag status.
|
||
*/
|
||
Field.prototype.updateClasses = function updateClasses () {
|
||
var this$1 = this;
|
||
|
||
if (!this.classes || this.isDisabled) { return; }
|
||
var applyClasses = function (el) {
|
||
toggleClass(el, this$1.classNames.dirty, this$1.flags.dirty);
|
||
toggleClass(el, this$1.classNames.pristine, this$1.flags.pristine);
|
||
toggleClass(el, this$1.classNames.touched, this$1.flags.touched);
|
||
toggleClass(el, this$1.classNames.untouched, this$1.flags.untouched);
|
||
// make sure we don't set any classes if the state is undetermined.
|
||
if (!isNullOrUndefined(this$1.flags.valid) && this$1.flags.validated) {
|
||
toggleClass(el, this$1.classNames.valid, this$1.flags.valid);
|
||
}
|
||
|
||
if (!isNullOrUndefined(this$1.flags.invalid) && this$1.flags.validated) {
|
||
toggleClass(el, this$1.classNames.invalid, this$1.flags.invalid);
|
||
}
|
||
};
|
||
|
||
if (!isCheckboxOrRadioInput(this.el)) {
|
||
applyClasses(this.el);
|
||
return;
|
||
}
|
||
|
||
var els = document.querySelectorAll(("input[name=\"" + (this.el.name) + "\"]"));
|
||
toArray(els).forEach(applyClasses);
|
||
};
|
||
|
||
/**
|
||
* Adds the listeners required for automatic classes and some flags.
|
||
*/
|
||
Field.prototype.addActionListeners = function addActionListeners () {
|
||
var this$1 = this;
|
||
|
||
// remove previous listeners.
|
||
this.unwatch(/class/);
|
||
|
||
if (!this.el) { return; }
|
||
|
||
var onBlur = function () {
|
||
this$1.flags.touched = true;
|
||
this$1.flags.untouched = false;
|
||
if (this$1.classes) {
|
||
toggleClass(this$1.el, this$1.classNames.touched, true);
|
||
toggleClass(this$1.el, this$1.classNames.untouched, false);
|
||
}
|
||
|
||
// only needed once.
|
||
this$1.unwatch(/^class_blur$/);
|
||
};
|
||
|
||
var inputEvent = isTextInput(this.el) ? 'input' : 'change';
|
||
var onInput = function () {
|
||
this$1.flags.dirty = true;
|
||
this$1.flags.pristine = false;
|
||
if (this$1.classes) {
|
||
toggleClass(this$1.el, this$1.classNames.pristine, false);
|
||
toggleClass(this$1.el, this$1.classNames.dirty, true);
|
||
}
|
||
|
||
// only needed once.
|
||
this$1.unwatch(/^class_input$/);
|
||
};
|
||
|
||
if (this.componentInstance && isCallable(this.componentInstance.$once)) {
|
||
this.componentInstance.$once('input', onInput);
|
||
this.componentInstance.$once('blur', onBlur);
|
||
this.watchers.push({
|
||
tag: 'class_input',
|
||
unwatch: function () {
|
||
this$1.componentInstance.$off('input', onInput);
|
||
}
|
||
});
|
||
this.watchers.push({
|
||
tag: 'class_blur',
|
||
unwatch: function () {
|
||
this$1.componentInstance.$off('blur', onBlur);
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (!this.el) { return; }
|
||
|
||
addEventListener(this.el, inputEvent, onInput);
|
||
// Checkboxes and radio buttons on Mac don't emit blur naturally, so we listen on click instead.
|
||
var blurEvent = isCheckboxOrRadioInput(this.el) ? 'change' : 'blur';
|
||
addEventListener(this.el, blurEvent, onBlur);
|
||
this.watchers.push({
|
||
tag: 'class_input',
|
||
unwatch: function () {
|
||
this$1.el.removeEventListener(inputEvent, onInput);
|
||
}
|
||
});
|
||
|
||
this.watchers.push({
|
||
tag: 'class_blur',
|
||
unwatch: function () {
|
||
this$1.el.removeEventListener(blurEvent, onBlur);
|
||
}
|
||
});
|
||
};
|
||
|
||
Field.prototype.checkValueChanged = function checkValueChanged () {
|
||
// handle some people initialize the value to null, since text inputs have empty string value.
|
||
if (this.initialValue === null && this.value === '' && isTextInput(this.el)) {
|
||
return false;
|
||
}
|
||
|
||
return this.value !== this.initialValue;
|
||
};
|
||
|
||
/**
|
||
* Determines the suitable primary event to listen for.
|
||
*/
|
||
Field.prototype._determineInputEvent = function _determineInputEvent () {
|
||
// if its a custom component, use the customized model event or the input event.
|
||
if (this.componentInstance) {
|
||
return (this.componentInstance.$options.model && this.componentInstance.$options.model.event) || 'input';
|
||
}
|
||
|
||
if (this.model) {
|
||
return this.model.lazy ? 'change' : 'input';
|
||
}
|
||
|
||
if (isTextInput(this.el)) {
|
||
return 'input';
|
||
}
|
||
|
||
return 'change';
|
||
};
|
||
|
||
/**
|
||
* Determines the list of events to listen to.
|
||
*/
|
||
Field.prototype._determineEventList = function _determineEventList (defaultInputEvent) {
|
||
// if no event is configured, or it is a component or a text input then respect the user choice.
|
||
if (!this.events.length || this.componentInstance || isTextInput(this.el)) {
|
||
return [].concat( this.events );
|
||
}
|
||
|
||
// force suitable event for non-text type fields.
|
||
return this.events.map(function (e) {
|
||
if (e === 'input') {
|
||
return defaultInputEvent;
|
||
}
|
||
|
||
return e;
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Adds the listeners required for validation.
|
||
*/
|
||
Field.prototype.addValueListeners = function addValueListeners () {
|
||
var this$1 = this;
|
||
|
||
this.unwatch(/^input_.+/);
|
||
if (!this.listen || !this.el) { return; }
|
||
|
||
var token = { cancelled: false };
|
||
var fn = this.targetOf ? function () {
|
||
this$1.flags.changed = this$1.checkValueChanged(); this$1.validator.validate(("#" + (this$1.targetOf)));
|
||
} : function () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
// if its a DOM event, resolve the value, otherwise use the first parameter as the value.
|
||
if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || (args[0] && args[0].srcElement)) {
|
||
args[0] = this$1.value;
|
||
}
|
||
|
||
this$1.flags.changed = this$1.checkValueChanged();
|
||
this$1.validator.validate(("#" + (this$1.id)), args[0]);
|
||
};
|
||
|
||
var inputEvent = this._determineInputEvent();
|
||
var events = this._determineEventList(inputEvent);
|
||
|
||
// if there is a model and an on input validation is requested.
|
||
if (this.model && includes(events, inputEvent)) {
|
||
var ctx = null;
|
||
var expression = this.model.expression;
|
||
// if its watchable from the context vm.
|
||
if (this.model.expression) {
|
||
ctx = this.vm;
|
||
expression = this.model.expression;
|
||
}
|
||
|
||
// watch it from the custom component vm instead.
|
||
if (!expression && this.componentInstance && this.componentInstance.$options.model) {
|
||
ctx = this.componentInstance;
|
||
expression = this.componentInstance.$options.model.prop || 'value';
|
||
}
|
||
|
||
if (ctx && expression) {
|
||
var debouncedFn = debounce(fn, this.delay[inputEvent], false, token);
|
||
var unwatch = ctx.$watch(expression, function () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
this$1.flags.pending = true;
|
||
this$1._cancellationToken = token;
|
||
debouncedFn.apply(void 0, args);
|
||
});
|
||
this.watchers.push({
|
||
tag: 'input_model',
|
||
unwatch: unwatch
|
||
});
|
||
|
||
// filter out input event as it is already handled by the watcher API.
|
||
events = events.filter(function (e) { return e !== inputEvent; });
|
||
}
|
||
}
|
||
|
||
// Add events.
|
||
events.forEach(function (e) {
|
||
var debouncedFn = debounce(fn, this$1.delay[e], false, token);
|
||
var validate = function () {
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
|
||
this$1.flags.pending = true;
|
||
this$1._cancellationToken = token;
|
||
debouncedFn.apply(void 0, args);
|
||
};
|
||
|
||
this$1._addComponentEventListener(e, validate);
|
||
this$1._addHTMLEventListener(e, validate);
|
||
});
|
||
};
|
||
|
||
Field.prototype._addComponentEventListener = function _addComponentEventListener (evt, validate) {
|
||
var this$1 = this;
|
||
|
||
if (!this.componentInstance) { return; }
|
||
|
||
this.componentInstance.$on(evt, validate);
|
||
this.watchers.push({
|
||
tag: 'input_vue',
|
||
unwatch: function () {
|
||
this$1.componentInstance.$off(evt, validate);
|
||
}
|
||
});
|
||
};
|
||
|
||
Field.prototype._addHTMLEventListener = function _addHTMLEventListener (evt, validate) {
|
||
var this$1 = this;
|
||
|
||
if (!this.el || this.componentInstance) { return; }
|
||
|
||
// listen for the current element.
|
||
var addListener = function (el) {
|
||
addEventListener(el, evt, validate);
|
||
this$1.watchers.push({
|
||
tag: 'input_native',
|
||
unwatch: function () {
|
||
el.removeEventListener(evt, validate);
|
||
}
|
||
});
|
||
};
|
||
|
||
addListener(this.el);
|
||
if (!isCheckboxOrRadioInput(this.el)) {
|
||
return;
|
||
}
|
||
|
||
var els = document.querySelectorAll(("input[name=\"" + (this.el.name) + "\"]"));
|
||
toArray(els).forEach(function (el) {
|
||
// skip if it is added by v-validate and is not the current element.
|
||
if (el._veeValidateId && el !== this$1.el) {
|
||
return;
|
||
}
|
||
|
||
addListener(el);
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Updates aria attributes on the element.
|
||
*/
|
||
Field.prototype.updateAriaAttrs = function updateAriaAttrs () {
|
||
var this$1 = this;
|
||
|
||
if (!this.aria || !this.el || !isCallable(this.el.setAttribute)) { return; }
|
||
|
||
var applyAriaAttrs = function (el) {
|
||
el.setAttribute('aria-required', this$1.isRequired ? 'true' : 'false');
|
||
el.setAttribute('aria-invalid', this$1.flags.invalid ? 'true' : 'false');
|
||
};
|
||
|
||
if (!isCheckboxOrRadioInput(this.el)) {
|
||
applyAriaAttrs(this.el);
|
||
return;
|
||
}
|
||
|
||
var els = document.querySelectorAll(("input[name=\"" + (this.el.name) + "\"]"));
|
||
toArray(els).forEach(applyAriaAttrs);
|
||
};
|
||
|
||
/**
|
||
* Updates the custom validity for the field.
|
||
*/
|
||
Field.prototype.updateCustomValidity = function updateCustomValidity () {
|
||
if (!this.validity || !this.el || !isCallable(this.el.setCustomValidity) || !this.validator.errors) { return; }
|
||
|
||
this.el.setCustomValidity(this.flags.valid ? '' : (this.validator.errors.firstById(this.id) || ''));
|
||
};
|
||
|
||
/**
|
||
* Removes all listeners.
|
||
*/
|
||
Field.prototype.destroy = function destroy () {
|
||
this.unwatch();
|
||
this.dependencies.forEach(function (d) { return d.field.destroy(); });
|
||
this.dependencies = [];
|
||
};
|
||
|
||
Object.defineProperties( Field.prototype, prototypeAccessors$3 );
|
||
|
||
//
|
||
|
||
var FieldBag = function FieldBag (items) {
|
||
if ( items === void 0 ) items = [];
|
||
|
||
this.items = items || [];
|
||
};
|
||
|
||
var prototypeAccessors$4 = { length: { configurable: true } };
|
||
|
||
FieldBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {
|
||
var this$1 = this;
|
||
|
||
var index = 0;
|
||
return {
|
||
next: function () {
|
||
return { value: this$1.items[index++], done: index > this$1.items.length };
|
||
}
|
||
};
|
||
};
|
||
|
||
/**
|
||
* Gets the current items length.
|
||
*/
|
||
|
||
prototypeAccessors$4.length.get = function () {
|
||
return this.items.length;
|
||
};
|
||
|
||
/**
|
||
* Finds the first field that matches the provided matcher object.
|
||
*/
|
||
FieldBag.prototype.find = function find$1 (matcher) {
|
||
return find(this.items, function (item) { return item.matches(matcher); });
|
||
};
|
||
|
||
/**
|
||
* Filters the items down to the matched fields.
|
||
*/
|
||
FieldBag.prototype.filter = function filter (matcher) {
|
||
// multiple matchers to be tried.
|
||
if (Array.isArray(matcher)) {
|
||
return this.items.filter(function (item) { return matcher.some(function (m) { return item.matches(m); }); });
|
||
}
|
||
|
||
return this.items.filter(function (item) { return item.matches(matcher); });
|
||
};
|
||
|
||
/**
|
||
* Maps the field items using the mapping function.
|
||
*/
|
||
FieldBag.prototype.map = function map (mapper) {
|
||
return this.items.map(mapper);
|
||
};
|
||
|
||
/**
|
||
* Finds and removes the first field that matches the provided matcher object, returns the removed item.
|
||
*/
|
||
FieldBag.prototype.remove = function remove (matcher) {
|
||
var item = null;
|
||
if (matcher instanceof Field) {
|
||
item = matcher;
|
||
} else {
|
||
item = this.find(matcher);
|
||
}
|
||
|
||
if (!item) { return null; }
|
||
|
||
var index = this.items.indexOf(item);
|
||
this.items.splice(index, 1);
|
||
|
||
return item;
|
||
};
|
||
|
||
/**
|
||
* Adds a field item to the list.
|
||
*/
|
||
FieldBag.prototype.push = function push (item) {
|
||
if (! (item instanceof Field)) {
|
||
throw createError('FieldBag only accepts instances of Field that has an id defined.');
|
||
}
|
||
|
||
if (!item.id) {
|
||
throw createError('Field id must be defined.');
|
||
}
|
||
|
||
if (this.find({ id: item.id })) {
|
||
throw createError(("Field with id " + (item.id) + " is already added."));
|
||
}
|
||
|
||
this.items.push(item);
|
||
};
|
||
|
||
Object.defineProperties( FieldBag.prototype, prototypeAccessors$4 );
|
||
|
||
var ScopedValidator = function ScopedValidator (base, vm) {
|
||
this.id = vm._uid;
|
||
this._base = base;
|
||
|
||
// create a mirror bag with limited component scope.
|
||
this.errors = new ErrorBag(base.errors, this.id);
|
||
};
|
||
|
||
var prototypeAccessors$5 = { flags: { configurable: true },rules: { configurable: true },fields: { configurable: true },dictionary: { configurable: true },locale: { configurable: true } };
|
||
|
||
prototypeAccessors$5.flags.get = function () {
|
||
var this$1 = this;
|
||
|
||
return this._base.fields.items.filter(function (f) { return f.vmId === this$1.id; }).reduce(function (acc, field) {
|
||
if (field.scope) {
|
||
if (!acc[("$" + (field.scope))]) {
|
||
acc[("$" + (field.scope))] = {};
|
||
}
|
||
|
||
acc[("$" + (field.scope))][field.name] = field.flags;
|
||
}
|
||
|
||
acc[field.name] = field.flags;
|
||
|
||
return acc;
|
||
}, {});
|
||
};
|
||
|
||
prototypeAccessors$5.rules.get = function () {
|
||
return this._base.rules;
|
||
};
|
||
|
||
prototypeAccessors$5.fields.get = function () {
|
||
return new FieldBag(this._base.fields.filter({ vmId: this.id }));
|
||
};
|
||
|
||
prototypeAccessors$5.dictionary.get = function () {
|
||
return this._base.dictionary;
|
||
};
|
||
|
||
prototypeAccessors$5.locale.get = function () {
|
||
return this._base.locale;
|
||
};
|
||
|
||
prototypeAccessors$5.locale.set = function (val) {
|
||
this._base.locale = val;
|
||
};
|
||
|
||
ScopedValidator.prototype.localize = function localize () {
|
||
var ref;
|
||
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
return (ref = this._base).localize.apply(ref, args);
|
||
};
|
||
|
||
ScopedValidator.prototype.update = function update () {
|
||
var ref;
|
||
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
return (ref = this._base).update.apply(ref, args);
|
||
};
|
||
|
||
ScopedValidator.prototype.attach = function attach (opts) {
|
||
var attachOpts = assign({}, opts, { vmId: this.id });
|
||
|
||
return this._base.attach(attachOpts);
|
||
};
|
||
|
||
ScopedValidator.prototype.remove = function remove (ruleName) {
|
||
return this._base.remove(ruleName);
|
||
};
|
||
|
||
ScopedValidator.prototype.detach = function detach () {
|
||
var ref;
|
||
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
return (ref = this._base).detach.apply(ref, args.concat( [this.id] ));
|
||
};
|
||
|
||
ScopedValidator.prototype.extend = function extend () {
|
||
var ref;
|
||
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
return (ref = this._base).extend.apply(ref, args);
|
||
};
|
||
|
||
ScopedValidator.prototype.validate = function validate (descriptor, value, opts) {
|
||
if ( opts === void 0 ) opts = {};
|
||
|
||
return this._base.validate(descriptor, value, assign({}, { vmId: this.id }, opts || {}));
|
||
};
|
||
|
||
ScopedValidator.prototype.validateAll = function validateAll (values$$1, opts) {
|
||
if ( opts === void 0 ) opts = {};
|
||
|
||
return this._base.validateAll(values$$1, assign({}, { vmId: this.id }, opts || {}));
|
||
};
|
||
|
||
ScopedValidator.prototype.validateScopes = function validateScopes (opts) {
|
||
if ( opts === void 0 ) opts = {};
|
||
|
||
return this._base.validateScopes(assign({}, { vmId: this.id }, opts || {}));
|
||
};
|
||
|
||
ScopedValidator.prototype.destroy = function destroy () {
|
||
delete this.id;
|
||
delete this._base;
|
||
};
|
||
|
||
ScopedValidator.prototype.reset = function reset (matcher) {
|
||
return this._base.reset(Object.assign({}, matcher || {}, { vmId: this.id }));
|
||
};
|
||
|
||
ScopedValidator.prototype.flag = function flag () {
|
||
var ref;
|
||
|
||
var args = [], len = arguments.length;
|
||
while ( len-- ) args[ len ] = arguments[ len ];
|
||
return (ref = this._base).flag.apply(ref, args.concat( [this.id] ));
|
||
};
|
||
|
||
Object.defineProperties( ScopedValidator.prototype, prototypeAccessors$5 );
|
||
|
||
//
|
||
|
||
/**
|
||
* Checks if a parent validator instance was requested.
|
||
*/
|
||
var requestsValidator = function (injections) {
|
||
if (isObject(injections) && injections.$validator) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
var mixin = {
|
||
provide: function provide () {
|
||
if (this.$validator && !isBuiltInComponent(this.$vnode)) {
|
||
return {
|
||
$validator: this.$validator
|
||
};
|
||
}
|
||
|
||
return {};
|
||
},
|
||
beforeCreate: function beforeCreate () {
|
||
// if built in do nothing.
|
||
if (isBuiltInComponent(this.$vnode)) {
|
||
return;
|
||
}
|
||
|
||
// if its a root instance set the config if it exists.
|
||
if (!this.$parent) {
|
||
Config.merge(this.$options.$_veeValidate || {});
|
||
}
|
||
|
||
var options = Config.resolve(this);
|
||
|
||
// if its a root instance, inject anyways, or if it requested a new instance.
|
||
if (!this.$parent || (this.$options.$_veeValidate && /new/.test(this.$options.$_veeValidate.validator))) {
|
||
this.$validator = new ScopedValidator(Config.dependency('validator'), this);
|
||
}
|
||
|
||
var requested = requestsValidator(this.$options.inject);
|
||
|
||
// if automatic injection is enabled and no instance was requested.
|
||
if (! this.$validator && options.inject && !requested) {
|
||
this.$validator = new ScopedValidator(Config.dependency('validator'), this);
|
||
}
|
||
|
||
// don't inject errors or fieldBag as no validator was resolved.
|
||
if (! requested && ! this.$validator) {
|
||
return;
|
||
}
|
||
|
||
// There is a validator but it isn't injected, mark as reactive.
|
||
if (!requested && this.$validator) {
|
||
var Vue = this.$options._base; // the vue constructor.
|
||
Vue.util.defineReactive(this.$validator, 'errors', this.$validator.errors);
|
||
}
|
||
|
||
if (! this.$options.computed) {
|
||
this.$options.computed = {};
|
||
}
|
||
|
||
this.$options.computed[options.errorBagName || 'errors'] = function errorBagGetter () {
|
||
return this.$validator.errors;
|
||
};
|
||
this.$options.computed[options.fieldsBagName || 'fields'] = function fieldBagGetter () {
|
||
return this.$validator.fields.items.reduce(function (acc, field) {
|
||
if (field.scope) {
|
||
if (!acc[("$" + (field.scope))]) {
|
||
acc[("$" + (field.scope))] = {};
|
||
}
|
||
|
||
acc[("$" + (field.scope))][field.name] = field.flags;
|
||
|
||
return acc;
|
||
}
|
||
|
||
acc[field.name] = field.flags;
|
||
|
||
return acc;
|
||
}, {});
|
||
};
|
||
},
|
||
beforeDestroy: function beforeDestroy () {
|
||
if (this.$validator && this._uid === this.$validator.id) {
|
||
this.$validator.errors.clear(); // remove errors generated by this component.
|
||
}
|
||
}
|
||
};
|
||
|
||
//
|
||
|
||
/**
|
||
* Finds the requested field by id from the context object.
|
||
*/
|
||
function findField (el, context) {
|
||
if (!context || !context.$validator) {
|
||
return null;
|
||
}
|
||
|
||
return context.$validator.fields.find({ id: el._veeValidateId });
|
||
}
|
||
var directive = {
|
||
bind: function bind (el, binding, vnode) {
|
||
var validator = vnode.context.$validator;
|
||
if (!validator) {
|
||
{
|
||
warn("No validator instance is present on vm, did you forget to inject '$validator'?");
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
var fieldOptions = Resolver.generate(el, binding, vnode);
|
||
validator.attach(fieldOptions);
|
||
},
|
||
inserted: function inserted (el, binding, vnode) {
|
||
var field = findField(el, vnode.context);
|
||
var scope = Resolver.resolveScope(el, binding, vnode);
|
||
|
||
// skip if scope hasn't changed.
|
||
if (!field || scope === field.scope) { return; }
|
||
|
||
// only update scope.
|
||
field.update({ scope: scope });
|
||
|
||
// allows the field to re-evaluated once more in the update hook.
|
||
field.updated = false;
|
||
},
|
||
update: function update (el, binding, vnode) {
|
||
var field = findField(el, vnode.context);
|
||
|
||
// make sure we don't do unneccasary work if no important change was done.
|
||
if (!field || (field.updated && isEqual$1(binding.value, binding.oldValue))) { return; }
|
||
var scope = Resolver.resolveScope(el, binding, vnode);
|
||
var rules = Resolver.resolveRules(el, binding, vnode);
|
||
|
||
field.update({
|
||
scope: scope,
|
||
rules: rules
|
||
});
|
||
},
|
||
unbind: function unbind (el, binding, ref) {
|
||
var context = ref.context;
|
||
|
||
var field = findField(el, context);
|
||
if (!field) { return; }
|
||
|
||
context.$validator.detach(field);
|
||
}
|
||
};
|
||
|
||
var Vue;
|
||
|
||
function install (_Vue, options) {
|
||
if ( options === void 0 ) options = {};
|
||
|
||
if (Vue && _Vue === Vue) {
|
||
{
|
||
warn('already installed, Vue.use(VeeValidate) should only be called once.');
|
||
}
|
||
return;
|
||
}
|
||
|
||
detectPassiveSupport();
|
||
Vue = _Vue;
|
||
var validator = new Validator(null, options);
|
||
var localVue = new Vue({
|
||
data: function () { return ({
|
||
errors: validator.errors,
|
||
fields: validator.fields
|
||
}); }
|
||
});
|
||
Config.register('vm', localVue);
|
||
Config.register('validator', validator);
|
||
Config.merge(options);
|
||
|
||
var ref = Config.current;
|
||
var dictionary = ref.dictionary;
|
||
var i18n = ref.i18n;
|
||
|
||
if (dictionary) {
|
||
validator.localize(dictionary); // merge the dictionary.
|
||
}
|
||
|
||
var onLocaleChanged = function () {
|
||
validator.errors.regenerate();
|
||
};
|
||
|
||
// watch locale changes using localVue instance or i18n.
|
||
if (!i18n) {
|
||
if (typeof window !== 'undefined') {
|
||
localVue.$on('localeChanged', onLocaleChanged);
|
||
}
|
||
} else {
|
||
i18n._vm.$watch('locale', onLocaleChanged);
|
||
}
|
||
|
||
if (!i18n && options.locale) {
|
||
validator.localize(options.locale); // set the locale
|
||
}
|
||
|
||
Validator.setStrictMode(Config.current.strict);
|
||
|
||
Vue.mixin(mixin);
|
||
Vue.directive('validate', directive);
|
||
}
|
||
|
||
//
|
||
|
||
function use (plugin, options) {
|
||
if ( options === void 0 ) options = {};
|
||
|
||
if (!isCallable(plugin)) {
|
||
return warn('The plugin must be a callable function');
|
||
}
|
||
|
||
plugin({ Validator: Validator, ErrorBag: ErrorBag, Rules: Validator.rules }, options);
|
||
}
|
||
|
||
//
|
||
|
||
var normalize = function (fields) {
|
||
if (Array.isArray(fields)) {
|
||
return fields.reduce(function (prev, curr) {
|
||
if (includes(curr, '.')) {
|
||
prev[curr.split('.')[1]] = curr;
|
||
} else {
|
||
prev[curr] = curr;
|
||
}
|
||
|
||
return prev;
|
||
}, {});
|
||
}
|
||
|
||
return fields;
|
||
};
|
||
|
||
// Combines two flags using either AND or OR depending on the flag type.
|
||
var combine = function (lhs, rhs) {
|
||
var mapper = {
|
||
pristine: function (lhs, rhs) { return lhs && rhs; },
|
||
dirty: function (lhs, rhs) { return lhs || rhs; },
|
||
touched: function (lhs, rhs) { return lhs || rhs; },
|
||
untouched: function (lhs, rhs) { return lhs && rhs; },
|
||
valid: function (lhs, rhs) { return lhs && rhs; },
|
||
invalid: function (lhs, rhs) { return lhs || rhs; },
|
||
pending: function (lhs, rhs) { return lhs || rhs; },
|
||
required: function (lhs, rhs) { return lhs || rhs; },
|
||
validated: function (lhs, rhs) { return lhs && rhs; }
|
||
};
|
||
|
||
return Object.keys(mapper).reduce(function (flags, flag) {
|
||
flags[flag] = mapper[flag](lhs[flag], rhs[flag]);
|
||
|
||
return flags;
|
||
}, {});
|
||
};
|
||
|
||
var mapScope = function (scope, deep) {
|
||
if ( deep === void 0 ) deep = true;
|
||
|
||
return Object.keys(scope).reduce(function (flags, field) {
|
||
if (!flags) {
|
||
flags = assign({}, scope[field]);
|
||
return flags;
|
||
}
|
||
|
||
// scope.
|
||
var isScope = field.indexOf('$') === 0;
|
||
if (deep && isScope) {
|
||
return combine(mapScope(scope[field]), flags);
|
||
} else if (!deep && isScope) {
|
||
return flags;
|
||
}
|
||
|
||
flags = combine(flags, scope[field]);
|
||
|
||
return flags;
|
||
}, null);
|
||
};
|
||
|
||
/**
|
||
* Maps fields to computed functions.
|
||
*/
|
||
var mapFields = function (fields) {
|
||
if (!fields) {
|
||
return function () {
|
||
return mapScope(this.$validator.flags);
|
||
};
|
||
}
|
||
|
||
var normalized = normalize(fields);
|
||
return Object.keys(normalized).reduce(function (prev, curr) {
|
||
var field = normalized[curr];
|
||
prev[curr] = function mappedField () {
|
||
// if field exists
|
||
if (this.$validator.flags[field]) {
|
||
return this.$validator.flags[field];
|
||
}
|
||
|
||
// scopeless fields were selected.
|
||
if (normalized[curr] === '*') {
|
||
return mapScope(this.$validator.flags, false);
|
||
}
|
||
|
||
// if it has a scope defined
|
||
var index = field.indexOf('.');
|
||
if (index <= 0) {
|
||
return {};
|
||
}
|
||
|
||
var ref = field.split('.');
|
||
var scope = ref[0];
|
||
var name = ref.slice(1);
|
||
|
||
scope = this.$validator.flags[("$" + scope)];
|
||
name = name.join('.');
|
||
|
||
// an entire scope was selected: scope.*
|
||
if (name === '*' && scope) {
|
||
return mapScope(scope);
|
||
}
|
||
|
||
if (scope && scope[name]) {
|
||
return scope[name];
|
||
}
|
||
|
||
return {};
|
||
};
|
||
|
||
return prev;
|
||
}, {});
|
||
};
|
||
|
||
var ErrorComponent = {
|
||
name: 'vv-error',
|
||
inject: ['$validator'],
|
||
functional: true,
|
||
props: {
|
||
for: {
|
||
type: String,
|
||
required: true
|
||
},
|
||
tag: {
|
||
type: String,
|
||
default: 'span'
|
||
}
|
||
},
|
||
render: function render (createElement, ref) {
|
||
var props = ref.props;
|
||
var injections = ref.injections;
|
||
|
||
return createElement(props.tag, injections.$validator.errors.first(props.for));
|
||
}
|
||
};
|
||
|
||
var minimal = {
|
||
install: install,
|
||
use: use,
|
||
directive: directive,
|
||
mixin: mixin,
|
||
mapFields: mapFields,
|
||
Validator: Validator,
|
||
ErrorBag: ErrorBag,
|
||
ErrorComponent: ErrorComponent,
|
||
version: '2.1.0-beta.6'
|
||
};
|
||
|
||
// rules plugin definition.
|
||
var rulesPlugin = function (ref) {
|
||
var Validator = ref.Validator;
|
||
|
||
Object.keys(Rules).forEach(function (rule) {
|
||
Validator.extend(rule, Rules[rule].validate, Rules[rule].options);
|
||
});
|
||
|
||
// Merge the english messages.
|
||
Validator.localize('en', locale$1);
|
||
};
|
||
|
||
// install the rules via the plugin API.
|
||
minimal.use(rulesPlugin);
|
||
|
||
minimal.Rules = Rules;
|
||
|
||
return minimal;
|
||
|
||
})));
|
||
|
||
/*!
|
||
* Cropper.js v1.5.1
|
||
* https://fengyuanchen.github.io/cropperjs
|
||
*
|
||
* Copyright 2015-present Chen Fengyuan
|
||
* Released under the MIT license
|
||
*
|
||
* Date: 2019-03-10T09:55:53.729Z
|
||
*/
|
||
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||
typeof define === 'function' && define.amd ? define(factory) :
|
||
(global = global || self, global.Cropper = factory());
|
||
}(this, function () {
|
||
'use strict';
|
||
|
||
function _typeof(obj) {
|
||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||
_typeof = function (obj) {
|
||
return typeof obj;
|
||
};
|
||
} else {
|
||
_typeof = function (obj) {
|
||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||
};
|
||
}
|
||
|
||
|
||
return _typeof(obj);
|
||
}
|
||
|
||
function _classCallCheck(instance, Constructor) {
|
||
if (!(instance instanceof Constructor)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
|
||
function _defineProperties(target, props) {
|
||
for (var i = 0; i < props.length; i++) {
|
||
var descriptor = props[i];
|
||
descriptor.enumerable = descriptor.enumerable || false;
|
||
descriptor.configurable = true;
|
||
if ("value" in descriptor) descriptor.writable = true;
|
||
Object.defineProperty(target, descriptor.key, descriptor);
|
||
}
|
||
}
|
||
|
||
function _createClass(Constructor, protoProps, staticProps) {
|
||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||
return Constructor;
|
||
}
|
||
|
||
function _toConsumableArray(arr) {
|
||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
||
}
|
||
|
||
function _arrayWithoutHoles(arr) {
|
||
if (Array.isArray(arr)) {
|
||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
||
|
||
return arr2;
|
||
}
|
||
}
|
||
|
||
function _iterableToArray(iter) {
|
||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||
}
|
||
|
||
function _nonIterableSpread() {
|
||
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
||
}
|
||
|
||
var IS_BROWSER = typeof window !== 'undefined';
|
||
var WINDOW = IS_BROWSER ? window : {};
|
||
var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;
|
||
var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;
|
||
var NAMESPACE = 'cropper'; // Actions
|
||
|
||
var ACTION_ALL = 'all';
|
||
var ACTION_CROP = 'crop';
|
||
var ACTION_MOVE = 'move';
|
||
var ACTION_ZOOM = 'zoom';
|
||
var ACTION_EAST = 'e';
|
||
var ACTION_WEST = 'w';
|
||
var ACTION_SOUTH = 's';
|
||
var ACTION_NORTH = 'n';
|
||
var ACTION_NORTH_EAST = 'ne';
|
||
var ACTION_NORTH_WEST = 'nw';
|
||
var ACTION_SOUTH_EAST = 'se';
|
||
var ACTION_SOUTH_WEST = 'sw'; // Classes
|
||
|
||
var CLASS_CROP = "".concat(NAMESPACE, "-crop");
|
||
var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled");
|
||
var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden");
|
||
var CLASS_HIDE = "".concat(NAMESPACE, "-hide");
|
||
var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible");
|
||
var CLASS_MODAL = "".concat(NAMESPACE, "-modal");
|
||
var CLASS_MOVE = "".concat(NAMESPACE, "-move"); // Data keys
|
||
|
||
var DATA_ACTION = "".concat(NAMESPACE, "Action");
|
||
var DATA_PREVIEW = "".concat(NAMESPACE, "Preview"); // Drag modes
|
||
|
||
var DRAG_MODE_CROP = 'crop';
|
||
var DRAG_MODE_MOVE = 'move';
|
||
var DRAG_MODE_NONE = 'none'; // Events
|
||
|
||
var EVENT_CROP = 'crop';
|
||
var EVENT_CROP_END = 'cropend';
|
||
var EVENT_CROP_MOVE = 'cropmove';
|
||
var EVENT_CROP_START = 'cropstart';
|
||
var EVENT_DBLCLICK = 'dblclick';
|
||
var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';
|
||
var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';
|
||
var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';
|
||
var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;
|
||
var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;
|
||
var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;
|
||
var EVENT_READY = 'ready';
|
||
var EVENT_RESIZE = 'resize';
|
||
var EVENT_WHEEL = 'wheel';
|
||
var EVENT_ZOOM = 'zoom'; // Mime types
|
||
|
||
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps
|
||
|
||
var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
|
||
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
|
||
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
|
||
// Inspired by the default width and height of a canvas element.
|
||
|
||
var MIN_CONTAINER_WIDTH = 200;
|
||
var MIN_CONTAINER_HEIGHT = 100;
|
||
|
||
var DEFAULTS = {
|
||
// Define the view mode of the cropper
|
||
viewMode: 0,
|
||
// 0, 1, 2, 3
|
||
// Define the dragging mode of the cropper
|
||
dragMode: DRAG_MODE_CROP,
|
||
// 'crop', 'move' or 'none'
|
||
// Define the initial aspect ratio of the crop box
|
||
initialAspectRatio: NaN,
|
||
// Define the aspect ratio of the crop box
|
||
aspectRatio: NaN,
|
||
// An object with the previous cropping result data
|
||
data: null,
|
||
// A selector for adding extra containers to preview
|
||
preview: '',
|
||
// Re-render the cropper when resize the window
|
||
responsive: true,
|
||
// Restore the cropped area after resize the window
|
||
restore: true,
|
||
// Check if the current image is a cross-origin image
|
||
checkCrossOrigin: true,
|
||
// Check the current image's Exif Orientation information
|
||
checkOrientation: true,
|
||
// Show the black modal
|
||
modal: true,
|
||
// Show the dashed lines for guiding
|
||
guides: true,
|
||
// Show the center indicator for guiding
|
||
center: true,
|
||
// Show the white modal to highlight the crop box
|
||
highlight: true,
|
||
// Show the grid background
|
||
background: true,
|
||
// Enable to crop the image automatically when initialize
|
||
autoCrop: true,
|
||
// Define the percentage of automatic cropping area when initializes
|
||
autoCropArea: 0.8,
|
||
// Enable to move the image
|
||
movable: true,
|
||
// Enable to rotate the image
|
||
rotatable: true,
|
||
// Enable to scale the image
|
||
scalable: true,
|
||
// Enable to zoom the image
|
||
zoomable: true,
|
||
// Enable to zoom the image by dragging touch
|
||
zoomOnTouch: true,
|
||
// Enable to zoom the image by wheeling mouse
|
||
zoomOnWheel: true,
|
||
// Define zoom ratio when zoom the image by wheeling mouse
|
||
wheelZoomRatio: 0.1,
|
||
// Enable to move the crop box
|
||
cropBoxMovable: true,
|
||
// Enable to resize the crop box
|
||
cropBoxResizable: true,
|
||
// Toggle drag mode between "crop" and "move" when click twice on the cropper
|
||
toggleDragModeOnDblclick: true,
|
||
// Size limitation
|
||
minCanvasWidth: 0,
|
||
minCanvasHeight: 0,
|
||
minCropBoxWidth: 0,
|
||
minCropBoxHeight: 0,
|
||
minContainerWidth: 200,
|
||
minContainerHeight: 100,
|
||
// Shortcuts of events
|
||
ready: null,
|
||
cropstart: null,
|
||
cropmove: null,
|
||
cropend: null,
|
||
crop: null,
|
||
zoom: null
|
||
};
|
||
|
||
var TEMPLATE = '<div class="cropper-container" touch-action="none">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-cropper-action="e"></span>' + '<span class="cropper-line line-n" data-cropper-action="n"></span>' + '<span class="cropper-line line-w" data-cropper-action="w"></span>' + '<span class="cropper-line line-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-e" data-cropper-action="e"></span>' + '<span class="cropper-point point-n" data-cropper-action="n"></span>' + '<span class="cropper-point point-w" data-cropper-action="w"></span>' + '<span class="cropper-point point-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-ne" data-cropper-action="ne"></span>' + '<span class="cropper-point point-nw" data-cropper-action="nw"></span>' + '<span class="cropper-point point-sw" data-cropper-action="sw"></span>' + '<span class="cropper-point point-se" data-cropper-action="se"></span>' + '</div>' + '</div>';
|
||
|
||
/**
|
||
* Check if the given value is not a number.
|
||
*/
|
||
|
||
var isNaN = Number.isNaN || WINDOW.isNaN;
|
||
|
||
/**
|
||
* Check if the given value is a number.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a number, else `false`.
|
||
*/
|
||
|
||
function isNumber(value) {
|
||
return typeof value === 'number' && !isNaN(value);
|
||
}
|
||
|
||
/**
|
||
* Check if the given value is a positive number.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a positive number, else `false`.
|
||
*/
|
||
|
||
var isPositiveNumber = function isPositiveNumber(value) {
|
||
return value > 0 && value < Infinity;
|
||
};
|
||
|
||
/**
|
||
* Check if the given value is undefined.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is undefined, else `false`.
|
||
*/
|
||
|
||
function isUndefined(value) {
|
||
return typeof value === 'undefined';
|
||
}
|
||
|
||
/**
|
||
* Check if the given value is an object.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is an object, else `false`.
|
||
*/
|
||
|
||
function isObject(value) {
|
||
return _typeof(value) === 'object' && value !== null;
|
||
}
|
||
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
/**
|
||
* Check if the given value is a plain object.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
|
||
*/
|
||
|
||
function isPlainObject(value) {
|
||
if (!isObject(value)) {
|
||
return false;
|
||
}
|
||
|
||
try {
|
||
var _constructor = value.constructor;
|
||
var prototype = _constructor.prototype;
|
||
return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
|
||
} catch (error) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Check if the given value is a function.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a function, else `false`.
|
||
*/
|
||
|
||
function isFunction(value) {
|
||
return typeof value === 'function';
|
||
}
|
||
|
||
var slice = Array.prototype.slice;
|
||
|
||
/**
|
||
* Convert array-like or iterable object to an array.
|
||
* @param {*} value - The value to convert.
|
||
* @returns {Array} Returns a new array.
|
||
*/
|
||
|
||
function toArray(value) {
|
||
return Array.from ? Array.from(value) : slice.call(value);
|
||
}
|
||
|
||
/**
|
||
* Iterate the given data.
|
||
* @param {*} data - The data to iterate.
|
||
* @param {Function} callback - The process function for each element.
|
||
* @returns {*} The original data.
|
||
*/
|
||
|
||
function forEach(data, callback) {
|
||
if (data && isFunction(callback)) {
|
||
if (Array.isArray(data) || isNumber(data.length)
|
||
/* array-like */
|
||
) {
|
||
toArray(data).forEach(function (value, key) {
|
||
callback.call(data, value, key, data);
|
||
});
|
||
} else if (isObject(data)) {
|
||
Object.keys(data).forEach(function (key) {
|
||
callback.call(data, data[key], key, data);
|
||
});
|
||
}
|
||
}
|
||
|
||
return data;
|
||
}
|
||
|
||
/**
|
||
* Extend the given object.
|
||
* @param {*} target - The target object to extend.
|
||
* @param {*} args - The rest objects for merging to the target object.
|
||
* @returns {Object} The extended object.
|
||
*/
|
||
|
||
var assign = Object.assign || function assign(target) {
|
||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||
args[_key - 1] = arguments[_key];
|
||
}
|
||
|
||
if (isObject(target) && args.length > 0) {
|
||
args.forEach(function (arg) {
|
||
if (isObject(arg)) {
|
||
Object.keys(arg).forEach(function (key) {
|
||
target[key] = arg[key];
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
return target;
|
||
};
|
||
var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/;
|
||
|
||
/**
|
||
* Normalize decimal number.
|
||
* Check out {@link http://0.30000000000000004.com/}
|
||
* @param {number} value - The value to normalize.
|
||
* @param {number} [times=100000000000] - The times for normalizing.
|
||
* @returns {number} Returns the normalized number.
|
||
*/
|
||
|
||
function normalizeDecimalNumber(value) {
|
||
var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
|
||
return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
|
||
}
|
||
|
||
var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;
|
||
|
||
/**
|
||
* Apply styles to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {Object} styles - The styles for applying.
|
||
*/
|
||
|
||
function setStyle(element, styles) {
|
||
var style = element.style;
|
||
forEach(styles, function (value, property) {
|
||
if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
|
||
value = "".concat(value, "px");
|
||
}
|
||
|
||
style[property] = value;
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Check if the given element has a special class.
|
||
* @param {Element} element - The element to check.
|
||
* @param {string} value - The class to search.
|
||
* @returns {boolean} Returns `true` if the special class was found.
|
||
*/
|
||
|
||
function hasClass(element, value) {
|
||
return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
|
||
}
|
||
|
||
/**
|
||
* Add classes to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be added.
|
||
*/
|
||
|
||
function addClass(element, value) {
|
||
if (!value) {
|
||
return;
|
||
}
|
||
|
||
if (isNumber(element.length)) {
|
||
forEach(element, function (elem) {
|
||
addClass(elem, value);
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (element.classList) {
|
||
element.classList.add(value);
|
||
return;
|
||
}
|
||
|
||
var className = element.className.trim();
|
||
|
||
if (!className) {
|
||
element.className = value;
|
||
} else if (className.indexOf(value) < 0) {
|
||
element.className = "".concat(className, " ").concat(value);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Remove classes from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be removed.
|
||
*/
|
||
|
||
function removeClass(element, value) {
|
||
if (!value) {
|
||
return;
|
||
}
|
||
|
||
if (isNumber(element.length)) {
|
||
forEach(element, function (elem) {
|
||
removeClass(elem, value);
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (element.classList) {
|
||
element.classList.remove(value);
|
||
return;
|
||
}
|
||
|
||
if (element.className.indexOf(value) >= 0) {
|
||
element.className = element.className.replace(value, '');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Add or remove classes from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be toggled.
|
||
* @param {boolean} added - Add only.
|
||
*/
|
||
|
||
function toggleClass(element, value, added) {
|
||
if (!value) {
|
||
return;
|
||
}
|
||
|
||
if (isNumber(element.length)) {
|
||
forEach(element, function (elem) {
|
||
toggleClass(elem, value, added);
|
||
});
|
||
return;
|
||
} // IE10-11 doesn't support the second parameter of `classList.toggle`
|
||
|
||
|
||
if (added) {
|
||
addClass(element, value);
|
||
} else {
|
||
removeClass(element, value);
|
||
}
|
||
}
|
||
|
||
var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g;
|
||
|
||
/**
|
||
* Transform the given string from camelCase to kebab-case
|
||
* @param {string} value - The value to transform.
|
||
* @returns {string} The transformed value.
|
||
*/
|
||
|
||
function toParamCase(value) {
|
||
return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();
|
||
}
|
||
|
||
/**
|
||
* Get data from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} name - The data key to get.
|
||
* @returns {string} The data value.
|
||
*/
|
||
|
||
function getData(element, name) {
|
||
if (isObject(element[name])) {
|
||
return element[name];
|
||
}
|
||
|
||
if (element.dataset) {
|
||
return element.dataset[name];
|
||
}
|
||
|
||
return element.getAttribute("data-".concat(toParamCase(name)));
|
||
}
|
||
|
||
/**
|
||
* Set data to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} name - The data key to set.
|
||
* @param {string} data - The data value.
|
||
*/
|
||
|
||
function setData(element, name, data) {
|
||
if (isObject(data)) {
|
||
element[name] = data;
|
||
} else if (element.dataset) {
|
||
element.dataset[name] = data;
|
||
} else {
|
||
element.setAttribute("data-".concat(toParamCase(name)), data);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Remove data from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} name - The data key to remove.
|
||
*/
|
||
|
||
function removeData(element, name) {
|
||
if (isObject(element[name])) {
|
||
try {
|
||
delete element[name];
|
||
} catch (error) {
|
||
element[name] = undefined;
|
||
}
|
||
} else if (element.dataset) {
|
||
// #128 Safari not allows to delete dataset property
|
||
try {
|
||
delete element.dataset[name];
|
||
} catch (error) {
|
||
element.dataset[name] = undefined;
|
||
}
|
||
} else {
|
||
element.removeAttribute("data-".concat(toParamCase(name)));
|
||
}
|
||
}
|
||
|
||
var REGEXP_SPACES = /\s\s*/;
|
||
|
||
var onceSupported = function () {
|
||
var supported = false;
|
||
|
||
if (IS_BROWSER) {
|
||
var once = false;
|
||
|
||
var listener = function listener() {
|
||
};
|
||
|
||
var options = Object.defineProperty({}, 'once', {
|
||
get: function get() {
|
||
supported = true;
|
||
return once;
|
||
},
|
||
|
||
/**
|
||
* This setter can fix a `TypeError` in strict mode
|
||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
||
* @param {boolean} value - The value to set
|
||
*/
|
||
set: function set(value) {
|
||
once = value;
|
||
}
|
||
});
|
||
WINDOW.addEventListener('test', listener, options);
|
||
WINDOW.removeEventListener('test', listener, options);
|
||
}
|
||
|
||
return supported;
|
||
}();
|
||
|
||
/**
|
||
* Remove event listener from the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Function} listener - The event listener.
|
||
* @param {Object} options - The event options.
|
||
*/
|
||
|
||
|
||
function removeListener(element, type, listener) {
|
||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||
var handler = listener;
|
||
type.trim().split(REGEXP_SPACES).forEach(function (event) {
|
||
if (!onceSupported) {
|
||
var listeners = element.listeners;
|
||
|
||
if (listeners && listeners[event] && listeners[event][listener]) {
|
||
handler = listeners[event][listener];
|
||
delete listeners[event][listener];
|
||
|
||
if (Object.keys(listeners[event]).length === 0) {
|
||
delete listeners[event];
|
||
}
|
||
|
||
if (Object.keys(listeners).length === 0) {
|
||
delete element.listeners;
|
||
}
|
||
}
|
||
}
|
||
|
||
element.removeEventListener(event, handler, options);
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Add event listener to the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Function} listener - The event listener.
|
||
* @param {Object} options - The event options.
|
||
*/
|
||
|
||
function addListener(element, type, listener) {
|
||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||
var _handler = listener;
|
||
type.trim().split(REGEXP_SPACES).forEach(function (event) {
|
||
if (options.once && !onceSupported) {
|
||
var _element$listeners = element.listeners,
|
||
listeners = _element$listeners === void 0 ? {} : _element$listeners;
|
||
|
||
_handler = function handler() {
|
||
delete listeners[event][listener];
|
||
element.removeEventListener(event, _handler, options);
|
||
|
||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||
args[_key2] = arguments[_key2];
|
||
}
|
||
|
||
listener.apply(element, args);
|
||
};
|
||
|
||
if (!listeners[event]) {
|
||
listeners[event] = {};
|
||
}
|
||
|
||
if (listeners[event][listener]) {
|
||
element.removeEventListener(event, listeners[event][listener], options);
|
||
}
|
||
|
||
listeners[event][listener] = _handler;
|
||
element.listeners = listeners;
|
||
}
|
||
|
||
element.addEventListener(event, _handler, options);
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Dispatch event on the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Object} data - The additional event data.
|
||
* @returns {boolean} Indicate if the event is default prevented or not.
|
||
*/
|
||
|
||
function dispatchEvent(element, type, data) {
|
||
var event; // Event and CustomEvent on IE9-11 are global objects, not constructors
|
||
|
||
if (isFunction(Event) && isFunction(CustomEvent)) {
|
||
event = new CustomEvent(type, {
|
||
detail: data,
|
||
bubbles: true,
|
||
cancelable: true
|
||
});
|
||
} else {
|
||
event = document.createEvent('CustomEvent');
|
||
event.initCustomEvent(type, true, true, data);
|
||
}
|
||
|
||
return element.dispatchEvent(event);
|
||
}
|
||
|
||
/**
|
||
* Get the offset base on the document.
|
||
* @param {Element} element - The target element.
|
||
* @returns {Object} The offset data.
|
||
*/
|
||
|
||
function getOffset(element) {
|
||
var box = element.getBoundingClientRect();
|
||
return {
|
||
left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
|
||
top: box.top + (window.pageYOffset - document.documentElement.clientTop)
|
||
};
|
||
}
|
||
|
||
var location = WINDOW.location;
|
||
var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i;
|
||
|
||
/**
|
||
* Check if the given URL is a cross origin URL.
|
||
* @param {string} url - The target URL.
|
||
* @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
|
||
*/
|
||
|
||
function isCrossOriginURL(url) {
|
||
var parts = url.match(REGEXP_ORIGINS);
|
||
return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
|
||
}
|
||
|
||
/**
|
||
* Add timestamp to the given URL.
|
||
* @param {string} url - The target URL.
|
||
* @returns {string} The result URL.
|
||
*/
|
||
|
||
function addTimestamp(url) {
|
||
var timestamp = "timestamp=".concat(new Date().getTime());
|
||
return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
|
||
}
|
||
|
||
/**
|
||
* Get transforms base on the given object.
|
||
* @param {Object} obj - The target object.
|
||
* @returns {string} A string contains transform values.
|
||
*/
|
||
|
||
function getTransforms(_ref) {
|
||
var rotate = _ref.rotate,
|
||
scaleX = _ref.scaleX,
|
||
scaleY = _ref.scaleY,
|
||
translateX = _ref.translateX,
|
||
translateY = _ref.translateY;
|
||
var values = [];
|
||
|
||
if (isNumber(translateX) && translateX !== 0) {
|
||
values.push("translateX(".concat(translateX, "px)"));
|
||
}
|
||
|
||
if (isNumber(translateY) && translateY !== 0) {
|
||
values.push("translateY(".concat(translateY, "px)"));
|
||
} // Rotate should come first before scale to match orientation transform
|
||
|
||
|
||
if (isNumber(rotate) && rotate !== 0) {
|
||
values.push("rotate(".concat(rotate, "deg)"));
|
||
}
|
||
|
||
if (isNumber(scaleX) && scaleX !== 1) {
|
||
values.push("scaleX(".concat(scaleX, ")"));
|
||
}
|
||
|
||
if (isNumber(scaleY) && scaleY !== 1) {
|
||
values.push("scaleY(".concat(scaleY, ")"));
|
||
}
|
||
|
||
var transform = values.length ? values.join(' ') : 'none';
|
||
return {
|
||
WebkitTransform: transform,
|
||
msTransform: transform,
|
||
transform: transform
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Get the max ratio of a group of pointers.
|
||
* @param {string} pointers - The target pointers.
|
||
* @returns {number} The result ratio.
|
||
*/
|
||
|
||
function getMaxZoomRatio(pointers) {
|
||
var pointers2 = assign({}, pointers);
|
||
var ratios = [];
|
||
forEach(pointers, function (pointer, pointerId) {
|
||
delete pointers2[pointerId];
|
||
forEach(pointers2, function (pointer2) {
|
||
var x1 = Math.abs(pointer.startX - pointer2.startX);
|
||
var y1 = Math.abs(pointer.startY - pointer2.startY);
|
||
var x2 = Math.abs(pointer.endX - pointer2.endX);
|
||
var y2 = Math.abs(pointer.endY - pointer2.endY);
|
||
var z1 = Math.sqrt(x1 * x1 + y1 * y1);
|
||
var z2 = Math.sqrt(x2 * x2 + y2 * y2);
|
||
var ratio = (z2 - z1) / z1;
|
||
ratios.push(ratio);
|
||
});
|
||
});
|
||
ratios.sort(function (a, b) {
|
||
return Math.abs(a) < Math.abs(b);
|
||
});
|
||
return ratios[0];
|
||
}
|
||
|
||
/**
|
||
* Get a pointer from an event object.
|
||
* @param {Object} event - The target event object.
|
||
* @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
|
||
* @returns {Object} The result pointer contains start and/or end point coordinates.
|
||
*/
|
||
|
||
function getPointer(_ref2, endOnly) {
|
||
var pageX = _ref2.pageX,
|
||
pageY = _ref2.pageY;
|
||
var end = {
|
||
endX: pageX,
|
||
endY: pageY
|
||
};
|
||
return endOnly ? end : assign({
|
||
startX: pageX,
|
||
startY: pageY
|
||
}, end);
|
||
}
|
||
|
||
/**
|
||
* Get the center point coordinate of a group of pointers.
|
||
* @param {Object} pointers - The target pointers.
|
||
* @returns {Object} The center point coordinate.
|
||
*/
|
||
|
||
function getPointersCenter(pointers) {
|
||
var pageX = 0;
|
||
var pageY = 0;
|
||
var count = 0;
|
||
forEach(pointers, function (_ref3) {
|
||
var startX = _ref3.startX,
|
||
startY = _ref3.startY;
|
||
pageX += startX;
|
||
pageY += startY;
|
||
count += 1;
|
||
});
|
||
pageX /= count;
|
||
pageY /= count;
|
||
return {
|
||
pageX: pageX,
|
||
pageY: pageY
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Get the max sizes in a rectangle under the given aspect ratio.
|
||
* @param {Object} data - The original sizes.
|
||
* @param {string} [type='contain'] - The adjust type.
|
||
* @returns {Object} The result sizes.
|
||
*/
|
||
|
||
function getAdjustedSizes(_ref4) // or 'cover'
|
||
{
|
||
var aspectRatio = _ref4.aspectRatio,
|
||
height = _ref4.height,
|
||
width = _ref4.width;
|
||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';
|
||
var isValidWidth = isPositiveNumber(width);
|
||
var isValidHeight = isPositiveNumber(height);
|
||
|
||
if (isValidWidth && isValidHeight) {
|
||
var adjustedWidth = height * aspectRatio;
|
||
|
||
if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {
|
||
height = width / aspectRatio;
|
||
} else {
|
||
width = height * aspectRatio;
|
||
}
|
||
} else if (isValidWidth) {
|
||
height = width / aspectRatio;
|
||
} else if (isValidHeight) {
|
||
width = height * aspectRatio;
|
||
}
|
||
|
||
return {
|
||
width: width,
|
||
height: height
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Get the new sizes of a rectangle after rotated.
|
||
* @param {Object} data - The original sizes.
|
||
* @returns {Object} The result sizes.
|
||
*/
|
||
|
||
function getRotatedSizes(_ref5) {
|
||
var width = _ref5.width,
|
||
height = _ref5.height,
|
||
degree = _ref5.degree;
|
||
degree = Math.abs(degree) % 180;
|
||
|
||
if (degree === 90) {
|
||
return {
|
||
width: height,
|
||
height: width
|
||
};
|
||
}
|
||
|
||
var arc = degree % 90 * Math.PI / 180;
|
||
var sinArc = Math.sin(arc);
|
||
var cosArc = Math.cos(arc);
|
||
var newWidth = width * cosArc + height * sinArc;
|
||
var newHeight = width * sinArc + height * cosArc;
|
||
return degree > 90 ? {
|
||
width: newHeight,
|
||
height: newWidth
|
||
} : {
|
||
width: newWidth,
|
||
height: newHeight
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Get a canvas which drew the given image.
|
||
* @param {HTMLImageElement} image - The image for drawing.
|
||
* @param {Object} imageData - The image data.
|
||
* @param {Object} canvasData - The canvas data.
|
||
* @param {Object} options - The options.
|
||
* @returns {HTMLCanvasElement} The result canvas.
|
||
*/
|
||
|
||
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
|
||
var imageAspectRatio = _ref6.aspectRatio,
|
||
imageNaturalWidth = _ref6.naturalWidth,
|
||
imageNaturalHeight = _ref6.naturalHeight,
|
||
_ref6$rotate = _ref6.rotate,
|
||
rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate,
|
||
_ref6$scaleX = _ref6.scaleX,
|
||
scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX,
|
||
_ref6$scaleY = _ref6.scaleY,
|
||
scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;
|
||
var aspectRatio = _ref7.aspectRatio,
|
||
naturalWidth = _ref7.naturalWidth,
|
||
naturalHeight = _ref7.naturalHeight;
|
||
var _ref8$fillColor = _ref8.fillColor,
|
||
fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor,
|
||
_ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
|
||
imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE,
|
||
_ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
|
||
imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ,
|
||
_ref8$maxWidth = _ref8.maxWidth,
|
||
maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth,
|
||
_ref8$maxHeight = _ref8.maxHeight,
|
||
maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight,
|
||
_ref8$minWidth = _ref8.minWidth,
|
||
minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth,
|
||
_ref8$minHeight = _ref8.minHeight,
|
||
minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;
|
||
var canvas = document.createElement('canvas');
|
||
var context = canvas.getContext('2d');
|
||
var maxSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: maxWidth,
|
||
height: maxHeight
|
||
});
|
||
var minSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: minWidth,
|
||
height: minHeight
|
||
}, 'cover');
|
||
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
|
||
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as
|
||
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
|
||
|
||
var destMaxSizes = getAdjustedSizes({
|
||
aspectRatio: imageAspectRatio,
|
||
width: maxWidth,
|
||
height: maxHeight
|
||
});
|
||
var destMinSizes = getAdjustedSizes({
|
||
aspectRatio: imageAspectRatio,
|
||
width: minWidth,
|
||
height: minHeight
|
||
}, 'cover');
|
||
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
|
||
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
|
||
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];
|
||
canvas.width = normalizeDecimalNumber(width);
|
||
canvas.height = normalizeDecimalNumber(height);
|
||
context.fillStyle = fillColor;
|
||
context.fillRect(0, 0, width, height);
|
||
context.save();
|
||
context.translate(width / 2, height / 2);
|
||
context.rotate(rotate * Math.PI / 180);
|
||
context.scale(scaleX, scaleY);
|
||
context.imageSmoothingEnabled = imageSmoothingEnabled;
|
||
context.imageSmoothingQuality = imageSmoothingQuality;
|
||
context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) {
|
||
return Math.floor(normalizeDecimalNumber(param));
|
||
}))));
|
||
context.restore();
|
||
return canvas;
|
||
}
|
||
|
||
var fromCharCode = String.fromCharCode;
|
||
|
||
/**
|
||
* Get string from char code in data view.
|
||
* @param {DataView} dataView - The data view for read.
|
||
* @param {number} start - The start index.
|
||
* @param {number} length - The read length.
|
||
* @returns {string} The read result.
|
||
*/
|
||
|
||
function getStringFromCharCode(dataView, start, length) {
|
||
var str = '';
|
||
length += start;
|
||
|
||
for (var i = start; i < length; i += 1) {
|
||
str += fromCharCode(dataView.getUint8(i));
|
||
}
|
||
|
||
return str;
|
||
}
|
||
|
||
var REGEXP_DATA_URL_HEAD = /^data:.*,/;
|
||
|
||
/**
|
||
* Transform Data URL to array buffer.
|
||
* @param {string} dataURL - The Data URL to transform.
|
||
* @returns {ArrayBuffer} The result array buffer.
|
||
*/
|
||
|
||
function dataURLToArrayBuffer(dataURL) {
|
||
var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
|
||
var binary = atob(base64);
|
||
var arrayBuffer = new ArrayBuffer(binary.length);
|
||
var uint8 = new Uint8Array(arrayBuffer);
|
||
forEach(uint8, function (value, i) {
|
||
uint8[i] = binary.charCodeAt(i);
|
||
});
|
||
return arrayBuffer;
|
||
}
|
||
|
||
/**
|
||
* Transform array buffer to Data URL.
|
||
* @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
|
||
* @param {string} mimeType - The mime type of the Data URL.
|
||
* @returns {string} The result Data URL.
|
||
*/
|
||
|
||
function arrayBufferToDataURL(arrayBuffer, mimeType) {
|
||
var chunks = []; // Chunk Typed Array for better performance (#435)
|
||
|
||
var chunkSize = 8192;
|
||
var uint8 = new Uint8Array(arrayBuffer);
|
||
|
||
while (uint8.length > 0) {
|
||
// XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9
|
||
// eslint-disable-next-line prefer-spread
|
||
chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));
|
||
uint8 = uint8.subarray(chunkSize);
|
||
}
|
||
|
||
return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join('')));
|
||
}
|
||
|
||
/**
|
||
* Get orientation value from given array buffer.
|
||
* @param {ArrayBuffer} arrayBuffer - The array buffer to read.
|
||
* @returns {number} The read orientation value.
|
||
*/
|
||
|
||
function resetAndGetOrientation(arrayBuffer) {
|
||
var dataView = new DataView(arrayBuffer);
|
||
var orientation; // Ignores range error when the image does not have correct Exif information
|
||
|
||
try {
|
||
var littleEndian;
|
||
var app1Start;
|
||
var ifdStart; // Only handle JPEG image (start by 0xFFD8)
|
||
|
||
if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
|
||
var length = dataView.byteLength;
|
||
var offset = 2;
|
||
|
||
while (offset + 1 < length) {
|
||
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
|
||
app1Start = offset;
|
||
break;
|
||
}
|
||
|
||
offset += 1;
|
||
}
|
||
}
|
||
|
||
if (app1Start) {
|
||
var exifIDCode = app1Start + 4;
|
||
var tiffOffset = app1Start + 10;
|
||
|
||
if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
|
||
var endianness = dataView.getUint16(tiffOffset);
|
||
littleEndian = endianness === 0x4949;
|
||
|
||
if (littleEndian || endianness === 0x4D4D
|
||
/* bigEndian */
|
||
) {
|
||
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
|
||
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
|
||
|
||
if (firstIFDOffset >= 0x00000008) {
|
||
ifdStart = tiffOffset + firstIFDOffset;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (ifdStart) {
|
||
var _length = dataView.getUint16(ifdStart, littleEndian);
|
||
|
||
var _offset;
|
||
|
||
var i;
|
||
|
||
for (i = 0; i < _length; i += 1) {
|
||
_offset = ifdStart + i * 12 + 2;
|
||
|
||
if (dataView.getUint16(_offset, littleEndian) === 0x0112
|
||
/* Orientation */
|
||
) {
|
||
// 8 is the offset of the current tag's value
|
||
_offset += 8; // Get the original orientation value
|
||
|
||
orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value
|
||
|
||
dataView.setUint16(_offset, 1, littleEndian);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
} catch (error) {
|
||
orientation = 1;
|
||
}
|
||
|
||
return orientation;
|
||
}
|
||
|
||
/**
|
||
* Parse Exif Orientation value.
|
||
* @param {number} orientation - The orientation to parse.
|
||
* @returns {Object} The parsed result.
|
||
*/
|
||
|
||
function parseOrientation(orientation) {
|
||
var rotate = 0;
|
||
var scaleX = 1;
|
||
var scaleY = 1;
|
||
|
||
switch (orientation) {
|
||
// Flip horizontal
|
||
case 2:
|
||
scaleX = -1;
|
||
break;
|
||
// Rotate left 180°
|
||
|
||
case 3:
|
||
rotate = -180;
|
||
break;
|
||
// Flip vertical
|
||
|
||
case 4:
|
||
scaleY = -1;
|
||
break;
|
||
// Flip vertical and rotate right 90°
|
||
|
||
case 5:
|
||
rotate = 90;
|
||
scaleY = -1;
|
||
break;
|
||
// Rotate right 90°
|
||
|
||
case 6:
|
||
rotate = 90;
|
||
break;
|
||
// Flip horizontal and rotate right 90°
|
||
|
||
case 7:
|
||
rotate = 90;
|
||
scaleX = -1;
|
||
break;
|
||
// Rotate left 90°
|
||
|
||
case 8:
|
||
rotate = -90;
|
||
break;
|
||
|
||
default:
|
||
}
|
||
|
||
return {
|
||
rotate: rotate,
|
||
scaleX: scaleX,
|
||
scaleY: scaleY
|
||
};
|
||
}
|
||
|
||
var render = {
|
||
render: function render() {
|
||
this.initContainer();
|
||
this.initCanvas();
|
||
this.initCropBox();
|
||
this.renderCanvas();
|
||
|
||
if (this.cropped) {
|
||
this.renderCropBox();
|
||
}
|
||
},
|
||
initContainer: function initContainer() {
|
||
var element = this.element,
|
||
options = this.options,
|
||
container = this.container,
|
||
cropper = this.cropper;
|
||
addClass(cropper, CLASS_HIDDEN);
|
||
removeClass(element, CLASS_HIDDEN);
|
||
var containerData = {
|
||
width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),
|
||
height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)
|
||
};
|
||
this.containerData = containerData;
|
||
setStyle(cropper, {
|
||
width: containerData.width,
|
||
height: containerData.height
|
||
});
|
||
addClass(element, CLASS_HIDDEN);
|
||
removeClass(cropper, CLASS_HIDDEN);
|
||
},
|
||
// Canvas (image wrapper)
|
||
initCanvas: function initCanvas() {
|
||
var containerData = this.containerData,
|
||
imageData = this.imageData;
|
||
var viewMode = this.options.viewMode;
|
||
var rotated = Math.abs(imageData.rotate) % 180 === 90;
|
||
var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
|
||
var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
|
||
var aspectRatio = naturalWidth / naturalHeight;
|
||
var canvasWidth = containerData.width;
|
||
var canvasHeight = containerData.height;
|
||
|
||
if (containerData.height * aspectRatio > containerData.width) {
|
||
if (viewMode === 3) {
|
||
canvasWidth = containerData.height * aspectRatio;
|
||
} else {
|
||
canvasHeight = containerData.width / aspectRatio;
|
||
}
|
||
} else if (viewMode === 3) {
|
||
canvasHeight = containerData.width / aspectRatio;
|
||
} else {
|
||
canvasWidth = containerData.height * aspectRatio;
|
||
}
|
||
|
||
var canvasData = {
|
||
aspectRatio: aspectRatio,
|
||
naturalWidth: naturalWidth,
|
||
naturalHeight: naturalHeight,
|
||
width: canvasWidth,
|
||
height: canvasHeight
|
||
};
|
||
canvasData.left = (containerData.width - canvasWidth) / 2;
|
||
canvasData.top = (containerData.height - canvasHeight) / 2;
|
||
canvasData.oldLeft = canvasData.left;
|
||
canvasData.oldTop = canvasData.top;
|
||
this.canvasData = canvasData;
|
||
this.limited = viewMode === 1 || viewMode === 2;
|
||
this.limitCanvas(true, true);
|
||
this.initialImageData = assign({}, imageData);
|
||
this.initialCanvasData = assign({}, canvasData);
|
||
},
|
||
limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
|
||
var options = this.options,
|
||
containerData = this.containerData,
|
||
canvasData = this.canvasData,
|
||
cropBoxData = this.cropBoxData;
|
||
var viewMode = options.viewMode;
|
||
var aspectRatio = canvasData.aspectRatio;
|
||
var cropped = this.cropped && cropBoxData;
|
||
|
||
if (sizeLimited) {
|
||
var minCanvasWidth = Number(options.minCanvasWidth) || 0;
|
||
var minCanvasHeight = Number(options.minCanvasHeight) || 0;
|
||
|
||
if (viewMode > 1) {
|
||
minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
|
||
minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
|
||
|
||
if (viewMode === 3) {
|
||
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
|
||
minCanvasWidth = minCanvasHeight * aspectRatio;
|
||
} else {
|
||
minCanvasHeight = minCanvasWidth / aspectRatio;
|
||
}
|
||
}
|
||
} else if (viewMode > 0) {
|
||
if (minCanvasWidth) {
|
||
minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
|
||
} else if (minCanvasHeight) {
|
||
minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
|
||
} else if (cropped) {
|
||
minCanvasWidth = cropBoxData.width;
|
||
minCanvasHeight = cropBoxData.height;
|
||
|
||
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
|
||
minCanvasWidth = minCanvasHeight * aspectRatio;
|
||
} else {
|
||
minCanvasHeight = minCanvasWidth / aspectRatio;
|
||
}
|
||
}
|
||
}
|
||
|
||
var _getAdjustedSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: minCanvasWidth,
|
||
height: minCanvasHeight
|
||
});
|
||
|
||
minCanvasWidth = _getAdjustedSizes.width;
|
||
minCanvasHeight = _getAdjustedSizes.height;
|
||
canvasData.minWidth = minCanvasWidth;
|
||
canvasData.minHeight = minCanvasHeight;
|
||
canvasData.maxWidth = Infinity;
|
||
canvasData.maxHeight = Infinity;
|
||
}
|
||
|
||
if (positionLimited) {
|
||
if (viewMode > (cropped ? 0 : 1)) {
|
||
var newCanvasLeft = containerData.width - canvasData.width;
|
||
var newCanvasTop = containerData.height - canvasData.height;
|
||
canvasData.minLeft = Math.min(0, newCanvasLeft);
|
||
canvasData.minTop = Math.min(0, newCanvasTop);
|
||
canvasData.maxLeft = Math.max(0, newCanvasLeft);
|
||
canvasData.maxTop = Math.max(0, newCanvasTop);
|
||
|
||
if (cropped && this.limited) {
|
||
canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
|
||
canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
|
||
canvasData.maxLeft = cropBoxData.left;
|
||
canvasData.maxTop = cropBoxData.top;
|
||
|
||
if (viewMode === 2) {
|
||
if (canvasData.width >= containerData.width) {
|
||
canvasData.minLeft = Math.min(0, newCanvasLeft);
|
||
canvasData.maxLeft = Math.max(0, newCanvasLeft);
|
||
}
|
||
|
||
if (canvasData.height >= containerData.height) {
|
||
canvasData.minTop = Math.min(0, newCanvasTop);
|
||
canvasData.maxTop = Math.max(0, newCanvasTop);
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
canvasData.minLeft = -canvasData.width;
|
||
canvasData.minTop = -canvasData.height;
|
||
canvasData.maxLeft = containerData.width;
|
||
canvasData.maxTop = containerData.height;
|
||
}
|
||
}
|
||
},
|
||
renderCanvas: function renderCanvas(changed, transformed) {
|
||
var canvasData = this.canvasData,
|
||
imageData = this.imageData;
|
||
|
||
if (transformed) {
|
||
var _getRotatedSizes = getRotatedSizes({
|
||
width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
|
||
height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
|
||
degree: imageData.rotate || 0
|
||
}),
|
||
naturalWidth = _getRotatedSizes.width,
|
||
naturalHeight = _getRotatedSizes.height;
|
||
|
||
var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
|
||
var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
|
||
canvasData.left -= (width - canvasData.width) / 2;
|
||
canvasData.top -= (height - canvasData.height) / 2;
|
||
canvasData.width = width;
|
||
canvasData.height = height;
|
||
canvasData.aspectRatio = naturalWidth / naturalHeight;
|
||
canvasData.naturalWidth = naturalWidth;
|
||
canvasData.naturalHeight = naturalHeight;
|
||
this.limitCanvas(true, false);
|
||
}
|
||
|
||
if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
|
||
canvasData.left = canvasData.oldLeft;
|
||
}
|
||
|
||
if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
|
||
canvasData.top = canvasData.oldTop;
|
||
}
|
||
|
||
canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
|
||
canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
|
||
this.limitCanvas(false, true);
|
||
canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
|
||
canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
|
||
canvasData.oldLeft = canvasData.left;
|
||
canvasData.oldTop = canvasData.top;
|
||
setStyle(this.canvas, assign({
|
||
width: canvasData.width,
|
||
height: canvasData.height
|
||
}, getTransforms({
|
||
translateX: canvasData.left,
|
||
translateY: canvasData.top
|
||
})));
|
||
this.renderImage(changed);
|
||
|
||
if (this.cropped && this.limited) {
|
||
this.limitCropBox(true, true);
|
||
}
|
||
},
|
||
renderImage: function renderImage(changed) {
|
||
var canvasData = this.canvasData,
|
||
imageData = this.imageData;
|
||
var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
|
||
var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
|
||
assign(imageData, {
|
||
width: width,
|
||
height: height,
|
||
left: (canvasData.width - width) / 2,
|
||
top: (canvasData.height - height) / 2
|
||
});
|
||
setStyle(this.image, assign({
|
||
width: imageData.width,
|
||
height: imageData.height
|
||
}, getTransforms(assign({
|
||
translateX: imageData.left,
|
||
translateY: imageData.top
|
||
}, imageData))));
|
||
|
||
if (changed) {
|
||
this.output();
|
||
}
|
||
},
|
||
initCropBox: function initCropBox() {
|
||
var options = this.options,
|
||
canvasData = this.canvasData;
|
||
var aspectRatio = options.aspectRatio || options.initialAspectRatio;
|
||
var autoCropArea = Number(options.autoCropArea) || 0.8;
|
||
var cropBoxData = {
|
||
width: canvasData.width,
|
||
height: canvasData.height
|
||
};
|
||
|
||
if (aspectRatio) {
|
||
if (canvasData.height * aspectRatio > canvasData.width) {
|
||
cropBoxData.height = cropBoxData.width / aspectRatio;
|
||
} else {
|
||
cropBoxData.width = cropBoxData.height * aspectRatio;
|
||
}
|
||
}
|
||
|
||
this.cropBoxData = cropBoxData;
|
||
this.limitCropBox(true, true); // Initialize auto crop area
|
||
|
||
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
|
||
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than "minWidth/Height"
|
||
|
||
cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
|
||
cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
|
||
cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
|
||
cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
|
||
cropBoxData.oldLeft = cropBoxData.left;
|
||
cropBoxData.oldTop = cropBoxData.top;
|
||
this.initialCropBoxData = assign({}, cropBoxData);
|
||
},
|
||
limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
|
||
var options = this.options,
|
||
containerData = this.containerData,
|
||
canvasData = this.canvasData,
|
||
cropBoxData = this.cropBoxData,
|
||
limited = this.limited;
|
||
var aspectRatio = options.aspectRatio;
|
||
|
||
if (sizeLimited) {
|
||
var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
|
||
var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
|
||
var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;
|
||
var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height
|
||
|
||
minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
|
||
minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
|
||
|
||
if (aspectRatio) {
|
||
if (minCropBoxWidth && minCropBoxHeight) {
|
||
if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
|
||
minCropBoxHeight = minCropBoxWidth / aspectRatio;
|
||
} else {
|
||
minCropBoxWidth = minCropBoxHeight * aspectRatio;
|
||
}
|
||
} else if (minCropBoxWidth) {
|
||
minCropBoxHeight = minCropBoxWidth / aspectRatio;
|
||
} else if (minCropBoxHeight) {
|
||
minCropBoxWidth = minCropBoxHeight * aspectRatio;
|
||
}
|
||
|
||
if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
|
||
maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
|
||
} else {
|
||
maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
|
||
}
|
||
} // The minWidth/Height must be less than maxWidth/Height
|
||
|
||
|
||
cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
|
||
cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
|
||
cropBoxData.maxWidth = maxCropBoxWidth;
|
||
cropBoxData.maxHeight = maxCropBoxHeight;
|
||
}
|
||
|
||
if (positionLimited) {
|
||
if (limited) {
|
||
cropBoxData.minLeft = Math.max(0, canvasData.left);
|
||
cropBoxData.minTop = Math.max(0, canvasData.top);
|
||
cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
|
||
cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
|
||
} else {
|
||
cropBoxData.minLeft = 0;
|
||
cropBoxData.minTop = 0;
|
||
cropBoxData.maxLeft = containerData.width - cropBoxData.width;
|
||
cropBoxData.maxTop = containerData.height - cropBoxData.height;
|
||
}
|
||
}
|
||
},
|
||
renderCropBox: function renderCropBox() {
|
||
var options = this.options,
|
||
containerData = this.containerData,
|
||
cropBoxData = this.cropBoxData;
|
||
|
||
if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
|
||
cropBoxData.left = cropBoxData.oldLeft;
|
||
}
|
||
|
||
if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
|
||
cropBoxData.top = cropBoxData.oldTop;
|
||
}
|
||
|
||
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
|
||
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
|
||
this.limitCropBox(false, true);
|
||
cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
|
||
cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
|
||
cropBoxData.oldLeft = cropBoxData.left;
|
||
cropBoxData.oldTop = cropBoxData.top;
|
||
|
||
if (options.movable && options.cropBoxMovable) {
|
||
// Turn to move the canvas when the crop box is equal to the container
|
||
setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
|
||
}
|
||
|
||
setStyle(this.cropBox, assign({
|
||
width: cropBoxData.width,
|
||
height: cropBoxData.height
|
||
}, getTransforms({
|
||
translateX: cropBoxData.left,
|
||
translateY: cropBoxData.top
|
||
})));
|
||
|
||
if (this.cropped && this.limited) {
|
||
this.limitCanvas(true, true);
|
||
}
|
||
|
||
if (!this.disabled) {
|
||
this.output();
|
||
}
|
||
},
|
||
output: function output() {
|
||
this.preview();
|
||
dispatchEvent(this.element, EVENT_CROP, this.getData());
|
||
}
|
||
};
|
||
|
||
var preview = {
|
||
initPreview: function initPreview() {
|
||
var crossOrigin = this.crossOrigin;
|
||
var preview = this.options.preview;
|
||
var url = crossOrigin ? this.crossOriginUrl : this.url;
|
||
var image = document.createElement('img');
|
||
|
||
if (crossOrigin) {
|
||
image.crossOrigin = crossOrigin;
|
||
}
|
||
|
||
image.src = url;
|
||
this.viewBox.appendChild(image);
|
||
this.viewBoxImage = image;
|
||
|
||
if (!preview) {
|
||
return;
|
||
}
|
||
|
||
var previews = preview;
|
||
|
||
if (typeof preview === 'string') {
|
||
previews = this.element.ownerDocument.querySelectorAll(preview);
|
||
} else if (preview.querySelector) {
|
||
previews = [preview];
|
||
}
|
||
|
||
this.previews = previews;
|
||
forEach(previews, function (el) {
|
||
var img = document.createElement('img'); // Save the original size for recover
|
||
|
||
setData(el, DATA_PREVIEW, {
|
||
width: el.offsetWidth,
|
||
height: el.offsetHeight,
|
||
html: el.innerHTML
|
||
});
|
||
|
||
if (crossOrigin) {
|
||
img.crossOrigin = crossOrigin;
|
||
}
|
||
|
||
img.src = url;
|
||
/**
|
||
* Override img element styles
|
||
* Add `display:block` to avoid margin top issue
|
||
* Add `height:auto` to override `height` attribute on IE8
|
||
* (Occur only when margin-top <= -height)
|
||
*/
|
||
|
||
img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
|
||
el.innerHTML = '';
|
||
el.appendChild(img);
|
||
});
|
||
},
|
||
resetPreview: function resetPreview() {
|
||
forEach(this.previews, function (element) {
|
||
var data = getData(element, DATA_PREVIEW);
|
||
setStyle(element, {
|
||
width: data.width,
|
||
height: data.height
|
||
});
|
||
element.innerHTML = data.html;
|
||
removeData(element, DATA_PREVIEW);
|
||
});
|
||
},
|
||
preview: function preview() {
|
||
var imageData = this.imageData,
|
||
canvasData = this.canvasData,
|
||
cropBoxData = this.cropBoxData;
|
||
var cropBoxWidth = cropBoxData.width,
|
||
cropBoxHeight = cropBoxData.height;
|
||
var width = imageData.width,
|
||
height = imageData.height;
|
||
var left = cropBoxData.left - canvasData.left - imageData.left;
|
||
var top = cropBoxData.top - canvasData.top - imageData.top;
|
||
|
||
if (!this.cropped || this.disabled) {
|
||
return;
|
||
}
|
||
|
||
setStyle(this.viewBoxImage, assign({
|
||
width: width,
|
||
height: height
|
||
}, getTransforms(assign({
|
||
translateX: -left,
|
||
translateY: -top
|
||
}, imageData))));
|
||
forEach(this.previews, function (element) {
|
||
var data = getData(element, DATA_PREVIEW);
|
||
var originalWidth = data.width;
|
||
var originalHeight = data.height;
|
||
var newWidth = originalWidth;
|
||
var newHeight = originalHeight;
|
||
var ratio = 1;
|
||
|
||
if (cropBoxWidth) {
|
||
ratio = originalWidth / cropBoxWidth;
|
||
newHeight = cropBoxHeight * ratio;
|
||
}
|
||
|
||
if (cropBoxHeight && newHeight > originalHeight) {
|
||
ratio = originalHeight / cropBoxHeight;
|
||
newWidth = cropBoxWidth * ratio;
|
||
newHeight = originalHeight;
|
||
}
|
||
|
||
setStyle(element, {
|
||
width: newWidth,
|
||
height: newHeight
|
||
});
|
||
setStyle(element.getElementsByTagName('img')[0], assign({
|
||
width: width * ratio,
|
||
height: height * ratio
|
||
}, getTransforms(assign({
|
||
translateX: -left * ratio,
|
||
translateY: -top * ratio
|
||
}, imageData))));
|
||
});
|
||
}
|
||
};
|
||
|
||
var events = {
|
||
bind: function bind() {
|
||
var element = this.element,
|
||
options = this.options,
|
||
cropper = this.cropper;
|
||
|
||
if (isFunction(options.cropstart)) {
|
||
addListener(element, EVENT_CROP_START, options.cropstart);
|
||
}
|
||
|
||
if (isFunction(options.cropmove)) {
|
||
addListener(element, EVENT_CROP_MOVE, options.cropmove);
|
||
}
|
||
|
||
if (isFunction(options.cropend)) {
|
||
addListener(element, EVENT_CROP_END, options.cropend);
|
||
}
|
||
|
||
if (isFunction(options.crop)) {
|
||
addListener(element, EVENT_CROP, options.crop);
|
||
}
|
||
|
||
if (isFunction(options.zoom)) {
|
||
addListener(element, EVENT_ZOOM, options.zoom);
|
||
}
|
||
|
||
addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));
|
||
|
||
if (options.zoomable && options.zoomOnWheel) {
|
||
addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
|
||
passive: false,
|
||
capture: true
|
||
});
|
||
}
|
||
|
||
if (options.toggleDragModeOnDblclick) {
|
||
addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
|
||
}
|
||
|
||
addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));
|
||
addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));
|
||
|
||
if (options.responsive) {
|
||
addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));
|
||
}
|
||
},
|
||
unbind: function unbind() {
|
||
var element = this.element,
|
||
options = this.options,
|
||
cropper = this.cropper;
|
||
|
||
if (isFunction(options.cropstart)) {
|
||
removeListener(element, EVENT_CROP_START, options.cropstart);
|
||
}
|
||
|
||
if (isFunction(options.cropmove)) {
|
||
removeListener(element, EVENT_CROP_MOVE, options.cropmove);
|
||
}
|
||
|
||
if (isFunction(options.cropend)) {
|
||
removeListener(element, EVENT_CROP_END, options.cropend);
|
||
}
|
||
|
||
if (isFunction(options.crop)) {
|
||
removeListener(element, EVENT_CROP, options.crop);
|
||
}
|
||
|
||
if (isFunction(options.zoom)) {
|
||
removeListener(element, EVENT_ZOOM, options.zoom);
|
||
}
|
||
|
||
removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
|
||
|
||
if (options.zoomable && options.zoomOnWheel) {
|
||
removeListener(cropper, EVENT_WHEEL, this.onWheel, {
|
||
passive: false,
|
||
capture: true
|
||
});
|
||
}
|
||
|
||
if (options.toggleDragModeOnDblclick) {
|
||
removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
|
||
}
|
||
|
||
removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
|
||
removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
|
||
|
||
if (options.responsive) {
|
||
removeListener(window, EVENT_RESIZE, this.onResize);
|
||
}
|
||
}
|
||
};
|
||
|
||
var handlers = {
|
||
resize: function resize() {
|
||
var options = this.options,
|
||
container = this.container,
|
||
containerData = this.containerData;
|
||
var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;
|
||
var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;
|
||
|
||
if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
|
||
return;
|
||
}
|
||
|
||
var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed
|
||
|
||
if (ratio !== 1 || container.offsetHeight !== containerData.height) {
|
||
var canvasData;
|
||
var cropBoxData;
|
||
|
||
if (options.restore) {
|
||
canvasData = this.getCanvasData();
|
||
cropBoxData = this.getCropBoxData();
|
||
}
|
||
|
||
this.render();
|
||
|
||
if (options.restore) {
|
||
this.setCanvasData(forEach(canvasData, function (n, i) {
|
||
canvasData[i] = n * ratio;
|
||
}));
|
||
this.setCropBoxData(forEach(cropBoxData, function (n, i) {
|
||
cropBoxData[i] = n * ratio;
|
||
}));
|
||
}
|
||
}
|
||
},
|
||
dblclick: function dblclick() {
|
||
if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
|
||
return;
|
||
}
|
||
|
||
this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
|
||
},
|
||
wheel: function wheel(event) {
|
||
var _this = this;
|
||
|
||
var ratio = Number(this.options.wheelZoomRatio) || 0.1;
|
||
var delta = 1;
|
||
|
||
if (this.disabled) {
|
||
return;
|
||
}
|
||
|
||
event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)
|
||
|
||
if (this.wheeling) {
|
||
return;
|
||
}
|
||
|
||
this.wheeling = true;
|
||
setTimeout(function () {
|
||
_this.wheeling = false;
|
||
}, 50);
|
||
|
||
if (event.deltaY) {
|
||
delta = event.deltaY > 0 ? 1 : -1;
|
||
} else if (event.wheelDelta) {
|
||
delta = -event.wheelDelta / 120;
|
||
} else if (event.detail) {
|
||
delta = event.detail > 0 ? 1 : -1;
|
||
}
|
||
|
||
this.zoom(-delta * ratio, event);
|
||
},
|
||
cropStart: function cropStart(event) {
|
||
var buttons = event.buttons,
|
||
button = event.button;
|
||
|
||
if (this.disabled // No primary button (Usually the left button)
|
||
// Note that touch events have no `buttons` or `button` property
|
||
|| isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu
|
||
|| event.ctrlKey) {
|
||
return;
|
||
}
|
||
|
||
var options = this.options,
|
||
pointers = this.pointers;
|
||
var action;
|
||
|
||
if (event.changedTouches) {
|
||
// Handle touch event
|
||
forEach(event.changedTouches, function (touch) {
|
||
pointers[touch.identifier] = getPointer(touch);
|
||
});
|
||
} else {
|
||
// Handle mouse event and pointer event
|
||
pointers[event.pointerId || 0] = getPointer(event);
|
||
}
|
||
|
||
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
|
||
action = ACTION_ZOOM;
|
||
} else {
|
||
action = getData(event.target, DATA_ACTION);
|
||
}
|
||
|
||
if (!REGEXP_ACTIONS.test(action)) {
|
||
return;
|
||
}
|
||
|
||
if (dispatchEvent(this.element, EVENT_CROP_START, {
|
||
originalEvent: event,
|
||
action: action
|
||
}) === false) {
|
||
return;
|
||
} // This line is required for preventing page zooming in iOS browsers
|
||
|
||
|
||
event.preventDefault();
|
||
this.action = action;
|
||
this.cropping = false;
|
||
|
||
if (action === ACTION_CROP) {
|
||
this.cropping = true;
|
||
addClass(this.dragBox, CLASS_MODAL);
|
||
}
|
||
},
|
||
cropMove: function cropMove(event) {
|
||
var action = this.action;
|
||
|
||
if (this.disabled || !action) {
|
||
return;
|
||
}
|
||
|
||
var pointers = this.pointers;
|
||
event.preventDefault();
|
||
|
||
if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
|
||
originalEvent: event,
|
||
action: action
|
||
}) === false) {
|
||
return;
|
||
}
|
||
|
||
if (event.changedTouches) {
|
||
forEach(event.changedTouches, function (touch) {
|
||
// The first parameter should not be undefined (#432)
|
||
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
|
||
});
|
||
} else {
|
||
assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));
|
||
}
|
||
|
||
this.change(event);
|
||
},
|
||
cropEnd: function cropEnd(event) {
|
||
if (this.disabled) {
|
||
return;
|
||
}
|
||
|
||
var action = this.action,
|
||
pointers = this.pointers;
|
||
|
||
if (event.changedTouches) {
|
||
forEach(event.changedTouches, function (touch) {
|
||
delete pointers[touch.identifier];
|
||
});
|
||
} else {
|
||
delete pointers[event.pointerId || 0];
|
||
}
|
||
|
||
if (!action) {
|
||
return;
|
||
}
|
||
|
||
event.preventDefault();
|
||
|
||
if (!Object.keys(pointers).length) {
|
||
this.action = '';
|
||
}
|
||
|
||
if (this.cropping) {
|
||
this.cropping = false;
|
||
toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
|
||
}
|
||
|
||
dispatchEvent(this.element, EVENT_CROP_END, {
|
||
originalEvent: event,
|
||
action: action
|
||
});
|
||
}
|
||
};
|
||
|
||
var change = {
|
||
change: function change(event) {
|
||
var options = this.options,
|
||
canvasData = this.canvasData,
|
||
containerData = this.containerData,
|
||
cropBoxData = this.cropBoxData,
|
||
pointers = this.pointers;
|
||
var action = this.action;
|
||
var aspectRatio = options.aspectRatio;
|
||
var left = cropBoxData.left,
|
||
top = cropBoxData.top,
|
||
width = cropBoxData.width,
|
||
height = cropBoxData.height;
|
||
var right = left + width;
|
||
var bottom = top + height;
|
||
var minLeft = 0;
|
||
var minTop = 0;
|
||
var maxWidth = containerData.width;
|
||
var maxHeight = containerData.height;
|
||
var renderable = true;
|
||
var offset; // Locking aspect ratio in "free mode" by holding shift key
|
||
|
||
if (!aspectRatio && event.shiftKey) {
|
||
aspectRatio = width && height ? width / height : 1;
|
||
}
|
||
|
||
if (this.limited) {
|
||
minLeft = cropBoxData.minLeft;
|
||
minTop = cropBoxData.minTop;
|
||
maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
|
||
maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
|
||
}
|
||
|
||
var pointer = pointers[Object.keys(pointers)[0]];
|
||
var range = {
|
||
x: pointer.endX - pointer.startX,
|
||
y: pointer.endY - pointer.startY
|
||
};
|
||
|
||
var check = function check(side) {
|
||
switch (side) {
|
||
case ACTION_EAST:
|
||
if (right + range.x > maxWidth) {
|
||
range.x = maxWidth - right;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_WEST:
|
||
if (left + range.x < minLeft) {
|
||
range.x = minLeft - left;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_NORTH:
|
||
if (top + range.y < minTop) {
|
||
range.y = minTop - top;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_SOUTH:
|
||
if (bottom + range.y > maxHeight) {
|
||
range.y = maxHeight - bottom;
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
}
|
||
};
|
||
|
||
switch (action) {
|
||
// Move crop box
|
||
case ACTION_ALL:
|
||
left += range.x;
|
||
top += range.y;
|
||
break;
|
||
// Resize crop box
|
||
|
||
case ACTION_EAST:
|
||
if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_EAST);
|
||
width += range.x;
|
||
|
||
if (width < 0) {
|
||
action = ACTION_WEST;
|
||
width = -width;
|
||
left -= width;
|
||
}
|
||
|
||
if (aspectRatio) {
|
||
height = width / aspectRatio;
|
||
top += (cropBoxData.height - height) / 2;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_NORTH:
|
||
if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_NORTH);
|
||
height -= range.y;
|
||
top += range.y;
|
||
|
||
if (height < 0) {
|
||
action = ACTION_SOUTH;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
if (aspectRatio) {
|
||
width = height * aspectRatio;
|
||
left += (cropBoxData.width - width) / 2;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_WEST:
|
||
if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_WEST);
|
||
width -= range.x;
|
||
left += range.x;
|
||
|
||
if (width < 0) {
|
||
action = ACTION_EAST;
|
||
width = -width;
|
||
left -= width;
|
||
}
|
||
|
||
if (aspectRatio) {
|
||
height = width / aspectRatio;
|
||
top += (cropBoxData.height - height) / 2;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_SOUTH:
|
||
if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_SOUTH);
|
||
height += range.y;
|
||
|
||
if (height < 0) {
|
||
action = ACTION_NORTH;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
if (aspectRatio) {
|
||
width = height * aspectRatio;
|
||
left += (cropBoxData.width - width) / 2;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_NORTH_EAST:
|
||
if (aspectRatio) {
|
||
if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_NORTH);
|
||
height -= range.y;
|
||
top += range.y;
|
||
width = height * aspectRatio;
|
||
} else {
|
||
check(ACTION_NORTH);
|
||
check(ACTION_EAST);
|
||
|
||
if (range.x >= 0) {
|
||
if (right < maxWidth) {
|
||
width += range.x;
|
||
} else if (range.y <= 0 && top <= minTop) {
|
||
renderable = false;
|
||
}
|
||
} else {
|
||
width += range.x;
|
||
}
|
||
|
||
if (range.y <= 0) {
|
||
if (top > minTop) {
|
||
height -= range.y;
|
||
top += range.y;
|
||
}
|
||
} else {
|
||
height -= range.y;
|
||
top += range.y;
|
||
}
|
||
}
|
||
|
||
if (width < 0 && height < 0) {
|
||
action = ACTION_SOUTH_WEST;
|
||
height = -height;
|
||
width = -width;
|
||
top -= height;
|
||
left -= width;
|
||
} else if (width < 0) {
|
||
action = ACTION_NORTH_WEST;
|
||
width = -width;
|
||
left -= width;
|
||
} else if (height < 0) {
|
||
action = ACTION_SOUTH_EAST;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_NORTH_WEST:
|
||
if (aspectRatio) {
|
||
if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_NORTH);
|
||
height -= range.y;
|
||
top += range.y;
|
||
width = height * aspectRatio;
|
||
left += cropBoxData.width - width;
|
||
} else {
|
||
check(ACTION_NORTH);
|
||
check(ACTION_WEST);
|
||
|
||
if (range.x <= 0) {
|
||
if (left > minLeft) {
|
||
width -= range.x;
|
||
left += range.x;
|
||
} else if (range.y <= 0 && top <= minTop) {
|
||
renderable = false;
|
||
}
|
||
} else {
|
||
width -= range.x;
|
||
left += range.x;
|
||
}
|
||
|
||
if (range.y <= 0) {
|
||
if (top > minTop) {
|
||
height -= range.y;
|
||
top += range.y;
|
||
}
|
||
} else {
|
||
height -= range.y;
|
||
top += range.y;
|
||
}
|
||
}
|
||
|
||
if (width < 0 && height < 0) {
|
||
action = ACTION_SOUTH_EAST;
|
||
height = -height;
|
||
width = -width;
|
||
top -= height;
|
||
left -= width;
|
||
} else if (width < 0) {
|
||
action = ACTION_NORTH_EAST;
|
||
width = -width;
|
||
left -= width;
|
||
} else if (height < 0) {
|
||
action = ACTION_SOUTH_WEST;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_SOUTH_WEST:
|
||
if (aspectRatio) {
|
||
if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_WEST);
|
||
width -= range.x;
|
||
left += range.x;
|
||
height = width / aspectRatio;
|
||
} else {
|
||
check(ACTION_SOUTH);
|
||
check(ACTION_WEST);
|
||
|
||
if (range.x <= 0) {
|
||
if (left > minLeft) {
|
||
width -= range.x;
|
||
left += range.x;
|
||
} else if (range.y >= 0 && bottom >= maxHeight) {
|
||
renderable = false;
|
||
}
|
||
} else {
|
||
width -= range.x;
|
||
left += range.x;
|
||
}
|
||
|
||
if (range.y >= 0) {
|
||
if (bottom < maxHeight) {
|
||
height += range.y;
|
||
}
|
||
} else {
|
||
height += range.y;
|
||
}
|
||
}
|
||
|
||
if (width < 0 && height < 0) {
|
||
action = ACTION_NORTH_EAST;
|
||
height = -height;
|
||
width = -width;
|
||
top -= height;
|
||
left -= width;
|
||
} else if (width < 0) {
|
||
action = ACTION_SOUTH_EAST;
|
||
width = -width;
|
||
left -= width;
|
||
} else if (height < 0) {
|
||
action = ACTION_NORTH_WEST;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
break;
|
||
|
||
case ACTION_SOUTH_EAST:
|
||
if (aspectRatio) {
|
||
if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
check(ACTION_EAST);
|
||
width += range.x;
|
||
height = width / aspectRatio;
|
||
} else {
|
||
check(ACTION_SOUTH);
|
||
check(ACTION_EAST);
|
||
|
||
if (range.x >= 0) {
|
||
if (right < maxWidth) {
|
||
width += range.x;
|
||
} else if (range.y >= 0 && bottom >= maxHeight) {
|
||
renderable = false;
|
||
}
|
||
} else {
|
||
width += range.x;
|
||
}
|
||
|
||
if (range.y >= 0) {
|
||
if (bottom < maxHeight) {
|
||
height += range.y;
|
||
}
|
||
} else {
|
||
height += range.y;
|
||
}
|
||
}
|
||
|
||
if (width < 0 && height < 0) {
|
||
action = ACTION_NORTH_WEST;
|
||
height = -height;
|
||
width = -width;
|
||
top -= height;
|
||
left -= width;
|
||
} else if (width < 0) {
|
||
action = ACTION_SOUTH_WEST;
|
||
width = -width;
|
||
left -= width;
|
||
} else if (height < 0) {
|
||
action = ACTION_NORTH_EAST;
|
||
height = -height;
|
||
top -= height;
|
||
}
|
||
|
||
break;
|
||
// Move canvas
|
||
|
||
case ACTION_MOVE:
|
||
this.move(range.x, range.y);
|
||
renderable = false;
|
||
break;
|
||
// Zoom canvas
|
||
|
||
case ACTION_ZOOM:
|
||
this.zoom(getMaxZoomRatio(pointers), event);
|
||
renderable = false;
|
||
break;
|
||
// Create crop box
|
||
|
||
case ACTION_CROP:
|
||
if (!range.x || !range.y) {
|
||
renderable = false;
|
||
break;
|
||
}
|
||
|
||
offset = getOffset(this.cropper);
|
||
left = pointer.startX - offset.left;
|
||
top = pointer.startY - offset.top;
|
||
width = cropBoxData.minWidth;
|
||
height = cropBoxData.minHeight;
|
||
|
||
if (range.x > 0) {
|
||
action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
|
||
} else if (range.x < 0) {
|
||
left -= width;
|
||
action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
|
||
}
|
||
|
||
if (range.y < 0) {
|
||
top -= height;
|
||
} // Show the crop box if is hidden
|
||
|
||
|
||
if (!this.cropped) {
|
||
removeClass(this.cropBox, CLASS_HIDDEN);
|
||
this.cropped = true;
|
||
|
||
if (this.limited) {
|
||
this.limitCropBox(true, true);
|
||
}
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
}
|
||
|
||
if (renderable) {
|
||
cropBoxData.width = width;
|
||
cropBoxData.height = height;
|
||
cropBoxData.left = left;
|
||
cropBoxData.top = top;
|
||
this.action = action;
|
||
this.renderCropBox();
|
||
} // Override
|
||
|
||
|
||
forEach(pointers, function (p) {
|
||
p.startX = p.endX;
|
||
p.startY = p.endY;
|
||
});
|
||
}
|
||
};
|
||
|
||
var methods = {
|
||
// Show the crop box manually
|
||
crop: function crop() {
|
||
if (this.ready && !this.cropped && !this.disabled) {
|
||
this.cropped = true;
|
||
this.limitCropBox(true, true);
|
||
|
||
if (this.options.modal) {
|
||
addClass(this.dragBox, CLASS_MODAL);
|
||
}
|
||
|
||
removeClass(this.cropBox, CLASS_HIDDEN);
|
||
this.setCropBoxData(this.initialCropBoxData);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
// Reset the image and crop box to their initial states
|
||
reset: function reset() {
|
||
if (this.ready && !this.disabled) {
|
||
this.imageData = assign({}, this.initialImageData);
|
||
this.canvasData = assign({}, this.initialCanvasData);
|
||
this.cropBoxData = assign({}, this.initialCropBoxData);
|
||
this.renderCanvas();
|
||
|
||
if (this.cropped) {
|
||
this.renderCropBox();
|
||
}
|
||
}
|
||
|
||
return this;
|
||
},
|
||
// Clear the crop box
|
||
clear: function clear() {
|
||
if (this.cropped && !this.disabled) {
|
||
assign(this.cropBoxData, {
|
||
left: 0,
|
||
top: 0,
|
||
width: 0,
|
||
height: 0
|
||
});
|
||
this.cropped = false;
|
||
this.renderCropBox();
|
||
this.limitCanvas(true, true); // Render canvas after crop box rendered
|
||
|
||
this.renderCanvas();
|
||
removeClass(this.dragBox, CLASS_MODAL);
|
||
addClass(this.cropBox, CLASS_HIDDEN);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Replace the image's src and rebuild the cropper
|
||
* @param {string} url - The new URL.
|
||
* @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.
|
||
* @returns {Cropper} this
|
||
*/
|
||
replace: function replace(url) {
|
||
var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
|
||
if (!this.disabled && url) {
|
||
if (this.isImg) {
|
||
this.element.src = url;
|
||
}
|
||
|
||
if (hasSameSize) {
|
||
this.url = url;
|
||
this.image.src = url;
|
||
|
||
if (this.ready) {
|
||
this.viewBoxImage.src = url;
|
||
forEach(this.previews, function (element) {
|
||
element.getElementsByTagName('img')[0].src = url;
|
||
});
|
||
}
|
||
} else {
|
||
if (this.isImg) {
|
||
this.replaced = true;
|
||
}
|
||
|
||
this.options.data = null;
|
||
this.uncreate();
|
||
this.load(url);
|
||
}
|
||
}
|
||
|
||
return this;
|
||
},
|
||
// Enable (unfreeze) the cropper
|
||
enable: function enable() {
|
||
if (this.ready && this.disabled) {
|
||
this.disabled = false;
|
||
removeClass(this.cropper, CLASS_DISABLED);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
// Disable (freeze) the cropper
|
||
disable: function disable() {
|
||
if (this.ready && !this.disabled) {
|
||
this.disabled = true;
|
||
addClass(this.cropper, CLASS_DISABLED);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Destroy the cropper and remove the instance from the image
|
||
* @returns {Cropper} this
|
||
*/
|
||
destroy: function destroy() {
|
||
var element = this.element;
|
||
|
||
if (!element[NAMESPACE]) {
|
||
return this;
|
||
}
|
||
|
||
element[NAMESPACE] = undefined;
|
||
|
||
if (this.isImg && this.replaced) {
|
||
element.src = this.originalUrl;
|
||
}
|
||
|
||
this.uncreate();
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Move the canvas with relative offsets
|
||
* @param {number} offsetX - The relative offset distance on the x-axis.
|
||
* @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.
|
||
* @returns {Cropper} this
|
||
*/
|
||
move: function move(offsetX) {
|
||
var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX;
|
||
var _this$canvasData = this.canvasData,
|
||
left = _this$canvasData.left,
|
||
top = _this$canvasData.top;
|
||
return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
|
||
},
|
||
|
||
/**
|
||
* Move the canvas to an absolute point
|
||
* @param {number} x - The x-axis coordinate.
|
||
* @param {number} [y=x] - The y-axis coordinate.
|
||
* @returns {Cropper} this
|
||
*/
|
||
moveTo: function moveTo(x) {
|
||
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
|
||
var canvasData = this.canvasData;
|
||
var changed = false;
|
||
x = Number(x);
|
||
y = Number(y);
|
||
|
||
if (this.ready && !this.disabled && this.options.movable) {
|
||
if (isNumber(x)) {
|
||
canvasData.left = x;
|
||
changed = true;
|
||
}
|
||
|
||
if (isNumber(y)) {
|
||
canvasData.top = y;
|
||
changed = true;
|
||
}
|
||
|
||
if (changed) {
|
||
this.renderCanvas(true);
|
||
}
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Zoom the canvas with a relative ratio
|
||
* @param {number} ratio - The target ratio.
|
||
* @param {Event} _originalEvent - The original event if any.
|
||
* @returns {Cropper} this
|
||
*/
|
||
zoom: function zoom(ratio, _originalEvent) {
|
||
var canvasData = this.canvasData;
|
||
ratio = Number(ratio);
|
||
|
||
if (ratio < 0) {
|
||
ratio = 1 / (1 - ratio);
|
||
} else {
|
||
ratio = 1 + ratio;
|
||
}
|
||
|
||
return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
|
||
},
|
||
|
||
/**
|
||
* Zoom the canvas to an absolute ratio
|
||
* @param {number} ratio - The target ratio.
|
||
* @param {Object} pivot - The zoom pivot point coordinate.
|
||
* @param {Event} _originalEvent - The original event if any.
|
||
* @returns {Cropper} this
|
||
*/
|
||
zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
|
||
var options = this.options,
|
||
canvasData = this.canvasData;
|
||
var width = canvasData.width,
|
||
height = canvasData.height,
|
||
naturalWidth = canvasData.naturalWidth,
|
||
naturalHeight = canvasData.naturalHeight;
|
||
ratio = Number(ratio);
|
||
|
||
if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
|
||
var newWidth = naturalWidth * ratio;
|
||
var newHeight = naturalHeight * ratio;
|
||
|
||
if (dispatchEvent(this.element, EVENT_ZOOM, {
|
||
ratio: ratio,
|
||
oldRatio: width / naturalWidth,
|
||
originalEvent: _originalEvent
|
||
}) === false) {
|
||
return this;
|
||
}
|
||
|
||
if (_originalEvent) {
|
||
var pointers = this.pointers;
|
||
var offset = getOffset(this.cropper);
|
||
var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
|
||
pageX: _originalEvent.pageX,
|
||
pageY: _originalEvent.pageY
|
||
}; // Zoom from the triggering point of the event
|
||
|
||
canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
|
||
canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
|
||
} else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
|
||
canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
|
||
canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
|
||
} else {
|
||
// Zoom from the center of the canvas
|
||
canvasData.left -= (newWidth - width) / 2;
|
||
canvasData.top -= (newHeight - height) / 2;
|
||
}
|
||
|
||
canvasData.width = newWidth;
|
||
canvasData.height = newHeight;
|
||
this.renderCanvas(true);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Rotate the canvas with a relative degree
|
||
* @param {number} degree - The rotate degree.
|
||
* @returns {Cropper} this
|
||
*/
|
||
rotate: function rotate(degree) {
|
||
return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
|
||
},
|
||
|
||
/**
|
||
* Rotate the canvas to an absolute degree
|
||
* @param {number} degree - The rotate degree.
|
||
* @returns {Cropper} this
|
||
*/
|
||
rotateTo: function rotateTo(degree) {
|
||
degree = Number(degree);
|
||
|
||
if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
|
||
this.imageData.rotate = degree % 360;
|
||
this.renderCanvas(true, true);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Scale the image on the x-axis.
|
||
* @param {number} scaleX - The scale ratio on the x-axis.
|
||
* @returns {Cropper} this
|
||
*/
|
||
scaleX: function scaleX(_scaleX) {
|
||
var scaleY = this.imageData.scaleY;
|
||
return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
|
||
},
|
||
|
||
/**
|
||
* Scale the image on the y-axis.
|
||
* @param {number} scaleY - The scale ratio on the y-axis.
|
||
* @returns {Cropper} this
|
||
*/
|
||
scaleY: function scaleY(_scaleY) {
|
||
var scaleX = this.imageData.scaleX;
|
||
return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
|
||
},
|
||
|
||
/**
|
||
* Scale the image
|
||
* @param {number} scaleX - The scale ratio on the x-axis.
|
||
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
||
* @returns {Cropper} this
|
||
*/
|
||
scale: function scale(scaleX) {
|
||
var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
|
||
var imageData = this.imageData;
|
||
var transformed = false;
|
||
scaleX = Number(scaleX);
|
||
scaleY = Number(scaleY);
|
||
|
||
if (this.ready && !this.disabled && this.options.scalable) {
|
||
if (isNumber(scaleX)) {
|
||
imageData.scaleX = scaleX;
|
||
transformed = true;
|
||
}
|
||
|
||
if (isNumber(scaleY)) {
|
||
imageData.scaleY = scaleY;
|
||
transformed = true;
|
||
}
|
||
|
||
if (transformed) {
|
||
this.renderCanvas(true, true);
|
||
}
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Get the cropped area position and size data (base on the original image)
|
||
* @param {boolean} [rounded=false] - Indicate if round the data values or not.
|
||
* @returns {Object} The result cropped data.
|
||
*/
|
||
getData: function getData() {
|
||
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||
var options = this.options,
|
||
imageData = this.imageData,
|
||
canvasData = this.canvasData,
|
||
cropBoxData = this.cropBoxData;
|
||
var data;
|
||
|
||
if (this.ready && this.cropped) {
|
||
data = {
|
||
x: cropBoxData.left - canvasData.left,
|
||
y: cropBoxData.top - canvasData.top,
|
||
width: cropBoxData.width,
|
||
height: cropBoxData.height
|
||
};
|
||
var ratio = imageData.width / imageData.naturalWidth;
|
||
forEach(data, function (n, i) {
|
||
data[i] = n / ratio;
|
||
});
|
||
|
||
if (rounded) {
|
||
// In case rounding off leads to extra 1px in right or bottom border
|
||
// we should round the top-left corner and the dimension (#343).
|
||
var bottom = Math.round(data.y + data.height);
|
||
var right = Math.round(data.x + data.width);
|
||
data.x = Math.round(data.x);
|
||
data.y = Math.round(data.y);
|
||
data.width = right - data.x;
|
||
data.height = bottom - data.y;
|
||
}
|
||
} else {
|
||
data = {
|
||
x: 0,
|
||
y: 0,
|
||
width: 0,
|
||
height: 0
|
||
};
|
||
}
|
||
|
||
if (options.rotatable) {
|
||
data.rotate = imageData.rotate || 0;
|
||
}
|
||
|
||
if (options.scalable) {
|
||
data.scaleX = imageData.scaleX || 1;
|
||
data.scaleY = imageData.scaleY || 1;
|
||
}
|
||
|
||
return data;
|
||
},
|
||
|
||
/**
|
||
* Set the cropped area position and size with new data
|
||
* @param {Object} data - The new data.
|
||
* @returns {Cropper} this
|
||
*/
|
||
setData: function setData(data) {
|
||
var options = this.options,
|
||
imageData = this.imageData,
|
||
canvasData = this.canvasData;
|
||
var cropBoxData = {};
|
||
|
||
if (this.ready && !this.disabled && isPlainObject(data)) {
|
||
var transformed = false;
|
||
|
||
if (options.rotatable) {
|
||
if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
|
||
imageData.rotate = data.rotate;
|
||
transformed = true;
|
||
}
|
||
}
|
||
|
||
if (options.scalable) {
|
||
if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
|
||
imageData.scaleX = data.scaleX;
|
||
transformed = true;
|
||
}
|
||
|
||
if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
|
||
imageData.scaleY = data.scaleY;
|
||
transformed = true;
|
||
}
|
||
}
|
||
|
||
if (transformed) {
|
||
this.renderCanvas(true, true);
|
||
}
|
||
|
||
var ratio = imageData.width / imageData.naturalWidth;
|
||
|
||
if (isNumber(data.x)) {
|
||
cropBoxData.left = data.x * ratio + canvasData.left;
|
||
}
|
||
|
||
if (isNumber(data.y)) {
|
||
cropBoxData.top = data.y * ratio + canvasData.top;
|
||
}
|
||
|
||
if (isNumber(data.width)) {
|
||
cropBoxData.width = data.width * ratio;
|
||
}
|
||
|
||
if (isNumber(data.height)) {
|
||
cropBoxData.height = data.height * ratio;
|
||
}
|
||
|
||
this.setCropBoxData(cropBoxData);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Get the container size data.
|
||
* @returns {Object} The result container data.
|
||
*/
|
||
getContainerData: function getContainerData() {
|
||
return this.ready ? assign({}, this.containerData) : {};
|
||
},
|
||
|
||
/**
|
||
* Get the image position and size data.
|
||
* @returns {Object} The result image data.
|
||
*/
|
||
getImageData: function getImageData() {
|
||
return this.sized ? assign({}, this.imageData) : {};
|
||
},
|
||
|
||
/**
|
||
* Get the canvas position and size data.
|
||
* @returns {Object} The result canvas data.
|
||
*/
|
||
getCanvasData: function getCanvasData() {
|
||
var canvasData = this.canvasData;
|
||
var data = {};
|
||
|
||
if (this.ready) {
|
||
forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
|
||
data[n] = canvasData[n];
|
||
});
|
||
}
|
||
|
||
return data;
|
||
},
|
||
|
||
/**
|
||
* Set the canvas position and size with new data.
|
||
* @param {Object} data - The new canvas data.
|
||
* @returns {Cropper} this
|
||
*/
|
||
setCanvasData: function setCanvasData(data) {
|
||
var canvasData = this.canvasData;
|
||
var aspectRatio = canvasData.aspectRatio;
|
||
|
||
if (this.ready && !this.disabled && isPlainObject(data)) {
|
||
if (isNumber(data.left)) {
|
||
canvasData.left = data.left;
|
||
}
|
||
|
||
if (isNumber(data.top)) {
|
||
canvasData.top = data.top;
|
||
}
|
||
|
||
if (isNumber(data.width)) {
|
||
canvasData.width = data.width;
|
||
canvasData.height = data.width / aspectRatio;
|
||
} else if (isNumber(data.height)) {
|
||
canvasData.height = data.height;
|
||
canvasData.width = data.height * aspectRatio;
|
||
}
|
||
|
||
this.renderCanvas(true);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Get the crop box position and size data.
|
||
* @returns {Object} The result crop box data.
|
||
*/
|
||
getCropBoxData: function getCropBoxData() {
|
||
var cropBoxData = this.cropBoxData;
|
||
var data;
|
||
|
||
if (this.ready && this.cropped) {
|
||
data = {
|
||
left: cropBoxData.left,
|
||
top: cropBoxData.top,
|
||
width: cropBoxData.width,
|
||
height: cropBoxData.height
|
||
};
|
||
}
|
||
|
||
return data || {};
|
||
},
|
||
|
||
/**
|
||
* Set the crop box position and size with new data.
|
||
* @param {Object} data - The new crop box data.
|
||
* @returns {Cropper} this
|
||
*/
|
||
setCropBoxData: function setCropBoxData(data) {
|
||
var cropBoxData = this.cropBoxData;
|
||
var aspectRatio = this.options.aspectRatio;
|
||
var widthChanged;
|
||
var heightChanged;
|
||
|
||
if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
|
||
if (isNumber(data.left)) {
|
||
cropBoxData.left = data.left;
|
||
}
|
||
|
||
if (isNumber(data.top)) {
|
||
cropBoxData.top = data.top;
|
||
}
|
||
|
||
if (isNumber(data.width) && data.width !== cropBoxData.width) {
|
||
widthChanged = true;
|
||
cropBoxData.width = data.width;
|
||
}
|
||
|
||
if (isNumber(data.height) && data.height !== cropBoxData.height) {
|
||
heightChanged = true;
|
||
cropBoxData.height = data.height;
|
||
}
|
||
|
||
if (aspectRatio) {
|
||
if (widthChanged) {
|
||
cropBoxData.height = cropBoxData.width / aspectRatio;
|
||
} else if (heightChanged) {
|
||
cropBoxData.width = cropBoxData.height * aspectRatio;
|
||
}
|
||
}
|
||
|
||
this.renderCropBox();
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Get a canvas drawn the cropped image.
|
||
* @param {Object} [options={}] - The config options.
|
||
* @returns {HTMLCanvasElement} - The result canvas.
|
||
*/
|
||
getCroppedCanvas: function getCroppedCanvas() {
|
||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
if (!this.ready || !window.HTMLCanvasElement) {
|
||
return null;
|
||
}
|
||
|
||
var canvasData = this.canvasData;
|
||
var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped.
|
||
|
||
if (!this.cropped) {
|
||
return source;
|
||
}
|
||
|
||
var _this$getData = this.getData(),
|
||
initialX = _this$getData.x,
|
||
initialY = _this$getData.y,
|
||
initialWidth = _this$getData.width,
|
||
initialHeight = _this$getData.height;
|
||
|
||
var ratio = source.width / Math.floor(canvasData.naturalWidth);
|
||
|
||
if (ratio !== 1) {
|
||
initialX *= ratio;
|
||
initialY *= ratio;
|
||
initialWidth *= ratio;
|
||
initialHeight *= ratio;
|
||
}
|
||
|
||
var aspectRatio = initialWidth / initialHeight;
|
||
var maxSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: options.maxWidth || Infinity,
|
||
height: options.maxHeight || Infinity
|
||
});
|
||
var minSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: options.minWidth || 0,
|
||
height: options.minHeight || 0
|
||
}, 'cover');
|
||
|
||
var _getAdjustedSizes = getAdjustedSizes({
|
||
aspectRatio: aspectRatio,
|
||
width: options.width || (ratio !== 1 ? source.width : initialWidth),
|
||
height: options.height || (ratio !== 1 ? source.height : initialHeight)
|
||
}),
|
||
width = _getAdjustedSizes.width,
|
||
height = _getAdjustedSizes.height;
|
||
|
||
width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
|
||
height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
|
||
var canvas = document.createElement('canvas');
|
||
var context = canvas.getContext('2d');
|
||
canvas.width = normalizeDecimalNumber(width);
|
||
canvas.height = normalizeDecimalNumber(height);
|
||
context.fillStyle = options.fillColor || 'transparent';
|
||
context.fillRect(0, 0, width, height);
|
||
var _options$imageSmoothi = options.imageSmoothingEnabled,
|
||
imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi,
|
||
imageSmoothingQuality = options.imageSmoothingQuality;
|
||
context.imageSmoothingEnabled = imageSmoothingEnabled;
|
||
|
||
if (imageSmoothingQuality) {
|
||
context.imageSmoothingQuality = imageSmoothingQuality;
|
||
} // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
|
||
|
||
|
||
var sourceWidth = source.width;
|
||
var sourceHeight = source.height; // Source canvas parameters
|
||
|
||
var srcX = initialX;
|
||
var srcY = initialY;
|
||
var srcWidth;
|
||
var srcHeight; // Destination canvas parameters
|
||
|
||
var dstX;
|
||
var dstY;
|
||
var dstWidth;
|
||
var dstHeight;
|
||
|
||
if (srcX <= -initialWidth || srcX > sourceWidth) {
|
||
srcX = 0;
|
||
srcWidth = 0;
|
||
dstX = 0;
|
||
dstWidth = 0;
|
||
} else if (srcX <= 0) {
|
||
dstX = -srcX;
|
||
srcX = 0;
|
||
srcWidth = Math.min(sourceWidth, initialWidth + srcX);
|
||
dstWidth = srcWidth;
|
||
} else if (srcX <= sourceWidth) {
|
||
dstX = 0;
|
||
srcWidth = Math.min(initialWidth, sourceWidth - srcX);
|
||
dstWidth = srcWidth;
|
||
}
|
||
|
||
if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
|
||
srcY = 0;
|
||
srcHeight = 0;
|
||
dstY = 0;
|
||
dstHeight = 0;
|
||
} else if (srcY <= 0) {
|
||
dstY = -srcY;
|
||
srcY = 0;
|
||
srcHeight = Math.min(sourceHeight, initialHeight + srcY);
|
||
dstHeight = srcHeight;
|
||
} else if (srcY <= sourceHeight) {
|
||
dstY = 0;
|
||
srcHeight = Math.min(initialHeight, sourceHeight - srcY);
|
||
dstHeight = srcHeight;
|
||
}
|
||
|
||
var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError"
|
||
|
||
if (dstWidth > 0 && dstHeight > 0) {
|
||
var scale = width / initialWidth;
|
||
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
|
||
} // All the numerical parameters should be integer for `drawImage`
|
||
// https://github.com/fengyuanchen/cropper/issues/476
|
||
|
||
|
||
context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) {
|
||
return Math.floor(normalizeDecimalNumber(param));
|
||
}))));
|
||
return canvas;
|
||
},
|
||
|
||
/**
|
||
* Change the aspect ratio of the crop box.
|
||
* @param {number} aspectRatio - The new aspect ratio.
|
||
* @returns {Cropper} this
|
||
*/
|
||
setAspectRatio: function setAspectRatio(aspectRatio) {
|
||
var options = this.options;
|
||
|
||
if (!this.disabled && !isUndefined(aspectRatio)) {
|
||
// 0 -> NaN
|
||
options.aspectRatio = Math.max(0, aspectRatio) || NaN;
|
||
|
||
if (this.ready) {
|
||
this.initCropBox();
|
||
|
||
if (this.cropped) {
|
||
this.renderCropBox();
|
||
}
|
||
}
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
/**
|
||
* Change the drag mode.
|
||
* @param {string} mode - The new drag mode.
|
||
* @returns {Cropper} this
|
||
*/
|
||
setDragMode: function setDragMode(mode) {
|
||
var options = this.options,
|
||
dragBox = this.dragBox,
|
||
face = this.face;
|
||
|
||
if (this.ready && !this.disabled) {
|
||
var croppable = mode === DRAG_MODE_CROP;
|
||
var movable = options.movable && mode === DRAG_MODE_MOVE;
|
||
mode = croppable || movable ? mode : DRAG_MODE_NONE;
|
||
options.dragMode = mode;
|
||
setData(dragBox, DATA_ACTION, mode);
|
||
toggleClass(dragBox, CLASS_CROP, croppable);
|
||
toggleClass(dragBox, CLASS_MOVE, movable);
|
||
|
||
if (!options.cropBoxMovable) {
|
||
// Sync drag mode to crop box when it is not movable
|
||
setData(face, DATA_ACTION, mode);
|
||
toggleClass(face, CLASS_CROP, croppable);
|
||
toggleClass(face, CLASS_MOVE, movable);
|
||
}
|
||
}
|
||
|
||
return this;
|
||
}
|
||
};
|
||
|
||
var AnotherCropper = WINDOW.Cropper;
|
||
|
||
var Cropper =
|
||
/*#__PURE__*/
|
||
function () {
|
||
/**
|
||
* Create a new Cropper.
|
||
* @param {Element} element - The target element for cropping.
|
||
* @param {Object} [options={}] - The configuration options.
|
||
*/
|
||
function Cropper(element) {
|
||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
|
||
_classCallCheck(this, Cropper);
|
||
|
||
if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
|
||
throw new Error('The first argument is required and must be an <img> or <canvas> element.');
|
||
}
|
||
|
||
this.element = element;
|
||
this.options = assign({}, DEFAULTS, isPlainObject(options) && options);
|
||
this.cropped = false;
|
||
this.disabled = false;
|
||
this.pointers = {};
|
||
this.ready = false;
|
||
this.reloading = false;
|
||
this.replaced = false;
|
||
this.sized = false;
|
||
this.sizing = false;
|
||
this.init();
|
||
}
|
||
|
||
_createClass(Cropper, [{
|
||
key: "init",
|
||
value: function init() {
|
||
var element = this.element;
|
||
var tagName = element.tagName.toLowerCase();
|
||
var url;
|
||
|
||
if (element[NAMESPACE]) {
|
||
return;
|
||
}
|
||
|
||
element[NAMESPACE] = this;
|
||
|
||
if (tagName === 'img') {
|
||
this.isImg = true; // e.g.: "img/picture.jpg"
|
||
|
||
url = element.getAttribute('src') || '';
|
||
this.originalUrl = url; // Stop when it's a blank image
|
||
|
||
if (!url) {
|
||
return;
|
||
} // e.g.: "http://example.com/img/picture.jpg"
|
||
|
||
|
||
url = element.src;
|
||
} else if (tagName === 'canvas' && window.HTMLCanvasElement) {
|
||
url = element.toDataURL();
|
||
}
|
||
|
||
this.load(url);
|
||
}
|
||
}, {
|
||
key: "load",
|
||
value: function load(url) {
|
||
var _this = this;
|
||
|
||
if (!url) {
|
||
return;
|
||
}
|
||
|
||
this.url = url;
|
||
this.imageData = {};
|
||
var element = this.element,
|
||
options = this.options;
|
||
|
||
if (!options.rotatable && !options.scalable) {
|
||
options.checkOrientation = false;
|
||
} // Only IE10+ supports Typed Arrays
|
||
|
||
|
||
if (!options.checkOrientation || !window.ArrayBuffer) {
|
||
this.clone();
|
||
return;
|
||
} // Read ArrayBuffer from Data URL of JPEG images directly for better performance.
|
||
|
||
|
||
if (REGEXP_DATA_URL_JPEG.test(url)) {
|
||
this.read(dataURLToArrayBuffer(url));
|
||
return;
|
||
}
|
||
|
||
var xhr = new XMLHttpRequest();
|
||
var clone = this.clone.bind(this);
|
||
this.reloading = true;
|
||
this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:
|
||
// http, https, data, chrome, chrome-extension.
|
||
// 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy
|
||
// in some browsers as IE11 and Safari.
|
||
|
||
xhr.onabort = clone;
|
||
xhr.onerror = clone;
|
||
xhr.ontimeout = clone;
|
||
|
||
xhr.onprogress = function () {
|
||
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
|
||
xhr.abort();
|
||
}
|
||
};
|
||
|
||
xhr.onload = function () {
|
||
_this.read(xhr.response);
|
||
};
|
||
|
||
xhr.onloadend = function () {
|
||
_this.reloading = false;
|
||
_this.xhr = null;
|
||
}; // Bust cache when there is a "crossOrigin" property to avoid browser cache error
|
||
|
||
|
||
if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
|
||
url = addTimestamp(url);
|
||
}
|
||
|
||
xhr.open('GET', url);
|
||
xhr.responseType = 'arraybuffer';
|
||
xhr.withCredentials = element.crossOrigin === 'use-credentials';
|
||
xhr.send();
|
||
}
|
||
}, {
|
||
key: "read",
|
||
value: function read(arrayBuffer) {
|
||
var options = this.options,
|
||
imageData = this.imageData; // Reset the orientation value to its default value 1
|
||
// as some iOS browsers will render image with its orientation
|
||
|
||
var orientation = resetAndGetOrientation(arrayBuffer);
|
||
var rotate = 0;
|
||
var scaleX = 1;
|
||
var scaleY = 1;
|
||
|
||
if (orientation > 1) {
|
||
// Generate a new URL which has the default orientation value
|
||
this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);
|
||
|
||
var _parseOrientation = parseOrientation(orientation);
|
||
|
||
rotate = _parseOrientation.rotate;
|
||
scaleX = _parseOrientation.scaleX;
|
||
scaleY = _parseOrientation.scaleY;
|
||
}
|
||
|
||
if (options.rotatable) {
|
||
imageData.rotate = rotate;
|
||
}
|
||
|
||
if (options.scalable) {
|
||
imageData.scaleX = scaleX;
|
||
imageData.scaleY = scaleY;
|
||
}
|
||
|
||
this.clone();
|
||
}
|
||
}, {
|
||
key: "clone",
|
||
value: function clone() {
|
||
var element = this.element,
|
||
url = this.url;
|
||
var crossOrigin;
|
||
var crossOriginUrl;
|
||
|
||
if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
|
||
crossOrigin = element.crossOrigin;
|
||
|
||
if (crossOrigin) {
|
||
crossOriginUrl = url;
|
||
} else {
|
||
crossOrigin = 'anonymous'; // Bust cache when there is not a "crossOrigin" property
|
||
|
||
crossOriginUrl = addTimestamp(url);
|
||
}
|
||
}
|
||
|
||
this.crossOrigin = crossOrigin;
|
||
this.crossOriginUrl = crossOriginUrl;
|
||
var image = document.createElement('img');
|
||
|
||
if (crossOrigin) {
|
||
image.crossOrigin = crossOrigin;
|
||
}
|
||
|
||
image.src = crossOriginUrl || url;
|
||
this.image = image;
|
||
image.onload = this.start.bind(this);
|
||
image.onerror = this.stop.bind(this);
|
||
addClass(image, CLASS_HIDE);
|
||
element.parentNode.insertBefore(image, element.nextSibling);
|
||
}
|
||
}, {
|
||
key: "start",
|
||
value: function start() {
|
||
var _this2 = this;
|
||
|
||
var image = this.isImg ? this.element : this.image;
|
||
image.onload = null;
|
||
image.onerror = null;
|
||
this.sizing = true;
|
||
var IS_SAFARI = WINDOW.navigator && /^(?:.(?!chrome|android))*safari/i.test(WINDOW.navigator.userAgent);
|
||
|
||
var done = function done(naturalWidth, naturalHeight) {
|
||
assign(_this2.imageData, {
|
||
naturalWidth: naturalWidth,
|
||
naturalHeight: naturalHeight,
|
||
aspectRatio: naturalWidth / naturalHeight
|
||
});
|
||
_this2.sizing = false;
|
||
_this2.sized = true;
|
||
|
||
_this2.build();
|
||
}; // Modern browsers (except Safari)
|
||
|
||
|
||
if (image.naturalWidth && !IS_SAFARI) {
|
||
done(image.naturalWidth, image.naturalHeight);
|
||
return;
|
||
}
|
||
|
||
var sizingImage = document.createElement('img');
|
||
var body = document.body || document.documentElement;
|
||
this.sizingImage = sizingImage;
|
||
|
||
sizingImage.onload = function () {
|
||
done(sizingImage.width, sizingImage.height);
|
||
|
||
if (!IS_SAFARI) {
|
||
body.removeChild(sizingImage);
|
||
}
|
||
};
|
||
|
||
sizingImage.src = image.src; // iOS Safari will convert the image automatically
|
||
// with its orientation once append it into DOM (#279)
|
||
|
||
if (!IS_SAFARI) {
|
||
sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
|
||
body.appendChild(sizingImage);
|
||
}
|
||
}
|
||
}, {
|
||
key: "stop",
|
||
value: function stop() {
|
||
var image = this.image;
|
||
image.onload = null;
|
||
image.onerror = null;
|
||
image.parentNode.removeChild(image);
|
||
this.image = null;
|
||
}
|
||
}, {
|
||
key: "build",
|
||
value: function build() {
|
||
if (!this.sized || this.ready) {
|
||
return;
|
||
}
|
||
|
||
var element = this.element,
|
||
options = this.options,
|
||
image = this.image; // Create cropper elements
|
||
|
||
var container = element.parentNode;
|
||
var template = document.createElement('div');
|
||
template.innerHTML = TEMPLATE;
|
||
var cropper = template.querySelector(".".concat(NAMESPACE, "-container"));
|
||
var canvas = cropper.querySelector(".".concat(NAMESPACE, "-canvas"));
|
||
var dragBox = cropper.querySelector(".".concat(NAMESPACE, "-drag-box"));
|
||
var cropBox = cropper.querySelector(".".concat(NAMESPACE, "-crop-box"));
|
||
var face = cropBox.querySelector(".".concat(NAMESPACE, "-face"));
|
||
this.container = container;
|
||
this.cropper = cropper;
|
||
this.canvas = canvas;
|
||
this.dragBox = dragBox;
|
||
this.cropBox = cropBox;
|
||
this.viewBox = cropper.querySelector(".".concat(NAMESPACE, "-view-box"));
|
||
this.face = face;
|
||
canvas.appendChild(image); // Hide the original image
|
||
|
||
addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image
|
||
|
||
container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden
|
||
|
||
if (!this.isImg) {
|
||
removeClass(image, CLASS_HIDE);
|
||
}
|
||
|
||
this.initPreview();
|
||
this.bind();
|
||
options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN;
|
||
options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
|
||
options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
|
||
addClass(cropBox, CLASS_HIDDEN);
|
||
|
||
if (!options.guides) {
|
||
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-dashed")), CLASS_HIDDEN);
|
||
}
|
||
|
||
if (!options.center) {
|
||
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-center")), CLASS_HIDDEN);
|
||
}
|
||
|
||
if (options.background) {
|
||
addClass(cropper, "".concat(NAMESPACE, "-bg"));
|
||
}
|
||
|
||
if (!options.highlight) {
|
||
addClass(face, CLASS_INVISIBLE);
|
||
}
|
||
|
||
if (options.cropBoxMovable) {
|
||
addClass(face, CLASS_MOVE);
|
||
setData(face, DATA_ACTION, ACTION_ALL);
|
||
}
|
||
|
||
if (!options.cropBoxResizable) {
|
||
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-line")), CLASS_HIDDEN);
|
||
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-point")), CLASS_HIDDEN);
|
||
}
|
||
|
||
this.render();
|
||
this.ready = true;
|
||
this.setDragMode(options.dragMode);
|
||
|
||
if (options.autoCrop) {
|
||
this.crop();
|
||
}
|
||
|
||
this.setData(options.data);
|
||
|
||
if (isFunction(options.ready)) {
|
||
addListener(element, EVENT_READY, options.ready, {
|
||
once: true
|
||
});
|
||
}
|
||
|
||
dispatchEvent(element, EVENT_READY);
|
||
}
|
||
}, {
|
||
key: "unbuild",
|
||
value: function unbuild() {
|
||
if (!this.ready) {
|
||
return;
|
||
}
|
||
|
||
this.ready = false;
|
||
this.unbind();
|
||
this.resetPreview();
|
||
this.cropper.parentNode.removeChild(this.cropper);
|
||
removeClass(this.element, CLASS_HIDDEN);
|
||
}
|
||
}, {
|
||
key: "uncreate",
|
||
value: function uncreate() {
|
||
if (this.ready) {
|
||
this.unbuild();
|
||
this.ready = false;
|
||
this.cropped = false;
|
||
} else if (this.sizing) {
|
||
this.sizingImage.onload = null;
|
||
this.sizing = false;
|
||
this.sized = false;
|
||
} else if (this.reloading) {
|
||
this.xhr.onabort = null;
|
||
this.xhr.abort();
|
||
} else if (this.image) {
|
||
this.stop();
|
||
}
|
||
}
|
||
/**
|
||
* Get the no conflict cropper class.
|
||
* @returns {Cropper} The cropper class.
|
||
*/
|
||
|
||
}], [{
|
||
key: "noConflict",
|
||
value: function noConflict() {
|
||
window.Cropper = AnotherCropper;
|
||
return Cropper;
|
||
}
|
||
/**
|
||
* Change the default options.
|
||
* @param {Object} options - The new default options.
|
||
*/
|
||
|
||
}, {
|
||
key: "setDefaults",
|
||
value: function setDefaults(options) {
|
||
assign(DEFAULTS, isPlainObject(options) && options);
|
||
}
|
||
}]);
|
||
|
||
return Cropper;
|
||
}();
|
||
|
||
assign(Cropper.prototype, render, preview, events, handlers, change, methods);
|
||
|
||
return Cropper;
|
||
|
||
}));
|
||
|
||
/*!
|
||
* Name: vue-upload-component
|
||
* Version: 2.8.20
|
||
* Author: LianYue
|
||
*/
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||
typeof define === 'function' && define.amd ? define(factory) :
|
||
(global.VueUploadComponent = factory());
|
||
}(this, (function () { 'use strict';
|
||
|
||
/**
|
||
* Creates a XHR request
|
||
*
|
||
* @param {Object} options
|
||
*/
|
||
var createRequest = function createRequest(options) {
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.open(options.method || 'GET', options.url);
|
||
xhr.responseType = 'json';
|
||
if (options.headers) {
|
||
Object.keys(options.headers).forEach(function (key) {
|
||
xhr.setRequestHeader(key, options.headers[key]);
|
||
});
|
||
}
|
||
|
||
return xhr;
|
||
};
|
||
|
||
/**
|
||
* Sends a XHR request with certain body
|
||
*
|
||
* @param {XMLHttpRequest} xhr
|
||
* @param {Object} body
|
||
*/
|
||
var sendRequest = function sendRequest(xhr, body) {
|
||
return new Promise(function (resolve, reject) {
|
||
xhr.onload = function () {
|
||
if (xhr.status >= 200 && xhr.status < 300) {
|
||
var response;
|
||
try {
|
||
response = JSON.parse(xhr.response);
|
||
} catch (err) {
|
||
response = xhr.response;
|
||
}
|
||
resolve(response);
|
||
} else {
|
||
reject(xhr.response);
|
||
}
|
||
};
|
||
xhr.onerror = function () {
|
||
return reject(xhr.response);
|
||
};
|
||
xhr.send(JSON.stringify(body));
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Sends a XHR request with certain form data
|
||
*
|
||
* @param {XMLHttpRequest} xhr
|
||
* @param {Object} data
|
||
*/
|
||
var sendFormRequest = function sendFormRequest(xhr, data) {
|
||
var body = new FormData();
|
||
for (var name in data) {
|
||
body.append(name, data[name]);
|
||
}
|
||
|
||
return new Promise(function (resolve, reject) {
|
||
xhr.onload = function () {
|
||
if (xhr.status >= 200 && xhr.status < 300) {
|
||
var response;
|
||
try {
|
||
response = JSON.parse(xhr.response);
|
||
} catch (err) {
|
||
response = xhr.response;
|
||
}
|
||
resolve(response);
|
||
} else {
|
||
reject(xhr.response);
|
||
}
|
||
};
|
||
xhr.onerror = function () {
|
||
return reject(xhr.response);
|
||
};
|
||
xhr.send(body);
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Creates and sends XHR request
|
||
*
|
||
* @param {Object} options
|
||
*
|
||
* @returns Promise
|
||
*/
|
||
function request (options) {
|
||
var xhr = createRequest(options);
|
||
|
||
return sendRequest(xhr, options.body);
|
||
}
|
||
|
||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
var ChunkUploadHandler = function () {
|
||
/**
|
||
* Constructor
|
||
*
|
||
* @param {File} file
|
||
* @param {Object} options
|
||
*/
|
||
function ChunkUploadHandler(file, options) {
|
||
_classCallCheck(this, ChunkUploadHandler);
|
||
|
||
this.file = file;
|
||
this.options = options;
|
||
}
|
||
|
||
/**
|
||
* Gets the max retries from options
|
||
*/
|
||
|
||
|
||
_createClass(ChunkUploadHandler, [{
|
||
key: 'createChunks',
|
||
|
||
|
||
/**
|
||
* Creates all the chunks in the initial state
|
||
*/
|
||
value: function createChunks() {
|
||
this.chunks = [];
|
||
|
||
var start = 0;
|
||
var end = this.chunkSize;
|
||
while (start < this.fileSize) {
|
||
this.chunks.push({
|
||
blob: this.file.file.slice(start, end),
|
||
startOffset: start,
|
||
active: false,
|
||
retries: this.maxRetries
|
||
});
|
||
start = end;
|
||
end = start + this.chunkSize;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Updates the progress of the file with the handler's progress
|
||
*/
|
||
|
||
}, {
|
||
key: 'updateFileProgress',
|
||
value: function updateFileProgress() {
|
||
this.file.progress = this.progress;
|
||
}
|
||
|
||
/**
|
||
* Paues the upload process
|
||
* - Stops all active requests
|
||
* - Sets the file not active
|
||
*/
|
||
|
||
}, {
|
||
key: 'pause',
|
||
value: function pause() {
|
||
this.file.active = false;
|
||
this.stopChunks();
|
||
}
|
||
|
||
/**
|
||
* Stops all the current chunks
|
||
*/
|
||
|
||
}, {
|
||
key: 'stopChunks',
|
||
value: function stopChunks() {
|
||
this.chunksUploading.forEach(function (chunk) {
|
||
chunk.xhr.abort();
|
||
chunk.active = false;
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Resumes the file upload
|
||
* - Sets the file active
|
||
* - Starts the following chunks
|
||
*/
|
||
|
||
}, {
|
||
key: 'resume',
|
||
value: function resume() {
|
||
this.file.active = true;
|
||
this.startChunking();
|
||
}
|
||
|
||
/**
|
||
* Starts the file upload
|
||
*
|
||
* @returns Promise
|
||
* - resolve The file was uploaded
|
||
* - reject The file upload failed
|
||
*/
|
||
|
||
}, {
|
||
key: 'upload',
|
||
value: function upload() {
|
||
var _this = this;
|
||
|
||
this.promise = new Promise(function (resolve, reject) {
|
||
_this.resolve = resolve;
|
||
_this.reject = reject;
|
||
});
|
||
this.start();
|
||
|
||
return this.promise;
|
||
}
|
||
|
||
/**
|
||
* Start phase
|
||
* Sends a request to the backend to initialise the chunks
|
||
*/
|
||
|
||
}, {
|
||
key: 'start',
|
||
value: function start() {
|
||
var _this2 = this;
|
||
|
||
request({
|
||
method: 'POST',
|
||
headers: Object.assign({}, this.headers, {
|
||
'Content-Type': 'application/json'
|
||
}),
|
||
url: this.action,
|
||
body: Object.assign(this.startBody, {
|
||
phase: 'start',
|
||
mime_type: this.fileType,
|
||
size: this.fileSize,
|
||
name: this.fileName
|
||
})
|
||
}).then(function (res) {
|
||
if (res.status !== 'success') {
|
||
_this2.file.response = res;
|
||
return _this2.reject('server');
|
||
}
|
||
|
||
_this2.sessionId = res.data.session_id;
|
||
_this2.chunkSize = res.data.end_offset;
|
||
|
||
_this2.createChunks();
|
||
_this2.startChunking();
|
||
}).catch(function (res) {
|
||
_this2.file.response = res;
|
||
_this2.reject('server');
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Starts to upload chunks
|
||
*/
|
||
|
||
}, {
|
||
key: 'startChunking',
|
||
value: function startChunking() {
|
||
for (var i = 0; i < this.maxActiveChunks; i++) {
|
||
this.uploadNextChunk();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Uploads the next chunk
|
||
* - Won't do anything if the process is paused
|
||
* - Will start finish phase if there are no more chunks to upload
|
||
*/
|
||
|
||
}, {
|
||
key: 'uploadNextChunk',
|
||
value: function uploadNextChunk() {
|
||
if (this.file.active) {
|
||
if (this.hasChunksToUpload) {
|
||
return this.uploadChunk(this.chunksToUpload[0]);
|
||
}
|
||
|
||
if (this.chunksUploading.length === 0) {
|
||
return this.finish();
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Uploads a chunk
|
||
* - Sends the chunk to the backend
|
||
* - Sets the chunk as uploaded if everything went well
|
||
* - Decreases the number of retries if anything went wrong
|
||
* - Fails if there are no more retries
|
||
*
|
||
* @param {Object} chunk
|
||
*/
|
||
|
||
}, {
|
||
key: 'uploadChunk',
|
||
value: function uploadChunk(chunk) {
|
||
var _this3 = this;
|
||
|
||
chunk.progress = 0;
|
||
chunk.active = true;
|
||
this.updateFileProgress();
|
||
chunk.xhr = createRequest({
|
||
method: 'POST',
|
||
headers: this.headers,
|
||
url: this.action
|
||
});
|
||
|
||
chunk.xhr.upload.addEventListener('progress', function (evt) {
|
||
if (evt.lengthComputable) {
|
||
chunk.progress = Math.round(evt.loaded / evt.total * 100);
|
||
}
|
||
}, false);
|
||
|
||
sendFormRequest(chunk.xhr, Object.assign(this.uploadBody, {
|
||
phase: 'upload',
|
||
session_id: this.sessionId,
|
||
start_offset: chunk.startOffset,
|
||
chunk: chunk.blob
|
||
})).then(function (res) {
|
||
chunk.active = false;
|
||
if (res.status === 'success') {
|
||
chunk.uploaded = true;
|
||
} else {
|
||
if (chunk.retries-- <= 0) {
|
||
_this3.stopChunks();
|
||
return _this3.reject('upload');
|
||
}
|
||
}
|
||
|
||
_this3.uploadNextChunk();
|
||
}).catch(function () {
|
||
chunk.active = false;
|
||
if (chunk.retries-- <= 0) {
|
||
_this3.stopChunks();
|
||
return _this3.reject('upload');
|
||
}
|
||
|
||
_this3.uploadNextChunk();
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Finish phase
|
||
* Sends a request to the backend to finish the process
|
||
*/
|
||
|
||
}, {
|
||
key: 'finish',
|
||
value: function finish() {
|
||
var _this4 = this;
|
||
|
||
this.updateFileProgress();
|
||
|
||
request({
|
||
method: 'POST',
|
||
headers: Object.assign({}, this.headers, {
|
||
'Content-Type': 'application/json'
|
||
}),
|
||
url: this.action,
|
||
body: Object.assign(this.finishBody, {
|
||
phase: 'finish',
|
||
session_id: this.sessionId
|
||
})
|
||
}).then(function (res) {
|
||
_this4.file.response = res;
|
||
if (res.status !== 'success') {
|
||
return _this4.reject('server');
|
||
}
|
||
|
||
_this4.resolve(res);
|
||
}).catch(function (res) {
|
||
_this4.file.response = res;
|
||
_this4.reject('server');
|
||
});
|
||
}
|
||
}, {
|
||
key: 'maxRetries',
|
||
get: function get() {
|
||
return parseInt(this.options.maxRetries);
|
||
}
|
||
|
||
/**
|
||
* Gets the max number of active chunks being uploaded at once from options
|
||
*/
|
||
|
||
}, {
|
||
key: 'maxActiveChunks',
|
||
get: function get() {
|
||
return parseInt(this.options.maxActive);
|
||
}
|
||
|
||
/**
|
||
* Gets the file type
|
||
*/
|
||
|
||
}, {
|
||
key: 'fileType',
|
||
get: function get() {
|
||
return this.file.type;
|
||
}
|
||
|
||
/**
|
||
* Gets the file size
|
||
*/
|
||
|
||
}, {
|
||
key: 'fileSize',
|
||
get: function get() {
|
||
return this.file.size;
|
||
}
|
||
|
||
/**
|
||
* Gets the file name
|
||
*/
|
||
|
||
}, {
|
||
key: 'fileName',
|
||
get: function get() {
|
||
return this.file.name;
|
||
}
|
||
|
||
/**
|
||
* Gets action (url) to upload the file
|
||
*/
|
||
|
||
}, {
|
||
key: 'action',
|
||
get: function get() {
|
||
return this.options.action || null;
|
||
}
|
||
|
||
/**
|
||
* Gets the body to be merged when sending the request in start phase
|
||
*/
|
||
|
||
}, {
|
||
key: 'startBody',
|
||
get: function get() {
|
||
return this.options.startBody || {};
|
||
}
|
||
|
||
/**
|
||
* Gets the body to be merged when sending the request in upload phase
|
||
*/
|
||
|
||
}, {
|
||
key: 'uploadBody',
|
||
get: function get() {
|
||
return this.options.uploadBody || {};
|
||
}
|
||
|
||
/**
|
||
* Gets the body to be merged when sending the request in finish phase
|
||
*/
|
||
|
||
}, {
|
||
key: 'finishBody',
|
||
get: function get() {
|
||
return this.options.finishBody || {};
|
||
}
|
||
|
||
/**
|
||
* Gets the headers of the requests from options
|
||
*/
|
||
|
||
}, {
|
||
key: 'headers',
|
||
get: function get() {
|
||
return this.options.headers || {};
|
||
}
|
||
|
||
/**
|
||
* Whether it's ready to upload files or not
|
||
*/
|
||
|
||
}, {
|
||
key: 'readyToUpload',
|
||
get: function get() {
|
||
return !!this.chunks;
|
||
}
|
||
|
||
/**
|
||
* Gets the progress of the chunk upload
|
||
* - Gets all the completed chunks
|
||
* - Gets the progress of all the chunks that are being uploaded
|
||
*/
|
||
|
||
}, {
|
||
key: 'progress',
|
||
get: function get() {
|
||
var _this5 = this;
|
||
|
||
var completedProgress = this.chunksUploaded.length / this.chunks.length * 100;
|
||
var uploadingProgress = this.chunksUploading.reduce(function (progress, chunk) {
|
||
return progress + (chunk.progress | 0) / _this5.chunks.length;
|
||
}, 0);
|
||
|
||
return Math.min(completedProgress + uploadingProgress, 100);
|
||
}
|
||
|
||
/**
|
||
* Gets all the chunks that are pending to be uploaded
|
||
*/
|
||
|
||
}, {
|
||
key: 'chunksToUpload',
|
||
get: function get() {
|
||
return this.chunks.filter(function (chunk) {
|
||
return !chunk.active && !chunk.uploaded;
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Whether there are chunks to upload or not
|
||
*/
|
||
|
||
}, {
|
||
key: 'hasChunksToUpload',
|
||
get: function get() {
|
||
return this.chunksToUpload.length > 0;
|
||
}
|
||
|
||
/**
|
||
* Gets all the chunks that are uploading
|
||
*/
|
||
|
||
}, {
|
||
key: 'chunksUploading',
|
||
get: function get() {
|
||
return this.chunks.filter(function (chunk) {
|
||
return !!chunk.xhr && !!chunk.active;
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Gets all the chunks that have finished uploading
|
||
*/
|
||
|
||
}, {
|
||
key: 'chunksUploaded',
|
||
get: function get() {
|
||
return this.chunks.filter(function (chunk) {
|
||
return !!chunk.uploaded;
|
||
});
|
||
}
|
||
}]);
|
||
|
||
return ChunkUploadHandler;
|
||
}();
|
||
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
|
||
var script = {
|
||
methods: {
|
||
change: function change(e) {
|
||
this.$parent.addInputFile(e.target);
|
||
if (e.target.files) {
|
||
e.target.value = '';
|
||
if (e.target.files.length && !/safari/i.test(navigator.userAgent)) {
|
||
e.target.type = '';
|
||
e.target.type = 'file';
|
||
}
|
||
} else {
|
||
// ie9 fix #219
|
||
this.$destroy();
|
||
// eslint-disable-next-line
|
||
new this.constructor({
|
||
parent: this.$parent,
|
||
el: this.$el
|
||
});
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
/* script */
|
||
var __vue_script__ = script;
|
||
|
||
/* template */
|
||
var __vue_render__ = function __vue_render__() {
|
||
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('input', { attrs: { "type": "file", "name": _vm.$parent.name, "id": _vm.$parent.inputId || _vm.$parent.name, "accept": _vm.$parent.accept, "capture": _vm.$parent.capture, "disabled": _vm.$parent.disabled, "webkitdirectory": _vm.$parent.directory && _vm.$parent.features.directory, "directory": _vm.$parent.directory && _vm.$parent.features.directory, "multiple": _vm.$parent.multiple && _vm.$parent.features.html5 }, on: { "change": _vm.change } });
|
||
};
|
||
var __vue_staticRenderFns__ = [];
|
||
|
||
/* style */
|
||
var __vue_inject_styles__ = undefined;
|
||
/* scoped */
|
||
var __vue_scope_id__ = undefined;
|
||
/* module identifier */
|
||
var __vue_module_identifier__ = undefined;
|
||
/* functional template */
|
||
var __vue_is_functional_template__ = false;
|
||
/* component normalizer */
|
||
function __vue_normalize__(template, style, script$$1, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
|
||
var component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {};
|
||
|
||
if (!component.render) {
|
||
component.render = template.render;
|
||
component.staticRenderFns = template.staticRenderFns;
|
||
component._compiled = true;
|
||
|
||
if (functional) component.functional = true;
|
||
}
|
||
|
||
component._scopeId = scope;
|
||
|
||
return component;
|
||
}
|
||
/* style inject */
|
||
function __vue_create_injector__() {
|
||
var head = document.head || document.getElementsByTagName('head')[0];
|
||
var styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {});
|
||
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
||
|
||
return function addStyle(id, css) {
|
||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) return; // SSR styles are present.
|
||
|
||
var group = isOldIE ? css.media || 'default' : id;
|
||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined });
|
||
|
||
if (!style.ids.includes(id)) {
|
||
var code = css.source;
|
||
var index = style.ids.length;
|
||
|
||
style.ids.push(id);
|
||
|
||
if (css.map) {
|
||
// https://developer.chrome.com/devtools/docs/javascript-debugging
|
||
// this makes source maps inside style tags work properly in Chrome
|
||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
|
||
// http://stackoverflow.com/a/26603875
|
||
code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
|
||
}
|
||
|
||
if (isOldIE) {
|
||
style.element = style.element || document.querySelector('style[data-group=' + group + ']');
|
||
}
|
||
|
||
if (!style.element) {
|
||
var el = style.element = document.createElement('style');
|
||
el.type = 'text/css';
|
||
|
||
if (css.media) el.setAttribute('media', css.media);
|
||
if (isOldIE) {
|
||
el.setAttribute('data-group', group);
|
||
el.setAttribute('data-next-index', '0');
|
||
}
|
||
|
||
head.appendChild(el);
|
||
}
|
||
|
||
if (isOldIE) {
|
||
index = parseInt(style.element.getAttribute('data-next-index'));
|
||
style.element.setAttribute('data-next-index', index + 1);
|
||
}
|
||
|
||
if (style.element.styleSheet) {
|
||
style.parts.push(code);
|
||
style.element.styleSheet.cssText = style.parts.filter(Boolean).join('\n');
|
||
} else {
|
||
var textNode = document.createTextNode(code);
|
||
var nodes = style.element.childNodes;
|
||
if (nodes[index]) style.element.removeChild(nodes[index]);
|
||
if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
/* style inject SSR */
|
||
|
||
var InputFile = __vue_normalize__({ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, __vue_create_injector__, undefined);
|
||
|
||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||
|
||
var CHUNK_DEFAULT_OPTIONS = {
|
||
headers: {},
|
||
action: '',
|
||
minSize: 1048576,
|
||
maxActive: 3,
|
||
maxRetries: 5,
|
||
|
||
handler: ChunkUploadHandler
|
||
};
|
||
|
||
var script$1 = {
|
||
components: {
|
||
InputFile: InputFile
|
||
},
|
||
props: {
|
||
inputId: {
|
||
type: String
|
||
},
|
||
|
||
name: {
|
||
type: String,
|
||
default: 'file'
|
||
},
|
||
|
||
accept: {
|
||
type: String
|
||
},
|
||
|
||
capture: {},
|
||
|
||
disabled: {},
|
||
|
||
multiple: {
|
||
type: Boolean
|
||
},
|
||
|
||
maximum: {
|
||
type: Number,
|
||
default: function _default() {
|
||
return this.multiple ? 0 : 1;
|
||
}
|
||
},
|
||
|
||
addIndex: {
|
||
type: [Boolean, Number]
|
||
},
|
||
|
||
directory: {
|
||
type: Boolean
|
||
},
|
||
|
||
postAction: {
|
||
type: String
|
||
},
|
||
|
||
putAction: {
|
||
type: String
|
||
},
|
||
|
||
customAction: {
|
||
type: Function
|
||
},
|
||
|
||
headers: {
|
||
type: Object,
|
||
default: Object
|
||
},
|
||
|
||
data: {
|
||
type: Object,
|
||
default: Object
|
||
},
|
||
|
||
timeout: {
|
||
type: Number,
|
||
default: 0
|
||
},
|
||
|
||
drop: {
|
||
default: false
|
||
},
|
||
|
||
dropDirectory: {
|
||
type: Boolean,
|
||
default: true
|
||
},
|
||
|
||
size: {
|
||
type: Number,
|
||
default: 0
|
||
},
|
||
|
||
extensions: {
|
||
default: Array
|
||
},
|
||
|
||
value: {
|
||
type: Array,
|
||
default: Array
|
||
},
|
||
|
||
thread: {
|
||
type: Number,
|
||
default: 1
|
||
},
|
||
|
||
// Chunk upload enabled
|
||
chunkEnabled: {
|
||
type: Boolean,
|
||
default: false
|
||
},
|
||
|
||
// Chunk upload properties
|
||
chunk: {
|
||
type: Object,
|
||
default: function _default() {
|
||
return CHUNK_DEFAULT_OPTIONS;
|
||
}
|
||
}
|
||
},
|
||
|
||
data: function data() {
|
||
return {
|
||
files: this.value,
|
||
features: {
|
||
html5: true,
|
||
directory: false,
|
||
drag: false
|
||
},
|
||
|
||
active: false,
|
||
dropActive: false,
|
||
|
||
uploading: 0,
|
||
|
||
destroy: false
|
||
};
|
||
},
|
||
|
||
|
||
/**
|
||
* mounted
|
||
* @return {[type]} [description]
|
||
*/
|
||
mounted: function mounted() {
|
||
var input = document.createElement('input');
|
||
input.type = 'file';
|
||
input.multiple = true;
|
||
|
||
// html5 特征
|
||
if (window.FormData && input.files) {
|
||
// 上传目录特征
|
||
if (typeof input.webkitdirectory === 'boolean' || typeof input.directory === 'boolean') {
|
||
this.features.directory = true;
|
||
}
|
||
|
||
// 拖拽特征
|
||
if (this.features.html5 && typeof input.ondrop !== 'undefined') {
|
||
this.features.drop = true;
|
||
}
|
||
} else {
|
||
this.features.html5 = false;
|
||
}
|
||
|
||
// files 定位缓存
|
||
this.maps = {};
|
||
if (this.files) {
|
||
for (var i = 0; i < this.files.length; i++) {
|
||
var file = this.files[i];
|
||
this.maps[file.id] = file;
|
||
}
|
||
}
|
||
|
||
this.$nextTick(function () {
|
||
|
||
// 更新下父级
|
||
if (this.$parent) {
|
||
this.$parent.$forceUpdate();
|
||
}
|
||
|
||
// 拖拽渲染
|
||
this.watchDrop(this.drop);
|
||
});
|
||
},
|
||
|
||
|
||
/**
|
||
* beforeDestroy
|
||
* @return {[type]} [description]
|
||
*/
|
||
beforeDestroy: function beforeDestroy() {
|
||
// 已销毁
|
||
this.destroy = true;
|
||
|
||
// 设置成不激活
|
||
this.active = false;
|
||
},
|
||
|
||
|
||
computed: {
|
||
/**
|
||
* uploading 正在上传的线程
|
||
* @return {[type]} [description]
|
||
*/
|
||
|
||
/**
|
||
* uploaded 文件列表是否全部已上传
|
||
* @return {[type]} [description]
|
||
*/
|
||
uploaded: function uploaded() {
|
||
var file = void 0;
|
||
for (var i = 0; i < this.files.length; i++) {
|
||
file = this.files[i];
|
||
if (file.fileObject && !file.error && !file.success) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
},
|
||
chunkOptions: function chunkOptions() {
|
||
return Object.assign(CHUNK_DEFAULT_OPTIONS, this.chunk);
|
||
},
|
||
className: function className() {
|
||
return ['file-uploads', this.features.html5 ? 'file-uploads-html5' : 'file-uploads-html4', this.features.directory && this.directory ? 'file-uploads-directory' : undefined, this.features.drop && this.drop ? 'file-uploads-drop' : undefined, this.disabled ? 'file-uploads-disabled' : undefined];
|
||
}
|
||
},
|
||
|
||
watch: {
|
||
active: function active(_active) {
|
||
this.watchActive(_active);
|
||
},
|
||
dropActive: function dropActive() {
|
||
if (this.$parent) {
|
||
this.$parent.$forceUpdate();
|
||
}
|
||
},
|
||
drop: function drop(value) {
|
||
this.watchDrop(value);
|
||
},
|
||
value: function value(files) {
|
||
if (this.files === files) {
|
||
return;
|
||
}
|
||
this.files = files;
|
||
|
||
var oldMaps = this.maps;
|
||
|
||
// 重写 maps 缓存
|
||
this.maps = {};
|
||
for (var i = 0; i < this.files.length; i++) {
|
||
var file = this.files[i];
|
||
this.maps[file.id] = file;
|
||
}
|
||
|
||
// add, update
|
||
for (var key in this.maps) {
|
||
var newFile = this.maps[key];
|
||
var oldFile = oldMaps[key];
|
||
if (newFile !== oldFile) {
|
||
this.emitFile(newFile, oldFile);
|
||
}
|
||
}
|
||
|
||
// delete
|
||
for (var _key in oldMaps) {
|
||
if (!this.maps[_key]) {
|
||
this.emitFile(undefined, oldMaps[_key]);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
methods: {
|
||
|
||
// 清空
|
||
clear: function clear() {
|
||
if (this.files.length) {
|
||
var files = this.files;
|
||
this.files = [];
|
||
|
||
// 定位
|
||
this.maps = {};
|
||
|
||
// 事件
|
||
this.emitInput();
|
||
for (var i = 0; i < files.length; i++) {
|
||
this.emitFile(undefined, files[i]);
|
||
}
|
||
}
|
||
return true;
|
||
},
|
||
|
||
|
||
// 选择
|
||
get: function get(id) {
|
||
if (!id) {
|
||
return false;
|
||
}
|
||
|
||
if ((typeof id === 'undefined' ? 'undefined' : _typeof(id)) === 'object') {
|
||
return this.maps[id.id] || false;
|
||
}
|
||
|
||
return this.maps[id] || false;
|
||
},
|
||
|
||
|
||
// 添加
|
||
add: function add(_files) {
|
||
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addIndex;
|
||
|
||
var files = _files;
|
||
var isArray = files instanceof Array;
|
||
|
||
// 不是数组整理成数组
|
||
if (!isArray) {
|
||
files = [files];
|
||
}
|
||
|
||
// 遍历规范对象
|
||
var addFiles = [];
|
||
for (var i = 0; i < files.length; i++) {
|
||
var file = files[i];
|
||
if (this.features.html5 && file instanceof Blob) {
|
||
file = {
|
||
file: file,
|
||
size: file.size,
|
||
name: file.webkitRelativePath || file.relativePath || file.name || 'unknown',
|
||
type: file.type
|
||
};
|
||
}
|
||
var fileObject = false;
|
||
if (file.fileObject === false) ; else if (file.fileObject) {
|
||
fileObject = true;
|
||
} else if (typeof Element !== 'undefined' && file.el instanceof Element) {
|
||
fileObject = true;
|
||
} else if (typeof Blob !== 'undefined' && file.file instanceof Blob) {
|
||
fileObject = true;
|
||
}
|
||
if (fileObject) {
|
||
file = _extends({
|
||
fileObject: true,
|
||
size: -1,
|
||
name: 'Filename',
|
||
type: '',
|
||
active: false,
|
||
error: '',
|
||
success: false,
|
||
putAction: this.putAction,
|
||
postAction: this.postAction,
|
||
timeout: this.timeout
|
||
}, file, {
|
||
response: {},
|
||
|
||
progress: '0.00', // 只读
|
||
speed: 0 // 只读
|
||
// xhr: false, // 只读
|
||
// iframe: false, // 只读
|
||
});
|
||
|
||
file.data = _extends({}, this.data, file.data ? file.data : {});
|
||
|
||
file.headers = _extends({}, this.headers, file.headers ? file.headers : {});
|
||
}
|
||
|
||
// 必须包含 id
|
||
if (!file.id) {
|
||
file.id = Math.random().toString(36).substr(2);
|
||
}
|
||
|
||
if (this.emitFilter(file, undefined)) {
|
||
continue;
|
||
}
|
||
|
||
// 最大数量限制
|
||
if (this.maximum > 1 && addFiles.length + this.files.length >= this.maximum) {
|
||
break;
|
||
}
|
||
|
||
addFiles.push(file);
|
||
|
||
// 最大数量限制
|
||
if (this.maximum === 1) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 没有文件
|
||
if (!addFiles.length) {
|
||
return false;
|
||
}
|
||
|
||
// 如果是 1 清空
|
||
if (this.maximum === 1) {
|
||
this.clear();
|
||
}
|
||
|
||
// 添加进去 files
|
||
var newFiles = void 0;
|
||
if (index === true || index === 0) {
|
||
newFiles = addFiles.concat(this.files);
|
||
} else if (index) {
|
||
var _newFiles;
|
||
|
||
newFiles = this.files.concat([]);
|
||
(_newFiles = newFiles).splice.apply(_newFiles, [index, 0].concat(addFiles));
|
||
} else {
|
||
newFiles = this.files.concat(addFiles);
|
||
}
|
||
|
||
this.files = newFiles;
|
||
|
||
// 定位
|
||
for (var _i = 0; _i < addFiles.length; _i++) {
|
||
var _file2 = addFiles[_i];
|
||
this.maps[_file2.id] = _file2;
|
||
}
|
||
|
||
// 事件
|
||
this.emitInput();
|
||
for (var _i2 = 0; _i2 < addFiles.length; _i2++) {
|
||
this.emitFile(addFiles[_i2], undefined);
|
||
}
|
||
|
||
return isArray ? addFiles : addFiles[0];
|
||
},
|
||
|
||
|
||
// 添加表单文件
|
||
addInputFile: function addInputFile(el) {
|
||
var files = [];
|
||
if (el.files) {
|
||
for (var i = 0; i < el.files.length; i++) {
|
||
var file = el.files[i];
|
||
files.push({
|
||
size: file.size,
|
||
name: file.webkitRelativePath || file.relativePath || file.name,
|
||
type: file.type,
|
||
file: file
|
||
});
|
||
}
|
||
} else {
|
||
var names = el.value.replace(/\\/g, '/').split('/');
|
||
delete el.__vuex__;
|
||
files.push({
|
||
name: names[names.length - 1],
|
||
el: el
|
||
});
|
||
}
|
||
return this.add(files);
|
||
},
|
||
|
||
|
||
// 添加 DataTransfer
|
||
addDataTransfer: function addDataTransfer(dataTransfer) {
|
||
var _this = this;
|
||
|
||
var files = [];
|
||
if (dataTransfer.items && dataTransfer.items.length) {
|
||
var items = [];
|
||
for (var i = 0; i < dataTransfer.items.length; i++) {
|
||
var item = dataTransfer.items[i];
|
||
if (item.getAsEntry) {
|
||
item = item.getAsEntry() || item.getAsFile();
|
||
} else if (item.webkitGetAsEntry) {
|
||
item = item.webkitGetAsEntry() || item.getAsFile();
|
||
} else {
|
||
item = item.getAsFile();
|
||
}
|
||
if (item) {
|
||
items.push(item);
|
||
}
|
||
}
|
||
|
||
return new Promise(function (resolve, reject) {
|
||
var forEach = function forEach(i) {
|
||
var item = items[i];
|
||
// 结束 文件数量大于 最大数量
|
||
if (!item || _this.maximum > 0 && files.length >= _this.maximum) {
|
||
return resolve(_this.add(files));
|
||
}
|
||
_this.getEntry(item).then(function (results) {
|
||
files.push.apply(files, _toConsumableArray(results));
|
||
forEach(i + 1);
|
||
});
|
||
};
|
||
forEach(0);
|
||
});
|
||
}
|
||
|
||
if (dataTransfer.files.length) {
|
||
for (var _i3 = 0; _i3 < dataTransfer.files.length; _i3++) {
|
||
files.push(dataTransfer.files[_i3]);
|
||
if (this.maximum > 0 && files.length >= this.maximum) {
|
||
break;
|
||
}
|
||
}
|
||
return Promise.resolve(this.add(files));
|
||
}
|
||
|
||
return Promise.resolve([]);
|
||
},
|
||
|
||
|
||
// 获得 entry
|
||
getEntry: function getEntry(entry) {
|
||
var _this2 = this;
|
||
|
||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||
|
||
return new Promise(function (resolve, reject) {
|
||
if (entry.isFile) {
|
||
entry.file(function (file) {
|
||
resolve([{
|
||
size: file.size,
|
||
name: path + file.name,
|
||
type: file.type,
|
||
file: file
|
||
}]);
|
||
});
|
||
} else if (entry.isDirectory && _this2.dropDirectory) {
|
||
var files = [];
|
||
var dirReader = entry.createReader();
|
||
var readEntries = function readEntries() {
|
||
dirReader.readEntries(function (entries) {
|
||
var forEach = function forEach(i) {
|
||
if (!entries[i] && i === 0 || _this2.maximum > 0 && files.length >= _this2.maximum) {
|
||
return resolve(files);
|
||
}
|
||
if (!entries[i]) {
|
||
return readEntries();
|
||
}
|
||
_this2.getEntry(entries[i], path + entry.name + '/').then(function (results) {
|
||
files.push.apply(files, _toConsumableArray(results));
|
||
forEach(i + 1);
|
||
});
|
||
};
|
||
forEach(0);
|
||
});
|
||
};
|
||
readEntries();
|
||
} else {
|
||
resolve([]);
|
||
}
|
||
});
|
||
},
|
||
replace: function replace(id1, id2) {
|
||
var file1 = this.get(id1);
|
||
var file2 = this.get(id2);
|
||
if (!file1 || !file2 || file1 === file2) {
|
||
return false;
|
||
}
|
||
var files = this.files.concat([]);
|
||
var index1 = files.indexOf(file1);
|
||
var index2 = files.indexOf(file2);
|
||
if (index1 === -1 || index2 === -1) {
|
||
return false;
|
||
}
|
||
files[index1] = file2;
|
||
files[index2] = file1;
|
||
this.files = files;
|
||
this.emitInput();
|
||
return true;
|
||
},
|
||
|
||
|
||
// 移除
|
||
remove: function remove(id) {
|
||
var file = this.get(id);
|
||
if (file) {
|
||
if (this.emitFilter(undefined, file)) {
|
||
return false;
|
||
}
|
||
var files = this.files.concat([]);
|
||
var index = files.indexOf(file);
|
||
if (index === -1) {
|
||
console.error('remove', file);
|
||
return false;
|
||
}
|
||
files.splice(index, 1);
|
||
this.files = files;
|
||
|
||
// 定位
|
||
delete this.maps[file.id];
|
||
|
||
// 事件
|
||
this.emitInput();
|
||
this.emitFile(undefined, file);
|
||
}
|
||
return file;
|
||
},
|
||
|
||
|
||
// 更新
|
||
update: function update(id, data) {
|
||
var file = this.get(id);
|
||
if (file) {
|
||
var newFile = _extends({}, file, data);
|
||
// 停用必须加上错误
|
||
if (file.fileObject && file.active && !newFile.active && !newFile.error && !newFile.success) {
|
||
newFile.error = 'abort';
|
||
}
|
||
|
||
if (this.emitFilter(newFile, file)) {
|
||
return false;
|
||
}
|
||
|
||
var files = this.files.concat([]);
|
||
var index = files.indexOf(file);
|
||
if (index === -1) {
|
||
console.error('update', file);
|
||
return false;
|
||
}
|
||
files.splice(index, 1, newFile);
|
||
this.files = files;
|
||
|
||
// 删除 旧定位 写入 新定位 (已便支持修改id)
|
||
delete this.maps[file.id];
|
||
this.maps[newFile.id] = newFile;
|
||
|
||
// 事件
|
||
this.emitInput();
|
||
this.emitFile(newFile, file);
|
||
return newFile;
|
||
}
|
||
return false;
|
||
},
|
||
|
||
|
||
// 预处理 事件 过滤器
|
||
emitFilter: function emitFilter(newFile, oldFile) {
|
||
var isPrevent = false;
|
||
this.$emit('input-filter', newFile, oldFile, function () {
|
||
isPrevent = true;
|
||
return isPrevent;
|
||
});
|
||
return isPrevent;
|
||
},
|
||
|
||
|
||
// 处理后 事件 分发
|
||
emitFile: function emitFile(newFile, oldFile) {
|
||
this.$emit('input-file', newFile, oldFile);
|
||
if (newFile && newFile.fileObject && newFile.active && (!oldFile || !oldFile.active)) {
|
||
this.uploading++;
|
||
// 激活
|
||
this.$nextTick(function () {
|
||
var _this3 = this;
|
||
|
||
setTimeout(function () {
|
||
_this3.upload(newFile).then(function () {
|
||
// eslint-disable-next-line
|
||
newFile = _this3.get(newFile);
|
||
if (newFile && newFile.fileObject) {
|
||
_this3.update(newFile, {
|
||
active: false,
|
||
success: !newFile.error
|
||
});
|
||
}
|
||
}).catch(function (e) {
|
||
_this3.update(newFile, {
|
||
active: false,
|
||
success: false,
|
||
error: e.code || e.error || e.message || e
|
||
});
|
||
});
|
||
}, parseInt(Math.random() * 50 + 50, 10));
|
||
});
|
||
} else if ((!newFile || !newFile.fileObject || !newFile.active) && oldFile && oldFile.fileObject && oldFile.active) {
|
||
// 停止
|
||
this.uploading--;
|
||
}
|
||
|
||
// 自动延续激活
|
||
if (this.active && (Boolean(newFile) !== Boolean(oldFile) || newFile.active !== oldFile.active)) {
|
||
this.watchActive(true);
|
||
}
|
||
},
|
||
emitInput: function emitInput() {
|
||
this.$emit('input', this.files);
|
||
},
|
||
|
||
|
||
// 上传
|
||
upload: function upload(id) {
|
||
var file = this.get(id);
|
||
|
||
// 被删除
|
||
if (!file) {
|
||
return Promise.reject('not_exists');
|
||
}
|
||
|
||
// 不是文件对象
|
||
if (!file.fileObject) {
|
||
return Promise.reject('file_object');
|
||
}
|
||
|
||
// 有错误直接响应
|
||
if (file.error) {
|
||
return Promise.reject(file.error);
|
||
}
|
||
|
||
// 已完成直接响应
|
||
if (file.success) {
|
||
return Promise.resolve(file);
|
||
}
|
||
|
||
// 后缀
|
||
var extensions = this.extensions;
|
||
if (extensions && (extensions.length || typeof extensions.length === 'undefined')) {
|
||
if ((typeof extensions === 'undefined' ? 'undefined' : _typeof(extensions)) !== 'object' || !(extensions instanceof RegExp)) {
|
||
if (typeof extensions === 'string') {
|
||
extensions = extensions.split(',').map(function (value) {
|
||
return value.trim();
|
||
}).filter(function (value) {
|
||
return value;
|
||
});
|
||
}
|
||
extensions = new RegExp('\\.(' + extensions.join('|').replace(/\./g, '\\.') + ')$', 'i');
|
||
}
|
||
if (file.name.search(extensions) === -1) {
|
||
return Promise.reject('extension');
|
||
}
|
||
}
|
||
|
||
// 大小
|
||
if (this.size > 0 && file.size >= 0 && file.size > this.size) {
|
||
return Promise.reject('size');
|
||
}
|
||
|
||
if (this.customAction) {
|
||
return this.customAction(file, this);
|
||
}
|
||
|
||
if (this.features.html5) {
|
||
if (this.shouldUseChunkUpload(file)) {
|
||
return this.uploadChunk(file);
|
||
}
|
||
if (file.putAction) {
|
||
return this.uploadPut(file);
|
||
}
|
||
if (file.postAction) {
|
||
return this.uploadHtml5(file);
|
||
}
|
||
}
|
||
if (file.postAction) {
|
||
return this.uploadHtml4(file);
|
||
}
|
||
return Promise.reject('No action configured');
|
||
},
|
||
|
||
|
||
/**
|
||
* Whether this file should be uploaded using chunk upload or not
|
||
*
|
||
* @param Object file
|
||
*/
|
||
shouldUseChunkUpload: function shouldUseChunkUpload(file) {
|
||
return this.chunkEnabled && !!this.chunkOptions.handler && file.size > this.chunkOptions.minSize;
|
||
},
|
||
|
||
|
||
/**
|
||
* Upload a file using Chunk method
|
||
*
|
||
* @param File file
|
||
*/
|
||
uploadChunk: function uploadChunk(file) {
|
||
var HandlerClass = this.chunkOptions.handler;
|
||
file.chunk = new HandlerClass(file, this.chunkOptions);
|
||
|
||
return file.chunk.upload();
|
||
},
|
||
uploadPut: function uploadPut(file) {
|
||
var querys = [];
|
||
var value = void 0;
|
||
for (var key in file.data) {
|
||
value = file.data[key];
|
||
if (value !== null && value !== undefined) {
|
||
querys.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
|
||
}
|
||
}
|
||
var queryString = querys.length ? (file.putAction.indexOf('?') === -1 ? '?' : '&') + querys.join('&') : '';
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.open('PUT', file.putAction + queryString);
|
||
return this.uploadXhr(xhr, file, file.file);
|
||
},
|
||
uploadHtml5: function uploadHtml5(file) {
|
||
var form = new window.FormData();
|
||
var value = void 0;
|
||
for (var key in file.data) {
|
||
value = file.data[key];
|
||
if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && typeof value.toString !== 'function') {
|
||
if (value instanceof File) {
|
||
form.append(key, value, value.name);
|
||
} else {
|
||
form.append(key, JSON.stringify(value));
|
||
}
|
||
} else if (value !== null && value !== undefined) {
|
||
form.append(key, value);
|
||
}
|
||
}
|
||
form.append(this.name, file.file, file.file.filename || file.name);
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.open('POST', file.postAction);
|
||
return this.uploadXhr(xhr, file, form);
|
||
},
|
||
uploadXhr: function uploadXhr(xhr, _file, body) {
|
||
var _this4 = this;
|
||
|
||
var file = _file;
|
||
var speedTime = 0;
|
||
var speedLoaded = 0;
|
||
|
||
// 进度条
|
||
xhr.upload.onprogress = function (e) {
|
||
// 还未开始上传 已删除 未激活
|
||
file = _this4.get(file);
|
||
if (!e.lengthComputable || !file || !file.fileObject || !file.active) {
|
||
return;
|
||
}
|
||
|
||
// 进度 速度 每秒更新一次
|
||
var speedTime2 = Math.round(Date.now() / 1000);
|
||
if (speedTime2 === speedTime) {
|
||
return;
|
||
}
|
||
speedTime = speedTime2;
|
||
|
||
file = _this4.update(file, {
|
||
progress: (e.loaded / e.total * 100).toFixed(2),
|
||
speed: e.loaded - speedLoaded
|
||
});
|
||
speedLoaded = e.loaded;
|
||
};
|
||
|
||
// 检查激活状态
|
||
var interval = setInterval(function () {
|
||
file = _this4.get(file);
|
||
if (file && file.fileObject && !file.success && !file.error && file.active) {
|
||
return;
|
||
}
|
||
|
||
if (interval) {
|
||
clearInterval(interval);
|
||
interval = false;
|
||
}
|
||
|
||
try {
|
||
xhr.abort();
|
||
xhr.timeout = 1;
|
||
} catch (e) {}
|
||
}, 100);
|
||
|
||
return new Promise(function (resolve, reject) {
|
||
var complete = void 0;
|
||
var fn = function fn(e) {
|
||
// 已经处理过了
|
||
if (complete) {
|
||
return;
|
||
}
|
||
complete = true;
|
||
if (interval) {
|
||
clearInterval(interval);
|
||
interval = false;
|
||
}
|
||
|
||
file = _this4.get(file);
|
||
|
||
// 不存在直接响应
|
||
if (!file) {
|
||
return reject('not_exists');
|
||
}
|
||
|
||
// 不是文件对象
|
||
if (!file.fileObject) {
|
||
return reject('file_object');
|
||
}
|
||
|
||
// 有错误自动响应
|
||
if (file.error) {
|
||
return reject(file.error);
|
||
}
|
||
|
||
// 未激活
|
||
if (!file.active) {
|
||
return reject('abort');
|
||
}
|
||
|
||
// 已完成 直接相应
|
||
if (file.success) {
|
||
return resolve(file);
|
||
}
|
||
|
||
var data = {};
|
||
|
||
switch (e.type) {
|
||
case 'timeout':
|
||
case 'abort':
|
||
data.error = e.type;
|
||
break;
|
||
case 'error':
|
||
if (!xhr.status) {
|
||
data.error = 'network';
|
||
} else if (xhr.status >= 500) {
|
||
data.error = 'server';
|
||
} else if (xhr.status >= 400) {
|
||
data.error = 'denied';
|
||
}
|
||
break;
|
||
default:
|
||
if (xhr.status >= 500) {
|
||
data.error = 'server';
|
||
} else if (xhr.status >= 400) {
|
||
data.error = 'denied';
|
||
} else {
|
||
data.progress = '100.00';
|
||
}
|
||
}
|
||
|
||
if (xhr.responseText) {
|
||
var contentType = xhr.getResponseHeader('Content-Type');
|
||
if (contentType && contentType.indexOf('/json') !== -1) {
|
||
data.response = JSON.parse(xhr.responseText);
|
||
} else {
|
||
data.response = xhr.responseText;
|
||
}
|
||
}
|
||
|
||
// 更新
|
||
file = _this4.update(file, data);
|
||
|
||
// 相应错误
|
||
if (file.error) {
|
||
return reject(file.error);
|
||
}
|
||
|
||
// 响应
|
||
return resolve(file);
|
||
};
|
||
|
||
// 事件
|
||
xhr.onload = fn;
|
||
xhr.onerror = fn;
|
||
xhr.onabort = fn;
|
||
xhr.ontimeout = fn;
|
||
|
||
// 超时
|
||
if (file.timeout) {
|
||
xhr.timeout = file.timeout;
|
||
}
|
||
|
||
// headers
|
||
for (var key in file.headers) {
|
||
xhr.setRequestHeader(key, file.headers[key]);
|
||
}
|
||
|
||
// 更新 xhr
|
||
file = _this4.update(file, { xhr: xhr });
|
||
|
||
// 开始上传
|
||
xhr.send(body);
|
||
});
|
||
},
|
||
uploadHtml4: function uploadHtml4(_file) {
|
||
var _this5 = this;
|
||
|
||
var file = _file;
|
||
var onKeydown = function onKeydown(e) {
|
||
if (e.keyCode === 27) {
|
||
e.preventDefault();
|
||
}
|
||
};
|
||
|
||
var iframe = document.createElement('iframe');
|
||
iframe.id = 'upload-iframe-' + file.id;
|
||
iframe.name = 'upload-iframe-' + file.id;
|
||
iframe.src = 'about:blank';
|
||
iframe.setAttribute('style', 'width:1px;height:1px;top:-999em;position:absolute; margin-top:-999em;');
|
||
|
||
var form = document.createElement('form');
|
||
|
||
form.action = file.postAction;
|
||
|
||
form.name = 'upload-form-' + file.id;
|
||
|
||
form.setAttribute('method', 'POST');
|
||
form.setAttribute('target', 'upload-iframe-' + file.id);
|
||
form.setAttribute('enctype', 'multipart/form-data');
|
||
|
||
var value = void 0;
|
||
var input = void 0;
|
||
for (var key in file.data) {
|
||
value = file.data[key];
|
||
if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && typeof value.toString !== 'function') {
|
||
value = JSON.stringify(value);
|
||
}
|
||
if (value !== null && value !== undefined) {
|
||
input = document.createElement('input');
|
||
input.type = 'hidden';
|
||
input.name = key;
|
||
input.value = value;
|
||
form.appendChild(input);
|
||
}
|
||
}
|
||
form.appendChild(file.el);
|
||
|
||
document.body.appendChild(iframe).appendChild(form);
|
||
|
||
var getResponseData = function getResponseData() {
|
||
var doc = void 0;
|
||
try {
|
||
if (iframe.contentWindow) {
|
||
doc = iframe.contentWindow.document;
|
||
}
|
||
} catch (err) {}
|
||
if (!doc) {
|
||
try {
|
||
doc = iframe.contentDocument ? iframe.contentDocument : iframe.document;
|
||
} catch (err) {
|
||
doc = iframe.document;
|
||
}
|
||
}
|
||
if (doc && doc.body) {
|
||
return doc.body.innerHTML;
|
||
}
|
||
return null;
|
||
};
|
||
|
||
return new Promise(function (resolve, reject) {
|
||
setTimeout(function () {
|
||
file = _this5.update(file, { iframe: iframe });
|
||
|
||
// 不存在
|
||
if (!file) {
|
||
return reject('not_exists');
|
||
}
|
||
|
||
// 定时检查
|
||
var interval = setInterval(function () {
|
||
file = _this5.get(file);
|
||
if (file && file.fileObject && !file.success && !file.error && file.active) {
|
||
return;
|
||
}
|
||
|
||
if (interval) {
|
||
clearInterval(interval);
|
||
interval = false;
|
||
}
|
||
|
||
iframe.onabort({ type: file ? 'abort' : 'not_exists' });
|
||
}, 100);
|
||
|
||
var complete = void 0;
|
||
var fn = function fn(e) {
|
||
// 已经处理过了
|
||
if (complete) {
|
||
return;
|
||
}
|
||
complete = true;
|
||
|
||
if (interval) {
|
||
clearInterval(interval);
|
||
interval = false;
|
||
}
|
||
|
||
// 关闭 esc 事件
|
||
document.body.removeEventListener('keydown', onKeydown);
|
||
|
||
file = _this5.get(file);
|
||
|
||
// 不存在直接响应
|
||
if (!file) {
|
||
return reject('not_exists');
|
||
}
|
||
|
||
// 不是文件对象
|
||
if (!file.fileObject) {
|
||
return reject('file_object');
|
||
}
|
||
|
||
// 有错误自动响应
|
||
if (file.error) {
|
||
return reject(file.error);
|
||
}
|
||
|
||
// 未激活
|
||
if (!file.active) {
|
||
return reject('abort');
|
||
}
|
||
|
||
// 已完成 直接相应
|
||
if (file.success) {
|
||
return resolve(file);
|
||
}
|
||
|
||
var response = getResponseData();
|
||
var data = {};
|
||
switch (e.type) {
|
||
case 'abort':
|
||
data.error = 'abort';
|
||
break;
|
||
case 'error':
|
||
if (file.error) {
|
||
data.error = file.error;
|
||
} else if (response === null) {
|
||
data.error = 'network';
|
||
} else {
|
||
data.error = 'denied';
|
||
}
|
||
break;
|
||
default:
|
||
if (file.error) {
|
||
data.error = file.error;
|
||
} else if (data === null) {
|
||
data.error = 'network';
|
||
} else {
|
||
data.progress = '100.00';
|
||
}
|
||
}
|
||
|
||
if (response !== null) {
|
||
if (response && response.substr(0, 1) === '{' && response.substr(response.length - 1, 1) === '}') {
|
||
try {
|
||
response = JSON.parse(response);
|
||
} catch (err) {}
|
||
}
|
||
data.response = response;
|
||
}
|
||
|
||
// 更新
|
||
file = _this5.update(file, data);
|
||
|
||
if (file.error) {
|
||
return reject(file.error);
|
||
}
|
||
|
||
// 响应
|
||
return resolve(file);
|
||
};
|
||
|
||
// 添加事件
|
||
iframe.onload = fn;
|
||
iframe.onerror = fn;
|
||
iframe.onabort = fn;
|
||
|
||
// 禁止 esc 键
|
||
document.body.addEventListener('keydown', onKeydown);
|
||
|
||
// 提交
|
||
form.submit();
|
||
}, 50);
|
||
}).then(function (res) {
|
||
iframe.parentNode && iframe.parentNode.removeChild(iframe);
|
||
return res;
|
||
}).catch(function (res) {
|
||
iframe.parentNode && iframe.parentNode.removeChild(iframe);
|
||
return res;
|
||
});
|
||
},
|
||
watchActive: function watchActive(active) {
|
||
var file = void 0;
|
||
var index = 0;
|
||
while (file = this.files[index]) {
|
||
index++;
|
||
if (!file.fileObject) ; else if (active && !this.destroy) {
|
||
if (this.uploading >= this.thread || this.uploading && !this.features.html5) {
|
||
break;
|
||
}
|
||
if (!file.active && !file.error && !file.success) {
|
||
this.update(file, { active: true });
|
||
}
|
||
} else {
|
||
if (file.active) {
|
||
this.update(file, { active: false });
|
||
}
|
||
}
|
||
}
|
||
if (this.uploading === 0) {
|
||
this.active = false;
|
||
}
|
||
},
|
||
watchDrop: function watchDrop(_el) {
|
||
var el = _el;
|
||
if (!this.features.drop) {
|
||
return;
|
||
}
|
||
|
||
// 移除挂载
|
||
if (this.dropElement) {
|
||
try {
|
||
document.removeEventListener('dragenter', this.onDragenter, false);
|
||
document.removeEventListener('dragleave', this.onDragleave, false);
|
||
document.removeEventListener('drop', this.onDocumentDrop, false);
|
||
this.dropElement.removeEventListener('dragover', this.onDragover, false);
|
||
this.dropElement.removeEventListener('drop', this.onDrop, false);
|
||
} catch (e) {}
|
||
}
|
||
|
||
if (!el) {
|
||
el = false;
|
||
} else if (typeof el === 'string') {
|
||
el = document.querySelector(el) || this.$root.$el.querySelector(el);
|
||
} else if (el === true) {
|
||
el = this.$parent.$el;
|
||
}
|
||
|
||
this.dropElement = el;
|
||
|
||
if (this.dropElement) {
|
||
document.addEventListener('dragenter', this.onDragenter, false);
|
||
document.addEventListener('dragleave', this.onDragleave, false);
|
||
document.addEventListener('drop', this.onDocumentDrop, false);
|
||
this.dropElement.addEventListener('dragover', this.onDragover, false);
|
||
this.dropElement.addEventListener('drop', this.onDrop, false);
|
||
}
|
||
},
|
||
onDragenter: function onDragenter(e) {
|
||
e.preventDefault();
|
||
if (this.dropActive) {
|
||
return;
|
||
}
|
||
if (!e.dataTransfer) {
|
||
return;
|
||
}
|
||
var dt = e.dataTransfer;
|
||
if (dt.files && dt.files.length) {
|
||
this.dropActive = true;
|
||
} else if (!dt.types) {
|
||
this.dropActive = true;
|
||
} else if (dt.types.indexOf && dt.types.indexOf('Files') !== -1) {
|
||
this.dropActive = true;
|
||
} else if (dt.types.contains && dt.types.contains('Files')) {
|
||
this.dropActive = true;
|
||
}
|
||
},
|
||
onDragleave: function onDragleave(e) {
|
||
e.preventDefault();
|
||
if (!this.dropActive) {
|
||
return;
|
||
}
|
||
if (e.target.nodeName === 'HTML' || e.target === e.explicitOriginalTarget || !e.fromElement && (e.clientX <= 0 || e.clientY <= 0 || e.clientX >= window.innerWidth || e.clientY >= window.innerHeight)) {
|
||
this.dropActive = false;
|
||
}
|
||
},
|
||
onDragover: function onDragover(e) {
|
||
e.preventDefault();
|
||
},
|
||
onDocumentDrop: function onDocumentDrop() {
|
||
this.dropActive = false;
|
||
},
|
||
onDrop: function onDrop(e) {
|
||
e.preventDefault();
|
||
this.addDataTransfer(e.dataTransfer);
|
||
}
|
||
}
|
||
};
|
||
|
||
/* script */
|
||
var __vue_script__$1 = script$1;
|
||
|
||
/* template */
|
||
var __vue_render__$1 = function __vue_render__() {
|
||
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('span', { class: _vm.className }, [_vm._t("default"), _vm._v(" "), _c('label', { attrs: { "for": _vm.inputId || _vm.name } }), _vm._v(" "), _c('input-file')], 2);
|
||
};
|
||
var __vue_staticRenderFns__$1 = [];
|
||
|
||
/* style */
|
||
var __vue_inject_styles__$1 = function (inject) {
|
||
if (!inject) return;
|
||
inject("data-v-595958af_0", { source: "\n.file-uploads{overflow:hidden;position:relative;text-align:center;display:inline-block\n}\n.file-uploads.file-uploads-html4 input,.file-uploads.file-uploads-html5 label{background:#fff;opacity:0;font-size:20em;z-index:1;top:0;left:0;right:0;bottom:0;position:absolute;width:100%;height:100%\n}\n.file-uploads.file-uploads-html4 label,.file-uploads.file-uploads-html5 input{background:rgba(255,255,255,0);overflow:hidden;position:fixed;width:1px;height:1px;z-index:-1;opacity:0\n}", map: undefined, media: undefined });
|
||
};
|
||
/* scoped */
|
||
var __vue_scope_id__$1 = undefined;
|
||
/* module identifier */
|
||
var __vue_module_identifier__$1 = undefined;
|
||
/* functional template */
|
||
var __vue_is_functional_template__$1 = false;
|
||
/* component normalizer */
|
||
function __vue_normalize__$1(template, style, script, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
|
||
var component = (typeof script === 'function' ? script.options : script) || {};
|
||
|
||
if (!component.render) {
|
||
component.render = template.render;
|
||
component.staticRenderFns = template.staticRenderFns;
|
||
component._compiled = true;
|
||
|
||
if (functional) component.functional = true;
|
||
}
|
||
|
||
component._scopeId = scope;
|
||
|
||
{
|
||
var hook = void 0;
|
||
if (style) {
|
||
hook = function hook(context) {
|
||
style.call(this, createInjector(context));
|
||
};
|
||
}
|
||
|
||
if (hook !== undefined) {
|
||
if (component.functional) {
|
||
// register for functional component in vue file
|
||
var originalRender = component.render;
|
||
component.render = function renderWithStyleInjection(h, context) {
|
||
hook.call(context);
|
||
return originalRender(h, context);
|
||
};
|
||
} else {
|
||
// inject component registration as beforeCreate hook
|
||
var existing = component.beforeCreate;
|
||
component.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
||
}
|
||
}
|
||
}
|
||
|
||
return component;
|
||
}
|
||
/* style inject */
|
||
function __vue_create_injector__$1() {
|
||
var head = document.head || document.getElementsByTagName('head')[0];
|
||
var styles = __vue_create_injector__$1.styles || (__vue_create_injector__$1.styles = {});
|
||
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
||
|
||
return function addStyle(id, css) {
|
||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) return; // SSR styles are present.
|
||
|
||
var group = isOldIE ? css.media || 'default' : id;
|
||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined });
|
||
|
||
if (!style.ids.includes(id)) {
|
||
var code = css.source;
|
||
var index = style.ids.length;
|
||
|
||
style.ids.push(id);
|
||
|
||
if (css.map) {
|
||
// https://developer.chrome.com/devtools/docs/javascript-debugging
|
||
// this makes source maps inside style tags work properly in Chrome
|
||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
|
||
// http://stackoverflow.com/a/26603875
|
||
code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
|
||
}
|
||
|
||
if (isOldIE) {
|
||
style.element = style.element || document.querySelector('style[data-group=' + group + ']');
|
||
}
|
||
|
||
if (!style.element) {
|
||
var el = style.element = document.createElement('style');
|
||
el.type = 'text/css';
|
||
|
||
if (css.media) el.setAttribute('media', css.media);
|
||
if (isOldIE) {
|
||
el.setAttribute('data-group', group);
|
||
el.setAttribute('data-next-index', '0');
|
||
}
|
||
|
||
head.appendChild(el);
|
||
}
|
||
|
||
if (isOldIE) {
|
||
index = parseInt(style.element.getAttribute('data-next-index'));
|
||
style.element.setAttribute('data-next-index', index + 1);
|
||
}
|
||
|
||
if (style.element.styleSheet) {
|
||
style.parts.push(code);
|
||
style.element.styleSheet.cssText = style.parts.filter(Boolean).join('\n');
|
||
} else {
|
||
var textNode = document.createTextNode(code);
|
||
var nodes = style.element.childNodes;
|
||
if (nodes[index]) style.element.removeChild(nodes[index]);
|
||
if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
/* style inject SSR */
|
||
|
||
var FileUpload = __vue_normalize__$1({ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, __vue_create_injector__$1, undefined);
|
||
|
||
var FileUpload$1 = /*#__PURE__*/Object.freeze({
|
||
default: FileUpload
|
||
});
|
||
|
||
var require$$0 = ( FileUpload$1 && FileUpload ) || FileUpload$1;
|
||
|
||
var src = require$$0;
|
||
|
||
return src;
|
||
|
||
})));
|
||
//# sourceMappingURL=vue-upload-component.js.map
|
||
|
||
(function(){"use strict";var e={function:!0,object:!0},t=e[typeof window]&&window||this,i=e[typeof exports]&&exports,n=e[typeof module]&&module&&!module.nodeType&&module,r=i&&n&&"object"==typeof global&&global;!r||r.global!==r&&r.window!==r&&r.self!==r||(t=r);var o=Math.pow(2,53)-1,a=/\bOpera/,l=Object.prototype,s=l.hasOwnProperty,b=l.toString;function c(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function p(e){return e=x(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:c(e)}function u(e,t){for(var i in e)s.call(e,i)&&t(e[i],i,e)}function d(e){return null==e?c(e):b.call(e).slice(8,-1)}function f(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function S(e,t){var i=null;return function(e,t){var i=-1,n=e?e.length:0;if("number"==typeof n&&n>-1&&n<=o)for(;++i<n;)t(e[i],i,e);else u(e,t)}(e,function(n,r){i=t(i,n,r,e)}),i}function x(e){return String(e).replace(/^ +| +$/g,"")}var h=function e(i){var n=t,r=i&&"object"==typeof i&&"String"!=d(i);r&&(n=i,i=null);var o=n.navigator||{},l=o.userAgent||"";i||(i=l);var s,c,h,m,g,O=r?!!o.likeChrome:/\bChrome\b/.test(i)&&!/internal|\n/i.test(b.toString()),y=r?"Object":"ScriptBridgingProxyObject",M=r?"Object":"Environment",E=r&&n.java?"JavaPackage":d(n.java),v=r?"Object":"RuntimeObject",P=/\bJava/.test(E)&&n.java,w=P&&d(n.environment)==M,k=P?"a":"α",C=P?"b":"β",W=n.document||{},B=n.operamini||n.opera,A=a.test(A=r&&B?B["[[Class]]"]:d(B))?A:B=null,I=i,R=[],T=null,F=i==l,G=F&&B&&"function"==typeof B.version&&B.version(),$=S([{label:"EdgeHTML",pattern:"(?:Edge|EdgA|EdgiOS)"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],function(e,t){return e||RegExp("\\b"+(t.pattern||f(t))+"\\b","i").exec(i)&&(t.label||t)}),j=function(e){return S(e,function(e,t){return e||RegExp("\\b"+(t.pattern||f(t))+"\\b","i").exec(i)&&(t.label||t)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),X=V([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),N=function(e){return S(e,function(e,t,n){return e||(t[X]||t[/^[a-z]+(?: +[a-z]+\b)*/i.exec(X)]||RegExp("\\b"+f(n)+"(?:\\b|\\w*\\d)","i").exec(i))&&n})}({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),K=function(e){return S(e,function(e,t){var n=t.pattern||f(t);return!e&&(e=RegExp("\\b"+n+"(?:/[\\d.]+|[ \\w.]*)","i").exec(i))&&(e=function(e,t,i){var n={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&i&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(n=n[/[\d.]+$/.exec(e)])&&(e="Windows "+n),e=String(e),t&&i&&(e=e.replace(RegExp(t,"i"),i)),e=p(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,n,t.label||t)),e})}(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function V(e){return S(e,function(e,t){var n=t.pattern||f(t);return!e&&(e=RegExp("\\b"+n+" *\\d+[.\\w_]*","i").exec(i)||RegExp("\\b"+n+" *\\w+-[\\w]*","i").exec(i)||RegExp("\\b"+n+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(i))&&((e=String(t.label&&!RegExp(n,"i").test(t.label)?t.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),t=t.label||t,e=p(e[0].replace(RegExp(n,"i"),t).replace(RegExp("; *(?:"+t+"[_-])?","i")," ").replace(RegExp("("+t+")[-_.]?(\\w)","i"),"$1 $2"))),e})}if($&&($=[$]),N&&!X&&(X=V([N])),(s=/\bGoogle TV\b/.exec(X))&&(X=s[0]),/\bSimulator\b/i.test(i)&&(X=(X?X+" ":"")+"Simulator"),"Opera Mini"==j&&/\bOPiOS\b/.test(i)&&R.push("running in Turbo/Uncompressed mode"),"IE"==j&&/\blike iPhone OS\b/.test(i)?(N=(s=e(i.replace(/like iPhone OS/,""))).manufacturer,X=s.product):/^iP/.test(X)?(j||(j="Safari"),K="iOS"+((s=/ OS ([\d_]+)/i.exec(i))?" "+s[1].replace(/_/g,"."):"")):"Konqueror"!=j||/buntu/i.test(K)?N&&"Google"!=N&&(/Chrome/.test(j)&&!/\bMobile Safari\b/i.test(i)||/\bVita\b/.test(X))||/\bAndroid\b/.test(K)&&/^Chrome/.test(j)&&/\bVersion\//i.test(i)?(j="Android Browser",K=/\bAndroid\b/.test(K)?K:"Android"):"Silk"==j?(/\bMobi/i.test(i)||(K="Android",R.unshift("desktop mode")),/Accelerated *= *true/i.test(i)&&R.unshift("accelerated")):"PaleMoon"==j&&(s=/\bFirefox\/([\d.]+)\b/.exec(i))?R.push("identifying as Firefox "+s[1]):"Firefox"==j&&(s=/\b(Mobile|Tablet|TV)\b/i.exec(i))?(K||(K="Firefox OS"),X||(X=s[1])):!j||(s=!/\bMinefield\b/i.test(i)&&/\b(?:Firefox|Safari)\b/.exec(j))?(j&&!X&&/[\/,]|^[^(]+?\)/.test(i.slice(i.indexOf(s+"/")+8))&&(j=null),(s=X||N||K)&&(X||N||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(K))&&(j=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(K)?K:s)+" Browser")):"Electron"==j&&(s=(/\bChrome\/([\d.]+)\b/.exec(i)||0)[1])&&R.push("Chromium "+s):K="Kubuntu",G||(G=S(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",f(j),"(?:Firefox|Minefield|NetFront)"],function(e,t){return e||(RegExp(t+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(i)||0)[1]||null})),(s=("iCab"==$&&parseFloat(G)>3?"WebKit":/\bOpera\b/.test(j)&&(/\bOPR\b/.test(i)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(i)&&!/^(?:Trident|EdgeHTML)$/.test($)&&"WebKit"||!$&&/\bMSIE\b/i.test(i)&&("Mac OS"==K?"Tasman":"Trident")||"WebKit"==$&&/\bPlayStation\b(?! Vita\b)/i.test(j)&&"NetFront")&&($=[s]),"IE"==j&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(i)||0)[1])?(j+=" Mobile",K="Windows Phone "+(/\+$/.test(s)?s:s+".x"),R.unshift("desktop mode")):/\bWPDesktop\b/i.test(i)?(j="IE Mobile",K="Windows Phone 8.x",R.unshift("desktop mode"),G||(G=(/\brv:([\d.]+)/.exec(i)||0)[1])):"IE"!=j&&"Trident"==$&&(s=/\brv:([\d.]+)/.exec(i))&&(j&&R.push("identifying as "+j+(G?" "+G:"")),j="IE",G=s[1]),F){if(m="global",g=null!=(h=n)?typeof h[m]:"number",/^(?:boolean|number|string|undefined)$/.test(g)||"object"==g&&!h[m])d(s=n.runtime)==y?(j="Adobe AIR",K=s.flash.system.Capabilities.os):d(s=n.phantom)==v?(j="PhantomJS",G=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof W.documentMode&&(s=/\bTrident\/(\d+)/i.exec(i))?(G=[G,W.documentMode],(s=+s[1]+4)!=G[1]&&(R.push("IE "+G[1]+" mode"),$&&($[1]=""),G[1]=s),G="IE"==j?String(G[1].toFixed(1)):G[0]):"number"==typeof W.documentMode&&/^(?:Chrome|Firefox)\b/.test(j)&&(R.push("masking as "+j+" "+G),j="IE",G="11.0",$=["Trident"],K="Windows");else if(P&&(I=(s=P.lang.System).getProperty("os.arch"),K=K||s.getProperty("os.name")+" "+s.getProperty("os.version")),w){try{G=n.require("ringo/engine").version.join("."),j="RingoJS"}catch(e){(s=n.system)&&s.global.system==n.system&&(j="Narwhal",K||(K=s[0].os||null))}j||(j="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(R.push("Node "+s.versions.node),j="Electron",G=s.versions.electron):"string"==typeof s.versions.nw&&(R.push("Chromium "+G,"Node "+s.versions.node),j="NW.js",G=s.versions.nw)),j||(j="Node.js",I=s.arch,K=s.platform,G=(G=/[\d.]+/.exec(s.version))?G[0]:null));K=K&&p(K)}if(G&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(G)||/(?:alpha|beta)(?: ?\d)?/i.exec(i+";"+(F&&o.appMinorVersion))||/\bMinefield\b/i.test(i)&&"a")&&(T=/b/i.test(s)?"beta":"alpha",G=G.replace(RegExp(s+"\\+?$"),"")+("beta"==T?C:k)+(/\d+\+?/.exec(s)||"")),"Fennec"==j||"Firefox"==j&&/\b(?:Android|Firefox OS)\b/.test(K))j="Firefox Mobile";else if("Maxthon"==j&&G)G=G.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(X))"Xbox 360"==X&&(K=null),"Xbox 360"==X&&/\bIEMobile\b/.test(i)&&R.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(j)&&(!j||X||/Browser|Mobi/.test(j))||"Windows CE"!=K&&!/Mobi/i.test(i))if("IE"==j&&F)try{null===n.external&&R.unshift("platform preview")}catch(e){R.unshift("embedded")}else(/\bBlackBerry\b/.test(X)||/\bBB10\b/.test(i))&&(s=(RegExp(X.replace(/ +/g," *")+"/([.\\d]+)","i").exec(i)||0)[1]||G)?(K=((s=[s,/BB10/.test(i)])[1]?(X=null,N="BlackBerry"):"Device Software")+" "+s[0],G=null):this!=u&&"Wii"!=X&&(F&&B||/Opera/.test(j)&&/\b(?:MSIE|Firefox)\b/i.test(i)||"Firefox"==j&&/\bOS X (?:\d+\.){2,}/.test(K)||"IE"==j&&(K&&!/^Win/.test(K)&&G>5.5||/\bWindows XP\b/.test(K)&&G>8||8==G&&!/\bTrident\b/.test(i)))&&!a.test(s=e.call(u,i.replace(a,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),a.test(j)?(/\bIE\b/.test(s)&&"Mac OS"==K&&(K=null),s="identify"+s):(s="mask"+s,j=A?p(A.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(K=null),F||(G=null)),$=["Presto"],R.push(s));else j+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(i)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==j&&"+"==s[1].slice(-1)?(j="WebKit Nightly",T="alpha",G=s[1].slice(0,-1)):G!=s[1]&&G!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(i)||0)[1])||(G=null),s[1]=(/\bChrome\/([\d.]+)/i.exec(i)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==$&&($=["Blink"]),F&&(O||s[1])?($&&($[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=$?"27":"28")):($&&($[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:"8"),$&&($[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==j&&(!G||parseInt(G)>45)&&(G=s)),"Opera"==j&&(s=/\bzbov|zvav$/.exec(K))?(j+=" ",R.unshift("desktop mode"),"zvav"==s?(j+="Mini",G=null):j+="Mobile",K=K.replace(RegExp(" *"+s+"$"),"")):"Safari"==j&&/\bChrome\b/.exec($&&$[1])&&(R.unshift("desktop mode"),j="Chrome Mobile",G=null,/\bOS X\b/.test(K)?(N="Apple",K="iOS 4.3+"):K=null),G&&0==G.indexOf(s=/[\d.]+$/.exec(K))&&i.indexOf("/"+s+"-")>-1&&(K=x(K.replace(s,""))),$&&!/\b(?:Avant|Nook)\b/.test(j)&&(/Browser|Lunascape|Maxthon/.test(j)||"Safari"!=j&&/^iOS/.test(K)&&/\bSafari\b/.test($[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(j)&&$[1])&&(s=$[$.length-1])&&R.push(s),R.length&&(R=["("+R.join("; ")+")"]),N&&X&&X.indexOf(N)<0&&R.push("on "+N),X&&R.push((/^on /.test(R[R.length-1])?"":"on ")+X),K&&(s=/ ([\d.+]+)$/.exec(K),c=s&&"/"==K.charAt(K.length-s[0].length-1),K={architecture:32,family:s&&!c?K.replace(s[0],""):K,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!c?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(I))&&!/\bi686\b/i.test(I)?(K&&(K.architecture=64,K.family=K.family.replace(RegExp(" *"+s),"")),j&&(/\bWOW64\b/i.test(i)||F&&/\w(?:86|32)$/.test(o.cpuClass||o.platform)&&!/\bWin64; x64\b/i.test(i))&&R.unshift("32-bit")):K&&/^OS X/.test(K.family)&&"Chrome"==j&&parseFloat(G)>=39&&(K.architecture=64),i||(i=null);var z={};return z.description=i,z.layout=$&&$[0],z.manufacturer=N,z.name=j,z.prerelease=T,z.product=X,z.ua=i,z.version=j&&G,z.os=K||{architecture:null,family:null,version:null,toString:function(){return"null"}},z.parse=e,z.toString=function(){return this.description||""},z.version&&R.unshift(G),z.name&&R.unshift(j),K&&j&&(K!=String(K).split(" ")[0]||K!=j.split(" ")[0]&&!X)&&R.push(X?"("+K+")":"on "+K),R.length&&(z.description=R.join(" ")),z}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.platform=h,define(function(){return h})):i&&n?u(h,function(e,t){i[t]=e}):t.platform=h}).call(this);
|
||
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Vue2Editor=e():t.Vue2Editor=e()})("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=5)}([function(t,e,n){(function(e){(function(e,n){t.exports=n()})("undefined"!=typeof self&&self,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=109)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),o=n(18),i=n(19),l=n(45),a=n(46),s=n(47),u=n(48),c=n(49),f=n(12),d=n(32),p=n(33),h=n(31),y=n(1),b={Scope:y.Scope,create:y.create,find:y.find,query:y.query,register:y.register,Container:r.default,Format:o.default,Leaf:i.default,Embed:u.default,Scroll:l.default,Block:s.default,Inline:a.default,Text:c.default,Attributor:{Attribute:f.default,Class:d.default,Style:p.default,Store:h.default}};e.default=b},function(t,e,n){"use strict";function r(t,e){var n=i(t);if(null==n)throw new s("Unable to create "+t+" blot");var r=n;return new r(t instanceof Node||t.nodeType===Node.TEXT_NODE?t:r.create(e),e)}function o(t,n){return void 0===n&&(n=!1),null==t?null:null!=t[e.DATA_KEY]?t[e.DATA_KEY].blot:n?o(t.parentNode,n):null}function i(t,e){void 0===e&&(e=p.ANY);var n;if("string"==typeof t)n=d[t]||u[t];else if(t instanceof Text||t.nodeType===Node.TEXT_NODE)n=d.text;else if("number"==typeof t)t&p.LEVEL&p.BLOCK?n=d.block:t&p.LEVEL&p.INLINE&&(n=d.inline);else if(t instanceof HTMLElement){var r=(t.getAttribute("class")||"").split(/\s+/);for(var o in r)if(n=c[r[o]])break;n=n||f[t.tagName]}return null==n?null:e&p.LEVEL&n.scope&&e&p.TYPE&n.scope?n:null}function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length>1)return t.map(function(t){return l(t)});var n=t[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new s("Invalid definition");if("abstract"===n.blotName)throw new s("Cannot register abstract class");if(d[n.blotName||n.attrName]=n,"string"==typeof n.keyName)u[n.keyName]=n;else if(null!=n.className&&(c[n.className]=n),null!=n.tagName){Array.isArray(n.tagName)?n.tagName=n.tagName.map(function(t){return t.toUpperCase()}):n.tagName=n.tagName.toUpperCase();var r=Array.isArray(n.tagName)?n.tagName:[n.tagName];r.forEach(function(t){null!=f[t]&&null!=n.className||(f[t]=n)})}return n}var a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(e){var n=this;return e="[Parchment] "+e,n=t.call(this,e)||this,n.message=e,n.name=n.constructor.name,n}return a(e,t),e}(Error);e.ParchmentError=s;var u={},c={},f={},d={};e.DATA_KEY="__blot";var p;(function(t){t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY"})(p=e.Scope||(e.Scope={})),e.create=r,e.find=o,e.query=i,e.register=l},function(t,e,n){var r=n(51),o=n(11),i=n(3),l=n(20),a=String.fromCharCode(0),s=function(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]};s.prototype.insert=function(t,e){var n={};return 0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))},s.prototype.delete=function(t){return t<=0?this:this.push({delete:t})},s.prototype.retain=function(t,e){if(t<=0)return this;var n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)},s.prototype.push=function(t){var e=this.ops.length,n=this.ops[e-1];if(t=i(!0,{},t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,"object"!=typeof(n=this.ops[e-1])))return this.ops.unshift(t),this;if(o(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this},s.prototype.chop=function(){var t=this.ops[this.ops.length-1];return t&&t.retain&&!t.attributes&&this.ops.pop(),this},s.prototype.filter=function(t){return this.ops.filter(t)},s.prototype.forEach=function(t){this.ops.forEach(t)},s.prototype.map=function(t){return this.ops.map(t)},s.prototype.partition=function(t){var e=[],n=[];return this.forEach(function(r){(t(r)?e:n).push(r)}),[e,n]},s.prototype.reduce=function(t,e){return this.ops.reduce(t,e)},s.prototype.changeLength=function(){return this.reduce(function(t,e){return e.insert?t+l.length(e):e.delete?t-e.delete:t},0)},s.prototype.length=function(){return this.reduce(function(t,e){return t+l.length(e)},0)},s.prototype.slice=function(t,e){t=t||0,"number"!=typeof e&&(e=1/0);for(var n=[],r=l.iterator(this.ops),o=0;o<e&&r.hasNext();){var i;o<t?i=r.next(t-o):(i=r.next(e-o),n.push(i)),o+=l.length(i)}return new s(n)},s.prototype.compose=function(t){for(var e=l.iterator(this.ops),n=l.iterator(t.ops),r=new s;e.hasNext()||n.hasNext();)if("insert"===n.peekType())r.push(n.next());else if("delete"===e.peekType())r.push(e.next());else{var o=Math.min(e.peekLength(),n.peekLength()),i=e.next(o),a=n.next(o);if("number"==typeof a.retain){var u={};"number"==typeof i.retain?u.retain=o:u.insert=i.insert;var c=l.attributes.compose(i.attributes,a.attributes,"number"==typeof i.retain);c&&(u.attributes=c),r.push(u)}else"number"==typeof a.delete&&"number"==typeof i.retain&&r.push(a)}return r.chop()},s.prototype.concat=function(t){var e=new s(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e},s.prototype.diff=function(t,e){if(this.ops===t.ops)return new s;var n=[this,t].map(function(e){return e.map(function(n){if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;var r=e===t?"on":"with";throw new Error("diff() called "+r+" non-document")}).join("")}),i=new s,u=r(n[0],n[1],e),c=l.iterator(this.ops),f=l.iterator(t.ops);return u.forEach(function(t){for(var e=t[1].length;e>0;){var n=0;switch(t[0]){case r.INSERT:n=Math.min(f.peekLength(),e),i.push(f.next(n));break;case r.DELETE:n=Math.min(e,c.peekLength()),c.next(n),i.delete(n);break;case r.EQUAL:n=Math.min(c.peekLength(),f.peekLength(),e);var a=c.next(n),s=f.next(n);o(a.insert,s.insert)?i.retain(n,l.attributes.diff(a.attributes,s.attributes)):i.push(s).delete(n)}e-=n}}),i.chop()},s.prototype.eachLine=function(t,e){e=e||"\n";for(var n=l.iterator(this.ops),r=new s,o=0;n.hasNext();){if("insert"!==n.peekType())return;var i=n.peek(),a=l.length(i)-n.peekLength(),u="string"==typeof i.insert?i.insert.indexOf(e,a)-a:-1;if(u<0)r.push(n.next());else if(u>0)r.push(n.next(u));else{if(!1===t(r,n.next(1).attributes||{},o))return;o+=1,r=new s}}r.length()>0&&t(r,{},o)},s.prototype.transform=function(t,e){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);for(var n=l.iterator(this.ops),r=l.iterator(t.ops),o=new s;n.hasNext()||r.hasNext();)if("insert"!==n.peekType()||!e&&"insert"===r.peekType())if("insert"===r.peekType())o.push(r.next());else{var i=Math.min(n.peekLength(),r.peekLength()),a=n.next(i),u=r.next(i);if(a.delete)continue;u.delete?o.push(u):o.retain(i,l.attributes.transform(a.attributes,u.attributes,e))}else o.retain(l.length(n.next()));return o.chop()},s.prototype.transformPosition=function(t,e){e=!!e;for(var n=l.iterator(this.ops),r=0;n.hasNext()&&r<=t;){var o=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<t||!e)&&(t+=o),r+=o):t-=Math.min(o,t-r)}return t},t.exports=s},function(t,e){"use strict";var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===r.call(t)},i=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var e=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!e&&!o)return!1;var i;for(i in t);return void 0===i||n.call(t,i)};t.exports=function t(){var e,n,r,l,a,s,u=arguments[0],c=1,f=arguments.length,d=!1;for("boolean"==typeof u&&(d=u,u=arguments[1]||{},c=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});c<f;++c)if(null!=(e=arguments[c]))for(n in e)r=u[n],l=e[n],u!==l&&(d&&l&&(i(l)||(a=o(l)))?(a?(a=!1,s=r&&o(r)?r:[]):s=r&&i(r)?r:{},u[n]=t(d,s,l)):void 0!==l&&(u[n]=l));return u}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==t?e:("function"==typeof t.formats&&(e=(0,f.default)(e,t.formats())),null==t.parent||"scroll"==t.parent.blotName||t.parent.statics.scope!==t.statics.scope?e:a(t.parent,e))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BlockEmbed=e.bubbleFormats=void 0;var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},c=n(3),f=r(c),d=n(2),p=r(d),h=n(0),y=r(h),b=n(16),v=r(b),g=n(6),m=r(g),q=n(7),_=r(q),w=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),s(e,[{key:"attach",value:function(){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"attach",this).call(this),this.attributes=new y.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return(new p.default).insert(this.value(),(0,f.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(t,e){var n=y.default.query(t,y.default.Scope.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}},{key:"formatAt",value:function(t,e,n,r){this.format(n,r)}},{key:"insertAt",value:function(t,n,r){if("string"==typeof n&&n.endsWith("\n")){var o=y.default.create(k.blotName);this.parent.insertBefore(o,0===t?this:this.next),o.insertAt(0,n.slice(0,-1))}else u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,n,r)}}]),e}(y.default.Embed);w.scope=y.default.Scope.BLOCK_BLOT;var k=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.cache={},n}return l(e,t),s(e,[{key:"delta",value:function(){return null==this.cache.delta&&(this.cache.delta=this.descendants(y.default.Leaf).reduce(function(t,e){return 0===e.length()?t:t.insert(e.value(),a(e))},new p.default).insert("\n",a(this))),this.cache.delta}},{key:"deleteAt",value:function(t,n){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"deleteAt",this).call(this,t,n),this.cache={}}},{key:"formatAt",value:function(t,n,r,o){n<=0||(y.default.query(r,y.default.Scope.BLOCK)?t+n===this.length()&&this.format(r,o):u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,Math.min(n,this.length()-t-1),r,o),this.cache={})}},{key:"insertAt",value:function(t,n,r){if(null!=r)return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,n,r);if(0!==n.length){var o=n.split("\n"),i=o.shift();i.length>0&&(t<this.length()-1||null==this.children.tail?u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,Math.min(t,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});var l=this;o.reduce(function(t,e){return l=l.split(t,!0),l.insertAt(0,e),e.length},t+i.length)}}},{key:"insertBefore",value:function(t,n){var r=this.children.head;u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,n),r instanceof v.default&&r.remove(),this.cache={}}},{key:"length",value:function(){return null==this.cache.length&&(this.cache.length=u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"length",this).call(this)+1),this.cache.length}},{key:"moveChildren",value:function(t,n){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"moveChildren",this).call(this,t,n),this.cache={}}},{key:"optimize",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t),this.cache={}}},{key:"path",value:function(t){return u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"path",this).call(this,t,!0)}},{key:"removeChild",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"removeChild",this).call(this,t),this.cache={}}},{key:"split",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&(0===t||t>=this.length()-1)){var r=this.clone();return 0===t?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}var o=u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"split",this).call(this,t,n);return this.cache={},o}}]),e}(y.default.Block);k.blotName="block",k.tagName="P",k.defaultChild="break",k.allowedChildren=[m.default,y.default.Embed,_.default],e.bubbleFormats=a,e.BlockEmbed=w,e.default=k},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(e=(0,E.default)(!0,{container:t,modules:{clipboard:!0,keyboard:!0,history:!0}},e),e.theme&&e.theme!==P.DEFAULTS.theme){if(e.theme=P.import("themes/"+e.theme),null==e.theme)throw new Error("Invalid theme "+e.theme+". Did you register it?")}else e.theme=T.default;var n=(0,E.default)(!0,{},e.theme.DEFAULTS);[n,e].forEach(function(t){t.modules=t.modules||{},Object.keys(t.modules).forEach(function(e){!0===t.modules[e]&&(t.modules[e]={})})});var r=Object.keys(n.modules).concat(Object.keys(e.modules)),o=r.reduce(function(t,e){var n=P.import("modules/"+e);return null==n?S.error("Cannot load "+e+" module. Are you sure you registered it?"):t[e]=n.DEFAULTS||{},t},{});return null!=e.modules&&e.modules.toolbar&&e.modules.toolbar.constructor!==Object&&(e.modules.toolbar={container:e.modules.toolbar}),e=(0,E.default)(!0,{},P.DEFAULTS,{modules:o},n,e),["bounds","container","scrollingContainer"].forEach(function(t){"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))}),e.modules=Object.keys(e.modules).reduce(function(t,n){return e.modules[n]&&(t[n]=e.modules[n]),t},{}),e}function a(t,e,n,r){if(this.options.strict&&!this.isEnabled()&&e===g.default.sources.USER)return new h.default;var o=null==n?null:this.getSelection(),i=this.editor.delta,l=t();if(null!=o&&(!0===n&&(n=o.index),null==r?o=u(o,l,e):0!==r&&(o=u(o,n,r,e)),this.setSelection(o,g.default.sources.SILENT)),l.length()>0){var a,s=[g.default.events.TEXT_CHANGE,l,i,e];if((a=this.emitter).emit.apply(a,[g.default.events.EDITOR_CHANGE].concat(s)),e!==g.default.sources.SILENT){var c;(c=this.emitter).emit.apply(c,s)}}return l}function s(t,e,n,r,o){var i={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(o=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(o=r,r=n,n=e,e=0),"object"===(void 0===n?"undefined":c(n))?(i=n,o=r):"string"==typeof n&&(null!=r?i[n]=r:o=n),o=o||g.default.sources.API,[t,e,i,o]}function u(t,e,n,r){if(null==t)return null;var o=void 0,i=void 0;if(e instanceof h.default){var l=[t.index,t.index+t.length].map(function(t){return e.transformPosition(t,r!==g.default.sources.USER)}),a=f(l,2);o=a[0],i=a[1]}else{var s=[t.index,t.index+t.length].map(function(t){return t<e||t===e&&r===g.default.sources.USER?t:n>=0?t+n:Math.max(e,t+n)}),u=f(s,2);o=u[0],i=u[1]}return new k.Range(o,i-o)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.overload=e.expandConfig=void 0;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();n(50);var p=n(2),h=r(p),y=n(14),b=r(y),v=n(8),g=r(v),m=n(9),q=r(m),_=n(0),w=r(_),k=n(15),O=r(k),x=n(3),E=r(x),A=n(10),j=r(A),N=n(34),T=r(N),S=(0,j.default)("quill"),P=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(this,t),this.options=l(e,r),this.container=this.options.container,null==this.container)return S.error("Invalid Quill container",e);this.options.debug&&t.debug(this.options.debug);var o=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new g.default,this.scroll=w.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new b.default(this.scroll),this.selection=new O.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(g.default.events.EDITOR_CHANGE,function(t){t===g.default.events.TEXT_CHANGE&&n.root.classList.toggle("ql-blank",n.editor.isBlank())}),this.emitter.on(g.default.events.SCROLL_UPDATE,function(t,e){var r=n.selection.lastRange,o=r&&0===r.length?r.index:void 0;a.call(n,function(){return n.editor.update(null,e,o)},t)});var s=this.clipboard.convert("<div class='ql-editor' style=\"white-space: normal;\">"+o+"<p><br></p></div>");this.setContents(s),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return d(t,null,[{key:"debug",value:function(t){!0===t&&(t="log"),j.default.level(t)}},{key:"find",value:function(t){return t.__quill||w.default.find(t)}},{key:"import",value:function(t){return null==this.imports[t]&&S.error("Cannot import "+t+". Are you sure it was registered?"),this.imports[t]}},{key:"register",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof t){var o=t.attrName||t.blotName;"string"==typeof o?this.register("formats/"+o,t,e):Object.keys(t).forEach(function(r){n.register(r,t[r],e)})}else null==this.imports[t]||r||S.warn("Overwriting "+t+" with",e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&"abstract"!==e.blotName?w.default.register(e):t.startsWith("modules")&&"function"==typeof e.register&&e.register()}}]),d(t,[{key:"addContainer",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){var n=t;t=document.createElement("div"),t.classList.add(n)}return this.container.insertBefore(t,e),t}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(t,e,n){var r=this,o=s(t,e,n),i=f(o,4);return t=i[0],e=i[1],n=i[3],a.call(this,function(){return r.editor.deleteText(t,e)},n,t,-1*e)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}},{key:"focus",value:function(){var t=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=t,this.scrollIntoView()}},{key:"format",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g.default.sources.API;return a.call(this,function(){var r=n.getSelection(!0),i=new h.default;if(null==r)return i;if(w.default.query(t,w.default.Scope.BLOCK))i=n.editor.formatLine(r.index,r.length,o({},t,e));else{if(0===r.length)return n.selection.format(t,e),i;i=n.editor.formatText(r.index,r.length,o({},t,e))}return n.setSelection(r,g.default.sources.SILENT),i},r)}},{key:"formatLine",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,e,n,r,o),c=f(u,4);return t=c[0],e=c[1],l=c[2],o=c[3],a.call(this,function(){return i.editor.formatLine(t,e,l)},o,t,0)}},{key:"formatText",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,e,n,r,o),c=f(u,4);return t=c[0],e=c[1],l=c[2],o=c[3],a.call(this,function(){return i.editor.formatText(t,e,l)},o,t,0)}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=void 0;n="number"==typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.length);var r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}},{key:"getContents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,n=s(t,e),r=f(n,2);return t=r[0],e=r[1],this.editor.getContents(t,e)}},{key:"getFormat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}},{key:"getIndex",value:function(t){return t.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(t){return this.scroll.leaf(t)}},{key:"getLine",value:function(t){return this.scroll.line(t)}},{key:"getLines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}},{key:"getModule",value:function(t){return this.theme.modules[t]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t,n=s(t,e),r=f(n,2);return t=r[0],e=r[1],this.editor.getText(t,e)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(e,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return a.call(this,function(){return o.editor.insertEmbed(e,n,r)},i,e)}},{key:"insertText",value:function(t,e,n,r,o){var i=this,l=void 0,u=s(t,0,n,r,o),c=f(u,4);return t=c[0],l=c[2],o=c[3],a.call(this,function(){return i.editor.insertText(t,e,l)},o,t,e.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(t,e,n){this.clipboard.dangerouslyPasteHTML(t,e,n)}},{key:"removeFormat",value:function(t,e,n){var r=this,o=s(t,e,n),i=f(o,4);return t=i[0],e=i[1],n=i[3],a.call(this,function(){return r.editor.removeFormat(t,e)},n,t)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API;return a.call(this,function(){t=new h.default(t);var n=e.getLength(),r=e.editor.deleteText(0,n),o=e.editor.applyDelta(t),i=o.ops[o.ops.length-1];return null!=i&&"string"==typeof i.insert&&"\n"===i.insert[i.insert.length-1]&&(e.editor.deleteText(e.getLength()-1,1),o.delete(1)),r.compose(o)},n)}},{key:"setSelection",value:function(e,n,r){if(null==e)this.selection.setRange(null,n||t.sources.API);else{var o=s(e,n,r),i=f(o,4);e=i[0],n=i[1],r=i[3],this.selection.setRange(new k.Range(e,n),r),r!==g.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API,n=(new h.default).insert(t);return this.setContents(n,e)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.default.sources.USER,e=this.scroll.update(t);return this.selection.update(t),e}},{key:"updateContents",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.default.sources.API;return a.call(this,function(){return t=new h.default(t),e.editor.applyDelta(t,n)},n,!0)}}]),t}();P.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},P.events=g.default.events,P.sources=g.default.sources,P.version="1.3.6",P.imports={delta:h.default,parchment:w.default,"core/module":q.default,"core/theme":T.default},e.expandConfig=l,e.overload=s,e.default=P},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(7),c=r(u),f=n(0),d=r(f),p=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),a(e,[{key:"formatAt",value:function(t,n,r,o){if(e.compare(this.statics.blotName,r)<0&&d.default.query(r,d.default.Scope.BLOT)){var i=this.isolate(t,n);o&&i.wrap(r,o)}else s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,n,r,o)}},{key:"optimize",value:function(t){if(s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){var n=this.parent.isolate(this.offset(),this.length());this.moveChildren(n),n.wrap(this)}}}],[{key:"compare",value:function(t,n){var r=e.order.indexOf(t),o=e.order.indexOf(n);return r>=0||o>=0?r-o:t===n?0:t<n?-1:1}}]),e}(d.default.Inline);p.allowedChildren=[p,d.default.Embed,c.default],p.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],e.default=p},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(0),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default.Text);e.default=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(54),c=r(u),f=n(10),d=r(f),p=(0,d.default)("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(function(t){document.addEventListener(t,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(t){if(t.__quill&&t.__quill.emitter){var n;(n=t.__quill.emitter).handleDOM.apply(n,e)}})})});var h=function(t){function e(){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.listeners={},t.on("error",p.error),t}return l(e,t),a(e,[{key:"emit",value:function(){p.log.apply(p,arguments),s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(this.listeners[t.type]||[]).forEach(function(e){var r=e.node,o=e.handler;(t.target===r||r.contains(t.target))&&o.apply(void 0,[t].concat(n))})}},{key:"listenDOM",value:function(t,e,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push({node:e,handler:n})}}]),e}(c.default);h.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},h.sources={API:"api",SILENT:"silent",USER:"user"},e.default=h},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,t),this.quill=e,this.options=n};o.DEFAULTS={},e.default=o},function(t,e,n){"use strict";function r(t){if(i.indexOf(t)<=i.indexOf(l)){for(var e,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console)[t].apply(e,r)}}function o(t){return i.reduce(function(e,n){return e[n]=r.bind(console,n,t),e},{})}Object.defineProperty(e,"__esModule",{value:!0});var i=["error","warn","log","info"],l="warn";r.level=o.level=function(t){l=t},e.default=o},function(t,e,n){function r(t){return null===t||void 0===t}function o(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}function i(t,e,n){var i,c;if(r(t)||r(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return!!s(e)&&(t=l.call(t),e=l.call(e),u(t,e,n));if(o(t)){if(!o(e))return!1;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}try{var f=a(t),d=a(e)}catch(t){return!1}if(f.length!=d.length)return!1;for(f.sort(),d.sort(),i=f.length-1;i>=0;i--)if(f[i]!=d[i])return!1;for(i=f.length-1;i>=0;i--)if(c=f[i],!u(t[c],e[c],n))return!1;return typeof t==typeof e}var l=Array.prototype.slice,a=n(52),s=n(53),u=t.exports=function(t,e,n){return n||(n={}),t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?t===e:t==e:i(t,e,n))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=function(){function t(t,e,n){void 0===n&&(n={}),this.attrName=t,this.keyName=e;var o=r.Scope.TYPE&r.Scope.ATTRIBUTE;null!=n.scope?this.scope=n.scope&r.Scope.LEVEL|o:this.scope=r.Scope.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}return t.keys=function(t){return[].map.call(t.attributes,function(t){return t.name})},t.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)},t.prototype.canAdd=function(t,e){return null!=r.query(t,r.Scope.BLOT&(this.scope|r.Scope.TYPE))&&(null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1))},t.prototype.remove=function(t){t.removeAttribute(this.keyName)},t.prototype.value=function(t){var e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""},t}();e.default=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Code=void 0;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},c=n(2),f=r(c),d=n(0),p=r(d),h=n(4),y=r(h),b=n(6),v=r(b),g=n(7),m=r(g),q=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),e}(v.default);q.blotName="code",q.tagName="CODE";var _=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),s(e,[{key:"delta",value:function(){var t=this,e=this.domNode.textContent;return e.endsWith("\n")&&(e=e.slice(0,-1)),e.split("\n").reduce(function(e,n){return e.insert(n).insert("\n",t.formats())},new f.default)}},{key:"format",value:function(t,n){if(t!==this.statics.blotName||!n){var r=this.descendant(m.default,this.length()-1),o=a(r,1),i=o[0];null!=i&&i.deleteAt(i.length()-1,1),u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n)}}},{key:"formatAt",value:function(t,n,r,o){if(0!==n&&null!=p.default.query(r,p.default.Scope.BLOCK)&&(r!==this.statics.blotName||o!==this.statics.formats(this.domNode))){var i=this.newlineIndex(t);if(!(i<0||i>=t+n)){var l=this.newlineIndex(t,!0)+1,a=i-l+1,s=this.isolate(l,a),u=s.next;s.format(r,o),u instanceof e&&u.formatAt(0,t-l+n-a,r,o)}}}},{key:"insertAt",value:function(t,e,n){if(null==n){var r=this.descendant(m.default,t),o=a(r,2),i=o[0],l=o[1];i.insertAt(l,e)}}},{key:"length",value:function(){var t=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?t:t+1}},{key:"newlineIndex",value:function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,t).lastIndexOf("\n");var e=this.domNode.textContent.slice(t).indexOf("\n");return e>-1?t+e:-1}},{key:"optimize",value:function(t){this.domNode.textContent.endsWith("\n")||this.appendChild(p.default.create("text","\n")),u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===n.statics.formats(n.domNode)&&(n.optimize(t),n.moveChildren(this),n.remove())}},{key:"replace",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(t){var e=p.default.find(t);null==e?t.parentNode.removeChild(t):e instanceof p.default.Embed?e.remove():e.unwrap()})}}],[{key:"create",value:function(t){var n=u(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return n.setAttribute("spellcheck",!1),n}},{key:"formats",value:function(){return!0}}]),e}(y.default);_.blotName="code-block",_.tagName="PRE",_.TAB=" ",e.Code=q,e.default=_},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){return Object.keys(e).reduce(function(n,r){return null==t[r]?n:(e[r]===t[r]?n[r]=e[r]:Array.isArray(e[r])?e[r].indexOf(t[r])<0&&(n[r]=e[r].concat([t[r]])):n[r]=[e[r],t[r]],n)},{})}function a(t){return t.reduce(function(t,e){if(1===e.insert){var n=(0,E.default)(e.attributes);return delete n.image,t.insert({image:e.attributes.image},n)}if(null==e.attributes||!0!==e.attributes.list&&!0!==e.attributes.bullet||(e=(0,E.default)(e),e.attributes.list?e.attributes.list="ordered":(e.attributes.list="bullet",delete e.attributes.bullet)),"string"==typeof e.insert){var r=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(r,e.attributes)}return t.push(e)},new d.default)}Object.defineProperty(e,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=n(2),d=r(f),p=n(20),h=r(p),y=n(0),b=r(y),v=n(13),g=r(v),m=n(24),q=r(m),_=n(4),w=r(_),k=n(16),O=r(k),x=n(21),E=r(x),A=n(11),j=r(A),N=n(3),T=r(N),S=/^[ -~]*$/,P=function(){function t(e){i(this,t),this.scroll=e,this.delta=this.getDelta()}return c(t,[{key:"applyDelta",value:function(t){var e=this,n=!1;this.scroll.update();var r=this.scroll.length();return this.scroll.batchStart(),t=a(t),t.reduce(function(t,o){var i=o.retain||o.delete||o.insert.length||1,l=o.attributes||{};if(null!=o.insert){if("string"==typeof o.insert){var a=o.insert;a.endsWith("\n")&&n&&(n=!1,a=a.slice(0,-1)),t>=r&&!a.endsWith("\n")&&(n=!0),e.scroll.insertAt(t,a);var c=e.scroll.line(t),f=u(c,2),d=f[0],p=f[1],y=(0,T.default)({},(0,_.bubbleFormats)(d));if(d instanceof w.default){var v=d.descendant(b.default.Leaf,p),g=u(v,1),m=g[0];y=(0,T.default)(y,(0,_.bubbleFormats)(m))}l=h.default.attributes.diff(y,l)||{}}else if("object"===s(o.insert)){var q=Object.keys(o.insert)[0];if(null==q)return t;e.scroll.insertAt(t,q,o.insert[q])}r+=i}return Object.keys(l).forEach(function(n){e.scroll.formatAt(t,i,n,l[n])}),t+i},0),t.reduce(function(t,n){return"number"==typeof n.delete?(e.scroll.deleteAt(t,n.delete),t):t+(n.retain||n.insert.length||1)},0),this.scroll.batchEnd(),this.update(t)}},{key:"deleteText",value:function(t,e){return this.scroll.deleteAt(t,e),this.update((new d.default).retain(t).delete(e))}},{key:"formatLine",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(r).forEach(function(o){if(null==n.scroll.whitelist||n.scroll.whitelist[o]){var i=n.scroll.lines(t,Math.max(e,1)),l=e;i.forEach(function(e){var i=e.length();if(e instanceof g.default){var a=t-e.offset(n.scroll),s=e.newlineIndex(a+l)-a+1;e.formatAt(a,s,o,r[o])}else e.format(o,r[o]);l-=i})}}),this.scroll.optimize(),this.update((new d.default).retain(t).retain(e,(0,E.default)(r)))}},{key:"formatText",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(r).forEach(function(o){n.scroll.formatAt(t,e,o,r[o])}),this.update((new d.default).retain(t).retain(e,(0,E.default)(r)))}},{key:"getContents",value:function(t,e){return this.delta.slice(t,t+e)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(t,e){return t.concat(e.delta())},new d.default)}},{key:"getFormat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(function(t){var e=u(t,1),o=e[0];o instanceof w.default?n.push(o):o instanceof b.default.Leaf&&r.push(o)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(b.default.Leaf,t,e));var o=[n,r].map(function(t){if(0===t.length)return{};for(var e=(0,_.bubbleFormats)(t.shift());Object.keys(e).length>0;){var n=t.shift();if(null==n)return e;e=l((0,_.bubbleFormats)(n),e)}return e});return T.default.apply(T.default,o)}},{key:"getText",value:function(t,e){return this.getContents(t,e).filter(function(t){return"string"==typeof t.insert}).map(function(t){return t.insert}).join("")}},{key:"insertEmbed",value:function(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new d.default).retain(t).insert(o({},e,n)))}},{key:"insertText",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(r).forEach(function(o){n.scroll.formatAt(t,e.length,o,r[o])}),this.update((new d.default).retain(t).insert(e,(0,E.default)(r)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var t=this.scroll.children.head;return t.statics.blotName===w.default.blotName&&(!(t.children.length>1)&&t.children.head instanceof O.default)}},{key:"removeFormat",value:function(t,e){var n=this.getText(t,e),r=this.scroll.line(t+e),o=u(r,2),i=o[0],l=o[1],a=0,s=new d.default;null!=i&&(a=i instanceof g.default?i.newlineIndex(l)-l+1:i.length()-l,s=i.delta().slice(l,l+a-1).insert("\n"));var c=this.getContents(t,e+a),f=c.diff((new d.default).insert(n).concat(s)),p=(new d.default).retain(t).concat(f);return this.applyDelta(p)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(S)&&b.default.find(e[0].target)){var o=b.default.find(e[0].target),i=(0,_.bubbleFormats)(o),l=o.offset(this.scroll),a=e[0].oldValue.replace(q.default.CONTENTS,""),s=(new d.default).insert(a),u=(new d.default).insert(o.value());t=(new d.default).retain(l).concat(s.diff(u,n)).reduce(function(t,e){return e.insert?t.insert(e.insert,i):t.push(e)},new d.default),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&(0,j.default)(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}]),t}();e.default=P},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){try{e.parentNode}catch(t){return!1}return e instanceof Text&&(e=e.parentNode),t.contains(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Range=void 0;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(0),c=r(u),f=n(21),d=r(f),p=n(11),h=r(p),y=n(8),b=r(y),v=n(10),g=r(v),m=(0,g.default)("quill:selection"),q=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.index=e,this.length=n},_=function(){function t(e,n){var r=this;i(this,t),this.emitter=n,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=c.default.create("cursor",this),this.lastRange=this.savedRange=new q(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){r.mouseDown||setTimeout(r.update.bind(r,b.default.sources.USER),1)}),this.emitter.on(b.default.events.EDITOR_CHANGE,function(t,e){t===b.default.events.TEXT_CHANGE&&e.length()>0&&r.update(b.default.sources.SILENT)}),this.emitter.on(b.default.events.SCROLL_BEFORE_UPDATE,function(){if(r.hasFocus()){var t=r.getNativeRange();null!=t&&t.start.node!==r.cursor.textNode&&r.emitter.once(b.default.events.SCROLL_UPDATE,function(){try{r.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset)}catch(t){}})}}),this.emitter.on(b.default.events.SCROLL_OPTIMIZE,function(t,e){if(e.range){var n=e.range,o=n.startNode,i=n.startOffset,l=n.endNode,a=n.endOffset;r.setNativeRange(o,i,l,a)}}),this.update(b.default.sources.SILENT)}return s(t,[{key:"handleComposition",value:function(){var t=this;this.root.addEventListener("compositionstart",function(){t.composing=!0}),this.root.addEventListener("compositionend",function(){if(t.composing=!1,t.cursor.parent){var e=t.cursor.restore();if(!e)return;setTimeout(function(){t.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}},{key:"handleDragging",value:function(){var t=this;this.emitter.listenDOM("mousedown",document.body,function(){t.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){t.mouseDown=!1,t.update(b.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(t,e){if(null==this.scroll.whitelist||this.scroll.whitelist[t]){this.scroll.update();var n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!c.default.query(t,c.default.Scope.BLOCK)){if(n.start.node!==this.cursor.textNode){var r=c.default.find(n.start.node,!1);if(null==r)return;if(r instanceof c.default.Leaf){var o=r.split(n.start.offset);r.parent.insertBefore(this.cursor,o)}else r.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.scroll.length();t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;var r=void 0,o=this.scroll.leaf(t),i=a(o,2),l=i[0],s=i[1];if(null==l)return null;var u=l.position(s,!0),c=a(u,2);r=c[0],s=c[1];var f=document.createRange();if(e>0){f.setStart(r,s);var d=this.scroll.leaf(t+e),p=a(d,2);if(l=p[0],s=p[1],null==l)return null;var h=l.position(s,!0),y=a(h,2);return r=y[0],s=y[1],f.setEnd(r,s),f.getBoundingClientRect()}var b="left",v=void 0;return r instanceof Text?(s<r.data.length?(f.setStart(r,s),f.setEnd(r,s+1)):(f.setStart(r,s-1),f.setEnd(r,s),b="right"),v=f.getBoundingClientRect()):(v=l.domNode.getBoundingClientRect(),s>0&&(b="right")),{bottom:v.top+v.height,height:v.height,left:v[b],right:v[b],top:v.top,width:0}}},{key:"getNativeRange",value:function(){var t=document.getSelection();if(null==t||t.rangeCount<=0)return null;var e=t.getRangeAt(0);if(null==e)return null;var n=this.normalizeNative(e);return m.info("getNativeRange",n),n}},{key:"getRange",value:function(){var t=this.getNativeRange();return null==t?[null,null]:[this.normalizedToRange(t),t]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(t){var e=this,n=[[t.start.node,t.start.offset]];t.native.collapsed||n.push([t.end.node,t.end.offset]);var r=n.map(function(t){var n=a(t,2),r=n[0],o=n[1],i=c.default.find(r,!0),l=i.offset(e.scroll);return 0===o?l:i instanceof c.default.Container?l+i.length():l+i.index(r,o)}),i=Math.min(Math.max.apply(Math,o(r)),this.scroll.length()-1),l=Math.min.apply(Math,[i].concat(o(r)));return new q(l,i-l)}},{key:"normalizeNative",value:function(t){if(!l(this.root,t.startContainer)||!t.collapsed&&!l(this.root,t.endContainer))return null;var e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(function(t){for(var e=t.node,n=t.offset;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}},{key:"rangeToNative",value:function(t){var e=this,n=t.collapsed?[t.index]:[t.index,t.index+t.length],r=[],o=this.scroll.length();return n.forEach(function(t,n){t=Math.min(o-1,t);var i=void 0,l=e.scroll.leaf(t),s=a(l,2),u=s[0],c=s[1],f=u.position(c,0!==n),d=a(f,2);i=d[0],c=d[1],r.push(i,c)}),r.length<2&&(r=r.concat(r)),r}},{key:"scrollIntoView",value:function(t){var e=this.lastRange;if(null!=e){var n=this.getBounds(e.index,e.length);if(null!=n){var r=this.scroll.length()-1,o=this.scroll.line(Math.min(e.index,r)),i=a(o,1),l=i[0],s=l;if(e.length>0){var u=this.scroll.line(Math.min(e.index+e.length,r));s=a(u,1)[0]}if(null!=l&&null!=s){var c=t.getBoundingClientRect();n.top<c.top?t.scrollTop-=c.top-n.top:n.bottom>c.bottom&&(t.scrollTop+=n.bottom-c.bottom)}}}}},{key:"setNativeRange",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(m.info("setNativeRange",t,e,n,r),null==t||null!=this.root.parentNode&&null!=t.parentNode&&null!=n.parentNode){var i=document.getSelection();if(null!=i)if(null!=t){this.hasFocus()||this.root.focus();var l=(this.getNativeRange()||{}).native;if(null==l||o||t!==l.startContainer||e!==l.startOffset||n!==l.endContainer||r!==l.endOffset){"BR"==t.tagName&&(e=[].indexOf.call(t.parentNode.childNodes,t),t=t.parentNode),"BR"==n.tagName&&(r=[].indexOf.call(n.parentNode.childNodes,n),n=n.parentNode);var a=document.createRange();a.setStart(t,e),a.setEnd(n,r),i.removeAllRanges(),i.addRange(a)}}else i.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b.default.sources.API;if("string"==typeof e&&(n=e,e=!1),m.info("setRange",t),null!=t){var r=this.rangeToNative(t);this.setNativeRange.apply(this,o(r).concat([e]))}else this.setNativeRange(null);this.update(n)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b.default.sources.USER,e=this.lastRange,n=this.getRange(),r=a(n,2),o=r[0],i=r[1];if(this.lastRange=o,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,h.default)(e,this.lastRange)){var l;!this.composing&&null!=i&&i.native.collapsed&&i.start.node!==this.cursor.textNode&&this.cursor.restore();var s=[b.default.events.SELECTION_CHANGE,(0,d.default)(this.lastRange),(0,d.default)(e),t];if((l=this.emitter).emit.apply(l,[b.default.events.EDITOR_CHANGE].concat(s)),t!==b.default.sources.SILENT){var u;(u=this.emitter).emit.apply(u,s)}}}}]),t}();e.Range=q,e.default=_},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"insertInto",value:function(t,n){0===t.children.length?a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertInto",this).call(this,t,n):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),e}(u.default.Embed);c.blotName="break",c.tagName="BR",e.default=c},function(t,e,n){"use strict";function r(t){var e=a.find(t);if(null==e)try{e=a.create(t)}catch(n){e=a.create(a.Scope.INLINE),[].slice.call(t.childNodes).forEach(function(t){e.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(e.domNode,t),e.attach()}return e}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(44),l=n(30),a=n(1),s=function(t){function e(e){var n=t.call(this,e)||this;return n.build(),n}return o(e,t),e.prototype.appendChild=function(t){this.insertBefore(t)},e.prototype.attach=function(){t.prototype.attach.call(this),this.children.forEach(function(t){t.attach()})},e.prototype.build=function(){var t=this;this.children=new i.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(e){try{var n=r(e);t.insertBefore(n,t.children.head||void 0)}catch(t){if(t instanceof a.ParchmentError)return;throw t}})},e.prototype.deleteAt=function(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,function(t,e,n){t.deleteAt(e,n)})},e.prototype.descendant=function(t,n){var r=this.children.find(n),o=r[0],i=r[1];return null==t.blotName&&t(o)||null!=t.blotName&&o instanceof t?[o,i]:o instanceof e?o.descendant(t,i):[null,-1]},e.prototype.descendants=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=Number.MAX_VALUE);var o=[],i=r;return this.children.forEachAt(n,r,function(n,r,l){(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&o.push(n),n instanceof e&&(o=o.concat(n.descendants(t,r,i))),i-=l}),o},e.prototype.detach=function(){this.children.forEach(function(t){t.detach()}),t.prototype.detach.call(this)},e.prototype.formatAt=function(t,e,n,r){this.children.forEachAt(t,e,function(t,e,o){t.formatAt(e,o,n,r)})},e.prototype.insertAt=function(t,e,n){var r=this.children.find(t),o=r[0],i=r[1];if(o)o.insertAt(i,e,n);else{var l=null==n?a.create("text",e):a.create(e,n);this.appendChild(l)}},e.prototype.insertBefore=function(t,e){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(e){return t instanceof e}))throw new a.ParchmentError("Cannot insert "+t.statics.blotName+" into "+this.statics.blotName);t.insertInto(this,e)},e.prototype.length=function(){return this.children.reduce(function(t,e){return t+e.length()},0)},e.prototype.moveChildren=function(t,e){this.children.forEach(function(n){t.insertBefore(n,e)})},e.prototype.optimize=function(e){if(t.prototype.optimize.call(this,e),0===this.children.length)if(null!=this.statics.defaultChild){var n=a.create(this.statics.defaultChild);this.appendChild(n),n.optimize(e)}else this.remove()},e.prototype.path=function(t,n){void 0===n&&(n=!1);var r=this.children.find(t,n),o=r[0],i=r[1],l=[[this,t]];return o instanceof e?l.concat(o.path(i,n)):(null!=o&&l.push([o,i]),l)},e.prototype.removeChild=function(t){this.children.remove(t)},e.prototype.replace=function(n){n instanceof e&&n.moveChildren(this),t.prototype.replace.call(this,n)},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var n=this.clone();return this.parent.insertBefore(n,this.next),this.children.forEachAt(t,this.length(),function(t,r,o){t=t.split(r,e),n.appendChild(t)}),n},e.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},e.prototype.update=function(t,e){var n=this,o=[],i=[];t.forEach(function(t){t.target===n.domNode&&"childList"===t.type&&(o.push.apply(o,t.addedNodes),i.push.apply(i,t.removedNodes))}),i.forEach(function(t){if(!(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var e=a.find(t);null!=e&&(null!=e.domNode.parentNode&&e.domNode.parentNode!==n.domNode||e.detach())}}),o.filter(function(t){return t.parentNode==n.domNode}).sort(function(t,e){return t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(t){var e=null;null!=t.nextSibling&&(e=a.find(t.nextSibling));var o=r(t);o.next==e&&null!=o.next||(null!=o.parent&&o.parent.removeChild(n),n.insertBefore(o,e||void 0))})},e}(l.default);e.default=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(12),i=n(31),l=n(17),a=n(1),s=function(t){function e(e){var n=t.call(this,e)||this;return n.attributes=new i.default(n.domNode),n}return r(e,t),e.formats=function(t){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?t.tagName.toLowerCase():void 0)},e.prototype.format=function(t,e){var n=a.query(t);n instanceof o.default?this.attributes.attribute(n,e):e&&(null==n||t===this.statics.blotName&&this.formats()[t]===e||this.replaceWith(t,e))},e.prototype.formats=function(){var t=this.attributes.values(),e=this.statics.formats(this.domNode);return null!=e&&(t[this.statics.blotName]=e),t},e.prototype.replaceWith=function(e,n){var r=t.prototype.replaceWith.call(this,e,n);return this.attributes.copy(r),r},e.prototype.update=function(e,n){var r=this;t.prototype.update.call(this,e,n),e.some(function(t){return t.target===r.domNode&&"attributes"===t.type})&&this.attributes.build()},e.prototype.wrap=function(n,r){var o=t.prototype.wrap.call(this,n,r);return o instanceof e&&o.statics.scope===this.statics.scope&&this.attributes.move(o),o},e}(l.default);e.default=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(30),i=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.value=function(t){return!0},e.prototype.index=function(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1},e.prototype.position=function(t,e){var n=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]},e.prototype.value=function(){return t={},t[this.statics.blotName]=this.statics.value(this.domNode)||!0,t;var t},e.scope=i.Scope.INLINE_BLOT,e}(o.default);e.default=l},function(t,e,n){function r(t){this.ops=t,this.index=0,this.offset=0}var o=n(11),i=n(3),l={attributes:{compose:function(t,e,n){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var r=i(!0,{},e);n||(r=Object.keys(r).reduce(function(t,e){return null!=r[e]&&(t[e]=r[e]),t},{}));for(var o in t)void 0!==t[o]&&void 0===e[o]&&(r[o]=t[o]);return Object.keys(r).length>0?r:void 0},diff:function(t,e){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});var n=Object.keys(t).concat(Object.keys(e)).reduce(function(n,r){return o(t[r],e[r])||(n[r]=void 0===e[r]?null:e[r]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(t,e,n){if("object"!=typeof t)return e;if("object"==typeof e){if(!n)return e;var r=Object.keys(e).reduce(function(n,r){return void 0===t[r]&&(n[r]=e[r]),n},{});return Object.keys(r).length>0?r:void 0}}},iterator:function(t){return new r(t)},length:function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"string"==typeof t.insert?t.insert.length:1}};r.prototype.hasNext=function(){return this.peekLength()<1/0},r.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var n=this.offset,r=l.length(e);if(t>=r-n?(t=r-n,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};var o={};return e.attributes&&(o.attributes=e.attributes),"number"==typeof e.retain?o.retain=t:"string"==typeof e.insert?o.insert=e.insert.substr(n,t):o.insert=e.insert,o}return{retain:1/0}},r.prototype.peek=function(){return this.ops[this.index]},r.prototype.peekLength=function(){return this.ops[this.index]?l.length(this.ops[this.index])-this.offset:1/0},r.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},t.exports=l},function(t,n){var r=function(){"use strict";function t(t,e){return null!=e&&t instanceof e}function n(r,o,i,l,f){function d(r,i){if(null===r)return null;if(0===i)return r;var b,v;if("object"!=typeof r)return r;if(t(r,s))b=new s;else if(t(r,u))b=new u;else if(t(r,c))b=new c(function(t,e){r.then(function(e){t(d(e,i-1))},function(t){e(d(t,i-1))})});else if(n.__isArray(r))b=[];else if(n.__isRegExp(r))b=new RegExp(r.source,a(r)),r.lastIndex&&(b.lastIndex=r.lastIndex);else if(n.__isDate(r))b=new Date(r.getTime());else{if(y&&e.isBuffer(r))return b=new e(r.length),r.copy(b),b;t(r,Error)?b=Object.create(r):void 0===l?(v=Object.getPrototypeOf(r),b=Object.create(v)):(b=Object.create(l),v=l)}if(o){var g=p.indexOf(r);if(-1!=g)return h[g];p.push(r),h.push(b)}t(r,s)&&r.forEach(function(t,e){var n=d(e,i-1),r=d(t,i-1);b.set(n,r)}),t(r,u)&&r.forEach(function(t){var e=d(t,i-1);b.add(e)});for(var m in r){var q;v&&(q=Object.getOwnPropertyDescriptor(v,m)),q&&null==q.set||(b[m]=d(r[m],i-1))}if(Object.getOwnPropertySymbols)for(var _=Object.getOwnPropertySymbols(r),m=0;m<_.length;m++){var w=_[m],k=Object.getOwnPropertyDescriptor(r,w);(!k||k.enumerable||f)&&(b[w]=d(r[w],i-1),k.enumerable||Object.defineProperty(b,w,{enumerable:!1}))}if(f)for(var O=Object.getOwnPropertyNames(r),m=0;m<O.length;m++){var x=O[m],k=Object.getOwnPropertyDescriptor(r,x);k&&k.enumerable||(b[x]=d(r[x],i-1),Object.defineProperty(b,x,{enumerable:!1}))}return b}"object"==typeof o&&(i=o.depth,l=o.prototype,f=o.includeNonEnumerable,o=o.circular);var p=[],h=[],y=void 0!==e;return void 0===o&&(o=!0),void 0===i&&(i=1/0),d(r,i)}function r(t){return Object.prototype.toString.call(t)}function o(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function l(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}var s;try{s=Map}catch(t){s=function(){}}var u;try{u=Set}catch(t){u=function(){}}var c;try{c=Promise}catch(t){c=function(){}}return n.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},n.__objToStr=r,n.__isDate=o,n.__isArray=i,n.__isRegExp=l,n.__getRegExpFlags=a,n}();"object"==typeof t&&t.exports&&(t.exports=r)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return t instanceof b.default||t instanceof y.BlockEmbed}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},f=n(0),d=r(f),p=n(8),h=r(p),y=n(4),b=r(y),v=n(16),g=r(v),m=n(13),q=r(m),_=n(25),w=r(_),k=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.emitter=n.emitter,Array.isArray(n.whitelist)&&(r.whitelist=n.whitelist.reduce(function(t,e){return t[e]=!0,t},{})),r.domNode.addEventListener("DOMNodeInserted",function(){}),r.optimize(),r.enable(),r}return l(e,t),u(e,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(t,n){var r=this.line(t),o=s(r,2),i=o[0],l=o[1],a=this.line(t+n),u=s(a,1),f=u[0];if(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"deleteAt",this).call(this,t,n),null!=f&&i!==f&&l>0){if(i instanceof y.BlockEmbed||f instanceof y.BlockEmbed)return void this.optimize();if(i instanceof q.default){var d=i.newlineIndex(i.length(),!0);if(d>-1&&(i=i.split(d+1))===f)return void this.optimize()}else if(f instanceof q.default){var p=f.newlineIndex(0);p>-1&&f.split(p+1)}var h=f.children.head instanceof g.default?null:f.children.head;i.moveChildren(f,h),i.remove()}this.optimize()}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t)}},{key:"formatAt",value:function(t,n,r,o){(null==this.whitelist||this.whitelist[r])&&(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"formatAt",this).call(this,t,n,r,o),this.optimize())}},{key:"insertAt",value:function(t,n,r){if(null==r||null==this.whitelist||this.whitelist[n]){if(t>=this.length())if(null==r||null==d.default.query(n,d.default.Scope.BLOCK)){var o=d.default.create(this.statics.defaultChild);this.appendChild(o),null==r&&n.endsWith("\n")&&(n=n.slice(0,-1)),o.insertAt(0,n,r)}else{var i=d.default.create(n,r);this.appendChild(i)}else c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertAt",this).call(this,t,n,r);this.optimize()}}},{key:"insertBefore",value:function(t,n){if(t.statics.scope===d.default.Scope.INLINE_BLOT){var r=d.default.create(this.statics.defaultChild);r.appendChild(t),t=r}c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,n)}},{key:"leaf",value:function(t){return this.path(t).pop()||[null,-1]}},{key:"line",value:function(t){return t===this.length()?this.line(t-1):this.descendant(a,t)}},{key:"lines",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return function t(e,n,r){var o=[],i=r;return e.children.forEachAt(n,r,function(e,n,r){a(e)?o.push(e):e instanceof d.default.Container&&(o=o.concat(t(e,n,i))),i-=r}),o}(this,t,e)}},{key:"optimize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t,n),t.length>0&&this.emitter.emit(h.default.events.SCROLL_OPTIMIZE,t,n))}},{key:"path",value:function(t){return c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"path",this).call(this,t).slice(1)}},{key:"update",value:function(t){if(!0!==this.batch){var n=h.default.sources.USER;"string"==typeof t&&(n=t),Array.isArray(t)||(t=this.observer.takeRecords()),t.length>0&&this.emitter.emit(h.default.events.SCROLL_BEFORE_UPDATE,n,t),c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"update",this).call(this,t.concat([])),t.length>0&&this.emitter.emit(h.default.events.SCROLL_UPDATE,n,t)}}}]),e}(d.default.Scroll);k.blotName="scroll",k.className="ql-editor",k.tagName="DIV",k.defaultChild="block",k.allowedChildren=[b.default,y.BlockEmbed,w.default],e.default=k},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n,r=t===D.keys.LEFT?"prefix":"suffix";return n={key:t,shiftKey:e,altKey:null},o(n,r,/^$/),o(n,"handler",function(n){var r=n.index;t===D.keys.RIGHT&&(r+=n.length+1);var o=this.quill.getLeaf(r);return!(v(o,1)[0]instanceof T.default.Embed)||(t===D.keys.LEFT?e?this.quill.setSelection(n.index-1,n.length+1,P.default.sources.USER):this.quill.setSelection(n.index-1,P.default.sources.USER):e?this.quill.setSelection(n.index,n.length+1,P.default.sources.USER):this.quill.setSelection(n.index+n.length+1,P.default.sources.USER),!1)}),n}function u(t,e){if(!(0===t.index||this.quill.getLength()<=1)){var n=this.quill.getLine(t.index),r=v(n,1),o=r[0],i={};if(0===e.offset){var l=this.quill.getLine(t.index-1),a=v(l,1),s=a[0];if(null!=s&&s.length()>1){var u=o.formats(),c=this.quill.getFormat(t.index-1,1);i=j.default.attributes.diff(u,c)||{}}}var f=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;this.quill.deleteText(t.index-f,f,P.default.sources.USER),Object.keys(i).length>0&&this.quill.formatLine(t.index-f,f,i,P.default.sources.USER),this.quill.focus()}}function c(t,e){var n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(!(t.index>=this.quill.getLength()-n)){var r={},o=0,i=this.quill.getLine(t.index),l=v(i,1),a=l[0];if(e.offset>=a.length()-1){var s=this.quill.getLine(t.index+1),u=v(s,1),c=u[0];if(c){var f=a.formats(),d=this.quill.getFormat(t.index,1);r=j.default.attributes.diff(f,d)||{},o=c.length()}}this.quill.deleteText(t.index,n,P.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(t.index+o-1,n,r,P.default.sources.USER)}}function f(t){var e=this.quill.getLines(t),n={};if(e.length>1){var r=e[0].formats(),o=e[e.length-1].formats();n=j.default.attributes.diff(o,r)||{}}this.quill.deleteText(t,P.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(t.index,1,n,P.default.sources.USER),this.quill.setSelection(t.index,P.default.sources.SILENT),this.quill.focus()}function d(t,e){var n=this;t.length>0&&this.quill.scroll.deleteAt(t.index,t.length);var r=Object.keys(e.format).reduce(function(t,n){return T.default.query(n,T.default.Scope.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t},{});this.quill.insertText(t.index,"\n",r,P.default.sources.USER),this.quill.setSelection(t.index+1,P.default.sources.SILENT),this.quill.focus(),Object.keys(e.format).forEach(function(t){null==r[t]&&(Array.isArray(e.format[t])||"link"!==t&&n.quill.format(t,e.format[t],P.default.sources.USER))})}function p(t){return{key:D.keys.TAB,shiftKey:!t,format:{"code-block":!0},handler:function(e){var n=T.default.query("code-block"),r=e.index,o=e.length,i=this.quill.scroll.descendant(n,r),l=v(i,2),a=l[0],s=l[1];if(null!=a){var u=this.quill.getIndex(a),c=a.newlineIndex(s,!0)+1,f=a.newlineIndex(u+s+o),d=a.domNode.textContent.slice(c,f).split("\n");s=0,d.forEach(function(e,i){t?(a.insertAt(c+s,n.TAB),s+=n.TAB.length,0===i?r+=n.TAB.length:o+=n.TAB.length):e.startsWith(n.TAB)&&(a.deleteAt(c+s,n.TAB.length),s-=n.TAB.length,0===i?r-=n.TAB.length:o-=n.TAB.length),s+=e.length+1}),this.quill.update(P.default.sources.USER),this.quill.setSelection(r,o,P.default.sources.SILENT)}}}}function h(t){return{key:t[0].toUpperCase(),shortKey:!0,handler:function(e,n){this.quill.format(t,!n.format[t],P.default.sources.USER)}}}function y(t){if("string"==typeof t||"number"==typeof t)return y({key:t});if("object"===(void 0===t?"undefined":b(t))&&(t=(0,q.default)(t,!1)),"string"==typeof t.key)if(null!=D.keys[t.key.toUpperCase()])t.key=D.keys[t.key.toUpperCase()];else{if(1!==t.key.length)return null;t.key=t.key.toUpperCase().charCodeAt(0)}return t.shortKey&&(t[B]=t.shortKey,delete t.shortKey),t}Object.defineProperty(e,"__esModule",{value:!0}),e.SHORTKEY=e.default=void 0;var b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),m=n(21),q=r(m),_=n(11),w=r(_),k=n(3),O=r(k),x=n(2),E=r(x),A=n(20),j=r(A),N=n(0),T=r(N),S=n(5),P=r(S),C=n(10),L=r(C),R=n(9),M=r(R),I=(0,L.default)("quill:keyboard"),B=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",D=function(t){function e(t,n){i(this,e);var r=l(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.bindings={},Object.keys(r.options.bindings).forEach(function(e){("list autofill"!==e||null==t.scroll.whitelist||t.scroll.whitelist.list)&&r.options.bindings[e]&&r.addBinding(r.options.bindings[e])}),r.addBinding({key:e.keys.ENTER,shiftKey:null},d),r.addBinding({key:e.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(r.addBinding({key:e.keys.BACKSPACE},{collapsed:!0},u),r.addBinding({key:e.keys.DELETE},{collapsed:!0},c)):(r.addBinding({key:e.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},u),r.addBinding({key:e.keys.DELETE},{collapsed:!0,suffix:/^.?$/},c)),r.addBinding({key:e.keys.BACKSPACE},{collapsed:!1},f),r.addBinding({key:e.keys.DELETE},{collapsed:!1},f),r.addBinding({key:e.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},u),r.listen(),r}return a(e,t),g(e,null,[{key:"match",value:function(t,e){return e=y(e),!["altKey","ctrlKey","metaKey","shiftKey"].some(function(n){return!!e[n]!==t[n]&&null!==e[n]})&&e.key===(t.which||t.keyCode)}}]),g(e,[{key:"addBinding",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=y(t);if(null==r||null==r.key)return I.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n}),r=(0,O.default)(r,e,n),this.bindings[r.key]=this.bindings[r.key]||[],this.bindings[r.key].push(r)}},{key:"listen",value:function(){var t=this;this.quill.root.addEventListener("keydown",function(n){if(!n.defaultPrevented){var r=n.which||n.keyCode,o=(t.bindings[r]||[]).filter(function(t){return e.match(n,t)});if(0!==o.length){var i=t.quill.getSelection();if(null!=i&&t.quill.hasFocus()){var l=t.quill.getLine(i.index),a=v(l,2),s=a[0],u=a[1],c=t.quill.getLeaf(i.index),f=v(c,2),d=f[0],p=f[1],h=0===i.length?[d,p]:t.quill.getLeaf(i.index+i.length),y=v(h,2),g=y[0],m=y[1],q=d instanceof T.default.Text?d.value().slice(0,p):"",_=g instanceof T.default.Text?g.value().slice(m):"",k={collapsed:0===i.length,empty:0===i.length&&s.length()<=1,format:t.quill.getFormat(i),offset:u,prefix:q,suffix:_};o.some(function(e){if(null!=e.collapsed&&e.collapsed!==k.collapsed)return!1;if(null!=e.empty&&e.empty!==k.empty)return!1;if(null!=e.offset&&e.offset!==k.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(function(t){return null==k.format[t]}))return!1}else if("object"===b(e.format)&&!Object.keys(e.format).every(function(t){return!0===e.format[t]?null!=k.format[t]:!1===e.format[t]?null==k.format[t]:(0,w.default)(e.format[t],k.format[t])}))return!1;return!(null!=e.prefix&&!e.prefix.test(k.prefix))&&(!(null!=e.suffix&&!e.suffix.test(k.suffix))&&!0!==e.handler.call(t,i,k))})&&n.preventDefault()}}}})}}]),e}(M.default);D.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},D.DEFAULTS={bindings:{bold:h("bold"),italic:h("italic"),underline:h("underline"),indent:{key:D.keys.TAB,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","+1",P.default.sources.USER)}},outdent:{key:D.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(t,e){if(e.collapsed&&0!==e.offset)return!0;this.quill.format("indent","-1",P.default.sources.USER)}},"outdent backspace":{key:D.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(t,e){null!=e.format.indent?this.quill.format("indent","-1",P.default.sources.USER):null!=e.format.list&&this.quill.format("list",!1,P.default.sources.USER)}},"indent code-block":p(!0),"outdent code-block":p(!1),"remove tab":{key:D.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(t){this.quill.deleteText(t.index-1,1,P.default.sources.USER)}},tab:{key:D.keys.TAB,handler:function(t){this.quill.history.cutoff();var e=(new E.default).retain(t.index).delete(t.length).insert("\t");this.quill.updateContents(e,P.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,P.default.sources.SILENT)}},"list empty enter":{key:D.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(t,e){this.quill.format("list",!1,P.default.sources.USER),e.format.indent&&this.quill.format("indent",!1,P.default.sources.USER)}},"checklist enter":{key:D.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(t){var e=this.quill.getLine(t.index),n=v(e,2),r=n[0],o=n[1],i=(0,O.default)({},r.formats(),{list:"checked"}),l=(new E.default).retain(t.index).insert("\n",i).retain(r.length()-o-1).retain(1,{list:"unchecked"});this.quill.updateContents(l,P.default.sources.USER),this.quill.setSelection(t.index+1,P.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:D.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(t,e){var n=this.quill.getLine(t.index),r=v(n,2),o=r[0],i=r[1],l=(new E.default).retain(t.index).insert("\n",e.format).retain(o.length()-i-1).retain(1,{header:null});this.quill.updateContents(l,P.default.sources.USER),this.quill.setSelection(t.index+1,P.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(t,e){var n=e.prefix.length,r=this.quill.getLine(t.index),o=v(r,2),i=o[0],l=o[1];if(l>n)return!0;var a=void 0;switch(e.prefix.trim()){case"[]":case"[ ]":a="unchecked";break;case"[x]":a="checked";break;case"-":case"*":a="bullet";break;default:a="ordered"}this.quill.insertText(t.index," ",P.default.sources.USER),this.quill.history.cutoff();var s=(new E.default).retain(t.index-l).delete(n+1).retain(i.length()-2-l).retain(1,{list:a});this.quill.updateContents(s,P.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,P.default.sources.SILENT)}},"code exit":{key:D.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(t){var e=this.quill.getLine(t.index),n=v(e,2),r=n[0],o=n[1],i=(new E.default).retain(t.index+r.length()-o-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(i,P.default.sources.USER)}},"embed left":s(D.keys.LEFT,!1),"embed left shift":s(D.keys.LEFT,!0),"embed right":s(D.keys.RIGHT,!1),"embed right shift":s(D.keys.RIGHT,!0)}},e.default=D,e.SHORTKEY=B},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(0),f=r(c),d=n(7),p=r(d),h=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return r.selection=n,r.textNode=document.createTextNode(e.CONTENTS),r.domNode.appendChild(r.textNode),r._length=0,r}return l(e,t),u(e,null,[{key:"value",value:function(){}}]),u(e,[{key:"detach",value:function(){null!=this.parent&&this.parent.removeChild(this)}},{key:"format",value:function(t,n){if(0!==this._length)return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n);for(var r=this,o=0;null!=r&&r.statics.scope!==f.default.Scope.BLOCK_BLOT;)o+=r.offset(r.parent),r=r.parent;null!=r&&(this._length=e.CONTENTS.length,r.optimize(),r.formatAt(o,e.CONTENTS.length,t,n),this._length=0)}},{key:"index",value:function(t,n){return t===this.textNode?0:s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"index",this).call(this,t,n)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!this.selection.composing&&null!=this.parent){var t=this.textNode,n=this.selection.getNativeRange(),r=void 0,o=void 0,i=void 0;if(null!=n&&n.start.node===t&&n.end.node===t){var l=[t,n.start.offset,n.end.offset];r=l[0],o=l[1],i=l[2]}for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==e.CONTENTS){var s=this.textNode.data.split(e.CONTENTS).join("");this.next instanceof p.default?(r=this.next.domNode,this.next.insertAt(0,s),this.textNode.data=e.CONTENTS):(this.textNode.data=s,this.parent.insertBefore(f.default.create(this.textNode),this),this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),null!=o){var u=[o,i].map(function(t){return Math.max(0,Math.min(r.data.length,t-1))}),c=a(u,2);return o=c[0],i=c[1],{startNode:r,startOffset:o,endNode:r,endOffset:i}}}}},{key:"update",value:function(t,e){var n=this;if(t.some(function(t){return"characterData"===t.type&&t.target===n.textNode})){var r=this.restore();r&&(e.range=r)}}},{key:"value",value:function(){return""}}]),e}(f.default.Embed);h.blotName="cursor",h.className="ql-cursor",h.tagName="span",h.CONTENTS="\ufeff",e.default=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),s=r(a),u=n(4),c=r(u),f=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),e}(s.default.Container);f.allowedChildren=[c.default,u.BlockEmbed,f],e.default=f},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ColorStyle=e.ColorClass=e.ColorAttributor=void 0;var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"value",value:function(t){var n=a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"value",this).call(this,t);return n.startsWith("rgb(")?(n=n.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),"#"+n.split(",").map(function(t){return("00"+parseInt(t).toString(16)).slice(-2)}).join("")):n}}]),e}(u.default.Attributor.Style),f=new u.default.Attributor.Class("color","ql-color",{scope:u.default.Scope.INLINE}),d=new c("color","color",{scope:u.default.Scope.INLINE});e.ColorAttributor=c,e.ColorClass=f,e.ColorStyle=d},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n=document.createElement("a");n.href=t;var r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}Object.defineProperty(e,"__esModule",{value:!0}),e.sanitize=e.default=void 0;var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(6),c=function(t){return t&&t.__esModule?t:{default:t}}(u),f=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),a(e,[{key:"format",value:function(t,n){if(t!==this.statics.blotName||!n)return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n);n=this.constructor.sanitize(n),this.domNode.setAttribute("href",n)}}],[{key:"create",value:function(t){var n=s(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return t=this.sanitize(t),n.setAttribute("href",t),n.setAttribute("target","_blank"),n}},{key:"formats",value:function(t){return t.getAttribute("href")}},{key:"sanitize",value:function(t){return l(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}}]),e}(c.default);f.blotName="link",f.tagName="A",f.SANITIZED_URL="about:blank",f.PROTOCOL_WHITELIST=["http","https","mailto","tel"],e.default=f,e.sanitize=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){t.setAttribute(e,!("true"===t.getAttribute(e)))}Object.defineProperty(e,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n(23),u=r(s),c=n(107),f=r(c),d=0,p=function(){function t(e){var n=this;o(this,t),this.select=e,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){n.togglePicker()}),this.label.addEventListener("keydown",function(t){switch(t.keyCode){case u.default.keys.ENTER:n.togglePicker();break;case u.default.keys.ESCAPE:n.escape(),t.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}return a(t,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),i(this.label,"aria-expanded"),i(this.options,"aria-hidden")}},{key:"buildItem",value:function(t){var e=this,n=document.createElement("span");return n.tabIndex="0",n.setAttribute("role","button"),n.classList.add("ql-picker-item"),t.hasAttribute("value")&&n.setAttribute("data-value",t.getAttribute("value")),t.textContent&&n.setAttribute("data-label",t.textContent),n.addEventListener("click",function(){e.selectItem(n,!0)}),n.addEventListener("keydown",function(t){switch(t.keyCode){case u.default.keys.ENTER:e.selectItem(n,!0),t.preventDefault();break;case u.default.keys.ESCAPE:e.escape(),t.preventDefault()}}),n}},{key:"buildLabel",value:function(){var t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML=f.default,t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}},{key:"buildOptions",value:function(){var t=this,e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id="ql-picker-options-"+d,d+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,[].slice.call(this.select.options).forEach(function(n){var r=t.buildItem(n);e.appendChild(r),!0===n.selected&&t.selectItem(r)}),this.container.appendChild(e)}},{key:"buildPicker",value:function(){var t=this;[].slice.call(this.select.attributes).forEach(function(e){t.container.setAttribute(e.name,e.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var t=this;this.close(),setTimeout(function(){return t.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.container.querySelector(".ql-selected");if(t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(t.parentNode.children,t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":l(Event))){var r=document.createEvent("Event");r.initEvent("change",!0,!0),this.select.dispatchEvent(r)}this.close()}}},{key:"update",value:function(){var t=void 0;if(this.select.selectedIndex>-1){var e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);var n=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",n)}}]),t}();e.default=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=r(o),l=n(5),a=r(l),s=n(4),u=r(s),c=n(16),f=r(c),d=n(25),p=r(d),h=n(24),y=r(h),b=n(35),v=r(b),g=n(6),m=r(g),q=n(22),_=r(q),w=n(7),k=r(w),O=n(55),x=r(O),E=n(42),A=r(E),j=n(23),N=r(j);a.default.register({"blots/block":u.default,"blots/block/embed":s.BlockEmbed,"blots/break":f.default,"blots/container":p.default,"blots/cursor":y.default,"blots/embed":v.default,"blots/inline":m.default,"blots/scroll":_.default,"blots/text":k.default,"modules/clipboard":x.default,"modules/history":A.default,"modules/keyboard":N.default}),i.default.register(u.default,f.default,y.default,m.default,_.default,k.default),e.default=a.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=function(){function t(t){this.domNode=t,this.domNode[r.DATA_KEY]={blot:this}}return Object.defineProperty(t.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),t.create=function(t){if(null==this.tagName)throw new r.ParchmentError("Blot definition missing tagName");var e;return Array.isArray(this.tagName)?("string"==typeof t&&(t=t.toUpperCase(),parseInt(t).toString()===t&&(t=parseInt(t))),e="number"==typeof t?document.createElement(this.tagName[t-1]):this.tagName.indexOf(t)>-1?document.createElement(t):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e},t.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},t.prototype.clone=function(){var t=this.domNode.cloneNode(!1);return r.create(t)},t.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[r.DATA_KEY]},t.prototype.deleteAt=function(t,e){this.isolate(t,e).remove()},t.prototype.formatAt=function(t,e,n,o){var i=this.isolate(t,e);if(null!=r.query(n,r.Scope.BLOT)&&o)i.wrap(n,o);else if(null!=r.query(n,r.Scope.ATTRIBUTE)){var l=r.create(this.statics.scope);i.wrap(l),l.format(n,o)}},t.prototype.insertAt=function(t,e,n){var o=null==n?r.create("text",e):r.create(e,n),i=this.split(t);this.parent.insertBefore(o,i)},t.prototype.insertInto=function(t,e){void 0===e&&(e=null),null!=this.parent&&this.parent.children.remove(this);var n=null;t.children.insertBefore(this,e),null!=e&&(n=e.domNode),this.domNode.parentNode==t.domNode&&this.domNode.nextSibling==n||t.domNode.insertBefore(this.domNode,n),this.parent=t,this.attach()},t.prototype.isolate=function(t,e){var n=this.split(t);return n.split(e),n},t.prototype.length=function(){return 1},t.prototype.offset=function(t){return void 0===t&&(t=this.parent),null==this.parent||this==t?0:this.parent.children.offset(this)+this.parent.offset(t)},t.prototype.optimize=function(t){null!=this.domNode[r.DATA_KEY]&&delete this.domNode[r.DATA_KEY].mutations},t.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},t.prototype.replace=function(t){null!=t.parent&&(t.parent.insertBefore(this,t.next),t.remove())},t.prototype.replaceWith=function(t,e){var n="string"==typeof t?r.create(t,e):t;return n.replace(this),n},t.prototype.split=function(t,e){return 0===t?this:this.next},t.prototype.update=function(t,e){},t.prototype.wrap=function(t,e){var n="string"==typeof t?r.create(t,e):t;return null!=this.parent&&this.parent.insertBefore(n,this.next),n.appendChild(this),n},t.blotName="abstract",t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(12),o=n(32),i=n(33),l=n(1),a=function(){function t(t){this.attributes={},this.domNode=t,this.build()}return t.prototype.attribute=function(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])},t.prototype.build=function(){var t=this;this.attributes={};var e=r.default.keys(this.domNode),n=o.default.keys(this.domNode),a=i.default.keys(this.domNode);e.concat(n).concat(a).forEach(function(e){var n=l.query(e,l.Scope.ATTRIBUTE);n instanceof r.default&&(t.attributes[n.attrName]=n)})},t.prototype.copy=function(t){var e=this;Object.keys(this.attributes).forEach(function(n){var r=e.attributes[n].value(e.domNode);t.format(n,r)})},t.prototype.move=function(t){var e=this;this.copy(t),Object.keys(this.attributes).forEach(function(t){e.attributes[t].remove(e.domNode)}),this.attributes={}},t.prototype.values=function(){var t=this;return Object.keys(this.attributes).reduce(function(e,n){return e[n]=t.attributes[n].value(t.domNode),e},{})},t}();e.default=a},function(t,e,n){"use strict";function r(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(function(t){return 0===t.indexOf(e+"-")})}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(12),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.keys=function(t){return(t.getAttribute("class")||"").split(/\s+/).map(function(t){return t.split("-").slice(0,-1).join("-")})},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(this.keyName+"-"+e),!0)},e.prototype.remove=function(t){r(t,this.keyName).forEach(function(e){t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")},e.prototype.value=function(t){var e=r(t,this.keyName)[0]||"",n=e.slice(this.keyName.length+1);return this.canAdd(t,n)?n:""},e}(i.default);e.default=l},function(t,e,n){"use strict";function r(t){var e=t.split("-"),n=e.slice(1).map(function(t){return t[0].toUpperCase()+t.slice(1)}).join("");return e[0]+n}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(12),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.keys=function(t){return(t.getAttribute("style")||"").split(";").map(function(t){return t.split(":")[0].trim()})},e.prototype.add=function(t,e){return!!this.canAdd(t,e)&&(t.style[r(this.keyName)]=e,!0)},e.prototype.remove=function(t){t.style[r(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")},e.prototype.value=function(t){var e=t.style[r(this.keyName)];return this.canAdd(t,e)?e:""},e}(i.default);e.default=l},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(e,n){r(this,t),this.quill=e,this.options=n,this.modules={}}return o(t,[{key:"init",value:function(){var t=this;Object.keys(this.options.modules).forEach(function(e){null==t.modules[e]&&t.addModule(e)})}},{key:"addModule",value:function(t){var e=this.quill.constructor.import("modules/"+t);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}}]),t}();i.DEFAULTS={modules:{}},i.themes={default:i},e.default=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(0),c=r(u),f=n(7),d=r(f),p="\ufeff",h=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.contentNode=document.createElement("span"),n.contentNode.setAttribute("contenteditable",!1),[].slice.call(n.domNode.childNodes).forEach(function(t){n.contentNode.appendChild(t)}),n.leftGuard=document.createTextNode(p),n.rightGuard=document.createTextNode(p),n.domNode.appendChild(n.leftGuard),n.domNode.appendChild(n.contentNode),n.domNode.appendChild(n.rightGuard),n}return l(e,t),a(e,[{key:"index",value:function(t,n){return t===this.leftGuard?0:t===this.rightGuard?1:s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"index",this).call(this,t,n)}},{key:"restore",value:function(t){var e=void 0,n=void 0,r=t.data.split(p).join("");if(t===this.leftGuard)if(this.prev instanceof d.default){var o=this.prev.length();this.prev.insertAt(o,r),e={startNode:this.prev.domNode,startOffset:o+r.length}}else n=document.createTextNode(r),this.parent.insertBefore(c.default.create(n),this),e={startNode:n,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof d.default?(this.next.insertAt(0,r),e={startNode:this.next.domNode,startOffset:r.length}):(n=document.createTextNode(r),this.parent.insertBefore(c.default.create(n),this.next),e={startNode:n,startOffset:r.length}));return t.data=p,e}},{key:"update",value:function(t,e){var n=this;t.forEach(function(t){if("characterData"===t.type&&(t.target===n.leftGuard||t.target===n.rightGuard)){var r=n.restore(t.target);r&&(e.range=r)}})}}]),e}(c.default.Embed);e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AlignStyle=e.AlignClass=e.AlignAttribute=void 0;var r=n(0),o=function(t){return t&&t.__esModule?t:{default:t}}(r),i={scope:o.default.Scope.BLOCK,whitelist:["right","center","justify"]},l=new o.default.Attributor.Attribute("align","align",i),a=new o.default.Attributor.Class("align","ql-align",i),s=new o.default.Attributor.Style("align","text-align",i);e.AlignAttribute=l,e.AlignClass=a,e.AlignStyle=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BackgroundStyle=e.BackgroundClass=void 0;var r=n(0),o=function(t){return t&&t.__esModule?t:{default:t}}(r),i=n(26),l=new o.default.Attributor.Class("background","ql-bg",{scope:o.default.Scope.INLINE}),a=new i.ColorAttributor("background","background-color",{scope:o.default.Scope.INLINE});e.BackgroundClass=l,e.BackgroundStyle=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DirectionStyle=e.DirectionClass=e.DirectionAttribute=void 0;var r=n(0),o=function(t){return t&&t.__esModule?t:{default:t}}(r),i={scope:o.default.Scope.BLOCK,whitelist:["rtl"]},l=new o.default.Attributor.Attribute("direction","dir",i),a=new o.default.Attributor.Class("direction","ql-direction",i),s=new o.default.Attributor.Style("direction","direction",i);e.DirectionAttribute=l,e.DirectionClass=a,e.DirectionStyle=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.FontClass=e.FontStyle=void 0;var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c={scope:u.default.Scope.INLINE,whitelist:["serif","monospace"]},f=new u.default.Attributor.Class("font","ql-font",c),d=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"value",value:function(t){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"value",this).call(this,t).replace(/["']/g,"")}}]),e}(u.default.Attributor.Style),p=new d("font","font-family",c);e.FontStyle=p,e.FontClass=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SizeStyle=e.SizeClass=void 0;var r=n(0),o=function(t){return t&&t.__esModule?t:{default:t}}(r),i=new o.default.Attributor.Class("size","ql-size",{scope:o.default.Scope.INLINE,whitelist:["small","large","huge"]}),l=new o.default.Attributor.Style("size","font-size",{scope:o.default.Scope.INLINE,whitelist:["10px","18px","32px"]});e.SizeClass=i,e.SizeStyle=l},function(t,e,n){"use strict";t.exports={align:{"":n(76),center:n(77),right:n(78),justify:n(79)},background:n(80),blockquote:n(81),bold:n(82),clean:n(83),code:n(58),"code-block":n(58),color:n(84),direction:{"":n(85),rtl:n(86)},float:{center:n(87),full:n(88),left:n(89),right:n(90)},formula:n(91),header:{1:n(92),2:n(93)},italic:n(94),image:n(95),indent:{"+1":n(96),"-1":n(97)},link:n(98),list:{ordered:n(99),bullet:n(100),check:n(101)},script:{sub:n(102),super:n(103)},strike:n(104),underline:n(105),video:n(106)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=t.ops[t.ops.length-1];return null!=e&&(null!=e.insert?"string"==typeof e.insert&&e.insert.endsWith("\n"):null!=e.attributes&&Object.keys(e.attributes).some(function(t){return null!=f.default.query(t,f.default.Scope.BLOCK)}))}function s(t){var e=t.reduce(function(t,e){return t+=e.delete||0},0),n=t.length()-e;return a(t)&&(n-=1),n}Object.defineProperty(e,"__esModule",{value:!0}),e.getLastChangeIndex=e.default=void 0;var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(0),f=r(c),d=n(5),p=r(d),h=n(9),y=r(h),b=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.lastRecorded=0,r.ignoreChange=!1,r.clear(),r.quill.on(p.default.events.EDITOR_CHANGE,function(t,e,n,o){t!==p.default.events.TEXT_CHANGE||r.ignoreChange||(r.options.userOnly&&o!==p.default.sources.USER?r.transform(e):r.record(e,n))}),r.quill.keyboard.addBinding({key:"Z",shortKey:!0},r.undo.bind(r)),r.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},r.redo.bind(r)),/Win/i.test(navigator.platform)&&r.quill.keyboard.addBinding({key:"Y",shortKey:!0},r.redo.bind(r)),r}return l(e,t),u(e,[{key:"change",value:function(t,e){if(0!==this.stack[t].length){var n=this.stack[t].pop();this.stack[e].push(n),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n[t],p.default.sources.USER),this.ignoreChange=!1;var r=s(n[t]);this.quill.setSelection(r)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(t,e){if(0!==t.ops.length){this.stack.redo=[];var n=this.quill.getContents().diff(e),r=Date.now();if(this.lastRecorded+this.options.delay>r&&this.stack.undo.length>0){var o=this.stack.undo.pop();n=n.compose(o.undo),t=o.redo.compose(t)}else this.lastRecorded=r;this.stack.undo.push({redo:t,undo:n}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(t){this.stack.undo.forEach(function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)}),this.stack.redo.forEach(function(e){e.undo=t.transform(e.undo,!0),e.redo=t.transform(e.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),e}(y.default);b.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},e.default=b,e.getLastChangeIndex=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return e?(e[1]||"https")+"://www.youtube.com/embed/"+e[2]+"?showinfo=0":(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(e[1]||"https")+"://player.vimeo.com/video/"+e[2]+"/":t}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(function(e){var r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",e),t.appendChild(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BaseTooltip=void 0;var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},f=n(3),d=r(f),p=n(2),h=r(p),y=n(8),b=r(y),v=n(23),g=r(v),m=n(34),q=r(m),_=n(59),w=r(_),k=n(60),O=r(k),x=n(28),E=r(x),A=n(61),j=r(A),N=[!1,"center","right","justify"],T=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],S=[!1,"serif","monospace"],P=["1","2","3",!1],C=["small",!1,"large","huge"],L=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),l=function e(n){if(!document.body.contains(t.root))return document.body.removeEventListener("click",e);null==r.tooltip||r.tooltip.root.contains(n.target)||document.activeElement===r.tooltip.textbox||r.quill.hasFocus()||r.tooltip.hide(),null!=r.pickers&&r.pickers.forEach(function(t){t.container.contains(n.target)||t.close()})};return t.emitter.listenDOM("click",document.body,l),r}return l(e,t),u(e,[{key:"addModule",value:function(t){var n=c(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"addModule",this).call(this,t);return"toolbar"===t&&this.extendToolbar(n),n}},{key:"buildButtons",value:function(t,e){t.forEach(function(t){(t.getAttribute("class")||"").split(/\s+/).forEach(function(n){if(n.startsWith("ql-")&&(n=n.slice("ql-".length),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"==typeof e[n])t.innerHTML=e[n];else{var r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}})})}},{key:"buildPickers",value:function(t,e){var n=this;this.pickers=t.map(function(t){if(t.classList.contains("ql-align"))return null==t.querySelector("option")&&s(t,N),new O.default(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){var n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&s(t,T,"background"===n?"#ffffff":"#000000"),new w.default(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?s(t,S):t.classList.contains("ql-header")?s(t,P):t.classList.contains("ql-size")&&s(t,C)),new E.default(t)});var r=function(){n.pickers.forEach(function(t){t.update()})};this.quill.on(b.default.events.EDITOR_CHANGE,r)}}]),e}(q.default);L.DEFAULTS=(0,d.default)(!0,{},q.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var t=this,e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),e.classList.add("ql-image"),e.addEventListener("change",function(){if(null!=e.files&&null!=e.files[0]){var n=new FileReader;n.onload=function(n){var r=t.quill.getSelection(!0);t.quill.updateContents((new h.default).retain(r.index).delete(r.length).insert({image:n.target.result}),b.default.sources.USER),t.quill.setSelection(r.index+1,b.default.sources.SILENT),e.value=""},n.readAsDataURL(e.files[0])}}),this.container.appendChild(e)),e.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var R=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.textbox=r.root.querySelector('input[type="text"]'),r.listen(),r}return l(e,t),u(e,[{key:"listen",value:function(){var t=this;this.textbox.addEventListener("keydown",function(e){g.default.match(e,"enter")?(t.save(),e.preventDefault()):g.default.match(e,"escape")&&(t.cancel(),e.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+t)||""),this.root.setAttribute("data-mode",t)}},{key:"restoreFocus",value:function(){var t=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=t}},{key:"save",value:function(){var t=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var e=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,b.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,b.default.sources.USER)),this.quill.root.scrollTop=e;break;case"video":t=a(t);case"formula":if(!t)break;var n=this.quill.getSelection(!0);if(null!=n){var r=n.index+n.length;this.quill.insertEmbed(r,this.root.getAttribute("data-mode"),t,b.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(r+1," ",b.default.sources.USER),this.quill.setSelection(r+2,b.default.sources.USER)}}this.textbox.value="",this.hide()}}]),e}(j.default);e.BaseTooltip=R,e.default=L},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this.head=this.tail=null,this.length=0}return t.prototype.append=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.insertBefore(t[0],null),t.length>1&&this.append.apply(this,t.slice(1))},t.prototype.contains=function(t){for(var e,n=this.iterator();e=n();)if(e===t)return!0;return!1},t.prototype.insertBefore=function(t,e){t&&(t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)},t.prototype.offset=function(t){for(var e=0,n=this.head;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1},t.prototype.remove=function(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)},t.prototype.iterator=function(t){return void 0===t&&(t=this.head),function(){var e=t;return null!=t&&(t=t.next),e}},t.prototype.find=function(t,e){void 0===e&&(e=!1);for(var n,r=this.iterator();n=r();){var o=n.length();if(t<o||e&&t===o&&(null==n.next||0!==n.next.length()))return[n,t];t-=o}return[null,0]},t.prototype.forEach=function(t){for(var e,n=this.iterator();e=n();)t(e)},t.prototype.forEachAt=function(t,e,n){if(!(e<=0))for(var r,o=this.find(t),i=o[0],l=o[1],a=t-l,s=this.iterator(i);(r=s())&&a<t+e;){var u=r.length();t>a?n(r,t-a,Math.min(e,a+u-t)):n(r,0,Math.min(u,t+e-a)),a+=u}},t.prototype.map=function(t){return this.reduce(function(e,n){return e.push(t(n)),e},[])},t.prototype.reduce=function(t,e){for(var n,r=this.iterator();n=r();)e=t(e,n);return e},t}();e.default=r},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(17),i=n(1),l={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},a=function(t){function e(e){var n=t.call(this,e)||this;return n.scroll=n,n.observer=new MutationObserver(function(t){n.update(t)}),n.observer.observe(n.domNode,l),n.attach(),n}return r(e,t),e.prototype.detach=function(){t.prototype.detach.call(this),this.observer.disconnect()},e.prototype.deleteAt=function(e,n){this.update(),0===e&&n===this.length()?this.children.forEach(function(t){t.remove()}):t.prototype.deleteAt.call(this,e,n)},e.prototype.formatAt=function(e,n,r,o){this.update(),t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.insertAt=function(e,n,r){this.update(),t.prototype.insertAt.call(this,e,n,r)},e.prototype.optimize=function(e,n){var r=this;void 0===e&&(e=[]),void 0===n&&(n={}),t.prototype.optimize.call(this,n);for(var l=[].slice.call(this.observer.takeRecords());l.length>0;)e.push(l.pop());for(var a=function(t,e){void 0===e&&(e=!0),null!=t&&t!==r&&null!=t.domNode.parentNode&&(null==t.domNode[i.DATA_KEY].mutations&&(t.domNode[i.DATA_KEY].mutations=[]),e&&a(t.parent))},s=function(t){null!=t.domNode[i.DATA_KEY]&&null!=t.domNode[i.DATA_KEY].mutations&&(t instanceof o.default&&t.children.forEach(s),t.optimize(n))},u=e,c=0;u.length>0;c+=1){if(c>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(u.forEach(function(t){var e=i.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(a(i.find(t.previousSibling,!1)),[].forEach.call(t.addedNodes,function(t){var e=i.find(t,!1);a(e,!1),e instanceof o.default&&e.children.forEach(function(t){a(t,!1)})})):"attributes"===t.type&&a(e.prev)),a(e))}),this.children.forEach(s),u=[].slice.call(this.observer.takeRecords()),l=u.slice();l.length>0;)e.push(l.pop())}},e.prototype.update=function(e,n){var r=this;void 0===n&&(n={}),e=e||this.observer.takeRecords(),e.map(function(t){var e=i.find(t.target,!0);return null==e?null:null==e.domNode[i.DATA_KEY].mutations?(e.domNode[i.DATA_KEY].mutations=[t],e):(e.domNode[i.DATA_KEY].mutations.push(t),null)}).forEach(function(t){null!=t&&t!==r&&null!=t.domNode[i.DATA_KEY]&&t.update(t.domNode[i.DATA_KEY].mutations||[],n)}),null!=this.domNode[i.DATA_KEY].mutations&&t.prototype.update.call(this,this.domNode[i.DATA_KEY].mutations,n),this.optimize(e,n)},e.blotName="scroll",e.defaultChild="block",e.scope=i.Scope.BLOCK_BLOT,e.tagName="DIV",e}(o.default);e.default=a},function(t,e,n){"use strict";function r(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var n in t)if(t[n]!==e[n])return!1;return!0}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(18),l=n(1),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.formats=function(n){if(n.tagName!==e.tagName)return t.formats.call(this,n)},e.prototype.format=function(n,r){var o=this;n!==this.statics.blotName||r?t.prototype.format.call(this,n,r):(this.children.forEach(function(t){t instanceof i.default||(t=t.wrap(e.blotName,!0)),o.attributes.copy(t)}),this.unwrap())},e.prototype.formatAt=function(e,n,r,o){if(null!=this.formats()[r]||l.query(r,l.Scope.ATTRIBUTE)){this.isolate(e,n).format(r,o)}else t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.optimize=function(n){t.prototype.optimize.call(this,n);var o=this.formats();if(0===Object.keys(o).length)return this.unwrap();var i=this.next;i instanceof e&&i.prev===this&&r(o,i.formats())&&(i.moveChildren(this),i.remove())},e.blotName="inline",e.scope=l.Scope.INLINE_BLOT,e.tagName="SPAN",e}(i.default);e.default=a},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(18),i=n(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.formats=function(n){var r=i.query(e.blotName).tagName;if(n.tagName!==r)return t.formats.call(this,n)},e.prototype.format=function(n,r){null!=i.query(n,i.Scope.BLOCK)&&(n!==this.statics.blotName||r?t.prototype.format.call(this,n,r):this.replaceWith(e.blotName))},e.prototype.formatAt=function(e,n,r,o){null!=i.query(r,i.Scope.BLOCK)?this.format(r,o):t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.insertAt=function(e,n,r){if(null==r||null!=i.query(n,i.Scope.INLINE))t.prototype.insertAt.call(this,e,n,r);else{var o=this.split(e),l=i.create(n,r);o.parent.insertBefore(l,o)}},e.prototype.update=function(e,n){navigator.userAgent.match(/Trident/)?this.build():t.prototype.update.call(this,e,n)},e.blotName="block",e.scope=i.Scope.BLOCK_BLOT,e.tagName="P",e}(o.default);e.default=l},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(19),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.formats=function(t){},e.prototype.format=function(e,n){t.prototype.formatAt.call(this,0,this.length(),e,n)},e.prototype.formatAt=function(e,n,r,o){0===e&&n===this.length()?this.format(r,o):t.prototype.formatAt.call(this,e,n,r,o)},e.prototype.formats=function(){return this.statics.formats(this.domNode)},e}(o.default);e.default=i},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(19),i=n(1),l=function(t){function e(e){var n=t.call(this,e)||this;return n.text=n.statics.value(n.domNode),n}return r(e,t),e.create=function(t){return document.createTextNode(t)},e.value=function(t){var e=t.data;return e.normalize&&(e=e.normalize()),e},e.prototype.deleteAt=function(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)},e.prototype.index=function(t,e){return this.domNode===t?e:-1},e.prototype.insertAt=function(e,n,r){null==r?(this.text=this.text.slice(0,e)+n+this.text.slice(e),this.domNode.data=this.text):t.prototype.insertAt.call(this,e,n,r)},e.prototype.length=function(){return this.text.length},e.prototype.optimize=function(n){t.prototype.optimize.call(this,n),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},e.prototype.position=function(t,e){return void 0===e&&(e=!1),[this.domNode,t]},e.prototype.split=function(t,e){if(void 0===e&&(e=!1),!e){if(0===t)return this;if(t===this.length())return this.next}var n=i.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next),this.text=this.statics.value(this.domNode),n},e.prototype.update=function(t,e){var n=this;t.some(function(t){return"characterData"===t.type&&t.target===n.domNode})&&(this.text=this.statics.value(this.domNode))},e.prototype.value=function(){return this.text},e.blotName="text",e.scope=i.Scope.INLINE_BLOT,e}(o.default);e.default=l},function(t,e,n){"use strict";var r=document.createElement("div");if(r.classList.toggle("test-class",!1),r.classList.contains("test-class")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return arguments.length>1&&!this.contains(t)==!e?e:o.call(this,t)}}String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=e||0,this.substr(e,t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var n=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,o=arguments[1],i=0;i<r;i++)if(e=n[i],t.call(o,e,i,n))return e}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})},function(t,e){function n(t,e,n){if(t==e)return t?[[b,t]]:[];(n<0||t.length<n)&&(n=null);var o=l(t,e),i=t.substring(0,o);t=t.substring(o),e=e.substring(o),o=a(t,e);var s=t.substring(t.length-o);t=t.substring(0,t.length-o),e=e.substring(0,e.length-o);var c=r(t,e);return i&&c.unshift([b,i]),s&&c.push([b,s]),u(c),null!=n&&(c=f(c,n)),c=d(c)}function r(t,e){var r;if(!t)return[[y,e]];if(!e)return[[h,t]];var i=t.length>e.length?t:e,l=t.length>e.length?e:t,a=i.indexOf(l);if(-1!=a)return r=[[y,i.substring(0,a)],[b,l],[y,i.substring(a+l.length)]],t.length>e.length&&(r[0][0]=r[2][0]=h),r;if(1==l.length)return[[h,t],[y,e]];var u=s(t,e);if(u){var c=u[0],f=u[1],d=u[2],p=u[3],v=u[4],g=n(c,d),m=n(f,p);return g.concat([[b,v]],m)}return o(t,e)}function o(t,e){for(var n=t.length,r=e.length,o=Math.ceil((n+r)/2),l=o,a=2*o,s=new Array(a),u=new Array(a),c=0;c<a;c++)s[c]=-1,u[c]=-1;s[l+1]=0,u[l+1]=0;for(var f=n-r,d=f%2!=0,p=0,b=0,v=0,g=0,m=0;m<o;m++){for(var q=-m+p;q<=m-b;q+=2){var _,w=l+q;_=q==-m||q!=m&&s[w-1]<s[w+1]?s[w+1]:s[w-1]+1;for(var k=_-q;_<n&&k<r&&t.charAt(_)==e.charAt(k);)_++,k++;if(s[w]=_,_>n)b+=2;else if(k>r)p+=2;else if(d){var O=l+f-q;if(O>=0&&O<a&&-1!=u[O]){var x=n-u[O];if(_>=x)return i(t,e,_,k)}}}for(var E=-m+v;E<=m-g;E+=2){var x,O=l+E;x=E==-m||E!=m&&u[O-1]<u[O+1]?u[O+1]:u[O-1]+1;for(var A=x-E;x<n&&A<r&&t.charAt(n-x-1)==e.charAt(r-A-1);)x++,A++;if(u[O]=x,x>n)g+=2;else if(A>r)v+=2;else if(!d){var w=l+f-E;if(w>=0&&w<a&&-1!=s[w]){var _=s[w],k=l+_-w;if(x=n-x,_>=x)return i(t,e,_,k)}}}}return[[h,t],[y,e]]}function i(t,e,r,o){var i=t.substring(0,r),l=e.substring(0,o),a=t.substring(r),s=e.substring(o),u=n(i,l),c=n(a,s);return u.concat(c)}function l(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),o=r,i=0;n<o;)t.substring(i,o)==e.substring(i,o)?(n=o,i=n):r=o,o=Math.floor((r-n)/2+n);return o}function a(t,e){if(!t||!e||t.charAt(t.length-1)!=e.charAt(e.length-1))return 0;for(var n=0,r=Math.min(t.length,e.length),o=r,i=0;n<o;)t.substring(t.length-o,t.length-i)==e.substring(e.length-o,e.length-i)?(n=o,i=n):r=o,o=Math.floor((r-n)/2+n);return o}function s(t,e){function n(t,e,n){for(var r,o,i,s,u=t.substring(n,n+Math.floor(t.length/4)),c=-1,f="";-1!=(c=e.indexOf(u,c+1));){var d=l(t.substring(n),e.substring(c)),p=a(t.substring(0,n),e.substring(0,c));f.length<p+d&&(f=e.substring(c-p,c)+e.substring(c,c+d),r=t.substring(0,n-p),o=t.substring(n+d),i=e.substring(0,c-p),s=e.substring(c+d))}return 2*f.length>=t.length?[r,o,i,s,f]:null}var r=t.length>e.length?t:e,o=t.length>e.length?e:t;if(r.length<4||2*o.length<r.length)return null;var i,s=n(r,o,Math.ceil(r.length/4)),u=n(r,o,Math.ceil(r.length/2));if(!s&&!u)return null;i=u?s&&s[4].length>u[4].length?s:u:s;var c,f,d,p;return t.length>e.length?(c=i[0],f=i[1],d=i[2],p=i[3]):(d=i[0],p=i[1],c=i[2],f=i[3]),[c,f,d,p,i[4]]}function u(t){t.push([b,""]);for(var e,n=0,r=0,o=0,i="",s="";n<t.length;)switch(t[n][0]){case y:o++,s+=t[n][1],n++;break;case h:r++,i+=t[n][1],n++;break;case b:r+o>1?(0!==r&&0!==o&&(e=l(s,i),0!==e&&(n-r-o>0&&t[n-r-o-1][0]==b?t[n-r-o-1][1]+=s.substring(0,e):(t.splice(0,0,[b,s.substring(0,e)]),n++),s=s.substring(e),i=i.substring(e)),0!==(e=a(s,i))&&(t[n][1]=s.substring(s.length-e)+t[n][1],s=s.substring(0,s.length-e),i=i.substring(0,i.length-e))),0===r?t.splice(n-o,r+o,[y,s]):0===o?t.splice(n-r,r+o,[h,i]):t.splice(n-r-o,r+o,[h,i],[y,s]),n=n-r-o+(r?1:0)+(o?1:0)+1):0!==n&&t[n-1][0]==b?(t[n-1][1]+=t[n][1],t.splice(n,1)):n++,o=0,r=0,i="",s=""}""===t[t.length-1][1]&&t.pop();var c=!1;for(n=1;n<t.length-1;)t[n-1][0]==b&&t[n+1][0]==b&&(t[n][1].substring(t[n][1].length-t[n-1][1].length)==t[n-1][1]?(t[n][1]=t[n-1][1]+t[n][1].substring(0,t[n][1].length-t[n-1][1].length),t[n+1][1]=t[n-1][1]+t[n+1][1],t.splice(n-1,1),c=!0):t[n][1].substring(0,t[n+1][1].length)==t[n+1][1]&&(t[n-1][1]+=t[n+1][1],t[n][1]=t[n][1].substring(t[n+1][1].length)+t[n+1][1],t.splice(n+1,1),c=!0)),n++;c&&u(t)}function c(t,e){if(0===e)return[b,t];for(var n=0,r=0;r<t.length;r++){var o=t[r];if(o[0]===h||o[0]===b){var i=n+o[1].length;if(e===i)return[r+1,t];if(e<i){t=t.slice();var l=e-n,a=[o[0],o[1].slice(0,l)],s=[o[0],o[1].slice(l)];return t.splice(r,1,a,s),[r+1,t]}n=i}}throw new Error("cursor_pos is out of bounds!")}function f(t,e){var n=c(t,e),r=n[1],o=n[0],i=r[o],l=r[o+1];if(null==i)return t;if(i[0]!==b)return t;if(null!=l&&i[1]+l[1]===l[1]+i[1])return r.splice(o,2,l,i),p(r,o,2);if(null!=l&&0===l[1].indexOf(i[1])){r.splice(o,2,[l[0],i[1]],[0,i[1]]);var a=l[1].slice(i[1].length);return a.length>0&&r.splice(o+2,0,[l[0],a]),p(r,o,3)}return t}function d(t){for(var e=!1,n=function(t){return t.charCodeAt(0)>=56320&&t.charCodeAt(0)<=57343},r=2;r<t.length;r+=1)t[r-2][0]===b&&function(t){return t.charCodeAt(t.length-1)>=55296&&t.charCodeAt(t.length-1)<=56319}(t[r-2][1])&&t[r-1][0]===h&&n(t[r-1][1])&&t[r][0]===y&&n(t[r][1])&&(e=!0,t[r-1][1]=t[r-2][1].slice(-1)+t[r-1][1],t[r][1]=t[r-2][1].slice(-1)+t[r][1],t[r-2][1]=t[r-2][1].slice(0,-1));if(!e)return t;for(var o=[],r=0;r<t.length;r+=1)t[r][1].length>0&&o.push(t[r]);return o}function p(t,e,n){for(var r=e+n-1;r>=0&&r>=e-1;r--)if(r+1<t.length){var o=t[r],i=t[r+1];o[0]===i[1]&&t.splice(r,2,[o[0],o[1]+i[1]])}return t}var h=-1,y=1,b=0,v=n;v.INSERT=y,v.DELETE=h,v.EQUAL=b,t.exports=v},function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}e=t.exports="function"==typeof Object.keys?Object.keys:n,e.shim=n},function(t,e){function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function r(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var o="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=o?n:r,e.supported=n,e.unsupported=r},function(t,e){"use strict";function n(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(){this._events=new n,this._eventsCount=0}var i=Object.prototype.hasOwnProperty,l="~";Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(l=!1)),o.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)i.call(t,e)&&n.push(l?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t,e){var n=l?l+t:t,r=this._events[n];if(e)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},o.prototype.emit=function(t,e,n,r,o,i){var a=l?l+t:t;if(!this._events[a])return!1;var s,u,c=this._events[a],f=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,o),!0;case 6:return c.fn.call(c.context,e,n,r,o,i),!0}for(u=1,s=new Array(f-1);u<f;u++)s[u-1]=arguments[u];c.fn.apply(c.context,s)}else{var d,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),f){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,n);break;case 4:c[u].fn.call(c[u].context,e,n,r);break;default:if(!s)for(d=1,s=new Array(f-1);d<f;d++)s[d-1]=arguments[d];c[u].fn.apply(c[u].context,s)}}return!0},o.prototype.on=function(t,e,n){var o=new r(e,n||this),i=l?l+t:t;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},o.prototype.once=function(t,e,n){var o=new r(e,n||this,!0),i=l?l+t:t;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},o.prototype.removeListener=function(t,e,r,o){var i=l?l+t:t;if(!this._events[i])return this;if(!e)return 0==--this._eventsCount?this._events=new n:delete this._events[i],this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||r&&a.context!==r||(0==--this._eventsCount?this._events=new n:delete this._events[i]);else{for(var s=0,u=[],c=a.length;s<c;s++)(a[s].fn!==e||o&&!a[s].once||r&&a[s].context!==r)&&u.push(a[s]);u.length?this._events[i]=1===u.length?u[0]:u:0==--this._eventsCount?this._events=new n:delete this._events[i]}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=l?l+t:t,this._events[e]&&(0==--this._eventsCount?this._events=new n:delete this._events[e])):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=l,o.EventEmitter=o,void 0!==t&&(t.exports=o)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,n){return"object"===(void 0===e?"undefined":k(e))?Object.keys(e).reduce(function(t,n){return s(t,n,e[n])},t):t.reduce(function(t,r){return r.attributes&&r.attributes[e]?t.push(r):t.insert(r.insert,(0,A.default)({},o({},e,n),r.attributes))},new N.default)}function u(t){if(t.nodeType!==Node.ELEMENT_NODE)return{};return t["__ql-computed-style"]||(t["__ql-computed-style"]=window.getComputedStyle(t))}function c(t,e){for(var n="",r=t.ops.length-1;r>=0&&n.length<e.length;--r){var o=t.ops[r];if("string"!=typeof o.insert)break;n=o.insert+n}return n.slice(-1*e.length)===e}function f(t){return 0!==t.childNodes.length&&["block","list-item"].indexOf(u(t).display)>-1}function d(t,e,n){return t.nodeType===t.TEXT_NODE?n.reduce(function(e,n){return n(t,e)},new N.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],function(r,o){var i=d(o,e,n);return o.nodeType===t.ELEMENT_NODE&&(i=e.reduce(function(t,e){return e(o,t)},i),i=(o[W]||[]).reduce(function(t,e){return e(o,t)},i)),r.concat(i)},new N.default):new N.default}function p(t,e,n){return s(n,t,!0)}function h(t,e){var n=S.default.Attributor.Attribute.keys(t),r=S.default.Attributor.Class.keys(t),o=S.default.Attributor.Style.keys(t),i={};return n.concat(r).concat(o).forEach(function(e){var n=S.default.query(e,S.default.Scope.ATTRIBUTE);null!=n&&(i[n.attrName]=n.value(t),i[n.attrName])||(n=G[e],null==n||n.attrName!==e&&n.keyName!==e||(i[n.attrName]=n.value(t)||void 0),null==(n=$[e])||n.attrName!==e&&n.keyName!==e||(n=$[e],i[n.attrName]=n.value(t)||void 0))}),Object.keys(i).length>0&&(e=s(e,i)),e}function y(t,e){var n=S.default.query(t);if(null==n)return e;if(n.prototype instanceof S.default.Embed){var r={},o=n.value(t);null!=o&&(r[n.blotName]=o,e=(new N.default).insert(r,n.formats(t)))}else"function"==typeof n.formats&&(e=s(e,n.blotName,n.formats(t)));return e}function b(t,e){return c(e,"\n")||e.insert("\n"),e}function v(){return new N.default}function g(t,e){var n=S.default.query(t);if(null==n||"list-item"!==n.blotName||!c(e,"\n"))return e;for(var r=-1,o=t.parentNode;!o.classList.contains("ql-clipboard");)"list"===(S.default.query(o)||{}).blotName&&(r+=1),o=o.parentNode;return r<=0?e:e.compose((new N.default).retain(e.length()-1).retain(1,{indent:r}))}function m(t,e){return c(e,"\n")||(f(t)||e.length()>0&&t.nextSibling&&f(t.nextSibling))&&e.insert("\n"),e}function q(t,e){if(f(t)&&null!=t.nextElementSibling&&!c(e,"\n\n")){var n=t.offsetHeight+parseFloat(u(t).marginTop)+parseFloat(u(t).marginBottom);t.nextElementSibling.offsetTop>t.offsetTop+1.5*n&&e.insert("\n")}return e}function _(t,e){var n={},r=t.style||{};return r.fontStyle&&"italic"===u(t).fontStyle&&(n.italic=!0),r.fontWeight&&(u(t).fontWeight.startsWith("bold")||parseInt(u(t).fontWeight)>=700)&&(n.bold=!0),Object.keys(n).length>0&&(e=s(e,n)),parseFloat(r.textIndent||0)>0&&(e=(new N.default).insert("\t").concat(e)),e}function w(t,e){var n=t.data;if("O:P"===t.parentNode.tagName)return e.insert(n.trim());if(0===n.trim().length&&t.parentNode.classList.contains("ql-clipboard"))return e;if(!u(t.parentNode).whiteSpace.startsWith("pre")){var r=function(t,e){return e=e.replace(/[^\u00a0]/g,""),e.length<1&&t?" ":e};n=n.replace(/\r\n/g," ").replace(/\n/g," "),n=n.replace(/\s\s+/g,r.bind(r,!0)),(null==t.previousSibling&&f(t.parentNode)||null!=t.previousSibling&&f(t.previousSibling))&&(n=n.replace(/^\s+/,r.bind(r,!1))),(null==t.nextSibling&&f(t.parentNode)||null!=t.nextSibling&&f(t.nextSibling))&&(n=n.replace(/\s+$/,r.bind(r,!1)))}return e.insert(n)}Object.defineProperty(e,"__esModule",{value:!0}),e.matchText=e.matchSpacing=e.matchNewline=e.matchBlot=e.matchAttributor=e.default=void 0;var k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),E=n(3),A=r(E),j=n(2),N=r(j),T=n(0),S=r(T),P=n(5),C=r(P),L=n(10),R=r(L),M=n(9),I=r(M),B=n(36),D=n(37),U=n(13),z=r(U),F=n(26),H=n(38),K=n(39),Y=n(40),V=(0,R.default)("quill:clipboard"),W="__ql-matcher",Z=[[Node.TEXT_NODE,w],[Node.TEXT_NODE,m],["br",b],[Node.ELEMENT_NODE,m],[Node.ELEMENT_NODE,y],[Node.ELEMENT_NODE,q],[Node.ELEMENT_NODE,h],[Node.ELEMENT_NODE,_],["li",g],["b",p.bind(p,"bold")],["i",p.bind(p,"italic")],["style",v]],G=[B.AlignAttribute,H.DirectionAttribute].reduce(function(t,e){return t[e.keyName]=e,t},{}),$=[B.AlignStyle,D.BackgroundStyle,F.ColorStyle,H.DirectionStyle,K.FontStyle,Y.SizeStyle].reduce(function(t,e){return t[e.keyName]=e,t},{}),X=function(t){function e(t,n){i(this,e);var r=l(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.quill.root.addEventListener("paste",r.onPaste.bind(r)),r.container=r.quill.addContainer("ql-clipboard"),r.container.setAttribute("contenteditable",!0),r.container.setAttribute("tabindex",-1),r.matchers=[],Z.concat(r.options.matchers).forEach(function(t){var e=O(t,2),o=e[0],i=e[1];(n.matchVisual||i!==q)&&r.addMatcher(o,i)}),r}return a(e,t),x(e,[{key:"addMatcher",value:function(t,e){this.matchers.push([t,e])}},{key:"convert",value:function(t){if("string"==typeof t)return this.container.innerHTML=t.replace(/\>\r?\n +\</g,"><"),this.convert();var e=this.quill.getFormat(this.quill.selection.savedRange.index);if(e[z.default.blotName]){var n=this.container.innerText;return this.container.innerHTML="",(new N.default).insert(n,o({},z.default.blotName,e[z.default.blotName]))}var r=this.prepareMatching(),i=O(r,2),l=i[0],a=i[1],s=d(this.container,l,a);return c(s,"\n")&&null==s.ops[s.ops.length-1].attributes&&(s=s.compose((new N.default).retain(s.length()-1).delete(1))),V.log("convert",this.container.innerHTML,s),this.container.innerHTML="",s}},{key:"dangerouslyPasteHTML",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default.sources.API;if("string"==typeof t)this.quill.setContents(this.convert(t),e),this.quill.setSelection(0,C.default.sources.SILENT);else{var r=this.convert(e);this.quill.updateContents((new N.default).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),C.default.sources.SILENT)}}},{key:"onPaste",value:function(t){var e=this;if(!t.defaultPrevented&&this.quill.isEnabled()){var n=this.quill.getSelection(),r=(new N.default).retain(n.index),o=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(C.default.sources.SILENT),setTimeout(function(){r=r.concat(e.convert()).delete(n.length),e.quill.updateContents(r,C.default.sources.USER),e.quill.setSelection(r.length()-n.length,C.default.sources.SILENT),e.quill.scrollingContainer.scrollTop=o,e.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var t=this,e=[],n=[];return this.matchers.forEach(function(r){var o=O(r,2),i=o[0],l=o[1];switch(i){case Node.TEXT_NODE:n.push(l);break;case Node.ELEMENT_NODE:e.push(l);break;default:[].forEach.call(t.container.querySelectorAll(i),function(t){t[W]=t[W]||[],t[W].push(l)})}}),[e,n]}}]),e}(I.default);X.DEFAULTS={matchers:[],matchVisual:!0},e.default=X,e.matchAttributor=h,e.matchBlot=y,e.matchNewline=m,e.matchSpacing=q,e.matchText=w},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(6),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"optimize",value:function(t){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),e}(u.default);c.blotName="bold",c.tagName=["STRONG","B"],e.default=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,n){var r=document.createElement("button");r.setAttribute("type","button"),r.classList.add("ql-"+e),null!=n&&(r.value=n),t.appendChild(r)}function u(t,e){Array.isArray(e[0])||(e=[e]),e.forEach(function(e){var n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(function(t){if("string"==typeof t)s(n,t);else{var e=Object.keys(t)[0],r=t[e];Array.isArray(r)?c(n,e,r):s(n,e,r)}}),t.appendChild(n)})}function c(t,e,n){var r=document.createElement("select");r.classList.add("ql-"+e),n.forEach(function(t){var e=document.createElement("option");!1!==t?e.setAttribute("value",t):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.addControls=e.default=void 0;var f=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=n(2),h=r(p),y=n(0),b=r(y),v=n(5),g=r(v),m=n(10),q=r(m),_=n(9),w=r(_),k=(0,q.default)("quill:toolbar"),O=function(t){function e(t,n){i(this,e);var r=l(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));if(Array.isArray(r.options.container)){var o=document.createElement("div");u(o,r.options.container),t.container.parentNode.insertBefore(o,t.container),r.container=o}else"string"==typeof r.options.container?r.container=document.querySelector(r.options.container):r.container=r.options.container;if(!(r.container instanceof HTMLElement)){var a;return a=k.error("Container required for toolbar",r.options),l(r,a)}return r.container.classList.add("ql-toolbar"),r.controls=[],r.handlers={},Object.keys(r.options.handlers).forEach(function(t){r.addHandler(t,r.options.handlers[t])}),[].forEach.call(r.container.querySelectorAll("button, select"),function(t){r.attach(t)}),r.quill.on(g.default.events.EDITOR_CHANGE,function(t,e){t===g.default.events.SELECTION_CHANGE&&r.update(e)}),r.quill.on(g.default.events.SCROLL_OPTIMIZE,function(){var t=r.quill.selection.getRange(),e=f(t,1),n=e[0];r.update(n)}),r}return a(e,t),d(e,[{key:"addHandler",value:function(t,e){this.handlers[t]=e}},{key:"attach",value:function(t){var e=this,n=[].find.call(t.classList,function(t){return 0===t.indexOf("ql-")});if(n){if(n=n.slice("ql-".length),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[n]){if(null!=this.quill.scroll.whitelist&&null==this.quill.scroll.whitelist[n])return void k.warn("ignoring attaching to disabled format",n,t);if(null==b.default.query(n))return void k.warn("ignoring attaching to nonexistent format",n,t)}var r="SELECT"===t.tagName?"change":"click";t.addEventListener(r,function(r){var i=void 0;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;var l=t.options[t.selectedIndex];i=!l.hasAttribute("selected")&&(l.value||!1)}else i=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),r.preventDefault();e.quill.focus();var a=e.quill.selection.getRange(),s=f(a,1),u=s[0];if(null!=e.handlers[n])e.handlers[n].call(e,i);else if(b.default.query(n).prototype instanceof b.default.Embed){if(!(i=prompt("Enter "+n)))return;e.quill.updateContents((new h.default).retain(u.index).delete(u.length).insert(o({},n,i)),g.default.sources.USER)}else e.quill.format(n,i,g.default.sources.USER);e.update(u)}),this.controls.push([n,t])}}},{key:"update",value:function(t){var e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(function(n){var r=f(n,2),o=r[0],i=r[1];if("SELECT"===i.tagName){var l=void 0;if(null==t)l=null;else if(null==e[o])l=i.querySelector("option[selected]");else if(!Array.isArray(e[o])){var a=e[o];"string"==typeof a&&(a=a.replace(/\"/g,'\\"')),l=i.querySelector('option[value="'+a+'"]')}null==l?(i.value="",i.selectedIndex=-1):l.selected=!0}else if(null==t)i.classList.remove("ql-active");else if(i.hasAttribute("value")){var s=e[o]===i.getAttribute("value")||null!=e[o]&&e[o].toString()===i.getAttribute("value")||null==e[o]&&!i.getAttribute("value");i.classList.toggle("ql-active",s)}else i.classList.toggle("ql-active",null!=e[o])})}}]),e}(w.default);O.DEFAULTS={},O.DEFAULTS={container:null,handlers:{clean:function(){var t=this,e=this.quill.getSelection();if(null!=e)if(0==e.length){var n=this.quill.getFormat();Object.keys(n).forEach(function(e){null!=b.default.query(e,b.default.Scope.INLINE)&&t.quill.format(e,!1)})}else this.quill.removeFormat(e,g.default.sources.USER)},direction:function(t){var e=this.quill.getFormat().align;"rtl"===t&&null==e?this.quill.format("align","right",g.default.sources.USER):t||"right"!==e||this.quill.format("align",!1,g.default.sources.USER),this.quill.format("direction",t,g.default.sources.USER)},indent:function(t){var e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0);if("+1"===t||"-1"===t){var o="+1"===t?1:-1;"rtl"===n.direction&&(o*=-1),this.quill.format("indent",r+o,g.default.sources.USER)}},link:function(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,g.default.sources.USER)},list:function(t){var e=this.quill.getSelection(),n=this.quill.getFormat(e);"check"===t?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,g.default.sources.USER):this.quill.format("list","unchecked",g.default.sources.USER):this.quill.format("list",t,g.default.sources.USER)}}},e.default=O,e.addControls=u},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(28),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(t,n){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.label.innerHTML=n,i.container.classList.add("ql-color-picker"),[].slice.call(i.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(t){t.classList.add("ql-primary")}),i}return i(e,t),l(e,[{key:"buildItem",value:function(t){var n=a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"buildItem",this).call(this,t);return n.style.backgroundColor=t.getAttribute("value")||"",n}},{key:"selectItem",value:function(t,n){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"selectItem",this).call(this,t,n);var r=this.label.querySelector(".ql-color-label"),o=t?t.getAttribute("data-value")||"":"";r&&("line"===r.tagName?r.style.stroke=o:r.style.fill=o)}}]),e}(u.default);e.default=c},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(28),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(t,n){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.container.classList.add("ql-icon-picker"),[].forEach.call(i.container.querySelectorAll(".ql-picker-item"),function(t){t.innerHTML=n[t.getAttribute("data-value")||""]}),i.defaultItem=i.container.querySelector(".ql-selected"),i.selectItem(i.defaultItem),i}return i(e,t),l(e,[{key:"selectItem",value:function(t,n){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"selectItem",this).call(this,t,n),t=t||this.defaultItem,this.label.innerHTML=t.innerHTML}}]),e}(u.default);e.default=c},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(e,n){var o=this;r(this,t),this.quill=e,this.boundsContainer=n||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){o.root.style.marginTop=-1*o.quill.root.scrollTop+"px"}),this.hide()}return o(t,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(t){var e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=e+"px",this.root.style.top=n+"px",this.root.classList.remove("ql-flip");var r=this.boundsContainer.getBoundingClientRect(),o=this.root.getBoundingClientRect(),i=0;if(o.right>r.right&&(i=r.right-o.right,this.root.style.left=e+i+"px"),o.left<r.left&&(i=r.left-o.left,this.root.style.left=e+i+"px"),o.bottom>r.bottom){var l=o.bottom-o.top,a=t.bottom-t.top+l;this.root.style.top=n-a+"px",this.root.classList.add("ql-flip")}return i}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),t}();e.default=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(3),f=r(c),d=n(8),p=r(d),h=n(43),y=r(h),b=n(27),v=r(b),g=n(15),m=n(41),q=r(m),_=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],w=function(t){function e(t,n){o(this,e),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=_);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.quill.container.classList.add("ql-snow"),r}return l(e,t),u(e,[{key:"extendToolbar",value:function(t){t.container.classList.add("ql-snow"),this.buildButtons([].slice.call(t.container.querySelectorAll("button")),q.default),this.buildPickers([].slice.call(t.container.querySelectorAll("select")),q.default),this.tooltip=new k(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(e,n){t.handlers.link.call(t,!n.format.link)})}}]),e}(y.default);w.DEFAULTS=(0,f.default)(!0,{},y.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(t){if(t){var e=this.quill.getSelection();if(null==e||0==e.length)return;var n=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(n)&&0!==n.indexOf("mailto:")&&(n="mailto:"+n);this.quill.theme.tooltip.edit("link",n)}else this.quill.format("link",!1)}}}}});var k=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.preview=r.root.querySelector("a.ql-preview"),r}return l(e,t),u(e,[{key:"listen",value:function(){var t=this;s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(e){t.root.classList.contains("ql-editing")?t.save():t.edit("link",t.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(e){if(null!=t.linkRange){var n=t.linkRange;t.restoreFocus(),t.quill.formatText(n,"link",!1,p.default.sources.USER),delete t.linkRange}e.preventDefault(),t.hide()}),this.quill.on(p.default.events.SELECTION_CHANGE,function(e,n,r){if(null!=e){if(0===e.length&&r===p.default.sources.USER){var o=t.quill.scroll.descendant(v.default,e.index),i=a(o,2),l=i[0],s=i[1];if(null!=l){t.linkRange=new g.Range(e.index-s,l.length());var u=v.default.formats(l.domNode);return t.preview.textContent=u,t.preview.setAttribute("href",u),t.show(),void t.position(t.quill.getBounds(t.linkRange))}}else delete t.linkRange;t.hide()}})}},{key:"show",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),e}(h.BaseTooltip);k.TEMPLATE=['<a class="ql-preview" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""),e.default=w},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(29),i=r(o),l=n(36),a=n(38),s=n(64),u=n(65),c=r(u),f=n(66),d=r(f),p=n(67),h=r(p),y=n(37),b=n(26),v=n(39),g=n(40),m=n(56),q=r(m),_=n(68),w=r(_),k=n(27),O=r(k),x=n(69),E=r(x),A=n(70),j=r(A),N=n(71),T=r(N),S=n(72),P=r(S),C=n(73),L=r(C),R=n(13),M=r(R),I=n(74),B=r(I),D=n(75),U=r(D),z=n(57),F=r(z),H=n(41),K=r(H),Y=n(28),V=r(Y),W=n(59),Z=r(W),G=n(60),$=r(G),X=n(61),Q=r(X),J=n(108),tt=r(J),et=n(62),nt=r(et);i.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":l.AlignClass,"attributors/class/background":y.BackgroundClass,"attributors/class/color":b.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":v.FontClass,"attributors/class/size":g.SizeClass,"attributors/style/align":l.AlignStyle,"attributors/style/background":y.BackgroundStyle,"attributors/style/color":b.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":v.FontStyle,"attributors/style/size":g.SizeStyle},!0),i.default.register({"formats/align":l.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":s.IndentClass,"formats/background":y.BackgroundStyle,"formats/color":b.ColorStyle,"formats/font":v.FontClass,"formats/size":g.SizeClass,"formats/blockquote":c.default,"formats/code-block":M.default,"formats/header":d.default,"formats/list":h.default,"formats/bold":q.default,"formats/code":R.Code,"formats/italic":w.default,"formats/link":O.default,"formats/script":E.default,"formats/strike":j.default,"formats/underline":T.default,"formats/image":P.default,"formats/video":L.default,"formats/list/item":p.ListItem,"modules/formula":B.default,"modules/syntax":U.default,"modules/toolbar":F.default,"themes/bubble":tt.default,"themes/snow":nt.default,"ui/icons":K.default,"ui/picker":V.default,"ui/icon-picker":$.default,"ui/color-picker":Z.default,"ui/tooltip":Q.default},!0),e.default=i.default},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.IndentClass=void 0;var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"add",value:function(t,n){if("+1"===n||"-1"===n){var r=this.value(t)||0;n="+1"===n?r+1:r-1}return 0===n?(this.remove(t),!0):a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"add",this).call(this,t,n)}},{key:"canAdd",value:function(t,n){return a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"canAdd",this).call(this,t,n)||a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"canAdd",this).call(this,t,parseInt(n))}},{key:"value",value:function(t){return parseInt(a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"value",this).call(this,t))||void 0}}]),e}(u.default.Attributor.Class),f=new c("indent","ql-indent",{scope:u.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});e.IndentClass=f},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(4),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default);s.blotName="blockquote",s.tagName="blockquote",e.default=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=n(4),s=function(t){return t&&t.__esModule?t:{default:t}}(a),u=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,null,[{key:"formats",value:function(t){return this.tagName.indexOf(t.tagName)+1}}]),e}(s.default);u.blotName="header",u.tagName=["H1","H2","H3","H4","H5","H6"],e.default=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.ListItem=void 0;var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},c=n(0),f=r(c),d=n(4),p=r(d),h=n(25),y=r(h),b=function(t){function e(){return i(this,e),l(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),s(e,[{key:"format",value:function(t,n){t!==v.blotName||n?u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n):this.replaceWith(f.default.create(this.statics.scope))}},{key:"remove",value:function(){null==this.prev&&null==this.next?this.parent.remove():u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(t,n){return this.parent.isolate(this.offset(this.parent),this.length()),t===this.parent.statics.blotName?(this.parent.replaceWith(t,n),this):(this.parent.unwrap(),u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replaceWith",this).call(this,t,n))}}],[{key:"formats",value:function(t){return t.tagName===this.tagName?void 0:u(e.__proto__||Object.getPrototypeOf(e),"formats",this).call(this,t)}}]),e}(p.default);b.blotName="list-item",b.tagName="LI";var v=function(t){function e(t){i(this,e);var n=l(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),r=function(e){if(e.target.parentNode===t){var r=n.statics.formats(t),o=f.default.find(e.target);"checked"===r?o.format("list","unchecked"):"unchecked"===r&&o.format("list","checked")}};return t.addEventListener("touchstart",r),t.addEventListener("mousedown",r),n}return a(e,t),s(e,null,[{key:"create",value:function(t){var n="ordered"===t?"OL":"UL",r=u(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,n);return"checked"!==t&&"unchecked"!==t||r.setAttribute("data-checked","checked"===t),r}},{key:"formats",value:function(t){return"OL"===t.tagName?"ordered":"UL"===t.tagName?t.hasAttribute("data-checked")?"true"===t.getAttribute("data-checked")?"checked":"unchecked":"bullet":void 0}}]),s(e,[{key:"format",value:function(t,e){this.children.length>0&&this.children.tail.format(t,e)}},{key:"formats",value:function(){return o({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(t,n){if(t instanceof b)u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"insertBefore",this).call(this,t,n);else{var r=null==n?this.length():n.offset(this),o=this.split(r);o.parent.insertBefore(t,o)}}},{key:"optimize",value:function(t){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"optimize",this).call(this,t);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&n.domNode.tagName===this.domNode.tagName&&n.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(n.moveChildren(this),n.remove())}},{key:"replace",value:function(t){if(t.statics.blotName!==this.statics.blotName){var n=f.default.create(this.statics.defaultChild);t.moveChildren(n),this.appendChild(n)}u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replace",this).call(this,t)}}]),e}(y.default);v.blotName="list",v.scope=f.default.Scope.BLOCK_BLOT,v.tagName=["OL","UL"],v.defaultChild="list-item",v.allowedChildren=[b],e.ListItem=b,e.default=v},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(56),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default);s.blotName="italic",s.tagName=["EM","I"],e.default=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(6),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,null,[{key:"create",value:function(t){return"super"===t?document.createElement("sup"):"sub"===t?document.createElement("sub"):a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t)}},{key:"formats",value:function(t){return"SUB"===t.tagName?"sub":"SUP"===t.tagName?"super":void 0}}]),e}(u.default);c.blotName="script",c.tagName=["SUB","SUP"],e.default=c},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(6),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default);s.blotName="strike",s.tagName="S",e.default=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(6),a=function(t){return t&&t.__esModule?t:{default:t}}(l),s=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(a.default);s.blotName="underline",s.tagName="U",e.default=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(0),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c=n(27),f=["alt","height","width"],d=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"format",value:function(t,n){f.indexOf(t)>-1?n?this.domNode.setAttribute(t,n):this.domNode.removeAttribute(t):a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n)}}],[{key:"create",value:function(t){var n=a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return"string"==typeof t&&n.setAttribute("src",this.sanitize(t)),n}},{key:"formats",value:function(t){return f.reduce(function(e,n){return t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e},{})}},{key:"match",value:function(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}},{key:"sanitize",value:function(t){return(0,c.sanitize)(t,["http","https","data"])?t:"//:0"}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(u.default.Embed);d.blotName="image",d.tagName="IMG",e.default=d},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=n(4),u=n(27),c=function(t){return t&&t.__esModule?t:{default:t}}(u),f=["height","width"],d=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),l(e,[{key:"format",value:function(t,n){f.indexOf(t)>-1?n?this.domNode.setAttribute(t,n):this.domNode.removeAttribute(t):a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"format",this).call(this,t,n)}}],[{key:"create",value:function(t){var n=a(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",!0),n.setAttribute("src",this.sanitize(t)),n}},{key:"formats",value:function(t){return f.reduce(function(e,n){return t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e},{})}},{key:"sanitize",value:function(t){return c.default.sanitize(t)}},{key:"value",value:function(t){return t.getAttribute("src")}}]),e}(s.BlockEmbed);d.blotName="video",d.className="ql-video",d.tagName="IFRAME",e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.FormulaBlot=void 0;var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(35),c=r(u),f=n(5),d=r(f),p=n(9),h=r(p),y=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),a(e,null,[{key:"create",value:function(t){var n=s(e.__proto__||Object.getPrototypeOf(e),"create",this).call(this,t);return"string"==typeof t&&(window.katex.render(t,n,{throwOnError:!1,errorColor:"#f00"}),n.setAttribute("data-value",t)),n}},{key:"value",value:function(t){return t.getAttribute("data-value")}}]),e}(c.default);y.blotName="formula",y.className="ql-formula",y.tagName="SPAN";var b=function(t){function e(){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));if(null==window.katex)throw new Error("Formula module requires KaTeX.");return t}return l(e,t),a(e,null,[{key:"register",value:function(){d.default.register(y,!0)}}]),e}(h.default);e.FormulaBlot=y,e.default=b},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.CodeToken=e.CodeBlock=void 0;var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},u=n(0),c=r(u),f=n(5),d=r(f),p=n(9),h=r(p),y=n(13),b=r(y),v=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return l(e,t),a(e,[{key:"replaceWith",value:function(t){this.domNode.textContent=this.domNode.textContent,this.attach(),s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"replaceWith",this).call(this,t)}},{key:"highlight",value:function(t){var e=this.domNode.textContent;this.cachedText!==e&&((e.trim().length>0||null==this.cachedText)&&(this.domNode.innerHTML=t(e),this.domNode.normalize(),this.attach()),this.cachedText=e)}}]),e}(b.default);v.className="ql-syntax";var g=new c.default.Attributor.Class("token","hljs",{scope:c.default.Scope.INLINE}),m=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));if("function"!=typeof r.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var l=null;return r.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(l),l=setTimeout(function(){r.highlight(),l=null},r.options.interval)}),r.highlight(),r}return l(e,t),a(e,null,[{key:"register",value:function(){d.default.register(g,!0),d.default.register(v,!0)}}]),a(e,[{key:"highlight",value:function(){var t=this;if(!this.quill.selection.composing){this.quill.update(d.default.sources.USER);var e=this.quill.getSelection();this.quill.scroll.descendants(v).forEach(function(e){e.highlight(t.options.highlight)}),this.quill.update(d.default.sources.SILENT),null!=e&&this.quill.setSelection(e,d.default.sources.SILENT)}}}]),e}(h.default);m.DEFAULTS={highlight:function(){return null==window.hljs?null:function(t){return window.hljs.highlightAuto(t).value}}(),interval:1e3},e.CodeBlock=v,e.CodeToken=g,e.default=m},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <g class="ql-fill ql-color-label"> <polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>'},function(t,e){t.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>'},function(t,e){t.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>'},function(t,e){t.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class="ql-even ql-stroke" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class="ql-even ql-stroke" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class="ql-stroke ql-thin" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class="ql-stroke ql-thin" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'},function(t,e){t.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'},function(t,e){t.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.BubbleTooltip=void 0;var a=function t(e,n,r){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,n,r)}if("value"in o)return o.value;var l=o.get;if(void 0!==l)return l.call(r)},s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(3),c=r(u),f=n(8),d=r(f),p=n(43),h=r(p),y=n(15),b=n(41),v=r(b),g=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],m=function(t){function e(t,n){o(this,e),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=g);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.quill.container.classList.add("ql-bubble"),r}return l(e,t),s(e,[{key:"extendToolbar",value:function(t){this.tooltip=new q(this.quill,this.options.bounds),this.tooltip.root.appendChild(t.container),this.buildButtons([].slice.call(t.container.querySelectorAll("button")),v.default),this.buildPickers([].slice.call(t.container.querySelectorAll("select")),v.default)}}]),e}(h.default);m.DEFAULTS=(0,c.default)(!0,{},h.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var q=function(t){function e(t,n){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.quill.on(d.default.events.EDITOR_CHANGE,function(t,e,n,o){if(t===d.default.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&o===d.default.sources.USER){r.show(),r.root.style.left="0px",r.root.style.width="",r.root.style.width=r.root.offsetWidth+"px";var i=r.quill.getLines(e.index,e.length);if(1===i.length)r.position(r.quill.getBounds(e));else{var l=i[i.length-1],a=r.quill.getIndex(l),s=Math.min(l.length()-1,e.index+e.length-a),u=r.quill.getBounds(new y.Range(a,s));r.position(u)}}else document.activeElement!==r.textbox&&r.quill.hasFocus()&&r.hide()}),r}return l(e,t),s(e,[{key:"listen",value:function(){var t=this;a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){t.root.classList.remove("ql-editing")}),this.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!t.root.classList.contains("ql-hidden")){var e=t.quill.getSelection();null!=e&&t.position(t.quill.getBounds(e))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(t){var n=a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"position",this).call(this,t),r=this.root.querySelector(".ql-tooltip-arrow");if(r.style.marginLeft="",0===n)return n;r.style.marginLeft=-1*n-r.offsetWidth/2+"px"}}]),e}(p.BaseTooltip);q.TEMPLATE=['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""),e.BubbleTooltip=q,e.default=m},function(t,e,n){t.exports=n(63)}]).default})}).call(e,n(14).Buffer)},function(t,e){function n(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=r(o);return[n].concat(o.sources.map(function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"})).concat([i]).join("\n")}return[n].join("\n")}function r(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r=n(e,t);return e[2]?"@media "+e[2]+"{"+r+"}":r}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var l=t[o];"number"==typeof l[0]&&r[l[0]]||(n&&!l[2]?l[2]=n:n&&(l[2]="("+l[2]+") and ("+n+")"),e.push(l))}},e}},function(t,e,n){function r(t){for(var e=0;e<t.length;e++){var n=t[e],r=c[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(i(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{for(var l=[],o=0;o<n.parts.length;o++)l.push(i(n.parts[o]));c[n.id]={id:n.id,refs:1,parts:l}}}}function o(){var t=document.createElement("style");return t.type="text/css",f.appendChild(t),t}function i(t){var e,n,r=document.querySelector("style["+v+'~="'+t.id+'"]');if(r){if(h)return y;r.parentNode.removeChild(r)}if(g){var i=p++;r=d||(d=o()),e=l.bind(null,r,i,!1),n=l.bind(null,r,i,!0)}else r=o(),e=a.bind(null,r),n=function(){r.parentNode.removeChild(r)};return e(t),function(r){if(r){if(r.css===t.css&&r.media===t.media&&r.sourceMap===t.sourceMap)return;e(t=r)}else n()}}function l(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=m(e,o);else{var i=document.createTextNode(o),l=t.childNodes;l[e]&&t.removeChild(l[e]),l.length?t.insertBefore(i,l[e]):t.appendChild(i)}}function a(t,e){var n=e.css,r=e.media,o=e.sourceMap;if(r&&t.setAttribute("media",r),b.ssrId&&t.setAttribute(v,e.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var s="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!s)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var u=n(10),c={},f=s&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,h=!1,y=function(){},b=null,v="data-vue-ssr-id",g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,o){h=n,b=o||{};var i=u(t,e);return r(i),function(e){for(var n=[],o=0;o<i.length;o++){var l=i[o],a=c[l.id];a.refs--,n.push(a)}e?(i=u(t,e),r(i)):i=[];for(var o=0;o<n.length;o++){var a=n[o];if(0===a.refs){for(var s=0;s<a.parts.length;s++)a.parts[s]();delete c[a.id]}}}};var m=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(18),l=n(19),a=n.n(l),s=n(21),u=n(22),c=window.Quill||o.a;e.a={name:"VueEditor",mixins:[s.a],props:{id:{type:String,default:"quill-container"},placeholder:{type:String,default:""},value:{type:String,default:""},disabled:{type:Boolean},editorToolbar:Array,editorOptions:{type:Object,required:!1,default:function(){return{}}},useCustomImageHandler:{type:Boolean,default:!1},useMarkdownShortcuts:{type:Boolean,default:!1}},data:function(){return{quill:null}},mounted:function(){this.registerCustomModules(c),this.registerPrototypes(),this.initializeEditor()},methods:{initializeEditor:function(){this.setupQuillEditor(),this.checkForCustomImageHandler(),this.handleInitialContent(),this.registerEditorEventListeners(),this.$emit("ready",this.quill)},setupQuillEditor:function(){var t={debug:!1,modules:this.setModules(),theme:"snow",placeholder:this.placeholder?this.placeholder:"",readOnly:!!this.disabled&&this.disabled};this.prepareEditorConfig(t),this.quill=new c(this.$refs.quillContainer,t)},setModules:function(){var t={toolbar:this.editorToolbar?this.editorToolbar:i.a};return this.useMarkdownShortcuts&&(c.register("modules/markdownShortcuts",u.a,!0),t.markdownShortcuts={}),t},prepareEditorConfig:function(t){Object.keys(this.editorOptions).length>0&&this.editorOptions.constructor===Object&&(this.editorOptions.modules&&void 0!==this.editorOptions.modules.toolbar&&delete t.modules.toolbar,a()(t,this.editorOptions))},registerPrototypes:function(){c.prototype.getHTML=function(){return this.container.querySelector(".ql-editor").innerHTML},c.prototype.getWordCount=function(){return this.container.querySelector(".ql-editor").innerText.length}},registerEditorEventListeners:function(){this.quill.on("text-change",this.handleTextChange),this.quill.on("selection-change",this.handleSelectionChange),this.listenForEditorEvent("text-change"),this.listenForEditorEvent("selection-change"),this.listenForEditorEvent("editor-change")},listenForEditorEvent:function(t){var e=this;this.quill.on(t,function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.$emit.apply(e,[t].concat(r))})},handleInitialContent:function(){this.value&&(this.quill.root.innerHTML=this.value)},handleSelectionChange:function(t,e){!t&&e?this.$emit("blur",this.quill):t&&!e&&this.$emit("focus",this.quill)},handleTextChange:function(){var t="<p><br></p>"===this.quill.getHTML()?"":this.quill.getHTML();this.$emit("input",t)},checkForCustomImageHandler:function(){!0===this.useCustomImageHandler&&this.setupCustomImageHandler()},setupCustomImageHandler:function(){this.quill.getModule("toolbar").addHandler("image",this.customImageHandler)},customImageHandler:function(t,e){this.$refs.fileInput.click()},emitImageInfo:function(t){var e=function(){document.getElementById("file-upload").value=""},n=t.target.files[0],r=this.quill,o=r.getSelection(),i=o.index;this.$emit("imageAdded",n,r,i,e)}},watch:{value:function(t){t==this.quill.root.innerHTML||this.quill.hasFocus()||(this.quill.root.innerHTML=t)},disabled:function(t){this.quill.enable(!t)}},beforeDestroy:function(){this.quill=null,delete this.quill}}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){t.exports=n(6)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"Quill",function(){return l});var r=n(7),o=n(0),i=n.n(o);n.d(e,"VueEditor",function(){return r.a});var l=window.Quill||i.a,a={VueEditor:r.a,install:function(t){t.component(r.a.name,r.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(a),e.default=a},function(t,e,n){"use strict";function r(t){n(8),n(11)}var o=n(3),i=n(23),l=n(13),a=r,s=l(o.a,i.a,!1,a,null,null);e.a=s.exports},function(t,e,n){var r=n(9);"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);n(2)("2ce73493",r,!0,{sourceMap:!1})},function(t,e,n){e=t.exports=n(1)(!1),e.push([t.i,'/*!\n * Quill Editor v1.3.6\n * https://quilljs.com/\n * Copyright (c) 2014, Jason Chen\n * Copyright (c) 2013, salesforce.com\n */.ql-container{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Helvetica,Arial,sans-serif;font-size:13px;height:100%;margin:0;position:relative}.ql-container.ql-disabled .ql-tooltip{visibility:hidden}.ql-container.ql-disabled .ql-editor ul[data-checked]>li:before{pointer-events:none}.ql-clipboard{left:-100000px;height:1px;overflow-y:hidden;position:absolute;top:50%}.ql-clipboard p{margin:0;padding:0}.ql-editor{-webkit-box-sizing:border-box;box-sizing:border-box;line-height:1.42;height:100%;outline:none;overflow-y:auto;padding:12px 15px;-o-tab-size:4;tab-size:4;-moz-tab-size:4;text-align:left;white-space:pre-wrap;word-wrap:break-word}.ql-editor>*{cursor:text}.ql-editor blockquote,.ql-editor h1,.ql-editor h2,.ql-editor h3,.ql-editor h4,.ql-editor h5,.ql-editor h6,.ql-editor ol,.ql-editor p,.ql-editor pre,.ql-editor ul{margin:0;padding:0;counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol,.ql-editor ul{padding-left:1.5em}.ql-editor ol>li,.ql-editor ul>li{list-style-type:none}.ql-editor ul>li:before{content:"\\2022"}.ql-editor ul[data-checked=false],.ql-editor ul[data-checked=true]{pointer-events:none}.ql-editor ul[data-checked=false]>li *,.ql-editor ul[data-checked=true]>li *{pointer-events:all}.ql-editor ul[data-checked=false]>li:before,.ql-editor ul[data-checked=true]>li:before{color:#777;cursor:pointer;pointer-events:all}.ql-editor ul[data-checked=true]>li:before{content:"\\2611"}.ql-editor ul[data-checked=false]>li:before{content:"\\2610"}.ql-editor li:before{display:inline-block;white-space:nowrap;width:1.2em}.ql-editor li:not(.ql-direction-rtl):before{margin-left:-1.5em;margin-right:.3em;text-align:right}.ql-editor li.ql-direction-rtl:before{margin-left:.3em;margin-right:-1.5em}.ql-editor ol li:not(.ql-direction-rtl),.ql-editor ul li:not(.ql-direction-rtl){padding-left:1.5em}.ql-editor ol li.ql-direction-rtl,.ql-editor ul li.ql-direction-rtl{padding-right:1.5em}.ql-editor ol li{counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;counter-increment:list-0}.ql-editor ol li:before{content:counter(list-0,decimal) ". "}.ql-editor ol li.ql-indent-1{counter-increment:list-1}.ql-editor ol li.ql-indent-1:before{content:counter(list-1,lower-alpha) ". "}.ql-editor ol li.ql-indent-1{counter-reset:list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-2{counter-increment:list-2}.ql-editor ol li.ql-indent-2:before{content:counter(list-2,lower-roman) ". "}.ql-editor ol li.ql-indent-2{counter-reset:list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-3{counter-increment:list-3}.ql-editor ol li.ql-indent-3:before{content:counter(list-3,decimal) ". "}.ql-editor ol li.ql-indent-3{counter-reset:list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-4{counter-increment:list-4}.ql-editor ol li.ql-indent-4:before{content:counter(list-4,lower-alpha) ". "}.ql-editor ol li.ql-indent-4{counter-reset:list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-5{counter-increment:list-5}.ql-editor ol li.ql-indent-5:before{content:counter(list-5,lower-roman) ". "}.ql-editor ol li.ql-indent-5{counter-reset:list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-6{counter-increment:list-6}.ql-editor ol li.ql-indent-6:before{content:counter(list-6,decimal) ". "}.ql-editor ol li.ql-indent-6{counter-reset:list-7 list-8 list-9}.ql-editor ol li.ql-indent-7{counter-increment:list-7}.ql-editor ol li.ql-indent-7:before{content:counter(list-7,lower-alpha) ". "}.ql-editor ol li.ql-indent-7{counter-reset:list-8 list-9}.ql-editor ol li.ql-indent-8{counter-increment:list-8}.ql-editor ol li.ql-indent-8:before{content:counter(list-8,lower-roman) ". "}.ql-editor ol li.ql-indent-8{counter-reset:list-9}.ql-editor ol li.ql-indent-9{counter-increment:list-9}.ql-editor ol li.ql-indent-9:before{content:counter(list-9,decimal) ". "}.ql-editor .ql-indent-1:not(.ql-direction-rtl){padding-left:3em}.ql-editor li.ql-indent-1:not(.ql-direction-rtl){padding-left:4.5em}.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:3em}.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:4.5em}.ql-editor .ql-indent-2:not(.ql-direction-rtl){padding-left:6em}.ql-editor li.ql-indent-2:not(.ql-direction-rtl){padding-left:7.5em}.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:6em}.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:7.5em}.ql-editor .ql-indent-3:not(.ql-direction-rtl){padding-left:9em}.ql-editor li.ql-indent-3:not(.ql-direction-rtl){padding-left:10.5em}.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:9em}.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:10.5em}.ql-editor .ql-indent-4:not(.ql-direction-rtl){padding-left:12em}.ql-editor li.ql-indent-4:not(.ql-direction-rtl){padding-left:13.5em}.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:12em}.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:13.5em}.ql-editor .ql-indent-5:not(.ql-direction-rtl){padding-left:15em}.ql-editor li.ql-indent-5:not(.ql-direction-rtl){padding-left:16.5em}.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:15em}.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:16.5em}.ql-editor .ql-indent-6:not(.ql-direction-rtl){padding-left:18em}.ql-editor li.ql-indent-6:not(.ql-direction-rtl){padding-left:19.5em}.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:18em}.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:19.5em}.ql-editor .ql-indent-7:not(.ql-direction-rtl){padding-left:21em}.ql-editor li.ql-indent-7:not(.ql-direction-rtl){padding-left:22.5em}.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:21em}.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:22.5em}.ql-editor .ql-indent-8:not(.ql-direction-rtl){padding-left:24em}.ql-editor li.ql-indent-8:not(.ql-direction-rtl){padding-left:25.5em}.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:24em}.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:25.5em}.ql-editor .ql-indent-9:not(.ql-direction-rtl){padding-left:27em}.ql-editor li.ql-indent-9:not(.ql-direction-rtl){padding-left:28.5em}.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:27em}.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:28.5em}.ql-editor .ql-video{display:block;max-width:100%}.ql-editor .ql-video.ql-align-center{margin:0 auto}.ql-editor .ql-video.ql-align-right{margin:0 0 0 auto}.ql-editor .ql-bg-black{background-color:#000}.ql-editor .ql-bg-red{background-color:#e60000}.ql-editor .ql-bg-orange{background-color:#f90}.ql-editor .ql-bg-yellow{background-color:#ff0}.ql-editor .ql-bg-green{background-color:#008a00}.ql-editor .ql-bg-blue{background-color:#06c}.ql-editor .ql-bg-purple{background-color:#93f}.ql-editor .ql-color-white{color:#fff}.ql-editor .ql-color-red{color:#e60000}.ql-editor .ql-color-orange{color:#f90}.ql-editor .ql-color-yellow{color:#ff0}.ql-editor .ql-color-green{color:#008a00}.ql-editor .ql-color-blue{color:#06c}.ql-editor .ql-color-purple{color:#93f}.ql-editor .ql-font-serif{font-family:Georgia,Times New Roman,serif}.ql-editor .ql-font-monospace{font-family:Monaco,Courier New,monospace}.ql-editor .ql-size-small{font-size:.75em}.ql-editor .ql-size-large{font-size:1.5em}.ql-editor .ql-size-huge{font-size:2.5em}.ql-editor .ql-direction-rtl{direction:rtl;text-align:inherit}.ql-editor .ql-align-center{text-align:center}.ql-editor .ql-align-justify{text-align:justify}.ql-editor .ql-align-right{text-align:right}.ql-editor.ql-blank:before{color:rgba(0,0,0,.6);content:attr(data-placeholder);font-style:italic;left:15px;pointer-events:none;position:absolute;right:15px}.ql-snow.ql-toolbar:after,.ql-snow .ql-toolbar:after{clear:both;content:"";display:table}.ql-snow.ql-toolbar button,.ql-snow .ql-toolbar button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:28px}.ql-snow.ql-toolbar button svg,.ql-snow .ql-toolbar button svg{float:left;height:100%}.ql-snow.ql-toolbar button:active:hover,.ql-snow .ql-toolbar button:active:hover{outline:none}.ql-snow.ql-toolbar input.ql-image[type=file],.ql-snow .ql-toolbar input.ql-image[type=file]{display:none}.ql-snow.ql-toolbar .ql-picker-item.ql-selected,.ql-snow .ql-toolbar .ql-picker-item.ql-selected,.ql-snow.ql-toolbar .ql-picker-item:hover,.ql-snow .ql-toolbar .ql-picker-item:hover,.ql-snow.ql-toolbar .ql-picker-label.ql-active,.ql-snow .ql-toolbar .ql-picker-label.ql-active,.ql-snow.ql-toolbar .ql-picker-label:hover,.ql-snow .ql-toolbar .ql-picker-label:hover,.ql-snow.ql-toolbar button.ql-active,.ql-snow .ql-toolbar button.ql-active,.ql-snow.ql-toolbar button:focus,.ql-snow .ql-toolbar button:focus,.ql-snow.ql-toolbar button:hover,.ql-snow .ql-toolbar button:hover{color:#06c}.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar button:focus .ql-fill,.ql-snow .ql-toolbar button:focus .ql-fill,.ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow.ql-toolbar button:hover .ql-fill,.ql-snow .ql-toolbar button:hover .ql-fill,.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill{fill:#06c}.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow.ql-toolbar button.ql-active .ql-stroke,.ql-snow .ql-toolbar button.ql-active .ql-stroke,.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar button:focus .ql-stroke,.ql-snow .ql-toolbar button:focus .ql-stroke,.ql-snow.ql-toolbar button:focus .ql-stroke-miter,.ql-snow .ql-toolbar button:focus .ql-stroke-miter,.ql-snow.ql-toolbar button:hover .ql-stroke,.ql-snow .ql-toolbar button:hover .ql-stroke,.ql-snow.ql-toolbar button:hover .ql-stroke-miter,.ql-snow .ql-toolbar button:hover .ql-stroke-miter{stroke:#06c}@media (pointer:coarse){.ql-snow.ql-toolbar button:hover:not(.ql-active),.ql-snow .ql-toolbar button:hover:not(.ql-active){color:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill{fill:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter{stroke:#444}}.ql-snow,.ql-snow *{-webkit-box-sizing:border-box;box-sizing:border-box}.ql-snow .ql-hidden{display:none}.ql-snow .ql-out-bottom,.ql-snow .ql-out-top{visibility:hidden}.ql-snow .ql-tooltip{position:absolute;-webkit-transform:translateY(10px);-ms-transform:translateY(10px);transform:translateY(10px)}.ql-snow .ql-tooltip a{cursor:pointer;text-decoration:none}.ql-snow .ql-tooltip.ql-flip{-webkit-transform:translateY(-10px);-ms-transform:translateY(-10px);transform:translateY(-10px)}.ql-snow .ql-formats{display:inline-block;vertical-align:middle}.ql-snow .ql-formats:after{clear:both;content:"";display:table}.ql-snow .ql-stroke{fill:none;stroke:#444;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.ql-snow .ql-stroke-miter{fill:none;stroke:#444;stroke-miterlimit:10;stroke-width:2}.ql-snow .ql-fill,.ql-snow .ql-stroke.ql-fill{fill:#444}.ql-snow .ql-empty{fill:none}.ql-snow .ql-even{fill-rule:evenodd}.ql-snow .ql-stroke.ql-thin,.ql-snow .ql-thin{stroke-width:1}.ql-snow .ql-transparent{opacity:.4}.ql-snow .ql-direction svg:last-child{display:none}.ql-snow .ql-direction.ql-active svg:last-child{display:inline}.ql-snow .ql-direction.ql-active svg:first-child{display:none}.ql-snow .ql-editor h1{font-size:2em}.ql-snow .ql-editor h2{font-size:1.5em}.ql-snow .ql-editor h3{font-size:1.17em}.ql-snow .ql-editor h4{font-size:1em}.ql-snow .ql-editor h5{font-size:.83em}.ql-snow .ql-editor h6{font-size:.67em}.ql-snow .ql-editor a{text-decoration:underline}.ql-snow .ql-editor blockquote{border-left:4px solid #ccc;margin-bottom:5px;margin-top:5px;padding-left:16px}.ql-snow .ql-editor code,.ql-snow .ql-editor pre{background-color:#f0f0f0;border-radius:3px}.ql-snow .ql-editor pre{white-space:pre-wrap;margin-bottom:5px;margin-top:5px;padding:5px 10px}.ql-snow .ql-editor code{font-size:85%;padding:2px 4px}.ql-snow .ql-editor pre.ql-syntax{background-color:#23241f;color:#f8f8f2;overflow:visible}.ql-snow .ql-editor img{max-width:100%}.ql-snow .ql-picker{color:#444;display:inline-block;float:left;font-size:14px;font-weight:500;height:24px;position:relative;vertical-align:middle}.ql-snow .ql-picker-label{cursor:pointer;display:inline-block;height:100%;padding-left:8px;padding-right:2px;position:relative;width:100%}.ql-snow .ql-picker-label:before{display:inline-block;line-height:22px}.ql-snow .ql-picker-options{background-color:#fff;display:none;min-width:100%;padding:4px 8px;position:absolute;white-space:nowrap}.ql-snow .ql-picker-options .ql-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px}.ql-snow .ql-picker.ql-expanded .ql-picker-label{color:#ccc;z-index:2}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill{fill:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke{stroke:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-options{display:block;margin-top:-1px;top:100%;z-index:1}.ql-snow .ql-color-picker,.ql-snow .ql-icon-picker{width:28px}.ql-snow .ql-color-picker .ql-picker-label,.ql-snow .ql-icon-picker .ql-picker-label{padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-label svg,.ql-snow .ql-icon-picker .ql-picker-label svg{right:4px}.ql-snow .ql-icon-picker .ql-picker-options{padding:4px 0}.ql-snow .ql-icon-picker .ql-picker-item{height:24px;width:24px;padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-options{padding:3px 5px;width:152px}.ql-snow .ql-color-picker .ql-picker-item{border:1px solid transparent;float:left;height:16px;margin:2px;padding:0;width:16px}.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg{position:absolute;margin-top:-9px;right:0;top:50%;width:18px}.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=""]):before{content:attr(data-label)}.ql-snow .ql-picker.ql-header{width:98px}.ql-snow .ql-picker.ql-header .ql-picker-item:before,.ql-snow .ql-picker.ql-header .ql-picker-label:before{content:"Normal"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]:before{content:"Heading 1"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]:before{content:"Heading 2"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]:before{content:"Heading 3"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]:before{content:"Heading 4"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]:before{content:"Heading 5"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before,.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]:before{content:"Heading 6"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before{font-size:2em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before{font-size:1.5em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before{font-size:1.17em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before{font-size:1em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before{font-size:.83em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before{font-size:.67em}.ql-snow .ql-picker.ql-font{width:108px}.ql-snow .ql-picker.ql-font .ql-picker-item:before,.ql-snow .ql-picker.ql-font .ql-picker-label:before{content:"Sans Serif"}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before,.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]:before{content:"Serif"}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before,.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]:before{content:"Monospace"}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before{font-family:Georgia,Times New Roman,serif}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before{font-family:Monaco,Courier New,monospace}.ql-snow .ql-picker.ql-size{width:98px}.ql-snow .ql-picker.ql-size .ql-picker-item:before,.ql-snow .ql-picker.ql-size .ql-picker-label:before{content:"Normal"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]:before{content:"Small"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]:before{content:"Large"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]:before{content:"Huge"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before{font-size:10px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before{font-size:18px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before{font-size:32px}.ql-snow .ql-color-picker.ql-background .ql-picker-item{background-color:#fff}.ql-snow .ql-color-picker.ql-color .ql-picker-item{background-color:#000}.ql-toolbar.ql-snow{border:1px solid #ccc;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;padding:8px}.ql-toolbar.ql-snow .ql-formats{margin-right:15px}.ql-toolbar.ql-snow .ql-picker-label{border:1px solid transparent}.ql-toolbar.ql-snow .ql-picker-options{border:1px solid transparent;-webkit-box-shadow:rgba(0,0,0,.2) 0 2px 8px;box-shadow:0 2px 8px rgba(0,0,0,.2)}.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label,.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options{border-color:#ccc}.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected,.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover{border-color:#000}.ql-toolbar.ql-snow+.ql-container.ql-snow{border-top:0}.ql-snow .ql-tooltip{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:0 0 5px #ddd;box-shadow:0 0 5px #ddd;color:#444;padding:5px 12px;white-space:nowrap}.ql-snow .ql-tooltip:before{content:"Visit URL:";line-height:26px;margin-right:8px}.ql-snow .ql-tooltip input[type=text]{display:none;border:1px solid #ccc;font-size:13px;height:26px;margin:0;padding:3px 5px;width:170px}.ql-snow .ql-tooltip a.ql-preview{display:inline-block;max-width:200px;overflow-x:hidden;text-overflow:ellipsis;vertical-align:top}.ql-snow .ql-tooltip a.ql-action:after{border-right:1px solid #ccc;content:"Edit";margin-left:16px;padding-right:8px}.ql-snow .ql-tooltip a.ql-remove:before{content:"Remove";margin-left:8px}.ql-snow .ql-tooltip a{line-height:26px}.ql-snow .ql-tooltip.ql-editing a.ql-preview,.ql-snow .ql-tooltip.ql-editing a.ql-remove{display:none}.ql-snow .ql-tooltip.ql-editing input[type=text]{display:inline-block}.ql-snow .ql-tooltip.ql-editing a.ql-action:after{border-right:0;content:"Save";padding-right:0}.ql-snow .ql-tooltip[data-mode=link]:before{content:"Enter link:"}.ql-snow .ql-tooltip[data-mode=formula]:before{content:"Enter formula:"}.ql-snow .ql-tooltip[data-mode=video]:before{content:"Enter video:"}.ql-snow a{color:#06c}.ql-container.ql-snow{border:1px solid #ccc}',""])},function(t,e){t.exports=function(t,e){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],l=i[0],a=i[1],s=i[2],u=i[3],c={id:t+":"+o,css:a,media:s,sourceMap:u};r[l]?r[l].parts.push(c):n.push(r[l]={id:l,parts:[c]})}return n}},function(t,e,n){var r=n(12);"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);n(2)("b2290b1a",r,!0,{sourceMap:!1})},function(t,e,n){e=t.exports=n(1)(!1),e.push([t.i,".ql-editor{min-height:200px;font-size:16px}.ql-snow .ql-stroke.ql-thin,.ql-snow .ql-thin{stroke-width:1px!important}.quillWrapper .ql-snow.ql-toolbar{padding-top:8px;padding-bottom:4px}.quillWrapper .ql-snow.ql-toolbar .ql-formats{margin-bottom:10px}.ql-snow .ql-toolbar button svg,.quillWrapper .ql-snow.ql-toolbar button svg{width:22px;height:22px}.quillWrapper .ql-editor ul[data-checked=false]>li:before,.quillWrapper .ql-editor ul[data-checked=true]>li:before{font-size:1.35em;vertical-align:baseline;bottom:-.065em;font-weight:900;color:#222}.quillWrapper .ql-snow .ql-stroke{stroke:rgba(63,63,63,.95);stroke-linecap:square;stroke-linejoin:initial;stroke-width:1.7px}.quillWrapper .ql-picker-label{font-size:15px}.quillWrapper .ql-snow .ql-active .ql-stroke{stroke-width:2.25px}.quillWrapper .ql-toolbar.ql-snow .ql-formats{vertical-align:top}.ql-picker:not(.ql-background){position:relative;top:2px}.ql-picker.ql-color-picker svg{width:22px!important;height:22px!important}.quillWrapper .imageResizeActive img{display:block;cursor:pointer}.quillWrapper .imageResizeActive~div svg{cursor:pointer}",""])},function(t,e){t.exports=function(t,e,n,r,o,i){var l,a=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(l=t,a=t.default);var u="function"==typeof a?a.options:a;e&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),o&&(u._scopeId=o);var c;if(i?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},u._ssrRegister=c):r&&(c=r),c){var f=u.functional,d=f?u.render:u.beforeCreate;f?(u._injectStyles=c,u.render=function(t,e){return c.call(e),d(t,e)}):u.beforeCreate=d?[].concat(d,c):[c]}return{esModule:l,exports:a,options:u}}},function(t,e,n){"use strict";(function(t){function r(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return i.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=i.prototype):(null===t&&(t=new i(e)),t.length=e),t}function i(t,e,n){if(!(i.TYPED_ARRAY_SUPPORT||this instanceof i))return new i(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(this,t)}return l(this,t,e,n)}function l(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?d(t,e,n,r):"string"==typeof e?c(t,e,n):p(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,n,r){return a(e),e<=0?o(t,e):void 0!==n?"string"==typeof r?o(t,e).fill(n,r):o(t,e).fill(n):o(t,e)}function u(t,e){if(a(e),t=o(t,e<0?0:0|h(e)),!i.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function c(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!i.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|b(e,n);t=o(t,r);var l=t.write(e,n);return l!==r&&(t=t.slice(0,l)),t}function f(t,e){var n=e.length<0?0:0|h(e.length);t=o(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),i.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=i.prototype):t=f(t,e),t}function p(t,e){if(i.isBuffer(e)){var n=0|h(e.length);return t=o(t,n),0===t.length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||G(e.length)?o(t,0):f(t,e);if("Buffer"===e.type&&Q(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function h(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function b(t,e){if(i.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(t).length;default:if(r)return K(t).length;e=(""+e).toLowerCase(),r=!0}}function v(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return j(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return S(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=i.from(e,r)),i.isBuffer(e))return 0===e.length?-1:q(t,e,n,r,o);if("number"==typeof e)return e&=255,i.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):q(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function q(t,e,n,r,o){function i(t,e){return 1===l?t[e]:t.readUInt16BE(e*l)}var l=1,a=t.length,s=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;l=2,a/=2,s/=2,n/=2}var u;if(o){var c=-1;for(u=n;u<a;u++)if(i(t,u)===i(e,-1===c?0:u-c)){if(-1===c&&(c=u),u-c+1===s)return c*l}else-1!==c&&(u-=u-c),c=-1}else for(n+s>a&&(n=a-s),u=n;u>=0;u--){for(var f=!0,d=0;d<s;d++)if(i(t,u+d)!==i(e,d)){f=!1;break}if(f)return u}return-1}function _(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var l=0;l<r;++l){var a=parseInt(e.substr(2*l,2),16);if(isNaN(a))return l;t[n+l]=a}return l}function w(t,e,n,r){return Z(K(e,t.length-n),t,n,r)}function k(t,e,n,r){return Z(Y(e),t,n,r)}function O(t,e,n,r){return k(t,e,n,r)}function x(t,e,n,r){return Z(W(e),t,n,r)}function E(t,e,n,r){return Z(V(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?$.fromByteArray(t):$.fromByteArray(t.slice(e,n))}function j(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i=t[o],l=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a<=n){var s,u,c,f;switch(a){case 1:i<128&&(l=i);break;case 2:s=t[o+1],128==(192&s)&&(f=(31&i)<<6|63&s)>127&&(l=f);break;case 3:s=t[o+1],u=t[o+2],128==(192&s)&&128==(192&u)&&(f=(15&i)<<12|(63&s)<<6|63&u)>2047&&(f<55296||f>57343)&&(l=f);break;case 4:s=t[o+1],u=t[o+2],c=t[o+3],128==(192&s)&&128==(192&u)&&128==(192&c)&&(f=(15&i)<<18|(63&s)<<12|(63&u)<<6|63&c)>65535&&f<1114112&&(l=f)}}null===l?(l=65533,a=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=a}return N(r)}function N(t){var e=t.length;if(e<=J)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=J));return n}function T(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function S(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function P(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=H(t[i]);return o}function C(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function L(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,n,r,o,l){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<l)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function M(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function I(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function B(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(t,e,n,r,o){return o||B(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,n,r,23,4),n+4}function U(t,e,n,r,o){return o||B(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,n,r,52,8),n+8}function z(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){e=e||1/0;for(var n,r=t.length,o=null,i=[],l=0;l<r;++l){if((n=t.charCodeAt(l))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(l+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Y(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function V(t,e){for(var n,r,o,i=[],l=0;l<t.length&&!((e-=2)<0);++l)n=t.charCodeAt(l),r=n>>8,o=n%256,i.push(o),i.push(r);return i}function W(t){return $.toByteArray(z(t))}function Z(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function G(t){return t!==t}var $=n(15),X=n(16),Q=n(17);e.Buffer=i,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50,i.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),i.poolSize=8192,i._augment=function(t){return t.__proto__=i.prototype,t},i.from=function(t,e,n){return l(null,t,e,n)},i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})),i.alloc=function(t,e,n){return s(null,t,e,n)},i.allocUnsafe=function(t){return u(null,t)},i.allocUnsafeSlow=function(t){return u(null,t)},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,l=Math.min(n,r);o<l;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=i.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var l=t[n];if(!i.isBuffer(l))throw new TypeError('"list" argument must be an Array of Buffers');l.copy(r,o),o+=l.length}return r},i.byteLength=b,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},i.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?j(this,0,t):v.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},i.prototype.compare=function(t,e,n,r,o){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var l=o-r,a=n-e,s=Math.min(l,a),u=this.slice(r,o),c=t.slice(e,n),f=0;f<s;++f)if(u[f]!==c[f]){l=u[f],a=c[f];break}return l<a?-1:a<l?1:0},i.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},i.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},i.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},i.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return k(this,t,e,n);case"latin1":case"binary":return O(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;i.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r;if(i.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=i.prototype;else{var o=e-t;r=new i(o,void 0);for(var l=0;l<o;++l)r[l]=this[l+t]}return r},i.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},i.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){R(this,t,e,n,Math.pow(2,8*n)-1,0)}var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},i.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){R(this,t,e,n,Math.pow(2,8*n)-1,0)}var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,255,0),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):I(this,t,e,!0),e+4},i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);R(this,t,e,n,o-1,-o)}var i=0,l=1,a=0;for(this[e]=255&t;++i<n&&(l*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/l>>0)-a&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);R(this,t,e,n,o-1,-o)}var i=n-1,l=1,a=0;for(this[e+i]=255&t;--i>=0&&(l*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/l>>0)-a&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,127,-128),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):I(this,t,e,!0),e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},i.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,l=r-n;if(this===t&&n<e&&e<r)for(o=l-1;o>=0;--o)t[o+e]=this[o+n];else if(l<1e3||!i.TYPED_ARRAY_SUPPORT)for(o=0;o<l;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+l),e);return l},i.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var l;if("number"==typeof t)for(l=e;l<n;++l)this[l]=t;else{var a=i.isBuffer(t)?t:K(new i(t,r).toString()),s=a.length;for(l=0;l<n-e;++l)this[l+e]=a[l%s]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,n(4))},function(t,e,n){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function o(t){var e=r(t),n=e[0],o=e[1];return 3*(n+o)/4-o}function i(t,e,n){return 3*(e+n)/4-n}function l(t){for(var e,n=r(t),o=n[0],l=n[1],a=new d(i(t,o,l)),s=0,u=l>0?o-4:o,c=0;c<u;c+=4)e=f[t.charCodeAt(c)]<<18|f[t.charCodeAt(c+1)]<<12|f[t.charCodeAt(c+2)]<<6|f[t.charCodeAt(c+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===l&&(e=f[t.charCodeAt(c)]<<2|f[t.charCodeAt(c+1)]>>4,a[s++]=255&e),1===l&&(e=f[t.charCodeAt(c)]<<10|f[t.charCodeAt(c+1)]<<4|f[t.charCodeAt(c+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a}function a(t){return c[t>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}function s(t,e,n){for(var r,o=[],i=e;i<n;i+=3)r=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(a(r));return o.join("")}function u(t){for(var e,n=t.length,r=n%3,o=[],i=0,l=n-r;i<l;i+=16383)o.push(s(t,i,i+16383>l?l:i+16383));return 1===r?(e=t[n-1],o.push(c[e>>2]+c[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(c[e>>10]+c[e>>4&63]+c[e<<2&63]+"=")),o.join("")}e.byteLength=o,e.toByteArray=l,e.fromByteArray=u;for(var c=[],f=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=p.length;h<y;++h)c[h]=p[h],f[p.charCodeAt(h)]=h;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,o){var i,l,a=8*o-r-1,s=(1<<a)-1,u=s>>1,c=-7,f=n?o-1:0,d=n?-1:1,p=t[e+f];for(f+=d,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[e+f],f+=d,c-=8);for(l=i&(1<<-c)-1,i>>=-c,c+=r;c>0;l=256*l+t[e+f],f+=d,c-=8);if(0===i)i=1-u;else{if(i===s)return l?NaN:1/0*(p?-1:1);l+=Math.pow(2,r),i-=u}return(p?-1:1)*l*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var l,a,s,u=8*i-o-1,c=(1<<u)-1,f=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,l=c):(l=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-l))<1&&(l--,s*=2),e+=l+f>=1?d/s:d*Math.pow(2,1-f),e*s>=2&&(l++,s/=2),l+f>=c?(a=0,l=c):l+f>=1?(a=(e*s-1)*Math.pow(2,o),l+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),l=0));o>=8;t[n+p]=255&a,p+=h,a/=256,o-=8);for(l=l<<o|a,u+=o;u>0;t[n+p]=255&l,p+=h,l/=256,u-=8);t[n+p-h]|=128*y}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";var r=[[{header:[!1,1,2,3,4,5,6]}],["bold","italic","underline","strike"],[{align:""},{align:"center"},{align:"right"},{align:"justify"}],["blockquote","code-block"],[{list:"ordered"},{list:"bullet"},{list:"check"}],[{indent:"-1"},{indent:"+1"}],[{color:[]},{background:[]}],["link","image","video"],["clean"]];e.a=r},function(t,e,n){(function(t,n){function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function o(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function i(t,e){return null==t?void 0:t[e]}function l(t,e){return"__proto__"==e?void 0:t[e]}function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function s(){this.__data__=ve?ve(null):{},this.size=0}function u(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function c(t){var e=this.__data__;if(ve){var n=e[t];return n===wt?void 0:n}return Qt.call(e,t)?e[t]:void 0}function f(t){var e=this.__data__;return ve?void 0!==e[t]:Qt.call(e,t)}function d(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ve&&void 0===e?wt:e,this}function p(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function h(){this.__data__=[],this.size=0}function y(t){var e=this.__data__,n=L(e,t);return!(n<0)&&(n==e.length-1?e.pop():ce.call(e,n,1),--this.size,!0)}function b(t){var e=this.__data__,n=L(e,t);return n<0?void 0:e[n][1]}function v(t){return L(this.__data__,t)>-1}function g(t,e){var n=this.__data__,r=L(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function m(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function q(){this.size=0,this.__data__={hash:new a,map:new(be||p),string:new a}}function _(t){var e=G(this,t).delete(t);return this.size-=e?1:0,e}function w(t){return G(this,t).get(t)}function k(t){return G(this,t).has(t)}function O(t,e){var n=G(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function x(t){var e=this.__data__=new p(t);this.size=e.size}function E(){this.__data__=new p,this.size=0}function A(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function j(t){return this.__data__.get(t)}function N(t){return this.__data__.has(t)}function T(t,e){var n=this.__data__;if(n instanceof p){var r=n.__data__;if(!be||r.length<_t-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new m(r)}return n.set(t,e),this.size=n.size,this}function S(t,e){var n=ke(t),r=!n&&we(t),i=!n&&!r&&Oe(t),l=!n&&!r&&!i&&xe(t),a=n||r||i||l,s=a?o(t.length,String):[],u=s.length;for(var c in t)!e&&!Qt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||l&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||J(c,u))||s.push(c);return s}function P(t,e,n){(void 0===n||st(t[e],n))&&(void 0!==n||e in t)||R(t,e,n)}function C(t,e,n){var r=t[e];Qt.call(t,e)&&st(r,n)&&(void 0!==n||e in t)||R(t,e,n)}function L(t,e){for(var n=t.length;n--;)if(st(t[n][0],e))return n;return-1}function R(t,e,n){"__proto__"==e&&de?de(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function M(t){return null==t?void 0===t?Ct:Tt:fe&&fe in Object(t)?X(t):it(t)}function I(t){return ht(t)&&M(t)==Et}function B(t){return!(!pt(t)||nt(t))&&(ft(t)?ne:Rt).test(at(t))}function D(t){return ht(t)&&dt(t.length)&&!!It[M(t)]}function U(t){if(!pt(t))return ot(t);var e=rt(t),n=[];for(var r in t)("constructor"!=r||!e&&Qt.call(t,r))&&n.push(r);return n}function z(t,e,n,r,o){t!==e&&me(e,function(i,a){if(pt(i))o||(o=new x),F(t,e,a,n,z,r,o);else{var s=r?r(l(t,a),i,a+"",t,e,o):void 0;void 0===s&&(s=i),P(t,a,s)}},vt)}function F(t,e,n,r,o,i,a){var s=l(t,n),u=l(e,n),c=a.get(u);if(c)return void P(t,n,c);var f=i?i(s,u,n+"",t,e,a):void 0,d=void 0===f;if(d){var p=ke(u),h=!p&&Oe(u),y=!p&&!h&&xe(u);f=u,p||h||y?ke(s)?f=s:ct(s)?f=W(s):h?(d=!1,f=K(u,!0)):y?(d=!1,f=V(u,!0)):f=[]:yt(u)||we(u)?(f=s,we(s)?f=bt(s):(!pt(s)||r&&ft(s))&&(f=Q(u))):d=!1}d&&(a.set(u,f),o(f,u,r,i,a),a.delete(u)),P(t,n,f)}function H(t,e){return _e(lt(t,e,mt),t+"")}function K(t,e){if(e)return t.slice();var n=t.length,r=le?le(n):new t.constructor(n);return t.copy(r),r}function Y(t){var e=new t.constructor(t.byteLength);return new ie(e).set(new ie(t)),e}function V(t,e){var n=e?Y(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function W(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function Z(t,e,n,r){var o=!n;n||(n={});for(var i=-1,l=e.length;++i<l;){var a=e[i],s=r?r(n[a],t[a],a,n,t):void 0;void 0===s&&(s=t[a]),o?R(n,a,s):C(n,a,s)}return n}function G(t,e){var n=t.__data__;return et(e)?n["string"==typeof e?"string":"hash"]:n.map}function $(t,e){var n=i(t,e);return B(n)?n:void 0}function X(t){var e=Qt.call(t,fe),n=t[fe];try{t[fe]=void 0;var r=!0}catch(t){}var o=te.call(t);return r&&(e?t[fe]=n:delete t[fe]),o}function Q(t){return"function"!=typeof t.constructor||rt(t)?{}:ge(ae(t))}function J(t,e){var n=typeof t;return!!(e=null==e?xt:e)&&("number"==n||"symbol"!=n&&Mt.test(t))&&t>-1&&t%1==0&&t<e}function tt(t,e,n){if(!pt(n))return!1;var r=typeof e;return!!("number"==r?ut(n)&&J(e,n.length):"string"==r&&e in n)&&st(n[e],t)}function et(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function nt(t){return!!Jt&&Jt in t}function rt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Gt)}function ot(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}function it(t){return te.call(t)}function lt(t,e,n){return e=he(void 0===e?t.length-1:e,0),function(){for(var o=arguments,i=-1,l=he(o.length-e,0),a=Array(l);++i<l;)a[i]=o[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=o[i];return s[e]=n(a),r(t,this,s)}}function at(t){if(null!=t){try{return Xt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function st(t,e){return t===e||t!==t&&e!==e}function ut(t){return null!=t&&dt(t.length)&&!ft(t)}function ct(t){return ht(t)&&ut(t)}function ft(t){if(!pt(t))return!1;var e=M(t);return e==jt||e==Nt||e==At||e==Pt}function dt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=xt}function pt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ht(t){return null!=t&&"object"==typeof t}function yt(t){if(!ht(t)||M(t)!=St)return!1;var e=ae(t);if(null===e)return!0;var n=Qt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Xt.call(n)==ee}function bt(t){return Z(t,vt(t))}function vt(t){return ut(t)?S(t,!0):U(t)}function gt(t){return function(){return t}}function mt(t){return t}function qt(){return!1}var _t=200,wt="__lodash_hash_undefined__",kt=800,Ot=16,xt=9007199254740991,Et="[object Arguments]",At="[object AsyncFunction]",jt="[object Function]",Nt="[object GeneratorFunction]",Tt="[object Null]",St="[object Object]",Pt="[object Proxy]",Ct="[object Undefined]",Lt=/[\\^$.*+?()[\]{}|]/g,Rt=/^\[object .+?Constructor\]$/,Mt=/^(?:0|[1-9]\d*)$/,It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It[Et]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It[jt]=It["[object Map]"]=It["[object Number]"]=It[St]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Bt="object"==typeof t&&t&&t.Object===Object&&t,Dt="object"==typeof self&&self&&self.Object===Object&&self,Ut=Bt||Dt||Function("return this")(),zt="object"==typeof e&&e&&!e.nodeType&&e,Ft=zt&&"object"==typeof n&&n&&!n.nodeType&&n,Ht=Ft&&Ft.exports===zt,Kt=Ht&&Bt.process,Yt=function(){try{return Kt&&Kt.binding&&Kt.binding("util")}catch(t){}}(),Vt=Yt&&Yt.isTypedArray,Wt=Array.prototype,Zt=Function.prototype,Gt=Object.prototype,$t=Ut["__core-js_shared__"],Xt=Zt.toString,Qt=Gt.hasOwnProperty,Jt=function(){var t=/[^.]+$/.exec($t&&$t.keys&&$t.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),te=Gt.toString,ee=Xt.call(Object),ne=RegExp("^"+Xt.call(Qt).replace(Lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=Ht?Ut.Buffer:void 0,oe=Ut.Symbol,ie=Ut.Uint8Array,le=re?re.allocUnsafe:void 0,ae=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),se=Object.create,ue=Gt.propertyIsEnumerable,ce=Wt.splice,fe=oe?oe.toStringTag:void 0,de=function(){try{var t=$(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),pe=re?re.isBuffer:void 0,he=Math.max,ye=Date.now,be=$(Ut,"Map"),ve=$(Object,"create"),ge=function(){function t(){}return function(e){if(!pt(e))return{};if(se)return se(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();a.prototype.clear=s,a.prototype.delete=u,a.prototype.get=c,a.prototype.has=f,a.prototype.set=d,p.prototype.clear=h,p.prototype.delete=y,p.prototype.get=b,p.prototype.has=v,p.prototype.set=g,m.prototype.clear=q,m.prototype.delete=_,m.prototype.get=w,m.prototype.has=k,m.prototype.set=O,x.prototype.clear=E,x.prototype.delete=A,x.prototype.get=j,x.prototype.has=N,x.prototype.set=T;var me=function(t){return function(e,n,r){for(var o=-1,i=Object(e),l=r(e),a=l.length;a--;){var s=l[t?a:++o];if(!1===n(i[s],s,i))break}return e}}(),qe=de?function(t,e){return de(t,"toString",{configurable:!0,enumerable:!1,value:gt(e),writable:!0})}:mt,_e=function(t){var e=0,n=0;return function(){var r=ye(),o=Ot-(r-n);if(n=r,o>0){if(++e>=kt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(qe),we=I(function(){return arguments}())?I:function(t){return ht(t)&&Qt.call(t,"callee")&&!ue.call(t,"callee")},ke=Array.isArray,Oe=pe||qt,xe=Vt?function(t){return function(e){return t(e)}}(Vt):D,Ee=function(t){return H(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,l=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,l&&tt(n[0],n[1],l)&&(i=o<3?void 0:i,o=1),e=Object(e);++r<o;){var a=n[r];a&&t(e,a,r,i)}return e})}(function(t,e,n){z(t,e,n)});n.exports=Ee}).call(e,n(4),n(20)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";e.a={props:{customModules:Array},methods:{registerCustomModules:function(t){void 0!==this.customModules&&this.customModules.forEach(function(e){t.register("modules/"+e.alias,e.module)})}}}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=n(0),a=n.n(l),s=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=a.a.import("blots/block/embed"),f=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),e}(c);f.blotName="hr",f.tagName="hr",a.a.register("formats/horizontal",f);var d=function(){function t(e,n){var o=this;r(this,t),this.quill=e,this.options=n,this.ignoreTags=["PRE"],this.matches=[{name:"header",pattern:/^(#){1,6}\s/g,action:function(t,e,n){var r=n.exec(t);if(r){var i=r[0].length;setTimeout(function(){o.quill.formatLine(e.index,0,"header",i-1),o.quill.deleteText(e.index-i,i)},0)}}},{name:"blockquote",pattern:/^(>)\s/g,action:function(t,e){setTimeout(function(){o.quill.formatLine(e.index,1,"blockquote",!0),o.quill.deleteText(e.index-2,2)},0)}},{name:"code-block",pattern:/^`{3}(?:\s|\n)/g,action:function(t,e){setTimeout(function(){o.quill.formatLine(e.index,1,"code-block",!0),o.quill.deleteText(e.index-4,4)},0)}},{name:"bolditalic",pattern:/(?:\*|_){3}(.+?)(?:\*|_){3}/g,action:function(t,e,n,r){var i=n.exec(t),l=i[0],a=i[1],s=r+i.index;t.match(/^([*_ \n]+)$/g)||setTimeout(function(){o.quill.deleteText(s,l.length),o.quill.insertText(s,a,{bold:!0,italic:!0}),o.quill.format("bold",!1)},0)}},{name:"bold",pattern:/(?:\*|_){2}(.+?)(?:\*|_){2}/g,action:function(t,e,n,r){var i=n.exec(t),l=i[0],a=i[1],s=r+i.index;t.match(/^([*_ \n]+)$/g)||setTimeout(function(){o.quill.deleteText(s,l.length),o.quill.insertText(s,a,{bold:!0}),o.quill.format("bold",!1)},0)}},{name:"italic",pattern:/(?:\*|_){1}(.+?)(?:\*|_){1}/g,action:function(t,e,n,r){var i=n.exec(t),l=i[0],a=i[1],s=r+i.index;t.match(/^([*_ \n]+)$/g)||setTimeout(function(){o.quill.deleteText(s,l.length),o.quill.insertText(s,a,{italic:!0}),o.quill.format("italic",!1)},0)}},{name:"strikethrough",pattern:/(?:~~)(.+?)(?:~~)/g,action:function(t,e,n,r){var i=n.exec(t),l=i[0],a=i[1],s=r+i.index;t.match(/^([*_ \n]+)$/g)||setTimeout(function(){o.quill.deleteText(s,l.length),o.quill.insertText(s,a,{strike:!0}),o.quill.format("strike",!1)},0)}},{name:"code",pattern:/(?:`)(.+?)(?:`)/g,action:function(t,e,n,r){var i=n.exec(t),l=i[0],a=i[1],s=r+i.index;t.match(/^([*_ \n]+)$/g)||setTimeout(function(){o.quill.deleteText(s,l.length),o.quill.insertText(s,a,{code:!0}),o.quill.format("code",!1),o.quill.insertText(o.quill.getSelection()," ")},0)}},{name:"hr",pattern:/^([-*]\s?){3}/g,action:function(t,e){var n=e.index-t.length;setTimeout(function(){o.quill.deleteText(n,t.length),o.quill.insertEmbed(n+1,"hr",!0,a.a.sources.USER),o.quill.insertText(n+2,"\n",a.a.sources.SILENT),o.quill.setSelection(n+2,a.a.sources.SILENT)},0)}},{name:"asterisk-ul",pattern:/^(\*|\+)\s$/g,action:function(t,e,n){setTimeout(function(){o.quill.formatLine(e.index,1,"list","unordered"),o.quill.deleteText(e.index-2,2)},0)}},{name:"image",pattern:/(?:!\[(.+?)\])(?:\((.+?)\))/g,action:function(t,e,n){var r=t.search(n),i=t.match(n)[0],l=t.match(/(?:\((.*?)\))/g)[0],a=e.index-i.length-1;-1!==r&&setTimeout(function(){o.quill.deleteText(a,i.length),o.quill.insertEmbed(a,"image",l.slice(1,l.length-1))},0)}},{name:"link",pattern:/(?:\[(.+?)\])(?:\((.+?)\))/g,action:function(t,e,n){var r=t.search(n),i=t.match(n)[0],l=t.match(/(?:\[(.*?)\])/g)[0],a=t.match(/(?:\((.*?)\))/g)[0],s=e.index-i.length-1;-1!==r&&setTimeout(function(){o.quill.deleteText(s,i.length),o.quill.insertText(s,l.slice(1,l.length-1),"link",a.slice(1,a.length-1))},0)}}],this.quill.on("text-change",function(t,e,n){for(var r=0;r<t.ops.length;r++)t.ops[r].hasOwnProperty("insert")&&(" "===t.ops[r].insert?o.onSpace():"\n"===t.ops[r].insert&&o.onEnter())})}return u(t,[{key:"isValid",value:function(t,e){return void 0!==t&&t&&-1===this.ignoreTags.indexOf(e)}},{key:"onSpace",value:function(){var t=this.quill.getSelection();if(t){var e=this.quill.getLine(t.index),n=s(e,2),r=n[0],o=n[1],i=r.domNode.textContent,l=t.index-o;if(this.isValid(i,r.domNode.tagName)){var a=!0,u=!1,c=void 0;try{for(var f,d=this.matches[Symbol.iterator]();!(a=(f=d.next()).done);a=!0){var p=f.value;if(i.match(p.pattern))return console.log("matched:",p.name,i),void p.action(i,t,p.pattern,l)}}catch(t){u=!0,c=t}finally{try{!a&&d.return&&d.return()}finally{if(u)throw c}}}}}},{key:"onEnter",value:function(){var t=this.quill.getSelection();if(t){var e=this.quill.getLine(t.index),n=s(e,2),r=n[0],o=n[1],i=r.domNode.textContent+" ",l=t.index-o;if(t.length=t.index++,this.isValid(i,r.domNode.tagName)){var a=!0,u=!1,c=void 0;try{for(var f,d=this.matches[Symbol.iterator]();!(a=(f=d.next()).done);a=!0){var p=f.value;if(i.match(p.pattern))return console.log("matched",p.name,i),void p.action(i,t,p.pattern,l)}}catch(t){u=!0,c=t}finally{try{!a&&d.return&&d.return()}finally{if(u)throw c}}}}}}]),t}();e.a=d},function(t,e,n){"use strict";var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"quillWrapper"},[t._t("toolbar"),t._v(" "),n("div",{ref:"quillContainer",attrs:{id:t.id}}),t._v(" "),t.useCustomImageHandler?n("input",{ref:"fileInput",staticStyle:{display:"none"},attrs:{id:"file-upload",type:"file",accept:"image/*"},on:{change:function(e){t.emitImageInfo(e)}}}):t._e()],2)},o=[],i={render:r,staticRenderFns:o};e.a=i}])});
|
||
/**
|
||
* Swiper 4.5.0
|
||
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||
* http://www.idangero.us/swiper/
|
||
*
|
||
* Copyright 2014-2019 Vladimir Kharlampidi
|
||
*
|
||
* Released under the MIT License
|
||
*
|
||
* Released on: February 22, 2019
|
||
*/
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Swiper=t()}(this,function(){"use strict";var f="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,J="undefined"==typeof window?{document:f,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window,l=function(e){for(var t=0;t<e.length;t+=1)this[t]=e[t];return this.length=e.length,this};function L(e,t){var a=[],i=0;if(e&&!t&&e instanceof l)return e;if(e)if("string"==typeof e){var s,r,n=e.trim();if(0<=n.indexOf("<")&&0<=n.indexOf(">")){var o="div";for(0===n.indexOf("<li")&&(o="ul"),0===n.indexOf("<tr")&&(o="tbody"),0!==n.indexOf("<td")&&0!==n.indexOf("<th")||(o="tr"),0===n.indexOf("<tbody")&&(o="table"),0===n.indexOf("<option")&&(o="select"),(r=f.createElement(o)).innerHTML=n,i=0;i<r.childNodes.length;i+=1)a.push(r.childNodes[i])}else for(s=t||"#"!==e[0]||e.match(/[ .<>:~]/)?(t||f).querySelectorAll(e.trim()):[f.getElementById(e.trim().split("#")[1])],i=0;i<s.length;i+=1)s[i]&&a.push(s[i])}else if(e.nodeType||e===J||e===f)a.push(e);else if(0<e.length&&e[0].nodeType)for(i=0;i<e.length;i+=1)a.push(e[i]);return new l(a)}function r(e){for(var t=[],a=0;a<e.length;a+=1)-1===t.indexOf(e[a])&&t.push(e[a]);return t}L.fn=l.prototype,L.Class=l,L.Dom7=l;var t={addClass:function(e){if(void 0===e)return this;for(var t=e.split(" "),a=0;a<t.length;a+=1)for(var i=0;i<this.length;i+=1)void 0!==this[i]&&void 0!==this[i].classList&&this[i].classList.add(t[a]);return this},removeClass:function(e){for(var t=e.split(" "),a=0;a<t.length;a+=1)for(var i=0;i<this.length;i+=1)void 0!==this[i]&&void 0!==this[i].classList&&this[i].classList.remove(t[a]);return this},hasClass:function(e){return!!this[0]&&this[0].classList.contains(e)},toggleClass:function(e){for(var t=e.split(" "),a=0;a<t.length;a+=1)for(var i=0;i<this.length;i+=1)void 0!==this[i]&&void 0!==this[i].classList&&this[i].classList.toggle(t[a]);return this},attr:function(e,t){var a=arguments;if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(var i=0;i<this.length;i+=1)if(2===a.length)this[i].setAttribute(e,t);else for(var s in e)this[i][s]=e[s],this[i].setAttribute(s,e[s]);return this},removeAttr:function(e){for(var t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},data:function(e,t){var a;if(void 0!==t){for(var i=0;i<this.length;i+=1)(a=this[i]).dom7ElementDataStorage||(a.dom7ElementDataStorage={}),a.dom7ElementDataStorage[e]=t;return this}if(a=this[0]){if(a.dom7ElementDataStorage&&e in a.dom7ElementDataStorage)return a.dom7ElementDataStorage[e];var s=a.getAttribute("data-"+e);return s||void 0}},transform:function(e){for(var t=0;t<this.length;t+=1){var a=this[t].style;a.webkitTransform=e,a.transform=e}return this},transition:function(e){"string"!=typeof e&&(e+="ms");for(var t=0;t<this.length;t+=1){var a=this[t].style;a.webkitTransitionDuration=e,a.transitionDuration=e}return this},on:function(){for(var e,t=[],a=arguments.length;a--;)t[a]=arguments[a];var i=t[0],r=t[1],n=t[2],s=t[3];function o(e){var t=e.target;if(t){var a=e.target.dom7EventData||[];if(a.indexOf(e)<0&&a.unshift(e),L(t).is(r))n.apply(t,a);else for(var i=L(t).parents(),s=0;s<i.length;s+=1)L(i[s]).is(r)&&n.apply(i[s],a)}}function l(e){var t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),n.apply(this,t)}"function"==typeof t[1]&&(i=(e=t)[0],n=e[1],s=e[2],r=void 0),s||(s=!1);for(var d,p=i.split(" "),c=0;c<this.length;c+=1){var u=this[c];if(r)for(d=0;d<p.length;d+=1){var h=p[d];u.dom7LiveListeners||(u.dom7LiveListeners={}),u.dom7LiveListeners[h]||(u.dom7LiveListeners[h]=[]),u.dom7LiveListeners[h].push({listener:n,proxyListener:o}),u.addEventListener(h,o,s)}else for(d=0;d<p.length;d+=1){var v=p[d];u.dom7Listeners||(u.dom7Listeners={}),u.dom7Listeners[v]||(u.dom7Listeners[v]=[]),u.dom7Listeners[v].push({listener:n,proxyListener:l}),u.addEventListener(v,l,s)}}return this},off:function(){for(var e,t=[],a=arguments.length;a--;)t[a]=arguments[a];var i=t[0],s=t[1],r=t[2],n=t[3];"function"==typeof t[1]&&(i=(e=t)[0],r=e[1],n=e[2],s=void 0),n||(n=!1);for(var o=i.split(" "),l=0;l<o.length;l+=1)for(var d=o[l],p=0;p<this.length;p+=1){var c=this[p],u=void 0;if(!s&&c.dom7Listeners?u=c.dom7Listeners[d]:s&&c.dom7LiveListeners&&(u=c.dom7LiveListeners[d]),u&&u.length)for(var h=u.length-1;0<=h;h-=1){var v=u[h];r&&v.listener===r?(c.removeEventListener(d,v.proxyListener,n),u.splice(h,1)):r&&v.listener&&v.listener.dom7proxy&&v.listener.dom7proxy===r?(c.removeEventListener(d,v.proxyListener,n),u.splice(h,1)):r||(c.removeEventListener(d,v.proxyListener,n),u.splice(h,1))}}return this},trigger:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var a=e[0].split(" "),i=e[1],s=0;s<a.length;s+=1)for(var r=a[s],n=0;n<this.length;n+=1){var o=this[n],l=void 0;try{l=new J.CustomEvent(r,{detail:i,bubbles:!0,cancelable:!0})}catch(e){(l=f.createEvent("Event")).initEvent(r,!0,!0),l.detail=i}o.dom7EventData=e.filter(function(e,t){return 0<t}),o.dispatchEvent(l),o.dom7EventData=[],delete o.dom7EventData}return this},transitionEnd:function(t){var a,i=["webkitTransitionEnd","transitionend"],s=this;function r(e){if(e.target===this)for(t.call(this,e),a=0;a<i.length;a+=1)s.off(i[a],r)}if(t)for(a=0;a<i.length;a+=1)s.on(i[a],r);return this},outerWidth:function(e){if(0<this.length){if(e){var t=this.styles();return this[0].offsetWidth+parseFloat(t.getPropertyValue("margin-right"))+parseFloat(t.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},outerHeight:function(e){if(0<this.length){if(e){var t=this.styles();return this[0].offsetHeight+parseFloat(t.getPropertyValue("margin-top"))+parseFloat(t.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(0<this.length){var e=this[0],t=e.getBoundingClientRect(),a=f.body,i=e.clientTop||a.clientTop||0,s=e.clientLeft||a.clientLeft||0,r=e===J?J.scrollY:e.scrollTop,n=e===J?J.scrollX:e.scrollLeft;return{top:t.top+r-i,left:t.left+n-s}}return null},css:function(e,t){var a;if(1===arguments.length){if("string"!=typeof e){for(a=0;a<this.length;a+=1)for(var i in e)this[a].style[i]=e[i];return this}if(this[0])return J.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(a=0;a<this.length;a+=1)this[a].style[e]=t;return this}return this},each:function(e){if(!e)return this;for(var t=0;t<this.length;t+=1)if(!1===e.call(this[t],t,this[t]))return this;return this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:void 0;for(var t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(var t=0;t<this.length;t+=1)this[t].textContent=e;return this},is:function(e){var t,a,i=this[0];if(!i||void 0===e)return!1;if("string"==typeof e){if(i.matches)return i.matches(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);for(t=L(e),a=0;a<t.length;a+=1)if(t[a]===i)return!0;return!1}if(e===f)return i===f;if(e===J)return i===J;if(e.nodeType||e instanceof l){for(t=e.nodeType?[e]:e,a=0;a<t.length;a+=1)if(t[a]===i)return!0;return!1}return!1},index:function(){var e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},eq:function(e){if(void 0===e)return this;var t,a=this.length;return new l(a-1<e?[]:e<0?(t=a+e)<0?[]:[this[t]]:[this[e]])},append:function(){for(var e,t=[],a=arguments.length;a--;)t[a]=arguments[a];for(var i=0;i<t.length;i+=1){e=t[i];for(var s=0;s<this.length;s+=1)if("string"==typeof e){var r=f.createElement("div");for(r.innerHTML=e;r.firstChild;)this[s].appendChild(r.firstChild)}else if(e instanceof l)for(var n=0;n<e.length;n+=1)this[s].appendChild(e[n]);else this[s].appendChild(e)}return this},prepend:function(e){var t,a;for(t=0;t<this.length;t+=1)if("string"==typeof e){var i=f.createElement("div");for(i.innerHTML=e,a=i.childNodes.length-1;0<=a;a-=1)this[t].insertBefore(i.childNodes[a],this[t].childNodes[0])}else if(e instanceof l)for(a=0;a<e.length;a+=1)this[t].insertBefore(e[a],this[t].childNodes[0]);else this[t].insertBefore(e,this[t].childNodes[0]);return this},next:function(e){return 0<this.length?e?this[0].nextElementSibling&&L(this[0].nextElementSibling).is(e)?new l([this[0].nextElementSibling]):new l([]):this[0].nextElementSibling?new l([this[0].nextElementSibling]):new l([]):new l([])},nextAll:function(e){var t=[],a=this[0];if(!a)return new l([]);for(;a.nextElementSibling;){var i=a.nextElementSibling;e?L(i).is(e)&&t.push(i):t.push(i),a=i}return new l(t)},prev:function(e){if(0<this.length){var t=this[0];return e?t.previousElementSibling&&L(t.previousElementSibling).is(e)?new l([t.previousElementSibling]):new l([]):t.previousElementSibling?new l([t.previousElementSibling]):new l([])}return new l([])},prevAll:function(e){var t=[],a=this[0];if(!a)return new l([]);for(;a.previousElementSibling;){var i=a.previousElementSibling;e?L(i).is(e)&&t.push(i):t.push(i),a=i}return new l(t)},parent:function(e){for(var t=[],a=0;a<this.length;a+=1)null!==this[a].parentNode&&(e?L(this[a].parentNode).is(e)&&t.push(this[a].parentNode):t.push(this[a].parentNode));return L(r(t))},parents:function(e){for(var t=[],a=0;a<this.length;a+=1)for(var i=this[a].parentNode;i;)e?L(i).is(e)&&t.push(i):t.push(i),i=i.parentNode;return L(r(t))},closest:function(e){var t=this;return void 0===e?new l([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},find:function(e){for(var t=[],a=0;a<this.length;a+=1)for(var i=this[a].querySelectorAll(e),s=0;s<i.length;s+=1)t.push(i[s]);return new l(t)},children:function(e){for(var t=[],a=0;a<this.length;a+=1)for(var i=this[a].childNodes,s=0;s<i.length;s+=1)e?1===i[s].nodeType&&L(i[s]).is(e)&&t.push(i[s]):1===i[s].nodeType&&t.push(i[s]);return new l(r(t))},remove:function(){for(var e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},add:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var a,i;for(a=0;a<e.length;a+=1){var s=L(e[a]);for(i=0;i<s.length;i+=1)this[this.length]=s[i],this.length+=1}return this},styles:function(){return this[0]?J.getComputedStyle(this[0],null):{}}};Object.keys(t).forEach(function(e){L.fn[e]=t[e]});var e,a,i,s,ee={deleteProps:function(e){var t=e;Object.keys(t).forEach(function(e){try{t[e]=null}catch(e){}try{delete t[e]}catch(e){}})},nextTick:function(e,t){return void 0===t&&(t=0),setTimeout(e,t)},now:function(){return Date.now()},getTranslate:function(e,t){var a,i,s;void 0===t&&(t="x");var r=J.getComputedStyle(e,null);return J.WebKitCSSMatrix?(6<(i=r.transform||r.webkitTransform).split(",").length&&(i=i.split(", ").map(function(e){return e.replace(",",".")}).join(", ")),s=new J.WebKitCSSMatrix("none"===i?"":i)):a=(s=r.MozTransform||r.OTransform||r.MsTransform||r.msTransform||r.transform||r.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,")).toString().split(","),"x"===t&&(i=J.WebKitCSSMatrix?s.m41:16===a.length?parseFloat(a[12]):parseFloat(a[4])),"y"===t&&(i=J.WebKitCSSMatrix?s.m42:16===a.length?parseFloat(a[13]):parseFloat(a[5])),i||0},parseUrlQuery:function(e){var t,a,i,s,r={},n=e||J.location.href;if("string"==typeof n&&n.length)for(s=(a=(n=-1<n.indexOf("?")?n.replace(/\S*\?/,""):"").split("&").filter(function(e){return""!==e})).length,t=0;t<s;t+=1)i=a[t].replace(/#\S+/g,"").split("="),r[decodeURIComponent(i[0])]=void 0===i[1]?void 0:decodeURIComponent(i[1])||"";return r},isObject:function(e){return"object"==typeof e&&null!==e&&e.constructor&&e.constructor===Object},extend:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var a=Object(e[0]),i=1;i<e.length;i+=1){var s=e[i];if(null!=s)for(var r=Object.keys(Object(s)),n=0,o=r.length;n<o;n+=1){var l=r[n],d=Object.getOwnPropertyDescriptor(s,l);void 0!==d&&d.enumerable&&(ee.isObject(a[l])&&ee.isObject(s[l])?ee.extend(a[l],s[l]):!ee.isObject(a[l])&&ee.isObject(s[l])?(a[l]={},ee.extend(a[l],s[l])):a[l]=s[l])}}return a}},te=(i=f.createElement("div"),{touch:J.Modernizr&&!0===J.Modernizr.touch||!!(0<J.navigator.maxTouchPoints||"ontouchstart"in J||J.DocumentTouch&&f instanceof J.DocumentTouch),pointerEvents:!!(J.navigator.pointerEnabled||J.PointerEvent||"maxTouchPoints"in J.navigator&&0<J.navigator.maxTouchPoints),prefixedPointerEvents:!!J.navigator.msPointerEnabled,transition:(a=i.style,"transition"in a||"webkitTransition"in a||"MozTransition"in a),transforms3d:J.Modernizr&&!0===J.Modernizr.csstransforms3d||(e=i.style,"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e),flexbox:function(){for(var e=i.style,t="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" "),a=0;a<t.length;a+=1)if(t[a]in e)return!0;return!1}(),observer:"MutationObserver"in J||"WebkitMutationObserver"in J,passiveListener:function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});J.addEventListener("testPassiveListener",null,t)}catch(e){}return e}(),gestures:"ongesturestart"in J}),I={isIE:!!J.navigator.userAgent.match(/Trident/g)||!!J.navigator.userAgent.match(/MSIE/g),isEdge:!!J.navigator.userAgent.match(/Edge/g),isSafari:(s=J.navigator.userAgent.toLowerCase(),0<=s.indexOf("safari")&&s.indexOf("chrome")<0&&s.indexOf("android")<0),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(J.navigator.userAgent)},n=function(e){void 0===e&&(e={});var t=this;t.params=e,t.eventsListeners={},t.params&&t.params.on&&Object.keys(t.params.on).forEach(function(e){t.on(e,t.params.on[e])})},o={components:{configurable:!0}};n.prototype.on=function(e,t,a){var i=this;if("function"!=typeof t)return i;var s=a?"unshift":"push";return e.split(" ").forEach(function(e){i.eventsListeners[e]||(i.eventsListeners[e]=[]),i.eventsListeners[e][s](t)}),i},n.prototype.once=function(a,i,e){var s=this;if("function"!=typeof i)return s;function r(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];i.apply(s,e),s.off(a,r),r.f7proxy&&delete r.f7proxy}return r.f7proxy=i,s.on(a,r,e)},n.prototype.off=function(e,i){var s=this;return s.eventsListeners&&e.split(" ").forEach(function(a){void 0===i?s.eventsListeners[a]=[]:s.eventsListeners[a]&&s.eventsListeners[a].length&&s.eventsListeners[a].forEach(function(e,t){(e===i||e.f7proxy&&e.f7proxy===i)&&s.eventsListeners[a].splice(t,1)})}),s},n.prototype.emit=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var a,i,s,r=this;return r.eventsListeners&&("string"==typeof e[0]||Array.isArray(e[0])?(a=e[0],i=e.slice(1,e.length),s=r):(a=e[0].events,i=e[0].data,s=e[0].context||r),(Array.isArray(a)?a:a.split(" ")).forEach(function(e){if(r.eventsListeners&&r.eventsListeners[e]){var t=[];r.eventsListeners[e].forEach(function(e){t.push(e)}),t.forEach(function(e){e.apply(s,i)})}})),r},n.prototype.useModulesParams=function(a){var i=this;i.modules&&Object.keys(i.modules).forEach(function(e){var t=i.modules[e];t.params&&ee.extend(a,t.params)})},n.prototype.useModules=function(i){void 0===i&&(i={});var s=this;s.modules&&Object.keys(s.modules).forEach(function(e){var a=s.modules[e],t=i[e]||{};a.instance&&Object.keys(a.instance).forEach(function(e){var t=a.instance[e];s[e]="function"==typeof t?t.bind(s):t}),a.on&&s.on&&Object.keys(a.on).forEach(function(e){s.on(e,a.on[e])}),a.create&&a.create.bind(s)(t)})},o.components.set=function(e){this.use&&this.use(e)},n.installModule=function(t){for(var e=[],a=arguments.length-1;0<a--;)e[a]=arguments[a+1];var i=this;i.prototype.modules||(i.prototype.modules={});var s=t.name||Object.keys(i.prototype.modules).length+"_"+ee.now();return(i.prototype.modules[s]=t).proto&&Object.keys(t.proto).forEach(function(e){i.prototype[e]=t.proto[e]}),t.static&&Object.keys(t.static).forEach(function(e){i[e]=t.static[e]}),t.install&&t.install.apply(i,e),i},n.use=function(e){for(var t=[],a=arguments.length-1;0<a--;)t[a]=arguments[a+1];var i=this;return Array.isArray(e)?(e.forEach(function(e){return i.installModule(e)}),i):i.installModule.apply(i,[e].concat(t))},Object.defineProperties(n,o);var d={updateSize:function(){var e,t,a=this,i=a.$el;e=void 0!==a.params.width?a.params.width:i[0].clientWidth,t=void 0!==a.params.height?a.params.height:i[0].clientHeight,0===e&&a.isHorizontal()||0===t&&a.isVertical()||(e=e-parseInt(i.css("padding-left"),10)-parseInt(i.css("padding-right"),10),t=t-parseInt(i.css("padding-top"),10)-parseInt(i.css("padding-bottom"),10),ee.extend(a,{width:e,height:t,size:a.isHorizontal()?e:t}))},updateSlides:function(){var e=this,t=e.params,a=e.$wrapperEl,i=e.size,s=e.rtlTranslate,r=e.wrongRTL,n=e.virtual&&t.virtual.enabled,o=n?e.virtual.slides.length:e.slides.length,l=a.children("."+e.params.slideClass),d=n?e.virtual.slides.length:l.length,p=[],c=[],u=[],h=t.slidesOffsetBefore;"function"==typeof h&&(h=t.slidesOffsetBefore.call(e));var v=t.slidesOffsetAfter;"function"==typeof v&&(v=t.slidesOffsetAfter.call(e));var f=e.snapGrid.length,m=e.snapGrid.length,g=t.spaceBetween,b=-h,w=0,y=0;if(void 0!==i){var x,T;"string"==typeof g&&0<=g.indexOf("%")&&(g=parseFloat(g.replace("%",""))/100*i),e.virtualSize=-g,s?l.css({marginLeft:"",marginTop:""}):l.css({marginRight:"",marginBottom:""}),1<t.slidesPerColumn&&(x=Math.floor(d/t.slidesPerColumn)===d/e.params.slidesPerColumn?d:Math.ceil(d/t.slidesPerColumn)*t.slidesPerColumn,"auto"!==t.slidesPerView&&"row"===t.slidesPerColumnFill&&(x=Math.max(x,t.slidesPerView*t.slidesPerColumn)));for(var E,S=t.slidesPerColumn,C=x/S,M=Math.floor(d/t.slidesPerColumn),z=0;z<d;z+=1){T=0;var P=l.eq(z);if(1<t.slidesPerColumn){var k=void 0,$=void 0,L=void 0;"column"===t.slidesPerColumnFill?(L=z-($=Math.floor(z/S))*S,(M<$||$===M&&L===S-1)&&S<=(L+=1)&&(L=0,$+=1),k=$+L*x/S,P.css({"-webkit-box-ordinal-group":k,"-moz-box-ordinal-group":k,"-ms-flex-order":k,"-webkit-order":k,order:k})):$=z-(L=Math.floor(z/C))*C,P.css("margin-"+(e.isHorizontal()?"top":"left"),0!==L&&t.spaceBetween&&t.spaceBetween+"px").attr("data-swiper-column",$).attr("data-swiper-row",L)}if("none"!==P.css("display")){if("auto"===t.slidesPerView){var I=J.getComputedStyle(P[0],null),D=P[0].style.transform,O=P[0].style.webkitTransform;if(D&&(P[0].style.transform="none"),O&&(P[0].style.webkitTransform="none"),t.roundLengths)T=e.isHorizontal()?P.outerWidth(!0):P.outerHeight(!0);else if(e.isHorizontal()){var A=parseFloat(I.getPropertyValue("width")),H=parseFloat(I.getPropertyValue("padding-left")),N=parseFloat(I.getPropertyValue("padding-right")),G=parseFloat(I.getPropertyValue("margin-left")),B=parseFloat(I.getPropertyValue("margin-right")),X=I.getPropertyValue("box-sizing");T=X&&"border-box"===X?A+G+B:A+H+N+G+B}else{var Y=parseFloat(I.getPropertyValue("height")),V=parseFloat(I.getPropertyValue("padding-top")),F=parseFloat(I.getPropertyValue("padding-bottom")),R=parseFloat(I.getPropertyValue("margin-top")),q=parseFloat(I.getPropertyValue("margin-bottom")),W=I.getPropertyValue("box-sizing");T=W&&"border-box"===W?Y+R+q:Y+V+F+R+q}D&&(P[0].style.transform=D),O&&(P[0].style.webkitTransform=O),t.roundLengths&&(T=Math.floor(T))}else T=(i-(t.slidesPerView-1)*g)/t.slidesPerView,t.roundLengths&&(T=Math.floor(T)),l[z]&&(e.isHorizontal()?l[z].style.width=T+"px":l[z].style.height=T+"px");l[z]&&(l[z].swiperSlideSize=T),u.push(T),t.centeredSlides?(b=b+T/2+w/2+g,0===w&&0!==z&&(b=b-i/2-g),0===z&&(b=b-i/2-g),Math.abs(b)<.001&&(b=0),t.roundLengths&&(b=Math.floor(b)),y%t.slidesPerGroup==0&&p.push(b),c.push(b)):(t.roundLengths&&(b=Math.floor(b)),y%t.slidesPerGroup==0&&p.push(b),c.push(b),b=b+T+g),e.virtualSize+=T+g,w=T,y+=1}}if(e.virtualSize=Math.max(e.virtualSize,i)+v,s&&r&&("slide"===t.effect||"coverflow"===t.effect)&&a.css({width:e.virtualSize+t.spaceBetween+"px"}),te.flexbox&&!t.setWrapperSize||(e.isHorizontal()?a.css({width:e.virtualSize+t.spaceBetween+"px"}):a.css({height:e.virtualSize+t.spaceBetween+"px"})),1<t.slidesPerColumn&&(e.virtualSize=(T+t.spaceBetween)*x,e.virtualSize=Math.ceil(e.virtualSize/t.slidesPerColumn)-t.spaceBetween,e.isHorizontal()?a.css({width:e.virtualSize+t.spaceBetween+"px"}):a.css({height:e.virtualSize+t.spaceBetween+"px"}),t.centeredSlides)){E=[];for(var j=0;j<p.length;j+=1){var U=p[j];t.roundLengths&&(U=Math.floor(U)),p[j]<e.virtualSize+p[0]&&E.push(U)}p=E}if(!t.centeredSlides){E=[];for(var K=0;K<p.length;K+=1){var _=p[K];t.roundLengths&&(_=Math.floor(_)),p[K]<=e.virtualSize-i&&E.push(_)}p=E,1<Math.floor(e.virtualSize-i)-Math.floor(p[p.length-1])&&p.push(e.virtualSize-i)}if(0===p.length&&(p=[0]),0!==t.spaceBetween&&(e.isHorizontal()?s?l.css({marginLeft:g+"px"}):l.css({marginRight:g+"px"}):l.css({marginBottom:g+"px"})),t.centerInsufficientSlides){var Z=0;if(u.forEach(function(e){Z+=e+(t.spaceBetween?t.spaceBetween:0)}),(Z-=t.spaceBetween)<i){var Q=(i-Z)/2;p.forEach(function(e,t){p[t]=e-Q}),c.forEach(function(e,t){c[t]=e+Q})}}ee.extend(e,{slides:l,snapGrid:p,slidesGrid:c,slidesSizesGrid:u}),d!==o&&e.emit("slidesLengthChange"),p.length!==f&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),c.length!==m&&e.emit("slidesGridLengthChange"),(t.watchSlidesProgress||t.watchSlidesVisibility)&&e.updateSlidesOffset()}},updateAutoHeight:function(e){var t,a=this,i=[],s=0;if("number"==typeof e?a.setTransition(e):!0===e&&a.setTransition(a.params.speed),"auto"!==a.params.slidesPerView&&1<a.params.slidesPerView)for(t=0;t<Math.ceil(a.params.slidesPerView);t+=1){var r=a.activeIndex+t;if(r>a.slides.length)break;i.push(a.slides.eq(r)[0])}else i.push(a.slides.eq(a.activeIndex)[0]);for(t=0;t<i.length;t+=1)if(void 0!==i[t]){var n=i[t].offsetHeight;s=s<n?n:s}s&&a.$wrapperEl.css("height",s+"px")},updateSlidesOffset:function(){for(var e=this.slides,t=0;t<e.length;t+=1)e[t].swiperSlideOffset=this.isHorizontal()?e[t].offsetLeft:e[t].offsetTop},updateSlidesProgress:function(e){void 0===e&&(e=this&&this.translate||0);var t=this,a=t.params,i=t.slides,s=t.rtlTranslate;if(0!==i.length){void 0===i[0].swiperSlideOffset&&t.updateSlidesOffset();var r=-e;s&&(r=e),i.removeClass(a.slideVisibleClass),t.visibleSlidesIndexes=[],t.visibleSlides=[];for(var n=0;n<i.length;n+=1){var o=i[n],l=(r+(a.centeredSlides?t.minTranslate():0)-o.swiperSlideOffset)/(o.swiperSlideSize+a.spaceBetween);if(a.watchSlidesVisibility){var d=-(r-o.swiperSlideOffset),p=d+t.slidesSizesGrid[n];(0<=d&&d<t.size||0<p&&p<=t.size||d<=0&&p>=t.size)&&(t.visibleSlides.push(o),t.visibleSlidesIndexes.push(n),i.eq(n).addClass(a.slideVisibleClass))}o.progress=s?-l:l}t.visibleSlides=L(t.visibleSlides)}},updateProgress:function(e){void 0===e&&(e=this&&this.translate||0);var t=this,a=t.params,i=t.maxTranslate()-t.minTranslate(),s=t.progress,r=t.isBeginning,n=t.isEnd,o=r,l=n;0===i?n=r=!(s=0):(r=(s=(e-t.minTranslate())/i)<=0,n=1<=s),ee.extend(t,{progress:s,isBeginning:r,isEnd:n}),(a.watchSlidesProgress||a.watchSlidesVisibility)&&t.updateSlidesProgress(e),r&&!o&&t.emit("reachBeginning toEdge"),n&&!l&&t.emit("reachEnd toEdge"),(o&&!r||l&&!n)&&t.emit("fromEdge"),t.emit("progress",s)},updateSlidesClasses:function(){var e,t=this,a=t.slides,i=t.params,s=t.$wrapperEl,r=t.activeIndex,n=t.realIndex,o=t.virtual&&i.virtual.enabled;a.removeClass(i.slideActiveClass+" "+i.slideNextClass+" "+i.slidePrevClass+" "+i.slideDuplicateActiveClass+" "+i.slideDuplicateNextClass+" "+i.slideDuplicatePrevClass),(e=o?t.$wrapperEl.find("."+i.slideClass+'[data-swiper-slide-index="'+r+'"]'):a.eq(r)).addClass(i.slideActiveClass),i.loop&&(e.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+n+'"]').addClass(i.slideDuplicateActiveClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+n+'"]').addClass(i.slideDuplicateActiveClass));var l=e.nextAll("."+i.slideClass).eq(0).addClass(i.slideNextClass);i.loop&&0===l.length&&(l=a.eq(0)).addClass(i.slideNextClass);var d=e.prevAll("."+i.slideClass).eq(0).addClass(i.slidePrevClass);i.loop&&0===d.length&&(d=a.eq(-1)).addClass(i.slidePrevClass),i.loop&&(l.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+l.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicateNextClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+l.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicateNextClass),d.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+d.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicatePrevClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+d.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicatePrevClass))},updateActiveIndex:function(e){var t,a=this,i=a.rtlTranslate?a.translate:-a.translate,s=a.slidesGrid,r=a.snapGrid,n=a.params,o=a.activeIndex,l=a.realIndex,d=a.snapIndex,p=e;if(void 0===p){for(var c=0;c<s.length;c+=1)void 0!==s[c+1]?i>=s[c]&&i<s[c+1]-(s[c+1]-s[c])/2?p=c:i>=s[c]&&i<s[c+1]&&(p=c+1):i>=s[c]&&(p=c);n.normalizeSlideIndex&&(p<0||void 0===p)&&(p=0)}if((t=0<=r.indexOf(i)?r.indexOf(i):Math.floor(p/n.slidesPerGroup))>=r.length&&(t=r.length-1),p!==o){var u=parseInt(a.slides.eq(p).attr("data-swiper-slide-index")||p,10);ee.extend(a,{snapIndex:t,realIndex:u,previousIndex:o,activeIndex:p}),a.emit("activeIndexChange"),a.emit("snapIndexChange"),l!==u&&a.emit("realIndexChange"),a.emit("slideChange")}else t!==d&&(a.snapIndex=t,a.emit("snapIndexChange"))},updateClickedSlide:function(e){var t=this,a=t.params,i=L(e.target).closest("."+a.slideClass)[0],s=!1;if(i)for(var r=0;r<t.slides.length;r+=1)t.slides[r]===i&&(s=!0);if(!i||!s)return t.clickedSlide=void 0,void(t.clickedIndex=void 0);t.clickedSlide=i,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(L(i).attr("data-swiper-slide-index"),10):t.clickedIndex=L(i).index(),a.slideToClickedSlide&&void 0!==t.clickedIndex&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}};var p={getTranslate:function(e){void 0===e&&(e=this.isHorizontal()?"x":"y");var t=this.params,a=this.rtlTranslate,i=this.translate,s=this.$wrapperEl;if(t.virtualTranslate)return a?-i:i;var r=ee.getTranslate(s[0],e);return a&&(r=-r),r||0},setTranslate:function(e,t){var a=this,i=a.rtlTranslate,s=a.params,r=a.$wrapperEl,n=a.progress,o=0,l=0;a.isHorizontal()?o=i?-e:e:l=e,s.roundLengths&&(o=Math.floor(o),l=Math.floor(l)),s.virtualTranslate||(te.transforms3d?r.transform("translate3d("+o+"px, "+l+"px, 0px)"):r.transform("translate("+o+"px, "+l+"px)")),a.previousTranslate=a.translate,a.translate=a.isHorizontal()?o:l;var d=a.maxTranslate()-a.minTranslate();(0===d?0:(e-a.minTranslate())/d)!==n&&a.updateProgress(e),a.emit("setTranslate",a.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]}};var c={setTransition:function(e,t){this.$wrapperEl.transition(e),this.emit("setTransition",e,t)},transitionStart:function(e,t){void 0===e&&(e=!0);var a=this,i=a.activeIndex,s=a.params,r=a.previousIndex;s.autoHeight&&a.updateAutoHeight();var n=t;if(n||(n=r<i?"next":i<r?"prev":"reset"),a.emit("transitionStart"),e&&i!==r){if("reset"===n)return void a.emit("slideResetTransitionStart");a.emit("slideChangeTransitionStart"),"next"===n?a.emit("slideNextTransitionStart"):a.emit("slidePrevTransitionStart")}},transitionEnd:function(e,t){void 0===e&&(e=!0);var a=this,i=a.activeIndex,s=a.previousIndex;a.animating=!1,a.setTransition(0);var r=t;if(r||(r=s<i?"next":i<s?"prev":"reset"),a.emit("transitionEnd"),e&&i!==s){if("reset"===r)return void a.emit("slideResetTransitionEnd");a.emit("slideChangeTransitionEnd"),"next"===r?a.emit("slideNextTransitionEnd"):a.emit("slidePrevTransitionEnd")}}};var u={slideTo:function(e,t,a,i){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===a&&(a=!0);var s=this,r=e;r<0&&(r=0);var n=s.params,o=s.snapGrid,l=s.slidesGrid,d=s.previousIndex,p=s.activeIndex,c=s.rtlTranslate;if(s.animating&&n.preventInteractionOnTransition)return!1;var u=Math.floor(r/n.slidesPerGroup);u>=o.length&&(u=o.length-1),(p||n.initialSlide||0)===(d||0)&&a&&s.emit("beforeSlideChangeStart");var h,v=-o[u];if(s.updateProgress(v),n.normalizeSlideIndex)for(var f=0;f<l.length;f+=1)-Math.floor(100*v)>=Math.floor(100*l[f])&&(r=f);if(s.initialized&&r!==p){if(!s.allowSlideNext&&v<s.translate&&v<s.minTranslate())return!1;if(!s.allowSlidePrev&&v>s.translate&&v>s.maxTranslate()&&(p||0)!==r)return!1}return h=p<r?"next":r<p?"prev":"reset",c&&-v===s.translate||!c&&v===s.translate?(s.updateActiveIndex(r),n.autoHeight&&s.updateAutoHeight(),s.updateSlidesClasses(),"slide"!==n.effect&&s.setTranslate(v),"reset"!==h&&(s.transitionStart(a,h),s.transitionEnd(a,h)),!1):(0!==t&&te.transition?(s.setTransition(t),s.setTranslate(v),s.updateActiveIndex(r),s.updateSlidesClasses(),s.emit("beforeTransitionStart",t,i),s.transitionStart(a,h),s.animating||(s.animating=!0,s.onSlideToWrapperTransitionEnd||(s.onSlideToWrapperTransitionEnd=function(e){s&&!s.destroyed&&e.target===this&&(s.$wrapperEl[0].removeEventListener("transitionend",s.onSlideToWrapperTransitionEnd),s.$wrapperEl[0].removeEventListener("webkitTransitionEnd",s.onSlideToWrapperTransitionEnd),s.onSlideToWrapperTransitionEnd=null,delete s.onSlideToWrapperTransitionEnd,s.transitionEnd(a,h))}),s.$wrapperEl[0].addEventListener("transitionend",s.onSlideToWrapperTransitionEnd),s.$wrapperEl[0].addEventListener("webkitTransitionEnd",s.onSlideToWrapperTransitionEnd))):(s.setTransition(0),s.setTranslate(v),s.updateActiveIndex(r),s.updateSlidesClasses(),s.emit("beforeTransitionStart",t,i),s.transitionStart(a,h),s.transitionEnd(a,h)),!0)},slideToLoop:function(e,t,a,i){void 0===e&&(e=0),void 0===t&&(t=this.params.speed),void 0===a&&(a=!0);var s=e;return this.params.loop&&(s+=this.loopedSlides),this.slideTo(s,t,a,i)},slideNext:function(e,t,a){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0);var i=this,s=i.params,r=i.animating;return s.loop?!r&&(i.loopFix(),i._clientLeft=i.$wrapperEl[0].clientLeft,i.slideTo(i.activeIndex+s.slidesPerGroup,e,t,a)):i.slideTo(i.activeIndex+s.slidesPerGroup,e,t,a)},slidePrev:function(e,t,a){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0);var i=this,s=i.params,r=i.animating,n=i.snapGrid,o=i.slidesGrid,l=i.rtlTranslate;if(s.loop){if(r)return!1;i.loopFix(),i._clientLeft=i.$wrapperEl[0].clientLeft}function d(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}var p,c=d(l?i.translate:-i.translate),u=n.map(function(e){return d(e)}),h=(o.map(function(e){return d(e)}),n[u.indexOf(c)],n[u.indexOf(c)-1]);return void 0!==h&&(p=o.indexOf(h))<0&&(p=i.activeIndex-1),i.slideTo(p,e,t,a)},slideReset:function(e,t,a){return void 0===e&&(e=this.params.speed),void 0===t&&(t=!0),this.slideTo(this.activeIndex,e,t,a)},slideToClosest:function(e,t,a){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0);var i=this,s=i.activeIndex,r=Math.floor(s/i.params.slidesPerGroup);if(r<i.snapGrid.length-1){var n=i.rtlTranslate?i.translate:-i.translate,o=i.snapGrid[r];(i.snapGrid[r+1]-o)/2<n-o&&(s=i.params.slidesPerGroup)}return i.slideTo(s,e,t,a)},slideToClickedSlide:function(){var e,t=this,a=t.params,i=t.$wrapperEl,s="auto"===a.slidesPerView?t.slidesPerViewDynamic():a.slidesPerView,r=t.clickedIndex;if(a.loop){if(t.animating)return;e=parseInt(L(t.clickedSlide).attr("data-swiper-slide-index"),10),a.centeredSlides?r<t.loopedSlides-s/2||r>t.slides.length-t.loopedSlides+s/2?(t.loopFix(),r=i.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]:not(.'+a.slideDuplicateClass+")").eq(0).index(),ee.nextTick(function(){t.slideTo(r)})):t.slideTo(r):r>t.slides.length-s?(t.loopFix(),r=i.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]:not(.'+a.slideDuplicateClass+")").eq(0).index(),ee.nextTick(function(){t.slideTo(r)})):t.slideTo(r)}else t.slideTo(r)}};var h={loopCreate:function(){var i=this,e=i.params,t=i.$wrapperEl;t.children("."+e.slideClass+"."+e.slideDuplicateClass).remove();var s=t.children("."+e.slideClass);if(e.loopFillGroupWithBlank){var a=e.slidesPerGroup-s.length%e.slidesPerGroup;if(a!==e.slidesPerGroup){for(var r=0;r<a;r+=1){var n=L(f.createElement("div")).addClass(e.slideClass+" "+e.slideBlankClass);t.append(n)}s=t.children("."+e.slideClass)}}"auto"!==e.slidesPerView||e.loopedSlides||(e.loopedSlides=s.length),i.loopedSlides=parseInt(e.loopedSlides||e.slidesPerView,10),i.loopedSlides+=e.loopAdditionalSlides,i.loopedSlides>s.length&&(i.loopedSlides=s.length);var o=[],l=[];s.each(function(e,t){var a=L(t);e<i.loopedSlides&&l.push(t),e<s.length&&e>=s.length-i.loopedSlides&&o.push(t),a.attr("data-swiper-slide-index",e)});for(var d=0;d<l.length;d+=1)t.append(L(l[d].cloneNode(!0)).addClass(e.slideDuplicateClass));for(var p=o.length-1;0<=p;p-=1)t.prepend(L(o[p].cloneNode(!0)).addClass(e.slideDuplicateClass))},loopFix:function(){var e,t=this,a=t.params,i=t.activeIndex,s=t.slides,r=t.loopedSlides,n=t.allowSlidePrev,o=t.allowSlideNext,l=t.snapGrid,d=t.rtlTranslate;t.allowSlidePrev=!0,t.allowSlideNext=!0;var p=-l[i]-t.getTranslate();i<r?(e=s.length-3*r+i,e+=r,t.slideTo(e,0,!1,!0)&&0!==p&&t.setTranslate((d?-t.translate:t.translate)-p)):("auto"===a.slidesPerView&&2*r<=i||i>=s.length-r)&&(e=-s.length+i+r,e+=r,t.slideTo(e,0,!1,!0)&&0!==p&&t.setTranslate((d?-t.translate:t.translate)-p));t.allowSlidePrev=n,t.allowSlideNext=o},loopDestroy:function(){var e=this.$wrapperEl,t=this.params,a=this.slides;e.children("."+t.slideClass+"."+t.slideDuplicateClass+",."+t.slideClass+"."+t.slideBlankClass).remove(),a.removeAttr("data-swiper-slide-index")}};var v={setGrabCursor:function(e){if(!(te.touch||!this.params.simulateTouch||this.params.watchOverflow&&this.isLocked)){var t=this.el;t.style.cursor="move",t.style.cursor=e?"-webkit-grabbing":"-webkit-grab",t.style.cursor=e?"-moz-grabbin":"-moz-grab",t.style.cursor=e?"grabbing":"grab"}},unsetGrabCursor:function(){te.touch||this.params.watchOverflow&&this.isLocked||(this.el.style.cursor="")}};var m={appendSlide:function(e){var t=this,a=t.$wrapperEl,i=t.params;if(i.loop&&t.loopDestroy(),"object"==typeof e&&"length"in e)for(var s=0;s<e.length;s+=1)e[s]&&a.append(e[s]);else a.append(e);i.loop&&t.loopCreate(),i.observer&&te.observer||t.update()},prependSlide:function(e){var t=this,a=t.params,i=t.$wrapperEl,s=t.activeIndex;a.loop&&t.loopDestroy();var r=s+1;if("object"==typeof e&&"length"in e){for(var n=0;n<e.length;n+=1)e[n]&&i.prepend(e[n]);r=s+e.length}else i.prepend(e);a.loop&&t.loopCreate(),a.observer&&te.observer||t.update(),t.slideTo(r,0,!1)},addSlide:function(e,t){var a=this,i=a.$wrapperEl,s=a.params,r=a.activeIndex;s.loop&&(r-=a.loopedSlides,a.loopDestroy(),a.slides=i.children("."+s.slideClass));var n=a.slides.length;if(e<=0)a.prependSlide(t);else if(n<=e)a.appendSlide(t);else{for(var o=e<r?r+1:r,l=[],d=n-1;e<=d;d-=1){var p=a.slides.eq(d);p.remove(),l.unshift(p)}if("object"==typeof t&&"length"in t){for(var c=0;c<t.length;c+=1)t[c]&&i.append(t[c]);o=e<r?r+t.length:r}else i.append(t);for(var u=0;u<l.length;u+=1)i.append(l[u]);s.loop&&a.loopCreate(),s.observer&&te.observer||a.update(),s.loop?a.slideTo(o+a.loopedSlides,0,!1):a.slideTo(o,0,!1)}},removeSlide:function(e){var t=this,a=t.params,i=t.$wrapperEl,s=t.activeIndex;a.loop&&(s-=t.loopedSlides,t.loopDestroy(),t.slides=i.children("."+a.slideClass));var r,n=s;if("object"==typeof e&&"length"in e){for(var o=0;o<e.length;o+=1)r=e[o],t.slides[r]&&t.slides.eq(r).remove(),r<n&&(n-=1);n=Math.max(n,0)}else r=e,t.slides[r]&&t.slides.eq(r).remove(),r<n&&(n-=1),n=Math.max(n,0);a.loop&&t.loopCreate(),a.observer&&te.observer||t.update(),a.loop?t.slideTo(n+t.loopedSlides,0,!1):t.slideTo(n,0,!1)},removeAllSlides:function(){for(var e=[],t=0;t<this.slides.length;t+=1)e.push(t);this.removeSlide(e)}},g=function(){var e=J.navigator.userAgent,t={ios:!1,android:!1,androidChrome:!1,desktop:!1,windows:!1,iphone:!1,ipod:!1,ipad:!1,cordova:J.cordova||J.phonegap,phonegap:J.cordova||J.phonegap},a=e.match(/(Windows Phone);?[\s\/]+([\d.]+)?/),i=e.match(/(Android);?[\s\/]+([\d.]+)?/),s=e.match(/(iPad).*OS\s([\d_]+)/),r=e.match(/(iPod)(.*OS\s([\d_]+))?/),n=!s&&e.match(/(iPhone\sOS|iOS)\s([\d_]+)/);if(a&&(t.os="windows",t.osVersion=a[2],t.windows=!0),i&&!a&&(t.os="android",t.osVersion=i[2],t.android=!0,t.androidChrome=0<=e.toLowerCase().indexOf("chrome")),(s||n||r)&&(t.os="ios",t.ios=!0),n&&!r&&(t.osVersion=n[2].replace(/_/g,"."),t.iphone=!0),s&&(t.osVersion=s[2].replace(/_/g,"."),t.ipad=!0),r&&(t.osVersion=r[3]?r[3].replace(/_/g,"."):null,t.iphone=!0),t.ios&&t.osVersion&&0<=e.indexOf("Version/")&&"10"===t.osVersion.split(".")[0]&&(t.osVersion=e.toLowerCase().split("version/")[1].split(" ")[0]),t.desktop=!(t.os||t.android||t.webView),t.webView=(n||s||r)&&e.match(/.*AppleWebKit(?!.*Safari)/i),t.os&&"ios"===t.os){var o=t.osVersion.split("."),l=f.querySelector('meta[name="viewport"]');t.minimalUi=!t.webView&&(r||n)&&(1*o[0]==7?1<=1*o[1]:7<1*o[0])&&l&&0<=l.getAttribute("content").indexOf("minimal-ui")}return t.pixelRatio=J.devicePixelRatio||1,t}();function b(){var e=this,t=e.params,a=e.el;if(!a||0!==a.offsetWidth){t.breakpoints&&e.setBreakpoint();var i=e.allowSlideNext,s=e.allowSlidePrev,r=e.snapGrid;if(e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),t.freeMode){var n=Math.min(Math.max(e.translate,e.maxTranslate()),e.minTranslate());e.setTranslate(n),e.updateActiveIndex(),e.updateSlidesClasses(),t.autoHeight&&e.updateAutoHeight()}else e.updateSlidesClasses(),("auto"===t.slidesPerView||1<t.slidesPerView)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0);e.allowSlidePrev=s,e.allowSlideNext=i,e.params.watchOverflow&&r!==e.snapGrid&&e.checkOverflow()}}var w={init:!0,direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,preventInteractionOnTransition:!1,edgeSwipeDetection:!1,edgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsInverse:!1,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!1,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:0,touchMoveStopPropagation:!0,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,loopFillGroupWithBlank:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-invisible-blank",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",runCallbacksOnInit:!0},y={update:d,translate:p,transition:c,slide:u,loop:h,grabCursor:v,manipulation:m,events:{attachEvents:function(){var e=this,t=e.params,a=e.touchEvents,i=e.el,s=e.wrapperEl;e.onTouchStart=function(e){var t=this,a=t.touchEventsData,i=t.params,s=t.touches;if(!t.animating||!i.preventInteractionOnTransition){var r=e;if(r.originalEvent&&(r=r.originalEvent),a.isTouchEvent="touchstart"===r.type,(a.isTouchEvent||!("which"in r)||3!==r.which)&&!(!a.isTouchEvent&&"button"in r&&0<r.button||a.isTouched&&a.isMoved))if(i.noSwiping&&L(r.target).closest(i.noSwipingSelector?i.noSwipingSelector:"."+i.noSwipingClass)[0])t.allowClick=!0;else if(!i.swipeHandler||L(r).closest(i.swipeHandler)[0]){s.currentX="touchstart"===r.type?r.targetTouches[0].pageX:r.pageX,s.currentY="touchstart"===r.type?r.targetTouches[0].pageY:r.pageY;var n=s.currentX,o=s.currentY,l=i.edgeSwipeDetection||i.iOSEdgeSwipeDetection,d=i.edgeSwipeThreshold||i.iOSEdgeSwipeThreshold;if(!l||!(n<=d||n>=J.screen.width-d)){if(ee.extend(a,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),s.startX=n,s.startY=o,a.touchStartTime=ee.now(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,0<i.threshold&&(a.allowThresholdMove=!1),"touchstart"!==r.type){var p=!0;L(r.target).is(a.formElements)&&(p=!1),f.activeElement&&L(f.activeElement).is(a.formElements)&&f.activeElement!==r.target&&f.activeElement.blur();var c=p&&t.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||c)&&r.preventDefault()}t.emit("touchStart",r)}}}}.bind(e),e.onTouchMove=function(e){var t=this,a=t.touchEventsData,i=t.params,s=t.touches,r=t.rtlTranslate,n=e;if(n.originalEvent&&(n=n.originalEvent),a.isTouched){if(!a.isTouchEvent||"mousemove"!==n.type){var o="touchmove"===n.type?n.targetTouches[0].pageX:n.pageX,l="touchmove"===n.type?n.targetTouches[0].pageY:n.pageY;if(n.preventedByNestedSwiper)return s.startX=o,void(s.startY=l);if(!t.allowTouchMove)return t.allowClick=!1,void(a.isTouched&&(ee.extend(s,{startX:o,startY:l,currentX:o,currentY:l}),a.touchStartTime=ee.now()));if(a.isTouchEvent&&i.touchReleaseOnEdges&&!i.loop)if(t.isVertical()){if(l<s.startY&&t.translate<=t.maxTranslate()||l>s.startY&&t.translate>=t.minTranslate())return a.isTouched=!1,void(a.isMoved=!1)}else if(o<s.startX&&t.translate<=t.maxTranslate()||o>s.startX&&t.translate>=t.minTranslate())return;if(a.isTouchEvent&&f.activeElement&&n.target===f.activeElement&&L(n.target).is(a.formElements))return a.isMoved=!0,void(t.allowClick=!1);if(a.allowTouchCallbacks&&t.emit("touchMove",n),!(n.targetTouches&&1<n.targetTouches.length)){s.currentX=o,s.currentY=l;var d,p=s.currentX-s.startX,c=s.currentY-s.startY;if(!(t.params.threshold&&Math.sqrt(Math.pow(p,2)+Math.pow(c,2))<t.params.threshold))if(void 0===a.isScrolling&&(t.isHorizontal()&&s.currentY===s.startY||t.isVertical()&&s.currentX===s.startX?a.isScrolling=!1:25<=p*p+c*c&&(d=180*Math.atan2(Math.abs(c),Math.abs(p))/Math.PI,a.isScrolling=t.isHorizontal()?d>i.touchAngle:90-d>i.touchAngle)),a.isScrolling&&t.emit("touchMoveOpposite",n),void 0===a.startMoving&&(s.currentX===s.startX&&s.currentY===s.startY||(a.startMoving=!0)),a.isScrolling)a.isTouched=!1;else if(a.startMoving){t.allowClick=!1,n.preventDefault(),i.touchMoveStopPropagation&&!i.nested&&n.stopPropagation(),a.isMoved||(i.loop&&t.loopFix(),a.startTranslate=t.getTranslate(),t.setTransition(0),t.animating&&t.$wrapperEl.trigger("webkitTransitionEnd transitionend"),a.allowMomentumBounce=!1,!i.grabCursor||!0!==t.allowSlideNext&&!0!==t.allowSlidePrev||t.setGrabCursor(!0),t.emit("sliderFirstMove",n)),t.emit("sliderMove",n),a.isMoved=!0;var u=t.isHorizontal()?p:c;s.diff=u,u*=i.touchRatio,r&&(u=-u),t.swipeDirection=0<u?"prev":"next",a.currentTranslate=u+a.startTranslate;var h=!0,v=i.resistanceRatio;if(i.touchReleaseOnEdges&&(v=0),0<u&&a.currentTranslate>t.minTranslate()?(h=!1,i.resistance&&(a.currentTranslate=t.minTranslate()-1+Math.pow(-t.minTranslate()+a.startTranslate+u,v))):u<0&&a.currentTranslate<t.maxTranslate()&&(h=!1,i.resistance&&(a.currentTranslate=t.maxTranslate()+1-Math.pow(t.maxTranslate()-a.startTranslate-u,v))),h&&(n.preventedByNestedSwiper=!0),!t.allowSlideNext&&"next"===t.swipeDirection&&a.currentTranslate<a.startTranslate&&(a.currentTranslate=a.startTranslate),!t.allowSlidePrev&&"prev"===t.swipeDirection&&a.currentTranslate>a.startTranslate&&(a.currentTranslate=a.startTranslate),0<i.threshold){if(!(Math.abs(u)>i.threshold||a.allowThresholdMove))return void(a.currentTranslate=a.startTranslate);if(!a.allowThresholdMove)return a.allowThresholdMove=!0,s.startX=s.currentX,s.startY=s.currentY,a.currentTranslate=a.startTranslate,void(s.diff=t.isHorizontal()?s.currentX-s.startX:s.currentY-s.startY)}i.followFinger&&((i.freeMode||i.watchSlidesProgress||i.watchSlidesVisibility)&&(t.updateActiveIndex(),t.updateSlidesClasses()),i.freeMode&&(0===a.velocities.length&&a.velocities.push({position:s[t.isHorizontal()?"startX":"startY"],time:a.touchStartTime}),a.velocities.push({position:s[t.isHorizontal()?"currentX":"currentY"],time:ee.now()})),t.updateProgress(a.currentTranslate),t.setTranslate(a.currentTranslate))}}}}else a.startMoving&&a.isScrolling&&t.emit("touchMoveOpposite",n)}.bind(e),e.onTouchEnd=function(e){var t=this,a=t.touchEventsData,i=t.params,s=t.touches,r=t.rtlTranslate,n=t.$wrapperEl,o=t.slidesGrid,l=t.snapGrid,d=e;if(d.originalEvent&&(d=d.originalEvent),a.allowTouchCallbacks&&t.emit("touchEnd",d),a.allowTouchCallbacks=!1,!a.isTouched)return a.isMoved&&i.grabCursor&&t.setGrabCursor(!1),a.isMoved=!1,void(a.startMoving=!1);i.grabCursor&&a.isMoved&&a.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);var p,c=ee.now(),u=c-a.touchStartTime;if(t.allowClick&&(t.updateClickedSlide(d),t.emit("tap",d),u<300&&300<c-a.lastClickTime&&(a.clickTimeout&&clearTimeout(a.clickTimeout),a.clickTimeout=ee.nextTick(function(){t&&!t.destroyed&&t.emit("click",d)},300)),u<300&&c-a.lastClickTime<300&&(a.clickTimeout&&clearTimeout(a.clickTimeout),t.emit("doubleTap",d))),a.lastClickTime=ee.now(),ee.nextTick(function(){t.destroyed||(t.allowClick=!0)}),!a.isTouched||!a.isMoved||!t.swipeDirection||0===s.diff||a.currentTranslate===a.startTranslate)return a.isTouched=!1,a.isMoved=!1,void(a.startMoving=!1);if(a.isTouched=!1,a.isMoved=!1,a.startMoving=!1,p=i.followFinger?r?t.translate:-t.translate:-a.currentTranslate,i.freeMode){if(p<-t.minTranslate())return void t.slideTo(t.activeIndex);if(p>-t.maxTranslate())return void(t.slides.length<l.length?t.slideTo(l.length-1):t.slideTo(t.slides.length-1));if(i.freeModeMomentum){if(1<a.velocities.length){var h=a.velocities.pop(),v=a.velocities.pop(),f=h.position-v.position,m=h.time-v.time;t.velocity=f/m,t.velocity/=2,Math.abs(t.velocity)<i.freeModeMinimumVelocity&&(t.velocity=0),(150<m||300<ee.now()-h.time)&&(t.velocity=0)}else t.velocity=0;t.velocity*=i.freeModeMomentumVelocityRatio,a.velocities.length=0;var g=1e3*i.freeModeMomentumRatio,b=t.velocity*g,w=t.translate+b;r&&(w=-w);var y,x,T=!1,E=20*Math.abs(t.velocity)*i.freeModeMomentumBounceRatio;if(w<t.maxTranslate())i.freeModeMomentumBounce?(w+t.maxTranslate()<-E&&(w=t.maxTranslate()-E),y=t.maxTranslate(),T=!0,a.allowMomentumBounce=!0):w=t.maxTranslate(),i.loop&&i.centeredSlides&&(x=!0);else if(w>t.minTranslate())i.freeModeMomentumBounce?(w-t.minTranslate()>E&&(w=t.minTranslate()+E),y=t.minTranslate(),T=!0,a.allowMomentumBounce=!0):w=t.minTranslate(),i.loop&&i.centeredSlides&&(x=!0);else if(i.freeModeSticky){for(var S,C=0;C<l.length;C+=1)if(l[C]>-w){S=C;break}w=-(w=Math.abs(l[S]-w)<Math.abs(l[S-1]-w)||"next"===t.swipeDirection?l[S]:l[S-1])}if(x&&t.once("transitionEnd",function(){t.loopFix()}),0!==t.velocity)g=r?Math.abs((-w-t.translate)/t.velocity):Math.abs((w-t.translate)/t.velocity);else if(i.freeModeSticky)return void t.slideToClosest();i.freeModeMomentumBounce&&T?(t.updateProgress(y),t.setTransition(g),t.setTranslate(w),t.transitionStart(!0,t.swipeDirection),t.animating=!0,n.transitionEnd(function(){t&&!t.destroyed&&a.allowMomentumBounce&&(t.emit("momentumBounce"),t.setTransition(i.speed),t.setTranslate(y),n.transitionEnd(function(){t&&!t.destroyed&&t.transitionEnd()}))})):t.velocity?(t.updateProgress(w),t.setTransition(g),t.setTranslate(w),t.transitionStart(!0,t.swipeDirection),t.animating||(t.animating=!0,n.transitionEnd(function(){t&&!t.destroyed&&t.transitionEnd()}))):t.updateProgress(w),t.updateActiveIndex(),t.updateSlidesClasses()}else if(i.freeModeSticky)return void t.slideToClosest();(!i.freeModeMomentum||u>=i.longSwipesMs)&&(t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses())}else{for(var M=0,z=t.slidesSizesGrid[0],P=0;P<o.length;P+=i.slidesPerGroup)void 0!==o[P+i.slidesPerGroup]?p>=o[P]&&p<o[P+i.slidesPerGroup]&&(z=o[(M=P)+i.slidesPerGroup]-o[P]):p>=o[P]&&(M=P,z=o[o.length-1]-o[o.length-2]);var k=(p-o[M])/z;if(u>i.longSwipesMs){if(!i.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(k>=i.longSwipesRatio?t.slideTo(M+i.slidesPerGroup):t.slideTo(M)),"prev"===t.swipeDirection&&(k>1-i.longSwipesRatio?t.slideTo(M+i.slidesPerGroup):t.slideTo(M))}else{if(!i.shortSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&t.slideTo(M+i.slidesPerGroup),"prev"===t.swipeDirection&&t.slideTo(M)}}}.bind(e),e.onClick=function(e){this.allowClick||(this.params.preventClicks&&e.preventDefault(),this.params.preventClicksPropagation&&this.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))}.bind(e);var r="container"===t.touchEventsTarget?i:s,n=!!t.nested;if(te.touch||!te.pointerEvents&&!te.prefixedPointerEvents){if(te.touch){var o=!("touchstart"!==a.start||!te.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};r.addEventListener(a.start,e.onTouchStart,o),r.addEventListener(a.move,e.onTouchMove,te.passiveListener?{passive:!1,capture:n}:n),r.addEventListener(a.end,e.onTouchEnd,o)}(t.simulateTouch&&!g.ios&&!g.android||t.simulateTouch&&!te.touch&&g.ios)&&(r.addEventListener("mousedown",e.onTouchStart,!1),f.addEventListener("mousemove",e.onTouchMove,n),f.addEventListener("mouseup",e.onTouchEnd,!1))}else r.addEventListener(a.start,e.onTouchStart,!1),f.addEventListener(a.move,e.onTouchMove,n),f.addEventListener(a.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&r.addEventListener("click",e.onClick,!0),e.on(g.ios||g.android?"resize orientationchange observerUpdate":"resize observerUpdate",b,!0)},detachEvents:function(){var e=this,t=e.params,a=e.touchEvents,i=e.el,s=e.wrapperEl,r="container"===t.touchEventsTarget?i:s,n=!!t.nested;if(te.touch||!te.pointerEvents&&!te.prefixedPointerEvents){if(te.touch){var o=!("onTouchStart"!==a.start||!te.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};r.removeEventListener(a.start,e.onTouchStart,o),r.removeEventListener(a.move,e.onTouchMove,n),r.removeEventListener(a.end,e.onTouchEnd,o)}(t.simulateTouch&&!g.ios&&!g.android||t.simulateTouch&&!te.touch&&g.ios)&&(r.removeEventListener("mousedown",e.onTouchStart,!1),f.removeEventListener("mousemove",e.onTouchMove,n),f.removeEventListener("mouseup",e.onTouchEnd,!1))}else r.removeEventListener(a.start,e.onTouchStart,!1),f.removeEventListener(a.move,e.onTouchMove,n),f.removeEventListener(a.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&r.removeEventListener("click",e.onClick,!0),e.off(g.ios||g.android?"resize orientationchange observerUpdate":"resize observerUpdate",b)}},breakpoints:{setBreakpoint:function(){var e=this,t=e.activeIndex,a=e.initialized,i=e.loopedSlides;void 0===i&&(i=0);var s=e.params,r=s.breakpoints;if(r&&(!r||0!==Object.keys(r).length)){var n=e.getBreakpoint(r);if(n&&e.currentBreakpoint!==n){var o=n in r?r[n]:void 0;o&&["slidesPerView","spaceBetween","slidesPerGroup"].forEach(function(e){var t=o[e];void 0!==t&&(o[e]="slidesPerView"!==e||"AUTO"!==t&&"auto"!==t?"slidesPerView"===e?parseFloat(t):parseInt(t,10):"auto")});var l=o||e.originalParams,d=l.direction&&l.direction!==s.direction,p=s.loop&&(l.slidesPerView!==s.slidesPerView||d);d&&a&&e.changeDirection(),ee.extend(e.params,l),ee.extend(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),e.currentBreakpoint=n,p&&a&&(e.loopDestroy(),e.loopCreate(),e.updateSlides(),e.slideTo(t-i+e.loopedSlides,0,!1)),e.emit("breakpoint",l)}}},getBreakpoint:function(e){if(e){var t=!1,a=[];Object.keys(e).forEach(function(e){a.push(e)}),a.sort(function(e,t){return parseInt(e,10)-parseInt(t,10)});for(var i=0;i<a.length;i+=1){var s=a[i];this.params.breakpointsInverse?s<=J.innerWidth&&(t=s):s>=J.innerWidth&&!t&&(t=s)}return t||"max"}}},checkOverflow:{checkOverflow:function(){var e=this,t=e.isLocked;e.isLocked=1===e.snapGrid.length,e.allowSlideNext=!e.isLocked,e.allowSlidePrev=!e.isLocked,t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock"),t&&t!==e.isLocked&&(e.isEnd=!1,e.navigation.update())}},classes:{addClasses:function(){var t=this.classNames,a=this.params,e=this.rtl,i=this.$el,s=[];s.push("initialized"),s.push(a.direction),a.freeMode&&s.push("free-mode"),te.flexbox||s.push("no-flexbox"),a.autoHeight&&s.push("autoheight"),e&&s.push("rtl"),1<a.slidesPerColumn&&s.push("multirow"),g.android&&s.push("android"),g.ios&&s.push("ios"),(I.isIE||I.isEdge)&&(te.pointerEvents||te.prefixedPointerEvents)&&s.push("wp8-"+a.direction),s.forEach(function(e){t.push(a.containerModifierClass+e)}),i.addClass(t.join(" "))},removeClasses:function(){var e=this.$el,t=this.classNames;e.removeClass(t.join(" "))}},images:{loadImage:function(e,t,a,i,s,r){var n;function o(){r&&r()}e.complete&&s?o():t?((n=new J.Image).onload=o,n.onerror=o,i&&(n.sizes=i),a&&(n.srcset=a),t&&(n.src=t)):o()},preloadImages:function(){var e=this;function t(){null!=e&&e&&!e.destroyed&&(void 0!==e.imagesLoaded&&(e.imagesLoaded+=1),e.imagesLoaded===e.imagesToLoad.length&&(e.params.updateOnImagesReady&&e.update(),e.emit("imagesReady")))}e.imagesToLoad=e.$el.find("img");for(var a=0;a<e.imagesToLoad.length;a+=1){var i=e.imagesToLoad[a];e.loadImage(i,i.currentSrc||i.getAttribute("src"),i.srcset||i.getAttribute("srcset"),i.sizes||i.getAttribute("sizes"),!0,t)}}}},x={},T=function(u){function h(){for(var e,t,s,a=[],i=arguments.length;i--;)a[i]=arguments[i];1===a.length&&a[0].constructor&&a[0].constructor===Object?s=a[0]:(t=(e=a)[0],s=e[1]),s||(s={}),s=ee.extend({},s),t&&!s.el&&(s.el=t),u.call(this,s),Object.keys(y).forEach(function(t){Object.keys(y[t]).forEach(function(e){h.prototype[e]||(h.prototype[e]=y[t][e])})});var r=this;void 0===r.modules&&(r.modules={}),Object.keys(r.modules).forEach(function(e){var t=r.modules[e];if(t.params){var a=Object.keys(t.params)[0],i=t.params[a];if("object"!=typeof i||null===i)return;if(!(a in s&&"enabled"in i))return;!0===s[a]&&(s[a]={enabled:!0}),"object"!=typeof s[a]||"enabled"in s[a]||(s[a].enabled=!0),s[a]||(s[a]={enabled:!1})}});var n=ee.extend({},w);r.useModulesParams(n),r.params=ee.extend({},n,x,s),r.originalParams=ee.extend({},r.params),r.passedParams=ee.extend({},s);var o=(r.$=L)(r.params.el);if(t=o[0]){if(1<o.length){var l=[];return o.each(function(e,t){var a=ee.extend({},s,{el:t});l.push(new h(a))}),l}t.swiper=r,o.data("swiper",r);var d,p,c=o.children("."+r.params.wrapperClass);return ee.extend(r,{$el:o,el:t,$wrapperEl:c,wrapperEl:c[0],classNames:[],slides:L(),slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:function(){return"horizontal"===r.params.direction},isVertical:function(){return"vertical"===r.params.direction},rtl:"rtl"===t.dir.toLowerCase()||"rtl"===o.css("direction"),rtlTranslate:"horizontal"===r.params.direction&&("rtl"===t.dir.toLowerCase()||"rtl"===o.css("direction")),wrongRTL:"-webkit-box"===c.css("display"),activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,allowSlideNext:r.params.allowSlideNext,allowSlidePrev:r.params.allowSlidePrev,touchEvents:(d=["touchstart","touchmove","touchend"],p=["mousedown","mousemove","mouseup"],te.pointerEvents?p=["pointerdown","pointermove","pointerup"]:te.prefixedPointerEvents&&(p=["MSPointerDown","MSPointerMove","MSPointerUp"]),r.touchEventsTouch={start:d[0],move:d[1],end:d[2]},r.touchEventsDesktop={start:p[0],move:p[1],end:p[2]},te.touch||!r.params.simulateTouch?r.touchEventsTouch:r.touchEventsDesktop),touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,formElements:"input, select, option, textarea, button, video",lastClickTime:ee.now(),clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,isTouchEvent:void 0,startMoving:void 0},allowClick:!0,allowTouchMove:r.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),r.useModules(),r.params.init&&r.init(),r}}u&&(h.__proto__=u);var e={extendedDefaults:{configurable:!0},defaults:{configurable:!0},Class:{configurable:!0},$:{configurable:!0}};return((h.prototype=Object.create(u&&u.prototype)).constructor=h).prototype.slidesPerViewDynamic=function(){var e=this,t=e.params,a=e.slides,i=e.slidesGrid,s=e.size,r=e.activeIndex,n=1;if(t.centeredSlides){for(var o,l=a[r].swiperSlideSize,d=r+1;d<a.length;d+=1)a[d]&&!o&&(n+=1,s<(l+=a[d].swiperSlideSize)&&(o=!0));for(var p=r-1;0<=p;p-=1)a[p]&&!o&&(n+=1,s<(l+=a[p].swiperSlideSize)&&(o=!0))}else for(var c=r+1;c<a.length;c+=1)i[c]-i[r]<s&&(n+=1);return n},h.prototype.update=function(){var a=this;if(a&&!a.destroyed){var e=a.snapGrid,t=a.params;t.breakpoints&&a.setBreakpoint(),a.updateSize(),a.updateSlides(),a.updateProgress(),a.updateSlidesClasses(),a.params.freeMode?(i(),a.params.autoHeight&&a.updateAutoHeight()):(("auto"===a.params.slidesPerView||1<a.params.slidesPerView)&&a.isEnd&&!a.params.centeredSlides?a.slideTo(a.slides.length-1,0,!1,!0):a.slideTo(a.activeIndex,0,!1,!0))||i(),t.watchOverflow&&e!==a.snapGrid&&a.checkOverflow(),a.emit("update")}function i(){var e=a.rtlTranslate?-1*a.translate:a.translate,t=Math.min(Math.max(e,a.maxTranslate()),a.minTranslate());a.setTranslate(t),a.updateActiveIndex(),a.updateSlidesClasses()}},h.prototype.changeDirection=function(a,e){void 0===e&&(e=!0);var t=this,i=t.params.direction;return a||(a="horizontal"===i?"vertical":"horizontal"),a===i||"horizontal"!==a&&"vertical"!==a||("vertical"===i&&(t.$el.removeClass(t.params.containerModifierClass+"vertical wp8-vertical").addClass(""+t.params.containerModifierClass+a),(I.isIE||I.isEdge)&&(te.pointerEvents||te.prefixedPointerEvents)&&t.$el.addClass(t.params.containerModifierClass+"wp8-"+a)),"horizontal"===i&&(t.$el.removeClass(t.params.containerModifierClass+"horizontal wp8-horizontal").addClass(""+t.params.containerModifierClass+a),(I.isIE||I.isEdge)&&(te.pointerEvents||te.prefixedPointerEvents)&&t.$el.addClass(t.params.containerModifierClass+"wp8-"+a)),t.params.direction=a,t.slides.each(function(e,t){"vertical"===a?t.style.width="":t.style.height=""}),t.emit("changeDirection"),e&&t.update()),t},h.prototype.init=function(){var e=this;e.initialized||(e.emit("beforeInit"),e.params.breakpoints&&e.setBreakpoint(),e.addClasses(),e.params.loop&&e.loopCreate(),e.updateSize(),e.updateSlides(),e.params.watchOverflow&&e.checkOverflow(),e.params.grabCursor&&e.setGrabCursor(),e.params.preloadImages&&e.preloadImages(),e.params.loop?e.slideTo(e.params.initialSlide+e.loopedSlides,0,e.params.runCallbacksOnInit):e.slideTo(e.params.initialSlide,0,e.params.runCallbacksOnInit),e.attachEvents(),e.initialized=!0,e.emit("init"))},h.prototype.destroy=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);var a=this,i=a.params,s=a.$el,r=a.$wrapperEl,n=a.slides;return void 0===a.params||a.destroyed||(a.emit("beforeDestroy"),a.initialized=!1,a.detachEvents(),i.loop&&a.loopDestroy(),t&&(a.removeClasses(),s.removeAttr("style"),r.removeAttr("style"),n&&n.length&&n.removeClass([i.slideVisibleClass,i.slideActiveClass,i.slideNextClass,i.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index").removeAttr("data-swiper-column").removeAttr("data-swiper-row")),a.emit("destroy"),Object.keys(a.eventsListeners).forEach(function(e){a.off(e)}),!1!==e&&(a.$el[0].swiper=null,a.$el.data("swiper",null),ee.deleteProps(a)),a.destroyed=!0),null},h.extendDefaults=function(e){ee.extend(x,e)},e.extendedDefaults.get=function(){return x},e.defaults.get=function(){return w},e.Class.get=function(){return u},e.$.get=function(){return L},Object.defineProperties(h,e),h}(n),E={name:"device",proto:{device:g},static:{device:g}},S={name:"support",proto:{support:te},static:{support:te}},C={name:"browser",proto:{browser:I},static:{browser:I}},M={name:"resize",create:function(){var e=this;ee.extend(e,{resize:{resizeHandler:function(){e&&!e.destroyed&&e.initialized&&(e.emit("beforeResize"),e.emit("resize"))},orientationChangeHandler:function(){e&&!e.destroyed&&e.initialized&&e.emit("orientationchange")}}})},on:{init:function(){J.addEventListener("resize",this.resize.resizeHandler),J.addEventListener("orientationchange",this.resize.orientationChangeHandler)},destroy:function(){J.removeEventListener("resize",this.resize.resizeHandler),J.removeEventListener("orientationchange",this.resize.orientationChangeHandler)}}},z={func:J.MutationObserver||J.WebkitMutationObserver,attach:function(e,t){void 0===t&&(t={});var a=this,i=new z.func(function(e){if(1!==e.length){var t=function(){a.emit("observerUpdate",e[0])};J.requestAnimationFrame?J.requestAnimationFrame(t):J.setTimeout(t,0)}else a.emit("observerUpdate",e[0])});i.observe(e,{attributes:void 0===t.attributes||t.attributes,childList:void 0===t.childList||t.childList,characterData:void 0===t.characterData||t.characterData}),a.observer.observers.push(i)},init:function(){var e=this;if(te.observer&&e.params.observer){if(e.params.observeParents)for(var t=e.$el.parents(),a=0;a<t.length;a+=1)e.observer.attach(t[a]);e.observer.attach(e.$el[0],{childList:e.params.observeSlideChildren}),e.observer.attach(e.$wrapperEl[0],{attributes:!1})}},destroy:function(){this.observer.observers.forEach(function(e){e.disconnect()}),this.observer.observers=[]}},P={name:"observer",params:{observer:!1,observeParents:!1,observeSlideChildren:!1},create:function(){ee.extend(this,{observer:{init:z.init.bind(this),attach:z.attach.bind(this),destroy:z.destroy.bind(this),observers:[]}})},on:{init:function(){this.observer.init()},destroy:function(){this.observer.destroy()}}},k={update:function(e){var t=this,a=t.params,i=a.slidesPerView,s=a.slidesPerGroup,r=a.centeredSlides,n=t.params.virtual,o=n.addSlidesBefore,l=n.addSlidesAfter,d=t.virtual,p=d.from,c=d.to,u=d.slides,h=d.slidesGrid,v=d.renderSlide,f=d.offset;t.updateActiveIndex();var m,g,b,w=t.activeIndex||0;m=t.rtlTranslate?"right":t.isHorizontal()?"left":"top",r?(g=Math.floor(i/2)+s+o,b=Math.floor(i/2)+s+l):(g=i+(s-1)+o,b=s+l);var y=Math.max((w||0)-b,0),x=Math.min((w||0)+g,u.length-1),T=(t.slidesGrid[y]||0)-(t.slidesGrid[0]||0);function E(){t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.lazy&&t.params.lazy.enabled&&t.lazy.load()}if(ee.extend(t.virtual,{from:y,to:x,offset:T,slidesGrid:t.slidesGrid}),p===y&&c===x&&!e)return t.slidesGrid!==h&&T!==f&&t.slides.css(m,T+"px"),void t.updateProgress();if(t.params.virtual.renderExternal)return t.params.virtual.renderExternal.call(t,{offset:T,from:y,to:x,slides:function(){for(var e=[],t=y;t<=x;t+=1)e.push(u[t]);return e}()}),void E();var S=[],C=[];if(e)t.$wrapperEl.find("."+t.params.slideClass).remove();else for(var M=p;M<=c;M+=1)(M<y||x<M)&&t.$wrapperEl.find("."+t.params.slideClass+'[data-swiper-slide-index="'+M+'"]').remove();for(var z=0;z<u.length;z+=1)y<=z&&z<=x&&(void 0===c||e?C.push(z):(c<z&&C.push(z),z<p&&S.push(z)));C.forEach(function(e){t.$wrapperEl.append(v(u[e],e))}),S.sort(function(e,t){return t-e}).forEach(function(e){t.$wrapperEl.prepend(v(u[e],e))}),t.$wrapperEl.children(".swiper-slide").css(m,T+"px"),E()},renderSlide:function(e,t){var a=this,i=a.params.virtual;if(i.cache&&a.virtual.cache[t])return a.virtual.cache[t];var s=i.renderSlide?L(i.renderSlide.call(a,e,t)):L('<div class="'+a.params.slideClass+'" data-swiper-slide-index="'+t+'">'+e+"</div>");return s.attr("data-swiper-slide-index")||s.attr("data-swiper-slide-index",t),i.cache&&(a.virtual.cache[t]=s),s},appendSlide:function(e){if("object"==typeof e&&"length"in e)for(var t=0;t<e.length;t+=1)e[t]&&this.virtual.slides.push(e[t]);else this.virtual.slides.push(e);this.virtual.update(!0)},prependSlide:function(e){var t=this,a=t.activeIndex,i=a+1,s=1;if(Array.isArray(e)){for(var r=0;r<e.length;r+=1)e[r]&&t.virtual.slides.unshift(e[r]);i=a+e.length,s=e.length}else t.virtual.slides.unshift(e);if(t.params.virtual.cache){var n=t.virtual.cache,o={};Object.keys(n).forEach(function(e){o[parseInt(e,10)+s]=n[e]}),t.virtual.cache=o}t.virtual.update(!0),t.slideTo(i,0)},removeSlide:function(e){var t=this;if(null!=e){var a=t.activeIndex;if(Array.isArray(e))for(var i=e.length-1;0<=i;i-=1)t.virtual.slides.splice(e[i],1),t.params.virtual.cache&&delete t.virtual.cache[e[i]],e[i]<a&&(a-=1),a=Math.max(a,0);else t.virtual.slides.splice(e,1),t.params.virtual.cache&&delete t.virtual.cache[e],e<a&&(a-=1),a=Math.max(a,0);t.virtual.update(!0),t.slideTo(a,0)}},removeAllSlides:function(){var e=this;e.virtual.slides=[],e.params.virtual.cache&&(e.virtual.cache={}),e.virtual.update(!0),e.slideTo(0,0)}},$={name:"virtual",params:{virtual:{enabled:!1,slides:[],cache:!0,renderSlide:null,renderExternal:null,addSlidesBefore:0,addSlidesAfter:0}},create:function(){var e=this;ee.extend(e,{virtual:{update:k.update.bind(e),appendSlide:k.appendSlide.bind(e),prependSlide:k.prependSlide.bind(e),removeSlide:k.removeSlide.bind(e),removeAllSlides:k.removeAllSlides.bind(e),renderSlide:k.renderSlide.bind(e),slides:e.params.virtual.slides,cache:{}}})},on:{beforeInit:function(){var e=this;if(e.params.virtual.enabled){e.classNames.push(e.params.containerModifierClass+"virtual");var t={watchSlidesProgress:!0};ee.extend(e.params,t),ee.extend(e.originalParams,t),e.params.initialSlide||e.virtual.update()}},setTranslate:function(){this.params.virtual.enabled&&this.virtual.update()}}},D={handle:function(e){var t=this,a=t.rtlTranslate,i=e;i.originalEvent&&(i=i.originalEvent);var s=i.keyCode||i.charCode;if(!t.allowSlideNext&&(t.isHorizontal()&&39===s||t.isVertical()&&40===s))return!1;if(!t.allowSlidePrev&&(t.isHorizontal()&&37===s||t.isVertical()&&38===s))return!1;if(!(i.shiftKey||i.altKey||i.ctrlKey||i.metaKey||f.activeElement&&f.activeElement.nodeName&&("input"===f.activeElement.nodeName.toLowerCase()||"textarea"===f.activeElement.nodeName.toLowerCase()))){if(t.params.keyboard.onlyInViewport&&(37===s||39===s||38===s||40===s)){var r=!1;if(0<t.$el.parents("."+t.params.slideClass).length&&0===t.$el.parents("."+t.params.slideActiveClass).length)return;var n=J.innerWidth,o=J.innerHeight,l=t.$el.offset();a&&(l.left-=t.$el[0].scrollLeft);for(var d=[[l.left,l.top],[l.left+t.width,l.top],[l.left,l.top+t.height],[l.left+t.width,l.top+t.height]],p=0;p<d.length;p+=1){var c=d[p];0<=c[0]&&c[0]<=n&&0<=c[1]&&c[1]<=o&&(r=!0)}if(!r)return}t.isHorizontal()?(37!==s&&39!==s||(i.preventDefault?i.preventDefault():i.returnValue=!1),(39===s&&!a||37===s&&a)&&t.slideNext(),(37===s&&!a||39===s&&a)&&t.slidePrev()):(38!==s&&40!==s||(i.preventDefault?i.preventDefault():i.returnValue=!1),40===s&&t.slideNext(),38===s&&t.slidePrev()),t.emit("keyPress",s)}},enable:function(){this.keyboard.enabled||(L(f).on("keydown",this.keyboard.handle),this.keyboard.enabled=!0)},disable:function(){this.keyboard.enabled&&(L(f).off("keydown",this.keyboard.handle),this.keyboard.enabled=!1)}},O={name:"keyboard",params:{keyboard:{enabled:!1,onlyInViewport:!0}},create:function(){ee.extend(this,{keyboard:{enabled:!1,enable:D.enable.bind(this),disable:D.disable.bind(this),handle:D.handle.bind(this)}})},on:{init:function(){this.params.keyboard.enabled&&this.keyboard.enable()},destroy:function(){this.keyboard.enabled&&this.keyboard.disable()}}};var A={lastScrollTime:ee.now(),event:-1<J.navigator.userAgent.indexOf("firefox")?"DOMMouseScroll":function(){var e="onwheel",t=e in f;if(!t){var a=f.createElement("div");a.setAttribute(e,"return;"),t="function"==typeof a[e]}return!t&&f.implementation&&f.implementation.hasFeature&&!0!==f.implementation.hasFeature("","")&&(t=f.implementation.hasFeature("Events.wheel","3.0")),t}()?"wheel":"mousewheel",normalize:function(e){var t=0,a=0,i=0,s=0;return"detail"in e&&(a=e.detail),"wheelDelta"in e&&(a=-e.wheelDelta/120),"wheelDeltaY"in e&&(a=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=a,a=0),i=10*t,s=10*a,"deltaY"in e&&(s=e.deltaY),"deltaX"in e&&(i=e.deltaX),(i||s)&&e.deltaMode&&(1===e.deltaMode?(i*=40,s*=40):(i*=800,s*=800)),i&&!t&&(t=i<1?-1:1),s&&!a&&(a=s<1?-1:1),{spinX:t,spinY:a,pixelX:i,pixelY:s}},handleMouseEnter:function(){this.mouseEntered=!0},handleMouseLeave:function(){this.mouseEntered=!1},handle:function(e){var t=e,a=this,i=a.params.mousewheel;if(!a.mouseEntered&&!i.releaseOnEdges)return!0;t.originalEvent&&(t=t.originalEvent);var s=0,r=a.rtlTranslate?-1:1,n=A.normalize(t);if(i.forceToAxis)if(a.isHorizontal()){if(!(Math.abs(n.pixelX)>Math.abs(n.pixelY)))return!0;s=n.pixelX*r}else{if(!(Math.abs(n.pixelY)>Math.abs(n.pixelX)))return!0;s=n.pixelY}else s=Math.abs(n.pixelX)>Math.abs(n.pixelY)?-n.pixelX*r:-n.pixelY;if(0===s)return!0;if(i.invert&&(s=-s),a.params.freeMode){a.params.loop&&a.loopFix();var o=a.getTranslate()+s*i.sensitivity,l=a.isBeginning,d=a.isEnd;if(o>=a.minTranslate()&&(o=a.minTranslate()),o<=a.maxTranslate()&&(o=a.maxTranslate()),a.setTransition(0),a.setTranslate(o),a.updateProgress(),a.updateActiveIndex(),a.updateSlidesClasses(),(!l&&a.isBeginning||!d&&a.isEnd)&&a.updateSlidesClasses(),a.params.freeModeSticky&&(clearTimeout(a.mousewheel.timeout),a.mousewheel.timeout=ee.nextTick(function(){a.slideToClosest()},300)),a.emit("scroll",t),a.params.autoplay&&a.params.autoplayDisableOnInteraction&&a.autoplay.stop(),o===a.minTranslate()||o===a.maxTranslate())return!0}else{if(60<ee.now()-a.mousewheel.lastScrollTime)if(s<0)if(a.isEnd&&!a.params.loop||a.animating){if(i.releaseOnEdges)return!0}else a.slideNext(),a.emit("scroll",t);else if(a.isBeginning&&!a.params.loop||a.animating){if(i.releaseOnEdges)return!0}else a.slidePrev(),a.emit("scroll",t);a.mousewheel.lastScrollTime=(new J.Date).getTime()}return t.preventDefault?t.preventDefault():t.returnValue=!1,!1},enable:function(){var e=this;if(!A.event)return!1;if(e.mousewheel.enabled)return!1;var t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=L(e.params.mousewheel.eventsTarged)),t.on("mouseenter",e.mousewheel.handleMouseEnter),t.on("mouseleave",e.mousewheel.handleMouseLeave),t.on(A.event,e.mousewheel.handle),e.mousewheel.enabled=!0},disable:function(){var e=this;if(!A.event)return!1;if(!e.mousewheel.enabled)return!1;var t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=L(e.params.mousewheel.eventsTarged)),t.off(A.event,e.mousewheel.handle),!(e.mousewheel.enabled=!1)}},H={update:function(){var e=this,t=e.params.navigation;if(!e.params.loop){var a=e.navigation,i=a.$nextEl,s=a.$prevEl;s&&0<s.length&&(e.isBeginning?s.addClass(t.disabledClass):s.removeClass(t.disabledClass),s[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass)),i&&0<i.length&&(e.isEnd?i.addClass(t.disabledClass):i.removeClass(t.disabledClass),i[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass))}},onPrevClick:function(e){e.preventDefault(),this.isBeginning&&!this.params.loop||this.slidePrev()},onNextClick:function(e){e.preventDefault(),this.isEnd&&!this.params.loop||this.slideNext()},init:function(){var e,t,a=this,i=a.params.navigation;(i.nextEl||i.prevEl)&&(i.nextEl&&(e=L(i.nextEl),a.params.uniqueNavElements&&"string"==typeof i.nextEl&&1<e.length&&1===a.$el.find(i.nextEl).length&&(e=a.$el.find(i.nextEl))),i.prevEl&&(t=L(i.prevEl),a.params.uniqueNavElements&&"string"==typeof i.prevEl&&1<t.length&&1===a.$el.find(i.prevEl).length&&(t=a.$el.find(i.prevEl))),e&&0<e.length&&e.on("click",a.navigation.onNextClick),t&&0<t.length&&t.on("click",a.navigation.onPrevClick),ee.extend(a.navigation,{$nextEl:e,nextEl:e&&e[0],$prevEl:t,prevEl:t&&t[0]}))},destroy:function(){var e=this,t=e.navigation,a=t.$nextEl,i=t.$prevEl;a&&a.length&&(a.off("click",e.navigation.onNextClick),a.removeClass(e.params.navigation.disabledClass)),i&&i.length&&(i.off("click",e.navigation.onPrevClick),i.removeClass(e.params.navigation.disabledClass))}},N={update:function(){var e=this,t=e.rtl,s=e.params.pagination;if(s.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var r,a=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,i=e.pagination.$el,n=e.params.loop?Math.ceil((a-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?((r=Math.ceil((e.activeIndex-e.loopedSlides)/e.params.slidesPerGroup))>a-1-2*e.loopedSlides&&(r-=a-2*e.loopedSlides),n-1<r&&(r-=n),r<0&&"bullets"!==e.params.paginationType&&(r=n+r)):r=void 0!==e.snapIndex?e.snapIndex:e.activeIndex||0,"bullets"===s.type&&e.pagination.bullets&&0<e.pagination.bullets.length){var o,l,d,p=e.pagination.bullets;if(s.dynamicBullets&&(e.pagination.bulletSize=p.eq(0)[e.isHorizontal()?"outerWidth":"outerHeight"](!0),i.css(e.isHorizontal()?"width":"height",e.pagination.bulletSize*(s.dynamicMainBullets+4)+"px"),1<s.dynamicMainBullets&&void 0!==e.previousIndex&&(e.pagination.dynamicBulletIndex+=r-e.previousIndex,e.pagination.dynamicBulletIndex>s.dynamicMainBullets-1?e.pagination.dynamicBulletIndex=s.dynamicMainBullets-1:e.pagination.dynamicBulletIndex<0&&(e.pagination.dynamicBulletIndex=0)),o=r-e.pagination.dynamicBulletIndex,d=((l=o+(Math.min(p.length,s.dynamicMainBullets)-1))+o)/2),p.removeClass(s.bulletActiveClass+" "+s.bulletActiveClass+"-next "+s.bulletActiveClass+"-next-next "+s.bulletActiveClass+"-prev "+s.bulletActiveClass+"-prev-prev "+s.bulletActiveClass+"-main"),1<i.length)p.each(function(e,t){var a=L(t),i=a.index();i===r&&a.addClass(s.bulletActiveClass),s.dynamicBullets&&(o<=i&&i<=l&&a.addClass(s.bulletActiveClass+"-main"),i===o&&a.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),i===l&&a.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next"))});else if(p.eq(r).addClass(s.bulletActiveClass),s.dynamicBullets){for(var c=p.eq(o),u=p.eq(l),h=o;h<=l;h+=1)p.eq(h).addClass(s.bulletActiveClass+"-main");c.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),u.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next")}if(s.dynamicBullets){var v=Math.min(p.length,s.dynamicMainBullets+4),f=(e.pagination.bulletSize*v-e.pagination.bulletSize)/2-d*e.pagination.bulletSize,m=t?"right":"left";p.css(e.isHorizontal()?m:"top",f+"px")}}if("fraction"===s.type&&(i.find("."+s.currentClass).text(s.formatFractionCurrent(r+1)),i.find("."+s.totalClass).text(s.formatFractionTotal(n))),"progressbar"===s.type){var g;g=s.progressbarOpposite?e.isHorizontal()?"vertical":"horizontal":e.isHorizontal()?"horizontal":"vertical";var b=(r+1)/n,w=1,y=1;"horizontal"===g?w=b:y=b,i.find("."+s.progressbarFillClass).transform("translate3d(0,0,0) scaleX("+w+") scaleY("+y+")").transition(e.params.speed)}"custom"===s.type&&s.renderCustom?(i.html(s.renderCustom(e,r+1,n)),e.emit("paginationRender",e,i[0])):e.emit("paginationUpdate",e,i[0]),i[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](s.lockClass)}},render:function(){var e=this,t=e.params.pagination;if(t.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var a=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,i=e.pagination.$el,s="";if("bullets"===t.type){for(var r=e.params.loop?Math.ceil((a-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length,n=0;n<r;n+=1)t.renderBullet?s+=t.renderBullet.call(e,n,t.bulletClass):s+="<"+t.bulletElement+' class="'+t.bulletClass+'"></'+t.bulletElement+">";i.html(s),e.pagination.bullets=i.find("."+t.bulletClass)}"fraction"===t.type&&(s=t.renderFraction?t.renderFraction.call(e,t.currentClass,t.totalClass):'<span class="'+t.currentClass+'"></span> / <span class="'+t.totalClass+'"></span>',i.html(s)),"progressbar"===t.type&&(s=t.renderProgressbar?t.renderProgressbar.call(e,t.progressbarFillClass):'<span class="'+t.progressbarFillClass+'"></span>',i.html(s)),"custom"!==t.type&&e.emit("paginationRender",e.pagination.$el[0])}},init:function(){var a=this,e=a.params.pagination;if(e.el){var t=L(e.el);0!==t.length&&(a.params.uniqueNavElements&&"string"==typeof e.el&&1<t.length&&1===a.$el.find(e.el).length&&(t=a.$el.find(e.el)),"bullets"===e.type&&e.clickable&&t.addClass(e.clickableClass),t.addClass(e.modifierClass+e.type),"bullets"===e.type&&e.dynamicBullets&&(t.addClass(""+e.modifierClass+e.type+"-dynamic"),a.pagination.dynamicBulletIndex=0,e.dynamicMainBullets<1&&(e.dynamicMainBullets=1)),"progressbar"===e.type&&e.progressbarOpposite&&t.addClass(e.progressbarOppositeClass),e.clickable&&t.on("click","."+e.bulletClass,function(e){e.preventDefault();var t=L(this).index()*a.params.slidesPerGroup;a.params.loop&&(t+=a.loopedSlides),a.slideTo(t)}),ee.extend(a.pagination,{$el:t,el:t[0]}))}},destroy:function(){var e=this,t=e.params.pagination;if(t.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var a=e.pagination.$el;a.removeClass(t.hiddenClass),a.removeClass(t.modifierClass+t.type),e.pagination.bullets&&e.pagination.bullets.removeClass(t.bulletActiveClass),t.clickable&&a.off("click","."+t.bulletClass)}}},G={setTranslate:function(){var e=this;if(e.params.scrollbar.el&&e.scrollbar.el){var t=e.scrollbar,a=e.rtlTranslate,i=e.progress,s=t.dragSize,r=t.trackSize,n=t.$dragEl,o=t.$el,l=e.params.scrollbar,d=s,p=(r-s)*i;a?0<(p=-p)?(d=s-p,p=0):r<-p+s&&(d=r+p):p<0?(d=s+p,p=0):r<p+s&&(d=r-p),e.isHorizontal()?(te.transforms3d?n.transform("translate3d("+p+"px, 0, 0)"):n.transform("translateX("+p+"px)"),n[0].style.width=d+"px"):(te.transforms3d?n.transform("translate3d(0px, "+p+"px, 0)"):n.transform("translateY("+p+"px)"),n[0].style.height=d+"px"),l.hide&&(clearTimeout(e.scrollbar.timeout),o[0].style.opacity=1,e.scrollbar.timeout=setTimeout(function(){o[0].style.opacity=0,o.transition(400)},1e3))}},setTransition:function(e){this.params.scrollbar.el&&this.scrollbar.el&&this.scrollbar.$dragEl.transition(e)},updateSize:function(){var e=this;if(e.params.scrollbar.el&&e.scrollbar.el){var t=e.scrollbar,a=t.$dragEl,i=t.$el;a[0].style.width="",a[0].style.height="";var s,r=e.isHorizontal()?i[0].offsetWidth:i[0].offsetHeight,n=e.size/e.virtualSize,o=n*(r/e.size);s="auto"===e.params.scrollbar.dragSize?r*n:parseInt(e.params.scrollbar.dragSize,10),e.isHorizontal()?a[0].style.width=s+"px":a[0].style.height=s+"px",i[0].style.display=1<=n?"none":"",e.params.scrollbar.hide&&(i[0].style.opacity=0),ee.extend(t,{trackSize:r,divider:n,moveDivider:o,dragSize:s}),t.$el[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](e.params.scrollbar.lockClass)}},setDragPosition:function(e){var t,a=this,i=a.scrollbar,s=a.rtlTranslate,r=i.$el,n=i.dragSize,o=i.trackSize;t=((a.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageX:e.pageX||e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageY:e.pageY||e.clientY)-r.offset()[a.isHorizontal()?"left":"top"]-n/2)/(o-n),t=Math.max(Math.min(t,1),0),s&&(t=1-t);var l=a.minTranslate()+(a.maxTranslate()-a.minTranslate())*t;a.updateProgress(l),a.setTranslate(l),a.updateActiveIndex(),a.updateSlidesClasses()},onDragStart:function(e){var t=this,a=t.params.scrollbar,i=t.scrollbar,s=t.$wrapperEl,r=i.$el,n=i.$dragEl;t.scrollbar.isTouched=!0,e.preventDefault(),e.stopPropagation(),s.transition(100),n.transition(100),i.setDragPosition(e),clearTimeout(t.scrollbar.dragTimeout),r.transition(0),a.hide&&r.css("opacity",1),t.emit("scrollbarDragStart",e)},onDragMove:function(e){var t=this.scrollbar,a=this.$wrapperEl,i=t.$el,s=t.$dragEl;this.scrollbar.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,t.setDragPosition(e),a.transition(0),i.transition(0),s.transition(0),this.emit("scrollbarDragMove",e))},onDragEnd:function(e){var t=this,a=t.params.scrollbar,i=t.scrollbar.$el;t.scrollbar.isTouched&&(t.scrollbar.isTouched=!1,a.hide&&(clearTimeout(t.scrollbar.dragTimeout),t.scrollbar.dragTimeout=ee.nextTick(function(){i.css("opacity",0),i.transition(400)},1e3)),t.emit("scrollbarDragEnd",e),a.snapOnRelease&&t.slideToClosest())},enableDraggable:function(){var e=this;if(e.params.scrollbar.el){var t=e.scrollbar,a=e.touchEventsTouch,i=e.touchEventsDesktop,s=e.params,r=t.$el[0],n=!(!te.passiveListener||!s.passiveListeners)&&{passive:!1,capture:!1},o=!(!te.passiveListener||!s.passiveListeners)&&{passive:!0,capture:!1};te.touch?(r.addEventListener(a.start,e.scrollbar.onDragStart,n),r.addEventListener(a.move,e.scrollbar.onDragMove,n),r.addEventListener(a.end,e.scrollbar.onDragEnd,o)):(r.addEventListener(i.start,e.scrollbar.onDragStart,n),f.addEventListener(i.move,e.scrollbar.onDragMove,n),f.addEventListener(i.end,e.scrollbar.onDragEnd,o))}},disableDraggable:function(){var e=this;if(e.params.scrollbar.el){var t=e.scrollbar,a=e.touchEventsTouch,i=e.touchEventsDesktop,s=e.params,r=t.$el[0],n=!(!te.passiveListener||!s.passiveListeners)&&{passive:!1,capture:!1},o=!(!te.passiveListener||!s.passiveListeners)&&{passive:!0,capture:!1};te.touch?(r.removeEventListener(a.start,e.scrollbar.onDragStart,n),r.removeEventListener(a.move,e.scrollbar.onDragMove,n),r.removeEventListener(a.end,e.scrollbar.onDragEnd,o)):(r.removeEventListener(i.start,e.scrollbar.onDragStart,n),f.removeEventListener(i.move,e.scrollbar.onDragMove,n),f.removeEventListener(i.end,e.scrollbar.onDragEnd,o))}},init:function(){var e=this;if(e.params.scrollbar.el){var t=e.scrollbar,a=e.$el,i=e.params.scrollbar,s=L(i.el);e.params.uniqueNavElements&&"string"==typeof i.el&&1<s.length&&1===a.find(i.el).length&&(s=a.find(i.el));var r=s.find("."+e.params.scrollbar.dragClass);0===r.length&&(r=L('<div class="'+e.params.scrollbar.dragClass+'"></div>'),s.append(r)),ee.extend(t,{$el:s,el:s[0],$dragEl:r,dragEl:r[0]}),i.draggable&&t.enableDraggable()}},destroy:function(){this.scrollbar.disableDraggable()}},B={setTransform:function(e,t){var a=this.rtl,i=L(e),s=a?-1:1,r=i.attr("data-swiper-parallax")||"0",n=i.attr("data-swiper-parallax-x"),o=i.attr("data-swiper-parallax-y"),l=i.attr("data-swiper-parallax-scale"),d=i.attr("data-swiper-parallax-opacity");if(n||o?(n=n||"0",o=o||"0"):this.isHorizontal()?(n=r,o="0"):(o=r,n="0"),n=0<=n.indexOf("%")?parseInt(n,10)*t*s+"%":n*t*s+"px",o=0<=o.indexOf("%")?parseInt(o,10)*t+"%":o*t+"px",null!=d){var p=d-(d-1)*(1-Math.abs(t));i[0].style.opacity=p}if(null==l)i.transform("translate3d("+n+", "+o+", 0px)");else{var c=l-(l-1)*(1-Math.abs(t));i.transform("translate3d("+n+", "+o+", 0px) scale("+c+")")}},setTranslate:function(){var i=this,e=i.$el,t=i.slides,s=i.progress,r=i.snapGrid;e.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(e,t){i.parallax.setTransform(t,s)}),t.each(function(e,t){var a=t.progress;1<i.params.slidesPerGroup&&"auto"!==i.params.slidesPerView&&(a+=Math.ceil(e/2)-s*(r.length-1)),a=Math.min(Math.max(a,-1),1),L(t).find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(e,t){i.parallax.setTransform(t,a)})})},setTransition:function(s){void 0===s&&(s=this.params.speed);this.$el.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(e,t){var a=L(t),i=parseInt(a.attr("data-swiper-parallax-duration"),10)||s;0===s&&(i=0),a.transition(i)})}},X={getDistanceBetweenTouches:function(e){if(e.targetTouches.length<2)return 1;var t=e.targetTouches[0].pageX,a=e.targetTouches[0].pageY,i=e.targetTouches[1].pageX,s=e.targetTouches[1].pageY;return Math.sqrt(Math.pow(i-t,2)+Math.pow(s-a,2))},onGestureStart:function(e){var t=this,a=t.params.zoom,i=t.zoom,s=i.gesture;if(i.fakeGestureTouched=!1,i.fakeGestureMoved=!1,!te.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;i.fakeGestureTouched=!0,s.scaleStart=X.getDistanceBetweenTouches(e)}s.$slideEl&&s.$slideEl.length||(s.$slideEl=L(e.target).closest(".swiper-slide"),0===s.$slideEl.length&&(s.$slideEl=t.slides.eq(t.activeIndex)),s.$imageEl=s.$slideEl.find("img, svg, canvas"),s.$imageWrapEl=s.$imageEl.parent("."+a.containerClass),s.maxRatio=s.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,0!==s.$imageWrapEl.length)?(s.$imageEl.transition(0),t.zoom.isScaling=!0):s.$imageEl=void 0},onGestureChange:function(e){var t=this.params.zoom,a=this.zoom,i=a.gesture;if(!te.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;a.fakeGestureMoved=!0,i.scaleMove=X.getDistanceBetweenTouches(e)}i.$imageEl&&0!==i.$imageEl.length&&(a.scale=te.gestures?e.scale*a.currentScale:i.scaleMove/i.scaleStart*a.currentScale,a.scale>i.maxRatio&&(a.scale=i.maxRatio-1+Math.pow(a.scale-i.maxRatio+1,.5)),a.scale<t.minRatio&&(a.scale=t.minRatio+1-Math.pow(t.minRatio-a.scale+1,.5)),i.$imageEl.transform("translate3d(0,0,0) scale("+a.scale+")"))},onGestureEnd:function(e){var t=this.params.zoom,a=this.zoom,i=a.gesture;if(!te.gestures){if(!a.fakeGestureTouched||!a.fakeGestureMoved)return;if("touchend"!==e.type||"touchend"===e.type&&e.changedTouches.length<2&&!g.android)return;a.fakeGestureTouched=!1,a.fakeGestureMoved=!1}i.$imageEl&&0!==i.$imageEl.length&&(a.scale=Math.max(Math.min(a.scale,i.maxRatio),t.minRatio),i.$imageEl.transition(this.params.speed).transform("translate3d(0,0,0) scale("+a.scale+")"),a.currentScale=a.scale,a.isScaling=!1,1===a.scale&&(i.$slideEl=void 0))},onTouchStart:function(e){var t=this.zoom,a=t.gesture,i=t.image;a.$imageEl&&0!==a.$imageEl.length&&(i.isTouched||(g.android&&e.preventDefault(),i.isTouched=!0,i.touchesStart.x="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,i.touchesStart.y="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY))},onTouchMove:function(e){var t=this,a=t.zoom,i=a.gesture,s=a.image,r=a.velocity;if(i.$imageEl&&0!==i.$imageEl.length&&(t.allowClick=!1,s.isTouched&&i.$slideEl)){s.isMoved||(s.width=i.$imageEl[0].offsetWidth,s.height=i.$imageEl[0].offsetHeight,s.startX=ee.getTranslate(i.$imageWrapEl[0],"x")||0,s.startY=ee.getTranslate(i.$imageWrapEl[0],"y")||0,i.slideWidth=i.$slideEl[0].offsetWidth,i.slideHeight=i.$slideEl[0].offsetHeight,i.$imageWrapEl.transition(0),t.rtl&&(s.startX=-s.startX,s.startY=-s.startY));var n=s.width*a.scale,o=s.height*a.scale;if(!(n<i.slideWidth&&o<i.slideHeight)){if(s.minX=Math.min(i.slideWidth/2-n/2,0),s.maxX=-s.minX,s.minY=Math.min(i.slideHeight/2-o/2,0),s.maxY=-s.minY,s.touchesCurrent.x="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,s.touchesCurrent.y="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,!s.isMoved&&!a.isScaling){if(t.isHorizontal()&&(Math.floor(s.minX)===Math.floor(s.startX)&&s.touchesCurrent.x<s.touchesStart.x||Math.floor(s.maxX)===Math.floor(s.startX)&&s.touchesCurrent.x>s.touchesStart.x))return void(s.isTouched=!1);if(!t.isHorizontal()&&(Math.floor(s.minY)===Math.floor(s.startY)&&s.touchesCurrent.y<s.touchesStart.y||Math.floor(s.maxY)===Math.floor(s.startY)&&s.touchesCurrent.y>s.touchesStart.y))return void(s.isTouched=!1)}e.preventDefault(),e.stopPropagation(),s.isMoved=!0,s.currentX=s.touchesCurrent.x-s.touchesStart.x+s.startX,s.currentY=s.touchesCurrent.y-s.touchesStart.y+s.startY,s.currentX<s.minX&&(s.currentX=s.minX+1-Math.pow(s.minX-s.currentX+1,.8)),s.currentX>s.maxX&&(s.currentX=s.maxX-1+Math.pow(s.currentX-s.maxX+1,.8)),s.currentY<s.minY&&(s.currentY=s.minY+1-Math.pow(s.minY-s.currentY+1,.8)),s.currentY>s.maxY&&(s.currentY=s.maxY-1+Math.pow(s.currentY-s.maxY+1,.8)),r.prevPositionX||(r.prevPositionX=s.touchesCurrent.x),r.prevPositionY||(r.prevPositionY=s.touchesCurrent.y),r.prevTime||(r.prevTime=Date.now()),r.x=(s.touchesCurrent.x-r.prevPositionX)/(Date.now()-r.prevTime)/2,r.y=(s.touchesCurrent.y-r.prevPositionY)/(Date.now()-r.prevTime)/2,Math.abs(s.touchesCurrent.x-r.prevPositionX)<2&&(r.x=0),Math.abs(s.touchesCurrent.y-r.prevPositionY)<2&&(r.y=0),r.prevPositionX=s.touchesCurrent.x,r.prevPositionY=s.touchesCurrent.y,r.prevTime=Date.now(),i.$imageWrapEl.transform("translate3d("+s.currentX+"px, "+s.currentY+"px,0)")}}},onTouchEnd:function(){var e=this.zoom,t=e.gesture,a=e.image,i=e.velocity;if(t.$imageEl&&0!==t.$imageEl.length){if(!a.isTouched||!a.isMoved)return a.isTouched=!1,void(a.isMoved=!1);a.isTouched=!1,a.isMoved=!1;var s=300,r=300,n=i.x*s,o=a.currentX+n,l=i.y*r,d=a.currentY+l;0!==i.x&&(s=Math.abs((o-a.currentX)/i.x)),0!==i.y&&(r=Math.abs((d-a.currentY)/i.y));var p=Math.max(s,r);a.currentX=o,a.currentY=d;var c=a.width*e.scale,u=a.height*e.scale;a.minX=Math.min(t.slideWidth/2-c/2,0),a.maxX=-a.minX,a.minY=Math.min(t.slideHeight/2-u/2,0),a.maxY=-a.minY,a.currentX=Math.max(Math.min(a.currentX,a.maxX),a.minX),a.currentY=Math.max(Math.min(a.currentY,a.maxY),a.minY),t.$imageWrapEl.transition(p).transform("translate3d("+a.currentX+"px, "+a.currentY+"px,0)")}},onTransitionEnd:function(){var e=this.zoom,t=e.gesture;t.$slideEl&&this.previousIndex!==this.activeIndex&&(t.$imageEl.transform("translate3d(0,0,0) scale(1)"),t.$imageWrapEl.transform("translate3d(0,0,0)"),e.scale=1,e.currentScale=1,t.$slideEl=void 0,t.$imageEl=void 0,t.$imageWrapEl=void 0)},toggle:function(e){var t=this.zoom;t.scale&&1!==t.scale?t.out():t.in(e)},in:function(e){var t,a,i,s,r,n,o,l,d,p,c,u,h,v,f,m,g=this,b=g.zoom,w=g.params.zoom,y=b.gesture,x=b.image;(y.$slideEl||(y.$slideEl=g.clickedSlide?L(g.clickedSlide):g.slides.eq(g.activeIndex),y.$imageEl=y.$slideEl.find("img, svg, canvas"),y.$imageWrapEl=y.$imageEl.parent("."+w.containerClass)),y.$imageEl&&0!==y.$imageEl.length)&&(y.$slideEl.addClass(""+w.zoomedSlideClass),void 0===x.touchesStart.x&&e?(t="touchend"===e.type?e.changedTouches[0].pageX:e.pageX,a="touchend"===e.type?e.changedTouches[0].pageY:e.pageY):(t=x.touchesStart.x,a=x.touchesStart.y),b.scale=y.$imageWrapEl.attr("data-swiper-zoom")||w.maxRatio,b.currentScale=y.$imageWrapEl.attr("data-swiper-zoom")||w.maxRatio,e?(f=y.$slideEl[0].offsetWidth,m=y.$slideEl[0].offsetHeight,i=y.$slideEl.offset().left+f/2-t,s=y.$slideEl.offset().top+m/2-a,o=y.$imageEl[0].offsetWidth,l=y.$imageEl[0].offsetHeight,d=o*b.scale,p=l*b.scale,h=-(c=Math.min(f/2-d/2,0)),v=-(u=Math.min(m/2-p/2,0)),(r=i*b.scale)<c&&(r=c),h<r&&(r=h),(n=s*b.scale)<u&&(n=u),v<n&&(n=v)):n=r=0,y.$imageWrapEl.transition(300).transform("translate3d("+r+"px, "+n+"px,0)"),y.$imageEl.transition(300).transform("translate3d(0,0,0) scale("+b.scale+")"))},out:function(){var e=this,t=e.zoom,a=e.params.zoom,i=t.gesture;i.$slideEl||(i.$slideEl=e.clickedSlide?L(e.clickedSlide):e.slides.eq(e.activeIndex),i.$imageEl=i.$slideEl.find("img, svg, canvas"),i.$imageWrapEl=i.$imageEl.parent("."+a.containerClass)),i.$imageEl&&0!==i.$imageEl.length&&(t.scale=1,t.currentScale=1,i.$imageWrapEl.transition(300).transform("translate3d(0,0,0)"),i.$imageEl.transition(300).transform("translate3d(0,0,0) scale(1)"),i.$slideEl.removeClass(""+a.zoomedSlideClass),i.$slideEl=void 0)},enable:function(){var e=this,t=e.zoom;if(!t.enabled){t.enabled=!0;var a=!("touchstart"!==e.touchEvents.start||!te.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};te.gestures?(e.$wrapperEl.on("gesturestart",".swiper-slide",t.onGestureStart,a),e.$wrapperEl.on("gesturechange",".swiper-slide",t.onGestureChange,a),e.$wrapperEl.on("gestureend",".swiper-slide",t.onGestureEnd,a)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.on(e.touchEvents.start,".swiper-slide",t.onGestureStart,a),e.$wrapperEl.on(e.touchEvents.move,".swiper-slide",t.onGestureChange,a),e.$wrapperEl.on(e.touchEvents.end,".swiper-slide",t.onGestureEnd,a)),e.$wrapperEl.on(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)}},disable:function(){var e=this,t=e.zoom;if(t.enabled){e.zoom.enabled=!1;var a=!("touchstart"!==e.touchEvents.start||!te.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};te.gestures?(e.$wrapperEl.off("gesturestart",".swiper-slide",t.onGestureStart,a),e.$wrapperEl.off("gesturechange",".swiper-slide",t.onGestureChange,a),e.$wrapperEl.off("gestureend",".swiper-slide",t.onGestureEnd,a)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.off(e.touchEvents.start,".swiper-slide",t.onGestureStart,a),e.$wrapperEl.off(e.touchEvents.move,".swiper-slide",t.onGestureChange,a),e.$wrapperEl.off(e.touchEvents.end,".swiper-slide",t.onGestureEnd,a)),e.$wrapperEl.off(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)}}},Y={loadInSlide:function(e,l){void 0===l&&(l=!0);var d=this,p=d.params.lazy;if(void 0!==e&&0!==d.slides.length){var c=d.virtual&&d.params.virtual.enabled?d.$wrapperEl.children("."+d.params.slideClass+'[data-swiper-slide-index="'+e+'"]'):d.slides.eq(e),t=c.find("."+p.elementClass+":not(."+p.loadedClass+"):not(."+p.loadingClass+")");!c.hasClass(p.elementClass)||c.hasClass(p.loadedClass)||c.hasClass(p.loadingClass)||(t=t.add(c[0])),0!==t.length&&t.each(function(e,t){var i=L(t);i.addClass(p.loadingClass);var s=i.attr("data-background"),r=i.attr("data-src"),n=i.attr("data-srcset"),o=i.attr("data-sizes");d.loadImage(i[0],r||s,n,o,!1,function(){if(null!=d&&d&&(!d||d.params)&&!d.destroyed){if(s?(i.css("background-image",'url("'+s+'")'),i.removeAttr("data-background")):(n&&(i.attr("srcset",n),i.removeAttr("data-srcset")),o&&(i.attr("sizes",o),i.removeAttr("data-sizes")),r&&(i.attr("src",r),i.removeAttr("data-src"))),i.addClass(p.loadedClass).removeClass(p.loadingClass),c.find("."+p.preloaderClass).remove(),d.params.loop&&l){var e=c.attr("data-swiper-slide-index");if(c.hasClass(d.params.slideDuplicateClass)){var t=d.$wrapperEl.children('[data-swiper-slide-index="'+e+'"]:not(.'+d.params.slideDuplicateClass+")");d.lazy.loadInSlide(t.index(),!1)}else{var a=d.$wrapperEl.children("."+d.params.slideDuplicateClass+'[data-swiper-slide-index="'+e+'"]');d.lazy.loadInSlide(a.index(),!1)}}d.emit("lazyImageReady",c[0],i[0])}}),d.emit("lazyImageLoad",c[0],i[0])})}},load:function(){var i=this,t=i.$wrapperEl,a=i.params,s=i.slides,e=i.activeIndex,r=i.virtual&&a.virtual.enabled,n=a.lazy,o=a.slidesPerView;function l(e){if(r){if(t.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]').length)return!0}else if(s[e])return!0;return!1}function d(e){return r?L(e).attr("data-swiper-slide-index"):L(e).index()}if("auto"===o&&(o=0),i.lazy.initialImageLoaded||(i.lazy.initialImageLoaded=!0),i.params.watchSlidesVisibility)t.children("."+a.slideVisibleClass).each(function(e,t){var a=r?L(t).attr("data-swiper-slide-index"):L(t).index();i.lazy.loadInSlide(a)});else if(1<o)for(var p=e;p<e+o;p+=1)l(p)&&i.lazy.loadInSlide(p);else i.lazy.loadInSlide(e);if(n.loadPrevNext)if(1<o||n.loadPrevNextAmount&&1<n.loadPrevNextAmount){for(var c=n.loadPrevNextAmount,u=o,h=Math.min(e+u+Math.max(c,u),s.length),v=Math.max(e-Math.max(u,c),0),f=e+o;f<h;f+=1)l(f)&&i.lazy.loadInSlide(f);for(var m=v;m<e;m+=1)l(m)&&i.lazy.loadInSlide(m)}else{var g=t.children("."+a.slideNextClass);0<g.length&&i.lazy.loadInSlide(d(g));var b=t.children("."+a.slidePrevClass);0<b.length&&i.lazy.loadInSlide(d(b))}}},V={LinearSpline:function(e,t){var a,i,s,r,n,o=function(e,t){for(i=-1,a=e.length;1<a-i;)e[s=a+i>>1]<=t?i=s:a=s;return a};return this.x=e,this.y=t,this.lastIndex=e.length-1,this.interpolate=function(e){return e?(n=o(this.x,e),r=n-1,(e-this.x[r])*(this.y[n]-this.y[r])/(this.x[n]-this.x[r])+this.y[r]):0},this},getInterpolateFunction:function(e){var t=this;t.controller.spline||(t.controller.spline=t.params.loop?new V.LinearSpline(t.slidesGrid,e.slidesGrid):new V.LinearSpline(t.snapGrid,e.snapGrid))},setTranslate:function(e,t){var a,i,s=this,r=s.controller.control;function n(e){var t=s.rtlTranslate?-s.translate:s.translate;"slide"===s.params.controller.by&&(s.controller.getInterpolateFunction(e),i=-s.controller.spline.interpolate(-t)),i&&"container"!==s.params.controller.by||(a=(e.maxTranslate()-e.minTranslate())/(s.maxTranslate()-s.minTranslate()),i=(t-s.minTranslate())*a+e.minTranslate()),s.params.controller.inverse&&(i=e.maxTranslate()-i),e.updateProgress(i),e.setTranslate(i,s),e.updateActiveIndex(),e.updateSlidesClasses()}if(Array.isArray(r))for(var o=0;o<r.length;o+=1)r[o]!==t&&r[o]instanceof T&&n(r[o]);else r instanceof T&&t!==r&&n(r)},setTransition:function(t,e){var a,i=this,s=i.controller.control;function r(e){e.setTransition(t,i),0!==t&&(e.transitionStart(),e.params.autoHeight&&ee.nextTick(function(){e.updateAutoHeight()}),e.$wrapperEl.transitionEnd(function(){s&&(e.params.loop&&"slide"===i.params.controller.by&&e.loopFix(),e.transitionEnd())}))}if(Array.isArray(s))for(a=0;a<s.length;a+=1)s[a]!==e&&s[a]instanceof T&&r(s[a]);else s instanceof T&&e!==s&&r(s)}},F={makeElFocusable:function(e){return e.attr("tabIndex","0"),e},addElRole:function(e,t){return e.attr("role",t),e},addElLabel:function(e,t){return e.attr("aria-label",t),e},disableEl:function(e){return e.attr("aria-disabled",!0),e},enableEl:function(e){return e.attr("aria-disabled",!1),e},onEnterKey:function(e){var t=this,a=t.params.a11y;if(13===e.keyCode){var i=L(e.target);t.navigation&&t.navigation.$nextEl&&i.is(t.navigation.$nextEl)&&(t.isEnd&&!t.params.loop||t.slideNext(),t.isEnd?t.a11y.notify(a.lastSlideMessage):t.a11y.notify(a.nextSlideMessage)),t.navigation&&t.navigation.$prevEl&&i.is(t.navigation.$prevEl)&&(t.isBeginning&&!t.params.loop||t.slidePrev(),t.isBeginning?t.a11y.notify(a.firstSlideMessage):t.a11y.notify(a.prevSlideMessage)),t.pagination&&i.is("."+t.params.pagination.bulletClass)&&i[0].click()}},notify:function(e){var t=this.a11y.liveRegion;0!==t.length&&(t.html(""),t.html(e))},updateNavigation:function(){var e=this;if(!e.params.loop){var t=e.navigation,a=t.$nextEl,i=t.$prevEl;i&&0<i.length&&(e.isBeginning?e.a11y.disableEl(i):e.a11y.enableEl(i)),a&&0<a.length&&(e.isEnd?e.a11y.disableEl(a):e.a11y.enableEl(a))}},updatePagination:function(){var i=this,s=i.params.a11y;i.pagination&&i.params.pagination.clickable&&i.pagination.bullets&&i.pagination.bullets.length&&i.pagination.bullets.each(function(e,t){var a=L(t);i.a11y.makeElFocusable(a),i.a11y.addElRole(a,"button"),i.a11y.addElLabel(a,s.paginationBulletMessage.replace(/{{index}}/,a.index()+1))})},init:function(){var e=this;e.$el.append(e.a11y.liveRegion);var t,a,i=e.params.a11y;e.navigation&&e.navigation.$nextEl&&(t=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(a=e.navigation.$prevEl),t&&(e.a11y.makeElFocusable(t),e.a11y.addElRole(t,"button"),e.a11y.addElLabel(t,i.nextSlideMessage),t.on("keydown",e.a11y.onEnterKey)),a&&(e.a11y.makeElFocusable(a),e.a11y.addElRole(a,"button"),e.a11y.addElLabel(a,i.prevSlideMessage),a.on("keydown",e.a11y.onEnterKey)),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.on("keydown","."+e.params.pagination.bulletClass,e.a11y.onEnterKey)},destroy:function(){var e,t,a=this;a.a11y.liveRegion&&0<a.a11y.liveRegion.length&&a.a11y.liveRegion.remove(),a.navigation&&a.navigation.$nextEl&&(e=a.navigation.$nextEl),a.navigation&&a.navigation.$prevEl&&(t=a.navigation.$prevEl),e&&e.off("keydown",a.a11y.onEnterKey),t&&t.off("keydown",a.a11y.onEnterKey),a.pagination&&a.params.pagination.clickable&&a.pagination.bullets&&a.pagination.bullets.length&&a.pagination.$el.off("keydown","."+a.params.pagination.bulletClass,a.a11y.onEnterKey)}},R={init:function(){var e=this;if(e.params.history){if(!J.history||!J.history.pushState)return e.params.history.enabled=!1,void(e.params.hashNavigation.enabled=!0);var t=e.history;t.initialized=!0,t.paths=R.getPathValues(),(t.paths.key||t.paths.value)&&(t.scrollToSlide(0,t.paths.value,e.params.runCallbacksOnInit),e.params.history.replaceState||J.addEventListener("popstate",e.history.setHistoryPopState))}},destroy:function(){this.params.history.replaceState||J.removeEventListener("popstate",this.history.setHistoryPopState)},setHistoryPopState:function(){this.history.paths=R.getPathValues(),this.history.scrollToSlide(this.params.speed,this.history.paths.value,!1)},getPathValues:function(){var e=J.location.pathname.slice(1).split("/").filter(function(e){return""!==e}),t=e.length;return{key:e[t-2],value:e[t-1]}},setHistory:function(e,t){if(this.history.initialized&&this.params.history.enabled){var a=this.slides.eq(t),i=R.slugify(a.attr("data-history"));J.location.pathname.includes(e)||(i=e+"/"+i);var s=J.history.state;s&&s.value===i||(this.params.history.replaceState?J.history.replaceState({value:i},null,i):J.history.pushState({value:i},null,i))}},slugify:function(e){return e.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")},scrollToSlide:function(e,t,a){var i=this;if(t)for(var s=0,r=i.slides.length;s<r;s+=1){var n=i.slides.eq(s);if(R.slugify(n.attr("data-history"))===t&&!n.hasClass(i.params.slideDuplicateClass)){var o=n.index();i.slideTo(o,e,a)}}else i.slideTo(0,e,a)}},q={onHashCange:function(){var e=this,t=f.location.hash.replace("#","");if(t!==e.slides.eq(e.activeIndex).attr("data-hash")){var a=e.$wrapperEl.children("."+e.params.slideClass+'[data-hash="'+t+'"]').index();if(void 0===a)return;e.slideTo(a)}},setHash:function(){var e=this;if(e.hashNavigation.initialized&&e.params.hashNavigation.enabled)if(e.params.hashNavigation.replaceState&&J.history&&J.history.replaceState)J.history.replaceState(null,null,"#"+e.slides.eq(e.activeIndex).attr("data-hash")||"");else{var t=e.slides.eq(e.activeIndex),a=t.attr("data-hash")||t.attr("data-history");f.location.hash=a||""}},init:function(){var e=this;if(!(!e.params.hashNavigation.enabled||e.params.history&&e.params.history.enabled)){e.hashNavigation.initialized=!0;var t=f.location.hash.replace("#","");if(t)for(var a=0,i=e.slides.length;a<i;a+=1){var s=e.slides.eq(a);if((s.attr("data-hash")||s.attr("data-history"))===t&&!s.hasClass(e.params.slideDuplicateClass)){var r=s.index();e.slideTo(r,0,e.params.runCallbacksOnInit,!0)}}e.params.hashNavigation.watchState&&L(J).on("hashchange",e.hashNavigation.onHashCange)}},destroy:function(){this.params.hashNavigation.watchState&&L(J).off("hashchange",this.hashNavigation.onHashCange)}},W={run:function(){var e=this,t=e.slides.eq(e.activeIndex),a=e.params.autoplay.delay;t.attr("data-swiper-autoplay")&&(a=t.attr("data-swiper-autoplay")||e.params.autoplay.delay),e.autoplay.timeout=ee.nextTick(function(){e.params.autoplay.reverseDirection?e.params.loop?(e.loopFix(),e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.isBeginning?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(e.slides.length-1,e.params.speed,!0,!0),e.emit("autoplay")):(e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.params.loop?(e.loopFix(),e.slideNext(e.params.speed,!0,!0),e.emit("autoplay")):e.isEnd?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(0,e.params.speed,!0,!0),e.emit("autoplay")):(e.slideNext(e.params.speed,!0,!0),e.emit("autoplay"))},a)},start:function(){var e=this;return void 0===e.autoplay.timeout&&(!e.autoplay.running&&(e.autoplay.running=!0,e.emit("autoplayStart"),e.autoplay.run(),!0))},stop:function(){var e=this;return!!e.autoplay.running&&(void 0!==e.autoplay.timeout&&(e.autoplay.timeout&&(clearTimeout(e.autoplay.timeout),e.autoplay.timeout=void 0),e.autoplay.running=!1,e.emit("autoplayStop"),!0))},pause:function(e){var t=this;t.autoplay.running&&(t.autoplay.paused||(t.autoplay.timeout&&clearTimeout(t.autoplay.timeout),t.autoplay.paused=!0,0!==e&&t.params.autoplay.waitForTransition?(t.$wrapperEl[0].addEventListener("transitionend",t.autoplay.onTransitionEnd),t.$wrapperEl[0].addEventListener("webkitTransitionEnd",t.autoplay.onTransitionEnd)):(t.autoplay.paused=!1,t.autoplay.run())))}},j={setTranslate:function(){for(var e=this,t=e.slides,a=0;a<t.length;a+=1){var i=e.slides.eq(a),s=-i[0].swiperSlideOffset;e.params.virtualTranslate||(s-=e.translate);var r=0;e.isHorizontal()||(r=s,s=0);var n=e.params.fadeEffect.crossFade?Math.max(1-Math.abs(i[0].progress),0):1+Math.min(Math.max(i[0].progress,-1),0);i.css({opacity:n}).transform("translate3d("+s+"px, "+r+"px, 0px)")}},setTransition:function(e){var a=this,t=a.slides,i=a.$wrapperEl;if(t.transition(e),a.params.virtualTranslate&&0!==e){var s=!1;t.transitionEnd(function(){if(!s&&a&&!a.destroyed){s=!0,a.animating=!1;for(var e=["webkitTransitionEnd","transitionend"],t=0;t<e.length;t+=1)i.trigger(e[t])}})}}},U={setTranslate:function(){var e,t=this,a=t.$el,i=t.$wrapperEl,s=t.slides,r=t.width,n=t.height,o=t.rtlTranslate,l=t.size,d=t.params.cubeEffect,p=t.isHorizontal(),c=t.virtual&&t.params.virtual.enabled,u=0;d.shadow&&(p?(0===(e=i.find(".swiper-cube-shadow")).length&&(e=L('<div class="swiper-cube-shadow"></div>'),i.append(e)),e.css({height:r+"px"})):0===(e=a.find(".swiper-cube-shadow")).length&&(e=L('<div class="swiper-cube-shadow"></div>'),a.append(e)));for(var h=0;h<s.length;h+=1){var v=s.eq(h),f=h;c&&(f=parseInt(v.attr("data-swiper-slide-index"),10));var m=90*f,g=Math.floor(m/360);o&&(m=-m,g=Math.floor(-m/360));var b=Math.max(Math.min(v[0].progress,1),-1),w=0,y=0,x=0;f%4==0?(w=4*-g*l,x=0):(f-1)%4==0?(w=0,x=4*-g*l):(f-2)%4==0?(w=l+4*g*l,x=l):(f-3)%4==0&&(w=-l,x=3*l+4*l*g),o&&(w=-w),p||(y=w,w=0);var T="rotateX("+(p?0:-m)+"deg) rotateY("+(p?m:0)+"deg) translate3d("+w+"px, "+y+"px, "+x+"px)";if(b<=1&&-1<b&&(u=90*f+90*b,o&&(u=90*-f-90*b)),v.transform(T),d.slideShadows){var E=p?v.find(".swiper-slide-shadow-left"):v.find(".swiper-slide-shadow-top"),S=p?v.find(".swiper-slide-shadow-right"):v.find(".swiper-slide-shadow-bottom");0===E.length&&(E=L('<div class="swiper-slide-shadow-'+(p?"left":"top")+'"></div>'),v.append(E)),0===S.length&&(S=L('<div class="swiper-slide-shadow-'+(p?"right":"bottom")+'"></div>'),v.append(S)),E.length&&(E[0].style.opacity=Math.max(-b,0)),S.length&&(S[0].style.opacity=Math.max(b,0))}}if(i.css({"-webkit-transform-origin":"50% 50% -"+l/2+"px","-moz-transform-origin":"50% 50% -"+l/2+"px","-ms-transform-origin":"50% 50% -"+l/2+"px","transform-origin":"50% 50% -"+l/2+"px"}),d.shadow)if(p)e.transform("translate3d(0px, "+(r/2+d.shadowOffset)+"px, "+-r/2+"px) rotateX(90deg) rotateZ(0deg) scale("+d.shadowScale+")");else{var C=Math.abs(u)-90*Math.floor(Math.abs(u)/90),M=1.5-(Math.sin(2*C*Math.PI/360)/2+Math.cos(2*C*Math.PI/360)/2),z=d.shadowScale,P=d.shadowScale/M,k=d.shadowOffset;e.transform("scale3d("+z+", 1, "+P+") translate3d(0px, "+(n/2+k)+"px, "+-n/2/P+"px) rotateX(-90deg)")}var $=I.isSafari||I.isUiWebView?-l/2:0;i.transform("translate3d(0px,0,"+$+"px) rotateX("+(t.isHorizontal()?0:u)+"deg) rotateY("+(t.isHorizontal()?-u:0)+"deg)")},setTransition:function(e){var t=this.$el;this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),this.params.cubeEffect.shadow&&!this.isHorizontal()&&t.find(".swiper-cube-shadow").transition(e)}},K={setTranslate:function(){for(var e=this,t=e.slides,a=e.rtlTranslate,i=0;i<t.length;i+=1){var s=t.eq(i),r=s[0].progress;e.params.flipEffect.limitRotation&&(r=Math.max(Math.min(s[0].progress,1),-1));var n=-180*r,o=0,l=-s[0].swiperSlideOffset,d=0;if(e.isHorizontal()?a&&(n=-n):(d=l,o=-n,n=l=0),s[0].style.zIndex=-Math.abs(Math.round(r))+t.length,e.params.flipEffect.slideShadows){var p=e.isHorizontal()?s.find(".swiper-slide-shadow-left"):s.find(".swiper-slide-shadow-top"),c=e.isHorizontal()?s.find(".swiper-slide-shadow-right"):s.find(".swiper-slide-shadow-bottom");0===p.length&&(p=L('<div class="swiper-slide-shadow-'+(e.isHorizontal()?"left":"top")+'"></div>'),s.append(p)),0===c.length&&(c=L('<div class="swiper-slide-shadow-'+(e.isHorizontal()?"right":"bottom")+'"></div>'),s.append(c)),p.length&&(p[0].style.opacity=Math.max(-r,0)),c.length&&(c[0].style.opacity=Math.max(r,0))}s.transform("translate3d("+l+"px, "+d+"px, 0px) rotateX("+o+"deg) rotateY("+n+"deg)")}},setTransition:function(e){var a=this,t=a.slides,i=a.activeIndex,s=a.$wrapperEl;if(t.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),a.params.virtualTranslate&&0!==e){var r=!1;t.eq(i).transitionEnd(function(){if(!r&&a&&!a.destroyed){r=!0,a.animating=!1;for(var e=["webkitTransitionEnd","transitionend"],t=0;t<e.length;t+=1)s.trigger(e[t])}})}}},_={setTranslate:function(){for(var e=this,t=e.width,a=e.height,i=e.slides,s=e.$wrapperEl,r=e.slidesSizesGrid,n=e.params.coverflowEffect,o=e.isHorizontal(),l=e.translate,d=o?t/2-l:a/2-l,p=o?n.rotate:-n.rotate,c=n.depth,u=0,h=i.length;u<h;u+=1){var v=i.eq(u),f=r[u],m=(d-v[0].swiperSlideOffset-f/2)/f*n.modifier,g=o?p*m:0,b=o?0:p*m,w=-c*Math.abs(m),y=o?0:n.stretch*m,x=o?n.stretch*m:0;Math.abs(x)<.001&&(x=0),Math.abs(y)<.001&&(y=0),Math.abs(w)<.001&&(w=0),Math.abs(g)<.001&&(g=0),Math.abs(b)<.001&&(b=0);var T="translate3d("+x+"px,"+y+"px,"+w+"px) rotateX("+b+"deg) rotateY("+g+"deg)";if(v.transform(T),v[0].style.zIndex=1-Math.abs(Math.round(m)),n.slideShadows){var E=o?v.find(".swiper-slide-shadow-left"):v.find(".swiper-slide-shadow-top"),S=o?v.find(".swiper-slide-shadow-right"):v.find(".swiper-slide-shadow-bottom");0===E.length&&(E=L('<div class="swiper-slide-shadow-'+(o?"left":"top")+'"></div>'),v.append(E)),0===S.length&&(S=L('<div class="swiper-slide-shadow-'+(o?"right":"bottom")+'"></div>'),v.append(S)),E.length&&(E[0].style.opacity=0<m?m:0),S.length&&(S[0].style.opacity=0<-m?-m:0)}}(te.pointerEvents||te.prefixedPointerEvents)&&(s[0].style.perspectiveOrigin=d+"px 50%")},setTransition:function(e){this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}},Z={init:function(){var e=this,t=e.params.thumbs,a=e.constructor;t.swiper instanceof a?(e.thumbs.swiper=t.swiper,ee.extend(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),ee.extend(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1})):ee.isObject(t.swiper)&&(e.thumbs.swiper=new a(ee.extend({},t.swiper,{watchSlidesVisibility:!0,watchSlidesProgress:!0,slideToClickedSlide:!1})),e.thumbs.swiperCreated=!0),e.thumbs.swiper.$el.addClass(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",e.thumbs.onThumbClick)},onThumbClick:function(){var e=this,t=e.thumbs.swiper;if(t){var a=t.clickedIndex,i=t.clickedSlide;if(!(i&&L(i).hasClass(e.params.thumbs.slideThumbActiveClass)||null==a)){var s;if(s=t.params.loop?parseInt(L(t.clickedSlide).attr("data-swiper-slide-index"),10):a,e.params.loop){var r=e.activeIndex;e.slides.eq(r).hasClass(e.params.slideDuplicateClass)&&(e.loopFix(),e._clientLeft=e.$wrapperEl[0].clientLeft,r=e.activeIndex);var n=e.slides.eq(r).prevAll('[data-swiper-slide-index="'+s+'"]').eq(0).index(),o=e.slides.eq(r).nextAll('[data-swiper-slide-index="'+s+'"]').eq(0).index();s=void 0===n?o:void 0===o?n:o-r<r-n?o:n}e.slideTo(s)}}},update:function(e){var t=this,a=t.thumbs.swiper;if(a){var i="auto"===a.params.slidesPerView?a.slidesPerViewDynamic():a.params.slidesPerView;if(t.realIndex!==a.realIndex){var s,r=a.activeIndex;if(a.params.loop){a.slides.eq(r).hasClass(a.params.slideDuplicateClass)&&(a.loopFix(),a._clientLeft=a.$wrapperEl[0].clientLeft,r=a.activeIndex);var n=a.slides.eq(r).prevAll('[data-swiper-slide-index="'+t.realIndex+'"]').eq(0).index(),o=a.slides.eq(r).nextAll('[data-swiper-slide-index="'+t.realIndex+'"]').eq(0).index();s=void 0===n?o:void 0===o?n:o-r==r-n?r:o-r<r-n?o:n}else s=t.realIndex;a.visibleSlidesIndexes.indexOf(s)<0&&(a.params.centeredSlides?s=r<s?s-Math.floor(i/2)+1:s+Math.floor(i/2)-1:r<s&&(s=s-i+1),a.slideTo(s,e?0:void 0))}var l=1,d=t.params.thumbs.slideThumbActiveClass;if(1<t.params.slidesPerView&&!t.params.centeredSlides&&(l=t.params.slidesPerView),a.slides.removeClass(d),a.params.loop)for(var p=0;p<l;p+=1)a.$wrapperEl.children('[data-swiper-slide-index="'+(t.realIndex+p)+'"]').addClass(d);else for(var c=0;c<l;c+=1)a.slides.eq(t.realIndex+c).addClass(d)}}},Q=[E,S,C,M,P,$,O,{name:"mousewheel",params:{mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarged:"container"}},create:function(){var e=this;ee.extend(e,{mousewheel:{enabled:!1,enable:A.enable.bind(e),disable:A.disable.bind(e),handle:A.handle.bind(e),handleMouseEnter:A.handleMouseEnter.bind(e),handleMouseLeave:A.handleMouseLeave.bind(e),lastScrollTime:ee.now()}})},on:{init:function(){this.params.mousewheel.enabled&&this.mousewheel.enable()},destroy:function(){this.mousewheel.enabled&&this.mousewheel.disable()}}},{name:"navigation",params:{navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock"}},create:function(){var e=this;ee.extend(e,{navigation:{init:H.init.bind(e),update:H.update.bind(e),destroy:H.destroy.bind(e),onNextClick:H.onNextClick.bind(e),onPrevClick:H.onPrevClick.bind(e)}})},on:{init:function(){this.navigation.init(),this.navigation.update()},toEdge:function(){this.navigation.update()},fromEdge:function(){this.navigation.update()},destroy:function(){this.navigation.destroy()},click:function(e){var t,a=this,i=a.navigation,s=i.$nextEl,r=i.$prevEl;!a.params.navigation.hideOnClick||L(e.target).is(r)||L(e.target).is(s)||(s?t=s.hasClass(a.params.navigation.hiddenClass):r&&(t=r.hasClass(a.params.navigation.hiddenClass)),!0===t?a.emit("navigationShow",a):a.emit("navigationHide",a),s&&s.toggleClass(a.params.navigation.hiddenClass),r&&r.toggleClass(a.params.navigation.hiddenClass))}}},{name:"pagination",params:{pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:function(e){return e},formatFractionTotal:function(e){return e},bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",modifierClass:"swiper-pagination-",currentClass:"swiper-pagination-current",totalClass:"swiper-pagination-total",hiddenClass:"swiper-pagination-hidden",progressbarFillClass:"swiper-pagination-progressbar-fill",progressbarOppositeClass:"swiper-pagination-progressbar-opposite",clickableClass:"swiper-pagination-clickable",lockClass:"swiper-pagination-lock"}},create:function(){var e=this;ee.extend(e,{pagination:{init:N.init.bind(e),render:N.render.bind(e),update:N.update.bind(e),destroy:N.destroy.bind(e),dynamicBulletIndex:0}})},on:{init:function(){this.pagination.init(),this.pagination.render(),this.pagination.update()},activeIndexChange:function(){this.params.loop?this.pagination.update():void 0===this.snapIndex&&this.pagination.update()},snapIndexChange:function(){this.params.loop||this.pagination.update()},slidesLengthChange:function(){this.params.loop&&(this.pagination.render(),this.pagination.update())},snapGridLengthChange:function(){this.params.loop||(this.pagination.render(),this.pagination.update())},destroy:function(){this.pagination.destroy()},click:function(e){var t=this;t.params.pagination.el&&t.params.pagination.hideOnClick&&0<t.pagination.$el.length&&!L(e.target).hasClass(t.params.pagination.bulletClass)&&(!0===t.pagination.$el.hasClass(t.params.pagination.hiddenClass)?t.emit("paginationShow",t):t.emit("paginationHide",t),t.pagination.$el.toggleClass(t.params.pagination.hiddenClass))}}},{name:"scrollbar",params:{scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag"}},create:function(){var e=this;ee.extend(e,{scrollbar:{init:G.init.bind(e),destroy:G.destroy.bind(e),updateSize:G.updateSize.bind(e),setTranslate:G.setTranslate.bind(e),setTransition:G.setTransition.bind(e),enableDraggable:G.enableDraggable.bind(e),disableDraggable:G.disableDraggable.bind(e),setDragPosition:G.setDragPosition.bind(e),onDragStart:G.onDragStart.bind(e),onDragMove:G.onDragMove.bind(e),onDragEnd:G.onDragEnd.bind(e),isTouched:!1,timeout:null,dragTimeout:null}})},on:{init:function(){this.scrollbar.init(),this.scrollbar.updateSize(),this.scrollbar.setTranslate()},update:function(){this.scrollbar.updateSize()},resize:function(){this.scrollbar.updateSize()},observerUpdate:function(){this.scrollbar.updateSize()},setTranslate:function(){this.scrollbar.setTranslate()},setTransition:function(e){this.scrollbar.setTransition(e)},destroy:function(){this.scrollbar.destroy()}}},{name:"parallax",params:{parallax:{enabled:!1}},create:function(){ee.extend(this,{parallax:{setTransform:B.setTransform.bind(this),setTranslate:B.setTranslate.bind(this),setTransition:B.setTransition.bind(this)}})},on:{beforeInit:function(){this.params.parallax.enabled&&(this.params.watchSlidesProgress=!0,this.originalParams.watchSlidesProgress=!0)},init:function(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTranslate:function(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTransition:function(e){this.params.parallax.enabled&&this.parallax.setTransition(e)}}},{name:"zoom",params:{zoom:{enabled:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}},create:function(){var i=this,t={enabled:!1,scale:1,currentScale:1,isScaling:!1,gesture:{$slideEl:void 0,slideWidth:void 0,slideHeight:void 0,$imageEl:void 0,$imageWrapEl:void 0,maxRatio:3},image:{isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},velocity:{x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0}};"onGestureStart onGestureChange onGestureEnd onTouchStart onTouchMove onTouchEnd onTransitionEnd toggle enable disable in out".split(" ").forEach(function(e){t[e]=X[e].bind(i)}),ee.extend(i,{zoom:t});var s=1;Object.defineProperty(i.zoom,"scale",{get:function(){return s},set:function(e){if(s!==e){var t=i.zoom.gesture.$imageEl?i.zoom.gesture.$imageEl[0]:void 0,a=i.zoom.gesture.$slideEl?i.zoom.gesture.$slideEl[0]:void 0;i.emit("zoomChange",e,t,a)}s=e}})},on:{init:function(){this.params.zoom.enabled&&this.zoom.enable()},destroy:function(){this.zoom.disable()},touchStart:function(e){this.zoom.enabled&&this.zoom.onTouchStart(e)},touchEnd:function(e){this.zoom.enabled&&this.zoom.onTouchEnd(e)},doubleTap:function(e){this.params.zoom.enabled&&this.zoom.enabled&&this.params.zoom.toggle&&this.zoom.toggle(e)},transitionEnd:function(){this.zoom.enabled&&this.params.zoom.enabled&&this.zoom.onTransitionEnd()}}},{name:"lazy",params:{lazy:{enabled:!1,loadPrevNext:!1,loadPrevNextAmount:1,loadOnTransitionStart:!1,elementClass:"swiper-lazy",loadingClass:"swiper-lazy-loading",loadedClass:"swiper-lazy-loaded",preloaderClass:"swiper-lazy-preloader"}},create:function(){ee.extend(this,{lazy:{initialImageLoaded:!1,load:Y.load.bind(this),loadInSlide:Y.loadInSlide.bind(this)}})},on:{beforeInit:function(){this.params.lazy.enabled&&this.params.preloadImages&&(this.params.preloadImages=!1)},init:function(){this.params.lazy.enabled&&!this.params.loop&&0===this.params.initialSlide&&this.lazy.load()},scroll:function(){this.params.freeMode&&!this.params.freeModeSticky&&this.lazy.load()},resize:function(){this.params.lazy.enabled&&this.lazy.load()},scrollbarDragMove:function(){this.params.lazy.enabled&&this.lazy.load()},transitionStart:function(){var e=this;e.params.lazy.enabled&&(e.params.lazy.loadOnTransitionStart||!e.params.lazy.loadOnTransitionStart&&!e.lazy.initialImageLoaded)&&e.lazy.load()},transitionEnd:function(){this.params.lazy.enabled&&!this.params.lazy.loadOnTransitionStart&&this.lazy.load()}}},{name:"controller",params:{controller:{control:void 0,inverse:!1,by:"slide"}},create:function(){var e=this;ee.extend(e,{controller:{control:e.params.controller.control,getInterpolateFunction:V.getInterpolateFunction.bind(e),setTranslate:V.setTranslate.bind(e),setTransition:V.setTransition.bind(e)}})},on:{update:function(){this.controller.control&&this.controller.spline&&(this.controller.spline=void 0,delete this.controller.spline)},resize:function(){this.controller.control&&this.controller.spline&&(this.controller.spline=void 0,delete this.controller.spline)},observerUpdate:function(){this.controller.control&&this.controller.spline&&(this.controller.spline=void 0,delete this.controller.spline)},setTranslate:function(e,t){this.controller.control&&this.controller.setTranslate(e,t)},setTransition:function(e,t){this.controller.control&&this.controller.setTransition(e,t)}}},{name:"a11y",params:{a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}"}},create:function(){var t=this;ee.extend(t,{a11y:{liveRegion:L('<span class="'+t.params.a11y.notificationClass+'" aria-live="assertive" aria-atomic="true"></span>')}}),Object.keys(F).forEach(function(e){t.a11y[e]=F[e].bind(t)})},on:{init:function(){this.params.a11y.enabled&&(this.a11y.init(),this.a11y.updateNavigation())},toEdge:function(){this.params.a11y.enabled&&this.a11y.updateNavigation()},fromEdge:function(){this.params.a11y.enabled&&this.a11y.updateNavigation()},paginationUpdate:function(){this.params.a11y.enabled&&this.a11y.updatePagination()},destroy:function(){this.params.a11y.enabled&&this.a11y.destroy()}}},{name:"history",params:{history:{enabled:!1,replaceState:!1,key:"slides"}},create:function(){var e=this;ee.extend(e,{history:{init:R.init.bind(e),setHistory:R.setHistory.bind(e),setHistoryPopState:R.setHistoryPopState.bind(e),scrollToSlide:R.scrollToSlide.bind(e),destroy:R.destroy.bind(e)}})},on:{init:function(){this.params.history.enabled&&this.history.init()},destroy:function(){this.params.history.enabled&&this.history.destroy()},transitionEnd:function(){this.history.initialized&&this.history.setHistory(this.params.history.key,this.activeIndex)}}},{name:"hash-navigation",params:{hashNavigation:{enabled:!1,replaceState:!1,watchState:!1}},create:function(){var e=this;ee.extend(e,{hashNavigation:{initialized:!1,init:q.init.bind(e),destroy:q.destroy.bind(e),setHash:q.setHash.bind(e),onHashCange:q.onHashCange.bind(e)}})},on:{init:function(){this.params.hashNavigation.enabled&&this.hashNavigation.init()},destroy:function(){this.params.hashNavigation.enabled&&this.hashNavigation.destroy()},transitionEnd:function(){this.hashNavigation.initialized&&this.hashNavigation.setHash()}}},{name:"autoplay",params:{autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!0,stopOnLastSlide:!1,reverseDirection:!1}},create:function(){var t=this;ee.extend(t,{autoplay:{running:!1,paused:!1,run:W.run.bind(t),start:W.start.bind(t),stop:W.stop.bind(t),pause:W.pause.bind(t),onTransitionEnd:function(e){t&&!t.destroyed&&t.$wrapperEl&&e.target===this&&(t.$wrapperEl[0].removeEventListener("transitionend",t.autoplay.onTransitionEnd),t.$wrapperEl[0].removeEventListener("webkitTransitionEnd",t.autoplay.onTransitionEnd),t.autoplay.paused=!1,t.autoplay.running?t.autoplay.run():t.autoplay.stop())}}})},on:{init:function(){this.params.autoplay.enabled&&this.autoplay.start()},beforeTransitionStart:function(e,t){this.autoplay.running&&(t||!this.params.autoplay.disableOnInteraction?this.autoplay.pause(e):this.autoplay.stop())},sliderFirstMove:function(){this.autoplay.running&&(this.params.autoplay.disableOnInteraction?this.autoplay.stop():this.autoplay.pause())},destroy:function(){this.autoplay.running&&this.autoplay.stop()}}},{name:"effect-fade",params:{fadeEffect:{crossFade:!1}},create:function(){ee.extend(this,{fadeEffect:{setTranslate:j.setTranslate.bind(this),setTransition:j.setTransition.bind(this)}})},on:{beforeInit:function(){var e=this;if("fade"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"fade");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};ee.extend(e.params,t),ee.extend(e.originalParams,t)}},setTranslate:function(){"fade"===this.params.effect&&this.fadeEffect.setTranslate()},setTransition:function(e){"fade"===this.params.effect&&this.fadeEffect.setTransition(e)}}},{name:"effect-cube",params:{cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}},create:function(){ee.extend(this,{cubeEffect:{setTranslate:U.setTranslate.bind(this),setTransition:U.setTransition.bind(this)}})},on:{beforeInit:function(){var e=this;if("cube"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"cube"),e.classNames.push(e.params.containerModifierClass+"3d");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0};ee.extend(e.params,t),ee.extend(e.originalParams,t)}},setTranslate:function(){"cube"===this.params.effect&&this.cubeEffect.setTranslate()},setTransition:function(e){"cube"===this.params.effect&&this.cubeEffect.setTransition(e)}}},{name:"effect-flip",params:{flipEffect:{slideShadows:!0,limitRotation:!0}},create:function(){ee.extend(this,{flipEffect:{setTranslate:K.setTranslate.bind(this),setTransition:K.setTransition.bind(this)}})},on:{beforeInit:function(){var e=this;if("flip"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"flip"),e.classNames.push(e.params.containerModifierClass+"3d");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};ee.extend(e.params,t),ee.extend(e.originalParams,t)}},setTranslate:function(){"flip"===this.params.effect&&this.flipEffect.setTranslate()},setTransition:function(e){"flip"===this.params.effect&&this.flipEffect.setTransition(e)}}},{name:"effect-coverflow",params:{coverflowEffect:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0}},create:function(){ee.extend(this,{coverflowEffect:{setTranslate:_.setTranslate.bind(this),setTransition:_.setTransition.bind(this)}})},on:{beforeInit:function(){var e=this;"coverflow"===e.params.effect&&(e.classNames.push(e.params.containerModifierClass+"coverflow"),e.classNames.push(e.params.containerModifierClass+"3d"),e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0)},setTranslate:function(){"coverflow"===this.params.effect&&this.coverflowEffect.setTranslate()},setTransition:function(e){"coverflow"===this.params.effect&&this.coverflowEffect.setTransition(e)}}},{name:"thumbs",params:{thumbs:{swiper:null,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-container-thumbs"}},create:function(){ee.extend(this,{thumbs:{swiper:null,init:Z.init.bind(this),update:Z.update.bind(this),onThumbClick:Z.onThumbClick.bind(this)}})},on:{beforeInit:function(){var e=this.params.thumbs;e&&e.swiper&&(this.thumbs.init(),this.thumbs.update(!0))},slideChange:function(){this.thumbs.swiper&&this.thumbs.update()},update:function(){this.thumbs.swiper&&this.thumbs.update()},resize:function(){this.thumbs.swiper&&this.thumbs.update()},observerUpdate:function(){this.thumbs.swiper&&this.thumbs.update()},setTransition:function(e){var t=this.thumbs.swiper;t&&t.setTransition(e)},beforeDestroy:function(){var e=this.thumbs.swiper;e&&this.thumbs.swiperCreated&&e&&e.destroy()}}}];return void 0===T.use&&(T.use=T.Class.use,T.installModule=T.Class.installModule),T.use(Q),T});
|
||
//# sourceMappingURL=swiper.min.js.map
|
||
|
||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("swiper/dist/js/swiper.js")):"function"==typeof define&&define.amd?define("VueAwesomeSwiper",["swiper"],t):"object"==typeof exports?exports.VueAwesomeSwiper=t(require("swiper/dist/js/swiper.js")):e.VueAwesomeSwiper=t(e.Swiper)}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=4)}([function(t,n){t.exports=e},function(e,t){e.exports=function(e,t,n,i,s,r){var o,a=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(o=e,a=e.default);var p="function"==typeof a?a.options:a;t&&(p.render=t.render,p.staticRenderFns=t.staticRenderFns,p._compiled=!0),n&&(p.functional=!0),s&&(p._scopeId=s);var l;if(r?(l=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},p._ssrRegister=l):i&&(l=i),l){var c=p.functional,d=c?p.render:p.beforeCreate;c?(p._injectStyles=l,p.render=function(e,t){return l.call(t),d(e,t)}):p.beforeCreate=d?[].concat(d,l):[l]}return{esModule:o,exports:a,options:p}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),s=n.n(i),r=n(8),o=n(1),a=o(s.a,r.a,!1,null,null,null);t.default=a.exports},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),s=n.n(i),r=n(7),o=n(1),a=o(s.a,r.a,!1,null,null,null);t.default=a.exports},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.install=t.swiperSlide=t.swiper=t.Swiper=void 0;var s=n(0),r=i(s),o=n(2),a=i(o),u=n(3),p=i(u),l=window.Swiper||r.default,c=p.default,d=a.default,f=function(e,t){t&&(p.default.props.globalOptions.default=function(){return t}),e.component(p.default.name,p.default),e.component(a.default.name,a.default)},h={Swiper:l,swiper:c,swiperSlide:d,install:f};t.default=h,t.Swiper=l,t.swiper=c,t.swiperSlide=d,t.install=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"swiper-slide",data:function(){return{slideClass:"swiper-slide"}},ready:function(){this.update()},mounted:function(){this.update(),this.$parent&&this.$parent.options&&this.$parent.options.slideClass&&(this.slideClass=this.$parent.options.slideClass)},updated:function(){this.update()},attached:function(){this.update()},methods:{update:function(){this.$parent&&this.$parent.swiper&&this.$parent.update()}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(i),r=window.Swiper||s.default;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[r]=s[r])}return n},writable:!0,configurable:!0});var o=["beforeDestroy","slideChange","slideChangeTransitionStart","slideChangeTransitionEnd","slideNextTransitionStart","slideNextTransitionEnd","slidePrevTransitionStart","slidePrevTransitionEnd","transitionStart","transitionEnd","touchStart","touchMove","touchMoveOpposite","sliderMove","touchEnd","click","tap","doubleTap","imagesReady","progress","reachBeginning","reachEnd","fromEdge","setTranslate","setTransition","resize"];t.default={name:"swiper",props:{options:{type:Object,default:function(){return{}}},globalOptions:{type:Object,required:!1,default:function(){return{}}}},data:function(){return{swiper:null,classes:{wrapperClass:"swiper-wrapper"}}},ready:function(){this.swiper||this.mountInstance()},mounted:function(){if(!this.swiper){var e=!1;for(var t in this.classes)this.classes.hasOwnProperty(t)&&this.options[t]&&(e=!0,this.classes[t]=this.options[t]);e?this.$nextTick(this.mountInstance):this.mountInstance()}},activated:function(){this.update()},updated:function(){this.update()},beforeDestroy:function(){this.$nextTick(function(){this.swiper&&(this.swiper.destroy&&this.swiper.destroy(),delete this.swiper)})},methods:{update:function(){this.swiper&&(this.swiper.update&&this.swiper.update(),this.swiper.navigation&&this.swiper.navigation.update(),this.swiper.pagination&&this.swiper.pagination.render(),this.swiper.pagination&&this.swiper.pagination.update())},mountInstance:function(){var e=Object.assign({},this.globalOptions,this.options);this.swiper=new r(this.$el,e),this.bindEvents(),this.$emit("ready",this.swiper)},bindEvents:function(){var e=this,t=this;o.forEach(function(n){e.swiper.on(n,function(){t.$emit.apply(t,[n].concat(Array.prototype.slice.call(arguments))),t.$emit.apply(t,[n.replace(/([A-Z])/g,"-$1").toLowerCase()].concat(Array.prototype.slice.call(arguments)))})})}}}},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"swiper-container"},[e._t("parallax-bg"),e._v(" "),n("div",{class:e.classes.wrapperClass},[e._t("default")],2),e._v(" "),e._t("pagination"),e._v(" "),e._t("button-prev"),e._v(" "),e._t("button-next"),e._v(" "),e._t("scrollbar")],2)},s=[],r={render:i,staticRenderFns:s};t.a=r},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{class:e.slideClass},[e._t("default")],2)},s=[],r={render:i,staticRenderFns:s};t.a=r}])});
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VueRecaptcha=t()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var t,i=(t=function(){var e=!1,t=[];return{resolved:function(){return e},resolve:function(i){if(!e){e=!0;for(var n=0,r=t.length;n<r;n++)t[n](i)}},promise:{then:function(i){e?i():t.push(i)}}}}(),{notify:function(){t.resolve()},wait:function(){return t.promise},render:function(e,t,i){this.wait().then(function(){i(window.grecaptcha.render(e,t))})},reset:function(e){void 0!==e&&(this.assertLoaded(),this.wait().then(function(){return window.grecaptcha.reset(e)}))},execute:function(e){void 0!==e&&(this.assertLoaded(),this.wait().then(function(){return window.grecaptcha.execute(e)}))},checkRecaptchaLoad:function(){window.hasOwnProperty("grecaptcha")&&window.grecaptcha.hasOwnProperty("render")&&this.notify()},assertLoaded:function(){if(!t.resolved())throw new Error("ReCAPTCHA has not been loaded")}});return"undefined"!=typeof window&&(window.vueRecaptchaApiLoaded=i.notify),{name:"VueRecaptcha",props:{sitekey:{type:String,required:!0},theme:{type:String},badge:{type:String},type:{type:String},size:{type:String},tabindex:{type:String},loadRecaptchaScript:{type:Boolean,default:!1},recaptchaScriptId:{type:String,default:"__RECAPTCHA_SCRIPT"},recaptchaHost:{type:String,default:"www.google.com"}},beforeMount:function(){if(this.loadRecaptchaScript&&!document.getElementById(this.recaptchaScriptId)){var e=document.createElement("script");e.id=this.recaptchaScriptId,e.src="https://"+this.recaptchaHost+"/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit",e.async=!0,e.defer=!0,document.head.appendChild(e)}},mounted:function(){var t=this;i.checkRecaptchaLoad();var n=e({},this.$props,{callback:this.emitVerify,"expired-callback":this.emitExpired}),r=this.$slots.default?this.$el.children[0]:this.$el;i.render(r,n,function(e){t.$widgetId=e,t.$emit("render",e)})},methods:{reset:function(){i.reset(this.$widgetId)},execute:function(){i.execute(this.$widgetId)},emitVerify:function(e){this.$emit("verify",e)},emitExpired:function(){this.$emit("expired")}},render:function(e){return e("div",{},this.$slots.default)}}});
|
||
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Tt(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function v(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function p(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function k(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function S(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=S(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&D(e[s])!==D(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function b(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function C(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,s={};for(n in e)m(e,n)&&(t=H(n))&&(s[t]=e[n]);return s}var U={};function F(e,t){U[e]=t}function L(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=b(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=b(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var de={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=D(e)}),t=0;t<e.length;t++)de[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,ve=4,pe=5,we=6,Me=7,ke=8;function Se(e){return De(e)?366:365}function De(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),C("year","y"),F("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):D(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return D(e)+(68<D(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(xe(this,t,e),c.updateOffset(this,n),this):be(this,t)}}function be(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function xe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&De(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?De(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),C("month","M"),F("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=D(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var He="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Re(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=D(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Re(this,e),c.updateOffset(this,!0),this):be(this,"Month")}var Fe=ae;var Le=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t;if(e<100&&0<=e){var n=Array.prototype.slice.call(arguments);n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)}else t=new Date(Date.UTC.apply(null,arguments));return t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return a=o<=0?Se(r=e-1)+o:o>Se(e)?(r=e+1,o-Se(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(Se(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),C("week","w"),C("isoWeek","W"),F("week",5),F("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function je(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),C("day","d"),C("weekday","e"),C("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=D(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var $e="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ae;var Je=ae;var Be=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Xe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Xe.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+L(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),C("hour","h"),F("hour",13),ue("a",et),ue("A",et),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=D(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=D(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=D(e.substr(0,s)),t[ve]=D(e.substr(s,2)),t[pe]=D(e.substr(i))});var tt,nt=Te("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:He,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){var t=null;if(!it[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=tt._abbr,require("./locale/"+e),ut(t)}catch(e){}return it[e]}function ut(e,t){var n;return e&&((n=l(t)?ht(e):lt(e,t))?tt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tt._abbr}function lt(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ot(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new P(x(s,t)),rt[e]&&rt[e].forEach(function(e){lt(e.name,e.config)}),ut(e),it[e]}function ht(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tt;if(!o(e)){if(t=ot(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ot(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return tt}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[ve]||0!==n[pe]||0!==n[we])?ge:n[ve]<0||59<n[ve]?ve:n[pe]<0||59<n[pe]?pe:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=ke),g(e).overflow=t),e}function ct(e,t,n){return null!=e?e:null!=t?t:n}function ft(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ct(t.GG,e._a[me],Ie(bt(),1,4).year),s=ct(t.W,1),((i=ct(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(bt(),r,a);n=ct(t.gg,e._a[me],l.year),s=ct(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ct(e._a[me],s[me]),(e._dayOfYear>Se(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[ve]&&0===e._a[pe]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/Z|[+-]\d\d(?::?\d\d)?/,gt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,s,i,r,a,o=e._i,u=mt.exec(o)||_t.exec(o);if(u){for(g(e).iso=!0,t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[1])){i=gt[t][0],s=!1!==gt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=vt.length;t<n;t++)if(vt[t][1].exec(u[3])){r=(u[2]||" ")+vt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!yt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Yt(e)}else e._isValid=!1}var Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function kt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),He.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=Mt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=kt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Yt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,h=l.length,d=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),d+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(de,a)&&de[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=h-d,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ft(e),dt(e)}else Dt(e);else wt(e)}function Ot(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||ht(e._l),null===r||void 0===a&&""===r?p({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r)?new M(dt(r)):(d(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Yt(t),v(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?Yt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):d(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(wt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ft(t)):u(n)?function(e){if(!e._d){var t=R(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ft(e)}}(t):h(n)?t._d=new Date(n):c.createFromInputFallback(t),v(e)||(e._d=null),e))}function Tt(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Ot(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function bt(e,t,n,s){return Tt(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:p()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=bt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:p()});function Wt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return bt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Ct=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=R(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Ct,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Ct.length;++s)if(e[Ct[s]]){if(n)return!1;parseFloat(e[Ct[s]])!==D(e[Ct[s]])&&(n=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ht(),this._bubble()}function Rt(e){return e instanceof Ht}function Ut(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+L(~~(e/60),2)+n+L(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Nt(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Nt(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+D(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(k(e)||d(e)?e.valueOf():bt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):bt(e).local()}function Vt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Et(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var It=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,At=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:D(a[ye])*n,h:D(a[ge])*n,m:D(a[ve])*n,s:D(a[pe])*n,ms:D(Ut(1e3*a[we]))*n}):(a=At.exec(e))?(n="-"===a[1]?-1:1,r={y:Zt(a[2],n),M:Zt(a[3],n),w:Zt(a[4],n),d:Zt(a[5],n),h:Zt(a[6],n),m:Zt(a[7],n),s:Zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(bt(r.from),bt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function Zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,jt(e="string"==typeof e?+e:e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ut(t._days),a=Ut(t._months);e.isValid()&&(s=null==s||s,a&&Re(e,be(e,"Month")+a*n),r&&xe(e,"Date",be(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}jt.fn=Ht.prototype,jt.invalid=function(){return jt(NaN)};var Jt=$t(1,"add"),Bt=$t(-1,"subtract");function Qt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Xt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=ht(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Kt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function en(){return this._locale}var tn=126227808e5;function nn(e,t){return(e%t+t)%t}function sn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-tn:new Date(e,t,n).valueOf()}function rn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-tn:Date.UTC(e,t,n)}function an(e,t){I(0,[e,e.length],0,t)}function on(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),an("gggg","weekYear"),an("ggggg","weekYear"),an("GGGG","isoWeekYear"),an("GGGGG","isoWeekYear"),C("weekYear","gg"),C("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),C("quarter","Q"),F("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(D(e)-1)}),I("D",["DD",2],"Do","date"),C("date","D"),F("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=D(e.match(B)[0])});var un=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),C("dayOfYear","DDD"),F("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)}),I("m",["mm",2],0,"minute"),C("minute","m"),F("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],ve);var ln=Te("Minutes",!1);I("s",["ss",2],0,"second"),C("second","s"),F("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],pe);var hn,dn=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),C("millisecond","ms"),F("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),hn="SSSS";hn.length<=9;hn+="S")ue(hn,ne);function cn(e,t){t[we]=D(1e3*("0."+e))}for(hn="S";hn.length<=9;hn+="S")ce(hn,cn);var fn=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var mn=M.prototype;function _n(e){return e}mn.add=Jt,mn.calendar=function(e,t){var n=e||bt(),s=Gt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(b(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,bt(n)))},mn.clone=function(){return new M(this)},mn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:S(r)},mn.endOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-nn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-nn(t,1e3)-1;break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},mn.from=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.fromNow=function(e){return this.from(bt(),e)},mn.to=function(e,t){return this.isValid()&&(k(e)&&e.isValid()||bt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},mn.toNow=function(e){return this.to(bt(),e)},mn.get=function(e){return b(this[e=H(e)])?this[e]():this},mn.invalidAt=function(){return g(this).overflow},mn.isAfter=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},mn.isBefore=function(e,t){var n=k(e)?e:bt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},mn.isBetween=function(e,t,n,s){var i=k(e)?e:bt(e),r=k(t)?t:bt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n))},mn.isSame=function(e,t){var n,s=k(e)?e:bt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=H(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},mn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},mn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},mn.isValid=function(){return v(this)},mn.lang=Kt,mn.locale=Xt,mn.localeData=en,mn.max=Pt,mn.min=xt,mn.parsingFlags=function(){return _({},g(this))},mn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:U[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=R(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(b(this[e=H(e)]))return this[e](t);return this},mn.startOf=function(e){var t;if(void 0===(e=H(e))||"millisecond"===e||!this.isValid())return this;var n=this._isUTC?rn:sn;switch(e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=nn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=nn(t,6e4);break;case"second":t=this._d.valueOf(),t-=nn(t,1e3);break}return this._d.setTime(t),c.updateOffset(this,!0),this},mn.subtract=Bt,mn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},mn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},mn.toDate=function(){return new Date(this.valueOf())},mn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):b(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.year=Oe,mn.isLeapYear=function(){return De(this.year())},mn.weekYear=function(e){return on.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},mn.isoWeekYear=function(e){return on.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},mn.quarter=mn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},mn.month=Ue,mn.daysInMonth=function(){return Pe(this.year(),this.month())},mn.week=mn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},mn.isoWeek=mn.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},mn.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},mn.isoWeeksInYear=function(){return Ae(this.year(),1,4)},mn.date=un,mn.day=mn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},mn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},mn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},mn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},mn.hour=mn.hours=nt,mn.minute=mn.minutes=ln,mn.second=mn.seconds=dn,mn.millisecond=mn.milliseconds=fn,mn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Vt(this);if("string"==typeof e){if(null===(e=Nt(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Vt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,jt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this},mn.utc=function(e){return this.utcOffset(0,e)},mn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Vt(this),"m")),this},mn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Nt(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},mn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?bt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},mn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Et,mn.isUTC=Et,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=n("dates accessor is deprecated. Use date instead.",un),mn.months=n("months accessor is deprecated. Use month instead",Ue),mn.years=n("years accessor is deprecated. Use year instead",Oe),mn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),mn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Ot(e))._a){var t=e._isUTC?y(e._a):bt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var yn=P.prototype;function gn(e,t,n,s){var i=ht(),r=y().set(s,t);return i[n](r,e)}function vn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return gn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=gn(e,s,n,"month");return i}function pn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=ht(),a=e?r._week.dow:0;if(null!=n)return gn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=gn(t,(i+a)%7,s,"day");return o}yn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return b(s)?s.call(t,n):s},yn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},yn.invalidDate=function(){return this._invalidDate},yn.ordinal=function(e){return this._ordinal.replace("%d",e)},yn.preparse=_n,yn.postformat=_n,yn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return b(i)?i(e,t,n,s):i.replace(/%d/i,e)},yn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return b(n)?n(t):n.replace(/%s/i,t)},yn.set=function(e){var t,n;for(n in e)b(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},yn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},yn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},yn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},yn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},yn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},yn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},yn.firstDayOfYear=function(){return this._week.doy},yn.firstDayOfWeek=function(){return this._week.dow},yn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?je(n,this._week.dow):e?n[e.day()]:n},yn.weekdaysMin=function(e){return!0===e?je(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},yn.weekdaysShort=function(e){return!0===e?je(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},yn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},yn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},yn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},yn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},yn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},yn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ut("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===D(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ut),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ht);var wn=Math.abs;function Mn(e,t,n,s){var i=jt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function kn(e){return e<0?Math.floor(e):Math.ceil(e)}function Sn(e){return 4800*e/146097}function Dn(e){return 146097*e/4800}function Yn(e){return function(){return this.as(e)}}var On=Yn("ms"),Tn=Yn("s"),bn=Yn("m"),xn=Yn("h"),Pn=Yn("d"),Wn=Yn("w"),Cn=Yn("M"),Hn=Yn("Q"),Rn=Yn("y");function Un(e){return function(){return this.isValid()?this._data[e]:NaN}}var Fn=Un("milliseconds"),Ln=Un("seconds"),Nn=Un("minutes"),Gn=Un("hours"),Vn=Un("days"),En=Un("months"),In=Un("years");var An=Math.round,jn={ss:44,s:45,m:45,h:22,d:26,M:11};var Zn=Math.abs;function zn(e){return(0<e)-(e<0)||+e}function $n(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Zn(this._milliseconds)/1e3,s=Zn(this._days),i=Zn(this._months);t=S((e=S(n/60))/60),n%=60,e%=60;var r=S(i/12),a=i%=12,o=s,u=t,l=e,h=n?n.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var c=d<0?"-":"",f=zn(this._months)!==zn(d)?"-":"",m=zn(this._days)!==zn(d)?"-":"",_=zn(this._milliseconds)!==zn(d)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||h?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(h?_+h+"S":"")}var qn=Ht.prototype;return qn.isValid=function(){return this._isValid},qn.abs=function(){var e=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),e.milliseconds=wn(e.milliseconds),e.seconds=wn(e.seconds),e.minutes=wn(e.minutes),e.hours=wn(e.hours),e.months=wn(e.months),e.years=wn(e.years),this},qn.add=function(e,t){return Mn(this,e,t,1)},qn.subtract=function(e,t){return Mn(this,e,t,-1)},qn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=H(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+Sn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Dn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},qn.asMilliseconds=On,qn.asSeconds=Tn,qn.asMinutes=bn,qn.asHours=xn,qn.asDays=Pn,qn.asWeeks=Wn,qn.asMonths=Cn,qn.asQuarters=Hn,qn.asYears=Rn,qn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*D(this._months/12):NaN},qn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*kn(Dn(o)+a),o=a=0),u.milliseconds=r%1e3,e=S(r/1e3),u.seconds=e%60,t=S(e/60),u.minutes=t%60,n=S(t/60),u.hours=n%24,o+=i=S(Sn(a+=S(n/24))),a-=kn(Dn(i)),s=S(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},qn.clone=function(){return jt(this)},qn.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},qn.milliseconds=Fn,qn.seconds=Ln,qn.minutes=Nn,qn.hours=Gn,qn.days=Vn,qn.weeks=function(){return S(this.days()/7)},qn.months=En,qn.years=In,qn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,h,d,c=this.localeData(),f=(n=!e,s=c,i=jt(t=this).abs(),r=An(i.as("s")),a=An(i.as("m")),o=An(i.as("h")),u=An(i.as("d")),l=An(i.as("M")),h=An(i.as("y")),(d=r<=jn.ss&&["s",r]||r<jn.s&&["ss",r]||a<=1&&["m"]||a<jn.m&&["mm",a]||o<=1&&["h"]||o<jn.h&&["hh",o]||u<=1&&["d"]||u<jn.d&&["dd",u]||l<=1&&["M"]||l<jn.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=n,d[3]=0<+t,d[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},qn.toISOString=$n,qn.toString=$n,qn.toJSON=$n,qn.locale=Xt,qn.localeData=en,qn.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$n),qn.lang=Kt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(D(e))}),c.version="2.24.0",e=bt,c.fn=mn,c.min=function(){return Wt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Wt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return bt(1e3*e)},c.months=function(e,t){return vn(e,t,"months")},c.isDate=d,c.locale=ut,c.invalid=p,c.duration=jt,c.isMoment=k,c.weekdays=function(e,t,n){return pn(e,t,n,"weekdays")},c.parseZone=function(){return bt.apply(null,arguments).parseZone()},c.localeData=ht,c.isDuration=Rt,c.monthsShort=function(e,t){return vn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return pn(e,t,n,"weekdaysMin")},c.defineLocale=lt,c.updateLocale=function(e,t){if(null!=t){var n,s,i=st;null!=(s=ot(e))&&(i=s._config),(n=new P(t=x(i,t))).parentLocale=it[e],it[e]=n,ut(e)}else null!=it[e]&&(null!=it[e].parentLocale?it[e]=it[e].parentLocale:null!=it[e]&&delete it[e]);return it[e]},c.locales=function(){return s(it)},c.weekdaysShort=function(e,t,n){return pn(e,t,n,"weekdaysShort")},c.normalizeUnits=H,c.relativeTimeRounding=function(e){return void 0===e?An:"function"==typeof e&&(An=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==jn[e]&&(void 0===t?jn[e]:(jn[e]=t,"s"===e&&(jn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=mn,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},c});
|
||
"use strict";function responseSwiper(){return{init:function(){new Swiper(".swiper-container",{spaceBetween:30,grabCursor:!0,slidesPerView:1,simulateTouch:!0})}}}"use strict",$(function(){$(".fav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/add_like",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(t){t.numberOfLikes=parseInt(t.numberOfLikes)+1,$(e).replaceWith("<button data-csrf=\""+t.csrf_token+"\" data-tugID=\""+t.tugID+"\" data-uID=\""+t.userID+"\" data-user=\""+t.username+"\" data-pUID=\""+t.pUID+"\" data-likes=\""+t.numberOfLikes+"\" data-link=\""+t.link+"\" class=\"unfav-button\"><i class=\"fas fa-heart\"></i> "+t.numberOfLikes+"\n</button>"),unfav()}})}),$(".unfav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/unlike",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(t){t.numberOfLikes=parseInt(t.numberOfLikes)-1,$(e).replaceWith("<button data-csrf=\""+t.csrf_token+"\" data-tugID=\""+t.tugID+"\" data-uID=\""+t.userID+"\" data-user=\""+t.username+"\" data-pUID=\""+t.pUID+"\" data-likes=\""+t.numberOfLikes+"\" data-link=\""+t.link+"\" class=\"fav-button\"><i class=\"fas fa-heart\"></i> "+t.numberOfLikes+"\n</button>"),fav()}})})});function unfav(){$(".unfav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/unlike",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(t){t.numberOfLikes=parseInt(t.numberOfLikes)-1,$(e).replaceWith("<button data-csrf=\""+t.csrf_token+"\" data-tugID=\""+t.tugID+"\" data-uID=\""+t.userID+"\" data-user=\""+t.username+"\" data-pUID=\""+t.pUID+"\" data-likes=\""+t.numberOfLikes+"\" data-link=\""+t.link+"\" class=\"fav-button\"><i class=\"fas fa-heart\"></i> "+t.numberOfLikes+"\n</button>"),fav()}})})}function fav(){$(".fav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/add_like",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(t){t.numberOfLikes=parseInt(t.numberOfLikes)+1,$(e).replaceWith("<button data-csrf=\""+t.csrf_token+"\" data-tugID=\""+t.tugID+"\" data-uID=\""+t.userID+"\" data-user=\""+t.username+"\" data-pUID=\""+t.pUID+"\" data-likes=\""+t.numberOfLikes+"\" data-link=\""+t.link+"\" class=\"unfav-button\"><i class=\"fas fa-heart\"></i> "+t.numberOfLikes+"\n</button>"),unfav()}})})}function updatePosts(){function e(){new Vue({el:"#update-posting",data:{update_title:"",update_desc:"",version:"",update_content:"",csrf:window.csrf},components:{"vue-editor":Vue2Editor.VueEditor},methods:{submitUpdate:function(){var e=this,t=new FormData;t.append("update_title",this.update_title),t.append("update_desc",this.update_desc),t.append("version",this.version),t.append("update_content",this.update_content),t.append("csrf_test_name",this.csrf),axios.post("/about/update/post/add",t)}}})}return{init:function(){e()}}}function tugsPosting(){function e(){$(".changeStatusBtn").on("click",function(){$("#question").css("display","none"),$("#status").css("display","block"),$("#question-button").css("display","block"),$("#status-button").css("display","none")})}function t(){$("#question-button button").click(function(){$("#question").css("display","block"),$("#status").css("display","none"),$("#question-button").css("display","none"),$("#status-button").css("display","block")})}function a(){$("#option3_add input").click(function(){$("#option3").css("display","block"),$("#option3_picture").css("display","block"),$("#option3_add").css("display","none"),$("#option4_add").css("display","block")})}function s(){$("#option4_add input").click(function(){$("#option4").css("display","block"),$("#option4_picture").css("display","block"),$("#option4_add").css("display","none"),$("#option5_add").css("display","block")})}function n(){$("#option5_add input").click(function(){$("#option5").css("display","block"),$("#option5_picture").css("display","block"),$("#option5_add").css("display","none")})}function o(){window.fileAmount=0,$(".file-input-button").on("click",function(t){t.preventDefault(),$(this).siblings("input").click(),$(this).css("display","none"),$(this).siblings(".file-input-button-rm").css("display","block")}),$(".file-input-button-rm").on("click",function(t){t.preventDefault(),window.fileAmount--,$(this).siblings("input").val(""),$("#"+$(this).attr("data-output")).attr("src",""),$(this).css("display","none"),$(this).siblings(".file-input-button").css("display","block");var e="calc(100% / "+window.fileAmount+")";$("#"+$(this).attr("data-id")).css("width",e)}),$("#picture1").on("change",function(){window.fileAmount++,$("#output1").attr("src",window.URL.createObjectURL(this.files[0]));var e="calc(100% / "+window.fileAmount+")";$(".posting-img-output").css("width",e),$("#output1").parent().css("display","block")}),$("#picture2").on("change",function(){window.fileAmount++,$("#output2").attr("src",window.URL.createObjectURL(this.files[0]));var e="calc(100% / "+window.fileAmount+")";$(".posting-img-output").css("width",e),$("#output2").parent().css("display","block")}),$("#picture3").on("change",function(){window.fileAmount++,$("#output3").attr("src",window.URL.createObjectURL(this.files[0]));var e="calc(100% / "+window.fileAmount+")";$(".posting-img-output").css("width",e),$("#output3").css("display","block")}),$("#picture4").on("change",function(){window.fileAmount++,$("#output4").attr("src",window.URL.createObjectURL(this.files[0]));var e="calc(100% / "+window.fileAmount+")";$(".posting-img-output").css("width",e),$("#output4").css("display","block")}),$("#picture5").on("change",function(){window.fileAmount++,$("#output5").attr("src",window.URL.createObjectURL(this.files[0]));var e="calc(100% / "+window.fileAmount+")";$(".posting-img-output").css("width",e),$("#output5").css("display","block")}),$("#statusPicture").on("change",function(){$(".status-img-wrapper").css("display","block"),$("#status_output").attr("src",window.URL.createObjectURL(this.files[0])),$("#status_output").css("display","block")})}function i(){window.valid=!1,Vue.use(VeeValidate),app=new Vue({el:"#statusPostingForm",data:{userStatus:null,emojiReaction:null,statusPicture:null,postUserName:$("#postUserName").attr("data-username"),postUserID:$("#postUserID").attr("data-id"),category:null,CSRF:$("#csrf_test_name").attr("data-CSRF"),postErrors:[],successMessage:[],status:null,selectedFile:null},methods:{submit:function(){$(".login-btn").html("<i class=\"fas fa-spinner fa-spin\"></i>"),this.status="submitting",this.statusValidate(),!0==window.valid?this.loginRequest():this.status="not-submitting"},loginRequest:function(){var e=this;e.status="submitting";var t=new FormData;t.append("userStatus",this.userStatus),t.append("statusReaction","<img alt=\"?\" class=\"emojioneemoji\" src=\"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/png/1f382.png\"/>"),t.append("postUserName",this.postUserName),t.append("postUserID",this.postUserID),t.append("category",this.category),t.append("csrf_test_name",this.CSRF),t.append("statusPicture",this.selectedFile),axios.post("/posting/addStatusTug",t)},onFileSelected:function(){console.log(event.target.files),this.selectedFile=event.target.files[0]},statusValidate:function(){this.status="submitting",this.$validator.validateAll().then(function(e){!0==e?window.valid=!0:this.status=null})["catch"](function(){window.valid=!1})}}})}return{init:function(){0<$("#statusPostingForm").length&&i(),e(),t(),a(),s(),n(),o()}}}function addTabCheck(){return{init:function(){$("body").hasClass("tabbed")||$("body").on("keyup.tabwatcher",function(t){9==t.which&&(t.preventDefault(),$("body").addClass("tabbed"),$("body").off("keyup.tabwatcher"))})}}}function platformInfo(){return{init:function(){$("body").addClass(platform.name),$("body").addClass(platform.name+"-"+platform.version),$("body").addClass(platform.os)}}}function mobileMenu(){function e(){$("#mobile-nav-open").on("click",function(){$(".mobile-nav-background").css("display","block"),$(".mobile-nav-open").css("display","none"),$("nav").addClass("mobile-menu-expanded")})}function t(){$("#mobile-nav-collapse").on("click",function(){var e=$("#mobile-nav");e.addClass("animated slideOutUp"),$(".mobile-nav-background").css("display","none"),$(".mobile-nav-open").css("display","block"),e.removeClass("animated slideOutUp"),e.addClass("animated slideInDown"),$("nav").removeClass("mobile-menu-expanded")})}return{init:function(){$(document).ready(e()),$(document).ready(t())}}}"use strict",!function(p,g,m,y){"use strict";var t=Math.ceil,i=Math.max,b=Math.abs,x=Math.floor,v=Math.min,w=Math.round;function n(n){var t=n.currentTarget,e=n.data?n.data.options:{},o=e.selector?m(e.selector):n.data?n.data.items:[],l=m(t).attr("data-fancybox")||"",a=0,c=m.fancybox.getInstance();n.preventDefault(),n.stopPropagation(),c&&c.current.opts.$orig.is(t)||(l?(o=o.length?o.filter("[data-fancybox=\""+l+"\"]"):m("[data-fancybox=\""+l+"\"]"),a=o.index(t),0>a&&(a=0)):o=[t],m.fancybox.open(o,e,a))}if(m){if(m.fn.fancybox)return void m.error("fancyBox already initialized");var k={loop:!1,margin:[44,0],gutter:50,keyboard:!0,arrows:!0,infobar:!1,toolbar:!0,buttons:["slideShow","fullScreen","thumbs","close"],idleTime:4,smallBtn:"auto",protect:!1,modal:!1,image:{preload:"auto"},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:"<iframe id=\"fancybox-frame{rnd}\" name=\"fancybox-frame{rnd}\" class=\"fancybox-iframe\" frameborder=\"0\" vspace=\"0\" hspace=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency=\"true\" src=\"\"></iframe>",preload:!0,css:{},attr:{scrolling:"auto"}},animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:"<div class=\"fancybox-container\" role=\"dialog\" tabindex=\"-1\"><div class=\"fancybox-bg\"></div><div class=\"fancybox-inner\"><div class=\"fancybox-infobar\"><button data-fancybox-prev title=\"{{PREV}}\" class=\"fancybox-button fancybox-button--left\"></button><div class=\"fancybox-infobar__body\"><span data-fancybox-index></span> / <span data-fancybox-count></span></div><button data-fancybox-next title=\"{{NEXT}}\" class=\"fancybox-button fancybox-button--right\"></button></div><div class=\"fancybox-toolbar\">{{BUTTONS}}</div><div class=\"fancybox-navigation\"><button data-fancybox-prev title=\"{{PREV}}\" class=\"fancybox-arrow fancybox-arrow--left\" /><button data-fancybox-next title=\"{{NEXT}}\" class=\"fancybox-arrow fancybox-arrow--right\" /></div><div class=\"fancybox-stage\"></div><div class=\"fancybox-caption-wrap\"><div class=\"fancybox-caption\"></div></div></div></div>",spinnerTpl:"<div class=\"fancybox-loading\"></div>",errorTpl:"<div class=\"fancybox-error\"><p>{{ERROR}}<p></div>",btnTpl:{slideShow:"<button data-fancybox-play class=\"fancybox-button fancybox-button--play\" title=\"{{PLAY_START}}\"></button>",fullScreen:"<button data-fancybox-fullscreen class=\"fancybox-button fancybox-button--fullscreen\" title=\"{{FULL_SCREEN}}\"></button>",thumbs:"<button data-fancybox-thumbs class=\"fancybox-button fancybox-button--thumbs\" title=\"{{THUMBS}}\"></button>",close:"<button data-fancybox-close class=\"fancybox-button fancybox-button--close\" title=\"{{CLOSE}}\"></button>",smallBtn:"<button data-fancybox-close class=\"fancybox-close-small\" title=\"{{CLOSE}}\"></button>"},parentEl:"body",autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:4e3},thumbs:{autoStart:!1,hideOnClose:!0},onInit:m.noop,beforeLoad:m.noop,afterLoad:m.noop,beforeShow:m.noop,afterShow:m.noop,beforeClose:m.noop,afterClose:m.noop,onActivate:m.noop,onDeactivate:m.noop,clickContent:function(e){return"image"===e.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{clickContent:function(e){return"image"===e.type&&"toggleControls"},clickSlide:function(e){return"image"===e.type?"toggleControls":"close"},dblclickContent:function(e){return"image"===e.type&&"zoom"},dblclickSlide:function(e){return"image"===e.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded. <br/> Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zur\xFCck",ERROR:"Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp\xE4ter nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder"}}},S=m(p),I=m(g),e=0,a=function(e){return e&&e.hasOwnProperty&&e instanceof m},C=function(){return p.requestAnimationFrame||p.webkitRequestAnimationFrame||p.mozRequestAnimationFrame||p.oRequestAnimationFrame||function(t){return p.setTimeout(t,1e3/60)}}(),u=function(){var e,a=g.createElement("fakeelement"),s={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in s)if(a.style[e]!==y)return s[e]}(),P=function(e){return e&&e.length&&e[0].offsetHeight},s=function(a,t,n){var o=this;o.opts=m.extend(!0,{index:n},k,t||{}),t&&m.isArray(t.buttons)&&(o.opts.buttons=t.buttons),o.id=o.opts.id||++e,o.group=[],o.currIndex=parseInt(o.opts.index,10)||0,o.prevIndex=null,o.prevPos=null,o.currPos=0,o.firstRun=null,o.createGroup(a),o.group.length&&(o.$lastFocus=m(g.activeElement).blur(),o.slides={},o.init(a))};m.extend(s.prototype,{init:function(){var s,n,r,l=this,i=l.group[l.currIndex].opts;l.scrollTop=I.scrollTop(),l.scrollLeft=I.scrollLeft(),m.fancybox.getInstance()||m.fancybox.isMobile||"hidden"===m("body").css("overflow")||(s=m("body").width(),m("html").addClass("fancybox-enabled"),s=m("body").width()-s,1<s&&m("head").append("<style id=\"fancybox-style-noscroll\" type=\"text/css\">.compensate-for-scrollbar, .fancybox-enabled body { margin-right: "+s+"px; }</style>")),r="",m.each(i.buttons,function(a,t){r+=i.btnTpl[t]||""}),n=m(l.translate(l,i.baseTpl.replace("{{BUTTONS}}",r))).addClass("fancybox-is-hidden").attr("id","fancybox-container-"+l.id).addClass(i.baseClass).data("FancyBox",l).prependTo(i.parentEl),l.$refs={container:n},["bg","inner","infobar","toolbar","stage","caption"].forEach(function(e){l.$refs[e]=n.find(".fancybox-"+e)}),(!i.arrows||2>l.group.length)&&n.find(".fancybox-navigation").remove(),i.infobar||l.$refs.infobar.remove(),i.toolbar||l.$refs.toolbar.remove(),l.trigger("onInit"),l.activate(),l.jumpTo(l.currIndex)},translate:function(a,t){var s=a.opts.i18n[a.opts.lang];return t.replace(/\{\{(\w+)\}\}/g,function(a,t){var e=s[t];return e===y?a:e})},createGroup:function(a){var n=this,e=m.makeArray(a);m.each(e,function(e,t){var o,i,p,f,g={},h={},b=[];m.isPlainObject(t)?(g=t,h=t.opts||t):"object"===m.type(t)&&m(t).length?(o=m(t),b=o.data(),h="options"in b?b.options:{},h="object"===m.type(h)?h:{},g.src="src"in b?b.src:h.src||o.attr("href"),["width","height","thumb","type","filter"].forEach(function(e){e in b&&(h[e]=b[e])}),"srcset"in b&&(h.image={srcset:b.srcset}),h.$orig=o,g.type||g.src||(g.type="inline",g.src=t)):g={type:"html",src:t+""},g.opts=m.extend(!0,{},n.opts,h),m.fancybox.isMobile&&(g.opts=m.extend(!0,{},g.opts,g.opts.mobile)),i=g.type||g.opts.type,p=g.src||"",!i&&p&&(p.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":p.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":"#"===p.charAt(0)&&(i="inline")),g.type=i,g.index=n.group.length,g.opts.$orig&&!g.opts.$orig.length&&delete g.opts.$orig,!g.opts.$thumb&&g.opts.$orig&&(g.opts.$thumb=g.opts.$orig.find("img:first")),g.opts.$thumb&&!g.opts.$thumb.length&&delete g.opts.$thumb,"function"===m.type(g.opts.caption)?g.opts.caption=g.opts.caption.apply(t,[n,g]):"caption"in b&&(g.opts.caption=b.caption),g.opts.caption=g.opts.caption===y?"":g.opts.caption+"","ajax"===i&&(f=p.split(/\s+/,2),1<f.length&&(g.src=f.shift(),g.opts.filter=f.shift())),"auto"==g.opts.smallBtn&&(-1<m.inArray(i,["html","inline","ajax"])?(g.opts.toolbar=!1,g.opts.smallBtn=!0):g.opts.smallBtn=!1),"pdf"===i&&(g.type="iframe",g.opts.iframe.preload=!1),g.opts.modal&&(g.opts=m.extend(!0,g.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),n.group.push(g)})},addEvents:function(){var a=this;a.removeEvents(),a.$refs.container.on("click.fb-close","[data-fancybox-close]",function(e){e.stopPropagation(),e.preventDefault(),a.close(e)}).on("click.fb-prev touchend.fb-prev","[data-fancybox-prev]",function(e){e.stopPropagation(),e.preventDefault(),a.previous()}).on("click.fb-next touchend.fb-next","[data-fancybox-next]",function(e){e.stopPropagation(),e.preventDefault(),a.next()}),S.on("orientationchange.fb resize.fb",function(e){e&&e.originalEvent&&"resize"===e.originalEvent.type?C(function(){a.update()}):(a.$refs.stage.hide(),setTimeout(function(){a.$refs.stage.show(),a.update()},500))}),I.on("focusin.fb",function(e){var t=m.fancybox?m.fancybox.getInstance():null;t.isClosing||!t.current||!t.current.opts.trapFocus||m(e.target).hasClass("fancybox-container")||m(e.target).is(g)||t&&"fixed"!==m(e.target).css("position")&&!t.$refs.container.has(e.target).length&&(e.stopPropagation(),t.focus(),S.scrollTop(a.scrollTop).scrollLeft(a.scrollLeft))}),I.on("keydown.fb",function(s){var t=a.current,e=s.keyCode||s.which;if(t&&t.opts.keyboard&&!m(s.target).is("input")&&!m(s.target).is("textarea"))return 8===e||27===e?(s.preventDefault(),void a.close(s)):37===e||38===e?(s.preventDefault(),void a.previous()):39===e||40===e?(s.preventDefault(),void a.next()):void a.trigger("afterKeydown",s,e)}),a.group[a.currIndex].opts.idleTime&&(a.idleSecondsCounter=0,I.on("mousemove.fb-idle mouseenter.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(){a.idleSecondsCounter=0,a.isIdle&&a.showControls(),a.isIdle=!1}),a.idleInterval=p.setInterval(function(){a.idleSecondsCounter++,a.idleSecondsCounter>=a.group[a.currIndex].opts.idleTime&&(a.isIdle=!0,a.idleSecondsCounter=0,a.hideControls())},1e3))},removeEvents:function(){var t=this;S.off("orientationchange.fb resize.fb"),I.off("focusin.fb keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),t.idleInterval&&(p.clearInterval(t.idleInterval),t.idleInterval=null)},previous:function(e){return this.jumpTo(this.currPos-1,e)},next:function(e){return this.jumpTo(this.currPos+1,e)},jumpTo:function(n,f){var o,i,g,b,x,v,k,S=this,h=S.group.length;if(!(S.isSliding||S.isClosing||S.isAnimating&&S.firstRun)){if(n=parseInt(n,10),i=S.current?S.current.opts.loop:S.opts.loop,!i&&(0>n||n>=h))return!1;if(o=S.firstRun=null===S.firstRun,!(2>h&&!o&&S.isSliding)){if(b=S.current,S.prevIndex=S.currIndex,S.prevPos=S.currPos,g=S.createSlide(n),1<h&&((i||0<g.index)&&S.createSlide(n-1),(i||g.index<h-1)&&S.createSlide(n+1)),S.current=g,S.currIndex=g.index,S.currPos=g.pos,S.trigger("beforeShow",o),S.updateControls(),v=m.fancybox.getTranslate(g.$slide),g.isMoved=(0!==v.left||0!==v.top)&&!g.$slide.hasClass("fancybox-animated"),g.forcedDuration=y,m.isNumeric(f)?g.forcedDuration=f:f=g.opts[o?"animationDuration":"transitionDuration"],f=parseInt(f,10),o)return g.opts.animationEffect&&f&&S.$refs.container.css("transition-duration",f+"ms"),S.$refs.container.removeClass("fancybox-is-hidden"),P(S.$refs.container),S.$refs.container.addClass("fancybox-is-open"),g.$slide.addClass("fancybox-slide--current"),S.loadSlide(g),void S.preload();m.each(S.slides,function(a,t){m.fancybox.stop(t.$slide)}),g.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"),g.isMoved?(x=w(g.$slide.width()),m.each(S.slides,function(e,t){var a=t.pos-g.pos;m.fancybox.animate(t.$slide,{top:0,left:a*x+a*t.opts.gutter},f,function(){t.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"),t.pos===S.currPos&&(g.isMoved=!1,S.complete())})})):S.$refs.stage.children().removeAttr("style"),g.isLoaded?S.revealContent(g):S.loadSlide(g),S.preload(),b.pos!==g.pos&&(k="fancybox-slide--"+(b.pos>g.pos?"next":"previous"),b.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),b.isComplete=!1,f&&(g.isMoved||g.opts.transitionEffect)&&(g.isMoved?b.$slide.addClass(k):(k="fancybox-animated "+k+" fancybox-fx-"+g.opts.transitionEffect,m.fancybox.animate(b.$slide,k,f,function(){b.$slide.removeClass(k).removeAttr("style")}))))}}},createSlide:function(a){var t,s,n=this;return s=a%n.group.length,s=0>s?n.group.length+s:s,!n.slides[a]&&n.group[s]&&(t=m("<div class=\"fancybox-slide\"></div>").appendTo(n.$refs.stage),n.slides[a]=m.extend(!0,{},n.group[s],{pos:a,$slide:t,isLoaded:!1}),n.updateSlide(n.slides[a])),n.slides[a]},scaleToActual:function(n,o,x){var i,v,w,k,S,I=this,u=I.current,d=u.$content,f=parseInt(u.$slide.width(),10),h=parseInt(u.$slide.height(),10),p=u.width,g=u.height;"image"!=u.type||u.hasError||!d||I.isAnimating||(m.fancybox.stop(d),I.isAnimating=!0,n=n===y?.5*f:n,o=o===y?.5*h:o,i=m.fancybox.getTranslate(d),k=p/i.width,S=g/i.height,v=.5*f-.5*p,w=.5*h-.5*g,p>f&&(v=i.left*k-(n*k-n),0<v&&(v=0),v<f-p&&(v=f-p)),g>h&&(w=i.top*S-(o*S-o),0<w&&(w=0),w<h-g&&(w=h-g)),I.updateCursor(p,g),m.fancybox.animate(d,{top:w,left:v,scaleX:k,scaleY:S},x||330,function(){I.isAnimating=!1}),I.SlideShow&&I.SlideShow.isActive&&I.SlideShow.stop())},scaleToFit:function(s){var t,n=this,o=n.current,i=o.$content;"image"!=o.type||o.hasError||!i||n.isAnimating||(m.fancybox.stop(i),n.isAnimating=!0,t=n.getFitPos(o),n.updateCursor(t.width,t.height),m.fancybox.animate(i,{top:t.top,left:t.left,scaleX:t.width/i.width(),scaleY:t.height/i.height()},s||330,function(){n.isAnimating=!1}))},getFitPos:function(s){var t,n,p,g,h,b=this,c=s.$content,l=s.width,u=s.height,d=s.opts.margin;return c&&c.length&&(l||u)&&("number"===m.type(d)&&(d=[d,d]),2==d.length&&(d=[d[0],d[1],d[0],d[1]]),800>S.width()&&(d=[0,0,0,0]),t=parseInt(b.$refs.stage.width(),10)-(d[1]+d[3]),n=parseInt(b.$refs.stage.height(),10)-(d[0]+d[2]),p=v(1,t/l,n/u),g=x(p*l),h=x(p*u),{top:x(.5*(n-h))+d[0],left:x(.5*(t-g))+d[3],width:g,height:h})},update:function(){var a=this;m.each(a.slides,function(t,e){a.updateSlide(e)})},updateSlide:function(a){var t=this,e=a.$content;e&&(a.width||a.height)&&(m.fancybox.stop(e),m.fancybox.setTranslate(e,t.getFitPos(a)),a.pos===t.currPos&&t.updateCursor()),a.$slide.trigger("refresh"),t.trigger("onUpdate",a)},updateCursor:function(s,t){var e,o=this,i=o.$refs.container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut");o.current&&!o.isClosing&&(o.isZoomable()?(i.addClass("fancybox-is-zoomable"),e=s!==y&&t!==y?s<o.current.width&&t<o.current.height:o.isScaledDown(),e?i.addClass("fancybox-can-zoomIn"):o.current.opts.touch?i.addClass("fancybox-can-drag"):i.addClass("fancybox-can-zoomOut")):o.current.opts.touch&&i.addClass("fancybox-can-drag"))},isZoomable:function(){var a,s=this,e=s.current;if(e&&!s.isClosing)return!!("image"===e.type&&e.isLoaded&&!e.hasError&&("zoom"===e.opts.clickContent||m.isFunction(e.opts.clickContent)&&"zoom"===e.opts.clickContent(e))&&(a=s.getFitPos(e),e.width>a.width||e.height>a.height))},isScaledDown:function(){var a=this,t=a.current,e=t.$content,s=!1;return e&&(s=m.fancybox.getTranslate(e),s=s.width<t.width||s.height<t.height),s},canPan:function(){var a=this,t=a.current,e=t.$content,s=!1;return e&&(s=a.getFitPos(t),s=1<b(e.width()-s.width)||1<b(e.height()-s.height)),s},loadSlide:function(s){var t,n,r,l=this;if(!s.isLoading&&!s.isLoaded){switch(s.isLoading=!0,l.trigger("beforeLoad",s),t=s.type,n=s.$slide,n.off("refresh").trigger("onReset").addClass("fancybox-slide--"+(t||"unknown")).addClass(s.opts.slideClass),t){case"image":l.setImage(s);break;case"iframe":l.setIframe(s);break;case"html":l.setContent(s,s.src||s.content);break;case"inline":m(s.src).length?l.setContent(s,m(s.src)):l.setError(s);break;case"ajax":l.showLoading(s),r=m.ajax(m.extend({},s.opts.ajax.settings,{url:s.src,success:function(t,e){"success"===e&&l.setContent(s,t)},error:function(t,e){t&&"abort"!==e&&l.setError(s)}})),n.one("onReset",function(){r.abort()});break;default:l.setError(s);}return!0}},setImage:function(t){var e,n,d,f,g=this,r=t.opts.image.srcset;if(r){d=p.devicePixelRatio||1,f=p.innerWidth*d,n=r.split(",").map(function(a){var s={};return a.trim().split(/\s+/).forEach(function(e,t){var a=parseInt(e.substring(0,e.length-1),10);return 0===t?s.url=e:void(a&&(s.value=a,s.postfix=e[e.length-1]))}),s}),n.sort(function(a,t){return a.value-t.value});for(var c,h=0;h<n.length;h++)if(c=n[h],"w"===c.postfix&&c.value>=f||"x"===c.postfix&&c.value>=d){e=c;break}!e&&n.length&&(e=n[n.length-1]),e&&(t.src=e.url,t.width&&t.height&&"w"==e.postfix&&(t.height=t.width/t.height*e.value,t.width=e.value))}t.$content=m("<div class=\"fancybox-image-wrap\"></div>").addClass("fancybox-is-hidden").appendTo(t.$slide),!1!==t.opts.preload&&t.opts.width&&t.opts.height&&(t.opts.thumb||t.opts.$thumb)?(t.width=t.opts.width,t.height=t.opts.height,t.$ghost=m("<img />").one("error",function(){m(this).remove(),t.$ghost=null,g.setBigImage(t)}).one("load",function(){g.afterLoad(t),g.setBigImage(t)}).addClass("fancybox-image").appendTo(t.$content).attr("src",t.opts.thumb||t.opts.$thumb.attr("src"))):g.setBigImage(t)},setBigImage:function(a){var t=this,e=m("<img />");a.$image=e.one("error",function(){t.setError(a)}).one("load",function(){clearTimeout(a.timouts),a.timouts=null,t.isClosing||(a.width=this.naturalWidth,a.height=this.naturalHeight,a.opts.image.srcset&&e.attr("sizes","100vw").attr("srcset",a.opts.image.srcset),t.hideLoading(a),a.$ghost?a.timouts=setTimeout(function(){a.timouts=null,a.$ghost.hide()},v(300,i(1e3,a.height/1600))):t.afterLoad(a))}).addClass("fancybox-image").attr("src",a.src).appendTo(a.$content),e[0].complete?e.trigger("load"):e[0].error?e.trigger("error"):a.timouts=setTimeout(function(){e[0].complete||a.hasError||t.showLoading(a)},100)},setIframe:function(o){var d,n=this,p=o.opts.iframe,a=o.$slide;o.$content=m("<div class=\"fancybox-content"+(p.preload?" fancybox-is-hidden":"")+"\"></div>").css(p.css).appendTo(a),d=m(p.tpl.replace(/\{rnd\}/g,new Date().getTime())).attr(p.attr).appendTo(o.$content),p.preload?(n.showLoading(o),d.on("load.fb error.fb",function(){this.isReady=1,o.$slide.trigger("refresh"),n.afterLoad(o)}),a.on("refresh.fb",function(){var e,a,u,f,g,m=o.$content;if(1===d[0].isReady){try{e=d.contents(),a=e.find("body")}catch(e){}a&&a.length&&(p.css.width===y||p.css.height===y)&&(u=d[0].contentWindow.document.documentElement.scrollWidth,f=t(a.outerWidth(!0)+(m.width()-u)),g=t(a.outerHeight(!0)),m.css({width:p.css.width===y?f+(m.outerWidth()-m.innerWidth()):p.css.width,height:p.css.height===y?g+(m.outerHeight()-m.innerHeight()):p.css.height})),m.removeClass("fancybox-is-hidden")}})):this.afterLoad(o),d.attr("src",o.src),!0===o.opts.smallBtn&&o.$content.prepend(n.translate(o,o.opts.btnTpl.smallBtn)),a.one("onReset",function(){try{m(this).find("iframe").hide().attr("src","//about:blank")}catch(e){}m(this).empty(),o.isLoaded=!1})},setContent:function(s,t){var n=this;n.isClosing||(n.hideLoading(s),s.$slide.empty(),a(t)&&t.parent().length?(t.parent(".fancybox-slide--inline").trigger("onReset"),s.$placeholder=m("<div></div>").hide().insertAfter(t),t.css("display","inline-block")):s.hasError||("string"===m.type(t)&&(t=m("<div>").append(m.trim(t)).contents(),3===t[0].nodeType&&(t=m("<div>").html(t))),s.opts.filter&&(t=m("<div>").html(t).find(s.opts.filter))),s.$slide.one("onReset",function(){s.$placeholder&&(s.$placeholder.after(t.hide()).remove(),s.$placeholder=null),s.$smallBtn&&(s.$smallBtn.remove(),s.$smallBtn=null),s.hasError||(m(this).empty(),s.isLoaded=!1)}),s.$content=m(t).appendTo(s.$slide),s.opts.smallBtn&&!s.$smallBtn&&(s.$smallBtn=m(n.translate(s,s.opts.btnTpl.smallBtn)).appendTo(s.$content.filter("div").first())),this.afterLoad(s))},setError:function(e){e.hasError=!0,e.$slide.removeClass("fancybox-slide--"+e.type),this.setContent(e,this.translate(e,e.opts.errorTpl))},showLoading:function(a){var s=this;a=a||s.current,a&&!a.$spinner&&(a.$spinner=m(s.opts.spinnerTpl).appendTo(a.$slide))},hideLoading:function(a){var s=this;a=a||s.current,a&&a.$spinner&&(a.$spinner.remove(),delete a.$spinner)},afterLoad:function(a){var t=this;t.isClosing||(a.isLoading=!1,a.isLoaded=!0,t.trigger("afterLoad",a),t.hideLoading(a),a.opts.protect&&a.$content&&!a.hasError&&(a.$content.on("contextmenu.fb",function(e){return 2==e.button&&e.preventDefault(),!0}),"image"===a.type&&m("<div class=\"fancybox-spaceball\"></div>").appendTo(a.$content)),t.revealContent(a))},revealContent:function(n){var t,o,d,p,f,g=this,c=n.$slide,l=!1;return t=n.opts[g.firstRun?"animationEffect":"transitionEffect"],d=n.opts[g.firstRun?"animationDuration":"transitionDuration"],d=parseInt(n.forcedDuration===y?d:n.forcedDuration,10),!n.isMoved&&n.pos===g.currPos&&d||(t=!1),"zoom"!==t||n.pos===g.currPos&&d&&"image"===n.type&&!n.hasError&&(l=g.getThumbPos(n))||(t="fade"),"zoom"===t?(f=g.getFitPos(n),f.scaleX=f.width/l.width,f.scaleY=f.height/l.height,delete f.width,delete f.height,p=n.opts.zoomOpacity,"auto"==p&&(p=.1<b(n.width/n.height-l.width/l.height)),p&&(l.opacity=.1,f.opacity=1),m.fancybox.setTranslate(n.$content.removeClass("fancybox-is-hidden"),l),P(n.$content),void m.fancybox.animate(n.$content,f,d,function(){g.complete()})):(g.updateSlide(n),t?(m.fancybox.stop(c),o="fancybox-animated fancybox-slide--"+(n.pos>g.prevPos?"next":"previous")+" fancybox-fx-"+t,c.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(o),n.$content.removeClass("fancybox-is-hidden"),P(c),void m.fancybox.animate(c,"fancybox-slide--current",d,function(){c.removeClass(o).removeAttr("style"),n.pos===g.currPos&&g.complete()},!0)):(P(c),n.$content.removeClass("fancybox-is-hidden"),void(n.pos===g.currPos&&g.complete())))},getThumbPos:function(e){var t,n=this,a=!1,o=function(t){for(var e,n=t[0],r=n.getBoundingClientRect(),a=[];null!==n.parentElement;)"hidden"!==m(n.parentElement).css("overflow")&&"auto"!==m(n.parentElement).css("overflow")||a.push(n.parentElement.getBoundingClientRect()),n=n.parentElement;return e=a.every(function(a){var t=v(r.right,a.right)-i(r.left,a.left),e=v(r.bottom,a.bottom)-i(r.top,a.top);return 0<t&&0<e}),e&&0<r.bottom&&0<r.right&&r.left<m(p).width()&&r.top<m(p).height()},r=e.opts.$thumb,c=r?r.offset():0;return c&&r[0].ownerDocument===g&&o(r)&&(t=n.$refs.stage.offset(),a={top:c.top-t.top+parseFloat(r.css("border-top-width")||0),left:c.left-t.left+parseFloat(r.css("border-left-width")||0),width:r.width(),height:r.height(),scaleX:1,scaleY:1}),a},complete:function(){var a=this,e=a.current,t={};e.isMoved||!e.isLoaded||e.isComplete||(e.isComplete=!0,e.$slide.siblings().trigger("onReset"),P(e.$slide),e.$slide.addClass("fancybox-slide--complete"),m.each(a.slides,function(s,e){e.pos>=a.currPos-1&&e.pos<=a.currPos+1?t[e.pos]=e:e&&(m.fancybox.stop(e.$slide),e.$slide.unbind().remove())}),a.slides=t,a.updateCursor(),a.trigger("afterShow"),(m(g.activeElement).is("[disabled]")||e.opts.autoFocus&&"image"!=e.type&&"iframe"!==e.type)&&a.focus())},preload:function(){var a,s,o=this;2>o.group.length||(a=o.slides[o.currPos+1],s=o.slides[o.currPos-1],a&&"image"===a.type&&o.loadSlide(a),s&&"image"===s.type&&o.loadSlide(s))},focus:function(){var a,s=this.current;this.isClosing||(a=s&&s.isComplete?s.$slide.find("button,:input,[tabindex],a").filter(":not([disabled]):visible:first"):null,a=a&&a.length?a:this.$refs.container,a.focus())},activate:function(){var a=this;m(".fancybox-container").each(function(){var t=m(this).data("FancyBox");t&&t.uid!==a.uid&&!t.isClosing&&t.trigger("onDeactivate")}),a.current&&(0<a.$refs.container.index()&&a.$refs.container.prependTo(g.body),a.updateControls()),a.trigger("onActivate"),a.addEvents()},close:function(n,t){var e,d,p,g,y,x,v=this,l=v.current,f=function(){v.cleanUp(n)};return!v.isClosing&&(v.isClosing=!0,!1===v.trigger("beforeClose",n)?(v.isClosing=!1,C(function(){v.update()}),!1):(v.removeEvents(),l.timouts&&clearTimeout(l.timouts),p=l.$content,e=l.opts.animationEffect,d=m.isNumeric(t)?t:e?l.opts.animationDuration:0,l.$slide.off(u).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),l.$slide.siblings().trigger("onReset").remove(),d&&v.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),v.hideLoading(l),v.hideControls(),v.updateCursor(),"zoom"!==e||!0!==n&&p&&d&&"image"===l.type&&!l.hasError&&(x=v.getThumbPos(l))||(e="fade"),"zoom"===e?(m.fancybox.stop(p),y=m.fancybox.getTranslate(p),y.width*=y.scaleX,y.height*=y.scaleY,g=l.opts.zoomOpacity,"auto"==g&&(g=.1<b(l.width/l.height-x.width/x.height)),g&&(x.opacity=0),y.scaleX=y.width/x.width,y.scaleY=y.height/x.height,y.width=x.width,y.height=x.height,m.fancybox.setTranslate(l.$content,y),m.fancybox.animate(l.$content,x,d,f),!0):(e&&d?!0===n?setTimeout(f,d):m.fancybox.animate(l.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+e,d,f):f(),!0)))},cleanUp:function(a){var t,s=this;s.current.$slide.trigger("onReset"),s.$refs.container.empty().remove(),s.trigger("afterClose",a),s.$lastFocus&&s.current.opts.backFocus&&s.$lastFocus.focus(),s.current=null,t=m.fancybox.getInstance(),t?t.activate():(S.scrollTop(s.scrollTop).scrollLeft(s.scrollLeft),m("html").removeClass("fancybox-enabled"),m("#fancybox-style-noscroll").remove())},trigger:function(n,t){var e,r=Array.prototype.slice.call(arguments,1),i=this,a=t&&t.opts?t:i.current;return a?r.unshift(a):a=i,r.unshift(i),m.isFunction(a.opts[n])&&(e=a.opts[n].apply(a,r)),!1===e?e:void("afterClose"===n?I.trigger(n+".fb",r):i.$refs.container.trigger(n+".fb",r))},updateControls:function(){var t=this,e=t.current,n=e.index,o=e.opts,a=o.caption,s=t.$refs.caption;e.$slide.trigger("refresh"),t.$caption=a&&a.length?s.html(a):null,t.isHiddenControls||t.showControls(),m("[data-fancybox-count]").html(t.group.length),m("[data-fancybox-index]").html(n+1),m("[data-fancybox-prev]").prop("disabled",!o.loop&&0>=n),m("[data-fancybox-next]").prop("disabled",!o.loop&&n>=t.group.length-1)},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var a=this,t=a.current?a.current.opts:a.opts,e=a.$refs.container;a.isHiddenControls=!1,a.idleSecondsCounter=0,e.toggleClass("fancybox-show-toolbar",t.toolbar&&t.buttons).toggleClass("fancybox-show-infobar",!!(t.infobar&&1<a.group.length)).toggleClass("fancybox-show-nav",!!(t.arrows&&1<a.group.length)).toggleClass("fancybox-is-modal",!!t.modal),a.$caption?e.addClass("fancybox-show-caption "):e.removeClass("fancybox-show-caption")},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),m.fancybox={version:"3.1.25",defaults:k,getInstance:function(a){var t=m(".fancybox-container:not(\".fancybox-is-closing\"):first").data("FancyBox"),e=Array.prototype.slice.call(arguments,1);return t instanceof s&&("string"===m.type(a)?t[a].apply(t,e):"function"===m.type(a)&&a.apply(t,e),t)},open:function(a,t,e){return new s(a,t,e)},close:function(a){var t=this.getInstance();t&&(t.close(),!0===a&&this.close())},destroy:function(){this.close(!0),I.off("click.fb-start")},isMobile:g.createTouch!==y&&/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),use3d:function(){var e=g.createElement("div");return p.getComputedStyle&&p.getComputedStyle(e).getPropertyValue("transform")&&!(g.documentMode&&11>g.documentMode)}(),getTranslate:function(a){var t;if(!a||!a.length)return!1;if(t=a.eq(0).css("transform"),t&&-1!==t.indexOf("matrix")?(t=t.split("(")[1],t=t.split(")")[0],t=t.split(",")):t=[],t.length)t=10<t.length?[t[13],t[12],t[0],t[5]]:[t[5],t[4],t[0],t[3]],t=t.map(parseFloat);else{t=[0,0,1,1];var s=/\.*translate\((.*)px,(.*)px\)/i,n=s.exec(a.eq(0).attr("style"));n&&(t[0]=parseFloat(n[2]),t[1]=parseFloat(n[1]))}return{top:t[0],left:t[1],scaleX:t[2],scaleY:t[3],opacity:parseFloat(a.css("opacity")),width:a.width(),height:a.height()}},setTranslate:function(a,t){var e="",s={};if(a&&t)return t.left===y&&t.top===y||(e=(t.left===y?a.position().left:t.left)+"px, "+(t.top===y?a.position().top:t.top)+"px",e=this.use3d?"translate3d("+e+", 0px)":"translate("+e+")"),t.scaleX!==y&&t.scaleY!==y&&(e=(e.length?e+" ":"")+"scale("+t.scaleX+", "+t.scaleY+")"),e.length&&(s.transform=e),t.opacity!==y&&(s.opacity=t.opacity),t.width!==y&&(s.width=t.width),t.height!==y&&(s.height=t.height),a.css(s)},animate:function(n,t,e,o,l){var s=u||"transitionend";m.isFunction(e)&&(o=e,e=null),m.isPlainObject(t)||n.removeAttr("style"),n.on(s,function(e){e&&e.originalEvent&&(!n.is(e.originalEvent.target)||"z-index"==e.originalEvent.propertyName)||(n.off(s),m.isPlainObject(t)?t.scaleX!==y&&t.scaleY!==y&&(n.css("transition-duration","0ms"),t.width=w(n.width()*t.scaleX),t.height=w(n.height()*t.scaleY),t.scaleX=1,t.scaleY=1,m.fancybox.setTranslate(n,t)):!0!==l&&n.removeClass(t),m.isFunction(o)&&o(e))}),m.isNumeric(e)&&n.css("transition-duration",e+"ms"),m.isPlainObject(t)?m.fancybox.setTranslate(n,t):n.addClass(t),n.data("timer",setTimeout(function(){n.trigger("transitionend")},e+16))},stop:function(e){clearTimeout(e.data("timer")),e.off(u)}},m.fn.fancybox=function(a){var s;return a=a||{},s=a.selector||!1,s?m("body").off("click.fb-start",s).on("click.fb-start",s,{options:a},n):this.off("click.fb-start").on("click.fb-start",{items:this,options:a},n),this},I.on("click.fb-start","[data-fancybox]",n)}}(window,document,window.jQuery||jQuery),function(g){"use strict";var t=function(e,t,a){if(e)return a=a||"","object"===g.type(a)&&(a=g.param(a,!0)),g.each(t,function(a,t){e=e.replace("$"+a,t||"")}),a.length&&(e+=(0<e.indexOf("?")?"&":"?")+a),e},e={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},metacafe:{matcher:/metacafe.com\/watch\/(\d+)\/(.*)?/,type:"iframe",url:"//www.metacafe.com/embed/$1/?ap=1"},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"iframe",url:"//www.dailymotion.com/embed/video/$1"},vine:{matcher:/vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/,type:"iframe",url:"//vine.co/v/$1/embed/simple"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(e){return"//maps.google."+e[2]+"/?ll="+(e[9]?e[9]+"&z="+Math.floor(e[10])+(e[12]?e[12].replace(/^\//,"&"):""):e[12])+"&output="+(e[12]&&0<e[12].indexOf("layer=c")?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(e){return"//maps.google."+e[2]+"/maps?q="+e[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};g(document).on("onInit.fb",function(a,s){g.each(s.group,function(n,m){var o,i,b,y,x,v,w,k=m.src||"",S=!1;m.type||(o=g.extend(!0,{},e,m.opts.media),g.each(o,function(e,s){if(b=k.match(s.matcher),v={},w=e,b){if(S=s.type,s.paramPlace&&b[s.paramPlace]){x=b[s.paramPlace],"?"==x[0]&&(x=x.substring(1)),x=x.split("&");for(var n,o=0;o<x.length;++o)n=x[o].split("=",2),2==n.length&&(v[n[0]]=decodeURIComponent(n[1].replace(/\+/g," ")))}return y=g.extend(!0,{},s.params,m.opts[e],v),k="function"===g.type(s.url)?s.url.call(this,b,y,m):t(s.url,b,y),i="function"===g.type(s.thumb)?s.thumb.call(this,b,y,m):t(s.thumb,b),"vimeo"===w&&(k=k.replace("&%23","#")),!1}}),S?(m.src=k,m.type=S,m.opts.thumb||m.opts.$thumb&&m.opts.$thumb.length||(m.opts.thumb=i),"iframe"===S&&(g.extend(!0,m.opts,{iframe:{preload:!1,attr:{scrolling:"no"}}}),m.contentProvider=w,m.opts.slideClass+=" fancybox-slide--"+("gmap_place"==w||"gmap_search"==w?"map":"video"))):m.type="image")})})}(window.jQuery),function(x,p,w){"use strict";var g=Math.pow,m=Math.max,h=Math.abs,k=Math.floor,S=Math.min,I=Math.round,C=function(){return x.requestAnimationFrame||x.webkitRequestAnimationFrame||x.mozRequestAnimationFrame||x.oRequestAnimationFrame||function(t){return x.setTimeout(t,1e3/60)}}(),n=function(){return x.cancelAnimationFrame||x.webkitCancelAnimationFrame||x.mozCancelAnimationFrame||x.oCancelAnimationFrame||function(t){x.clearTimeout(t)}}(),b=function(t){var a=[];for(var s in t=t.originalEvent||t||x.e,t=t.touches&&t.touches.length?t.touches:t.changedTouches&&t.changedTouches.length?t.changedTouches:[t],t)t[s].pageX?a.push({x:t[s].pageX,y:t[s].pageY}):t[s].clientX&&a.push({x:t[s].clientX,y:t[s].clientY});return a},P=function(a,t,e){return t&&a?"x"===e?a.x-t.x:"y"===e?a.y-t.y:Math.sqrt(g(a.x-t.x,2)+g(a.y-t.y,2)):0},e=function(a){if(a.is("a,button,input,select,textarea")||w.isFunction(a.get(0).onclick)||a.data("selectable"))return!0;for(var t=0,s=a[0].attributes,n=s.length;t<n;t++)if("data-fancybox-"===s[t].nodeName.substr(0,14))return!0;return!1},a=function(t){var e=x.getComputedStyle(t)["overflow-y"],s=x.getComputedStyle(t)["overflow-x"],n=("scroll"===e||"auto"===e)&&t.scrollHeight>t.clientHeight,o=("scroll"===s||"auto"===s)&&t.scrollWidth>t.clientWidth;return n||o},s=function(s){for(var n=!1;;){if(n=a(s.get(0)))break;if(s=s.parent(),!s.length||s.hasClass("fancybox-stage")||s.is("body"))break}return n},o=function(a){var t=this;t.instance=a,t.$bg=a.$refs.bg,t.$stage=a.$refs.stage,t.$container=a.$refs.container,t.destroy(),t.$container.on("touchstart.fb.touch mousedown.fb.touch",w.proxy(t,"ontouchstart"))};o.prototype.destroy=function(){this.$container.off(".fb.touch")},o.prototype.ontouchstart=function(t){var a=this,n=w(t.target),o=a.instance,i=o.current,r=i.$content,l="touchstart"==t.type;if(l&&a.$container.off("mousedown.fb.touch"),!i||a.instance.isAnimating||a.instance.isClosing)return t.stopPropagation(),void t.preventDefault();if((!t.originalEvent||2!=t.originalEvent.button)&&n.length&&!e(n)&&!e(n.parent())&&!(t.originalEvent.clientX>n[0].clientWidth+n.offset().left)&&(a.startPoints=b(t),a.startPoints&&!(1<a.startPoints.length&&o.isSliding))){if(a.$target=n,a.$content=r,a.canTap=!0,w(p).off(".fb.touch"),w(p).on(l?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",w.proxy(a,"ontouchend")),w(p).on(l?"touchmove.fb.touch":"mousemove.fb.touch",w.proxy(a,"ontouchmove")),!o.current.opts.touch&&!o.canPan()||!n.is(a.$stage)&&!a.$stage.find(n).length)return void(n.is("img")&&t.preventDefault());t.stopPropagation(),w.fancybox.isMobile&&(s(a.$target)||s(a.$target.parent()))||t.preventDefault(),a.canvasWidth=I(i.$slide[0].clientWidth),a.canvasHeight=I(i.$slide[0].clientHeight),a.startTime=new Date().getTime(),a.distanceX=a.distanceY=a.distance=0,a.isPanning=!1,a.isSwiping=!1,a.isZooming=!1,a.sliderStartPos=a.sliderLastPos||{top:0,left:0},a.contentStartPos=w.fancybox.getTranslate(a.$content),a.contentLastPos=null,1!==a.startPoints.length||a.isZooming||(a.canTap=!o.isSliding,"image"===i.type&&(a.contentStartPos.width>a.canvasWidth+1||a.contentStartPos.height>a.canvasHeight+1)?(w.fancybox.stop(a.$content),a.$content.css("transition-duration","0ms"),a.isPanning=!0):a.isSwiping=!0,a.$container.addClass("fancybox-controls--isGrabbing")),2!==a.startPoints.length||o.isAnimating||i.hasError||"image"!==i.type||!i.isLoaded&&!i.$ghost||(a.isZooming=!0,a.isSwiping=!1,a.isPanning=!1,w.fancybox.stop(a.$content),a.$content.css("transition-duration","0ms"),a.centerPointStartX=.5*(a.startPoints[0].x+a.startPoints[1].x)-w(x).scrollLeft(),a.centerPointStartY=.5*(a.startPoints[0].y+a.startPoints[1].y)-w(x).scrollTop(),a.percentageOfImageAtPinchPointX=(a.centerPointStartX-a.contentStartPos.left)/a.contentStartPos.width,a.percentageOfImageAtPinchPointY=(a.centerPointStartY-a.contentStartPos.top)/a.contentStartPos.height,a.startDistanceBetweenFingers=P(a.startPoints[0],a.startPoints[1]))}},o.prototype.ontouchmove=function(a){var t=this;if(t.newPoints=b(a),w.fancybox.isMobile&&(s(t.$target)||s(t.$target.parent())))return a.stopPropagation(),void(t.canTap=!1);if((t.instance.current.opts.touch||t.instance.canPan())&&t.newPoints&&t.newPoints.length&&(t.distanceX=P(t.newPoints[0],t.startPoints[0],"x"),t.distanceY=P(t.newPoints[0],t.startPoints[0],"y"),t.distance=P(t.newPoints[0],t.startPoints[0]),0<t.distance)){if(!t.$target.is(t.$stage)&&!t.$stage.find(t.$target).length)return;a.stopPropagation(),a.preventDefault(),t.isSwiping?t.onSwipe():t.isPanning?t.onPan():t.isZooming&&t.onZoom()}},o.prototype.onSwipe=function(){var t,i=this,a=i.isSwiping,s=i.sliderStartPos.left||0;!0===a?10<h(i.distance)&&(i.canTap=!1,2>i.instance.group.length&&i.instance.opts.touch.vertical?i.isSwiping="y":i.instance.isSliding||!1===i.instance.opts.touch.vertical||"auto"===i.instance.opts.touch.vertical&&800<w(x).width()?i.isSwiping="x":(t=h(180*Math.atan2(i.distanceY,i.distanceX)/Math.PI),i.isSwiping=45<t&&135>t?"y":"x"),i.instance.isSliding=i.isSwiping,i.startPoints=i.newPoints,w.each(i.instance.slides,function(a,t){w.fancybox.stop(t.$slide),t.$slide.css("transition-duration","0ms"),t.inTransition=!1,t.pos===i.instance.current.pos&&(i.sliderStartPos.left=w.fancybox.getTranslate(t.$slide).left)}),i.instance.SlideShow&&i.instance.SlideShow.isActive&&i.instance.SlideShow.stop()):("x"==a&&(0<i.distanceX&&(2>i.instance.group.length||0===i.instance.current.index&&!i.instance.current.opts.loop)?s+=g(i.distanceX,.8):0>i.distanceX&&(2>i.instance.group.length||i.instance.current.index===i.instance.group.length-1&&!i.instance.current.opts.loop)?s-=g(-i.distanceX,.8):s+=i.distanceX),i.sliderLastPos={top:"x"==a?0:i.sliderStartPos.top+i.distanceY,left:s},i.requestId&&(n(i.requestId),i.requestId=null),i.requestId=C(function(){i.sliderLastPos&&(w.each(i.instance.slides,function(a,t){var e=t.pos-i.instance.currPos;w.fancybox.setTranslate(t.$slide,{top:i.sliderLastPos.top,left:i.sliderLastPos.left+e*i.canvasWidth+e*t.opts.gutter})}),i.$container.addClass("fancybox-is-sliding"))}))},o.prototype.onPan=function(){var o,i,r,l=this;l.canTap=!1,o=l.contentStartPos.width>l.canvasWidth?l.contentStartPos.left+l.distanceX:l.contentStartPos.left,i=l.contentStartPos.top+l.distanceY,r=l.limitMovement(o,i,l.contentStartPos.width,l.contentStartPos.height),r.scaleX=l.contentStartPos.scaleX,r.scaleY=l.contentStartPos.scaleY,l.contentLastPos=r,l.requestId&&(n(l.requestId),l.requestId=null),l.requestId=C(function(){w.fancybox.setTranslate(l.$content,l.contentLastPos)})},o.prototype.limitMovement=function(b,y,x,n){var o,v,w,k,I=this,c=I.canvasWidth,l=I.canvasHeight,u=I.contentStartPos.left,d=I.contentStartPos.top,f=I.distanceX,h=I.distanceY;return o=m(0,.5*c-.5*x),v=m(0,.5*l-.5*n),w=S(c-x,.5*c-.5*x),k=S(l-n,.5*l-.5*n),x>c&&(0<f&&b>o&&(b=o-1+g(-o+u+f,.8)||0),0>f&&b<w&&(b=w+1-g(w-u-f,.8)||0)),n>l&&(0<h&&y>v&&(y=v-1+g(-v+d+h,.8)||0),0>h&&y<k&&(y=k+1-g(k-d-h,.8)||0)),{top:y,left:b}},o.prototype.limitPosition=function(r,l,c,n){var o=this,i=o.canvasWidth,a=o.canvasHeight;return c>i?(r=0<r?0:r,r=r<i-c?i-c:r):r=m(0,i/2-c/2),n>a?(l=0<l?0:l,l=l<a-n?a-n:l):l=m(0,a/2-n/2),{top:l,left:r}},o.prototype.onZoom=function(){var t=this,e=t.contentStartPos.width,a=t.contentStartPos.height,s=t.contentStartPos.left,o=t.contentStartPos.top,i=P(t.newPoints[0],t.newPoints[1]),r=i/t.startDistanceBetweenFingers,l=k(e*r),c=k(a*r),d=(e-l)*t.percentageOfImageAtPinchPointX,p=(a-c)*t.percentageOfImageAtPinchPointY,u=(t.newPoints[0].x+t.newPoints[1].x)/2-w(x).scrollLeft(),f=(t.newPoints[0].y+t.newPoints[1].y)/2-w(x).scrollTop(),g=u-t.centerPointStartX,m=f-t.centerPointStartY,h={top:o+(p+m),left:s+(d+g),scaleX:t.contentStartPos.scaleX*r,scaleY:t.contentStartPos.scaleY*r};t.canTap=!1,t.newWidth=l,t.newHeight=c,t.contentLastPos=h,t.requestId&&(n(t.requestId),t.requestId=null),t.requestId=C(function(){w.fancybox.setTranslate(t.$content,t.contentLastPos)})},o.prototype.ontouchend=function(e){var t=this,a=m(new Date().getTime()-t.startTime,1),s=t.isSwiping,o=t.isPanning,i=t.isZooming;return t.endPoints=b(e),t.$container.removeClass("fancybox-controls--isGrabbing"),w(p).off(".fb.touch"),t.requestId&&(n(t.requestId),t.requestId=null),t.isSwiping=!1,t.isPanning=!1,t.isZooming=!1,t.canTap?t.onTap(e):(t.speed=366,t.velocityX=.5*(t.distanceX/a),t.velocityY=.5*(t.distanceY/a),t.speedX=m(.5*t.speed,S(1.5*t.speed,1/h(t.velocityX)*t.speed)),void(o?t.endPanning():i?t.endZooming():t.endSwiping(s)))},o.prototype.endSwiping=function(a){var t=this,e=!1;t.instance.isSliding=!1,t.sliderLastPos=null,"y"==a&&50<h(t.distanceY)?(w.fancybox.animate(t.instance.current.$slide,{top:t.sliderStartPos.top+t.distanceY+150*t.velocityY,opacity:0},150),e=t.instance.close(!0,300)):"x"==a&&50<t.distanceX&&1<t.instance.group.length?e=t.instance.previous(t.speedX):"x"==a&&-50>t.distanceX&&1<t.instance.group.length&&(e=t.instance.next(t.speedX)),!1!==e||"x"!=a&&"y"!=a||t.instance.jumpTo(t.instance.current.index,150),t.$container.removeClass("fancybox-is-sliding")},o.prototype.endPanning=function(){var a,s,n,r=this;r.contentLastPos&&(!1===r.instance.current.opts.touch.momentum?(a=r.contentLastPos.left,s=r.contentLastPos.top):(a=r.contentLastPos.left+r.velocityX*r.speed,s=r.contentLastPos.top+r.velocityY*r.speed),n=r.limitPosition(a,s,r.contentStartPos.width,r.contentStartPos.height),n.width=r.contentStartPos.width,n.height=r.contentStartPos.height,w.fancybox.animate(r.$content,n,330))},o.prototype.endZooming=function(){var n,l,d,p,u=this,a=u.instance.current,s=u.newWidth,r=u.newHeight;u.contentLastPos&&(n=u.contentLastPos.left,l=u.contentLastPos.top,p={top:l,left:n,width:s,height:r,scaleX:1,scaleY:1},w.fancybox.setTranslate(u.$content,p),s<u.canvasWidth&&r<u.canvasHeight?u.instance.scaleToFit(150):s>a.width||r>a.height?u.instance.scaleToActual(u.centerPointStartX,u.centerPointStartY,150):(d=u.limitPosition(n,l,s,r),w.fancybox.setTranslate(u.content,w.fancybox.getTranslate(u.$content)),w.fancybox.animate(u.$content,d,150)))},o.prototype.onTap=function(a){var t,n=this,o=w(a.target),p=n.instance,s=p.current,i=a&&b(a)||n.startPoints,r=i[0]?i[0].x-n.$stage.offset().left:0,l=i[0]?i[0].y-n.$stage.offset().top:0,c=function(t){var e=s.opts[t];(w.isFunction(e)&&(e=e.apply(p,[s,a])),e)&&("close"===e?p.close(n.startEvent):"toggleControls"===e?p.toggleControls(!0):"next"===e?p.next():"nextOrClose"===e?1<p.group.length?p.next():p.close(n.startEvent):"zoom"===e?"image"==s.type&&(s.isLoaded||s.$ghost)&&(p.canPan()?p.scaleToFit():p.isScaledDown()?p.scaleToActual(r,l):2>p.group.length&&p.close(n.startEvent)):void 0)};if(!(a.originalEvent&&2==a.originalEvent.button||p.isSliding||r>o[0].clientWidth+o.offset().left)){if(o.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))t="Outside";else if(o.is(".fancybox-slide"))t="Slide";else{if(!p.current.$content||!p.current.$content.has(a.target).length)return;t="Content"}if(n.tapped){if(clearTimeout(n.tapped),n.tapped=null,50<h(r-n.tapX)||50<h(l-n.tapY)||p.isSliding)return this;c("dblclick"+t)}else n.tapX=r,n.tapY=l,s.opts["dblclick"+t]&&s.opts["dblclick"+t]!==s.opts["click"+t]?n.tapped=setTimeout(function(){n.tapped=null,c("click"+t)},300):c("click"+t);return this}},w(p).on("onActivate.fb",function(a,t){t&&!t.Guestures&&(t.Guestures=new o(t))}),w(p).on("beforeClose.fb",function(a,t){t&&t.Guestures&&t.Guestures.destroy()})}(window,document,window.jQuery),function(l,t){"use strict";var a=function(e){this.instance=e,this.init()};t.extend(a.prototype,{timer:null,isActive:!1,$button:null,speed:3e3,init:function(){var e=this;e.$button=e.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){e.toggle()}),(2>e.instance.group.length||!e.instance.group[e.instance.currIndex].opts.slideShow)&&e.$button.hide()},set:function(){var e=this;e.instance&&e.instance.current&&(e.instance.current.opts.loop||e.instance.currIndex<e.instance.group.length-1)?e.timer=setTimeout(function(){e.instance.next()},e.instance.current.opts.slideShow.speed||e.speed):(e.stop(),e.instance.idleSecondsCounter=0,e.instance.showControls())},clear:function(){var e=this;clearTimeout(e.timer),e.timer=null},start:function(){var a=this,t=a.instance.current;a.instance&&t&&(t.opts.loop||t.index<a.instance.group.length-1)&&(a.isActive=!0,a.$button.attr("title",t.opts.i18n[t.opts.lang].PLAY_STOP).addClass("fancybox-button--pause"),t.isComplete&&a.set())},stop:function(){var a=this,t=a.instance.current;a.clear(),a.$button.attr("title",t.opts.i18n[t.opts.lang].PLAY_START).removeClass("fancybox-button--pause"),a.isActive=!1},toggle:function(){var e=this;e.isActive?e.stop():e.start()}}),t(l).on({"onInit.fb":function(s,t){t&&!t.SlideShow&&(t.SlideShow=new a(t))},"beforeShow.fb":function(a,t,e,s){var n=t&&t.SlideShow;s?n&&e.opts.slideShow.autoStart&&n.start():n&&n.isActive&&n.clear()},"afterShow.fb":function(a,t){var e=t&&t.SlideShow;e&&e.isActive&&e.set()},"afterKeydown.fb":function(e,n,o,i,a){var s=n&&n.SlideShow;s&&o.opts.slideShow&&(80===a||32===a)&&!t(l.activeElement).is("button,a,input")&&(i.preventDefault(),s.toggle())},"beforeClose.fb onDeactivate.fb":function(a,t){var e=t&&t.SlideShow;e&&e.stop()}}),t(l).on("visibilitychange",function(){var e=t.fancybox.getInstance(),a=e&&e.SlideShow;a&&a.isActive&&(l.hidden?a.clear():a.set())})}(document,window.jQuery),function(s,a){"use strict";var t=function(){var t,r,l,c=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i={};for(r=0;r<c.length;r++)if(t=c[r],t&&t[1]in s){for(l=0;l<t.length;l++)i[c[0][l]]=t[l];return i}return!1}();if(!t)return void(a&&a.fancybox&&(a.fancybox.defaults.btnTpl.fullScreen=!1));var r={request:function(a){a=a||s.documentElement,a[t.requestFullscreen](a.ALLOW_KEYBOARD_INPUT)},exit:function(){s[t.exitFullscreen]()},toggle:function(t){t=t||s.documentElement,this.isFullscreen()?this.exit():this.request(t)},isFullscreen:function(){return!!s[t.fullscreenElement]},enabled:function(){return!!s[t.fullscreenEnabled]}};a(s).on({"onInit.fb":function(a,t){var e,s=t.$refs.toolbar.find("[data-fancybox-fullscreen]");t&&!t.FullScreen&&t.group[t.currIndex].opts.fullScreen?(e=t.$refs.container,e.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(a){a.stopPropagation(),a.preventDefault(),r.toggle(e[0])}),t.opts.fullScreen&&!0===t.opts.fullScreen.autoStart&&r.request(e[0]),t.FullScreen=r):s.hide()},"afterKeydown.fb":function(a,t,e,s,n){t&&t.FullScreen&&70===n&&(s.preventDefault(),t.FullScreen.toggle(t.$refs.container[0]))},"beforeClose.fb":function(e){e&&e.FullScreen&&r.exit()}}),a(s).on(t.fullscreenchange,function(){var e=a.fancybox.getInstance();e.current&&"image"===e.current.type&&e.isAnimating&&(e.current.$content.css("transition","none"),e.isAnimating=!1,e.update(!0,!0,0)),e.trigger("onFullscreenChange",r.isFullscreen())})}(document,window.jQuery),function(a,l){"use strict";var e=Math.floor,c=Math.min,d=function(e){this.instance=e,this.init()};l.extend(d.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,init:function(){var a=this,t=a.instance.group[0],e=a.instance.group[1];a.$button=a.instance.$refs.toolbar.find("[data-fancybox-thumbs]"),1<a.instance.group.length&&a.instance.group[a.instance.currIndex].opts.thumbs&&("image"==t.type||t.opts.thumb||t.opts.$thumb)&&("image"==e.type||e.opts.thumb||e.opts.$thumb)?(a.$button.on("click",function(){a.toggle()}),a.isActive=!0):(a.$button.hide(),a.isActive=!1)},create:function(){var a,s,i=this.instance;this.$grid=l("<div class=\"fancybox-thumbs\"></div>").appendTo(i.$refs.container),a="<ul>",l.each(i.group,function(t,e){s=e.opts.thumb||(e.opts.$thumb?e.opts.$thumb.attr("src"):null),s||"image"!==e.type||(s=e.src),s&&s.length&&(a+="<li data-index=\""+t+"\" tabindex=\"0\" class=\"fancybox-thumbs-loading\"><img data-src=\""+s+"\" /></li>")}),a+="</ul>",this.$list=l(a).appendTo(this.$grid).on("click","li",function(){i.jumpTo(l(this).data("index"))}),this.$list.find("img").hide().one("load",function(){var d,p,u,f,g=l(this).parent().removeClass("fancybox-thumbs-loading"),a=g.outerWidth(),s=g.outerHeight();d=this.naturalWidth||this.width,p=this.naturalHeight||this.height,u=d/a,f=p/s,1<=u&&1<=f&&(u>f?(d/=f,p=s):(d=a,p/=u)),l(this).css({width:e(d),height:e(p),"margin-top":c(0,e(.3*s-.3*p)),"margin-left":c(0,e(.5*a-.5*d))}).show()}).each(function(){this.src=l(this).data("src")})},focus:function(){this.instance.current&&this.$list.children().removeClass("fancybox-thumbs-active").filter("[data-index=\""+this.instance.current.index+"\"]").addClass("fancybox-thumbs-active").focus()},close:function(){this.$grid.hide()},update:function(){this.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),this.isVisible?(this.$grid||this.create(),this.instance.trigger("onThumbsShow"),this.focus()):this.$grid&&this.instance.trigger("onThumbsHide"),this.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),l(a).on({"onInit.fb":function(a,t){t&&!t.Thumbs&&(t.Thumbs=new d(t))},"beforeShow.fb":function(a,t,e,s){var n=t&&t.Thumbs;if(n&&n.isActive){if(e.modal)return n.$button.hide(),void n.hide();s&&!0===t.opts.thumbs.autoStart&&n.show(),n.isVisible&&n.focus()}},"afterKeydown.fb":function(s,t,e,n,o){var i=t&&t.Thumbs;i&&i.isActive&&71===o&&(n.preventDefault(),i.toggle())},"beforeClose.fb":function(a,t){var e=t&&t.Thumbs;e&&e.isVisible&&!1!==t.opts.thumbs.hideOnClose&&e.close()}})}(document,window.jQuery),function(d,p,f){"use strict";function l(){var e=p.location.hash.substr(1),t=e.split("-"),a=1<t.length&&/^\+?\d+$/.test(t[t.length-1])?parseInt(t.pop(-1),10)||1:1,s=t.join("-");return 1>a&&(a=1),{hash:e,index:a,gallery:s}}function e(s){var t;""!==s.gallery&&(t=f("[data-fancybox='"+f.escapeSelector(s.gallery)+"']").eq(s.index-1),t.length||(t=f("#"+f.escapeSelector(s.gallery))),t.length&&(a=!1,t.trigger("click")))}function g(a){var t;return!!a&&(t=a.current?a.current.opts:a.opts,t.hash||(t.$orig?t.$orig.data("fancybox"):""))}f.escapeSelector||(f.escapeSelector=function(a){var t=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;return(a+"").replace(t,function(a,t){return t?"\0"===a?"\uFFFD":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a})});var a=!0,m=null,t=null;f(function(){setTimeout(function(){!1!==f.fancybox.defaults.hash&&(f(d).on({"onInit.fb":function(a,t){var e,s;!1!==t.group[t.currIndex].opts.hash&&(e=l(),s=g(t),s&&e.gallery&&s==e.gallery&&(t.currIndex=e.index-1))},"beforeShow.fb":function(e,s,n){var o;n&&!1!==n.opts.hash&&(o=g(s),o&&""!==o&&(0>p.location.hash.indexOf(o)&&(s.opts.origHash=p.location.hash),m=o+(1<s.group.length?"-"+(n.index+1):""),"replaceState"in p.history?(t&&clearTimeout(t),t=setTimeout(function(){p.history[a?"pushState":"replaceState"]({},d.title,p.location.pathname+p.location.search+"#"+m),t=null,a=!1},300)):p.location.hash=m))},"beforeClose.fb":function(e,a,n){var s,o;t&&clearTimeout(t),!1!==n.opts.hash&&(s=g(a),o=a&&a.opts.origHash?a.opts.origHash:"",s&&""!==s&&("replaceState"in history?p.history.replaceState({},d.title,p.location.pathname+p.location.search+o):(p.location.hash=o,f(p).scrollTop(a.scrollTop).scrollLeft(a.scrollLeft))),m=null)}}),f(p).on("hashchange.fb",function(){var a=l();f.fancybox.getInstance()?!m||m===a.gallery+"-"+a.index||1===a.index&&m==a.gallery||(m=null,f.fancybox.close()):""!==a.gallery&&e(a)}),e(l()))},50)})}(document,window,window.jQuery),"use strict";function misc(){return{init:function(){$("[data-fancybox]").fancybox({keyboard:!1,clickSlide:"false",touch:{vertical:!1,momentum:!1}})}}}function homeSwiper(){return{init:function(){var e=new Swiper(".s1",{pagination:{el:".swiper-pagination",clickable:!0},paginationHide:!1,a11y:{prevSlideMessage:"Previous tug",nextSlideMessage:"Next tug"},keyboard:{enabled:!0,onlyInViewport:!1},loop:!0});e.on("slideChange",function(){0==this.activeIndex?changeInfo1():1==this.activeIndex?changeInfo2():2==this.activeIndex?changeInfo3():3==this.activeIndex?changeInfo4():4==this.activeIndex&&changeInfo5()});new Swiper(".s2",{pagination:{el:".swiper-pagination-mobile"},paginationHide:!1,onSlideChangeStart:function(){console.log("wow")},breakpoints:{991:{slidesPerView:1}}})}}}function voteForm(){function e(){$(".tug-vote-form-btn").on("click",function(){$(".tug-vote-form-btn").css("display","none"),$(".tug-vote-form-info p").css("display","none"),$(".tug-vote-title").css("display","none"),$(".vote-image").css("display","none"),$(".tug-vote-load").css("display","block");this;$.ajax({url:"/"+$(this).attr("data-post-userID")+"/tugs/add_response/"+$(this).attr("data-tug-id"),type:"POST",data:{postID:$(this).attr("data-tug-id"),userID:$(this).attr("data-userID"),postUserID:$(this).attr("data-post-userID"),responseUserID:$(this).attr("data-response-userID"),postOption:$(this).attr("data-tug-option"),postType:$(this).attr("data-tug-type"),link:$(this).attr("data-tug-link"),csrf_test_name:$(this).attr("csrf_test_name"),numberOfOptions:$(this).attr("data-numberOfOptions"),ifVote:"1"},success:function(e){$(".tug-vote-load").css("display","none"),$("#tug-vote-form .success-message").css("display","block"),$("#tug-"+e.tugID+" .tug-vote-icon").css("color","#b11515"),$("#tug-"+e.tugID+" .tug-vote-img").css("pointer-events","none")}})})}return{init:function(){$(".tug-vote-img").on("click",function(){$(".tug-vote-form-btn").css("display","block"),$(".tug-vote-form-info p").css("display","block"),$(".tug-vote-title").css("display","block"),$(".vote-image").css("display","block"),$("#tug-vote-form .success-message").css("display","none"),$(".tug-vote-option").html("\""+$(this).attr("data-caption")+"\""),$(".tug-vote-title").html($(this).attr("data-tug-title")),$(".tug-vote-title").attr("href",$(this).attr("data-tug-link")),$(".vote-image").css("background-image","url(\""+$(this).find("img").attr("src")+"\")"),$(".tug-vote-form-btn").attr("data-tug-id",$(this).attr("data-tug-id")),$(".tug-vote-form-btn").attr("data-tug-option",$(this).attr("data-tug-option")),$(".tug-vote-form-btn").attr("data-post-userID",$(this).attr("data-post-userID")),$(".tug-vote-form-btn").attr("data-tug-link",$(this).attr("data-tug-link")),$(".tug-vote-form-btn").attr("data-numberOfOptions",$(this).attr("data-numberOfOptions")),$(".fancybox-arrow").css("display","none"),e()})}}}function registerValidateJquery(){return{init:function(){$("#name-in-first").keyup(function(){firstNameValidate()}),$("#name-in-last").keyup(function(){lastNameValidate()}),$("#username").keyup(function(){usernameValidate()}),$("#email-in").keyup(function(){emailValidate()}),$("#password-in").keyup(function(){passwordValidate()}),$("#cpassword-in").keyup(function(){cPasswordValidate()})}}}function registerValidate(){return window.valid=!1,{init:function(){Vue.use(VeeValidate),Vue.use(VueRecaptcha);new Vue({el:"#register-app",components:{"vue-recaptcha":VueRecaptcha},data:{emailErrors:[],passwordErrors:[],firstName:null,lastName:null,username:null,email:null,password:null,password2:null,status:null,location:null,CSRF:$("#csrf_test_name").attr("data-CSRF"),postErrors:[],successMessage:[]},methods:{submit:function(){$("#sign-up-btn").html("<i class=\"fas fa-spinner fa-spin\"></i>"),this.status="submitting",this.validateBeforeSubmit(),!0==window.valid?this.$refs.recaptcha.execute():(this.status="not-submitting",$("#sign-up-btn").html("Register"))},onCaptchaVerified:function(e){var t=this;console.log(t),t.status="submitting",console.log("test"),$.ajax({url:"/register",type:"POST",data:{first_name:t.firstName,last_name:t.lastName,username:t.username,email:t.email,password:t.password,password2:t.password2,captcha:"true",csrf_test_name:t.CSRF,location:t.location,recaptcha:e},success:function(){$("#register-form").css("display","none"),t.successMessage="You are all signed up! Check your email for the verify message! Enjoy tugging!"},error:function(e){t.postErrors=e.responseJSON.error,$("#sign-up-btn").html("Register"),this.status="not-submitting"}}),t.$refs.recaptcha.reset()},onCaptchaExpired:function(){$("#sign-up-btn").html("Register"),this.status="not-submitting",this.$refs.recaptcha.reset()},validateBeforeSubmit:function(){this.status="submitting",this.$validator.validateAll().then(function(e){!0==e?window.valid=!0:this.status=null})["catch"](function(){window.valid=!1})}}})}}}function loginValidate(){return window.valid=!1,{init:function(){Vue.use(VeeValidate),app=new Vue({el:"#loginForm",data:{email:null,pass:null,CSRF:$("#csrf_test_name").attr("data-CSRF"),postErrors:[],successMessage:[],status:null},methods:{submit:function(){$(".login-btn").html("<i class=\"fas fa-spinner fa-spin\"></i>");var e=this;this.status="submitting",this.$validator.validateAll().then(function(t){!0==t?(e.status="submitting",$.ajax({url:"/login/pro",type:"POST",data:{email:e.email,pass:e.pass,csrf_test_name:e.CSRF},success:function(){window.open("/tugs","_self")},error:function(t){e.postErrors=t.responseJSON.error,$(".login-btn").html("Login"),e.status="not-submitting"}})):this.status=null})["catch"](function(){window.valid=!1})}}})}}}function forgotPWValidate(){return window.valid=!1,{init:function(){Vue.use(VeeValidate),app=new Vue({el:"#forgotPWForm",data:{email:null,CSRF:$("#csrf_test_name").attr("data-CSRF"),postErrors:[],successMessage:[],status:null},methods:{submit:function(){$(".fpw-btn").html("<i class=\"fas fa-spinner fa-spin\"></i>"),this.status="submitting",this.forgotPWValidate(),!0==window.valid?this.forgotPWRequest():(this.status="not-submitting",$(".fpw-btn").html("Request Password Change"))},forgotPWRequest:function(){var e=this;console.log(e),e.status="submitting",console.log("test"),$.ajax({url:"/login/forgotpw_pro",type:"POST",data:{email:e.email,csrf_test_name:e.CSRF},success:function(){$(".forgotPWForm").css("display","none"),$(".forgotpw-msg").html("Congrats, you did it! Your requested was submitted and you should receive an email soon to reset your password!")},error:function(t){e.postErrors=t.responseJSON.error,$(".fpw-btn").html("Login"),e.status="not-submitting"}})},forgotPWValidate:function(){this.status="submitting",this.$validator.validateAll().then(function(e){!0==e?window.valid=!0:this.status=null})["catch"](function(){window.valid=!1})}}})}}}function responseScripts(){return{init:function(){$(".response-option-comment-popup-button").on("click",function(){var e=$(this).attr("data-trigger-id");$("#"+e).toggleClass("open")}),$(".comment-form-btn").on("click",function(){var e=$(this).attr("data-comment");$("#"+e).hasClass("comment-toggle")?($("#"+e).removeClass("comment-toggle"),$(this).attr("aria-pressed","false")):($("#"+e).addClass("comment-toggle"),$("#"+e+" textarea").focus(),$(this).attr("aria-pressed","true"))}),$(".comment-form-btn").keydown(function(t){if("13"==t.which){var e=$(this).attr("data-comment");$("#"+e).hasClass("comment-toggle")?($("#"+e).removeClass("comment-toggle"),$(this).attr("aria-pressed","false")):($("#"+e).addClass("comment-toggle"),$("#"+e+" textarea").focus(),$(this).attr("aria-pressed","true"))}}),$(".profile-link").on("click",function(){window.open($(this).attr("data-link"),"_self")}),$(".comment-reply").on("click",function(){$(".tug-comment-textarea").val("@"+$(this).attr("data-user")+"...")})}}}function commentLikes(){function e(){$(".unfav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/unlike",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(a){a.numberOfLikes=parseInt(a.numberOfLikes)-1,$(e).replaceWith("<button data-csrf=\""+a.csrf_token+"\" data-tugID=\""+a.tugID+"\" data-uID=\""+a.userID+"\" data-user=\""+a.username+"\" data-pUID=\""+a.pUID+"\" data-likes=\""+a.numberOfLikes+"\" data-link=\""+a.link+"\" class=\"fav-button\"><i class=\"fas fa-heart\"></i> "+a.numberOfLikes+"\n</button>"),t()}})})}function t(){$(".fav-button").on("click",function(){var t=this;$.ajax({url:"/tugs/add_like",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(a){a.numberOfLikes=parseInt(a.numberOfLikes)+1,$(t).replaceWith("<button data-csrf=\""+a.csrf_token+"\" data-tugID=\""+a.tugID+"\" data-uID=\""+a.userID+"\" data-user=\""+a.username+"\" data-pUID=\""+a.pUID+"\" data-likes=\""+a.numberOfLikes+"\" data-link=\""+a.link+"\" class=\"unfav-button\"><i class=\"fas fa-heart\"></i> "+a.numberOfLikes+"\n</button>"),e()}})})}return{init:function(){$(".fav-button").on("click",function(){var t=this;$.ajax({url:"/response/comment_add_like",type:"POST",data:{commentID:$(this).attr("data-tugID"),commentUserID:$(this).attr("data-pUID"),likeUserID:$(this).attr("data-uID"),likeUser:$(this).attr("data-user"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(a){a.numberOfLikes=parseInt(a.numberOfLikes)+1,$(t).replaceWith("<button data-csrf=\""+a.csrf_token+"\" data-tugID=\""+a.tugID+"\" data-uID=\""+a.userID+"\" data-user=\""+a.username+"\" data-pUID=\""+a.pUID+"\" data-likes=\""+a.numberOfLikes+"\" data-link=\""+a.link+"\" class=\"unfav-button\"><i class=\"fas fa-heart\"></i> "+a.numberOfLikes+"\n</button>"),e()}})}),$(".unfav-button").on("click",function(){var e=this;$.ajax({url:"/tugs/unlike",type:"POST",data:{questionID:$(this).attr("data-tugID"),userID:$(this).attr("data-uID"),postUserID:$(this).attr("data-pUID"),username:$(this).attr("data-user"),link:$(this).attr("data-link"),csrf_test_name:$(this).attr("data-csrf"),numberOfLikes:$(this).attr("data-likes")},success:function(a){a.numberOfLikes=parseInt(a.numberOfLikes)-1,$(e).replaceWith("<button data-csrf=\""+a.csrf_token+"\" data-tugID=\""+a.tugID+"\" data-uID=\""+a.userID+"\" data-user=\""+a.username+"\" data-pUID=\""+a.pUID+"\" data-likes=\""+a.numberOfLikes+"\" data-link=\""+a.link+"\" class=\"fav-button\"><i class=\"fas fa-heart\"></i> "+a.numberOfLikes+"\n</button>"),t()}})})}}}function autoExpand(){return{init:function(){$(document).one("focus.autoExpand","textarea.autoExpand",function(){var e=this.value;this.value="",this.baseScrollHeight=this.scrollHeight,this.value=e}).on("input.autoExpand","textarea.autoExpand",function(){var e,t=0|this.getAttribute("data-min-rows");this.rows=t,e=Math.ceil((this.scrollHeight-this.baseScrollHeight)/16),this.rows=t+e})}}}function profile(){function e(){var e=document.URL,t=e.substring(e.indexOf("#"));$(".nav-pills").find("li a").each(function(e,a){t==$(a).attr("href")&&$(a).click(),$(a).click(function(){location.hash=$(this).attr("href")})})}function t(){app=new Vue({el:"#profile-requests",data:{followerRequests:window.followRequests,status:"",rqNm:"request-"},methods:{confirmRequest:function(t,e){var a=this,s=new FormData;s.append("requestID",this.followerRequests[e].requestID),s.append("requestedUserID",this.followerRequests[e].requestedUserID),s.append("userID",this.followerRequests[e].userID),s.append("csrf_test_name",this.followerRequests[e].CSRF),s.append("status","approved"),axios.post("/profile/requestFollow",s).then(function(){this.status="approved",$("#request-"+e+" .card-body").css("height","134px"),$("#request-"+e+" .card").css("background","lightgreen"),$("#request-"+e+" .card-body").html("<span>You accepted the profile request from "+a.followerRequests[e].username+"</span>")})},deleteRequest:function(t,e){var a=this,s=new FormData;s.append("requestID",this.followerRequests[e].requestID),s.append("requestedUserID",this.followerRequests[e].requestedUserID),s.append("userID",this.followerRequests[e].userID),s.append("csrf_test_name",this.followerRequests[e].CSRF),s.append("status","rejected"),axios.post("/profile/requestFollow",s).then(function(){this.status="rejected",$("#request-"+e+" .card-body").css("height","134px"),$("#request-"+e+" .card").css("background","indianred"),$("#request-"+e+" .card-body").html("<span>You denied the profile request from "+a.followerRequests[e].username+"</span>")})}},filters:{formatDate:function(e){if(e)return moment(e+"").format("MM/DD/YYYY hh:mm")}}})}function a(){app=new Vue({el:"#profile-request",data:{postErrors:[],successMessage:[],status:null,requestInfo:window.requestInfo},methods:{request:function(){var e=this,t=new FormData;t.append("requestedUserID",this.requestInfo.requestedUserID),t.append("userID",this.requestInfo.userID),t.append("csrf_test_name",this.requestInfo.csrf_test_name),axios.post("/profile/requestFollow",t).then(function(){e.requestInfo.ifRequested=1})},cancelRequest:function(){var e=new FormData;e.append("requestedUserID",this.requestInfo.requestedUserID),e.append("userID",this.requestInfo.userID),e.append("csrf_test_name",this.requestInfo.csrf_test_name),axios.post("/profile/unrequestFollow",e).then(function(){self.requestInfo.ifRequested=0})}}})}function s(){Vue.use(VeeValidate),app=new Vue({el:"#profile-about",data:{userStatus:null,CSRF:$("#csrf_test_name").attr("data-CSRF"),postErrors:[],successMessage:[],status:null,profileInfo:window.profileInfo,editMode:!1},methods:{submit:function(){$(".login-btn").html("<i class=\"fas fa-spinner fa-spin\"></i>"),this.status="submitting",this.loginRequest()},switchMode:function(){$("body").hasClass("editMode")?($("body").removeClass("editMode"),$(".edit-btn").text("Edit Mode"),this.editMode=!1):($("body").addClass("editMode"),$(".edit-btn").text("Exit Edit Mode"),this.editMode=!0)},saveProfile:function(){var e=this;e.status="submitting";var t=new FormData;t.append("email",this.profileInfo.email),t.append("username",this.profileInfo.username),t.append("first_name",this.profileInfo.first_name),t.append("last_name",this.profileInfo.last_name),t.append("location",this.profileInfo.location),t.append("work",this.profileInfo.work),t.append("religion",this.profileInfo.religion),t.append("political_affiliation",this.profileInfo.political),t.append("education",this.profileInfo.education),t.append("aboutme",this.profileInfo.about),t.append("gender",this.profileInfo.gender),t.append("facebook",this.profileInfo.facebook),t.append("twitter",this.profileInfo.twitter),t.append("instagram",this.profileInfo.instagram),t.append("linkedin",this.profileInfo.linkedin),t.append("pinterest",this.profileInfo.pinterest),t.append("enable_email_notification",this.profileInfo.emailNot),t.append("privateProfile",this.profileInfo["private"]),t.append("csrf_test_name",this.profileInfo.csrf_test_name),axios.post("/user_settings/pro",t)},onFileSelected:function(){console.log(event.target.files),this.selectedFile=event.target.files[0]},statusValidate:function(){this.status="submitting",this.$validator.validateAll().then(function(e){!0==e?window.valid=!0:this.status=null})["catch"](function(){window.valid=!1})}}})}function n(){Vue.use(VueUploadComponent);new Vue({el:"#profileAvatar",data:{files:[],edit:!1,cropper:!1,activeSource:"",activeSrc:"test",csrf_test_name:window.csrf},components:{FileUpload:VueUploadComponent},watch:{edit:function(e){console.log(e),e?this.$nextTick(function(){if(!this.$refs.editImage)return void console.log("test");console.log("test1");var e=new Cropper(this.$refs.editImage,{viewMode:2,modal:!0});this.cropper=e}):this.cropper&&(this.cropper.destroy(),this.cropper=!1)}},methods:{getFileData:function(t){var a=[new Promise(function(a){var s=new FileReader;s.addEventListener("loadend",function(s){a({src:s.srcElement.result,filename:t.name})}),s.readAsDataURL(t.file)})];return a},editSave:function(){this.edit=!1;for(var e=this.files[0],t=atob(this.cropper.getCroppedCanvas().toDataURL(e.type).split(",")[1]),a=new Uint8Array(t.length),s=0;s<t.length;s++)a[s]=t.charCodeAt(s);var n=new File([a],e.name,{type:e.type});this.$refs.upload.update(e.id,{file:n,type:n.type,size:n.size,active:!0})},alert:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){alert(e)}),upload:function(e){var t=this;Promise.all(t.getFileData(e)).then(function(e){console.log(e);var a=new FormData;a.append("filename",e[0].filename),a.append("src",e[0].src),a.append("csrf_test_name",t.csrf_test_name),axios.post("/upload/avatar",a)})},inputFile:function(e,t){e&&!t&&this.$nextTick(function(){this.edit=!0}),!e&&t&&(this.edit=!1)},inputFilter:function(e,t,a){if(e&&!t&&!/\.(gif|jpg|jpeg|png|webp)$/i.test(e.name))return this.alert("Your choice is not a picture"),a();if(e&&(!t||e.file!==t.file)){e.url="";var s=window.URL||window.webkitURL;s&&s.createObjectURL&&(e.url=s.createObjectURL(e.file))}}},computed:{changeSrc:function(){if(this.files.length)return"background-image: url("+this.files[0].url+"); background-size: cover; background-position: center;"}}})}return{init:function(){$("#profile-about").length&&s(),$("#profile-request").length&&a(),$("#profile-requests").length&&t(),$("#profileAvatar").length&&n(),e()}}}function settings(){function e(){Vue.use(VeeValidate),app=new Vue({el:"#change-password",data:{settings:{csrf:window.csrf,status:""},data:{currentPassword:"",password1:"",password2:""}},methods:{submit:function(){var e=this;this.$validator.validateAll().then(function(t){if(console.log(t),!0==t){console.log("test");var a=new FormData;a.append("current_password",e.data.currentPassword),a.append("new_pass1",e.data.password1),a.append("new_pass2",e.data.password2),a.append("csrf_test_name",e.settings.csrf),axios.post("/user_settings/change_password_pro",a).then(function(){e.settings.status="completed"})}else e.settings.status="failed"})["catch"](function(){window.valid=!1})}}})}return{init:function(){$("#change-password").length&&e()}}}function homeMap(){function e(){window.map,window.map=new google.maps.Map(document.getElementById("map"),{center:{lat:50,lng:0},zoom:3,streetViewControl:!1,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP]},styles:[{elementType:"geometry",stylers:[{color:"#f5f5f5"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{elementType:"labels.text.stroke",stylers:[{color:"#f5f5f5"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#bdbdbd"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#dadada"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"water",stylers:[{color:"#000000"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#c9c9c9"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]}]});var t=new google.maps.LatLngBounds(new google.maps.LatLng(-68,180),new google.maps.LatLng(80,170));google.maps.event.addListener(e,"bounds_changed",function(){if(!t.contains(e.getCenter())){var a=e.getCenter(),s=a.lng(),n=a.lat(),o=t.getNorthEast().lng(),i=t.getNorthEast().lat(),r=t.getSouthWest().lng(),l=t.getSouthWest().lat();s<r&&(s=r),s>o&&(s=o),n<l&&(n=l),n>i&&(n=i),e.setCenter(new google.maps.LatLng(n,s))}}),google.maps.event.addListener(e,"zoom_changed",function(){e.getZoom()<3&&e.setZoom(3)})}function t(){Vue.use(VueAwesomeSwiper),console.log(window.startPos),new Vue({el:"#swiper-home",components:{LocalSwiper:VueAwesomeSwiper.swiper,LocalSlide:VueAwesomeSwiper.swiperSlide},data:{data:{tugData:window.tugData,map:window.map,markers:[],locationData:{}},settings:{currentSlide:[],currentSlideIndex:0,option1Marker:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",fillColor:"#B11515",fillOpacity:1,anchor:new google.maps.Point(0,0),strokeWeight:0,scale:.15},option2Marker:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",fillColor:"#294DFF",fillOpacity:1,anchor:new google.maps.Point(0,0),strokeWeight:0,scale:.15},option3Marker:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",fillColor:"#EEDC20",fillOpacity:1,anchor:new google.maps.Point(0,0),strokeWeight:0,scale:.15},option4Marker:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",fillColor:"#1EE946",fillOpacity:1,anchor:new google.maps.Point(0,0),strokeWeight:0,scale:.15},option5Marker:{path:"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",fillColor:"#FF8820",fillOpacity:1,anchor:new google.maps.Point(0,0),strokeWeight:0,scale:.15},selectedOption:{},voteSuccess:!1},swiperOptionA:{pagination:{el:".swiper-pagination"},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}}},computed:{swiperA:function(){return this.$refs.awesomeSwiperA.swiper}},methods:{setLocation:function(){console.log(window.GlobalVar)},onSetTranslate:function(){},changeInfo:function(e,t){var a=this;this.clearMarkers(),this.deleteMarkers(),$.getJSON("/"+e+"/tugs/locations/"+t,function(e){$.each(e,function(){a.addMarker(this.lat,this.lng,this.option)})})},clearMarkers:function(){this.setMapOnAll(null)},setMapOnAll:function(e){for(var t=this,a=0;a<t.data.markers.length;a++)t.data.markers[a].setMap(e)},openTugVote:function(e){var t=this;0==t.settings.currentSlide.numberOfVotes&&(t.settings.selectedOption={option:t.settings.currentSlide["postOption"+e],tugQuestion:t.settings.currentSlide.postQues,picture:t.settings.currentSlide["postpicture"+e],optionID:e,tugID:t.settings.currentSlide.postID},$.fancybox.open({src:"#vote-on-tug",type:"inline",opts:{beforeShow:function(){console.info("done!")}}}))},deleteMarkers:function(){this.clearMarkers(),this.data.markers=[]},initMap:function(e,t){var a=this;$.getJSON("/"+e+"/tugs/locations/"+t,function(e){$.each(e,function(){a.addMarker(this.lat,this.lng,this.option)})})},addMarker:function(e,t,a){var s=new google.maps.LatLng(e,t);if("Option1"==a){var n=new google.maps.Marker({position:s,map:this.data.map,draggable:!1,icon:this.settings.option1Marker,zIndex:-20,optimized:!1});this.data.markers.push(n)}else if("Option2"==a){var o=new google.maps.Marker({position:s,map:this.data.map,draggable:!1,icon:this.settings.option2Marker,zIndex:-20,optimized:!1});this.data.markers.push(o)}else if("Option3"==a){var i=new google.maps.Marker({position:s,map:this.data.map,draggable:!1,icon:this.settings.option3Marker,zIndex:-20,optimized:!1});this.data.markers.push(i)}else if("Option4"==a){var r=new google.maps.Marker({position:s,map:this.data.map,draggable:!1,icon:this.settings.option4Marker,zIndex:-20,optimized:!1});this.data.markers.push(r)}else if("Option5"==a){var l=new google.maps.Marker({position:s,map:this.data.map,draggable:!1,icon:this.settings.option5Marker,zIndex:-20,optimized:!1});this.data.markers.push(l)}},onSlideChange:function(){this.settings.currentSlide=null,this.settings.currentSlideIndex=null,this.settings.currentSlide=this.data.tugData[this.swiperA.activeIndex],this.settings.currentSlideIndex=this.swiperA.activeIndex,this.changeInfo(this.settings.currentSlide.postUserID,this.settings.currentSlide.postID)},numberOfOptions:function(e){var t=this.data.tugData[e];if(null==t.postOption3)return 2;return null==t.postOption4?3:null==t.postOption5?4:null==t.postOption5?void 0:5},getStyle:function(e,t){return"background-image: url(/uploads/"+t+"); background-position: center; width: calc(100% / "+this.numberOfOptions(e)+");"},getSelectedStyle:function(e){return"background-image: url(/uploads/"+e+"); border-left: 15px solid #ffffff; border-right: 15px solid #ffffff; background-position: center; width: 200px; height: 300px; background-repeat: no-repeat; background-size: cover;"},placeVote:function(){$("#vote-on-tug btn").html("<i class=\"fas fa-spinner fa-spin\"></i>");var e=this,t=new FormData;t.append("csrf_test_name",window.csrf),t.append("option",e.settings.selectedOption.option),t.append("optionID",e.settings.selectedOption.optionID),t.append("tugID",e.settings.selectedOption.tugID),t.append("lat",e.data.locationData.lat),t.append("long",e.data.locationData.long),axios.post("/response/addVote",t).then(function(t){t.data.status?e.settings.voteSuccess=!0:e.settings.voteError="There was an error placing your vote, did you vote on this already?"})}},filters:{formatDate:function(e){return moment(e).format("MMM DD, YYYY")}},mounted:function(){var e=this;this.settings.currentSlide=this.data.tugData[this.swiperA.activeIndex],this.initMap(this.settings.currentSlide.postUserID,this.settings.currentSlide.postID),navigator.geolocation.getCurrentPosition(function(t){var a={lat:t.coords.latitude,long:t.coords.longitude};e.data.locationData=a})}})}function a(){$("[data-toggle=\"popover\"]").popover(),$("[data-toggle=\"popover\"]").click(),$("[data-toggle=\"popover\"]").on("click",function(){$(this).unbind()})}return{init:function(){e(),t(),a()}}}function supportForm(){function e(){return{input:{firstName:"",lastName:"",subject:"",message:"",csrf_test_name:window.csrf},settings:{status:"",error:"",messageErrors:!1,siteKey:"6Lce_rgUAAAAALh1NMFlK83zJVApyvWGJf1CY9rL",subjectOptions:["General Inquery","Bug Report"]}}}return{init:function(){Vue.use("vue-textarea-autosize"),Vue.use(VeeValidate),app=new Vue({el:"#supportForm",data:e(),components:{VueRecaptcha:VueRecaptcha},methods:{onSubmit:function(){this.$refs.invisibleRecaptcha.execute()},onVerify:function(e){console.log("Verify: "+e)},onExpired:function(){console.log("Expired")},resetRecaptcha:function(){this.$refs.recaptcha.reset()},submitContact:function(){var e=this;this.settings.status="sending",this.$validator.validateAll().then(function(t){e.settings.messageErrors=!(""!==e.input.message),!0===t&&!1===e.settings.messageErrors?axios.post("/contact/sendMail",e.convertObjectToFormData()).then(function(t){t.data.status?e.settings.status="sent":(e.settings.status="failed",e.settings.error="Something went wrong, try again later.")}):(e.settings.status="",e.settings.error="Please correct the errors on the form.")})["catch"](function(){e.settings.status="",e.settings.error="Something went wrong, try again later."})},convertObjectToFormData:function(){var e=new FormData;for(var t in this.input)e.append(t,this.input[t]);return e}}})}}}"use strict",$(function(){setTimeout(function(){$(".emojionearea-category h1").replaceWith("<span>Test</span>")},2e3),addTabCheck().init(),platformInfo().init(),tugsPosting().init(),mobileMenu().init(),voteForm().init(),responseScripts().init(),commentLikes().init(),autoExpand().init(),$("#loginForm > input[type=\"hidden\"]:nth-child(1)").attr("data-CSRF",$("#loginForm > input[type=\"hidden\"]:nth-child(1)").val()),$("#loginForm > input[type=\"hidden\"]:nth-child(1)").attr("id","csrf_test_name"),0<$(".response-content").length&&responseSwiper().init(),0<$("#register-app").length&®isterValidate().init(),0<$("#loginForm").length&&loginValidate().init(),0<$("#forgotPWForm").length&&forgotPWValidate().init(),"home"===window.Page&&homeSwiper().init(),$("body").find(".profile")&&profile().init(),$(".update-content").length&&updatePosts().init(),$("#supportForm").length&&supportForm().init(),$("#swiper-home").length&&homeMap().init(),settings().init(),misc()}); |