/*!FullCalendarInteractionPluginv4.4.0Docs&License:https://fullcalendar.io/(c)2019AdamShaw*/(function (global, base_factory) { typeof exports === 'object' && typeof module !== 'undefined' ? base_factory(exports, require('@fullcalendar/core')):typeofdefine==='function'&&define.amd?define(['exports','@fullcalendar/core'],base_factory):(global=global||self,base_factory(global.FullCalendarInteraction={},global.FullCalendar));}(this,function(exports,core){'use strict';/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0THISCODEISPROVIDEDONAN*ASIS*BASIS,WITHOUTWARRANTIESORCONDITIONSOFANYKIND,EITHEREXPRESSORIMPLIED,INCLUDINGWITHOUTLIMITATIONANYIMPLIEDWARRANTIESORCONDITIONSOFTITLE,FITNESSFORAPARTICULARPURPOSE,MERCHANTABLITYORNON-INFRINGEMENT.SeetheApacheVersion2.0LicenseforspecificlanguagegoverningpermissionsandlimitationsundertheLicense.******************************************************************************/ /*globalReflect,Promise*/ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf ||({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; core.config.touchMouseIgnoreWait = 500; var ignoreMouseDepth = 0; var listenerCnt = 0; var isWindowTouchMoveCancelled = false; /*Usesa"pointer"abstraction,whichmonitorsUIeventsforbothmouseandtouch.Trackswhenthepointer"drags"onacertainelement,meaningdown+move+up.Also,tracksiftherewastouch-scrolling.Also,canpreventtouch-scrollingfromhappening.Also,canfirepointermoveeventswhenscrollinghappensunderneath,evenwhennorealpointermovement.emits:-pointerdown-pointermove-pointerup*/ var PointerDragging = /**@class*/ (function () { function PointerDragging(containerEl) { var _this = this; this.subjectEl = null; this.downEl = null; //optionsthatcanbedirectlyassignedbycallerthis.selector='';// will cause subjectEl in all emitted events to be this elementthis.handleSelector='';this.shouldIgnoreMove=false;this.shouldWatchScroll=true;// for simulating pointermove on scroll// internal statesthis.isDragging=false;this.isTouchDragging=false;this.wasTouchScroll=false;// Mouse// ----------------------------------------------------------------------------------------------------this.handleMouseDown=function(ev){if(!_this.shouldIgnoreMouse()&&isPrimaryMouseButton(ev)&&_this.tryStart(ev)){varpev=_this.createEventFromMouse(ev,true);_this.emitter.trigger('pointerdown',pev);_this.initScrollWatch(pev);if(!_this.shouldIgnoreMove){document.addEventListener('mousemove',_this.handleMouseMove);}document.addEventListener('mouseup',_this.handleMouseUp);}};this.handleMouseMove=function(ev){varpev=_this.createEventFromMouse(ev);_this.recordCoords(pev);_this.emitter.trigger('pointermove',pev);};this.handleMouseUp=function(ev){document.removeEventListener('mousemove',_this.handleMouseMove);document.removeEventListener('mouseup',_this.handleMouseUp);_this.emitter.trigger('pointerup',_this.createEventFromMouse(ev));_this.cleanup();// call last so that pointerup has access to props};// Touch// ----------------------------------------------------------------------------------------------------this.handleTouchStart=function(ev){if(_this.tryStart(ev)){_this.isTouchDragging=true;varpev=_this.createEventFromTouch(ev,true);_this.emitter.trigger('pointerdown',pev);_this.initScrollWatch(pev);// unlike mouse, need to attach to target, not document// https://stackoverflow.com/a/45760014vartarget=ev.target;if(!_this.shouldIgnoreMove){target.addEventListener('touchmove',_this.handleTouchMove);}target.addEventListener('touchend',_this.handleTouchEnd);target.addEventListener('touchcancel',_this.handleTouchEnd);// treat it as a touch end// attach a handler to get called when ANY scroll action happens on the page.// this was impossible to do with normal on/off because 'scroll' doesn't bubble.// http://stackoverflow.com/a/32954565/96342window.addEventListener('scroll',_this.handleTouchScroll,true// useCapture);}};this.handleTouchMove=function(ev){varpev=_this.createEventFromTouch(ev);_this.recordCoords(pev);_this.emitter.trigger('pointermove',pev);};this.handleTouchEnd=function(ev){if(_this.isDragging){// done to guard against touchend followed by touchcancelvartarget=ev.target;target.removeEventListener('touchmove',_this.handleTouchMove);target.removeEventListener('touchend',_this.handleTouchEnd);target.removeEventListener('touchcancel',_this.handleTouchEnd);window.removeEventListener('scroll',_this.handleTouchScroll,true);// useCaptured=true_this.emitter.trigger('pointerup',_this.createEventFromTouch(ev));_this.cleanup();// call last so that pointerup has access to props_this.isTouchDragging=false;startIgnoringMouse();}};this.handleTouchScroll=function(){_this.wasTouchScroll=true;};this.handleScroll=function(ev){if(!_this.shouldIgnoreMove){varpageX=(window.pageXOffset-_this.prevScrollX)+_this.prevPageX;varpageY=(window.pageYOffset-_this.prevScrollY)+_this.prevPageY;_this.emitter.trigger('pointermove',{origEvent:ev,isTouch:_this.isTouchDragging,subjectEl:_this.subjectEl,pageX:pageX,pageY:pageY,deltaX:pageX-_this.origPageX,deltaY:pageY-_this.origPageY});}};this.containerEl=containerEl;this.emitter=newcore.EmitterMixin();containerEl.addEventListener('mousedown',this.handleMouseDown);containerEl.addEventListener('touchstart',this.handleTouchStart,{passive:true});listenerCreated();}PointerDragging.prototype.destroy=function(){this.containerEl.removeEventListener('mousedown',this.handleMouseDown);this.containerEl.removeEventListener('touchstart',this.handleTouchStart,{passive:true});listenerDestroyed();};PointerDragging.prototype.tryStart=function(ev){varsubjectEl=this.querySubjectEl(ev);vardownEl=ev.target;if(subjectEl&&(!this.handleSelector||core.elementClosest(downEl,this.handleSelector))){this.subjectEl=subjectEl;this.downEl=downEl;this.isDragging=true;// do this first so cancelTouchScroll will workthis.wasTouchScroll=false;returntrue;}returnfalse;};PointerDragging.prototype.cleanup=function(){isWindowTouchMoveCancelled=false;this.isDragging=false;this.subjectEl=null;this.downEl=null;// keep wasTouchScroll around for later accessthis.destroyScrollWatch();};PointerDragging.prototype.querySubjectEl=function(ev){if(this.selector){returncore.elementClosest(ev.target,this.selector);}else{returnthis.containerEl;}};PointerDragging.prototype.shouldIgnoreMouse=function(){returnignoreMouseDepth||this.isTouchDragging;};// can be called by user of this class, to cancel touch-based scrolling for the current dragPointerDragging.prototype.cancelTouchScroll=function(){if(this.isDragging){isWindowTouchMoveCancelled=true;}};// Scrolling that simulates pointermoves// ----------------------------------------------------------------------------------------------------PointerDragging.prototype.initScrollWatch=function(ev){if(this.shouldWatchScroll){this.recordCoords(ev);window.addEventListener('scroll',this.handleScroll,true);// useCapture=true}};PointerDragging.prototype.recordCoords=function(ev){if(this.shouldWatchScroll){this.prevPageX=ev.pageX;this.prevPageY=ev.pageY;this.prevScrollX=window.pageXOffset;this.prevScrollY=window.pageYOffset;}};PointerDragging.prototype.destroyScrollWatch=function(){if(this.shouldWatchScroll){window.removeEventListener('scroll',this.handleScroll,true);// useCaptured=true}};// Event Normalization// ----------------------------------------------------------------------------------------------------PointerDragging.prototype.createEventFromMouse=function(ev,isFirst){vardeltaX=0;vardeltaY=0;// TODO: repeat codeif(isFirst){this.origPageX=ev.pageX;this.origPageY=ev.pageY;}else{deltaX=ev.pageX-this.origPageX;deltaY=ev.pageY-this.origPageY;}return{origEvent:ev,isTouch:false,subjectEl:this.subjectEl,pageX:ev.pageX,pageY:ev.pageY,deltaX:deltaX,deltaY:deltaY};};PointerDragging.prototype.createEventFromTouch=function(ev,isFirst){vartouches=ev.touches;varpageX;varpageY;vardeltaX=0;vardeltaY=0;// if touch coords available, prefer,// because FF would give bad ev.pageX ev.pageYif(touches&&touches.length){pageX=touches[0].pageX;pageY=touches[0].pageY;}else{pageX=ev.pageX;pageY=ev.pageY;}// TODO: repeat codeif(isFirst){this.origPageX=pageX;this.origPageY=pageY;}else{deltaX=pageX-this.origPageX;deltaY=pageY-this.origPageY;}return{origEvent:ev,isTouch:true,subjectEl:this.subjectEl,pageX:pageX,pageY:pageY,deltaX:deltaX,deltaY:deltaY};};returnPointerDragging;}());// Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)functionisPrimaryMouseButton(ev){returnev.button===0&&!ev.ctrlKey;}// Ignoring fake mouse events generated by touch// ----------------------------------------------------------------------------------------------------functionstartIgnoringMouse(){ignoreMouseDepth++;setTimeout(function(){ignoreMouseDepth--;},core.config.touchMouseIgnoreWait);}// We want to attach touchmove as early as possible for Safari// ----------------------------------------------------------------------------------------------------functionlistenerCreated(){if(!(listenerCnt++)){window.addEventListener('touchmove',onWindowTouchMove,{passive:false});}}functionlistenerDestroyed(){if(!(--listenerCnt)){window.removeEventListener('touchmove',onWindowTouchMove,{passive:false});}}functiononWindowTouchMove(ev){if(isWindowTouchMoveCancelled){ev.preventDefault();}}/* An effect in which an element follows the movement of a pointer across the screen. The moving element is a clone of some other element. Must call start + handleMove + stop. */varElementMirror=/** @class */(function(){functionElementMirror(){this.isVisible=false;// must be explicitly enabledthis.sourceEl=null;this.mirrorEl=null;this.sourceElRect=null;// screen coords relative to viewport// options that can be set directly by callerthis.parentNode=document.body;this.zIndex=9999;this.revertDuration=0;}ElementMirror.prototype.start=function(sourceEl,pageX,pageY){this.sourceEl=sourceEl;this.sourceElRect=this.sourceEl.getBoundingClientRect();this.origScreenX=pageX-window.pageXOffset;this.origScreenY=pageY-window.pageYOffset;this.deltaX=0;this.deltaY=0;this.updateElPosition();};ElementMirror.prototype.handleMove=function(pageX,pageY){this.deltaX=(pageX-window.pageXOffset)-this.origScreenX;this.deltaY=(pageY-window.pageYOffset)-this.origScreenY;this.updateElPosition();};// can be called before startElementMirror.prototype.setIsVisible=function(bool){if(bool){if(!this.isVisible){if(this.mirrorEl){this.mirrorEl.style.display='';}this.isVisible=bool;// needs to happen before updateElPositionthis.updateElPosition();// because was not updating the position while invisible}}else{if(this.isVisible){if(this.mirrorEl){this.mirrorEl.style.display='none';}this.isVisible=bool;}}};// always asyncElementMirror.prototype.stop=function(needsRevertAnimation,callback){var_this=this;vardone=function(){_this.cleanup();callback();};if(needsRevertAnimation&&this.mirrorEl&&this.isVisible&&this.revertDuration&&// if 0, transition won't work(this.deltaX||this.deltaY)// if same coords, transition won't work){this.doRevertAnimation(done,this.revertDuration);}else{setTimeout(done,0);}};ElementMirror.prototype.doRevertAnimation=function(callback,revertDuration){varmirrorEl=this.mirrorEl;varfinalSourceElRect=this.sourceEl.getBoundingClientRect();// because autoscrolling might have happenedmirrorEl.style.transition='top '+revertDuration+'ms,'+'left '+revertDuration+'ms';core.applyStyle(mirrorEl,{left:finalSourceElRect.left,top:finalSourceElRect.top});core.whenTransitionDone(mirrorEl,function(){mirrorEl.style.transition='';callback();});};ElementMirror.prototype.cleanup=function(){if(this.mirrorEl){core.removeElement(this.mirrorEl);this.mirrorEl=null;}this.sourceEl=null;};ElementMirror.prototype.updateElPosition=function(){if(this.sourceEl&&this.isVisible){core.applyStyle(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY});}};ElementMirror.prototype.getMirrorEl=function(){varsourceElRect=this.sourceElRect;varmirrorEl=this.mirrorEl;if(!mirrorEl){mirrorEl=this.mirrorEl=this.sourceEl.cloneNode(true);// cloneChildren=true// we don't want long taps or any mouse interaction causing selection/menus.// would use preventSelection(), but that prevents selectstart, causing problems.mirrorEl.classList.add('fc-unselectable');mirrorEl.classList.add('fc-dragging');core.applyStyle(mirrorEl,{position:'fixed',zIndex:this.zIndex,visibility:'',boxSizing:'border-box',width:sourceElRect.right-sourceElRect.left,height:sourceElRect.bottom-sourceElRect.top,right:'auto',bottom:'auto',margin:0});this.parentNode.appendChild(mirrorEl);}returnmirrorEl;};returnElementMirror;}());/* Is a cache for a given element's scroll information (all the info that ScrollController stores) in addition the "client rectangle" of the element.. the area within the scrollbars. The cache can be in one of two modes: - doesListening:false - ignores when the container is scrolled by someone else - doesListening:true - watch for scrolling and update the cache */varScrollGeomCache=/** @class */(function(_super){__extends(ScrollGeomCache,_super);functionScrollGeomCache(scrollController,doesListening){var_this=_super.call(this)||this;_this.handleScroll=function(){_this.scrollTop=_this.scrollController.getScrollTop();_this.scrollLeft=_this.scrollController.getScrollLeft();_this.handleScrollChange();};_this.scrollController=scrollController;_this.doesListening=doesListening;_this.scrollTop=_this.origScrollTop=scrollController.getScrollTop();_this.scrollLeft=_this.origScrollLeft=scrollController.getScrollLeft();_this.scrollWidth=scrollController.getScrollWidth();_this.scrollHeight=scrollController.getScrollHeight();_this.clientWidth=scrollController.getClientWidth();_this.clientHeight=scrollController.getClientHeight();_this.clientRect=_this.computeClientRect();// do last in case it needs cached valuesif(_this.doesListening){_this.getEventTarget().addEventListener('scroll',_this.handleScroll);}return_this;}ScrollGeomCache.prototype.destroy=function(){if(this.doesListening){this.getEventTarget().removeEventListener('scroll',this.handleScroll);}};ScrollGeomCache.prototype.getScrollTop=function(){returnthis.scrollTop;};ScrollGeomCache.prototype.getScrollLeft=function(){returnthis.scrollLeft;};ScrollGeomCache.prototype.setScrollTop=function(top){this.scrollController.setScrollTop(top);if(!this.doesListening){// we are not relying on the element to normalize out-of-bounds scroll values// so we need to sanitize ourselvesthis.scrollTop=Math.max(Math.min(top,this.getMaxScrollTop()),0);this.handleScrollChange();}};ScrollGeomCache.prototype.setScrollLeft=function(top){this.scrollController.setScrollLeft(top);if(!this.doesListening){// we are not relying on the element to normalize out-of-bounds scroll values// so we need to sanitize ourselvesthis.scrollLeft=Math.max(Math.min(top,this.getMaxScrollLeft()),0);this.handleScrollChange();}};ScrollGeomCache.prototype.getClientWidth=function(){returnthis.clientWidth;};ScrollGeomCache.prototype.getClientHeight=function(){returnthis.clientHeight;};ScrollGeomCache.prototype.getScrollWidth=function(){returnthis.scrollWidth;};ScrollGeomCache.prototype.getScrollHeight=function(){returnthis.scrollHeight;};ScrollGeomCache.prototype.handleScrollChange=function(){};returnScrollGeomCache;}(core.ScrollController));varElementScrollGeomCache=/** @class */(function(_super){__extends(ElementScrollGeomCache,_super);functionElementScrollGeomCache(el,doesListening){return_super.call(this,newcore.ElementScrollController(el),doesListening)||this;}ElementScrollGeomCache.prototype.getEventTarget=function(){returnthis.scrollController.el;};ElementScrollGeomCache.prototype.computeClientRect=function(){returncore.computeInnerRect(this.scrollController.el);};returnElementScrollGeomCache;}(ScrollGeomCache));varWindowScrollGeomCache=/** @class */(function(_super){__extends(WindowScrollGeomCache,_super);functionWindowScrollGeomCache(doesListening){return_super.call(this,newcore.WindowScrollController(),doesListening)||this;}WindowScrollGeomCache.prototype.getEventTarget=function(){returnwindow;};WindowScrollGeomCache.prototype.computeClientRect=function(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight};};// the window is the only scroll object that changes it's rectangle relative// to the document's topleft as it scrollsWindowScrollGeomCache.prototype.handleScrollChange=function(){this.clientRect=this.computeClientRect();};returnWindowScrollGeomCache;}(ScrollGeomCache));// If available we are using native "performance" API instead of "Date"// Read more about it on MDN:// https://developer.mozilla.org/en-US/docs/Web/API/PerformancevargetTime=typeofperformance==='function'?performance.now:Date.now;/* For a pointer interaction, automatically scrolls certain scroll containers when the pointer approaches the edge. The caller must call start + handleMove + stop. */varAutoScroller=/** @class */(function(){functionAutoScroller(){var_this=this;// options that can be set by callerthis.isEnabled=true;this.scrollQuery=[window,'.fc-scroller'];this.edgeThreshold=50;// pixelsthis.maxVelocity=300;// pixels per second// internal statethis.pointerScreenX=null;this.pointerScreenY=null;this.isAnimating=false;this.scrollCaches=null;// protect against the initial pointerdown being too close to an edge and starting the scrollthis.everMovedUp=false;this.everMovedDown=false;this.everMovedLeft=false;this.everMovedRight=false;this.animate=function(){if(_this.isAnimating){// wasn't cancelled between animation callsvaredge=_this.computeBestEdge(_this.pointerScreenX+window.pageXOffset,_this.pointerScreenY+window.pageYOffset);if(edge){varnow=getTime();_this.handleSide(edge,(now-_this.msSinceRequest)/1000);_this.requestAnimation(now);}else{_this.isAnimating=false;// will stop animation}}};}AutoScroller.prototype.start=function(pageX,pageY){if(this.isEnabled){this.scrollCaches=this.buildCaches();this.pointerScreenX=null;this.pointerScreenY=null;this.everMovedUp=false;this.everMovedDown=false;this.everMovedLeft=false;this.everMovedRight=false;this.handleMove(pageX,pageY);}};AutoScroller.prototype.handleMove=function(pageX,pageY){if(this.isEnabled){varpointerScreenX=pageX-window.pageXOffset;varpointerScreenY=pageY-window.pageYOffset;varyDelta=this.pointerScreenY===null?0:pointerScreenY-this.pointerScreenY;varxDelta=this.pointerScreenX===null?0:pointerScreenX-this.pointerScreenX;if(yDelta<0){this.everMovedUp=true;}elseif(yDelta>0){this.everMovedDown=true;}if(xDelta<0){this.everMovedLeft=true;}elseif(xDelta>0){this.everMovedRight=true;}this.pointerScreenX=pointerScreenX;this.pointerScreenY=pointerScreenY;if(!this.isAnimating){this.isAnimating=true;this.requestAnimation(getTime());}}};AutoScroller.prototype.stop=function(){if(this.isEnabled){this.isAnimating=false;// will stop animationfor(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];scrollCache.destroy();}this.scrollCaches=null;}};AutoScroller.prototype.requestAnimation=function(now){this.msSinceRequest=now;requestAnimationFrame(this.animate);};AutoScroller.prototype.handleSide=function(edge,seconds){varscrollCache=edge.scrollCache;varedgeThreshold=this.edgeThreshold;varinvDistance=edgeThreshold-edge.distance;varvelocity=// the closer to the edge, the faster we scroll(invDistance*invDistance)/(edgeThreshold*edgeThreshold)*// quadraticthis.maxVelocity*seconds;varsign=1;switch(edge.name){case'left':sign=-1;// falls throughcase'right':scrollCache.setScrollLeft(scrollCache.getScrollLeft()+velocity*sign);break;case'top':sign=-1;// falls throughcase'bottom':scrollCache.setScrollTop(scrollCache.getScrollTop()+velocity*sign);break;}};// left/top are relative to document topleftAutoScroller.prototype.computeBestEdge=function(left,top){varedgeThreshold=this.edgeThreshold;varbestSide=null;for(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];varrect=scrollCache.clientRect;varleftDist=left-rect.left;varrightDist=rect.right-left;vartopDist=top-rect.top;varbottomDist=rect.bottom-top;// completely within the rect?if(leftDist>=0&&rightDist>=0&&topDist>=0&&bottomDist>=0){if(topDist<=edgeThreshold&&this.everMovedUp&&scrollCache.canScrollUp()&&(!bestSide||bestSide.distance>topDist)){bestSide={scrollCache:scrollCache,name:'top',distance:topDist};}if(bottomDist<=edgeThreshold&&this.everMovedDown&&scrollCache.canScrollDown()&&(!bestSide||bestSide.distance>bottomDist)){bestSide={scrollCache:scrollCache,name:'bottom',distance:bottomDist};}if(leftDist<=edgeThreshold&&this.everMovedLeft&&scrollCache.canScrollLeft()&&(!bestSide||bestSide.distance>leftDist)){bestSide={scrollCache:scrollCache,name:'left',distance:leftDist};}if(rightDist<=edgeThreshold&&this.everMovedRight&&scrollCache.canScrollRight()&&(!bestSide||bestSide.distance>rightDist)){bestSide={scrollCache:scrollCache,name:'right',distance:rightDist};}}}returnbestSide;};AutoScroller.prototype.buildCaches=function(){returnthis.queryScrollEls().map(function(el){if(el===window){returnnewWindowScrollGeomCache(false);// false = don't listen to user-generated scrolls}else{returnnewElementScrollGeomCache(el,false);// false = don't listen to user-generated scrolls}});};AutoScroller.prototype.queryScrollEls=function(){varels=[];for(var_i=0,_a=this.scrollQuery;_i<_a.length;_i++){varquery=_a[_i];if(typeofquery==='object'){els.push(query);}else{els.push.apply(els,Array.prototype.slice.call(document.querySelectorAll(query)));}}returnels;};returnAutoScroller;}());/* Monitors dragging on an element. Has a number of high-level features: - minimum distance required before dragging - minimum wait time ("delay") before dragging - a mirror element that follows the pointer */varFeaturefulElementDragging=/** @class */(function(_super){__extends(FeaturefulElementDragging,_super);functionFeaturefulElementDragging(containerEl){var_this=_super.call(this,containerEl)||this;// options that can be directly set by caller// the caller can also set the PointerDragging's options as well_this.delay=null;_this.minDistance=0;_this.touchScrollAllowed=true;// prevents drag from starting and blocks scrolling during drag_this.mirrorNeedsRevert=false;_this.isInteracting=false;// is the user validly moving the pointer? lasts until pointerup_this.isDragging=false;// is it INTENTFULLY dragging? lasts until after revert animation_this.isDelayEnded=false;_this.isDistanceSurpassed=false;_this.delayTimeoutId=null;_this.onPointerDown=function(ev){if(!_this.isDragging){// so new drag doesn't happen while revert animation is going_this.isInteracting=true;_this.isDelayEnded=false;_this.isDistanceSurpassed=false;core.preventSelection(document.body);core.preventContextMenu(document.body);// prevent links from being visited if there's an eventual drag.// also prevents selection in older browsers (maybe?).// not necessary for touch, besides, browser would complain about passiveness.if(!ev.isTouch){ev.origEvent.preventDefault();}_this.emitter.trigger('pointerdown',ev);if(!_this.pointer.shouldIgnoreMove){// actions related to initiating dragstart+dragmove+dragend..._this.mirror.setIsVisible(false);// reset. caller must set-visible_this.mirror.start(ev.subjectEl,ev.pageX,ev.pageY);// must happen on first pointer down_this.startDelay(ev);if(!_this.minDistance){_this.handleDistanceSurpassed(ev);}}}};_this.onPointerMove=function(ev){if(_this.isInteracting){// if false, still waiting for previous drag's revert_this.emitter.trigger('pointermove',ev);if(!_this.isDistanceSurpassed){varminDistance=_this.minDistance;vardistanceSq=void0;// current distance from the origin, squaredvardeltaX=ev.deltaX,deltaY=ev.deltaY;distanceSq=deltaX*deltaX+deltaY*deltaY;if(distanceSq>=minDistance*minDistance){// use pythagorean theorem_this.handleDistanceSurpassed(ev);}}if(_this.isDragging){// a real pointer move? (not one simulated by scrolling)if(ev.origEvent.type!=='scroll'){_this.mirror.handleMove(ev.pageX,ev.pageY);_this.autoScroller.handleMove(ev.pageX,ev.pageY);}_this.emitter.trigger('dragmove',ev);}}};_this.onPointerUp=function(ev){if(_this.isInteracting){// if false, still waiting for previous drag's revert_this.isInteracting=false;core.allowSelection(document.body);core.allowContextMenu(document.body);_this.emitter.trigger('pointerup',ev);// can potentially set mirrorNeedsRevertif(_this.isDragging){_this.autoScroller.stop();_this.tryStopDrag(ev);// which will stop the mirror}if(_this.delayTimeoutId){clearTimeout(_this.delayTimeoutId);_this.delayTimeoutId=null;}}};varpointer=_this.pointer=newPointerDragging(containerEl);pointer.emitter.on('pointerdown',_this.onPointerDown);pointer.emitter.on('pointermove',_this.onPointerMove);pointer.emitter.on('pointerup',_this.onPointerUp);_this.mirror=newElementMirror();_this.autoScroller=newAutoScroller();return_this;}FeaturefulElementDragging.prototype.destroy=function(){this.pointer.destroy();};FeaturefulElementDragging.prototype.startDelay=function(ev){var_this=this;if(typeofthis.delay==='number'){this.delayTimeoutId=setTimeout(function(){_this.delayTimeoutId=null;_this.handleDelayEnd(ev);},this.delay);// not assignable to number!}else{this.handleDelayEnd(ev);}};FeaturefulElementDragging.prototype.handleDelayEnd=function(ev){this.isDelayEnded=true;this.tryStartDrag(ev);};FeaturefulElementDragging.prototype.handleDistanceSurpassed=function(ev){this.isDistanceSurpassed=true;this.tryStartDrag(ev);};FeaturefulElementDragging.prototype.tryStartDrag=function(ev){if(this.isDelayEnded&&this.isDistanceSurpassed){if(!this.pointer.wasTouchScroll||this.touchScrollAllowed){this.isDragging=true;this.mirrorNeedsRevert=false;this.autoScroller.start(ev.pageX,ev.pageY);this.emitter.trigger('dragstart',ev);if(this.touchScrollAllowed===false){this.pointer.cancelTouchScroll();}}}};FeaturefulElementDragging.prototype.tryStopDrag=function(ev){// .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events// that come from the document to fire beforehand. much more convenient this way.this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,ev)// bound with args);};FeaturefulElementDragging.prototype.stopDrag=function(ev){this.isDragging=false;this.emitter.trigger('dragend',ev);};// fill in the implementations...FeaturefulElementDragging.prototype.setIgnoreMove=function(bool){this.pointer.shouldIgnoreMove=bool;};FeaturefulElementDragging.prototype.setMirrorIsVisible=function(bool){this.mirror.setIsVisible(bool);};FeaturefulElementDragging.prototype.setMirrorNeedsRevert=function(bool){this.mirrorNeedsRevert=bool;};FeaturefulElementDragging.prototype.setAutoScrollEnabled=function(bool){this.autoScroller.isEnabled=bool;};returnFeaturefulElementDragging;}(core.ElementDragging));/* When this class is instantiated, it records the offset of an element (relative to the document topleft), and continues to monitor scrolling, updating the cached coordinates if it needs to. Does not access the DOM after instantiation, so highly performant. Also keeps track of all scrolling/overflow:hiddencontainersthatareparentsofthegivenelementandandetermineifagivenpointisinsidethecombinedclippingrectangle.*/ var OffsetTracker = /**@class*/ (function () { function OffsetTracker(el) { this.origRect = core.computeRect(el); //willworkfinefordivsthathaveoverflow:hiddenthis.scrollCaches=core.getClippingParents(el).map(function(el){returnnewElementScrollGeomCache(el,true);// listen=true});}OffsetTracker.prototype.destroy=function(){for(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];scrollCache.destroy();}};OffsetTracker.prototype.computeLeft=function(){varleft=this.origRect.left;for(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];left+=scrollCache.origScrollLeft-scrollCache.getScrollLeft();}returnleft;};OffsetTracker.prototype.computeTop=function(){vartop=this.origRect.top;for(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];top+=scrollCache.origScrollTop-scrollCache.getScrollTop();}returntop;};OffsetTracker.prototype.isWithinClipping=function(pageX,pageY){varpoint={left:pageX,top:pageY};for(var_i=0,_a=this.scrollCaches;_i<_a.length;_i++){varscrollCache=_a[_i];if(!isIgnoredClipping(scrollCache.getEventTarget())&&!core.pointInsideRect(point,scrollCache.clientRect)){returnfalse;}}returntrue;};returnOffsetTracker;}());// certain clipping containers should never constrain interactions, like <html> and <body>// https://github.com/fullcalendar/fullcalendar/issues/3615functionisIgnoredClipping(node){vartagName=node.tagName;returntagName==='HTML'||tagName==='BODY';}/* Tracks movement over multiple droppable areas (aka "hits") that exist in one or more DateComponents. Relies on an existing draggable. emits: - pointerdown - dragstart - hitchange - fires initially, even if not over a hit - pointerup - (hitchange - again, to null, if ended over a hit) - dragend */varHitDragging=/** @class */(function(){functionHitDragging(dragging,droppableStore){var_this=this;// options that can be set by callerthis.useSubjectCenter=false;this.requireInitial=true;// if doesn't start out on a hit, won't emit any eventsthis.initialHit=null;this.movingHit=null;this.finalHit=null;// won't ever be populated if shouldIgnoreMovethis.handlePointerDown=function(ev){vardragging=_this.dragging;_this.initialHit=null;_this.movingHit=null;_this.finalHit=null;_this.prepareHits();_this.processFirstCoord(ev);if(_this.initialHit||!_this.requireInitial){dragging.setIgnoreMove(false);_this.emitter.trigger('pointerdown',ev);// TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :(}else{dragging.setIgnoreMove(true);}};this.handleDragStart=function(ev){_this.emitter.trigger('dragstart',ev);_this.handleMove(ev,true);// force = fire even if initially null};this.handleDragMove=function(ev){_this.emitter.trigger('dragmove',ev);_this.handleMove(ev);};this.handlePointerUp=function(ev){_this.releaseHits();_this.emitter.trigger('pointerup',ev);};this.handleDragEnd=function(ev){if(_this.movingHit){_this.emitter.trigger('hitupdate',null,true,ev);}_this.finalHit=_this.movingHit;_this.movingHit=null;_this.emitter.trigger('dragend',ev);};this.droppableStore=droppableStore;dragging.emitter.on('pointerdown',this.handlePointerDown);dragging.emitter.on('dragstart',this.handleDragStart);dragging.emitter.on('dragmove',this.handleDragMove);dragging.emitter.on('pointerup',this.handlePointerUp);dragging.emitter.on('dragend',this.handleDragEnd);this.dragging=dragging;this.emitter=newcore.EmitterMixin();}// sets initialHit// sets coordAdjustHitDragging.prototype.processFirstCoord=function(ev){varorigPoint={left:ev.pageX,top:ev.pageY};varadjustedPoint=origPoint;varsubjectEl=ev.subjectEl;varsubjectRect;if(subjectEl!==document){subjectRect=core.computeRect(subjectEl);adjustedPoint=core.constrainPoint(adjustedPoint,subjectRect);}varinitialHit=this.initialHit=this.queryHitForOffset(adjustedPoint.left,adjustedPoint.top);if(initialHit){if(this.useSubjectCenter&&subjectRect){varslicedSubjectRect=core.intersectRects(subjectRect,initialHit.rect);if(slicedSubjectRect){adjustedPoint=core.getRectCenter(slicedSubjectRect);}}this.coordAdjust=core.diffPoints(adjustedPoint,origPoint);}else{this.coordAdjust={left:0,top:0};}};HitDragging.prototype.handleMove=function(ev,forceHandle){varhit=this.queryHitForOffset(ev.pageX+this.coordAdjust.left,ev.pageY+this.coordAdjust.top);if(forceHandle||!isHitsEqual(this.movingHit,hit)){this.movingHit=hit;this.emitter.trigger('hitupdate',hit,false,ev);}};HitDragging.prototype.prepareHits=function(){this.offsetTrackers=core.mapHash(this.droppableStore,function(interactionSettings){interactionSettings.component.buildPositionCaches();returnnewOffsetTracker(interactionSettings.el);});};HitDragging.prototype.releaseHits=function(){varoffsetTrackers=this.offsetTrackers;for(varidinoffsetTrackers){offsetTrackers[id].destroy();}this.offsetTrackers={};};HitDragging.prototype.queryHitForOffset=function(offsetLeft,offsetTop){var_a=this,droppableStore=_a.droppableStore,offsetTrackers=_a.offsetTrackers;varbestHit=null;for(varidindroppableStore){varcomponent=droppableStore[id].component;varoffsetTracker=offsetTrackers[id];if(offsetTracker.isWithinClipping(offsetLeft,offsetTop)){varoriginLeft=offsetTracker.computeLeft();varoriginTop=offsetTracker.computeTop();varpositionLeft=offsetLeft-originLeft;varpositionTop=offsetTop-originTop;varorigRect=offsetTracker.origRect;varwidth=origRect.right-origRect.left;varheight=origRect.bottom-origRect.top;if(// must be within the element's boundspositionLeft>=0&&positionLeft<width&&positionTop>=0&&positionTop<height){varhit=component.queryHit(positionLeft,positionTop,width,height);if(hit&&(// make sure the hit is within activeRange, meaning it's not a deal cell!component.props.dateProfile||// hack for DayTilecore.rangeContainsRange(component.props.dateProfile.activeRange,hit.dateSpan.range))&&(!bestHit||hit.layer>bestHit.layer)){// TODO: better way to re-orient rectanglehit.rect.left+=originLeft;hit.rect.right+=originLeft;hit.rect.top+=originTop;hit.rect.bottom+=originTop;bestHit=hit;}}}}returnbestHit;};returnHitDragging;}());functionisHitsEqual(hit0,hit1){if(!hit0&&!hit1){returntrue;}if(Boolean(hit0)!==Boolean(hit1)){returnfalse;}returncore.isDateSpansEqual(hit0.dateSpan,hit1.dateSpan);}/* Monitors when the user clicks on a specific date/timeofacomponent.Apointerdown+pointeruponthesame"hit"constitutesaclick.*/ var DateClicking = /**@class*/ (function (_super) { __extends(DateClicking, _super); function DateClicking(settings) { var _this = _super.call(this, settings) || this; _this.handlePointerDown = function (ev) { var dragging = _this.dragging; //dothisinpointerdown(notdragend)becauseDOMmightbemutatedbythetimedragendisfireddragging.setIgnoreMove(!_this.component.isValidDateDownEl(dragging.pointer.downEl));};// won't even fire if moving was ignored_this.handleDragEnd=function(ev){varcomponent=_this.component;var_a=component.context,calendar=_a.calendar,view=_a.view;varpointer=_this.dragging.pointer;if(!pointer.wasTouchScroll){var_b=_this.hitDragging,initialHit=_b.initialHit,finalHit=_b.finalHit;if(initialHit&&finalHit&&isHitsEqual(initialHit,finalHit)){calendar.triggerDateClick(initialHit.dateSpan,initialHit.dayEl,view,ev.origEvent);}}};varcomponent=settings.component;// we DO want to watch pointer moves because otherwise finalHit won't get populated_this.dragging=newFeaturefulElementDragging(component.el);_this.dragging.autoScroller.isEnabled=false;varhitDragging=_this.hitDragging=newHitDragging(_this.dragging,core.interactionSettingsToStore(settings));hitDragging.emitter.on('pointerdown',_this.handlePointerDown);hitDragging.emitter.on('dragend',_this.handleDragEnd);return_this;}DateClicking.prototype.destroy=function(){this.dragging.destroy();};returnDateClicking;}(core.Interaction));/* Tracks when the user selects a portion of time of a component, constituted by a drag over date cells, with a possible delay at the beginning of the drag. */varDateSelecting=/** @class */(function(_super){__extends(DateSelecting,_super);functionDateSelecting(settings){var_this=_super.call(this,settings)||this;_this.dragSelection=null;_this.handlePointerDown=function(ev){var_a=_this,component=_a.component,dragging=_a.dragging;varoptions=component.context.options;varcanSelect=options.selectable&&component.isValidDateDownEl(ev.origEvent.target);// don't bother to watch expensive moves if component won't do selectiondragging.setIgnoreMove(!canSelect);// if touch, require user to hold downdragging.delay=ev.isTouch?getComponentTouchDelay(component):null;};_this.handleDragStart=function(ev){_this.component.context.calendar.unselect(ev);// unselect previous selections};_this.handleHitUpdate=function(hit,isFinal){varcalendar=_this.component.context.calendar;vardragSelection=null;varisInvalid=false;if(hit){dragSelection=joinHitsIntoSelection(_this.hitDragging.initialHit,hit,calendar.pluginSystem.hooks.dateSelectionTransformers);if(!dragSelection||!_this.component.isDateSelectionValid(dragSelection)){isInvalid=true;dragSelection=null;}}if(dragSelection){calendar.dispatch({type:'SELECT_DATES',selection:dragSelection});}elseif(!isFinal){// only unselect if moved away while draggingcalendar.dispatch({type:'UNSELECT_DATES'});}if(!isInvalid){core.enableCursor();}else{core.disableCursor();}if(!isFinal){_this.dragSelection=dragSelection;// only clear if moved away from all hits while dragging}};_this.handlePointerUp=function(pev){if(_this.dragSelection){// selection is already rendered, so just need to report selection_this.component.context.calendar.triggerDateSelect(_this.dragSelection,pev);_this.dragSelection=null;}};varcomponent=settings.component;varoptions=component.context.options;vardragging=_this.dragging=newFeaturefulElementDragging(component.el);dragging.touchScrollAllowed=false;dragging.minDistance=options.selectMinDistance||0;dragging.autoScroller.isEnabled=options.dragScroll;varhitDragging=_this.hitDragging=newHitDragging(_this.dragging,core.interactionSettingsToStore(settings));hitDragging.emitter.on('pointerdown',_this.handlePointerDown);hitDragging.emitter.on('dragstart',_this.handleDragStart);hitDragging.emitter.on('hitupdate',_this.handleHitUpdate);hitDragging.emitter.on('pointerup',_this.handlePointerUp);return_this;}DateSelecting.prototype.destroy=function(){this.dragging.destroy();};returnDateSelecting;}(core.Interaction));functiongetComponentTouchDelay(component){varoptions=component.context.options;vardelay=options.selectLongPressDelay;if(delay==null){delay=options.longPressDelay;}returndelay;}functionjoinHitsIntoSelection(hit0,hit1,dateSelectionTransformers){vardateSpan0=hit0.dateSpan;vardateSpan1=hit1.dateSpan;varms=[dateSpan0.range.start,dateSpan0.range.end,dateSpan1.range.start,dateSpan1.range.end];ms.sort(core.compareNumbers);varprops={};for(var_i=0,dateSelectionTransformers_1=dateSelectionTransformers;_i<dateSelectionTransformers_1.length;_i++){vartransformer=dateSelectionTransformers_1[_i];varres=transformer(hit0,hit1);if(res===false){returnnull;}elseif(res){__assign(props,res);}}props.range={start:ms[0],end:ms[3]};props.allDay=dateSpan0.allDay;returnprops;}varEventDragging=/** @class */(function(_super){__extends(EventDragging,_super);functionEventDragging(settings){var_this=_super.call(this,settings)||this;// internal state_this.subjectSeg=null;// the seg being selected/dragged_this.isDragging=false;_this.eventRange=null;_this.relevantEvents=null;// the events being dragged_this.receivingCalendar=null;_this.validMutation=null;_this.mutatedRelevantEvents=null;_this.handlePointerDown=function(ev){varorigTarget=ev.origEvent.target;var_a=_this,component=_a.component,dragging=_a.dragging;varmirror=dragging.mirror;varoptions=component.context.options;varinitialCalendar=component.context.calendar;varsubjectSeg=_this.subjectSeg=core.getElSeg(ev.subjectEl);vareventRange=_this.eventRange=subjectSeg.eventRange;vareventInstanceId=eventRange.instance.instanceId;_this.relevantEvents=core.getRelevantEvents(initialCalendar.state.eventStore,eventInstanceId);dragging.minDistance=ev.isTouch?0:options.eventDragMinDistance;dragging.delay=// only do a touch delay if touch and this event hasn't been selected yet(ev.isTouch&&eventInstanceId!==component.props.eventSelection)?getComponentTouchDelay$1(component):null;mirror.parentNode=initialCalendar.el;mirror.revertDuration=options.dragRevertDuration;varisValid=component.isValidSegDownEl(origTarget)&&!core.elementClosest(origTarget,'.fc-resizer');// NOT on a resizerdragging.setIgnoreMove(!isValid);// disable dragging for elements that are resizable (ie, selectable)// but are not draggable_this.isDragging=isValid&&ev.subjectEl.classList.contains('fc-draggable');};_this.handleDragStart=function(ev){varcontext=_this.component.context;varinitialCalendar=context.calendar;vareventRange=_this.eventRange;vareventInstanceId=eventRange.instance.instanceId;if(ev.isTouch){// need to select a different event?if(eventInstanceId!==_this.component.props.eventSelection){initialCalendar.dispatch({type:'SELECT_EVENT',eventInstanceId:eventInstanceId});}}else{// if now using mouse, but was previous touch interaction, clear selected eventinitialCalendar.dispatch({type:'UNSELECT_EVENT'});}if(_this.isDragging){initialCalendar.unselect(ev);// unselect *date* selectioninitialCalendar.publiclyTrigger('eventDragStart',[{el:_this.subjectSeg.el,event:newcore.EventApi(initialCalendar,eventRange.def,eventRange.instance),jsEvent:ev.origEvent,view:context.view}]);}};_this.handleHitUpdate=function(hit,isFinal){if(!_this.isDragging){return;}varrelevantEvents=_this.relevantEvents;varinitialHit=_this.hitDragging.initialHit;varinitialCalendar=_this.component.context.calendar;// states based on new hitvarreceivingCalendar=null;varmutation=null;varmutatedRelevantEvents=null;varisInvalid=false;varinteraction={affectedEvents:relevantEvents,mutatedEvents:core.createEmptyEventStore(),isEvent:true,origSeg:_this.subjectSeg};if(hit){varreceivingComponent=hit.component;receivingCalendar=receivingComponent.context.calendar;varreceivingOptions=receivingComponent.context.options;if(initialCalendar===receivingCalendar||receivingOptions.editable&&receivingOptions.droppable){mutation=computeEventMutation(initialHit,hit,receivingCalendar.pluginSystem.hooks.eventDragMutationMassagers);if(mutation){mutatedRelevantEvents=core.applyMutationToEventStore(relevantEvents,receivingCalendar.eventUiBases,mutation,receivingCalendar);interaction.mutatedEvents=mutatedRelevantEvents;if(!receivingComponent.isInteractionValid(interaction)){isInvalid=true;mutation=null;mutatedRelevantEvents=null;interaction.mutatedEvents=core.createEmptyEventStore();}}}else{receivingCalendar=null;}}_this.displayDrag(receivingCalendar,interaction);if(!isInvalid){core.enableCursor();}else{core.disableCursor();}if(!isFinal){if(initialCalendar===receivingCalendar&&// TODO: write test for thisisHitsEqual(initialHit,hit)){mutation=null;}_this.dragging.setMirrorNeedsRevert(!mutation);// render the mirror if no already-rendered mirror// TODO: wish we could somehow wait for dispatch to guarantee render_this.dragging.setMirrorIsVisible(!hit||!document.querySelector('.fc-mirror'));// assign states based on new hit_this.receivingCalendar=receivingCalendar;_this.validMutation=mutation;_this.mutatedRelevantEvents=mutatedRelevantEvents;}};_this.handlePointerUp=function(){if(!_this.isDragging){_this.cleanup();// because handleDragEnd won't fire}};_this.handleDragEnd=function(ev){if(_this.isDragging){varcontext=_this.component.context;varinitialCalendar_1=context.calendar;varinitialView=context.view;var_a=_this,receivingCalendar=_a.receivingCalendar,validMutation=_a.validMutation;vareventDef=_this.eventRange.def;vareventInstance=_this.eventRange.instance;vareventApi=newcore.EventApi(initialCalendar_1,eventDef,eventInstance);varrelevantEvents_1=_this.relevantEvents;varmutatedRelevantEvents=_this.mutatedRelevantEvents;varfinalHit=_this.hitDragging.finalHit;_this.clearDrag();// must happen after revert animationinitialCalendar_1.publiclyTrigger('eventDragStop',[{el:_this.subjectSeg.el,event:eventApi,jsEvent:ev.origEvent,view:initialView}]);if(validMutation){// dropped within same calendarif(receivingCalendar===initialCalendar_1){initialCalendar_1.dispatch({type:'MERGE_EVENTS',eventStore:mutatedRelevantEvents});vartransformed={};for(var_i=0,_b=initialCalendar_1.pluginSystem.hooks.eventDropTransformers;_i<_b.length;_i++){vartransformer=_b[_i];__assign(transformed,transformer(validMutation,initialCalendar_1));}vareventDropArg=__assign({},transformed,{el:ev.subjectEl,delta:validMutation.datesDelta,oldEvent:eventApi,event:newcore.EventApi(// the data AFTER the mutationinitialCalendar_1,mutatedRelevantEvents.defs[eventDef.defId],eventInstance?mutatedRelevantEvents.instances[eventInstance.instanceId]:null),revert:function(){initialCalendar_1.dispatch({type:'MERGE_EVENTS',eventStore:relevantEvents_1});},jsEvent:ev.origEvent,view:initialView});initialCalendar_1.publiclyTrigger('eventDrop',[eventDropArg]);// dropped in different calendar}elseif(receivingCalendar){initialCalendar_1.publiclyTrigger('eventLeave',[{draggedEl:ev.subjectEl,event:eventApi,view:initialView}]);initialCalendar_1.dispatch({type:'REMOVE_EVENT_INSTANCES',instances:_this.mutatedRelevantEvents.instances});receivingCalendar.dispatch({type:'MERGE_EVENTS',eventStore:_this.mutatedRelevantEvents});if(ev.isTouch){receivingCalendar.dispatch({type:'SELECT_EVENT',eventInstanceId:eventInstance.instanceId});}vardropArg=__assign({},receivingCalendar.buildDatePointApi(finalHit.dateSpan),{draggedEl:ev.subjectEl,jsEvent:ev.origEvent,view:finalHit.component// should this be finalHit.component.view? See #4644});receivingCalendar.publiclyTrigger('drop',[dropArg]);receivingCalendar.publiclyTrigger('eventReceive',[{draggedEl:ev.subjectEl,event:newcore.EventApi(// the data AFTER the mutationreceivingCalendar,mutatedRelevantEvents.defs[eventDef.defId],mutatedRelevantEvents.instances[eventInstance.instanceId]),view:finalHit.component// should this be finalHit.component.view? See #4644}]);}}else{initialCalendar_1.publiclyTrigger('_noEventDrop');}}_this.cleanup();};varcomponent=_this.component;varoptions=component.context.options;vardragging=_this.dragging=newFeaturefulElementDragging(component.el);dragging.pointer.selector=EventDragging.SELECTOR;dragging.touchScrollAllowed=false;dragging.autoScroller.isEnabled=options.dragScroll;varhitDragging=_this.hitDragging=newHitDragging(_this.dragging,core.interactionSettingsStore);hitDragging.useSubjectCenter=settings.useEventCenter;hitDragging.emitter.on('pointerdown',_this.handlePointerDown);hitDragging.emitter.on('dragstart',_this.handleDragStart);hitDragging.emitter.on('hitupdate',_this.handleHitUpdate);hitDragging.emitter.on('pointerup',_this.handlePointerUp);hitDragging.emitter.on('dragend',_this.handleDragEnd);return_this;}EventDragging.prototype.destroy=function(){this.dragging.destroy();};// render a drag state on the next receivingCalendarEventDragging.prototype.displayDrag=function(nextCalendar,state){varinitialCalendar=this.component.context.calendar;varprevCalendar=this.receivingCalendar;// does the previous calendar need to be cleared?if(prevCalendar&&prevCalendar!==nextCalendar){// does the initial calendar need to be cleared?// if so, don't clear all the way. we still need to to hide the affectedEventsif(prevCalendar===initialCalendar){prevCalendar.dispatch({type:'SET_EVENT_DRAG',state:{affectedEvents:state.affectedEvents,mutatedEvents:core.createEmptyEventStore(),isEvent:true,origSeg:state.origSeg}});// completely clear the old calendar if it wasn't the initial}else{prevCalendar.dispatch({type:'UNSET_EVENT_DRAG'});}}if(nextCalendar){nextCalendar.dispatch({type:'SET_EVENT_DRAG',state:state});}};EventDragging.prototype.clearDrag=function(){varinitialCalendar=this.component.context.calendar;varreceivingCalendar=this.receivingCalendar;if(receivingCalendar){receivingCalendar.dispatch({type:'UNSET_EVENT_DRAG'});}// the initial calendar might have an dummy drag state from displayDragif(initialCalendar!==receivingCalendar){initialCalendar.dispatch({type:'UNSET_EVENT_DRAG'});}};EventDragging.prototype.cleanup=function(){this.subjectSeg=null;this.isDragging=false;this.eventRange=null;this.relevantEvents=null;this.receivingCalendar=null;this.validMutation=null;this.mutatedRelevantEvents=null;};EventDragging.SELECTOR='.fc-draggable, .fc-resizable';// TODO: test this in IE11returnEventDragging;}(core.Interaction));functioncomputeEventMutation(hit0,hit1,massagers){vardateSpan0=hit0.dateSpan;vardateSpan1=hit1.dateSpan;vardate0=dateSpan0.range.start;vardate1=dateSpan1.range.start;varstandardProps={};if(dateSpan0.allDay!==dateSpan1.allDay){standardProps.allDay=dateSpan1.allDay;standardProps.hasEnd=hit1.component.context.options.allDayMaintainDuration;if(dateSpan1.allDay){// means date1 is already start-of-day,// but date0 needs to be converteddate0=core.startOfDay(date0);}}vardelta=core.diffDates(date0,date1,hit0.component.context.dateEnv,hit0.component===hit1.component?hit0.component.largeUnit:null);if(delta.milliseconds){// has hours/minutes/secondsstandardProps.allDay=false;}varmutation={datesDelta:delta,standardProps:standardProps};for(var_i=0,massagers_1=massagers;_i<massagers_1.length;_i++){varmassager=massagers_1[_i];massager(mutation,hit0,hit1);}returnmutation;}functiongetComponentTouchDelay$1(component){varoptions=component.context.options;vardelay=options.eventLongPressDelay;if(delay==null){delay=options.longPressDelay;}returndelay;}varEventDragging$1=/** @class */(function(_super){__extends(EventDragging,_super);functionEventDragging(settings){var_this=_super.call(this,settings)||this;// internal state_this.draggingSeg=null;// TODO: rename to resizingSeg? subjectSeg?_this.eventRange=null;_this.relevantEvents=null;_this.validMutation=null;_this.mutatedRelevantEvents=null;_this.handlePointerDown=function(ev){varcomponent=_this.component;varseg=_this.querySeg(ev);vareventRange=_this.eventRange=seg.eventRange;_this.dragging.minDistance=component.context.options.eventDragMinDistance;// if touch, need to be working with a selected event_this.dragging.setIgnoreMove(!_this.component.isValidSegDownEl(ev.origEvent.target)||(ev.isTouch&&_this.component.props.eventSelection!==eventRange.instance.instanceId));};_this.handleDragStart=function(ev){var_a=_this.component.context,calendar=_a.calendar,view=_a.view;vareventRange=_this.eventRange;_this.relevantEvents=core.getRelevantEvents(calendar.state.eventStore,_this.eventRange.instance.instanceId);_this.draggingSeg=_this.querySeg(ev);calendar.unselect();calendar.publiclyTrigger('eventResizeStart',[{el:_this.draggingSeg.el,event:newcore.EventApi(calendar,eventRange.def,eventRange.instance),jsEvent:ev.origEvent,view:view}]);};_this.handleHitUpdate=function(hit,isFinal,ev){varcalendar=_this.component.context.calendar;varrelevantEvents=_this.relevantEvents;varinitialHit=_this.hitDragging.initialHit;vareventInstance=_this.eventRange.instance;varmutation=null;varmutatedRelevantEvents=null;varisInvalid=false;varinteraction={affectedEvents:relevantEvents,mutatedEvents:core.createEmptyEventStore(),isEvent:true,origSeg:_this.draggingSeg};if(hit){mutation=computeMutation(initialHit,hit,ev.subjectEl.classList.contains('fc-start-resizer'),eventInstance.range,calendar.pluginSystem.hooks.eventResizeJoinTransforms);}if(mutation){mutatedRelevantEvents=core.applyMutationToEventStore(relevantEvents,calendar.eventUiBases,mutation,calendar);interaction.mutatedEvents=mutatedRelevantEvents;if(!_this.component.isInteractionValid(interaction)){isInvalid=true;mutation=null;mutatedRelevantEvents=null;interaction.mutatedEvents=null;}}if(mutatedRelevantEvents){calendar.dispatch({type:'SET_EVENT_RESIZE',state:interaction});}else{calendar.dispatch({type:'UNSET_EVENT_RESIZE'});}if(!isInvalid){core.enableCursor();}else{core.disableCursor();}if(!isFinal){if(mutation&&isHitsEqual(initialHit,hit)){mutation=null;}_this.validMutation=mutation;_this.mutatedRelevantEvents=mutatedRelevantEvents;}};_this.handleDragEnd=function(ev){var_a=_this.component.context,calendar=_a.calendar,view=_a.view;vareventDef=_this.eventRange.def;vareventInstance=_this.eventRange.instance;vareventApi=newcore.EventApi(calendar,eventDef,eventInstance);varrelevantEvents=_this.relevantEvents;varmutatedRelevantEvents=_this.mutatedRelevantEvents;calendar.publiclyTrigger('eventResizeStop',[{el:_this.draggingSeg.el,event:eventApi,jsEvent:ev.origEvent,view:view}]);if(_this.validMutation){calendar.dispatch({type:'MERGE_EVENTS',eventStore:mutatedRelevantEvents});calendar.publiclyTrigger('eventResize',[{el:_this.draggingSeg.el,startDelta:_this.validMutation.startDelta||core.createDuration(0),endDelta:_this.validMutation.endDelta||core.createDuration(0),prevEvent:eventApi,event:newcore.EventApi(// the data AFTER the mutationcalendar,mutatedRelevantEvents.defs[eventDef.defId],eventInstance?mutatedRelevantEvents.instances[eventInstance.instanceId]:null),revert:function(){calendar.dispatch({type:'MERGE_EVENTS',eventStore:relevantEvents});},jsEvent:ev.origEvent,view:view}]);}else{calendar.publiclyTrigger('_noEventResize');}// reset all internal state_this.draggingSeg=null;_this.relevantEvents=null;_this.validMutation=null;// okay to keep eventInstance around. useful to set it in handlePointerDown};varcomponent=settings.component;vardragging=_this.dragging=newFeaturefulElementDragging(component.el);dragging.pointer.selector='.fc-resizer';dragging.touchScrollAllowed=false;dragging.autoScroller.isEnabled=component.context.options.dragScroll;varhitDragging=_this.hitDragging=newHitDragging(_this.dragging,core.interactionSettingsToStore(settings));hitDragging.emitter.on('pointerdown',_this.handlePointerDown);hitDragging.emitter.on('dragstart',_this.handleDragStart);hitDragging.emitter.on('hitupdate',_this.handleHitUpdate);hitDragging.emitter.on('dragend',_this.handleDragEnd);return_this;}EventDragging.prototype.destroy=function(){this.dragging.destroy();};EventDragging.prototype.querySeg=function(ev){returncore.getElSeg(core.elementClosest(ev.subjectEl,this.component.fgSegSelector));};returnEventDragging;}(core.Interaction));functioncomputeMutation(hit0,hit1,isFromStart,instanceRange,transforms){vardateEnv=hit0.component.context.dateEnv;vardate0=hit0.dateSpan.range.start;vardate1=hit1.dateSpan.range.start;vardelta=core.diffDates(date0,date1,dateEnv,hit0.component.largeUnit);varprops={};for(var_i=0,transforms_1=transforms;_i<transforms_1.length;_i++){vartransform=transforms_1[_i];varres=transform(hit0,hit1);if(res===false){returnnull;}elseif(res){__assign(props,res);}}if(isFromStart){if(dateEnv.add(instanceRange.start,delta)<instanceRange.end){props.startDelta=delta;returnprops;}}else{if(dateEnv.add(instanceRange.end,delta)>instanceRange.start){props.endDelta=delta;returnprops;}}returnnull;}varUnselectAuto=/** @class */(function(){functionUnselectAuto(calendar){var_this=this;this.isRecentPointerDateSelect=false;// wish we could use a selector to detect date selection, but uses hit systemthis.onSelect=function(selectInfo){if(selectInfo.jsEvent){_this.isRecentPointerDateSelect=true;}};this.onDocumentPointerUp=function(pev){var_a=_this,calendar=_a.calendar,documentPointer=_a.documentPointer;varstate=calendar.state;// touch-scrolling should never unfocus any type of selectionif(!documentPointer.wasTouchScroll){if(state.dateSelection&&// an existing date selection?!_this.isRecentPointerDateSelect// a new pointer-initiated date selection since last onDocumentPointerUp?){varunselectAuto=calendar.viewOpt('unselectAuto');varunselectCancel=calendar.viewOpt('unselectCancel');if(unselectAuto&&(!unselectAuto||!core.elementClosest(documentPointer.downEl,unselectCancel))){calendar.unselect(pev);}}if(state.eventSelection&&// an existing event selected?!core.elementClosest(documentPointer.downEl,EventDragging.SELECTOR)// interaction DIDN'T start on an event){calendar.dispatch({type:'UNSELECT_EVENT'});}}_this.isRecentPointerDateSelect=false;};this.calendar=calendar;vardocumentPointer=this.documentPointer=newPointerDragging(document);documentPointer.shouldIgnoreMove=true;documentPointer.shouldWatchScroll=false;documentPointer.emitter.on('pointerup',this.onDocumentPointerUp);/* TODO: better way to know about whether there was a selection with the pointer */calendar.on('select',this.onSelect);}UnselectAuto.prototype.destroy=function(){this.calendar.off('select',this.onSelect);this.documentPointer.destroy();};returnUnselectAuto;}());/* Given an already instantiated draggable object for one-or-more elements, Interprets any dragging as an attempt to drag an events that lives outside of a calendar onto a calendar. */varExternalElementDragging=/** @class */(function(){functionExternalElementDragging(dragging,suppliedDragMeta){var_this=this;this.receivingCalendar=null;this.droppableEvent=null;// will exist for all drags, even if create:falsethis.suppliedDragMeta=null;this.dragMeta=null;this.handleDragStart=function(ev){_this.dragMeta=_this.buildDragMeta(ev.subjectEl);};this.handleHitUpdate=function(hit,isFinal,ev){vardragging=_this.hitDragging.dragging;varreceivingCalendar=null;vardroppableEvent=null;varisInvalid=false;varinteraction={affectedEvents:core.createEmptyEventStore(),mutatedEvents:core.createEmptyEventStore(),isEvent:_this.dragMeta.create,origSeg:null};if(hit){receivingCalendar=hit.component.context.calendar;if(_this.canDropElOnCalendar(ev.subjectEl,receivingCalendar)){droppableEvent=computeEventForDateSpan(hit.dateSpan,_this.dragMeta,receivingCalendar);interaction.mutatedEvents=core.eventTupleToStore(droppableEvent);isInvalid=!core.isInteractionValid(interaction,receivingCalendar);if(isInvalid){interaction.mutatedEvents=core.createEmptyEventStore();droppableEvent=null;}}}_this.displayDrag(receivingCalendar,interaction);// show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)// TODO: wish we could somehow wait for dispatch to guarantee renderdragging.setMirrorIsVisible(isFinal||!droppableEvent||!document.querySelector('.fc-mirror'));if(!isInvalid){core.enableCursor();}else{core.disableCursor();}if(!isFinal){dragging.setMirrorNeedsRevert(!droppableEvent);_this.receivingCalendar=receivingCalendar;_this.droppableEvent=droppableEvent;}};this.handleDragEnd=function(pev){var_a=_this,receivingCalendar=_a.receivingCalendar,droppableEvent=_a.droppableEvent;_this.clearDrag();if(receivingCalendar&&droppableEvent){varfinalHit=_this.hitDragging.finalHit;varfinalView=finalHit.component.context.view;vardragMeta=_this.dragMeta;vararg=__assign({},receivingCalendar.buildDatePointApi(finalHit.dateSpan),{draggedEl:pev.subjectEl,jsEvent:pev.origEvent,view:finalView});receivingCalendar.publiclyTrigger('drop',[arg]);if(dragMeta.create){receivingCalendar.dispatch({type:'MERGE_EVENTS',eventStore:core.eventTupleToStore(droppableEvent)});if(pev.isTouch){receivingCalendar.dispatch({type:'SELECT_EVENT',eventInstanceId:droppableEvent.instance.instanceId});}// signal that an external event landedreceivingCalendar.publiclyTrigger('eventReceive',[{draggedEl:pev.subjectEl,event:newcore.EventApi(receivingCalendar,droppableEvent.def,droppableEvent.instance),view:finalView}]);}}_this.receivingCalendar=null;_this.droppableEvent=null;};varhitDragging=this.hitDragging=newHitDragging(dragging,core.interactionSettingsStore);hitDragging.requireInitial=false;// will start outside of a componenthitDragging.emitter.on('dragstart',this.handleDragStart);hitDragging.emitter.on('hitupdate',this.handleHitUpdate);hitDragging.emitter.on('dragend',this.handleDragEnd);this.suppliedDragMeta=suppliedDragMeta;}ExternalElementDragging.prototype.buildDragMeta=function(subjectEl){if(typeofthis.suppliedDragMeta==='object'){returncore.parseDragMeta(this.suppliedDragMeta);}elseif(typeofthis.suppliedDragMeta==='function'){returncore.parseDragMeta(this.suppliedDragMeta(subjectEl));}else{returngetDragMetaFromEl(subjectEl);}};ExternalElementDragging.prototype.displayDrag=function(nextCalendar,state){varprevCalendar=this.receivingCalendar;if(prevCalendar&&prevCalendar!==nextCalendar){prevCalendar.dispatch({type:'UNSET_EVENT_DRAG'});}if(nextCalendar){nextCalendar.dispatch({type:'SET_EVENT_DRAG',state:state});}};ExternalElementDragging.prototype.clearDrag=function(){if(this.receivingCalendar){this.receivingCalendar.dispatch({type:'UNSET_EVENT_DRAG'});}};ExternalElementDragging.prototype.canDropElOnCalendar=function(el,receivingCalendar){vardropAccept=receivingCalendar.opt('dropAccept');if(typeofdropAccept==='function'){returndropAccept(el);}elseif(typeofdropAccept==='string'&&dropAccept){returnBoolean(core.elementMatches(el,dropAccept));}returntrue;};returnExternalElementDragging;}());// Utils for computing event store from the DragMeta// ----------------------------------------------------------------------------------------------------functioncomputeEventForDateSpan(dateSpan,dragMeta,calendar){vardefProps=__assign({},dragMeta.leftoverProps);for(var_i=0,_a=calendar.pluginSystem.hooks.externalDefTransforms;_i<_a.length;_i++){vartransform=_a[_i];__assign(defProps,transform(dateSpan,dragMeta));}vardef=core.parseEventDef(defProps,dragMeta.sourceId,dateSpan.allDay,calendar.opt('forceEventDuration')||Boolean(dragMeta.duration),// hasEndcalendar);varstart=dateSpan.range.start;// only rely on time info if drop zone is all-day,// otherwise, we already know the timeif(dateSpan.allDay&&dragMeta.startTime){start=calendar.dateEnv.add(start,dragMeta.startTime);}varend=dragMeta.duration?calendar.dateEnv.add(start,dragMeta.duration):calendar.getDefaultEventEnd(dateSpan.allDay,start);varinstance=core.createEventInstance(def.defId,{start:start,end:end});return{def:def,instance:instance};}// Utils for extracting data from element// ----------------------------------------------------------------------------------------------------functiongetDragMetaFromEl(el){varstr=getEmbeddedElData(el,'event');varobj=str?JSON.parse(str):{create:false};// if no embedded data, assume no event creationreturncore.parseDragMeta(obj);}core.config.dataAttrPrefix='';functiongetEmbeddedElData(el,name){varprefix=core.config.dataAttrPrefix;varprefixedName=(prefix?prefix+'-':'')+name;returnel.getAttribute('data-'+prefixedName)||'';}/* Makes an element (that is *external* to any calendar) draggable. Can pass in data that determines how an event will be created when dropped onto a calendar. Leverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system. */varExternalDraggable=/** @class */(function(){functionExternalDraggable(el,settings){var_this=this;if(settings===void0){settings={};}this.handlePointerDown=function(ev){vardragging=_this.dragging;var_a=_this.settings,minDistance=_a.minDistance,longPressDelay=_a.longPressDelay;dragging.minDistance=minDistance!=null?minDistance:(ev.isTouch?0:core.globalDefaults.eventDragMinDistance);dragging.delay=ev.isTouch?// TODO: eventually read eventLongPressDelay instead vvv(longPressDelay!=null?longPressDelay:core.globalDefaults.longPressDelay):0;};this.handleDragStart=function(ev){if(ev.isTouch&&_this.dragging.delay&&ev.subjectEl.classList.contains('fc-event')){_this.dragging.mirror.getMirrorEl().classList.add('fc-selected');}};this.settings=settings;vardragging=this.dragging=newFeaturefulElementDragging(el);dragging.touchScrollAllowed=false;if(settings.itemSelector!=null){dragging.pointer.selector=settings.itemSelector;}if(settings.appendTo!=null){dragging.mirror.parentNode=settings.appendTo;// TODO: write tests}dragging.emitter.on('pointerdown',this.handlePointerDown);dragging.emitter.on('dragstart',this.handleDragStart);newExternalElementDragging(dragging,settings.eventData);}ExternalDraggable.prototype.destroy=function(){this.dragging.destroy();};returnExternalDraggable;}());/* Detects when a *THIRD-PARTY* drag-n-drop system interacts with elements. The third-party system is responsible for drawing the visuals effects of the drag. This class simply monitors for pointer movements and fires events. It also has the ability to hide the moving element (the "mirror") during the drag. */varInferredElementDragging=/** @class */(function(_super){__extends(InferredElementDragging,_super);functionInferredElementDragging(containerEl){var_this=_super.call(this,containerEl)||this;_this.shouldIgnoreMove=false;_this.mirrorSelector='';_this.currentMirrorEl=null;_this.handlePointerDown=function(ev){_this.emitter.trigger('pointerdown',ev);if(!_this.shouldIgnoreMove){// fire dragstart right away. does not support delay or min-distance_this.emitter.trigger('dragstart',ev);}};_this.handlePointerMove=function(ev){if(!_this.shouldIgnoreMove){_this.emitter.trigger('dragmove',ev);}};_this.handlePointerUp=function(ev){_this.emitter.trigger('pointerup',ev);if(!_this.shouldIgnoreMove){// fire dragend right away. does not support a revert animation_this.emitter.trigger('dragend',ev);}};varpointer=_this.pointer=newPointerDragging(containerEl);pointer.emitter.on('pointerdown',_this.handlePointerDown);pointer.emitter.on('pointermove',_this.handlePointerMove);pointer.emitter.on('pointerup',_this.handlePointerUp);return_this;}InferredElementDragging.prototype.destroy=function(){this.pointer.destroy();};InferredElementDragging.prototype.setIgnoreMove=function(bool){this.shouldIgnoreMove=bool;};InferredElementDragging.prototype.setMirrorIsVisible=function(bool){if(bool){// restore a previously hidden element.// use the reference in case the selector class has already been removed.if(this.currentMirrorEl){this.currentMirrorEl.style.visibility='';this.currentMirrorEl=null;}}else{varmirrorEl=this.mirrorSelector?document.querySelector(this.mirrorSelector):null;if(mirrorEl){this.currentMirrorEl=mirrorEl;mirrorEl.style.visibility='hidden';}}};returnInferredElementDragging;}(core.ElementDragging));/* Bridges third-party drag-n-drop systems with FullCalendar. Must be instantiated and destroyed by caller. */varThirdPartyDraggable=/** @class */(function(){functionThirdPartyDraggable(containerOrSettings,settings){varcontainerEl=document;if(// wish we could just test instanceof EventTarget, but doesn't work in IE11containerOrSettings===document||containerOrSettingsinstanceofElement){containerEl=containerOrSettings;settings=settings||{};}else{settings=(containerOrSettings||{});}vardragging=this.dragging=newInferredElementDragging(containerEl);if(typeofsettings.itemSelector==='string'){dragging.pointer.selector=settings.itemSelector;}elseif(containerEl===document){dragging.pointer.selector='[data-event]';}if(typeofsettings.mirrorSelector==='string'){dragging.mirrorSelector=settings.mirrorSelector;}newExternalElementDragging(dragging,settings.eventData);}ThirdPartyDraggable.prototype.destroy=function(){this.dragging.destroy();};returnThirdPartyDraggable;}());varmain=core.createPlugin({componentInteractions:[DateClicking,DateSelecting,EventDragging,EventDragging$1],calendarInteractions:[UnselectAuto],elementDraggingImpl:FeaturefulElementDragging});exports.Draggable=ExternalDraggable;exports.FeaturefulElementDragging=FeaturefulElementDragging;exports.PointerDragging=PointerDragging;exports.ThirdPartyDraggable=ThirdPartyDraggable;exports.default=main;Object.defineProperty(exports,'__esModule',{value:true});}));