2021-04-20 11:51:53 -07:00
var Grav ;
2020-11-18 13:36:30 -08:00
/******/ ( ( ) => { // webpackBootstrap
/******/ var _ _webpack _modules _ _ = ( {
2025-10-16 10:59:50 -06:00
/***/ 3604 :
/***/ ( ( module ) => {
2025-09-24 18:27:08 -06:00
"use strict" ;
2025-10-16 10:59:50 -06:00
module . exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=" ;
2025-09-24 18:27:08 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
/***/ 15980 :
/***/ ( ( module ) => {
2025-09-24 18:27:08 -06:00
"use strict" ;
2025-10-16 10:59:50 -06:00
module . exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=" ;
2025-09-24 18:27:08 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
/***/ 24912 :
/***/ ( ( module ) => {
2025-09-24 18:27:08 -06:00
"use strict" ;
2025-10-16 10:59:50 -06:00
module . exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==" ;
2025-09-24 18:27:08 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
/***/ 35358 :
/***/ ( ( module , _ _unused _webpack _exports , _ _webpack _require _ _ ) => {
2025-09-24 18:27:08 -06:00
2025-10-16 10:59:50 -06:00
var map = {
"./af" : 25177 ,
"./af.js" : 25177 ,
"./ar" : 61509 ,
"./ar-dz" : 41488 ,
"./ar-dz.js" : 41488 ,
"./ar-kw" : 58676 ,
"./ar-kw.js" : 58676 ,
"./ar-ly" : 42353 ,
"./ar-ly.js" : 42353 ,
"./ar-ma" : 24496 ,
"./ar-ma.js" : 24496 ,
"./ar-sa" : 82682 ,
"./ar-sa.js" : 82682 ,
"./ar-tn" : 89756 ,
"./ar-tn.js" : 89756 ,
"./ar.js" : 61509 ,
"./az" : 95533 ,
"./az.js" : 95533 ,
"./be" : 28959 ,
"./be.js" : 28959 ,
"./bg" : 47777 ,
"./bg.js" : 47777 ,
"./bm" : 54903 ,
"./bm.js" : 54903 ,
"./bn" : 61290 ,
"./bn-bd" : 17357 ,
"./bn-bd.js" : 17357 ,
"./bn.js" : 61290 ,
"./bo" : 31545 ,
"./bo.js" : 31545 ,
"./br" : 11470 ,
"./br.js" : 11470 ,
"./bs" : 44429 ,
"./bs.js" : 44429 ,
"./ca" : 7306 ,
"./ca.js" : 7306 ,
"./cs" : 56464 ,
"./cs.js" : 56464 ,
"./cv" : 73635 ,
"./cv.js" : 73635 ,
"./cy" : 64226 ,
"./cy.js" : 64226 ,
"./da" : 93601 ,
"./da.js" : 93601 ,
"./de" : 77853 ,
"./de-at" : 26111 ,
"./de-at.js" : 26111 ,
"./de-ch" : 54697 ,
"./de-ch.js" : 54697 ,
"./de.js" : 77853 ,
"./dv" : 60708 ,
"./dv.js" : 60708 ,
"./el" : 54691 ,
"./el.js" : 54691 ,
"./en-au" : 53872 ,
"./en-au.js" : 53872 ,
"./en-ca" : 28298 ,
"./en-ca.js" : 28298 ,
"./en-gb" : 56195 ,
"./en-gb.js" : 56195 ,
"./en-ie" : 66584 ,
"./en-ie.js" : 66584 ,
"./en-il" : 65543 ,
"./en-il.js" : 65543 ,
"./en-in" : 9033 ,
"./en-in.js" : 9033 ,
"./en-nz" : 79402 ,
"./en-nz.js" : 79402 ,
"./en-sg" : 43004 ,
"./en-sg.js" : 43004 ,
"./eo" : 32934 ,
"./eo.js" : 32934 ,
"./es" : 97650 ,
"./es-do" : 20838 ,
"./es-do.js" : 20838 ,
"./es-mx" : 17730 ,
"./es-mx.js" : 17730 ,
"./es-us" : 56575 ,
"./es-us.js" : 56575 ,
"./es.js" : 97650 ,
"./et" : 3035 ,
"./et.js" : 3035 ,
"./eu" : 3508 ,
"./eu.js" : 3508 ,
"./fa" : 119 ,
"./fa.js" : 119 ,
"./fi" : 90527 ,
"./fi.js" : 90527 ,
"./fil" : 95995 ,
"./fil.js" : 95995 ,
"./fo" : 52477 ,
"./fo.js" : 52477 ,
"./fr" : 85498 ,
"./fr-ca" : 26435 ,
"./fr-ca.js" : 26435 ,
"./fr-ch" : 37892 ,
"./fr-ch.js" : 37892 ,
"./fr.js" : 85498 ,
"./fy" : 37071 ,
"./fy.js" : 37071 ,
"./ga" : 41734 ,
"./ga.js" : 41734 ,
"./gd" : 70217 ,
"./gd.js" : 70217 ,
"./gl" : 77329 ,
"./gl.js" : 77329 ,
"./gom-deva" : 32124 ,
"./gom-deva.js" : 32124 ,
"./gom-latn" : 93383 ,
"./gom-latn.js" : 93383 ,
"./gu" : 95050 ,
"./gu.js" : 95050 ,
"./he" : 11713 ,
"./he.js" : 11713 ,
"./hi" : 43861 ,
"./hi.js" : 43861 ,
"./hr" : 26308 ,
"./hr.js" : 26308 ,
"./hu" : 90609 ,
"./hu.js" : 90609 ,
"./hy-am" : 17160 ,
"./hy-am.js" : 17160 ,
"./id" : 74063 ,
"./id.js" : 74063 ,
"./is" : 89374 ,
"./is.js" : 89374 ,
"./it" : 88383 ,
"./it-ch" : 21827 ,
"./it-ch.js" : 21827 ,
"./it.js" : 88383 ,
"./ja" : 23827 ,
"./ja.js" : 23827 ,
"./jv" : 89722 ,
"./jv.js" : 89722 ,
"./ka" : 41794 ,
"./ka.js" : 41794 ,
"./kk" : 27088 ,
"./kk.js" : 27088 ,
"./km" : 96870 ,
"./km.js" : 96870 ,
"./kn" : 84451 ,
"./kn.js" : 84451 ,
"./ko" : 63164 ,
"./ko.js" : 63164 ,
"./ku" : 98174 ,
"./ku.js" : 98174 ,
"./ky" : 78474 ,
"./ky.js" : 78474 ,
"./lb" : 79680 ,
"./lb.js" : 79680 ,
"./lo" : 15867 ,
"./lo.js" : 15867 ,
"./lt" : 45766 ,
"./lt.js" : 45766 ,
"./lv" : 69532 ,
"./lv.js" : 69532 ,
"./me" : 58076 ,
"./me.js" : 58076 ,
"./mi" : 41848 ,
"./mi.js" : 41848 ,
"./mk" : 30306 ,
"./mk.js" : 30306 ,
"./ml" : 73739 ,
"./ml.js" : 73739 ,
"./mn" : 99053 ,
"./mn.js" : 99053 ,
"./mr" : 86169 ,
"./mr.js" : 86169 ,
"./ms" : 73386 ,
"./ms-my" : 92297 ,
"./ms-my.js" : 92297 ,
"./ms.js" : 73386 ,
"./mt" : 77075 ,
"./mt.js" : 77075 ,
"./my" : 72264 ,
"./my.js" : 72264 ,
"./nb" : 22274 ,
"./nb.js" : 22274 ,
"./ne" : 8235 ,
"./ne.js" : 8235 ,
"./nl" : 92572 ,
"./nl-be" : 43784 ,
"./nl-be.js" : 43784 ,
"./nl.js" : 92572 ,
"./nn" : 54566 ,
"./nn.js" : 54566 ,
"./oc-lnc" : 69330 ,
"./oc-lnc.js" : 69330 ,
"./pa-in" : 29849 ,
"./pa-in.js" : 29849 ,
"./pl" : 94418 ,
"./pl.js" : 94418 ,
"./pt" : 79834 ,
"./pt-br" : 48303 ,
"./pt-br.js" : 48303 ,
"./pt.js" : 79834 ,
"./ro" : 24457 ,
"./ro.js" : 24457 ,
"./ru" : 82271 ,
"./ru.js" : 82271 ,
"./sd" : 1221 ,
"./sd.js" : 1221 ,
"./se" : 33478 ,
"./se.js" : 33478 ,
"./si" : 17538 ,
"./si.js" : 17538 ,
"./sk" : 5784 ,
"./sk.js" : 5784 ,
"./sl" : 46637 ,
"./sl.js" : 46637 ,
"./sq" : 86794 ,
"./sq.js" : 86794 ,
"./sr" : 45719 ,
"./sr-cyrl" : 3322 ,
"./sr-cyrl.js" : 3322 ,
"./sr.js" : 45719 ,
"./ss" : 33619 ,
"./ss.js" : 33619 ,
"./sv" : 41011 ,
"./sv.js" : 41011 ,
"./sw" : 40748 ,
"./sw.js" : 40748 ,
"./ta" : 11025 ,
"./ta.js" : 11025 ,
"./te" : 11885 ,
"./te.js" : 11885 ,
"./tet" : 28861 ,
"./tet.js" : 28861 ,
"./tg" : 86571 ,
"./tg.js" : 86571 ,
"./th" : 55802 ,
"./th.js" : 55802 ,
"./tk" : 59527 ,
"./tk.js" : 59527 ,
"./tl-ph" : 29231 ,
"./tl-ph.js" : 29231 ,
"./tlh" : 31052 ,
"./tlh.js" : 31052 ,
"./tr" : 85096 ,
"./tr.js" : 85096 ,
"./tzl" : 79846 ,
"./tzl.js" : 79846 ,
"./tzm" : 81765 ,
"./tzm-latn" : 97711 ,
"./tzm-latn.js" : 97711 ,
"./tzm.js" : 81765 ,
"./ug-cn" : 48414 ,
"./ug-cn.js" : 48414 ,
"./uk" : 16618 ,
"./uk.js" : 16618 ,
"./ur" : 57777 ,
"./ur.js" : 57777 ,
"./uz" : 57609 ,
"./uz-latn" : 72475 ,
"./uz-latn.js" : 72475 ,
"./uz.js" : 57609 ,
"./vi" : 21135 ,
"./vi.js" : 21135 ,
"./x-pseudo" : 64051 ,
"./x-pseudo.js" : 64051 ,
"./yo" : 82218 ,
"./yo.js" : 82218 ,
"./zh-cn" : 52648 ,
"./zh-cn.js" : 52648 ,
"./zh-hk" : 1632 ,
"./zh-hk.js" : 1632 ,
"./zh-mo" : 31541 ,
"./zh-mo.js" : 31541 ,
"./zh-tw" : 50304 ,
"./zh-tw.js" : 50304
} ;
2025-09-24 18:27:08 -06:00
2025-10-16 10:59:50 -06:00
function webpackContext ( req ) {
var id = webpackContextResolve ( req ) ;
return _ _webpack _require _ _ ( id ) ;
}
function webpackContextResolve ( req ) {
if ( ! _ _webpack _require _ _ . o ( map , req ) ) {
var e = new Error ( "Cannot find module '" + req + "'" ) ;
e . code = 'MODULE_NOT_FOUND' ;
throw e ;
}
return map [ req ] ;
}
webpackContext . keys = function webpackContextKeys ( ) {
return Object . keys ( map ) ;
} ;
webpackContext . resolve = webpackContextResolve ;
module . exports = webpackContext ;
webpackContext . id = 35358 ;
2025-09-24 18:27:08 -06:00
/***/ } ) ,
2025-10-18 13:48:40 -06:00
/***/ 36736 :
/***/ ( ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) => {
2025-09-24 18:27:08 -06:00
"use strict" ;
2025-10-18 13:48:40 -06:00
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"default" : ( ) => ( /* binding */ main )
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// EXTERNAL MODULE: ./node_modules/@babel/polyfill/lib/index.js
var lib = _ _webpack _require _ _ ( 27461 ) ;
// EXTERNAL MODULE: external "jQuery"
var external _jQuery _ = _ _webpack _require _ _ ( 41669 ) ;
var external _jQuery _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _jQuery _ ) ;
; // ./app/utils/remodal.js
/* Remodal from https:/ / github . com / vodkabears / Remodal
* With Stackable option from https : //github.com/antstorm/Remodal patch
* /
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
! function ( root , factory ) {
return factory ( root , ( external _jQuery _default ( ) ) ) ;
} ( undefined , function ( global , $ ) {
'use strict' ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Name of the plugin
* @ private
* @ const
* @ type { String }
* /
var PLUGIN _NAME = 'remodal' ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Namespace for CSS and events
* @ private
* @ const
* @ type { String }
* /
var NAMESPACE = window . REMODAL _GLOBALS && window . REMODAL _GLOBALS . NAMESPACE || PLUGIN _NAME ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Animationstart event with vendor prefixes
* @ private
* @ const
* @ type { String }
* /
var ANIMATIONSTART _EVENTS = $ . map ( [ 'animationstart' , 'webkitAnimationStart' , 'MSAnimationStart' , 'oAnimationStart' ] , function ( eventName ) {
return eventName + '.' + NAMESPACE ;
} ) . join ( ' ' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Animationend event with vendor prefixes
* @ private
* @ const
* @ type { String }
* /
var ANIMATIONEND _EVENTS = $ . map ( [ 'animationend' , 'webkitAnimationEnd' , 'MSAnimationEnd' , 'oAnimationEnd' ] , function ( eventName ) {
return eventName + '.' + NAMESPACE ;
} ) . join ( ' ' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Default settings
* @ private
* @ const
* @ type { Object }
* /
var DEFAULTS = $ . extend ( {
hashTracking : true ,
closeOnConfirm : true ,
closeOnCancel : true ,
closeOnEscape : true ,
closeOnOutsideClick : true ,
modifier : '' ,
stack : false ,
appendTo : null
} , window . REMODAL _GLOBALS && window . REMODAL _GLOBALS . DEFAULTS ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* States of the Remodal
* @ private
* @ const
* @ enum { String }
* /
var STATES = {
CLOSING : 'closing' ,
CLOSED : 'closed' ,
OPENING : 'opening' ,
OPENED : 'opened'
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Reasons of the state change .
* @ private
* @ const
* @ enum { String }
* /
var STATE _CHANGE _REASONS = {
CONFIRMATION : 'confirmation' ,
CANCELLATION : 'cancellation'
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Is animation supported ?
* @ private
* @ const
* @ type { Boolean }
* /
var IS _ANIMATION = function ( ) {
var style = document . createElement ( 'div' ) . style ;
return style . animationName !== undefined || style . WebkitAnimationName !== undefined || style . MozAnimationName !== undefined || style . msAnimationName !== undefined || style . OAnimationName !== undefined ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Is iOS ?
* @ private
* @ const
* @ type { Boolean }
* /
var IS _IOS = /iPad|iPhone|iPod/ . test ( navigator . platform ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Current modal
* @ private
* @ type { Remodal }
* /
var openModals = [ ] ;
/ * *
* Scrollbar position
* @ private
* @ type { Number }
* /
var scrollTop ;
/ * *
* Returns an animation duration
* @ private
* @ param { jQuery } $elem
* @ returns { Number }
* /
function getAnimationDuration ( $elem ) {
if ( IS _ANIMATION && $elem . css ( 'animation-name' ) === 'none' && $elem . css ( '-webkit-animation-name' ) === 'none' && $elem . css ( '-moz-animation-name' ) === 'none' && $elem . css ( '-o-animation-name' ) === 'none' && $elem . css ( '-ms-animation-name' ) === 'none' ) {
return 0 ;
}
var duration = $elem . css ( 'animation-duration' ) || $elem . css ( '-webkit-animation-duration' ) || $elem . css ( '-moz-animation-duration' ) || $elem . css ( '-o-animation-duration' ) || $elem . css ( '-ms-animation-duration' ) || '0s' ;
var delay = $elem . css ( 'animation-delay' ) || $elem . css ( '-webkit-animation-delay' ) || $elem . css ( '-moz-animation-delay' ) || $elem . css ( '-o-animation-delay' ) || $elem . css ( '-ms-animation-delay' ) || '0s' ;
var iterationCount = $elem . css ( 'animation-iteration-count' ) || $elem . css ( '-webkit-animation-iteration-count' ) || $elem . css ( '-moz-animation-iteration-count' ) || $elem . css ( '-o-animation-iteration-count' ) || $elem . css ( '-ms-animation-iteration-count' ) || '1' ;
var max ;
var len ;
var num ;
var i ;
duration = duration . split ( ', ' ) ;
delay = delay . split ( ', ' ) ;
iterationCount = iterationCount . split ( ', ' ) ;
// The 'duration' size is the same as the 'delay' size
for ( i = 0 , len = duration . length , max = Number . NEGATIVE _INFINITY ; i < len ; i ++ ) {
num = parseFloat ( duration [ i ] ) * parseInt ( iterationCount [ i ] , 10 ) + parseFloat ( delay [ i ] ) ;
if ( num > max ) {
max = num ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
return max ;
}
/ * *
* Returns a scrollbar width
* @ private
* @ returns { Number }
* /
function getScrollbarWidth ( ) {
if ( $ ( document ) . height ( ) <= $ ( window ) . height ( ) ) {
return 0 ;
}
var outer = document . createElement ( 'div' ) ;
var inner = document . createElement ( 'div' ) ;
var widthNoScroll ;
var widthWithScroll ;
outer . style . visibility = 'hidden' ;
outer . style . width = '100px' ;
document . body . appendChild ( outer ) ;
widthNoScroll = outer . offsetWidth ;
// Force scrollbars
outer . style . overflow = 'scroll' ;
// Add inner div
inner . style . width = '100%' ;
outer . appendChild ( inner ) ;
widthWithScroll = inner . offsetWidth ;
// Remove divs
outer . parentNode . removeChild ( outer ) ;
return widthNoScroll - widthWithScroll ;
}
/ * *
* Locks the screen
* @ private
* /
function lockScreen ( ) {
if ( IS _IOS ) {
return ;
}
var $html = $ ( 'html' ) ;
var lockedClass = namespacify ( 'is-locked' ) ;
var paddingRight ;
var $body ;
if ( ! $html . hasClass ( lockedClass ) ) {
$body = $ ( document . body ) ;
// Zepto does not support '-=', '+=' in the `css` method
paddingRight = parseInt ( $body . css ( 'padding-right' ) , 10 ) + getScrollbarWidth ( ) ;
$body . css ( 'padding-right' , paddingRight + 'px' ) ;
$html . addClass ( lockedClass ) ;
}
}
/ * *
* Unlocks the screen
* @ private
* /
function unlockScreen ( ) {
if ( IS _IOS ) {
return ;
}
var $html = $ ( 'html' ) ;
var lockedClass = namespacify ( 'is-locked' ) ;
var paddingRight ;
var $body ;
if ( $html . hasClass ( lockedClass ) ) {
$body = $ ( document . body ) ;
// Zepto does not support '-=', '+=' in the `css` method
paddingRight = parseInt ( $body . css ( 'padding-right' ) , 10 ) - getScrollbarWidth ( ) ;
$body . css ( 'padding-right' , paddingRight + 'px' ) ;
$html . removeClass ( lockedClass ) ;
}
}
/ * *
* Sets a state for an instance
* @ private
* @ param { Remodal } instance
* @ param { STATES } state
* @ param { Boolean } isSilent If true , Remodal does not trigger events
* @ param { String } Reason of a state change .
* /
function setState ( instance , state , isSilent , reason ) {
var newState = namespacify ( 'is' , state ) ;
var allStates = [ namespacify ( 'is' , STATES . CLOSING ) , namespacify ( 'is' , STATES . OPENING ) , namespacify ( 'is' , STATES . CLOSED ) , namespacify ( 'is' , STATES . OPENED ) ] . join ( ' ' ) ;
instance . $bg . removeClass ( allStates ) . addClass ( newState ) ;
instance . $overlay . removeClass ( allStates ) . addClass ( newState ) ;
instance . $wrapper . removeClass ( allStates ) . addClass ( newState ) ;
instance . $modal . removeClass ( allStates ) . addClass ( newState ) ;
instance . state = state ;
! isSilent && instance . $modal . trigger ( {
type : state ,
reason : reason
} , [ {
reason : reason
} ] ) ;
}
/ * *
* Synchronizes with the animation
* @ param { Function } doBeforeAnimation
* @ param { Function } doAfterAnimation
* @ param { Remodal } instance
* /
function syncWithAnimation ( doBeforeAnimation , doAfterAnimation , instance ) {
var runningAnimationsCount = 0 ;
var handleAnimationStart = function handleAnimationStart ( e ) {
if ( e . target !== this ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
runningAnimationsCount ++ ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var handleAnimationEnd = function handleAnimationEnd ( e ) {
if ( e . target !== this ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( -- runningAnimationsCount === 0 ) {
// Remove event listeners
$ . each ( [ '$bg' , '$overlay' , '$wrapper' , '$modal' ] , function ( index , elemName ) {
instance [ elemName ] . off ( ANIMATIONSTART _EVENTS + ' ' + ANIMATIONEND _EVENTS ) ;
} ) ;
doAfterAnimation ( ) ;
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
$ . each ( [ '$bg' , '$overlay' , '$wrapper' , '$modal' ] , function ( index , elemName ) {
instance [ elemName ] . on ( ANIMATIONSTART _EVENTS , handleAnimationStart ) . on ( ANIMATIONEND _EVENTS , handleAnimationEnd ) ;
} ) ;
doBeforeAnimation ( ) ;
// If the animation is not supported by a browser or its duration is 0
if ( getAnimationDuration ( instance . $bg ) === 0 && getAnimationDuration ( instance . $overlay ) === 0 && getAnimationDuration ( instance . $wrapper ) === 0 && getAnimationDuration ( instance . $modal ) === 0 ) {
// Remove event listeners
$ . each ( [ '$bg' , '$overlay' , '$wrapper' , '$modal' ] , function ( index , elemName ) {
instance [ elemName ] . off ( ANIMATIONSTART _EVENTS + ' ' + ANIMATIONEND _EVENTS ) ;
} ) ;
doAfterAnimation ( ) ;
}
}
/ * *
* Closes immediately
* @ private
* @ param { Remodal } instance
* /
function halt ( instance ) {
if ( instance . state === STATES . CLOSED ) {
return ;
}
$ . each ( [ '$bg' , '$overlay' , '$wrapper' , '$modal' ] , function ( index , elemName ) {
instance [ elemName ] . off ( ANIMATIONSTART _EVENTS + ' ' + ANIMATIONEND _EVENTS ) ;
} ) ;
removeModal ( instance ) ;
instance . $bg . removeClass ( instance . settings . modifier ) ;
instance . $overlay . removeClass ( instance . settings . modifier ) . hide ( ) ;
instance . $wrapper . hide ( ) ;
if ( openModals . length === 0 ) {
unlockScreen ( ) ;
}
setState ( instance , STATES . CLOSED , true ) ;
}
/ * *
* Parses a string with options
* @ private
* @ param str
* @ returns { Object }
* /
function parseOptions ( str ) {
var obj = { } ;
var arr ;
var len ;
var val ;
var i ;
// Remove spaces before and after delimiters
str = str . replace ( /\s*:\s*/g , ':' ) . replace ( /\s*,\s*/g , ',' ) ;
// Parse a string
arr = str . split ( ',' ) ;
for ( i = 0 , len = arr . length ; i < len ; i ++ ) {
arr [ i ] = arr [ i ] . split ( ':' ) ;
val = arr [ i ] [ 1 ] ;
// Convert a string value if it is like a boolean
if ( typeof val === 'string' || val instanceof String ) {
val = val === 'true' || ( val === 'false' ? false : val ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// Convert a string value if it is like a number
if ( typeof val === 'string' || val instanceof String ) {
val = ! isNaN ( val ) ? + val : val ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
obj [ arr [ i ] [ 0 ] ] = val ;
}
return obj ;
}
/ * *
* Generates a string separated by dashes and prefixed with NAMESPACE
* @ private
* @ param { ... String }
* @ returns { String }
* /
function namespacify ( ) {
var result = NAMESPACE ;
for ( var i = 0 ; i < arguments . length ; ++ i ) {
result += '-' + arguments [ i ] ;
}
return result ;
}
/ * *
* Handles the hashchange event
* @ private
* @ listens hashchange
* /
function handleHashChangeEvent ( ) {
var id = location . hash . replace ( '#' , '' ) ;
var instance ;
var $elem ;
var current = currentModal ( ) ;
if ( ! id ) {
// Check if we have currently opened modal and animation was completed
if ( current && current . state === STATES . OPENED && current . settings . hashTracking ) {
current . close ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} else {
if ( ! current || current . id !== id ) {
// Catch syntax error if your hash is bad
try {
$elem = $ ( '[data-' + PLUGIN _NAME + '-id="' + id + '"]' ) ;
} catch ( err ) { }
if ( $elem && $elem . length ) {
instance = $ [ PLUGIN _NAME ] . lookup [ $elem . data ( PLUGIN _NAME ) ] ;
if ( instance && instance . settings . hashTracking ) {
instance . open ( ) ;
}
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
}
function currentModal ( ) {
return openModals [ openModals . length - 1 ] ;
}
function removeModal ( remodal ) {
var index = openModals . indexOf ( remodal ) ;
if ( index >= 0 ) {
openModals . slice ( index , 1 ) ;
}
}
/ * *
* Remodal constructor
* @ constructor
* @ param { jQuery } $modal
* @ param { Object } options
* /
function Remodal ( $modal , options ) {
var $body = $ ( document . body ) ;
var $appendTo = $body ;
var remodal = this ;
remodal . id = $modal . attr ( 'data-' + PLUGIN _NAME + '-id' ) ;
remodal . settings = $ . extend ( { } , DEFAULTS , options ) ;
remodal . index = $ [ PLUGIN _NAME ] . lookup . push ( remodal ) - 1 ;
remodal . state = STATES . CLOSED ;
// remodal.$overlay = $('.' + namespacify('overlay'));
if ( remodal . settings . appendTo !== null && remodal . settings . appendTo . length ) {
$appendTo = $ ( remodal . settings . appendTo ) ;
}
if ( ! remodal . $overlay ) {
remodal . $overlay = $ ( '<div>' ) . addClass ( namespacify ( 'overlay' ) + ' ' + namespacify ( 'is' , STATES . CLOSED ) ) . hide ( ) ;
$appendTo . append ( remodal . $overlay ) ;
}
remodal . $bg = $ ( '.' + namespacify ( 'bg' ) ) . addClass ( namespacify ( 'is' , STATES . CLOSED ) ) ;
remodal . $modal = $modal . addClass ( NAMESPACE + ' ' + namespacify ( 'is-initialized' ) + ' ' + remodal . settings . modifier + ' ' + namespacify ( 'is' , STATES . CLOSED ) ) . attr ( 'tabindex' , '-1' ) ;
remodal . $wrapper = $ ( '<div>' ) . addClass ( namespacify ( 'wrapper' ) + ' ' + remodal . settings . modifier + ' ' + namespacify ( 'is' , STATES . CLOSED ) ) . hide ( ) . append ( remodal . $modal ) ;
$appendTo . append ( remodal . $wrapper ) ;
// Add the event listener for the close button
remodal . $wrapper . on ( 'click.' + NAMESPACE , '[data-' + PLUGIN _NAME + '-action="close"]' , function ( e ) {
e . preventDefault ( ) ;
remodal . close ( ) ;
} ) ;
// Add the event listener for the cancel button
remodal . $wrapper . on ( 'click.' + NAMESPACE , '[data-' + PLUGIN _NAME + '-action="cancel"]' , function ( e ) {
e . preventDefault ( ) ;
remodal . $modal . trigger ( STATE _CHANGE _REASONS . CANCELLATION ) ;
if ( remodal . settings . closeOnCancel ) {
remodal . close ( STATE _CHANGE _REASONS . CANCELLATION ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
// Add the event listener for the confirm button
remodal . $wrapper . on ( 'click.' + NAMESPACE , '[data-' + PLUGIN _NAME + '-action="confirm"]' , function ( e ) {
e . preventDefault ( ) ;
remodal . $modal . trigger ( STATE _CHANGE _REASONS . CONFIRMATION ) ;
if ( remodal . settings . closeOnConfirm ) {
remodal . close ( STATE _CHANGE _REASONS . CONFIRMATION ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
// Add the event listener for the overlay
remodal . $wrapper . on ( 'click.' + NAMESPACE , function ( e ) {
var $target = $ ( e . target ) ;
var isWrapper = $target . hasClass ( namespacify ( 'wrapper' ) ) ;
var isWithin = $target . closest ( '.' + namespacify ( 'is' , STATES . OPENED ) ) . length ;
if ( ! isWrapper && isWithin ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( remodal . settings . closeOnOutsideClick ) {
remodal . close ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
}
/ * *
* Opens a modal window
* @ public
* /
Remodal . prototype . open = function ( ) {
var remodal = this ;
var current ;
var modalCount ;
// Check if the animation was completed
if ( remodal . state === STATES . OPENING || remodal . state === STATES . CLOSING ) {
return ;
}
// id = remodal.$modal.attr('data-' + PLUGIN_NAME + '-id');
if ( remodal . id && remodal . settings . hashTracking ) {
scrollTop = $ ( window ) . scrollTop ( ) ;
location . hash = remodal . id ;
}
if ( ! remodal . settings . stack ) {
current = currentModal ( ) ;
if ( current && current !== remodal ) {
halt ( current ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
modalCount = openModals . push ( remodal ) ;
remodal . $overlay . css ( 'z-index' , function ( _ , value ) {
return parseInt ( value , 10 ) + modalCount ;
} ) ;
remodal . $wrapper . css ( 'z-index' , function ( _ , value ) {
return parseInt ( value , 10 ) + modalCount ;
} ) ;
lockScreen ( ) ;
remodal . $bg . addClass ( remodal . settings . modifier ) ;
remodal . $overlay . addClass ( remodal . settings . modifier ) . show ( ) ;
remodal . $wrapper . show ( ) . scrollTop ( 0 ) ;
remodal . $modal . focus ( ) ;
syncWithAnimation ( function ( ) {
setState ( remodal , STATES . OPENING ) ;
} , function ( ) {
setState ( remodal , STATES . OPENED ) ;
} , remodal ) ;
} ;
/ * *
* Closes a modal window
* @ public
* @ param { String } reason
* /
Remodal . prototype . close = function ( reason ) {
var remodal = this ;
var current ;
// Check if the animation was completed
if ( remodal . state === STATES . OPENING || remodal . state === STATES . CLOSING || remodal . state === STATES . CLOSED ) {
return ;
}
removeModal ( remodal ) ;
if ( remodal . settings . hashTracking && remodal . id === location . hash . substr ( 1 ) ) {
current = currentModal ( ) ;
if ( current ) {
location . hash = current . id ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
location . hash = '' ;
$ ( window ) . scrollTop ( scrollTop ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
syncWithAnimation ( function ( ) {
setState ( remodal , STATES . CLOSING , false , reason ) ;
} , function ( ) {
remodal . $bg . removeClass ( remodal . settings . modifier ) ;
remodal . $overlay . removeClass ( remodal . settings . modifier ) . hide ( ) ;
remodal . $wrapper . hide ( ) ;
if ( openModals . length === 0 ) {
unlockScreen ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
setState ( remodal , STATES . CLOSED , false , reason ) ;
} , remodal ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Returns a current state of a modal
* @ public
* @ returns { STATES }
* /
Remodal . prototype . getState = function ( ) {
return this . state ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Destroys a modal
* @ public
* /
Remodal . prototype . destroy = function ( ) {
var lookup = $ [ PLUGIN _NAME ] . lookup ;
var instanceCount ;
halt ( this ) ;
this . $wrapper . remove ( ) ;
delete lookup [ this . index ] ;
instanceCount = $ . grep ( lookup , function ( instance ) {
return ! ! instance ;
} ) . length ;
if ( instanceCount === 0 ) {
this . $overlay . remove ( ) ;
this . $bg . removeClass ( namespacify ( 'is' , STATES . CLOSING ) + ' ' + namespacify ( 'is' , STATES . OPENING ) + ' ' + namespacify ( 'is' , STATES . CLOSED ) + ' ' + namespacify ( 'is' , STATES . OPENED ) ) ;
}
} ;
/ * *
* Special plugin object for instances
* @ public
* @ type { Object }
* /
$ [ PLUGIN _NAME ] = {
lookup : [ ]
} ;
/ * *
* Plugin constructor
* @ constructor
* @ param { Object } options
* @ returns { JQuery }
* /
$ . fn [ PLUGIN _NAME ] = function ( opts ) {
var instance ;
var $elem ;
this . each ( function ( index , elem ) {
$elem = $ ( elem ) ;
if ( $elem . data ( PLUGIN _NAME ) == null ) {
instance = new Remodal ( $elem , opts ) ;
$elem . data ( PLUGIN _NAME , instance . index ) ;
if ( instance . settings . hashTracking && instance . id === location . hash . substr ( 1 ) ) {
instance . open ( ) ;
2025-10-16 10:59:50 -06:00
}
} else {
2025-10-18 13:48:40 -06:00
instance = $ [ PLUGIN _NAME ] . lookup [ $elem . data ( PLUGIN _NAME ) ] ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
return instance ;
} ;
$ ( document ) . ready ( function ( ) {
// data-remodal-target opens a modal window with the special Id
$ ( document ) . on ( 'click' , '[data-' + PLUGIN _NAME + '-target]' , function ( e ) {
e . preventDefault ( ) ;
var elem = e . currentTarget ;
var id = elem . getAttribute ( 'data-' + PLUGIN _NAME + '-target' ) ;
var $target = $ ( '[data-' + PLUGIN _NAME + '-id="' + id + '"]' ) ;
$ [ PLUGIN _NAME ] . lookup [ $target . data ( PLUGIN _NAME ) ] . open ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Auto initialization of modal windows
// They should have the 'remodal' class attribute
// Also you can write the `data-remodal-options` attribute to pass params into the modal
$ ( document ) . find ( '.' + NAMESPACE ) . each ( function ( i , container ) {
var $container = $ ( container ) ;
var options = $container . data ( PLUGIN _NAME + '-options' ) ;
if ( ! options ) {
options = { } ;
} else if ( typeof options === 'string' || options instanceof String ) {
options = parseOptions ( options ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$container [ PLUGIN _NAME ] ( options ) ;
} ) ;
// Handles the keydown event
$ ( document ) . on ( 'keydown.' + NAMESPACE , function ( e ) {
var current = currentModal ( ) ;
if ( current && current . settings . closeOnEscape && current . state === STATES . OPENED && e . keyCode === 27 ) {
current . close ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
// Handles the hashchange event
$ ( window ) . on ( 'hashchange.' + NAMESPACE , handleHashChangeEvent ) ;
} ) ;
} ) ;
// EXTERNAL MODULE: ./node_modules/simplebar/dist/simplebar.min.js
var simplebar _min = _ _webpack _require _ _ ( 88904 ) ;
// EXTERNAL MODULE: ./node_modules/dropzone/dist/dropzone.js
var dist _dropzone = _ _webpack _require _ _ ( 62628 ) ;
var dropzone _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( dist _dropzone ) ;
// EXTERNAL MODULE: ./node_modules/toastr/toastr.js
var toastr = _ _webpack _require _ _ ( 47959 ) ;
var toastr _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( toastr ) ;
; // ./app/utils/toastr.js
( toastr _default ( ) ) . options . positionClass = 'toast-top-right' ;
( toastr _default ( ) ) . options . preventDuplicates = true ;
/* harmony default export */ const utils _toastr = ( ( toastr _default ( ) ) ) ;
; // ./app/utils/offline.js
var offlineElement = external _jQuery _default ( ) ( '#offline-status' ) ;
external _jQuery _default ( ) ( window ) . on ( 'offline' , function ( ) {
offlineElement . slideDown ( ) ;
} ) ;
external _jQuery _default ( ) ( window ) . on ( 'online' , function ( ) {
offlineElement . slideUp ( ) ;
} ) ;
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
if ( ! offline ) {
offlineElement . slideDown ( ) ;
}
} ) ;
// assume online if can't check
/* harmony default export */ const offline = ( typeof _ _webpack _require _ _ . g . navigator . onLine !== 'undefined' ? _ _webpack _require _ _ . g . navigator . onLine : true ) ;
// EXTERNAL MODULE: ./node_modules/mout/string/trim.js
var trim = _ _webpack _require _ _ ( 35814 ) ;
var trim _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( trim ) ;
; // external "GravAdmin"
const external _GravAdmin _namespaceObject = GravAdmin ;
; // ./app/utils/keepalive.js
function _typeof ( o ) { "@babel/helpers - typeof" ; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , _typeof ( o ) ; }
function _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , _toPropertyKey ( o . key ) , o ) ; } }
function _createClass ( e , r , t ) { return r && _defineProperties ( e . prototype , r ) , t && _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function _toPropertyKey ( t ) { var i = _toPrimitive ( t , "string" ) ; return "symbol" == _typeof ( i ) ? i : i + "" ; }
function _toPrimitive ( t , r ) { if ( "object" != _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var MAX _SAFE _DELAY = 2147483647 ;
var KeepAlive = /*#__PURE__*/ function ( ) {
function KeepAlive ( ) {
_classCallCheck ( this , KeepAlive ) ;
this . active = false ;
}
return _createClass ( KeepAlive , [ {
key : "start" ,
value : function start ( ) {
var _this = this ;
var timeout = external _GravAdmin _namespaceObject . config . admin _timeout / 1.5 * 1000 ;
this . timer = setInterval ( function ( ) {
return _this . fetch ( ) ;
} , Math . min ( timeout , MAX _SAFE _DELAY ) ) ;
this . active = true ;
}
} , {
key : "stop" ,
value : function stop ( ) {
clearInterval ( this . timer ) ;
this . active = false ;
}
} , {
key : "checkOnce" ,
value : function checkOnce ( ) {
var data = new FormData ( ) ;
data . append ( 'admin-nonce' , external _GravAdmin _namespaceObject . config . admin _nonce ) ;
return fetch ( "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "keepAlive" ) , {
credentials : 'same-origin' ,
method : 'post' ,
body : data
} ) . then ( function ( response ) {
if ( response && ( response . status === 401 || response . status === 403 ) ) {
2025-10-16 10:59:50 -06:00
return false ;
}
2025-10-18 13:48:40 -06:00
return true ;
} ) [ "catch" ] ( function ( ) {
return false ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
} , {
key : "fetch" ,
value : function fetch ( ) {
return this . checkOnce ( ) . then ( function ( ok ) {
if ( ! ok ) {
showSessionExpiredModal ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) [ "catch" ] ( userFeedbackError ) ;
}
} ] ) ;
} ( ) ;
/* harmony default export */ const keepalive = ( new KeepAlive ( ) ) ;
; // ./app/utils/session-expired.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var shown = false ;
function showSessionExpiredModal ( ) {
if ( shown ) {
return ;
}
shown = true ;
try {
localStorage . setItem ( 'grav:admin:sessionExpiredShown' , '1' ) ;
} catch ( e ) { }
try {
keepalive . stop ( ) ;
} catch ( e ) { }
// Ensure modal exists (in case a custom layout removed it)
var $modal = external _jQuery _default ( ) ( '[data-remodal-id="session-expired"]' ) ;
if ( ! $modal . length ) {
var html = "\n <div class=\"remodal\" data-remodal-id=\"session-expired\" data-remodal-options=\"hashTracking: false\">\n <form>\n <h1>Session Expired</h1>\n <p class=\"bigger\">Your admin login session has expired. Please log in again.</p>\n <div class=\"button-bar\">\n <a class=\"button remodal-confirm\" data-remodal-action=\"confirm\" href=\"#\">OK</a>\n </div>\n </form>\n </div>" ;
external _jQuery _default ( ) ( 'body' ) . append ( html ) ;
$modal = external _jQuery _default ( ) ( '[data-remodal-id="session-expired"]' ) ;
}
// Harden the modal: no escape/overlay close
var instance = $modal . remodal ( {
hashTracking : false ,
closeOnEscape : false ,
closeOnOutsideClick : false ,
closeOnCancel : false ,
closeOnConfirm : true ,
stack : false
} ) ;
// Style overlay + blur background
external _jQuery _default ( ) ( 'html' ) . addClass ( 'session-expired-active' ) ;
external _jQuery _default ( ) ( '.remodal-overlay' ) . addClass ( 'session-expired' ) ;
// On confirm, redirect to login
$modal . off ( '.session-expired' ) . on ( 'confirmation.session-expired' , function ( ) {
// Keep suppression flag for the next page load (login) so we don't double prompt
window . location . href = external _GravAdmin _namespaceObject . config . base _url _relative ;
} ) ;
// Open modal
instance . open ( ) ;
}
// Bind a jQuery global ajax error trap for legacy XHR paths
function bindGlobalAjaxTrap ( ) {
external _jQuery _default ( ) ( document ) . off ( 'ajaxError._grav_session' ) . on ( 'ajaxError._grav_session' , function ( event , xhr ) {
if ( ! xhr ) {
return ;
}
var status = xhr . status || 0 ;
if ( status === 401 || status === 403 ) {
showSessionExpiredModal ( ) ;
}
} ) ;
}
// Intercept in-admin link clicks to show the modal before any server redirect to login
function installNavigationGuard ( ) {
external _jQuery _default ( ) ( document ) . off ( 'click._grav_session_nav' ) . on ( 'click._grav_session_nav' , 'a[href]' , function ( e ) {
var $a = external _jQuery _default ( ) ( this ) ;
var href = $a . attr ( 'href' ) ;
if ( ! href || href === '#' || href . indexOf ( 'javascript:' ) === 0 ) {
return ;
}
if ( e . isDefaultPrevented ( ) ) {
return ;
}
if ( $a . attr ( 'target' ) === '_blank' || e . metaKey || e . ctrlKey || e . shiftKey || e . altKey ) {
return ;
}
// Only guard admin-relative links
var base = window . GravAdmin && window . GravAdmin . config && window . GravAdmin . config . base _url _relative || '' ;
var isAdminLink = href . indexOf ( base + '/' ) === 0 || href === base || href . indexOf ( '/' ) === 0 ;
if ( ! isAdminLink ) {
return ;
}
e . preventDefault ( ) ;
// Quick session check, if invalid show modal, else proceed with navigation
try {
keepalive . checkOnce ( ) . then ( function ( ok ) {
if ( ok ) {
window . location . href = href ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
showSessionExpiredModal ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
} catch ( err ) {
// On any error, just navigate
window . location . href = href ;
}
} ) ;
}
/* harmony default export */ const session _expired = ( {
showSessionExpiredModal : showSessionExpiredModal ,
bindGlobalAjaxTrap : bindGlobalAjaxTrap
} ) ;
; // ./app/utils/response.js
function response _typeof ( o ) { "@babel/helpers - typeof" ; return response _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , response _typeof ( o ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// import { config } from 'grav-config';
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var UNLOADING = false ;
var error = function error ( response ) {
var error = new Error ( response . statusText || response || '' ) ;
error . response = response ;
return error ;
} ;
function parseStatus ( response ) {
return response ;
/ * W h o o p s c a n h a n d l e J S O N r e s p o n s e s s o w e d o n ' t n e e d t h i s f o r n o w .
if ( response . status >= 200 && response . status < 300 ) {
return response ;
} else {
throw error ( response ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
* /
}
function parseJSON ( response ) {
// If the session is no longer valid, surface a blocking modal instead of generic errors
if ( response && ( response . status === 401 || response . status === 403 ) ) {
showSessionExpiredModal ( ) ;
throw new Error ( 'Unauthorized' ) ;
}
return response . text ( ) . then ( function ( text ) {
var parsed = text ;
try {
parsed = JSON . parse ( text ) ;
} catch ( error ) {
var content = document . createElement ( 'div' ) ;
content . innerHTML = text ;
var the _error = new Error ( ) ;
the _error . stack = trim _default ( ) ( content . innerText ) ;
throw the _error ;
}
return parsed ;
} ) ;
}
function userFeedback ( response ) {
if ( UNLOADING ) {
return true ;
}
var status = response . status || ( response . error ? 'error' : '' ) ;
var message = response . message || ( response . error ? response . error . message : null ) ;
var settings = response . toastr || null ;
var backup ;
switch ( status ) {
case 'unauthenticated' :
// Show a blocking modal and stop further processing
showSessionExpiredModal ( ) ;
throw error ( 'Logged out' ) ;
case 'unauthorized' :
status = 'error' ;
message = message || 'Unauthorized.' ;
break ;
case 'error' :
status = 'error' ;
message = message || 'Unknown error.' ;
break ;
case 'success' :
status = 'success' ;
message = message || '' ;
break ;
default :
status = 'error' ;
message = message || 'Invalid AJAX response.' ;
break ;
}
if ( settings && response _typeof ( settings ) === 'object' && settings !== null ) {
backup = Object . assign ( { } , utils _toastr . options ) ;
Object . keys ( settings ) . forEach ( function ( key ) {
utils _toastr . options [ key ] = settings [ key ] ;
} ) ;
}
if ( message && ( offline || ! offline && status !== 'error' ) ) {
utils _toastr [ status === 'success' ? 'success' : 'error' ] ( message ) ;
}
if ( settings ) {
utils _toastr . options = backup ;
}
return response ;
}
function userFeedbackError ( error ) {
if ( UNLOADING ) {
return true ;
}
// If we can detect an unauthorized state here, show modal
var unauthorized = error && ( error . message === 'Unauthorized' || error . response && ( error . response . status === 401 || error . response . status === 403 ) ) ;
if ( unauthorized ) {
showSessionExpiredModal ( ) ;
return ;
}
var stack = error . stack ? "<pre><code>" . concat ( error . stack , "</code></pre>" ) : '' ;
utils _toastr . error ( "Fetch Failed: <br /> " . concat ( error . message , " " ) . concat ( stack ) ) ;
console . error ( "" . concat ( error . message , " at " ) . concat ( error . stack ) ) ;
}
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . on ( 'beforeunload._ajax' , function ( ) {
UNLOADING = true ;
} ) ;
; // ./app/utils/request.js
function request _typeof ( o ) { "@babel/helpers - typeof" ; return request _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , request _typeof ( o ) ; }
var raw ;
var request = function request ( url ) {
var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var callback = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : function ( ) {
return true ;
} ;
if ( typeof options === 'function' ) {
callback = options ;
options = { } ;
}
var silentErrors = ! ! options . silentErrors ;
if ( options . silentErrors ) {
delete options . silentErrors ;
}
if ( options . method && options . method === 'post' ) {
var data = new FormData ( ) ;
options . body = Object . assign ( {
'admin-nonce' : external _GravAdmin _namespaceObject . config . admin _nonce
} , options . body || { } ) ;
if ( options . body && request _typeof ( options . body ) === 'object' ) {
Object . keys ( options . body ) . map ( function ( key ) {
return data . append ( key , options . body [ key ] ) ;
} ) ;
}
options . body = data ;
}
options = Object . assign ( {
credentials : 'same-origin' ,
headers : {
'Accept' : 'application/json'
}
} , options ) ;
return fetch ( url , options ) . then ( function ( response ) {
raw = response ;
return response ;
} ) . then ( parseStatus ) . then ( parseJSON ) . then ( userFeedback ) . then ( function ( response ) {
return callback ( response , raw ) ;
} ) [ "catch" ] ( function ( error ) {
if ( silentErrors ) {
console . debug ( '[Request] silent failure' , url , error ) ;
return undefined ;
}
userFeedbackError ( error ) ;
return undefined ;
} ) ;
} ;
/* harmony default export */ const utils _request = ( request ) ;
; // ./app/forms/fields/files.js
function files _typeof ( o ) { "@babel/helpers - typeof" ; return files _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , files _typeof ( o ) ; }
function files _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function files _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , files _toPropertyKey ( o . key ) , o ) ; } }
function files _createClass ( e , r , t ) { return r && files _defineProperties ( e . prototype , r ) , t && files _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function files _toPropertyKey ( t ) { var i = files _toPrimitive ( t , "string" ) ; return "symbol" == files _typeof ( i ) ? i : i + "" ; }
function files _toPrimitive ( t , r ) { if ( "object" != files _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != files _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
// import EXIF from 'exif-js';
// translations
var Dictionary = {
dictCancelUpload : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _CANCEL _UPLOAD ,
dictCancelUploadConfirmation : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _CANCEL _UPLOAD _CONFIRMATION ,
dictDefaultMessage : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _DEFAULT _MESSAGE ,
dictFallbackMessage : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _FALLBACK _MESSAGE ,
dictFallbackText : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _FALLBACK _TEXT ,
dictFileTooBig : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _FILE _TOO _BIG ,
dictInvalidFileType : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _INVALID _FILE _TYPE ,
dictMaxFilesExceeded : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _MAX _FILES _EXCEEDED ,
dictRemoveFile : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _REMOVE _FILE ,
dictResponseError : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROPZONE _RESPONSE _ERROR
} ;
( dropzone _default ( ) ) . autoDiscover = false ;
( dropzone _default ( ) ) . options . gravPageDropzone = { } ;
( dropzone _default ( ) ) . confirm = function ( question , accepted , rejected ) {
var doc = external _jQuery _default ( ) ( document ) ;
var modalSelector = '[data-remodal-id="delete-media"]' ;
var removeEvents = function removeEvents ( ) {
doc . off ( 'confirmation' , modalSelector , accept ) ;
doc . off ( 'cancellation' , modalSelector , reject ) ;
external _jQuery _default ( ) ( modalSelector ) . find ( '.remodal-confirm' ) . removeClass ( 'pointer-events-disabled' ) ;
} ;
var accept = function accept ( ) {
accepted && accepted ( ) ;
removeEvents ( ) ;
} ;
var reject = function reject ( ) {
rejected && rejected ( ) ;
removeEvents ( ) ;
} ;
( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( modalSelector ) . data ( 'remodal' ) ] . open ( ) ;
doc . on ( 'confirmation' , modalSelector , accept ) ;
doc . on ( 'cancellation' , modalSelector , reject ) ;
} ;
var DropzoneMediaConfig = {
timeout : 0 ,
thumbnailWidth : 200 ,
thumbnailHeight : 150 ,
addRemoveLinks : false ,
dictDefaultMessage : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DROP _FILES _HERE _TO _UPLOAD . replace ( /</g , '<' ) . replace ( />/g , '>' ) ,
dictRemoveFileConfirmation : '[placeholder]' ,
previewTemplate : "\n <div class=\"dz-preview dz-file-preview dz-no-editor\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>\u2714</span></div>\n <div class=\"dz-error-mark\"><span>\u2718</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <a class=\"dz-unset\" title=\"" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UNSET , "\" href=\"#\" data-dz-unset>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UNSET , "</a>\n <a class=\"dz-remove\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DELETE , "\" href=\"javascript:undefined;\" data-dz-remove>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DELETE , "</a>\n <a class=\"dz-metadata\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . METADATA , "\" href=\"#\" target=\"_blank\" data-dz-metadata>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . METADATA , "</a>\n <a class=\"dz-view\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . VIEW , "\" href=\"#\" target=\"_blank\" data-dz-view>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . VIEW , "</a>\n </div>" ) . trim ( )
} ;
// global.EXIF = EXIF;
var ACCEPT _FUNC = function ACCEPT _FUNC ( file , done , settings ) {
var resolution = settings . resolution ;
if ( ! resolution ) return done ( ) ;
var reader = new FileReader ( ) ;
var error = '' ;
var hasMin = resolution . min && ( resolution . min . width || resolution . min . height ) ;
var hasMax = resolution . max && ( resolution . max . width || resolution . max . height ) ;
if ( hasMin || ! ( settings . resizeWidth || settings . resizeHeight ) && hasMax ) {
reader . onload = function ( event ) {
if ( ! /image\// . test ( file . type ) ) {
done ( ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var image = new Image ( ) ;
image . src = event . target . result ;
image . onerror = function ( ) {
done ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FILE _ERROR _UPLOAD ) ;
} ;
image . onload = function ( ) {
var _this = this ;
if ( resolution . min ) {
Object . keys ( resolution . min ) . forEach ( function ( attr ) {
if ( resolution . min [ attr ] && _this [ attr ] < resolution . min [ attr ] ) {
error += external _GravAdmin _namespaceObject . translations . PLUGIN _FORM . RESOLUTION _MIN . replace ( /{{attr}}/g , attr ) . replace ( /{{min}}/g , resolution . min [ attr ] ) ;
}
} ) ;
}
if ( ! ( settings . resizeWidth || settings . resizeHeight ) ) {
if ( resolution . max ) {
Object . keys ( resolution . max ) . forEach ( function ( attr ) {
if ( resolution . max [ attr ] && _this [ attr ] > resolution . max [ attr ] ) {
error += external _GravAdmin _namespaceObject . translations . PLUGIN _FORM . RESOLUTION _MAX . replace ( /{{attr}}/g , attr ) . replace ( /{{max}}/g , resolution . max [ attr ] ) ;
}
} ) ;
}
}
URL . revokeObjectURL ( image . src ) ; // release memory
return error ? done ( error ) : done ( ) ;
} ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
reader . readAsDataURL ( file ) ;
} else {
return error ? done ( error ) : done ( ) ;
}
} ;
var FilesField = /*#__PURE__*/ function ( ) {
function FilesField ( ) {
var _this2 = this ;
var _ref = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ,
_ref$container = _ref . container ,
container = _ref$container === void 0 ? '.dropzone.files-upload' : _ref$container ,
_ref$options = _ref . options ,
options = _ref$options === void 0 ? { } : _ref$options ;
files _classCallCheck ( this , FilesField ) ;
this . container = external _jQuery _default ( ) ( container ) ;
if ( ! this . container . length ) {
return ;
}
this . urls = { } ;
this . customPost = this . container . data ( 'filePostAdd' ) || { } ;
this . options = Object . assign ( { } , Dictionary , DropzoneMediaConfig , {
klass : this ,
url : this . container . data ( 'file-url-add' ) || external _GravAdmin _namespaceObject . config . current _url ,
acceptedFiles : this . container . data ( 'media-types' ) ,
init : this . initDropzone
} , this . container . data ( 'dropzone-options' ) , options ) ;
this . options = Object . assign ( { } , this . options , {
accept : function accept ( file , done ) {
ACCEPT _FUNC ( file , done , this . options ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
this . dropzone = new ( dropzone _default ( ) ) ( container , this . options ) ;
this . dropzone . on ( 'complete' , this . onDropzoneComplete . bind ( this ) ) ;
this . dropzone . on ( 'success' , this . onDropzoneSuccess . bind ( this ) ) ;
this . dropzone . on ( 'addedfile' , this . onDropzoneAddedFile . bind ( this ) ) ;
this . dropzone . on ( 'removedfile' , this . onDropzoneRemovedFile . bind ( this ) ) ;
this . dropzone . on ( 'sending' , this . onDropzoneSending . bind ( this ) ) ;
this . dropzone . on ( 'error' , this . onDropzoneError . bind ( this ) ) ;
this . container . on ( 'mouseenter' , '[data-dz-view]' , function ( e ) {
var value = JSON . parse ( _this2 . container . find ( '[name][type="hidden"]' ) . val ( ) || '{}' ) ;
var target = external _jQuery _default ( ) ( e . currentTarget ) ;
var file = target . parent ( '.dz-preview' ) . find ( '.dz-filename' ) ;
var filename = encodeURI ( file . text ( ) ) ;
var URL = Object . keys ( value ) . filter ( function ( key ) {
return value [ key ] . name === filename ;
} ) . shift ( ) ;
target . attr ( 'href' , "" . concat ( external _GravAdmin _namespaceObject . config . base _url _simple , "/" ) . concat ( URL ) ) ;
} ) ;
}
return files _createClass ( FilesField , [ {
key : "initDropzone" ,
value : function initDropzone ( ) {
var _this3 = this ;
var files = this . options . klass . container . find ( '[data-file]' ) ;
var dropzone = this ;
if ( ! files . length ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
files . each ( function ( index , file ) {
file = external _jQuery _default ( ) ( file ) ;
var data = file . data ( 'file' ) ;
var mock = {
name : data . name ,
size : data . size ,
type : data . type ,
status : ( dropzone _default ( ) ) . ADDED ,
accepted : true ,
url : _this3 . options . url ,
removeUrl : data . remove
} ;
dropzone . files . push ( mock ) ;
dropzone . options . addedfile . call ( dropzone , mock ) ;
if ( mock . type . match ( /^image\// ) ) {
dropzone . options . thumbnail . call ( dropzone , mock , data . path ) ;
dropzone . createThumbnailFromUrl ( mock , data . path ) ;
}
file . remove ( ) ;
} ) ;
}
} , {
key : "getURI" ,
value : function getURI ( ) {
return this . container . data ( 'mediaUri' ) || '' ;
}
} , {
key : "onDropzoneSending" ,
value : function onDropzoneSending ( file , xhr , formData ) {
var _this4 = this ;
if ( Object . keys ( this . customPost ) . length ) {
Object . keys ( this . customPost ) . forEach ( function ( key ) {
formData . append ( key , _this4 . customPost [ key ] ) ;
} ) ;
} else {
formData . append ( 'name' , this . options . dotNotation ) ;
formData . append ( 'task' , 'filesupload' ) ;
formData . append ( 'uri' , this . getURI ( ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
formData . append ( 'admin-nonce' , external _GravAdmin _namespaceObject . config . admin _nonce ) ;
}
} , {
key : "onDropzoneSuccess" ,
value : function onDropzoneSuccess ( file , response , xhr ) {
response = typeof response === 'string' ? JSON . parse ( response ) : response ;
if ( this . options . reloadPage ) {
_ _webpack _require _ _ . g . location . reload ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// store params for removing file from session before it gets saved
if ( response . session ) {
file . sessionParams = response . session ;
file . removeUrl = this . options . url ;
// Touch field value to force a mutation detection
var input = this . container . find ( '[name][type="hidden"]' ) ;
var value = input . val ( ) ;
input . val ( value + ' ' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return this . handleError ( {
file : file ,
data : response ,
mode : 'removeFile' ,
msg : "<p>" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FILE _ERROR _UPLOAD , " <strong>{{fileName}}</strong></p>\n <pre>" ) . concat ( response . message , "</pre>" )
} ) ;
}
} , {
key : "onDropzoneComplete" ,
value : function onDropzoneComplete ( file ) {
if ( ! file . accepted && ! file . rejected ) {
var data = {
status : 'error' ,
message : "" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FILE _UNSUPPORTED , ": " ) . concat ( file . name . match ( /\..+/ ) . join ( '' ) )
} ;
return this . handleError ( {
file : file ,
data : data ,
mode : 'removeFile' ,
msg : "<p>" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FILE _ERROR _ADD , " <strong>{{fileName}}</strong></p>\n <pre>" ) . concat ( data . message , "</pre>" )
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( this . options . reloadPage ) {
_ _webpack _require _ _ . g . location . reload ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
} , {
key : "b64_to_utf8" ,
value : function b64 _to _utf8 ( str ) {
str = str . replace ( /\s/g , '' ) ;
return decodeURIComponent ( escape ( window . atob ( str ) ) ) ;
}
} , {
key : "onDropzoneAddedFile" ,
value : function onDropzoneAddedFile ( file ) {
return this . dropzone . options . addedfile ( file ) ;
}
} , {
key : "onDropzoneRemovedFile" ,
value : function onDropzoneRemovedFile ( file ) {
var _this5 = this ;
if ( ! file . accepted || file . rejected ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var url = file . removeUrl || this . urls [ "delete" ] || this . options . url ;
var path = ( url || '' ) . match ( /path:(.*)\// ) ;
var body = {
filename : file . name ,
uri : this . getURI ( )
} ;
if ( file . sessionParams ) {
body . task = 'filessessionremove' ;
body . session = file . sessionParams ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var customPost = this . container . data ( 'filePostRemove' ) || { } ;
if ( Object . keys ( customPost ) . length ) {
body = { } ;
Object . keys ( customPost ) . forEach ( function ( key ) {
body [ key ] = customPost [ key ] ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
body [ 'filename' ] = file . name ;
body [ 'admin-nonce' ] = external _GravAdmin _namespaceObject . config . admin _nonce ;
utils _request ( url , {
method : 'post' ,
body : body
} , function ( ) {
if ( ! path ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
path = _this5 . b64 _to _utf8 ( path [ 1 ] ) ;
var input = _this5 . container . find ( '[name][type="hidden"]' ) ;
var data = JSON . parse ( input . val ( ) || '{}' ) ;
delete data [ path ] ;
input . val ( JSON . stringify ( data ) ) ;
} ) ;
}
} , {
key : "onDropzoneError" ,
value : function onDropzoneError ( file , response , xhr ) {
var message = xhr ? response . error . message : response ;
external _jQuery _default ( ) ( file . previewElement ) . find ( '[data-dz-errormessage]' ) . html ( message ) ;
return this . handleError ( {
file : file ,
data : {
status : 'error'
} ,
msg : "<pre>" . concat ( message , "</pre>" )
} ) ;
}
} , {
key : "handleError" ,
value : function handleError ( options ) {
var file = options . file ,
data = options . data ,
mode = options . mode ,
msg = options . msg ;
if ( data . status !== 'error' && data . status !== 'unauthorized' ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
switch ( mode ) {
case 'addBack' :
if ( file instanceof File ) {
this . dropzone . addFile . call ( this . dropzone , file ) ;
} else {
this . dropzone . files . push ( file ) ;
this . dropzone . options . addedfile . call ( this . dropzone , file ) ;
this . dropzone . options . thumbnail . call ( this . dropzone , file , file . extras . url ) ;
}
break ;
case 'removeFile' :
default :
if ( ~ this . dropzone . files . indexOf ( file ) ) {
file . rejected = true ;
this . dropzone . removeFile . call ( this . dropzone , file , {
silent : true
} ) ;
}
break ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var modal = external _jQuery _default ( ) ( '[data-remodal-id="generic"]' ) ;
var cleanName = file . name . replace ( '<' , '<' ) . replace ( '>' , '>' ) ;
modal . find ( '.error-content' ) . html ( msg . replace ( '{{fileName}}' , cleanName ) ) ;
( external _jQuery _default ( ) ) . remodal . lookup [ modal . data ( 'remodal' ) ] . open ( ) ;
}
} ] ) ;
} ( ) ;
function UriToMarkdown ( uri ) {
uri = uri . replace ( /@3x|@2x|@1x/ , '' ) ;
uri = uri . replace ( /\(/g , '%28' ) ;
uri = uri . replace ( /\)/g , '%29' ) ;
var title = uri . split ( '.' ) . slice ( 0 , - 1 ) . join ( '.' ) ;
return uri . match ( /\.(jpe?g|png|gif|svg|webp|avif|mp4|webm|ogv|mov)$/i ) ? " . concat ( uri , " \"" ) . concat ( title , "\")" ) : "[" . concat ( decodeURI ( uri ) , "](" ) . concat ( uri , ")" ) ;
}
var instances = [ ] ;
var cache = external _jQuery _default ( ) ( ) ;
var onAddedNodes = function onAddedNodes ( event , target /* , record, instance */ ) {
var files = external _jQuery _default ( ) ( target ) . find ( '.dropzone.files-upload' ) ;
if ( ! files . length ) {
return ;
}
files . each ( function ( index , file ) {
file = external _jQuery _default ( ) ( file ) ;
if ( ! ~ cache . index ( file ) ) {
addNode ( file ) ;
}
} ) ;
} ;
var addNode = function addNode ( container ) {
container = external _jQuery _default ( ) ( container ) ;
var input = container . find ( 'input[type="file"]' ) ;
var settings = container . data ( 'grav-file-settings' ) || { } ;
if ( settings . accept && ~ settings . accept . indexOf ( '*' ) ) {
settings . accept = [ '' ] ;
}
var options = {
url : container . data ( 'file-url-add' ) || ( container . closest ( 'form' ) . attr ( 'action' ) || external _GravAdmin _namespaceObject . config . current _url ) + '.json' ,
paramName : settings . paramName || 'file' ,
dotNotation : settings . name || 'file' ,
acceptedFiles : settings . accept ? settings . accept . join ( ',' ) : input . attr ( 'accept' ) || container . data ( 'media-types' ) ,
maxFilesize : typeof settings . filesize !== 'undefined' ? settings . filesize : 256 ,
maxFiles : settings . limit || null ,
resizeWidth : settings . resizeWidth || null ,
resizeHeight : settings . resizeHeight || null ,
resizeQuality : settings . resizeQuality || null ,
resolution : settings . resolution || null ,
accept : function accept ( file , done ) {
ACCEPT _FUNC ( file , done , settings ) ;
}
} ;
cache = cache . add ( container ) ;
container = container [ 0 ] ;
instances . push ( new FilesField ( {
container : container ,
options : options
} ) ) ;
} ;
var Instance = function ( ) {
external _jQuery _default ( ) ( '.dropzone.files-upload' ) . each ( function ( i , container ) {
return addNode ( container ) ;
} ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , onAddedNodes ) ;
return instances ;
} ( ) ;
// EXTERNAL MODULE: ./node_modules/events/events.js
var events = _ _webpack _require _ _ ( 37007 ) ;
var events _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( events ) ;
; // ./app/utils/gpm.js
function gpm _typeof ( o ) { "@babel/helpers - typeof" ; return gpm _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , gpm _typeof ( o ) ; }
function gpm _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function gpm _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , gpm _toPropertyKey ( o . key ) , o ) ; } }
function gpm _createClass ( e , r , t ) { return r && gpm _defineProperties ( e . prototype , r ) , t && gpm _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function gpm _toPropertyKey ( t ) { var i = gpm _toPrimitive ( t , "string" ) ; return "symbol" == gpm _typeof ( i ) ? i : i + "" ; }
function gpm _toPrimitive ( t , r ) { if ( "object" != gpm _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != gpm _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
function _callSuper ( t , o , e ) { return o = _getPrototypeOf ( o ) , _possibleConstructorReturn ( t , _isNativeReflectConstruct ( ) ? Reflect . construct ( o , e || [ ] , _getPrototypeOf ( t ) . constructor ) : o . apply ( t , e ) ) ; }
function _possibleConstructorReturn ( t , e ) { if ( e && ( "object" == gpm _typeof ( e ) || "function" == typeof e ) ) return e ; if ( void 0 !== e ) throw new TypeError ( "Derived constructors may only return object or undefined" ) ; return _assertThisInitialized ( t ) ; }
function _assertThisInitialized ( e ) { if ( void 0 === e ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return e ; }
function _isNativeReflectConstruct ( ) { try { var t = ! Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ; } catch ( t ) { } return ( _isNativeReflectConstruct = function _isNativeReflectConstruct ( ) { return ! ! t ; } ) ( ) ; }
function _getPrototypeOf ( t ) { return _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf . bind ( ) : function ( t ) { return t . _ _proto _ _ || Object . getPrototypeOf ( t ) ; } , _getPrototypeOf ( t ) ; }
function _inherits ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function" ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , writable : ! 0 , configurable : ! 0 } } ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , e && _setPrototypeOf ( t , e ) ; }
function _setPrototypeOf ( t , e ) { return _setPrototypeOf = Object . setPrototypeOf ? Object . setPrototypeOf . bind ( ) : function ( t , e ) { return t . _ _proto _ _ = e , t ; } , _setPrototypeOf ( t , e ) ; }
var GPM = /*#__PURE__*/ function ( _EventEmitter ) {
function GPM ( ) {
var _this ;
var action = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'getUpdates' ;
gpm _classCallCheck ( this , GPM ) ;
_this = _callSuper ( this , GPM ) ;
_this . payload = { } ;
_this . raw = { } ;
_this . action = action ;
return _this ;
}
_inherits ( GPM , _EventEmitter ) ;
return gpm _createClass ( GPM , [ {
key : "setPayload" ,
value : function setPayload ( ) {
var payload = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
this . payload = payload ;
this . emit ( 'payload' , payload ) ;
return this ;
}
} , {
key : "setAction" ,
value : function setAction ( ) {
var action = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'getUpdates' ;
this . action = action ;
this . emit ( 'action' , action ) ;
return this ;
}
} , {
key : "fetch" ,
value : function ( _fetch ) {
function fetch ( ) {
return _fetch . apply ( this , arguments ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
fetch . toString = function ( ) {
return _fetch . toString ( ) ;
} ;
return fetch ;
} ( function ( ) {
var _this2 = this ;
var callback = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : function ( ) {
return true ;
} ;
var flush = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
var data = new FormData ( ) ;
data . append ( 'admin-nonce' , external _GravAdmin _namespaceObject . config . admin _nonce ) ;
if ( flush ) {
data . append ( 'flush' , true ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . emit ( 'fetching' , this ) ;
fetch ( "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/update.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "getUpdates" ) , {
credentials : 'same-origin' ,
method : 'post' ,
body : data
} ) . then ( function ( response ) {
_this2 . raw = response ;
return response ;
} ) . then ( parseStatus ) . then ( parseJSON ) . then ( function ( response ) {
return _this2 . response ( response ) ;
} ) . then ( function ( response ) {
return callback ( response , _this2 . raw ) ;
} ) . then ( function ( response ) {
return _this2 . emit ( 'fetched' , _this2 . payload , _this2 . raw , _this2 ) ;
} ) [ "catch" ] ( userFeedbackError ) ;
} )
} , {
key : "response" ,
value : function response ( _response ) {
this . payload = _response ;
return _response ;
}
} ] ) ;
} ( ( events _default ( ) ) ) ;
var gpm _Instance = new GPM ( ) ;
// EXTERNAL MODULE: ./node_modules/mout/array/unique.js
var unique = _ _webpack _require _ _ ( 45195 ) ;
var unique _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( unique ) ;
; // ./app/updates/notifications.js
function notifications _typeof ( o ) { "@babel/helpers - typeof" ; return notifications _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , notifications _typeof ( o ) ; }
function notifications _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function notifications _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , notifications _toPropertyKey ( o . key ) , o ) ; } }
function notifications _createClass ( e , r , t ) { return r && notifications _defineProperties ( e . prototype , r ) , t && notifications _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function notifications _toPropertyKey ( t ) { var i = notifications _toPrimitive ( t , "string" ) ; return "symbol" == notifications _typeof ( i ) ? i : i + "" ; }
function notifications _toPrimitive ( t , r ) { if ( "object" != notifications _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != notifications _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var canFetchNotifications = function canFetchNotifications ( ) {
return external _GravAdmin _namespaceObject . config . notifications . enabled ;
} ;
var notificationsFilters = function notificationsFilters ( ) {
return external _GravAdmin _namespaceObject . config . notifications . filters ;
} ;
var Notifications = /*#__PURE__*/ function ( ) {
function Notifications ( ) {
notifications _classCallCheck ( this , Notifications ) ;
}
return notifications _createClass ( Notifications , [ {
key : "fetch" ,
value :
// Grav.default.Notifications.fetch()
function fetch ( ) {
var _ref = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ,
_ref$filter = _ref . filter ,
filter = _ref$filter === void 0 ? notificationsFilters ( ) : _ref$filter ,
_ref$refresh = _ref . refresh ,
refresh = _ref$refresh === void 0 ? false : _ref$refresh ;
if ( ! canFetchNotifications ( ) ) {
return false ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var feed = external _jQuery _default ( ) ( '#notifications' ) ;
var loader = feed . find ( '.widget-loader' ) ;
var content = feed . find ( '.widget-content > ul' ) ;
loader . find ( 'div' ) . remove ( ) ;
loader . find ( '.fa-warning' ) . removeClass ( 'fa-warning' ) . addClass ( 'fa-refresh fa-spin' ) ;
loader . show ( ) ;
content . hide ( ) ;
var processNotifications = function processNotifications ( response ) {
var notifications = response . notifications ;
external _jQuery _default ( ) ( '#notifications' ) . find ( '.widget-content > ul' ) . empty ( ) ;
if ( notifications ) {
Object . keys ( notifications ) . forEach ( function ( location ) {
return Notifications . processLocation ( location , notifications [ location ] ) ;
} ) ;
}
} ;
utils _request ( "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "getNotifications" ) , {
method : 'post' ,
body : {
refresh : refresh ,
filter : filter
}
} , function ( response ) {
processNotifications ( response ) ;
} ) [ "catch" ] ( function ( ) {
var widget = external _jQuery _default ( ) ( '#notifications .widget-content' ) ;
widget . find ( '.widget-loader' ) . find ( 'div' ) . remove ( ) ;
widget . find ( '.widget-loader' ) . append ( '<div>Failed to retrieve notifications</div>' ) . find ( '.fa-spin' ) . removeClass ( 'fa-spin fa-refresh' ) . addClass ( 'fa-warning' ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] , [ {
key : "addShowAllInFeed" ,
value : function addShowAllInFeed ( ) {
external _jQuery _default ( ) ( '#notifications ul' ) . append ( '<li class="show-all" data-notification-action="show-all-notifications">Show all</li>' ) ;
}
} , {
key : "showNotificationInFeed" ,
value : function showNotificationInFeed ( notification ) {
var notifications = external _jQuery _default ( ) ( '#notifications' ) . removeClass ( 'hidden' ) ;
var loader = notifications . find ( '.widget-loader' ) . hide ( ) ;
var content = notifications . find ( '.widget-content > ul' ) . show ( ) ;
loader . find ( 'div' ) . remove ( ) ;
loader . find ( '.fa-warning' ) . removeClass ( 'fa-warning' ) . addClass ( 'fa-refresh fa-spin' ) ;
content . append ( notification ) . find ( 'li:nth-child(n+11)' ) . addClass ( 'hidden' ) ; // hide all items > 10
if ( content . find ( 'li.hidden' ) . length ) {
Notifications . addShowAllInFeed ( ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
} , {
key : "showNotificationInTop" ,
value : function showNotificationInTop ( notification ) {
var container = external _jQuery _default ( ) ( '.top-notifications-container' ) ;
var dummy = external _jQuery _default ( ) ( '<div />' ) . html ( notification ) ;
container . removeClass ( 'hidden' ) . append ( dummy . children ( ) ) ;
dummy . children ( ) . slideDown ( 150 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "showNotificationInDashboard" ,
value : function showNotificationInDashboard ( notification ) {
var container = external _jQuery _default ( ) ( '.dashboard-notifications-container' ) ;
var dummy = external _jQuery _default ( ) ( '<div />' ) . html ( notification ) ;
container . removeClass ( 'hidden' ) . append ( dummy . children ( ) ) ;
dummy . children ( ) . slideDown ( 150 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "showNotificationInPlugins" ,
value : function showNotificationInPlugins ( notification ) {
var container = external _jQuery _default ( ) ( '.plugins-notifications-container' ) ;
var dummy = external _jQuery _default ( ) ( '<div />' ) . html ( notification ) ;
container . removeClass ( 'hidden' ) . append ( dummy . children ( ) ) ;
dummy . children ( ) . slideDown ( 150 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "showNotificationInThemes" ,
value : function showNotificationInThemes ( notification ) {
var container = external _jQuery _default ( ) ( '.themes-notifications-container' ) ;
var dummy = external _jQuery _default ( ) ( '<div />' ) . html ( notification ) ;
container . removeClass ( 'hidden' ) . append ( dummy . children ( ) ) ;
dummy . children ( ) . slideDown ( 150 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "processLocation" ,
value : function processLocation ( location , notification ) {
switch ( location ) {
case 'feed' :
Notifications . showNotificationInFeed ( notification ) ;
break ;
case 'top' :
if ( ! notification . read ) {
Notifications . showNotificationInTop ( notification ) ;
}
break ;
case 'dashboard' :
if ( ! notification . read ) {
Notifications . showNotificationInDashboard ( notification ) ;
}
break ;
case 'plugins' :
if ( ! notification . read ) {
Notifications . showNotificationInPlugins ( notification ) ;
}
break ;
case 'themes' :
if ( ! notification . read ) {
Notifications . showNotificationInThemes ( notification ) ;
}
break ;
}
}
} ] ) ;
} ( ) ;
var notifications = new Notifications ( ) ;
/* harmony default export */ const updates _notifications = ( notifications ) ;
if ( canFetchNotifications ( ) ) {
notifications . fetch ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* Hide a notification and store it hidden */
// <a href="#" data-notification-action="hide-notification" data-notification-id="${notification.id}" class="close hide-notification"><i class="fa fa-close"></i></a>
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-notification-action="hide-notification"]' , function ( event ) {
var notification _id = external _jQuery _default ( ) ( event . target ) . parents ( '.hide-notification' ) . data ( 'notification-id' ) ;
var url = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/notifications.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "hideNotification/notification_id" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( notification _id ) ;
utils _request ( url , {
method : 'post'
} , function ( ) { } ) ;
external _jQuery _default ( ) ( event . target ) . parents ( '.single-notification' ) . hide ( ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-notification-action="hide-notification"]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var notification = target . parent ( ) ;
notification . slideUp ( function ( ) {
return notification . remove ( ) ;
} ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-notification-action="show-all-notifications"]' , function ( event ) {
external _jQuery _default ( ) ( '#notifications .show-all' ) . hide ( ) ;
external _jQuery _default ( ) ( '#notifications .hidden' ) . removeClass ( 'hidden' ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-refresh="notifications"]' , function ( event ) {
event . preventDefault ( ) ;
notifications . fetch ( {
filter : [ 'feed' ] ,
refresh : true
} ) ;
} ) ;
}
; // ./app/updates/feed.js
function feed _typeof ( o ) { "@babel/helpers - typeof" ; return feed _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , feed _typeof ( o ) ; }
function feed _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function feed _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , feed _toPropertyKey ( o . key ) , o ) ; } }
function feed _createClass ( e , r , t ) { return r && feed _defineProperties ( e . prototype , r ) , t && feed _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function feed _toPropertyKey ( t ) { var i = feed _toPrimitive ( t , "string" ) ; return "symbol" == feed _typeof ( i ) ? i : i + "" ; }
function feed _toPrimitive ( t , r ) { if ( "object" != feed _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != feed _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var URI = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/ajax.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "getNewsFeed" ) ;
var Feed = /*#__PURE__*/ function ( ) {
function Feed ( ) {
feed _classCallCheck ( this , Feed ) ;
this . data = null ;
}
return feed _createClass ( Feed , [ {
key : "fetch" ,
value : function fetch ( ) {
var _this = this ;
var refresh = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
var callback = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : function ( ) { } ;
utils _request ( URI , {
method : 'post' ,
body : {
refresh : refresh
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , function ( response ) {
_this . data = response ;
callback ( response ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
} , {
key : "refresh" ,
value : function refresh ( ) {
var _refresh = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
var feed = external _jQuery _default ( ) ( '#news-feed .widget-content' ) ;
if ( ! feed . length ) {
return ;
}
var loader = feed . find ( '.widget-loader' ) ;
loader . find ( 'div' ) . remove ( ) ;
loader . find ( '.fa-warning' ) . removeClass ( 'fa-warning' ) . addClass ( 'fa-refresh fa-spin' ) ;
loader . show ( ) ;
feed . find ( '> ul' ) . hide ( ) ;
if ( ! this . data || this . data . error || _refresh ) {
this . fetch ( _refresh , this . updateContent . bind ( this ) ) ;
} else {
this . updateContent ( ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
} , {
key : "updateContent" ,
value : function updateContent ( ) {
var feed = external _jQuery _default ( ) ( '#news-feed .widget-content' ) ;
if ( ! feed . length ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var loader = feed . find ( '.widget-loader' ) . hide ( ) ;
var content = feed . find ( '> ul' ) . empty ( ) . show ( ) ;
if ( this . data . error || this . data . status === 'error' ) {
loader . show ( ) . find ( 'div' ) . remove ( ) ;
loader . find ( '.fa-refresh' ) . removeClass ( 'fa-refresh fa-spin' ) . addClass ( 'fa-warning' ) ;
loader . append ( "<div>" . concat ( this . data . error ? this . data . error . message : this . data . message || 'Unable to download news feed' , "</div>" ) ) ;
return ;
}
if ( this . data && this . data . feed _data ) {
content . append ( this . data . feed _data ) ;
}
}
} ] ) ;
} ( ) ;
var feed = new Feed ( ) ;
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
return feed . refresh ( ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-refresh="feed"]' , function ( event ) {
event . preventDefault ( ) ;
feed . refresh ( true ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
/* harmony default export */ const updates _feed = ( feed ) ;
; // ./app/updates/check.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Check for updates trigger
external _jQuery _default ( ) ( '[data-gpm-checkupdates]' ) . on ( 'click' , function ( ) {
var element = external _jQuery _default ( ) ( this ) ;
element . find ( 'i' ) . addClass ( 'fa-spin' ) ;
gpm _Instance . fetch ( function ( response ) {
element . find ( 'i' ) . removeClass ( 'fa-spin' ) ;
var payload = response . payload ;
if ( ! payload ) {
return ;
}
if ( ! payload . grav . isUpdatable && ! payload . resources . total ) {
utils _toastr . success ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . EVERYTHING _UP _TO _DATE ) ;
} else {
var grav = payload . grav . isUpdatable ? 'Grav v' + payload . grav . available : '' ;
var resources = payload . resources . total ? payload . resources . total + ' ' + external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATES _ARE _AVAILABLE : '' ;
if ( ! resources ) {
grav += ' ' + external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . IS _AVAILABLE _FOR _UPDATE ;
}
utils _toastr . info ( grav + ( grav && resources ? ' ' + external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . AND + ' ' : '' ) + resources ) ;
}
} , true ) ;
} ) ;
; // ./app/utils/formatbytes.js
var sizes = [ 'Bytes' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] ;
function formatBytes ( bytes , decimals ) {
if ( bytes === 0 ) return '0 Byte' ;
var k = 1000 ;
var value = Math . floor ( Math . log ( bytes ) / Math . log ( k ) ) ;
var decimal = decimals + 1 || 3 ;
return ( bytes / Math . pow ( k , value ) ) . toPrecision ( decimal ) + ' ' + sizes [ value ] ;
}
; // ./app/updates/update.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Dashboard update and Grav update
external _jQuery _default ( ) ( document ) . on ( 'click.remodal' , '[data-remodal-id="update-grav"] [data-remodal-action="confirm"]' , function ( ) {
var element = external _jQuery _default ( ) ( '#grav-update-button' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Safely get the file size with fallback
var sizeText = '' ;
if ( updates _Instance . payload && updates _Instance . payload . grav && updates _Instance . payload . grav . assets && updates _Instance . payload . grav . assets [ 'grav-update' ] && updates _Instance . payload . grav . assets [ 'grav-update' ] . size ) {
sizeText = " " . concat ( formatBytes ( updates _Instance . payload . grav . assets [ 'grav-update' ] . size ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
element . html ( "" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATING _PLEASE _WAIT ) . concat ( sizeText , ".." ) ) ;
element . attr ( 'disabled' , 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-cloud-download' ) . addClass ( 'fa-refresh fa-spin' ) ;
utils _request ( updates _Instance . updateURL , function ( response ) {
if ( response . type === 'updategrav' ) {
external _jQuery _default ( ) ( '[data-gpm-grav]' ) . remove ( ) ;
external _jQuery _default ( ) ( '#footer .grav-version' ) . html ( response . version ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
element . removeAttr ( 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-refresh fa-spin' ) . addClass ( 'fa-cloud-download' ) ;
} ) ;
} ) ;
; // ./app/updates/channel-switcher.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var switcher = external _jQuery _default ( ) ( 'input[type="radio"][name="channel-switch"]' ) ;
if ( switcher ) {
switcher . on ( 'change' , function ( event ) {
var radio = external _jQuery _default ( ) ( event . target ) ;
var url = "" . concat ( radio . parent ( '[data-url]' ) . data ( 'url' ) ) ;
utils _request ( url , {
method : 'post' ,
body : {
task : 'gpmRelease' ,
release : radio . val ( )
}
} , function ( response ) {
if ( response . reload ) {
_ _webpack _require _ _ . g . location . reload ( ) ;
}
} ) ;
} ) ;
}
; // ./app/updates/safe-upgrade.js
function safe _upgrade _typeof ( o ) { "@babel/helpers - typeof" ; return safe _upgrade _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , safe _upgrade _typeof ( o ) ; }
function safe _upgrade _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function safe _upgrade _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , safe _upgrade _toPropertyKey ( o . key ) , o ) ; } }
function safe _upgrade _createClass ( e , r , t ) { return r && safe _upgrade _defineProperties ( e . prototype , r ) , t && safe _upgrade _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function safe _upgrade _toPropertyKey ( t ) { var i = safe _upgrade _toPrimitive ( t , "string" ) ; return "symbol" == safe _upgrade _typeof ( i ) ? i : i + "" ; }
function safe _upgrade _toPrimitive ( t , r ) { if ( "object" != safe _upgrade _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != safe _upgrade _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var t = function t ( key ) {
var fallback = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : '' ;
if ( external _GravAdmin _namespaceObject . translations && external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN && external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN [ key ] ) {
return external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN [ key ] ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return fallback ;
} ;
var r = function r ( key , value ) {
var fallback = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : '' ;
var template = t ( key , fallback ) ;
if ( ! template || typeof template . replace !== 'function' ) {
return fallback . replace ( '%s' , value ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return template . replace ( '%s' , value ) ;
} ;
var STAGE _TITLES = {
queued : function queued ( ) {
return t ( 'SAFE_UPGRADE_STAGE_QUEUED' , 'Waiting for worker' ) ;
} ,
initializing : function initializing ( ) {
return t ( 'SAFE_UPGRADE_STAGE_INITIALIZING' , 'Preparing upgrade' ) ;
} ,
downloading : function downloading ( ) {
return t ( 'SAFE_UPGRADE_STAGE_DOWNLOADING' , 'Downloading update' ) ;
} ,
2025-10-18 17:54:29 -06:00
snapshot : function snapshot ( ) {
return t ( 'SAFE_UPGRADE_STAGE_SNAPSHOT' , 'Creating backup snapshot' ) ;
} ,
2025-10-18 13:48:40 -06:00
installing : function installing ( ) {
return t ( 'SAFE_UPGRADE_STAGE_INSTALLING' , 'Installing update' ) ;
} ,
2025-10-18 17:54:29 -06:00
rollback : function rollback ( ) {
return t ( 'SAFE_UPGRADE_STAGE_ROLLBACK' , 'Restoring snapshot' ) ;
} ,
2025-10-18 13:48:40 -06:00
finalizing : function finalizing ( ) {
return t ( 'SAFE_UPGRADE_STAGE_FINALIZING' , 'Finalizing changes' ) ;
} ,
complete : function complete ( ) {
return t ( 'SAFE_UPGRADE_STAGE_COMPLETE' , 'Upgrade complete' ) ;
} ,
error : function error ( ) {
return t ( 'SAFE_UPGRADE_STAGE_ERROR' , 'Upgrade encountered an error' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
var SafeUpgrade = /*#__PURE__*/ function ( ) {
function SafeUpgrade ( updatesInstance ) {
safe _upgrade _classCallCheck ( this , SafeUpgrade ) ;
this . updates = updatesInstance ;
this . modalElement = external _jQuery _default ( ) ( '[data-remodal-id="update-grav"]' ) ;
this . modal = this . modalElement . remodal ( {
hashTracking : false
} ) ;
this . steps = {
preflight : this . modalElement . find ( '[data-safe-upgrade-step="preflight"]' ) ,
progress : this . modalElement . find ( '[data-safe-upgrade-step="progress"]' ) ,
result : this . modalElement . find ( '[data-safe-upgrade-step="result"]' )
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
this . buttons = {
start : this . modalElement . find ( '[data-safe-upgrade-action="start"]' ) ,
cancel : this . modalElement . find ( '[data-safe-upgrade-action="cancel"]' ) ,
recheck : this . modalElement . find ( '[data-safe-upgrade-action="recheck"]' ) ,
finish : this . modalElement . find ( '[data-safe-upgrade-action="finish"]' )
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
this . urls = this . buildUrls ( ) ;
this . decisions = { } ;
this . pollTimer = null ;
this . statusRequest = null ;
this . isPolling = false ;
this . active = false ;
this . jobId = null ;
this . statusFailures = 0 ;
this . statusContext = null ;
this . statusIdleCount = 0 ;
this . currentStage = null ;
this . stageEnteredAt = 0 ;
this . directStatusUrl = this . resolveDirectStatusUrl ( ) ;
this . preferDirectStatus = ! ! this . directStatusUrl ;
this . modalLocked = false ;
2025-10-18 18:16:44 -06:00
this . lastOverallPercent = 0 ;
2025-10-18 13:48:40 -06:00
this . registerEvents ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return safe _upgrade _createClass ( SafeUpgrade , [ {
key : "buildUrls" ,
value : function buildUrls ( ) {
var task = "task" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) ;
var nonce = "admin-nonce" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( external _GravAdmin _namespaceObject . config . admin _nonce ) ;
var base = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/update.json" ) ;
return {
preflight : "" . concat ( base , "/" ) . concat ( task , "safeUpgradePreflight/" ) . concat ( nonce ) ,
start : "" . concat ( base , "/" ) . concat ( task , "safeUpgradeStart/" ) . concat ( nonce ) ,
status : "" . concat ( base , "/" ) . concat ( task , "safeUpgradeStatus/" ) . concat ( nonce )
} ;
}
} , {
key : "registerEvents" ,
value : function registerEvents ( ) {
var _this = this ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '#grav-update-button' , function ( event ) {
if ( external _jQuery _default ( ) ( event . currentTarget ) . hasClass ( 'pointer-events-none' ) ) {
return ;
}
event . preventDefault ( ) ;
_this . open ( ) ;
} ) ;
this . modalElement . on ( 'closed' , function ( ) {
_this . stopPolling ( ) ;
_this . active = false ;
} ) ;
this . modalElement . on ( 'click' , '[data-safe-upgrade-action="recheck"]' , function ( event ) {
event . preventDefault ( ) ;
if ( ! _this . active ) {
return ;
}
_this . fetchPreflight ( true ) ;
} ) ;
this . modalElement . on ( 'click' , '[data-safe-upgrade-action="start"]' , function ( event ) {
event . preventDefault ( ) ;
if ( external _jQuery _default ( ) ( event . currentTarget ) . prop ( 'disabled' ) ) {
return ;
}
_this . startUpgrade ( ) ;
} ) ;
this . modalElement . on ( 'click' , '[data-safe-upgrade-action="finish"]' , function ( event ) {
event . preventDefault ( ) ;
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( button . prop ( 'disabled' ) ) {
return ;
}
_this . modalLocked = false ;
_this . modal . close ( 'finish' ) ;
setTimeout ( function ( ) {
return window . location . reload ( ) ;
} , 75 ) ;
} ) ;
this . modalElement . on ( 'change' , '[data-safe-upgrade-decision]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var decision = target . val ( ) ;
var type = target . data ( 'safe-upgrade-decision' ) ;
_this . decisions [ type ] = decision ;
_this . updateStartButtonState ( ) ;
} ) ;
this . modalElement . on ( 'closing' , function ( event ) {
if ( _this . modalLocked && event . reason !== 'finish' ) {
event . preventDefault ( ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "setPayload" ,
value : function setPayload ( ) {
var payload = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
this . payload = payload ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "open" ,
value : function open ( ) {
this . active = true ;
this . decisions = { } ;
this . statusFailures = 0 ;
this . preferDirectStatus = ! ! this . directStatusUrl ;
this . statusContext = null ;
this . statusIdleCount = 0 ;
this . currentStage = null ;
this . stageEnteredAt = 0 ;
this . modalLocked = false ;
2025-10-18 18:16:44 -06:00
this . lastOverallPercent = 0 ;
2025-10-18 13:48:40 -06:00
this . renderLoading ( ) ;
this . modal . open ( ) ;
this . fetchPreflight ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "renderLoading" ,
value : function renderLoading ( ) {
this . modalLocked = false ;
this . resetFooterButtons ( ) ;
this . switchStep ( 'preflight' ) ;
this . steps . preflight . html ( "\n <div class=\"safe-upgrade-loading\">\n <span class=\"fa fa-refresh fa-spin\"></span>\n <p>" . concat ( t ( 'SAFE_UPGRADE_CHECKING' , 'Running preflight checks...' ) , "</p>\n </div>\n " ) ) ;
this . buttons . start . prop ( 'disabled' , true ) . addClass ( 'hidden' ) ;
this . modalElement . find ( '[data-safe-upgrade-footer]' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "fetchPreflight" ,
value : function fetchPreflight ( ) {
var _this2 = this ;
var silent = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
if ( ! silent ) {
this . renderLoading ( ) ;
} else {
this . setRecheckLoading ( true ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var done = function done ( ) {
if ( silent ) {
_this2 . setRecheckLoading ( false ) ;
}
} ;
var requestPromise = utils _request ( this . urls . preflight , function ( response ) {
if ( ! _this2 . active ) {
done ( ) ;
return ;
}
if ( response . status === 'error' ) {
done ( ) ;
_this2 . renderPreflightError ( response . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_this2 . renderPreflight ( response . data || { } ) ;
done ( ) ;
} ) ;
if ( silent && requestPromise && typeof requestPromise [ "catch" ] === 'function' ) {
requestPromise [ "catch" ] ( function ( ) {
return done ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
} , {
key : "renderPreflightError" ,
value : function renderPreflightError ( message ) {
this . switchStep ( 'preflight' ) ;
this . steps . preflight . html ( "\n <div class=\"safe-upgrade-error\">\n <p>" . concat ( message , "</p>\n <button data-safe-upgrade-action=\"recheck\" class=\"button secondary\">" ) . concat ( t ( 'SAFE_UPGRADE_RECHECK' , 'Re-run Checks' ) , "</button>\n </div>\n " ) ) ;
this . buttons . start . prop ( 'disabled' , true ) . addClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "renderPreflight" ,
value : function renderPreflight ( data ) {
var blockers = [ ] ;
var version = data . version || { } ;
var releaseDate = version . release _date || '' ;
var packageSize = version . package _size ? formatBytes ( version . package _size ) : t ( 'SAFE_UPGRADE_UNKNOWN_SIZE' , 'unknown' ) ;
var warnings = data . preflight && data . preflight . warnings || [ ] ;
var pending = data . preflight && data . preflight . plugins _pending || { } ;
var psrConflicts = data . preflight && data . preflight . psr _log _conflicts || { } ;
var monologConflicts = data . preflight && data . preflight . monolog _conflicts || { } ;
if ( data . status === 'error' ) {
blockers . push ( data . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! data . requirements || ! data . requirements . meets ) {
blockers . push ( r ( 'SAFE_UPGRADE_REQUIREMENTS_FAIL' , data . requirements ? data . requirements . minimum _php : '?' , 'PHP %s or newer is required before continuing.' ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( data . symlinked ) {
blockers . push ( t ( 'GRAV_SYMBOLICALLY_LINKED' , 'Grav is symbolically linked. Upgrade will not be available.' ) ) ;
}
if ( data . safe _upgrade && data . safe _upgrade . enabled === false ) {
blockers . push ( t ( 'SAFE_UPGRADE_DISABLED' , 'Safe upgrade is disabled. Enable it in Configuration ▶ System ▶ Updates.' ) ) ;
}
if ( ! data . safe _upgrade || ! data . safe _upgrade . staging _ready ) {
var err = data . safe _upgrade && data . safe _upgrade . error ? data . safe _upgrade . error : t ( 'SAFE_UPGRADE_STAGING_ERROR' , 'Safe upgrade staging directory is not writable.' ) ;
blockers . push ( err ) ;
}
if ( ! data . upgrade _available ) {
blockers . push ( t ( 'SAFE_UPGRADE_NOT_AVAILABLE' , 'No Grav update is available.' ) ) ;
}
if ( Object . keys ( pending ) . length ) {
blockers . push ( t ( 'SAFE_UPGRADE_PENDING_HINT' , 'Update all plugins and themes before proceeding.' ) ) ;
}
var psrWarningItems = Object . keys ( psrConflicts ) . map ( function ( slug ) {
var info = psrConflicts [ slug ] || { } ;
var requires = info . requires || '*' ;
return "<li>" . concat ( t ( 'SAFE_UPGRADE_WARNINGS_PSR_ITEM' , 'Potential psr/log conflict:' ) , " <code>" ) . concat ( slug , "</code> — " ) . concat ( r ( 'SAFE_UPGRADE_CONFLICTS_REQUIRES' , requires , 'Requires psr/log %s' ) , "</li>" ) ;
} ) ;
var monologWarningItems = Object . keys ( monologConflicts ) . map ( function ( slug ) {
var entries = Array . isArray ( monologConflicts [ slug ] ) ? monologConflicts [ slug ] : [ ] ;
var details = entries . map ( function ( entry ) {
var method = entry . method || '' ;
var file = entry . file ? basename ( entry . file ) : '' ;
return "<span>" . concat ( method , " " ) . concat ( file ? "<code>" . concat ( file , "</code>" ) : '' , "</span>" ) ;
} ) . join ( ', ' ) ;
var description = details || t ( 'SAFE_UPGRADE_WARNINGS_MONOLOG_UNKNOWN' , 'Review the plugin for potential API changes.' ) ;
return "<li>" . concat ( t ( 'SAFE_UPGRADE_WARNINGS_MONOLOG_ITEM' , 'Potential Monolog conflict:' ) , " <code>" ) . concat ( slug , "</code> — " ) . concat ( description , "</li>" ) ;
} ) ;
var filteredWarnings = warnings . filter ( function ( warning ) {
var lower = ( warning || '' ) . toLowerCase ( ) ;
var isPsrRelated = lower . includes ( 'psr/log' ) ;
var isMonologRelated = lower . includes ( 'monolog' ) ;
return ! isPsrRelated && ! isMonologRelated ;
} ) ;
var warningsList = filteredWarnings . length || psrWarningItems . length || monologWarningItems . length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--alert safe-upgrade-alert\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-exclamation-triangle\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">" . concat ( t ( 'SAFE_UPGRADE_WARNINGS' , 'Warnings' ) , "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">" ) . concat ( t ( 'SAFE_UPGRADE_WARNINGS_HINT' , 'These items may require attention before continuing.' ) , "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n " ) . concat ( filteredWarnings . map ( function ( warning ) {
return "<li>" . concat ( warning , "</li>" ) ;
} ) . join ( '' ) , "\n " ) . concat ( psrWarningItems . join ( '' ) , "\n " ) . concat ( monologWarningItems . join ( '' ) , "\n </ul>\n </div>\n </section>\n " ) : '' ;
var pendingList = Object . keys ( pending ) . length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-sync\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">" . concat ( t ( 'SAFE_UPGRADE_PENDING_UPDATES' , 'Pending plugin or theme updates' ) , "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">" ) . concat ( t ( 'SAFE_UPGRADE_PENDING_INTRO' , 'Review the extensions that should be updated first.' ) , "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n " ) . concat ( Object . keys ( pending ) . map ( function ( slug ) {
var item = pending [ slug ] || { } ;
var type = item . type || 'plugin' ;
var current = item . current || t ( 'SAFE_UPGRADE_UNKNOWN_VERSION' , 'unknown' ) ;
var next = item . available || t ( 'SAFE_UPGRADE_UNKNOWN_VERSION' , 'unknown' ) ;
return "<li><code>" . concat ( slug , "</code> (" ) . concat ( type , ") " ) . concat ( current , " → " ) . concat ( next , "</li>" ) ;
} ) . join ( '' ) , "\n </ul>\n </div>\n </section>\n " ) : '' ;
var psrList = Object . keys ( psrConflicts ) . length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--conflict safe-upgrade-conflict\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-code-branch\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">" . concat ( t ( 'SAFE_UPGRADE_CONFLICTS_PSR' , 'Potential psr/log compatibility issues' ) , "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">" ) . concat ( t ( 'SAFE_UPGRADE_CONFLICTS_HINT' , 'Choose how to handle conflicts before starting the upgrade.' ) , "</span>\n </div>\n </div>\n " ) . concat ( this . renderDecisionSelect ( 'psr_log' ) , "\n </header>\n </section>\n " ) : '' ;
var monologList = Object . keys ( monologConflicts ) . length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--conflict safe-upgrade-conflict\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-wave-square\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">" . concat ( t ( 'SAFE_UPGRADE_CONFLICTS_MONOLOG' , 'Potential Monolog API compatibility issues' ) , "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">" ) . concat ( t ( 'SAFE_UPGRADE_CONFLICTS_HINT' , 'Choose how to handle conflicts before starting the upgrade.' ) , "</span>\n </div>\n </div>\n " ) . concat ( this . renderDecisionSelect ( 'monolog' ) , "\n </header>\n </section>\n " ) : '' ;
var blockersList = blockers . length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--blocker safe-upgrade-blockers\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-ban\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">" . concat ( t ( 'SAFE_UPGRADE_BLOCKERS_TITLE' , 'Action required before continuing' ) , "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">" ) . concat ( t ( 'SAFE_UPGRADE_BLOCKERS_DESC' , 'Resolve the following items to enable the upgrade.' ) , "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>" ) . concat ( blockers . map ( function ( item ) {
return "<li>" . concat ( item , "</li>" ) ;
} ) . join ( '' ) , "</ul>\n </div>\n </section>\n " ) : '' ;
var summary = "\n <section class=\"safe-upgrade-summary\">\n <p>" . concat ( r ( 'SAFE_UPGRADE_SUMMARY_CURRENT' , version . local || '?' , 'Current Grav version: <strong>v%s</strong>' ) , "</p>\n <p>" ) . concat ( r ( 'SAFE_UPGRADE_SUMMARY_REMOTE' , version . remote || '?' , 'Available Grav version: <strong>v%s</strong>' ) , "</p>\n <p>" ) . concat ( releaseDate ? r ( 'SAFE_UPGRADE_RELEASED_ON' , releaseDate , 'Released on %s' ) : '' , "</p>\n <p>" ) . concat ( r ( 'SAFE_UPGRADE_PACKAGE_SIZE' , packageSize , 'Package size: %s' ) , "</p>\n </section>\n " ) ;
this . steps . preflight . html ( "\n <div class=\"safe-upgrade-preflight\">\n " . concat ( summary , "\n " ) . concat ( warningsList , "\n " ) . concat ( pendingList , "\n " ) . concat ( psrList , "\n " ) . concat ( monologList , "\n " ) . concat ( blockersList , "\n </div>\n " ) ) ;
this . switchStep ( 'preflight' ) ;
var hasBlockingConflicts = Object . keys ( psrConflicts ) . length && ! this . decisions . psr _log || Object . keys ( monologConflicts ) . length && ! this . decisions . monolog ;
var canStart = ! blockers . length && ! hasBlockingConflicts ;
this . buttons . start . removeClass ( 'hidden' ) . prop ( 'disabled' , ! canStart ) . text ( t ( 'SAFE_UPGRADE_START' , 'Start Safe Upgrade' ) ) ;
if ( Object . keys ( psrConflicts ) . length && ! this . decisions . psr _log ) {
this . decisions . psr _log = 'disable' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( Object . keys ( monologConflicts ) . length && ! this . decisions . monolog ) {
this . decisions . monolog = 'disable' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . updateStartButtonState ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "renderDecisionSelect" ,
value : function renderDecisionSelect ( type ) {
var currentDecision = this . decisions [ type ] || 'disable' ;
var name = "safe-upgrade-decision-" . concat ( type ) ;
var ariaLabel = t ( 'SAFE_UPGRADE_DECISION_PROMPT' , 'When conflicts are detected:' ) ;
var options = [ {
value : 'disable' ,
label : t ( 'SAFE_UPGRADE_DECISION_DISABLE' , 'Disable conflicting plugins' ) ,
description : t ( 'SAFE_UPGRADE_DECISION_DISABLE_DESC' , 'Temporarily disable conflicting plugins during the upgrade.' )
} , {
value : 'continue' ,
label : t ( 'SAFE_UPGRADE_DECISION_CONTINUE' , 'Continue with plugins enabled' ) ,
description : t ( 'SAFE_UPGRADE_DECISION_CONTINUE_DESC' , 'Proceed with plugins enabled. This may require manual fixes.' )
} ] ;
return "\n <div class=\"safe-upgrade-panel__action safe-upgrade-decision\" role=\"radiogroup\" aria-label=\"" . concat ( ariaLabel , "\">\n " ) . concat ( options . map ( function ( option ) {
return "\n <label class=\"safe-upgrade-decision-option\">\n <input type=\"radio\" name=\"" . concat ( name , "\" value=\"" ) . concat ( option . value , "\" " ) . concat ( currentDecision === option . value ? 'checked' : '' , " data-safe-upgrade-decision=\"" ) . concat ( type , "\">\n <span class=\"safe-upgrade-decision-option__content\">\n <span class=\"safe-upgrade-decision-option__title\">" ) . concat ( option . label , "</span>\n <span class=\"safe-upgrade-decision-option__description\">" ) . concat ( option . description , "</span>\n </span>\n </label>\n " ) ;
} ) . join ( '' ) , "\n </div>\n " ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "updateStartButtonState" ,
value : function updateStartButtonState ( ) {
var _this3 = this ;
var decisionInputs = this . modalElement . find ( '[data-safe-upgrade-decision]' ) ;
var unresolved = [ ] ;
decisionInputs . each ( function ( index , element ) {
var input = external _jQuery _default ( ) ( element ) ;
var key = input . data ( 'safe-upgrade-decision' ) ;
if ( ! _this3 . decisions [ key ] ) {
unresolved . push ( key ) ;
}
} ) ;
var hasUnresolvedConflicts = unresolved . length > 0 ;
var blockers = this . steps . preflight . find ( '.safe-upgrade-blockers li' ) ;
var disabled = hasUnresolvedConflicts || blockers . length > 0 ;
this . buttons . start . prop ( 'disabled' , disabled ) ;
}
} , {
key : "setRecheckLoading" ,
value : function setRecheckLoading ( state ) {
var button = this . modalElement . find ( '[data-safe-upgrade-action="recheck"]' ) ;
if ( ! button . length ) {
return ;
}
var dataKey = 'safe-upgrade-recheck-label' ;
if ( state ) {
if ( ! button . data ( dataKey ) ) {
button . data ( dataKey , button . html ( ) ) ;
}
button . prop ( 'disabled' , true ) . addClass ( 'is-loading' ) . html ( "\n <span class=\"button-spinner fa fa-refresh fa-spin\" aria-hidden=\"true\"></span>\n <span class=\"button-text\">" . concat ( t ( 'SAFE_UPGRADE_RECHECKING' , 'Re-running Checks...' ) , "</span>\n " ) ) ;
} else {
var original = button . data ( dataKey ) ;
button . prop ( 'disabled' , false ) . removeClass ( 'is-loading' ) ;
if ( original ) {
button . html ( original ) ;
button . removeData ( dataKey ) ;
} else {
button . html ( t ( 'SAFE_UPGRADE_RECHECK' , 'Re-run Checks' ) ) ;
}
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
} , {
key : "startUpgrade" ,
value : function startUpgrade ( ) {
var _this4 = this ;
this . switchStep ( 'progress' ) ;
2025-10-18 18:16:44 -06:00
this . lastOverallPercent = 0 ;
2025-10-18 13:48:40 -06:00
this . renderProgress ( {
stage : 'initializing' ,
message : t ( 'SAFE_UPGRADE_STAGE_INITIALIZING' , 'Preparing upgrade' ) ,
percent : 0
} ) ;
this . buttons . start . prop ( 'disabled' , true ) ;
this . buttons . finish . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
this . modalLocked = false ;
this . stopPolling ( ) ;
this . jobId = null ;
var decisionFields = { } ;
Object . keys ( this . decisions || { } ) . forEach ( function ( key ) {
var value = _this4 . decisions [ key ] ;
if ( value ) {
decisionFields [ "decisions[" . concat ( key , "]" ) ] = value ;
}
} ) ;
var body = decisionFields ;
utils _request ( this . urls . start , {
method : 'post' ,
body : body
} , function ( response ) {
if ( ! _this4 . active ) {
return ;
}
if ( response . status === 'error' ) {
_this4 . stopPolling ( ) ;
_this4 . renderProgress ( {
stage : 'error' ,
message : response . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ,
percent : null
} ) ;
_this4 . renderResult ( {
status : 'error' ,
message : response . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' )
} ) ;
return ;
}
var data = response . data || { } ;
if ( data . status === 'error' ) {
_this4 . stopPolling ( ) ;
_this4 . renderProgress ( {
stage : 'error' ,
message : data . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ,
percent : null
} ) ;
_this4 . renderResult ( data ) ;
return ;
}
if ( data . fallback ) {
_this4 . renderResult ( data ) ;
_this4 . stopPolling ( ) ;
_this4 . renderProgress ( {
stage : data . status === 'success' ? 'complete' : 'error' ,
message : data . message || t ( 'SAFE_UPGRADE_STAGE_COMPLETE' , 'Upgrade complete' ) ,
percent : data . status === 'success' ? 100 : null ,
target _version : data . version || data . manifest && data . manifest . target _version || null ,
manifest : data . manifest || null
} ) ;
return ;
}
if ( data . status === 'queued' && data . job _id ) {
_this4 . jobId = data . job _id ;
if ( data . progress ) {
_this4 . renderProgress ( data . progress ) ;
}
_this4 . statusFailures = 0 ;
_this4 . preferDirectStatus = ! ! _this4 . directStatusUrl ;
_this4 . statusContext = data . context || null ;
_this4 . beginPolling ( 1200 ) ;
} else {
_this4 . renderResult ( data ) ;
_this4 . stopPolling ( ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "resolveDirectStatusUrl" ,
value : function resolveDirectStatusUrl ( ) {
var scriptPath = '/___safe-upgrade-status' ;
var join = function join ( base , path ) {
if ( ! base ) {
return path ;
}
var trimmed = base . endsWith ( '/' ) ? base . slice ( 0 , - 1 ) : base ;
return "" . concat ( trimmed ) . concat ( path ) ;
} ;
var normalize = function normalize ( url ) {
return url . replace ( /([^:]\/)\/+/g , '$1' ) ;
} ;
var candidates = [ external _GravAdmin _namespaceObject . config . base _url _simple || '' , ( external _GravAdmin _namespaceObject . config . base _url _relative || '' ) . replace ( /\/admin\/?$/ , '' ) , '' ] ;
for ( var _i = 0 , _candidates = candidates ; _i < _candidates . length ; _i ++ ) {
var base = _candidates [ _i ] ;
if ( typeof base !== 'string' ) {
continue ;
}
var candidate = normalize ( join ( base , scriptPath ) ) ;
if ( candidate ) {
return candidate ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return scriptPath ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "resolveStatusEndpoint" ,
value : function resolveStatusEndpoint ( ) {
var useDirect = this . directStatusUrl && this . preferDirectStatus ;
var url = useDirect ? this . directStatusUrl : this . urls . status ;
var params = [ ] ;
if ( this . jobId ) {
params . push ( "job=" . concat ( encodeURIComponent ( this . jobId ) ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( this . statusContext ) {
params . push ( "context=" . concat ( encodeURIComponent ( this . statusContext ) ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( params . length ) {
url += ( url . includes ( '?' ) ? '&' : '?' ) + params . join ( '&' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return {
url : url ,
direct : useDirect
} ;
}
} , {
key : "beginPolling" ,
value : function beginPolling ( ) {
var delay = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 1200 ;
if ( this . isPolling ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . isPolling = true ;
this . schedulePoll ( delay ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "schedulePoll" ,
value : function schedulePoll ( ) {
var _this5 = this ;
var delay = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 1200 ;
this . clearPollTimer ( ) ;
if ( ! this . isPolling ) {
return ;
}
this . pollTimer = setTimeout ( function ( ) {
return _this5 . fetchStatus ( true ) ;
} , delay ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "clearPollTimer" ,
value : function clearPollTimer ( ) {
if ( this . pollTimer ) {
clearTimeout ( this . pollTimer ) ;
this . pollTimer = null ;
}
}
} , {
key : "fetchStatus" ,
value : function fetchStatus ( ) {
var _this6 = this ;
var silent = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
if ( this . statusRequest ) {
return ;
}
this . pollTimer = null ;
var nextStage = null ;
var jobComplete = false ;
var jobFailed = false ;
var handled = false ;
var lastPayload = null ;
console . debug ( '[SafeUpgrade] poll status' ) ;
var endpoint = this . resolveStatusEndpoint ( ) ;
var statusUrl = endpoint . url ;
var usingDirect = endpoint . direct ;
var requestOptions = {
silentErrors : true
} ;
this . statusRequest = utils _request ( statusUrl , requestOptions , function ( response ) {
console . debug ( '[SafeUpgrade] status response' , response ) ;
if ( ! response ) {
_this6 . statusFailures += 1 ;
return ;
}
handled = true ;
_this6 . statusFailures = 0 ;
if ( response . status === 'error' ) {
if ( ! silent ) {
_this6 . renderProgress ( {
stage : 'error' ,
message : response . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ,
percent : null
} ) ;
}
nextStage = 'error' ;
jobFailed = true ;
return ;
}
var payload = response . data || { } ;
lastPayload = payload ;
if ( Object . prototype . hasOwnProperty . call ( payload , 'context' ) ) {
_this6 . statusContext = payload . context || null ;
}
var job = payload . job || { } ;
var data = payload . progress || payload ;
nextStage = data . stage || null ;
if ( ! job || ! Object . keys ( job ) . length ) {
_this6 . statusIdleCount += 1 ;
} else {
_this6 . statusIdleCount = 0 ;
}
_this6 . renderProgress ( data , job ) ;
if ( job . status === 'error' ) {
nextStage = 'error' ;
var message = job . error || data . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) ;
_this6 . renderProgress ( {
stage : 'error' ,
message : message ,
percent : null
} , job ) ;
jobFailed = true ;
} else if ( job . status === 'success' ) {
if ( data . stage !== 'complete' ) {
var completePayload = {
stage : 'complete' ,
message : t ( 'SAFE_UPGRADE_STAGE_COMPLETE' , 'Upgrade complete' ) ,
percent : 100 ,
target _version : job . result && job . result . version || data . target _version || null ,
manifest : job . result && job . result . manifest || data . manifest || null
} ;
_this6 . renderProgress ( completePayload , job ) ;
nextStage = 'complete' ;
}
jobComplete = true ;
} else if ( ! job . status && data . stage === 'complete' ) {
jobComplete = true ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
var finalize = function finalize ( ) {
_this6 . statusRequest = null ;
if ( ! _this6 . isPolling ) {
return ;
}
if ( ! handled ) {
if ( usingDirect && _this6 . statusFailures >= 3 ) {
_this6 . preferDirectStatus = false ;
_this6 . statusFailures = 0 ;
_this6 . statusIdleCount = 0 ;
_this6 . schedulePoll ( ) ;
} else {
var delay = Math . min ( 5000 , 1200 * Math . max ( 1 , _this6 . statusFailures ) ) ;
_this6 . schedulePoll ( delay ) ;
}
} else if ( ( ! lastPayload || ! lastPayload . job || ! Object . keys ( lastPayload . job ) . length ) && usingDirect && _this6 . statusIdleCount >= 5 ) {
_this6 . preferDirectStatus = false ;
_this6 . statusFailures = 0 ;
_this6 . statusIdleCount = 0 ;
_this6 . schedulePoll ( ) ;
} else if ( jobFailed ) {
_this6 . stopPolling ( ) ;
_this6 . jobId = null ;
} else if ( jobComplete || nextStage === 'complete' ) {
_this6 . stopPolling ( ) ;
_this6 . jobId = null ;
} else {
_this6 . schedulePoll ( ) ;
}
} ;
this . statusRequest . then ( finalize , finalize ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "renderProgress" ,
value : function renderProgress ( data ) {
var _this7 = this ;
var job = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
if ( ! data ) {
return ;
}
var stage = data . stage || 'initializing' ;
if ( stage !== this . currentStage ) {
this . currentStage = stage ;
this . stageEnteredAt = Date . now ( ) ;
}
var titleResolver = STAGE _TITLES [ stage ] || STAGE _TITLES . initializing ;
var title = titleResolver ( ) ;
var percent = typeof data . percent === 'number' ? data . percent : null ;
var scaledPercent = function scaledPercent ( ) {
if ( stage === 'queued' ) {
return 0 ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( stage === 'initializing' ) {
2025-10-18 18:16:44 -06:00
return percent !== null ? Math . min ( Math . max ( percent , 0 ) , 5 ) : 5 ;
2025-10-18 13:48:40 -06:00
}
if ( stage === 'downloading' ) {
2025-10-18 18:16:44 -06:00
return _this7 . scaleStagePercent ( 5 , 45 , percent , 2 ) ;
2025-10-18 13:48:40 -06:00
}
2025-10-18 17:54:29 -06:00
if ( stage === 'snapshot' ) {
2025-10-18 18:16:44 -06:00
return _this7 . scaleStagePercent ( 45 , 70 , percent , 2 ) ;
2025-10-18 17:54:29 -06:00
}
2025-10-18 13:48:40 -06:00
if ( stage === 'installing' ) {
2025-10-18 18:16:44 -06:00
return _this7 . scaleStagePercent ( 70 , 95 , percent , 3 ) ;
2025-10-18 13:48:40 -06:00
}
2025-10-18 17:54:29 -06:00
if ( stage === 'rollback' ) {
2025-10-18 18:16:44 -06:00
return _this7 . scaleStagePercent ( 40 , 95 , percent , 3 ) ;
2025-10-18 17:54:29 -06:00
}
2025-10-18 13:48:40 -06:00
if ( stage === 'finalizing' ) {
2025-10-18 18:16:44 -06:00
return _this7 . scaleStagePercent ( 95 , 99 , percent , 1.5 ) ;
2025-10-18 13:48:40 -06:00
}
if ( stage === 'complete' ) {
return 100 ;
}
if ( stage === 'error' ) {
return null ;
}
return percent ;
} ;
percent = scaledPercent ( ) ;
2025-10-18 18:16:44 -06:00
if ( percent !== null ) {
var baseline = typeof this . lastOverallPercent === 'number' ? this . lastOverallPercent : 0 ;
percent = Math . max ( percent , baseline ) ;
this . lastOverallPercent = percent ;
}
2025-10-18 13:48:40 -06:00
var displayPercent = percent !== null ? Math . round ( percent ) : null ;
var percentLabel = displayPercent !== null ? "" . concat ( displayPercent , "%" ) : '' ;
2025-10-18 17:54:29 -06:00
var message = typeof data . message === 'string' ? data . message : '' ;
var normalize = function normalize ( value ) {
return value . replace ( /\u2026/g , '...' ) . replace ( /\.+$/ , '' ) . trim ( ) . toLowerCase ( ) ;
} ;
var normalizedTitle = normalize ( title || '' ) ;
var normalizedMessage = normalize ( message || '' ) ;
var shouldShowMessage = stage === 'error' ? message . trim ( ) . length > 0 : message && stage !== 'installing' && stage !== 'finalizing' && normalizedMessage !== '' && normalizedMessage !== normalizedTitle ;
2025-10-18 13:48:40 -06:00
var statusLine = job && job . status ? "<p class=\"safe-upgrade-status\">" . concat ( t ( 'SAFE_UPGRADE_JOB_STATUS' , 'Status' ) , ": <strong>" ) . concat ( job . status . toUpperCase ( ) , "</strong>" ) . concat ( job . error ? " — " . concat ( job . error ) : '' , "</p>" ) : '' ;
var animateBar = stage !== 'complete' && stage !== 'error' && percent !== null ;
var barClass = "safe-upgrade-progress-bar" . concat ( animateBar ? ' is-active' : '' ) ;
2025-10-18 17:54:29 -06:00
var detailMessage = shouldShowMessage ? "<p>" . concat ( message , "</p>" ) : '' ;
2025-10-18 13:48:40 -06:00
this . steps . progress . html ( "\n <div class=\"safe-upgrade-progress\">\n <h3>" . concat ( title , "</h3>\n " ) . concat ( detailMessage , "\n " ) . concat ( statusLine , "\n " ) . concat ( percentLabel ? "<div class=\"" . concat ( barClass , "\"><span style=\"width:" ) . concat ( percent , "%\"></span></div><div class=\"progress-value\">" ) . concat ( percentLabel , "</div>" ) : '' , "\n </div>\n " ) ) ;
this . switchStep ( 'progress' ) ;
if ( stage === 'complete' ) {
this . renderResult ( {
status : 'success' ,
manifest : data . manifest || null ,
version : data . target _version || null
} ) ;
} else if ( stage === 'error' ) {
this . renderResult ( {
status : 'error' ,
message : data . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' )
} ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "renderResult" ,
value : function renderResult ( result ) {
var status = result . status || 'success' ;
if ( status === 'success' || status === 'finalized' ) {
var manifest = result . manifest || { } ;
var target = result . version || manifest . target _version || '' ;
var identifier = manifest . id || '' ;
this . steps . result . html ( "\n <div class=\"safe-upgrade-result success\">\n <h3>" . concat ( r ( 'SAFE_UPGRADE_RESULT_SUCCESS' , target , 'Grav upgraded to v%s' ) , "</h3>\n " ) . concat ( identifier ? "<p>" . concat ( r ( 'SAFE_UPGRADE_RESULT_MANIFEST' , identifier , 'Snapshot reference: <code>%s</code>' ) , "</p>" ) : '' , "\n <p>" ) . concat ( t ( 'SAFE_UPGRADE_RESULT_HINT' , 'Restore snapshots from Tools → Restore Grav.' ) , "</p>\n </div>\n " ) ) ;
this . switchStep ( 'result' ) ;
external _jQuery _default ( ) ( '[data-gpm-grav]' ) . remove ( ) ;
if ( target ) {
external _jQuery _default ( ) ( '#footer .grav-version' ) . html ( "v" . concat ( target ) ) ;
}
if ( this . updates ) {
this . updates . fetch ( true ) ;
}
this . prepareCompletionFooter ( ) ;
} else if ( status === 'noop' ) {
this . steps . result . html ( "\n <div class=\"safe-upgrade-result neutral\">\n <h3>" . concat ( t ( 'SAFE_UPGRADE_RESULT_NOOP' , 'Grav is already up to date.' ) , "</h3>\n </div>\n " ) ) ;
this . switchStep ( 'result' ) ;
this . prepareCompletionFooter ( ) ;
} else {
this . steps . result . html ( "\n <div class=\"safe-upgrade-result error\">\n <h3>" . concat ( t ( 'SAFE_UPGRADE_RESULT_FAILURE' , 'Safe upgrade failed' ) , "</h3>\n <p>" ) . concat ( result . message || t ( 'SAFE_UPGRADE_GENERIC_ERROR' , 'Safe upgrade could not complete. See Grav logs for details.' ) , "</p>\n </div>\n " ) ) ;
this . switchStep ( 'result' ) ;
this . modalLocked = false ;
this . buttons . finish . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
this . buttons . cancel . removeClass ( 'hidden' ) . prop ( 'disabled' , false ) ;
this . buttons . recheck . removeClass ( 'hidden' ) . prop ( 'disabled' , false ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "switchStep" ,
value : function switchStep ( step ) {
var _this8 = this ;
Object . keys ( this . steps ) . forEach ( function ( handle ) {
var isActive = handle === step ;
_this8 . steps [ handle ] . toggle ( isActive ) ;
_this8 . steps [ handle ] . toggleClass ( 'hidden' , ! isActive ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "resetFooterButtons" ,
value : function resetFooterButtons ( ) {
this . buttons . cancel . removeClass ( 'hidden' ) . prop ( 'disabled' , false ) ;
this . buttons . recheck . removeClass ( 'hidden' ) . prop ( 'disabled' , false ) ;
this . buttons . finish . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "prepareCompletionFooter" ,
value : function prepareCompletionFooter ( ) {
this . modalLocked = true ;
this . buttons . cancel . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
this . buttons . recheck . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
this . buttons . start . addClass ( 'hidden' ) . prop ( 'disabled' , true ) ;
this . buttons . finish . removeClass ( 'hidden' ) . prop ( 'disabled' , false ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "stopPolling" ,
value : function stopPolling ( ) {
this . isPolling = false ;
this . clearPollTimer ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 18:16:44 -06:00
} , {
key : "scaleStagePercent" ,
value : function scaleStagePercent ( start , end , stagePercent , fallbackSeconds ) {
var safeStart = typeof start === 'number' ? start : 0 ;
var safeEnd = typeof end === 'number' ? end : safeStart ;
if ( stagePercent !== null && ! Number . isNaN ( stagePercent ) ) {
var normalized = Math . min ( 100 , Math . max ( 0 , stagePercent ) ) ;
return safeStart + ( safeEnd - safeStart ) * normalized / 100 ;
}
var duration = typeof fallbackSeconds === 'number' ? Math . max ( fallbackSeconds , 0.25 ) : 1 ;
return this . computeSmoothPercent ( safeStart , safeEnd , duration , stagePercent ) ;
}
2025-10-18 13:48:40 -06:00
} , {
key : "computeSmoothPercent" ,
value : function computeSmoothPercent ( base , target , durationSeconds , actualPercent ) {
var span = target - base ;
if ( span <= 0 ) {
return actualPercent !== null ? Math . min ( Math . max ( actualPercent , base ) , target ) : base ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var elapsed = Math . max ( 0 , ( Date . now ( ) - this . stageEnteredAt ) / 1000 ) ;
var progressRatio = Math . min ( 1 , elapsed / Math . max ( durationSeconds , 1 ) ) ;
var smooth = base + progressRatio * span ;
if ( actualPercent !== null && ! Number . isNaN ( actualPercent ) ) {
smooth = Math . max ( smooth , Math . min ( actualPercent , target ) ) ;
}
return Math . min ( smooth , target ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
function basename ( path ) {
if ( ! path ) {
return '' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return path . split ( /[\\/]/ ) . pop ( ) ;
}
; // ./app/updates/index.js
function updates _typeof ( o ) { "@babel/helpers - typeof" ; return updates _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , updates _typeof ( o ) ; }
function updates _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function updates _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , updates _toPropertyKey ( o . key ) , o ) ; } }
function updates _createClass ( e , r , t ) { return r && updates _defineProperties ( e . prototype , r ) , t && updates _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function updates _toPropertyKey ( t ) { var i = updates _toPrimitive ( t , "string" ) ; return "symbol" == updates _typeof ( i ) ? i : i + "" ; }
function updates _toPrimitive ( t , r ) { if ( "object" != updates _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != updates _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-09-24 18:27:08 -06:00
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var Updates = /*#__PURE__*/ function ( ) {
function Updates ( ) {
var payload = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
updates _classCallCheck ( this , Updates ) ;
this . setPayload ( payload ) ;
this . task = "task" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) ;
this . updateURL = '' ;
this . safeUpgrade = new SafeUpgrade ( this ) ;
}
return updates _createClass ( Updates , [ {
key : "setPayload" ,
value : function setPayload ( ) {
var payload = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
this . payload = payload ;
if ( this . safeUpgrade ) {
this . safeUpgrade . setPayload ( payload ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return this ;
}
} , {
key : "fetch" ,
value : function fetch ( ) {
var _this = this ;
var force = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : false ;
gpm _Instance . fetch ( function ( response ) {
return _this . setPayload ( response ) ;
} , force ) ;
return this ;
}
} , {
key : "maintenance" ,
value : function maintenance ( ) {
var mode = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'hide' ;
var element = external _jQuery _default ( ) ( '#updates [data-update-packages]' ) ;
element [ mode === 'show' ? 'fadeIn' : 'fadeOut' ] ( ) ;
if ( mode === 'hide' ) {
external _jQuery _default ( ) ( '.badges.with-updates' ) . removeClass ( 'with-updates' ) . find ( '.badge.updates' ) . remove ( ) ;
}
return this ;
}
} , {
key : "grav" ,
value : function grav ( ) {
var payload = this . payload . grav ;
if ( payload && payload . isUpdatable ) {
var task = this . task ;
var bar = '' ;
if ( ! payload . isSymlink ) {
this . updateURL = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/update.json/" ) . concat ( task , "updategrav/admin-nonce" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( external _GravAdmin _namespaceObject . config . admin _nonce ) ;
bar += "<button data-remodal-target=\"update-grav\" class=\"button button-small secondary pointer-events-none\" id=\"grav-update-button\">" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATE _GRAV _NOW , " <span class=\"cnt-down\">(5s)</span></button>" ) ;
} else {
bar += "<span class=\"hint--left\" style=\"float: right;\" data-hint=\"" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . GRAV _SYMBOLICALLY _LINKED , "\"><i class=\"fa fa-fw fa-link\"></i></span>" ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
bar += "\n Grav <b>v" . concat ( payload . available , "</b> " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . IS _NOW _AVAILABLE , "! <span class=\"less\">(" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . CURRENT , " v" ) . concat ( payload . version , ")</span>\n " ) ;
var element = external _jQuery _default ( ) ( '[data-gpm-grav]' ) . removeClass ( 'hidden' ) ;
if ( element . is ( ':empty' ) ) {
element . hide ( ) ;
}
element . addClass ( 'grav' ) . html ( "" . concat ( bar ) ) . slideDown ( 150 , function ( ) {
var c = 5 ;
var x = setInterval ( function ( ) {
c -= 1 ;
element . find ( '.pointer-events-none .cnt-down' ) . text ( '(' + c + 's)' ) ;
} , 1000 ) ;
setTimeout ( function ( ) {
clearInterval ( x ) ;
element . find ( '.pointer-events-none .cnt-down' ) . remove ( ) ;
element . find ( '.pointer-events-none' ) . removeClass ( 'pointer-events-none' ) ;
} , 5000 ) ;
} ) . parent ( '#messages' ) . addClass ( 'default-box-shadow' ) ;
}
return this ;
}
} , {
key : "resources" ,
value : function resources ( ) {
if ( ! this . payload || ! this . payload . resources || ! this . payload . resources . total ) {
return this . maintenance ( 'hide' ) ;
}
var is _current _package _latest = true ;
var map = [ 'plugins' , 'themes' ] ;
var singles = [ 'plugin' , 'theme' ] ;
var _this$payload$resourc = this . payload . resources ,
plugins = _this$payload$resourc . plugins ,
themes = _this$payload$resourc . themes ;
if ( ! this . payload . resources . total ) {
return this ;
}
[ plugins , themes ] . forEach ( function ( resources , index ) {
if ( ! resources || Array . isArray ( resources ) || updates _typeof ( resources ) !== 'object' ) {
return ;
}
var length = Object . keys ( resources ) . length ;
var type = map [ index ] ;
// sidebar
external _jQuery _default ( ) ( "#admin-menu a[href$=\"/" . concat ( map [ index ] , "\"]" ) ) . find ( '.badges' ) . addClass ( 'with-updates' ) . find ( '.badge.updates' ) . text ( length ) ;
var type _translation = '' ;
// update all
if ( type === 'plugins' ) {
type _translation = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . PLUGINS ;
} else {
type _translation = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . THEMES ;
}
var updateAll = external _jQuery _default ( ) ( ".grav-update." . concat ( type ) ) ;
updateAll . css ( 'display' , 'block' ) . html ( "\n <p>\n <a href=\"#\" class=\"button button-small secondary\" data-remodal-target=\"update-packages\" data-packages-slugs=\"" . concat ( Object . keys ( resources ) . join ( ) , "\" data-" ) . concat ( singles [ index ] , "-action=\"start-packages-update\">" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATE , " " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . ALL , " " ) . concat ( type _translation , "</a>\n <i class=\"fa fa-bullhorn\"></i>\n " ) . concat ( length , " " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . OF _YOUR , " " ) . concat ( type _translation . toLowerCase ( ) , " " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . HAVE _AN _UPDATE _AVAILABLE , "\n </p>\n " ) ) ;
var existing _slugs = external _jQuery _default ( ) ( '[data-update-packages]' ) . attr ( 'data-packages-slugs' ) || '' ;
if ( existing _slugs ) {
existing _slugs = existing _slugs . split ( ',' ) ;
} else {
existing _slugs = [ ] ;
}
var slugs = unique _default ( ) ( existing _slugs . concat ( Object . keys ( resources ) ) ) . join ( ) ;
external _jQuery _default ( ) ( '[data-update-packages]' ) . attr ( 'data-packages-slugs' , "" . concat ( slugs ) ) ;
Object . keys ( resources ) . forEach ( function ( item ) {
// listing page
var container = external _jQuery _default ( ) ( "[data-gpm-" . concat ( singles [ index ] , "=\"" ) . concat ( item , "\"]" ) ) ;
var element = container . find ( '.gpm-name' ) ;
var url = element . find ( 'a' ) ;
var content _wrapper = container . parents ( '.content-wrapper' ) ;
if ( type === 'plugins' && ! element . find ( '.badge.update' ) . length ) {
element . append ( "<a class=\"plugin-update-button\" href=\"" . concat ( url . attr ( 'href' ) , "\"><span class=\"badge update\">" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATE _AVAILABLE , "!</span></a>" ) ) ;
content _wrapper . addClass ( 'has-updates' ) ;
} else if ( type === 'themes' ) {
element . append ( "<div class=\"gpm-ribbon\"><a href=\"" . concat ( url . attr ( 'href' ) , "\">" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATE . toUpperCase ( ) , "</a></div>" ) ) ;
content _wrapper . addClass ( 'has-updates' ) ;
}
// details page
if ( container . length ) {
var details = external _jQuery _default ( ) ( ".grav-update." . concat ( singles [ index ] ) ) ;
if ( details . length ) {
var releaseType = resources [ item ] . type === 'testing' ? '<span class="gpm-testing">test release</span>' : '' ;
details . html ( "\n <p>\n <a href=\"#\" class=\"button button-small secondary\" data-remodal-target=\"update-packages\" data-packages-slugs=\"" . concat ( item , "\" data-" ) . concat ( singles [ index ] , "-action=\"start-package-installation\">" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UPDATE , " " ) . concat ( singles [ index ] . charAt ( 0 ) . toUpperCase ( ) + singles [ index ] . substr ( 1 ) . toLowerCase ( ) , "</a>\n <i class=\"fa fa-bullhorn\"></i>\n <strong>v" ) . concat ( resources [ item ] . available , "</strong> " ) . concat ( releaseType , " " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . OF _THIS , " " ) . concat ( singles [ index ] , " " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . IS _NOW _AVAILABLE , "!\n </p>\n " ) ) . css ( 'display' , 'block' ) ;
is _current _package _latest = false ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
external _jQuery _default ( ) ( '[data-update-packages]' ) . removeClass ( 'hidden' ) ;
} ) ;
external _jQuery _default ( ) ( '.content-wrapper' ) . addClass ( 'updates-checked' ) ;
if ( ! is _current _package _latest ) {
external _jQuery _default ( ) ( '.warning-reinstall-not-latest-release' ) . removeClass ( 'hidden' ) ;
}
}
} ] ) ;
} ( ) ;
var updates _Instance = new Updates ( ) ;
// automatically refresh UI for updates (graph, sidebar, plugin/themes pages) after every fetch
gpm _Instance . on ( 'fetched' , function ( response , raw ) {
updates _Instance . setPayload ( response . payload || { } ) ;
updates _Instance . grav ( ) . resources ( ) ;
} ) ;
if ( external _GravAdmin _namespaceObject . config . enable _auto _updates _check === '1' ) {
gpm _Instance . fetch ( ) ;
}
// EXTERNAL MODULE: ./node_modules/chartist/dist/chartist.js
var chartist = _ _webpack _require _ _ ( 9592 ) ;
var chartist _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( chartist ) ;
; // ./app/dashboard/chart.js
function chart _callSuper ( t , o , e ) { return o = chart _getPrototypeOf ( o ) , chart _possibleConstructorReturn ( t , chart _isNativeReflectConstruct ( ) ? Reflect . construct ( o , e || [ ] , chart _getPrototypeOf ( t ) . constructor ) : o . apply ( t , e ) ) ; }
function chart _possibleConstructorReturn ( t , e ) { if ( e && ( "object" == chart _typeof ( e ) || "function" == typeof e ) ) return e ; if ( void 0 !== e ) throw new TypeError ( "Derived constructors may only return object or undefined" ) ; return chart _assertThisInitialized ( t ) ; }
function chart _assertThisInitialized ( e ) { if ( void 0 === e ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return e ; }
function chart _isNativeReflectConstruct ( ) { try { var t = ! Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ; } catch ( t ) { } return ( chart _isNativeReflectConstruct = function _isNativeReflectConstruct ( ) { return ! ! t ; } ) ( ) ; }
function _superPropGet ( t , o , e , r ) { var p = _get ( chart _getPrototypeOf ( 1 & r ? t . prototype : t ) , o , e ) ; return 2 & r && "function" == typeof p ? function ( t ) { return p . apply ( e , t ) ; } : p ; }
function _get ( ) { return _get = "undefined" != typeof Reflect && Reflect . get ? Reflect . get . bind ( ) : function ( e , t , r ) { var p = _superPropBase ( e , t ) ; if ( p ) { var n = Object . getOwnPropertyDescriptor ( p , t ) ; return n . get ? n . get . call ( arguments . length < 3 ? e : r ) : n . value ; } } , _get . apply ( null , arguments ) ; }
function _superPropBase ( t , o ) { for ( ; ! { } . hasOwnProperty . call ( t , o ) && null !== ( t = chart _getPrototypeOf ( t ) ) ; ) ; return t ; }
function chart _getPrototypeOf ( t ) { return chart _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf . bind ( ) : function ( t ) { return t . _ _proto _ _ || Object . getPrototypeOf ( t ) ; } , chart _getPrototypeOf ( t ) ; }
function chart _inherits ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function" ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , writable : ! 0 , configurable : ! 0 } } ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , e && chart _setPrototypeOf ( t , e ) ; }
function chart _setPrototypeOf ( t , e ) { return chart _setPrototypeOf = Object . setPrototypeOf ? Object . setPrototypeOf . bind ( ) : function ( t , e ) { return t . _ _proto _ _ = e , t ; } , chart _setPrototypeOf ( t , e ) ; }
function chart _typeof ( o ) { "@babel/helpers - typeof" ; return chart _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , chart _typeof ( o ) ; }
function chart _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function chart _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , chart _toPropertyKey ( o . key ) , o ) ; } }
function chart _createClass ( e , r , t ) { return r && chart _defineProperties ( e . prototype , r ) , t && chart _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function chart _toPropertyKey ( t ) { var i = chart _toPrimitive ( t , "string" ) ; return "symbol" == chart _typeof ( i ) ? i : i + "" ; }
function chart _toPrimitive ( t , r ) { if ( "object" != chart _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != chart _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
// let isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
var defaults = {
data : {
series : [ 100 , 0 ]
} ,
options : {
Pie : {
donut : true ,
donutWidth : 10 ,
startAngle : 0 ,
total : 100 ,
showLabel : false ,
height : 150 ,
// chartPadding: !isFirefox ? 10 : 25 // workaround for older versions of firefox
chartPadding : 5
} ,
Bar : {
height : 164 ,
chartPadding : 20 ,
// workaround for older versions of firefox
axisX : {
showGrid : false ,
labelOffset : {
x : 0 ,
y : 0
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ,
axisY : {
offset : 15 ,
showLabel : true ,
showGrid : true ,
labelOffset : {
x : 5 ,
y : 5
} ,
scaleMinSpace : 25
}
}
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
var Chart = /*#__PURE__*/ function ( ) {
function Chart ( element ) {
var _this = this ;
var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var data = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
chart _classCallCheck ( this , Chart ) ;
this . element = external _jQuery _default ( ) ( element ) || [ ] ;
if ( ! this . element [ 0 ] ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
var type = ( this . element . data ( 'chart-type' ) || 'pie' ) . toLowerCase ( ) ;
this . type = type . charAt ( 0 ) . toUpperCase ( ) + type . substr ( 1 ) . toLowerCase ( ) ;
options = Object . assign ( { } , defaults . options [ this . type ] , options ) ;
data = Object . assign ( { } , defaults . data , data ) ;
Object . assign ( this , {
options : options ,
data : data
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
this . chart = ( chartist _default ( ) ) [ this . type ] ( this . element . find ( '.ct-chart' ) . empty ( ) [ 0 ] , this . data , this . options ) ;
this . chart . on ( 'created' , function ( ) {
_this . element . find ( '.hidden' ) . removeClass ( 'hidden' ) ;
// FIX: workaround for chartist issue not allowing HTML in labels anymore
// https://github.com/gionkunz/chartist-js/issues/937
_this . element . find ( '.ct-label' ) . each ( function ( index , label ) {
label = external _jQuery _default ( ) ( label ) ;
var text = label . html ( ) . replace ( '<' , '<' ) . replace ( '>' , '>' ) ;
label . html ( text ) ;
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
return chart _createClass ( Chart , [ {
key : "updateData" ,
value : function updateData ( data ) {
Object . assign ( this . data , data ) ;
this . chart . update ( this . data ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
;
var UpdatesChart = /*#__PURE__*/ function ( _Chart ) {
function UpdatesChart ( element ) {
var _this2 ;
var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
var data = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
chart _classCallCheck ( this , UpdatesChart ) ;
_this2 = chart _callSuper ( this , UpdatesChart , [ element , options , data ] ) ;
_this2 . chart . on ( 'draw' , function ( data ) {
return _this2 . draw ( data ) ;
} ) ;
gpm _Instance . on ( 'fetched' , function ( response ) {
if ( ! response . payload ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var payload = response . payload . grav ;
var missing = ( response . payload . resources . total + ( payload . isUpdatable ? 1 : 0 ) ) * 100 / ( response . payload . installed + ( payload . isUpdatable ? 1 : 0 ) ) ;
var updated = 100 - missing ;
_this2 . updateData ( {
series : [ updated , missing ]
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
if ( response . payload . resources . total ) {
updates _Instance . maintenance ( 'show' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
return _this2 ;
}
chart _inherits ( UpdatesChart , _Chart ) ;
return chart _createClass ( UpdatesChart , [ {
key : "draw" ,
value : function draw ( data ) {
if ( data . index ) {
return ;
}
var notice = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN [ data . value === 100 ? 'FULLY_UPDATED' : 'UPDATES_AVAILABLE' ] ;
this . element . find ( '.numeric span' ) . text ( "" . concat ( Math . round ( data . value ) , "%" ) ) ;
this . element . find ( '.js__updates-available-description' ) . html ( notice ) ;
this . element . find ( '.hidden' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "updateData" ,
value : function updateData ( data ) {
_superPropGet ( UpdatesChart , "updateData" , this , 3 ) ( [ data ] ) ;
// missing updates
if ( this . data . series [ 0 ] < 100 ) {
this . element . closest ( '#updates' ) . find ( '[data-update-packages]' ) . fadeIn ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
} ] ) ;
} ( Chart ) ;
var charts = { } ;
external _jQuery _default ( ) ( '[data-chart-name]' ) . each ( function ( ) {
var element = external _jQuery _default ( ) ( this ) ;
var name = element . data ( 'chart-name' ) || '' ;
var options = element . data ( 'chart-options' ) || { } ;
var data = element . data ( 'chart-data' ) || { } ;
if ( name === 'updates' ) {
charts [ name ] = new UpdatesChart ( element , options , data ) ;
} else {
charts [ name ] = new Chart ( element , options , data ) ;
}
} ) ;
var Instances = charts ;
; // ./app/dashboard/cache.js
function cache _typeof ( o ) { "@babel/helpers - typeof" ; return cache _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , cache _typeof ( o ) ; }
function cache _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function cache _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , cache _toPropertyKey ( o . key ) , o ) ; } }
function cache _createClass ( e , r , t ) { return r && cache _defineProperties ( e . prototype , r ) , t && cache _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function cache _toPropertyKey ( t ) { var i = cache _toPrimitive ( t , "string" ) ; return "symbol" == cache _typeof ( i ) ? i : i + "" ; }
function cache _toPrimitive ( t , r ) { if ( "object" != cache _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != cache _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var getUrl = function getUrl ( ) {
var type = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : '' ;
if ( type ) {
type = "cleartype:" . concat ( type , "/" ) ;
}
return "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/cache.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "clearCache/" ) . concat ( type , "admin-nonce" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( external _GravAdmin _namespaceObject . config . admin _nonce ) ;
} ;
var Cache = /*#__PURE__*/ function ( ) {
function Cache ( ) {
var _this = this ;
cache _classCallCheck ( this , Cache ) ;
this . element = external _jQuery _default ( ) ( '[data-clear-cache]' ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'click' , '[data-clear-cache]' , function ( event ) {
return _this . clear ( event , event . target ) ;
} ) ;
}
return cache _createClass ( Cache , [ {
key : "clear" ,
value : function clear ( event , element ) {
var _this2 = this ;
var type = '' ;
if ( event && event . preventDefault ) {
event . preventDefault ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof event === 'string' ) {
type = event ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
element = element ? external _jQuery _default ( ) ( element ) : external _jQuery _default ( ) ( "[data-clear-cache-type=\"" . concat ( type , "\"]" ) ) ;
type = type || external _jQuery _default ( ) ( element ) . data ( 'clear-cache-type' ) || '' ;
var url = element . data ( 'clearCache' ) || getUrl ( type ) ;
this . disable ( ) ;
utils _request ( url , function ( ) {
return _this2 . enable ( ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "enable" ,
value : function enable ( ) {
this . element . removeAttr ( 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-refresh fa-spin fa-retweet' ) . addClass ( 'fa-retweet' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "disable" ,
value : function disable ( ) {
this . element . attr ( 'disabled' , 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-retweet' ) . addClass ( 'fa-refresh fa-spin' ) ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var cache _Instance = new Cache ( ) ;
; // ./app/dashboard/backup.js
external _jQuery _default ( ) ( '[data-backup][data-ajax*="backup/"]' ) . on ( 'click' , function ( ) {
var element = external _jQuery _default ( ) ( this ) ;
var url = element . data ( 'ajax' ) ;
var inDropdown = element . closest ( '.dropdown-menu' ) ;
( inDropdown . length ? inDropdown : element ) . closest ( '.button-group' ) . find ( '> button:first' ) . attr ( 'disabled' , 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-life-ring' ) . addClass ( 'fa-spin fa-refresh' ) ;
utils _request ( url , function /* response */
( ) {
if ( Instances && Instances . backups ) {
Instances . backups . updateData ( {
series : [ 0 , 100 ]
} ) ;
Instances . backups . element . find ( '.numeric' ) . html ( "0 <em>" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DAYS . toLowerCase ( ) , "</em>" ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
( inDropdown . length ? inDropdown : element ) . closest ( '.button-group' ) . find ( '> button:first' ) . removeAttr ( 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-spin fa-refresh' ) . addClass ( 'fa-life-ring' ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} ) ;
external _jQuery _default ( ) ( '[data-backup][data-ajax*="backupDelete"]' ) . on ( 'click' , function ( ) {
var element = external _jQuery _default ( ) ( this ) ;
var url = element . data ( 'ajax' ) ;
var tr = element . closest ( 'tr' ) ;
tr . addClass ( 'deleting' ) ;
utils _request ( url , function ( response ) {
if ( response . status === 'success' ) {
tr . remove ( ) ;
} else {
tr . removeClass ( 'deleting' ) ;
}
} ) ;
} ) ;
; // ./app/dashboard/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* harmony default export */ const dashboard = ( {
Chart : {
Chart : Chart ,
UpdatesChart : UpdatesChart ,
Instances : Instances
} ,
Cache : cache _Instance
} ) ;
// EXTERNAL MODULE: ./node_modules/sortablejs/modular/sortable.esm.js
var sortable _esm = _ _webpack _require _ _ ( 10246 ) ;
// EXTERNAL MODULE: ./node_modules/debounce/index.js
var debounce = _ _webpack _require _ _ ( 17334 ) ;
var debounce _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( debounce ) ;
// EXTERNAL MODULE: ./app/utils/storage.js
var storage = _ _webpack _require _ _ ( 95851 ) ;
; // ./app/pages/tree.js
function tree _typeof ( o ) { "@babel/helpers - typeof" ; return tree _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , tree _typeof ( o ) ; }
function tree _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function tree _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , tree _toPropertyKey ( o . key ) , o ) ; } }
function tree _createClass ( e , r , t ) { return r && tree _defineProperties ( e . prototype , r ) , t && tree _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function tree _toPropertyKey ( t ) { var i = tree _toPrimitive ( t , "string" ) ; return "symbol" == tree _typeof ( i ) ? i : i + "" ; }
function tree _toPrimitive ( t , r ) { if ( "object" != tree _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != tree _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var sessionKey = 'grav:admin:pages' ;
if ( ! sessionStorage . getItem ( sessionKey ) ) {
sessionStorage . setItem ( sessionKey , '{}' ) ;
}
var PagesTree = /*#__PURE__*/ function ( ) {
function PagesTree ( query ) {
var _this = this ;
var elements = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : undefined ;
tree _classCallCheck ( this , PagesTree ) ;
this . query = query ;
this . elements = external _jQuery _default ( ) ( elements !== undefined ? elements : this . query ) ;
this . session = JSON . parse ( sessionStorage . getItem ( sessionKey ) || '{}' ) ;
if ( ! this . elements . length ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . restore ( ) ;
this . elements . find ( '.page-icon' ) . on ( 'click' , function ( event ) {
return _this . toggle ( event . target ) ;
} ) ;
this . elements . data ( 'tree_init' , 1 ) ;
external _jQuery _default ( ) ( '[data-page-toggleall]' ) . on ( 'click' , function ( event ) {
var element = external _jQuery _default ( ) ( event . target ) . closest ( '[data-page-toggleall]' ) ;
var action = element . data ( 'page-toggleall' ) ;
_this [ action ] ( ) ;
} ) ;
}
return tree _createClass ( PagesTree , [ {
key : "reload" ,
value : function reload ( ) {
var elements = external _jQuery _default ( ) ( this . query ) . filter ( function ( index , element ) {
return ! external _jQuery _default ( ) ( element ) . data ( 'tree_init' ) ;
} ) ;
if ( ! elements . length ) {
return ;
}
this . constructor ( this . query , elements ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "toggle" ,
value : function toggle ( elements ) {
2025-10-16 10:59:50 -06:00
var _this2 = this ;
2025-10-18 13:48:40 -06:00
var dontStore = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
if ( typeof elements === 'string' ) {
elements = external _jQuery _default ( ) ( "[data-nav-id=\"" . concat ( elements , "\"]" ) ) . find ( '[data-toggle="children"]' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
elements = external _jQuery _default ( ) ( elements || this . elements ) ;
elements . each ( function ( index , element ) {
element = external _jQuery _default ( ) ( element ) ;
var state = _this2 . getState ( element . closest ( '[data-toggle="children"]' ) ) ;
_this2 [ state . isOpen ? 'collapse' : 'expand' ] ( state . id , dontStore ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "collapse" ,
value : function collapse ( elements ) {
var _this3 = this ;
var dontStore = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
if ( typeof elements === 'string' ) {
elements = external _jQuery _default ( ) ( "[data-nav-id=\"" . concat ( elements , "\"]" ) ) . find ( '[data-toggle="children"]' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
elements = external _jQuery _default ( ) ( elements || this . elements ) ;
elements . each ( function ( index , element ) {
element = external _jQuery _default ( ) ( element ) ;
var state = _this3 . getState ( element ) ;
if ( state . isOpen ) {
state . children . hide ( ) ;
state . icon . removeClass ( 'children-open' ) . addClass ( 'children-closed' ) ;
if ( ! dontStore ) {
delete _this3 . session [ state . id ] ;
}
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
if ( ! dontStore ) {
this . save ( ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "expand" ,
value : function expand ( elements ) {
var _this4 = this ;
var dontStore = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
if ( typeof elements === 'string' ) {
var element = external _jQuery _default ( ) ( "[data-nav-id=\"" . concat ( elements , "\"]" ) ) ;
var parents = element . parents ( '[data-nav-id]' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// loop back through parents, we don't want to expand an hidden child
if ( parents . length ) {
parents = parents . find ( '[data-toggle="children"]:first' ) ;
parents = parents . add ( element . find ( '[data-toggle="children"]:first' ) ) ;
return this . expand ( parents , dontStore ) ;
}
elements = element . find ( '[data-toggle="children"]:first' ) ;
}
elements = external _jQuery _default ( ) ( elements || this . elements ) ;
elements . each ( function ( index , element ) {
element = external _jQuery _default ( ) ( element ) ;
var state = _this4 . getState ( element ) ;
if ( ! state . isOpen ) {
state . children . show ( ) ;
state . icon . removeClass ( 'children-closed' ) . addClass ( 'children-open' ) ;
if ( ! dontStore ) {
_this4 . session [ state . id ] = 1 ;
}
}
} ) ;
if ( ! dontStore ) {
this . save ( ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "restore" ,
value : function restore ( ) {
var _this5 = this ;
this . collapse ( null , true ) ;
Object . keys ( this . session ) . forEach ( function ( key ) {
_this5 . expand ( key , 'no-store' ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "save" ,
value : function save ( ) {
return sessionStorage . setItem ( sessionKey , JSON . stringify ( this . session ) ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "getState" ,
value : function getState ( element ) {
element = external _jQuery _default ( ) ( element ) ;
return {
id : element . closest ( '[data-nav-id]' ) . data ( 'nav-id' ) ,
children : element . closest ( 'li.page-item' ) . find ( 'ul:first' ) ,
icon : element . find ( '.page-icon' ) ,
get isOpen ( ) {
return this . icon . hasClass ( 'children-open' ) ;
}
} ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var tree _Instance = new PagesTree ( '[data-toggle="children"]' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// EXTERNAL MODULE: ./node_modules/selectize/dist/js/selectize.js
var selectize = _ _webpack _require _ _ ( 72890 ) ;
var selectize _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( selectize ) ;
; // ./app/utils/selectize-required-fix.js
/ * *
* This is a plugin to override the ` .refreshValidityState ` method of
* the Selectize library ( https : //selectize.github.io/selectize.js/).
* The library is not maintained anymore ( as of 2017 - 09 - 13 ) and contains
* a bug which causes Microsoft Edge to not work with selectized [ required ]
* form fields . This plugin should be removed if
* https : //github.com/selectize/selectize.js/pull/1320 is ever merged
* and a new version of Selectize gets released .
* /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
selectize _default ( ) . define ( 'required-fix' , function ( options ) {
var _this = this ;
this . refreshValidityState = function ( ) {
if ( ! _this . isRequired ) return false ;
var invalid = ! _this . items . length ;
_this . isInvalid = invalid ;
if ( invalid ) {
_this . $control _input . attr ( 'required' , '' ) ;
_this . $input . removeAttr ( 'required' ) ;
} else {
_this . $control _input . removeAttr ( 'required' ) ;
_this . $input . attr ( 'required' ) ;
}
} ;
} ) ;
; // ./app/pages/filter.js
function filter _typeof ( o ) { "@babel/helpers - typeof" ; return filter _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , filter _typeof ( o ) ; }
function filter _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function filter _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , filter _toPropertyKey ( o . key ) , o ) ; } }
function filter _createClass ( e , r , t ) { return r && filter _defineProperties ( e . prototype , r ) , t && filter _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function filter _toPropertyKey ( t ) { var i = filter _toPrimitive ( t , "string" ) ; return "symbol" == filter _typeof ( i ) ? i : i + "" ; }
function filter _toPrimitive ( t , r ) { if ( "object" != filter _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != filter _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
/* @formatter:off */
/* eslint-disable */
var options = [ {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . MODULE ,
key : 'Module' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . VISIBLE ,
key : 'Visible' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . ROUTABLE ,
key : 'Routable' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . PUBLISHED ,
key : 'Published' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . NON _MODULE ,
key : 'NonModule' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . NON _VISIBLE ,
key : 'NonVisible' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . NON _ROUTABLE ,
key : 'NonRoutable' ,
cat : 'mode'
} , {
flag : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . NON _PUBLISHED ,
key : 'NonPublished' ,
cat : 'mode'
} ] ;
/* @formatter:on */
/* eslint-enable */
var PagesFilter = /*#__PURE__*/ function ( ) {
function PagesFilter ( filters , search ) {
var _this = this ;
filter _classCallCheck ( this , PagesFilter ) ;
this . filters = external _jQuery _default ( ) ( filters ) ;
this . search = external _jQuery _default ( ) ( search ) ;
this . options = options ;
this . tree = tree _Instance ;
var storage = JSON . parse ( localStorage . getItem ( 'grav:admin:pages:filter' ) || '{}' ) ;
if ( ! this . filters . length || ! this . search . length ) {
return ;
}
this . labels = this . filters . data ( 'filter-labels' ) ;
this . search . on ( 'input' , debounce _default ( ) ( function ( ) {
return _this . filter ( ) ;
} , 250 ) ) ;
this . filters . on ( 'change' , function ( ) {
return _this . filter ( ) ;
} ) ;
// restore state
if ( storage . flags || storage . query ) {
this . setValues ( storage ) ;
this . filter ( ) ;
}
this . _initSelectize ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return filter _createClass ( PagesFilter , [ {
key : "filter" ,
value : function filter ( value ) {
var _this2 = this ;
var data = {
flags : '' ,
query : ''
} ;
if ( filter _typeof ( value ) === 'object' ) {
Object . assign ( data , value ) ;
}
if ( typeof value === 'string' ) {
data . query = value ;
}
if ( typeof value === 'undefined' ) {
data . flags = this . filters . val ( ) ;
data . query = this . search . val ( ) ;
}
if ( ! Object . keys ( data ) . filter ( function ( key ) {
return data [ key ] !== '' ;
} ) . length ) {
this . resetValues ( ) ;
return ;
}
data . flags = data . flags . replace ( /(\s{1,})?,(\s{1,})?/g , ',' ) ;
this . setValues ( {
flags : data . flags ,
query : data . query
} , 'silent' ) ;
utils _request ( "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/pages-filter.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "filterPages" ) , {
2025-10-16 10:59:50 -06:00
method : 'post' ,
2025-10-18 13:48:40 -06:00
body : data
2025-10-16 10:59:50 -06:00
} , function ( response ) {
2025-10-18 13:48:40 -06:00
_this2 . refreshDOM ( response ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "refreshDOM" ,
value : function refreshDOM ( response ) {
var _this3 = this ;
var items = external _jQuery _default ( ) ( '[data-nav-id]' ) ;
if ( ! response ) {
items . removeClass ( 'search-match' ) . show ( ) ;
this . tree . restore ( ) ;
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
items . removeClass ( 'search-match' ) . hide ( ) ;
response . results . forEach ( function ( page ) {
var match = items . filter ( "[data-nav-id=\"" . concat ( page , "\"]" ) ) . addClass ( 'search-match' ) . show ( ) ;
match . parents ( '[data-nav-id]' ) . addClass ( 'search-match' ) . show ( ) ;
_this3 . tree . expand ( page , 'no-store' ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "setValues" ,
value : function setValues ( _ref , silent ) {
var _ref$flags = _ref . flags ,
flags = _ref$flags === void 0 ? '' : _ref$flags ,
_ref$query = _ref . query ,
query = _ref$query === void 0 ? '' : _ref$query ;
var flagsArray = flags . replace ( /(\s{1,})?,(\s{1,})?/g , ',' ) . split ( ',' ) ;
if ( this . filters . val ( ) !== flags ) {
var selectize = this . filters . data ( 'selectize' ) ;
this . filters [ selectize ? 'setValue' : 'val' ] ( flagsArray , silent ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( this . search . val ( ) !== query ) {
this . search . val ( query ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
localStorage . setItem ( 'grav:admin:pages:filter' , JSON . stringify ( {
flags : flags ,
query : query
} ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "resetValues" ,
value : function resetValues ( ) {
this . setValues ( '' , 'silent' ) ;
this . refreshDOM ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "_initSelectize" ,
value : function _initSelectize ( ) {
var _this4 = this ;
var extras = {
type : this . filters . data ( 'filter-types' ) || { } ,
access : this . filters . data ( 'filter-access-levels' ) || { }
} ;
Object . keys ( extras ) . forEach ( function ( cat ) {
Object . keys ( extras [ cat ] ) . forEach ( function ( key ) {
_this4 . options . push ( {
cat : cat ,
key : key ,
flag : extras [ cat ] [ key ]
} ) ;
} ) ;
} ) ;
this . filters . selectize ( {
maxItems : null ,
valueField : 'key' ,
labelField : 'flag' ,
searchField : [ 'flag' , 'key' ] ,
options : this . options ,
optgroups : this . labels ,
optgroupField : 'cat' ,
optgroupLabelField : 'name' ,
optgroupValueField : 'id' ,
optgroupOrder : this . labels . map ( function ( item ) {
return item . id ;
} ) ,
plugins : [ 'optgroup_columns' , 'required-fix' ]
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var filter _Instance = new PagesFilter ( 'input[name="page-filter"]' , 'input[name="page-search"]' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// EXTERNAL MODULE: ./node_modules/speakingurl/index.js
var speakingurl = _ _webpack _require _ _ ( 91264 ) ;
var speakingurl _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( speakingurl ) ;
; // ./app/utils/jquery-utils.js
var _this = undefined ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// jQuery no parents filter
( external _jQuery _default ( ) ) . expr [ ':' ] [ 'noparents' ] = external _jQuery _default ( ) . expr . createPseudo ( function ( text ) {
return function ( element ) {
return external _jQuery _default ( ) ( element ) . parents ( text ) . length < 1 ;
} ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
// Slugify
// CommonJS and ES6 version of https://github.com/madflow/jquery-slugify
( external _jQuery _default ( ) ) . fn . slugify = function ( source , options ) {
return _this . each ( function ( element ) {
var target = external _jQuery _default ( ) ( element ) ;
var source = external _jQuery _default ( ) ( source ) ;
target . on ( 'keyup change' , function ( ) {
target . data ( 'locked' , target . val ( ) !== '' && target . val ( ) !== undefined ) ;
} ) ;
source . on ( 'keyup change' , function ( ) {
if ( target . data ( 'locked' ) === true ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var isInput = target . is ( 'input' ) || target . is ( 'textarea' ) ;
target [ isInput ? 'val' : 'text' ] ( external _jQuery _default ( ) . slugify ( source . val ( ) , options ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
} ) ;
2025-10-18 13:48:40 -06:00
} ;
// Static method.
( external _jQuery _default ( ) ) . slugify = function ( sourceString , options ) {
options = external _jQuery _default ( ) . extend ( { } , ( external _jQuery _default ( ) ) . slugify . options , options ) ;
options . lang = options . lang || external _jQuery _default ( ) ( 'html' ) . prop ( 'lang' ) ;
if ( typeof options . preSlug === 'function' ) {
sourceString = options . preSlug ( sourceString ) ;
}
sourceString = options . slugFunc ( sourceString , options ) ;
if ( typeof options . postSlug === 'function' ) {
sourceString = options . postSlug ( sourceString ) ;
}
return sourceString ;
} ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Default plugin options
( external _jQuery _default ( ) ) . slugify . options = {
preSlug : null ,
postSlug : null ,
slugFunc : function slugFunc ( input , opts ) {
return speakingurl _default ( ) ( input , opts ) ;
}
} ;
; // ./app/pages/page/add.js
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
var custom = false ;
var folder = external _jQuery _default ( ) ( '[data-remodal-id="modal"] input[name="data[folder]"], [data-remodal-id="module"] input[name="data[folder]"], [data-remodal-id="modal-page-copy"] input[name="data[folder]"]' ) ;
var title = external _jQuery _default ( ) ( '[data-remodal-id="modal"] input[name="data[title]"], [data-remodal-id="module"] input[name="data[title]"], [data-remodal-id="modal-page-copy"] input[name="data[title]"]' ) ;
var getFields = function getFields ( type , target ) {
target = external _jQuery _default ( ) ( target ) ;
var query = "[data-remodal-id=\"" . concat ( target . closest ( '[data-remodal-id]' ) . data ( 'remodal-id' ) , "\"]" ) ;
return {
title : type === 'title' ? external _jQuery _default ( ) ( target ) : external _jQuery _default ( ) ( "" . concat ( query , " input[name=\"data[title]\"]" ) ) ,
folder : type === 'folder' ? external _jQuery _default ( ) ( target ) : external _jQuery _default ( ) ( "" . concat ( query , " input[name=\"data[folder]\"]" ) )
} ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
title . on ( 'input focus blur' , function ( event ) {
if ( custom ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var elements = getFields ( 'title' , event . currentTarget ) ;
var slug = external _jQuery _default ( ) . slugify ( elements . title . val ( ) , {
custom : {
"'" : '' ,
'‘ ' : '' ,
'’ ' : ''
}
} ) ;
elements . folder . val ( slug ) ;
} ) ;
folder . on ( 'input' , function ( event ) {
var elements = getFields ( 'folder' , event . currentTarget ) ;
var input = elements . folder . get ( 0 ) ;
var value = elements . folder . val ( ) ;
var selection = {
start : input . selectionStart ,
end : input . selectionEnd
} ;
value = value . toLowerCase ( ) . replace ( /\s/g , '-' ) . replace ( /[^a-z0-9_\-]/g , '' ) ;
elements . folder . val ( value ) ;
custom = ! ! value ;
// restore cursor position
input . setSelectionRange ( selection . start , selection . end ) ;
} ) ;
folder . on ( 'focus blur' , function ( event ) {
getFields ( 'title' ) . title . trigger ( 'input' ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'change' , '[name="data[route]"]' , function ( event ) {
var rawroute = external _jQuery _default ( ) ( event . currentTarget ) . val ( ) ;
var pageTemplate = external _jQuery _default ( ) ( '[name="data[name]"]' ) ;
var URI = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/ajax.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "getChildTypes" ) ;
if ( pageTemplate . length === 0 ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
utils _request ( URI , {
method : 'post' ,
body : {
rawroute : rawroute
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , function ( response ) {
var type = response . child _type ;
if ( type !== '' && type !== 'default' ) {
pageTemplate . val ( type ) ;
pageTemplate . data ( 'selectize' ) . setValue ( type ) ;
}
} ) ;
} ) ;
; // ./app/pages/page/move.js
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-page-move] button[name="task"][value="save"]' , function ( event ) {
/ * l e t r o u t e = $ ( ' f o r m # b l u e p r i n t s : f i r s t s e l e c t [ n a m e = " d a t a [ r o u t e ] " ] ' ) ;
let moveTo = $ ( '[data-page-move] select' ) . val ( ) ;
if ( route . length && route . val ( ) !== moveTo ) {
let selectize = route . data ( 'selectize' ) ;
route . val ( moveTo ) ;
if ( selectize ) selectize . setValue ( moveTo ) ;
} * /
var modal = external _jQuery _default ( ) ( event . currentTarget ) . closest ( '[data-remodal-id]' ) ;
var parents = modal . data ( 'parents' ) || { } ;
var finder = parents . finder ;
if ( ! parents || ! finder ) {
return true ;
}
var field = parents . field ;
var parentLabel = parents . parentLabel ;
var parentName = parents . parentName ;
var selection = finder . findLastActive ( ) . item [ 0 ] ;
var value = selection . _item [ finder . config . valueKey ] ;
var name = selection . _item [ finder . config . labelKey ] ;
field . val ( value ) ;
parentLabel . text ( value ) ;
parentName . text ( name ) ;
finder . config . defaultPath = value ;
external _jQuery _default ( ) ( '<div />' ) . css ( {
backgroundColor : 'rgba(255, 255, 255, 0.1)' ,
position : 'fixed' ,
top : 0 ,
left : 0 ,
width : '100vw' ,
height : '100vh' ,
zIndex : 15000
} ) . appendTo ( external _jQuery _default ( ) ( 'body' ) ) ;
} ) ;
/ *
$ ( document ) . on ( 'click' , '[data-remodal-id="parents"] [data-parents-select]' , ( event ) => {
const modal = $ ( event . currentTarget ) . closest ( '[data-remodal-id]' ) ;
const parents = modal . data ( 'parents' ) ;
const finder = parents . finder ;
const field = parents . field ;
const parentLabel = parents . parentLabel ;
const parentName = parents . parentName ;
const selection = finder . findLastActive ( ) . item [ 0 ] ;
const value = selection . _item [ finder . config . valueKey ] ;
const name = selection . _item [ finder . config . labelKey ] ;
field . val ( value ) ;
parentLabel . text ( value ) ;
parentName . text ( name ) ;
finder . config . defaultPath = value ;
const remodal = $ . remodal . lookup [ $ ( ` [data-remodal-id=" ${ modal . data ( 'remodalId' ) } "] ` ) . data ( 'remodal' ) ] ;
remodal . close ( ) ;
} ) ;
* /
; // ./app/pages/page/delete.js
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-remodal-target="delete"]' , function ( ) {
var confirm = external _jQuery _default ( ) ( '[data-remodal-id="delete"] [data-delete-action]' ) ;
var link = external _jQuery _default ( ) ( this ) . data ( 'delete-url' ) ;
confirm . data ( 'delete-action' , link ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-delete-action]' , function ( ) {
var remodal = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( '[data-remodal-id="delete"]' ) . data ( 'remodal' ) ] ;
_ _webpack _require _ _ . g . location . href = external _jQuery _default ( ) ( this ) . data ( 'delete-action' ) ;
remodal . close ( ) ;
} ) ;
; // ./app/pages/page/unset.js
external _jQuery _default ( ) ( document ) . on ( 'click' , '.dz-unset' , function ( ) {
var file _upload = external _jQuery _default ( ) ( this ) . closest ( '.files-upload' ) ;
external _jQuery _default ( ) ( this ) . closest ( '.dz-image-preview' ) . remove ( ) ;
var unset _image = external _jQuery _default ( ) ( this ) . closest ( '.dz-image-preview' ) . find ( '[data-dz-name]' ) . text ( ) . trim ( ) ;
var images = JSON . parse ( file _upload . find ( 'input[data-grav-field="hidden"]' ) . val ( ) ) || { } ;
var image _array = { } ;
external _jQuery _default ( ) . each ( images , function ( ind , obj ) {
if ( ! ind . endsWith ( unset _image ) ) {
image _array [ ind ] = obj ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
file _upload . find ( 'input[data-grav-field="hidden"]' ) . val ( JSON . stringify ( image _array ) ) ;
} ) ;
; // ./app/pages/page/disable-buttons.js
external _jQuery _default ( ) ( '.disable-after-click' ) . on ( 'click' , function ( ) {
external _jQuery _default ( ) ( this ) . addClass ( 'pointer-events-disabled' ) ;
} ) ;
; // ./app/utils/cookies.js
function cookies _typeof ( o ) { "@babel/helpers - typeof" ; return cookies _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , cookies _typeof ( o ) ; }
/ *
* Cookies . js - 1.2 . 3 - grav
* https : //github.com/ScottHamper/Cookies
*
* With SameSite support by Grav
*
* This is free and unencumbered software released into the public domain .
* /
var factory = function factory ( window ) {
var _arguments = arguments ;
if ( cookies _typeof ( window . document ) !== 'object' ) {
throw new Error ( 'Cookies.js requires a `window` with a `document` object' ) ;
}
var _Cookies = function Cookies ( key , value , options ) {
return _arguments . length === 1 ? _Cookies . get ( key ) : _Cookies . set ( key , value , options ) ;
} ;
// Allows for setter injection in unit tests
_Cookies . _document = window . document ;
// Used to ensure cookie keys do not collide with
// built-in `Object` properties
_Cookies . _cacheKeyPrefix = 'cookey.' ; // Hurr hurr, :)
_Cookies . _maxExpireDate = new Date ( 'Fri, 31 Dec 9999 23:59:59 UTC' ) ;
_Cookies . defaults = {
path : '/' ,
secure : false ,
sameSite : 'Lax'
} ;
_Cookies . get = function ( key ) {
if ( _Cookies . _cachedDocumentCookie !== _Cookies . _document . cookie ) {
_Cookies . _renewCache ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var value = _Cookies . _cache [ _Cookies . _cacheKeyPrefix + key ] ;
return value === undefined ? undefined : decodeURIComponent ( value ) ;
} ;
_Cookies . set = function ( key , value , options ) {
options = _Cookies . _getExtendedOptions ( options ) ;
options . expires = _Cookies . _getExpiresDate ( value === undefined ? - 1 : options . expires ) ;
_Cookies . _document . cookie = _Cookies . _generateCookieString ( key , value , options ) ;
return _Cookies ;
} ;
_Cookies . expire = function ( key , options ) {
return _Cookies . set ( key , undefined , options ) ;
} ;
_Cookies . _getExtendedOptions = function ( options ) {
return {
path : options && options . path || _Cookies . defaults . path ,
domain : options && options . domain || _Cookies . defaults . domain ,
expires : options && options . expires || _Cookies . defaults . expires ,
secure : options && options . secure !== undefined ? options . secure : _Cookies . defaults . secure ,
sameSite : options && options . sameSite || _Cookies . defaults . sameSite
} ;
} ;
_Cookies . _isValidDate = function ( date ) {
return Object . prototype . toString . call ( date ) === '[object Date]' && ! isNaN ( date . getTime ( ) ) ;
} ;
_Cookies . _getExpiresDate = function ( expires , now ) {
now = now || new Date ( ) ;
if ( typeof expires === 'number' ) {
expires = expires === Infinity ? _Cookies . _maxExpireDate : new Date ( now . getTime ( ) + expires * 1000 ) ;
} else if ( typeof expires === 'string' ) {
expires = new Date ( expires ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( expires && ! _Cookies . _isValidDate ( expires ) ) {
throw new Error ( '`expires` parameter cannot be converted to a valid Date instance' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return expires ;
} ;
_Cookies . _generateCookieString = function ( key , value , options ) {
key = key . replace ( /[^#$&+\^`|]/g , encodeURIComponent ) ;
key = key . replace ( /\(/g , '%28' ) . replace ( /\)/g , '%29' ) ;
value = ( value + '' ) . replace ( /[^!#$&-+\--:<-\[\]-~]/g , encodeURIComponent ) ;
options = options || { } ;
var cookieString = key + '=' + value ;
cookieString += options . path ? ';path=' + options . path : '' ;
cookieString += options . domain ? ';domain=' + options . domain : '' ;
cookieString += options . expires ? ';expires=' + options . expires . toUTCString ( ) : '' ;
cookieString += options . secure ? ';secure' : '' ;
cookieString += options . sameSite ? ';SameSite=' + options . sameSite : '' ;
return cookieString ;
} ;
_Cookies . _getCacheFromString = function ( documentCookie ) {
var cookieCache = { } ;
var cookiesArray = documentCookie ? documentCookie . split ( '; ' ) : [ ] ;
for ( var i = 0 ; i < cookiesArray . length ; i ++ ) {
var cookieKvp = _Cookies . _getKeyValuePairFromCookieString ( cookiesArray [ i ] ) ;
if ( cookieCache [ _Cookies . _cacheKeyPrefix + cookieKvp . key ] === undefined ) {
cookieCache [ _Cookies . _cacheKeyPrefix + cookieKvp . key ] = cookieKvp . value ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
return cookieCache ;
} ;
_Cookies . _getKeyValuePairFromCookieString = function ( cookieString ) {
// "=" is a valid character in a cookie value according to RFC6265, so cannot `split('=')`
var separatorIndex = cookieString . indexOf ( '=' ) ;
// IE omits the "=" when the cookie value is an empty string
separatorIndex = separatorIndex < 0 ? cookieString . length : separatorIndex ;
var key = cookieString . substr ( 0 , separatorIndex ) ;
var decodedKey ;
try {
decodedKey = decodeURIComponent ( key ) ;
} catch ( e ) {
if ( console && typeof console . error === 'function' ) {
console . error ( 'Could not decode cookie with key "' + key + '"' , e ) ;
}
}
return {
key : decodedKey ,
value : cookieString . substr ( separatorIndex + 1 ) // Defer decoding value until accessed
} ;
} ;
_Cookies . _renewCache = function ( ) {
_Cookies . _cache = _Cookies . _getCacheFromString ( _Cookies . _document . cookie ) ;
_Cookies . _cachedDocumentCookie = _Cookies . _document . cookie ;
} ;
_Cookies . _areEnabled = function ( ) {
var testKey = 'cookies.js' ;
var areEnabled = _Cookies . set ( testKey , 1 ) . get ( testKey ) === '1' ;
_Cookies . expire ( testKey ) ;
return areEnabled ;
} ;
_Cookies . enabled = _Cookies . _areEnabled ( ) ;
return _Cookies ;
} ;
_ _webpack _require _ _ . g . Cookies = _ _webpack _require _ _ . g && cookies _typeof ( _ _webpack _require _ _ . g . document ) === 'object' ? factory ( _ _webpack _require _ _ . g ) : factory ;
/* harmony default export */ const cookies = ( _ _webpack _require _ _ . g . Cookies ) ;
; // ./app/forms/fields/editor/buttons.js
var replacer = function replacer ( _ref ) {
var name = _ref . name ,
replace = _ref . replace ,
codemirror = _ref . codemirror ,
button = _ref . button ,
_ref$mode = _ref . mode ,
mode = _ref$mode === void 0 ? 'replaceSelections' : _ref$mode ,
runner = _ref . runner ;
button . on ( "click.editor." . concat ( name ) , function ( ) {
strategies [ mode ] ( {
token : '$1' ,
template : replace ,
codemirror : codemirror ,
runner : runner
} ) ;
} ) ;
} ;
var strategies = {
replaceSelections : function replaceSelections ( _ref2 ) {
var template = _ref2 . template ,
token = _ref2 . token ,
codemirror = _ref2 . codemirror ,
runner = _ref2 . runner ;
var replacements = [ ] ;
var ranges = [ ] ;
var selections = codemirror . getSelections ( ) ;
var list = codemirror . listSelections ( ) ;
var accumulator = { } ;
selections . forEach ( function ( selection , index ) {
var markup = template . replace ( token , selection ) ;
var cursor = markup . indexOf ( '$cur' ) ;
var _list$index$anchor = list [ index ] . anchor ,
line = _list$index$anchor . line ,
ch = _list$index$anchor . ch ;
markup = markup . replace ( '$cur' , '' ) ;
markup = runner ? runner ( selection , markup , list ) : markup ;
replacements . push ( markup ) ;
if ( ! accumulator [ line ] ) {
accumulator [ line ] = 0 ;
}
ch += accumulator [ line ] + ( cursor === - 1 ? markup . length : cursor ) ;
var range = {
ch : ch ,
line : line
2025-10-17 15:40:31 -06:00
} ;
2025-10-18 13:48:40 -06:00
ranges . push ( {
anchor : range ,
head : range
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
accumulator [ line ] += markup . length - selection . length ;
} ) ;
codemirror . replaceSelections ( replacements ) ;
codemirror . setSelections ( ranges ) ;
codemirror . focus ( ) ;
} ,
replaceLine : function replaceLine ( _ref3 ) {
var template = _ref3 . template ,
token = _ref3 . token ,
codemirror = _ref3 . codemirror ,
runner = _ref3 . runner ;
var list = codemirror . listSelections ( ) ;
var range ;
list . forEach ( function ( selection ) {
var lines = {
min : Math . min ( selection . anchor . line , selection . head . line ) ,
max : Math . max ( selection . anchor . line , selection . head . line )
} ;
codemirror . eachLine ( lines . min , lines . max + 1 , function ( handler ) {
var markup = template . replace ( token , handler . text ) ;
var line = codemirror . getLineNumber ( handler ) ;
markup = runner ? runner ( handler , markup ) : markup ;
codemirror . replaceRange ( markup , {
line : line ,
ch : 0
} , {
line : line ,
ch : markup . length
2025-10-17 15:40:31 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
range = {
line : line ,
ch : markup . length
} ;
2025-10-17 15:40:31 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} ) ;
codemirror . setSelection ( range , range , 'end' ) ;
codemirror . focus ( ) ;
} ,
replaceRange : function replaceRange ( ) { }
} ;
var flipDisabled = function flipDisabled ( codemirror , button , type ) {
var hasHistory = codemirror . historySize ( ) [ type ] ;
var element = button . find ( 'a' ) ;
button [ hasHistory ? 'removeClass' : 'addClass' ] ( 'button-disabled' ) ;
if ( ! hasHistory ) {
element . attr ( 'title-disabled' , element . attr ( 'title' ) ) ;
element . attr ( 'data-hint-disabled' , element . attr ( 'data-hint' ) ) ;
element . removeAttr ( 'title' ) . removeAttr ( 'data-hint' ) ;
} else {
element . attr ( 'title' , element . attr ( 'title-disabled' ) ) ;
element . attr ( 'data-hint' , element . attr ( 'data-hint-disabled' ) ) ;
element . removeAttr ( 'title-disabled' ) . removeAttr ( 'data-hint-disabled' ) ;
}
} ;
/* harmony default export */ const buttons = ( {
navigation : [ {
undo : {
identifier : 'undo' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UNDO ,
label : '<i class="fa fa-fw fa-undo"></i>' ,
modes : [ ] ,
action : function action ( _ref4 ) {
var codemirror = _ref4 . codemirror ,
button = _ref4 . button ,
textarea = _ref4 . textarea ;
button . addClass ( 'button-disabled' ) ;
codemirror . on ( 'change' , function ( ) {
return flipDisabled ( codemirror , button , 'undo' ) ;
} ) ;
button . on ( 'click.editor.undo' , function ( ) {
codemirror . undo ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-17 15:40:31 -06:00
} , {
2025-10-18 13:48:40 -06:00
redo : {
identifier : 'redo' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . REDO ,
label : '<i class="fa fa-fw fa-repeat"></i>' ,
modes : [ ] ,
action : function action ( _ref5 ) {
var codemirror = _ref5 . codemirror ,
button = _ref5 . button ,
textarea = _ref5 . textarea ;
button . addClass ( 'button-disabled' ) ;
codemirror . on ( 'change' , function ( ) {
return flipDisabled ( codemirror , button , 'redo' ) ;
} ) ;
button . on ( 'click.editor.redo' , function ( ) {
codemirror . redo ( ) ;
} ) ;
2025-10-17 15:40:31 -06:00
}
}
2025-10-16 10:59:50 -06:00
} , {
2025-10-18 13:48:40 -06:00
headers : {
identifier : 'headers' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . HEADERS ,
label : '<i class="fa fa-fw fa-header"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
children : [ {
h1 : {
identifier : 'h1' ,
label : '<i class="fa fa-fw fa-header"></i>1' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref6 ) {
var codemirror = _ref6 . codemirror ,
button = _ref6 . button ,
textarea = _ref6 . textarea ;
replacer ( {
name : 'h1' ,
replace : '# $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
2025-10-17 16:00:46 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
h2 : {
identifier : 'h2' ,
label : '<i class="fa fa-fw fa-header"></i>2' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref7 ) {
var codemirror = _ref7 . codemirror ,
button = _ref7 . button ,
textarea = _ref7 . textarea ;
replacer ( {
name : 'h2' ,
replace : '## $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
2025-10-16 15:13:34 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
h3 : {
identifier : 'h3' ,
label : '<i class="fa fa-fw fa-header"></i>3' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref8 ) {
var codemirror = _ref8 . codemirror ,
button = _ref8 . button ,
textarea = _ref8 . textarea ;
replacer ( {
name : 'h3' ,
replace : '### $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
h4 : {
identifier : 'h4' ,
label : '<i class="fa fa-fw fa-header"></i>4' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref9 ) {
var codemirror = _ref9 . codemirror ,
button = _ref9 . button ,
textarea = _ref9 . textarea ;
replacer ( {
name : 'h4' ,
replace : '#### $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
h5 : {
identifier : 'h5' ,
label : '<i class="fa fa-fw fa-header"></i>5' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref0 ) {
var codemirror = _ref0 . codemirror ,
button = _ref0 . button ,
textarea = _ref0 . textarea ;
replacer ( {
name : 'h5' ,
replace : '##### $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
2025-10-16 17:31:57 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
h6 : {
identifier : 'h6' ,
label : '<i class="fa fa-fw fa-header"></i>6' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref1 ) {
var codemirror = _ref1 . codemirror ,
button = _ref1 . button ,
textarea = _ref1 . textarea ;
replacer ( {
name : 'h6' ,
replace : '###### $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
2025-10-16 17:31:57 -06:00
}
}
2025-10-18 13:48:40 -06:00
} ]
}
} , {
bold : {
identifier : 'bold' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . BOLD ,
label : '<i class="fa fa-fw fa-bold"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
shortcut : [ 'Ctrl-B' , 'Cmd-B' ] ,
action : function action ( _ref10 ) {
var codemirror = _ref10 . codemirror ,
button = _ref10 . button ,
textarea = _ref10 . textarea ;
replacer ( {
name : 'bold' ,
replace : '**$1$cur**' ,
codemirror : codemirror ,
button : button
} ) ;
}
}
} , {
italic : {
identifier : 'italic' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . ITALIC ,
label : '<i class="fa fa-fw fa-italic"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
shortcut : [ 'Ctrl-I' , 'Cmd-I' ] ,
action : function action ( _ref11 ) {
var codemirror = _ref11 . codemirror ,
button = _ref11 . button ,
textarea = _ref11 . textarea ;
replacer ( {
name : 'italic' ,
replace : '_$1$cur_' ,
codemirror : codemirror ,
button : button
} ) ;
}
}
} , {
strike : {
identifier : 'strike' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . STRIKETHROUGH ,
label : '<i class="fa fa-fw fa-strikethrough"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref12 ) {
var codemirror = _ref12 . codemirror ,
button = _ref12 . button ,
textarea = _ref12 . textarea ;
replacer ( {
name : 'strike' ,
replace : '~~$1$cur~~' ,
codemirror : codemirror ,
button : button
} ) ;
}
}
} , {
delimiter : {
identifier : 'delimiter' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . SUMMARY _DELIMITER ,
label : '<i class="fa fa-fw fa-minus"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref13 ) {
var codemirror = _ref13 . codemirror ,
button = _ref13 . button ,
textarea = _ref13 . textarea ;
replacer ( {
name : 'delimiter' ,
replace : "" . concat ( external _GravAdmin _namespaceObject . config . site . delimiter , "$1" ) ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
}
}
} , {
link : {
identifier : 'link' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . LINK ,
label : '<i class="fa fa-fw fa-link"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
shortcut : [ 'Ctrl-K' , 'Cmd-K' ] ,
action : function action ( _ref14 ) {
var codemirror = _ref14 . codemirror ,
button = _ref14 . button ,
textarea = _ref14 . textarea ;
replacer ( {
name : 'link' ,
replace : '[$1]($cur)' ,
codemirror : codemirror ,
button : button
} ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-16 23:16:16 -06:00
} , {
2025-10-18 13:48:40 -06:00
image : {
identifier : 'image' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . IMAGE ,
label : '<i class="fa fa-fw fa-picture-o"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref15 ) {
var codemirror = _ref15 . codemirror ,
button = _ref15 . button ,
textarea = _ref15 . textarea ;
replacer ( {
name : 'image' ,
replace : '' ,
codemirror : codemirror ,
button : button
} ) ;
2025-10-16 23:16:16 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
blockquote : {
identifier : 'blockquote' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . BLOCKQUOTE ,
label : '<i class="fa fa-fw fa-quote-right"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref16 ) {
var codemirror = _ref16 . codemirror ,
button = _ref16 . button ,
textarea = _ref16 . textarea ;
replacer ( {
name : 'blockquote' ,
replace : '> $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
2025-10-17 10:02:22 -06:00
}
2025-10-18 13:48:40 -06:00
}
} , {
listUl : {
identifier : 'listUl' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . UNORDERED _LIST ,
label : '<i class="fa fa-fw fa-list-ul"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref17 ) {
var codemirror = _ref17 . codemirror ,
button = _ref17 . button ,
textarea = _ref17 . textarea ;
replacer ( {
name : 'listUl' ,
replace : '* $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine'
} ) ;
2025-10-17 10:02:22 -06:00
}
2025-10-18 13:48:40 -06:00
}
} , {
listOl : {
identifier : 'listOl' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . ORDERED _LIST ,
label : '<i class="fa fa-fw fa-list-ol"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref18 ) {
var codemirror = _ref18 . codemirror ,
button = _ref18 . button ,
textarea = _ref18 . textarea ;
replacer ( {
name : 'listOl' ,
replace : '. $1' ,
codemirror : codemirror ,
button : button ,
mode : 'replaceLine' ,
runner : function runner ( line , markup ) {
var lineNo = codemirror . getLineNumber ( line ) ;
var previousLine = codemirror . getLine ( lineNo - 1 ) || '' ;
var match = previousLine . match ( /^(\d+)\./ ) ;
var prefix = 1 + ( match ? Number ( match [ 1 ] ) : 0 ) ;
return "" . concat ( prefix ) . concat ( markup ) ;
}
} ) ;
}
}
} ] ,
states : [ {
code : {
identifier : 'editor' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . EDITOR ,
label : '<i class="fa fa-fw fa-code"></i>' ,
action : function action ( _ref19 ) {
var codemirror = _ref19 . codemirror ,
button = _ref19 . button ,
textarea = _ref19 . textarea ,
ui = _ref19 . ui ;
if ( textarea . data ( 'grav-editor-mode' ) === 'editor' ) {
button . addClass ( 'editor-active' ) ;
}
button . on ( 'click.states.editor' , function ( ) {
button . siblings ( ) . removeClass ( 'editor-active' ) ;
button . addClass ( 'editor-active' ) ;
textarea . data ( 'grav-editor-mode' , 'editor' ) ;
var previewContainer = textarea . data ( 'grav-editor-preview-container' ) ;
var content = textarea . parent ( '.grav-editor-content' ) ;
content . addClass ( 'is-active' ) ;
ui . navigation . find ( '.grav-editor-actions' ) . css ( 'visibility' , 'visible' ) ;
if ( previewContainer ) {
previewContainer . removeClass ( 'is-active' ) ;
}
} ) ;
2025-10-16 23:16:16 -06:00
}
}
2025-10-16 13:49:53 -06:00
} , {
2025-10-18 13:48:40 -06:00
preview : {
identifier : 'preview' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . PREVIEW ,
label : '<i class="fa fa-fw fa-eye"></i>' ,
modes : [ 'gfm' , 'markdown' ] ,
action : function action ( _ref20 ) {
var codemirror = _ref20 . codemirror ,
button = _ref20 . button ,
textarea = _ref20 . textarea ,
ui = _ref20 . ui ;
if ( textarea . data ( 'grav-editor-mode' ) === 'preview' ) {
button . addClass ( 'editor-active' ) ;
}
button . on ( 'click.states.preview' , function ( ) {
var previewContainer = textarea . data ( 'grav-editor-preview-container' ) ;
var content = textarea . parent ( '.grav-editor-content' ) ;
button . siblings ( ) . removeClass ( 'editor-active' ) ;
button . addClass ( 'editor-active' ) ;
textarea . data ( 'grav-editor-mode' , 'preview' ) ;
if ( ! previewContainer ) {
previewContainer = external _jQuery _default ( ) ( '<div class="grav-editor-preview" />' ) ;
content . after ( previewContainer ) ;
textarea . data ( 'grav-editor-preview-container' , previewContainer ) ;
}
previewContainer . css ( {
height : content . height ( )
} ) ;
previewContainer . addClass ( 'is-active' ) ;
content . removeClass ( 'is-active' ) ;
ui . navigation . find ( '.grav-editor-actions' ) . css ( 'visibility' , 'hidden' ) ;
var url = "" . concat ( textarea . data ( 'grav-urlpreview' ) , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "processmarkdown" ) ;
var params = textarea . closest ( 'form' ) . serializeArray ( ) ;
var body = { } ;
params . map ( function ( obj ) {
body [ obj . name ] = obj . value ;
} ) ;
utils _request ( url , {
method : 'post' ,
body : body
} , function ( response ) {
return previewContainer . html ( response . preview ) ;
} ) ;
} ) ;
2025-10-16 13:49:53 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
fullscreen : {
identifier : 'fullscreen' ,
title : external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FULLSCREEN ,
label : '<i class="fa fa-fw fa-expand"></i>' ,
action : function action ( _ref21 ) {
var codemirror = _ref21 . codemirror ,
button = _ref21 . button ,
textarea = _ref21 . textarea ;
button . on ( 'click.editor.fullscreen' , function ( ) {
var container = textarea . closest ( '.grav-editor' ) ;
var wrapper = codemirror . getWrapperElement ( ) ;
var contentWrapper = external _jQuery _default ( ) ( '.content-wrapper' ) ;
if ( ! container . hasClass ( 'grav-editor-fullscreen' ) ) {
textarea . data ( 'fullScreenRestore' , {
scrollTop : _ _webpack _require _ _ . g . pageYOffset ,
scrollLeft : _ _webpack _require _ _ . g . pageXOffset ,
width : wrapper . style . width ,
height : wrapper . style . height
} ) ;
wrapper . style . width = '' ;
wrapper . style . height = textarea . parent ( '.grav-editor-content' ) . height ( ) + 'px' ;
_ _webpack _require _ _ . g . document . documentElement . style . overflow = 'hidden' ;
var hints = container . find ( '.grav-editor-toolbar .hint--top' ) ;
if ( hints ) {
hints . removeClass ( 'hint--top' ) . addClass ( 'hint--bottom' ) ;
external _jQuery _default ( ) ( hints [ hints . length - 1 ] ) . addClass ( 'hint--bottom-left' ) ;
}
if ( contentWrapper ) {
contentWrapper . css ( 'overflow' , 'visible' ) ;
}
} else {
_ _webpack _require _ _ . g . document . documentElement . style . overflow = '' ;
var state = textarea . data ( 'fullScreenRestore' ) ;
wrapper . style . width = state . width ;
wrapper . style . height = state . height ;
_ _webpack _require _ _ . g . scrollTo ( state . scrollLeft , state . scrollTop ) ;
var _hints = container . find ( '.grav-editor-toolbar .hint--bottom' ) ;
if ( _hints ) {
_hints . removeClass ( 'hint--bottom' ) . addClass ( 'hint--top' ) ;
external _jQuery _default ( ) ( _hints [ _hints . length - 1 ] ) . removeClass ( 'hint--bottom-left' ) ;
}
if ( contentWrapper ) {
contentWrapper . css ( 'overflow' , 'auto' ) ;
}
}
container . toggleClass ( 'grav-editor-fullscreen' ) ;
setTimeout ( function ( ) {
codemirror . refresh ( ) ;
// this.preview.parent().css('height', this.code.height());
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . trigger ( 'resize' ) ;
} , 5 ) ;
} ) ;
2025-10-16 13:49:53 -06:00
}
}
2025-10-18 13:48:40 -06:00
} ]
} ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.js
var codemirror = _ _webpack _require _ _ ( 15237 ) ;
var codemirror _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( codemirror ) ;
// EXTERNAL MODULE: ./node_modules/watchjs/src/watch.js
var watch = _ _webpack _require _ _ ( 72797 ) ;
// EXTERNAL MODULE: ./node_modules/js-yaml/dist/js-yaml.mjs
var js _yaml = _ _webpack _require _ _ ( 20382 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/css/css.js
var css = _ _webpack _require _ _ ( 68656 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/gfm/gfm.js
var gfm = _ _webpack _require _ _ ( 21764 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/htmlmixed/htmlmixed.js
var htmlmixed = _ _webpack _require _ _ ( 12520 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/javascript/javascript.js
var javascript = _ _webpack _require _ _ ( 16792 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/markdown/markdown.js
var markdown = _ _webpack _require _ _ ( 47216 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/php/php.js
var php = _ _webpack _require _ _ ( 98000 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/sass/sass.js
var sass = _ _webpack _require _ _ ( 17246 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/twig/twig.js
var twig = _ _webpack _require _ _ ( 11956 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/xml/xml.js
var xml = _ _webpack _require _ _ ( 40576 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/mode/yaml/yaml.js
var yaml = _ _webpack _require _ _ ( 20496 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/continuelist.js
var continuelist = _ _webpack _require _ _ ( 97382 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/mode/overlay.js
var overlay = _ _webpack _require _ _ ( 32580 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/selection/active-line.js
var active _line = _ _webpack _require _ _ ( 50436 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/lint.js
var lint = _ _webpack _require _ _ ( 71561 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/lint.css
var lint _lint = _ _webpack _require _ _ ( 3419 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/css-lint.js
var css _lint = _ _webpack _require _ _ ( 9279 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/javascript-lint.js
var javascript _lint = _ _webpack _require _ _ ( 12089 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/json-lint.js
var json _lint = _ _webpack _require _ _ ( 92154 ) ;
// EXTERNAL MODULE: ./node_modules/codemirror/addon/lint/yaml-lint.js
var yaml _lint = _ _webpack _require _ _ ( 23857 ) ;
; // ./app/forms/fields/editor.js
function editor _typeof ( o ) { "@babel/helpers - typeof" ; return editor _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , editor _typeof ( o ) ; }
function editor _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function editor _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , editor _toPropertyKey ( o . key ) , o ) ; } }
function editor _createClass ( e , r , t ) { return r && editor _defineProperties ( e . prototype , r ) , t && editor _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function editor _toPropertyKey ( t ) { var i = editor _toPrimitive ( t , "string" ) ; return "symbol" == editor _typeof ( i ) ? i : i + "" ; }
function editor _toPrimitive ( t , r ) { if ( "object" != editor _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != editor _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
_ _webpack _require _ _ . g . jsyaml = js _yaml /* default */ . Ay ;
// Modes
// Add-ons
var IS _MOUSEDOWN = false ;
var ThemesMap = [ 'paper' ] ;
var Defaults = {
codemirror : {
mode : 'htmlmixed' ,
theme : 'paper' ,
lineWrapping : true ,
dragDrop : true ,
autoCloseTags : true ,
matchTags : true ,
autoCloseBrackets : true ,
matchBrackets : true ,
indentUnit : 4 ,
indentWithTabs : false ,
tabSize : 4 ,
hintOptions : {
completionSingle : false
} ,
extraKeys : {
'Enter' : 'newlineAndIndentContinueMarkdownList'
2025-10-16 13:49:53 -06:00
}
2025-10-18 13:48:40 -06:00
}
} ;
var EditorField = /*#__PURE__*/ function ( ) {
function EditorField ( options ) {
var _this = this ;
editor _classCallCheck ( this , EditorField ) ;
var body = external _jQuery _default ( ) ( 'body' ) ;
this . editors = external _jQuery _default ( ) ( ) ;
this . options = Object . assign ( { } , Defaults , options ) ;
this . buttons = buttons ;
this . buttonStrategies = strategies ;
( 0 , watch . watch ) ( buttons , function /* key, modifier, prev, next */
( ) {
_this . editors . each ( function ( index , editor ) {
return external _jQuery _default ( ) ( editor ) . data ( 'toolbar' ) . renderButtons ( ) ;
2025-10-16 15:47:33 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} ) ;
external _jQuery _default ( ) ( '[data-grav-editor]' ) . each ( function ( index , editor ) {
return _this . addEditor ( editor ) ;
} ) ;
external _jQuery _default ( ) ( function ( ) {
body . trigger ( 'grav-editor-ready' ) ;
} ) ;
body . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
body . on ( 'mouseup._grav' , function ( ) {
if ( ! IS _MOUSEDOWN ) {
return true ;
}
body . unbind ( 'mousemove._grav' ) ;
IS _MOUSEDOWN = false ;
} ) ;
body . on ( 'mousedown._grav' , '.grav-editor-resizer' , function ( event ) {
event && event . preventDefault ( ) ;
IS _MOUSEDOWN = true ;
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var container = target . siblings ( '.grav-editor-content' ) ;
var editor = container . find ( '.CodeMirror' ) ;
var codemirror = container . find ( 'textarea' ) . data ( 'codemirror' ) ;
body . on ( 'mousemove._grav' , function ( event ) {
editor . css ( 'height' , Math . max ( 100 , event . pageY - container . offset ( ) . top ) ) ;
codemirror . refresh ( ) ;
} ) ;
} ) ;
}
return editor _createClass ( EditorField , [ {
key : "addButton" ,
value : function addButton ( button , options ) {
if ( options && ( options . before || options . after ) ) {
var index = this . buttons . navigation . findIndex ( function ( obj ) {
var key = Object . keys ( obj ) . shift ( ) ;
return obj [ key ] . identifier === ( options . before || options . after ) ;
} ) ;
if ( ! ~ index ) {
options = 'end' ;
2025-10-16 15:04:40 -06:00
} else {
2025-10-18 13:48:40 -06:00
this . buttons . navigation . splice ( options . before ? index : index + 1 , 0 , button ) ;
2025-10-16 13:49:53 -06:00
}
2025-10-18 13:48:40 -06:00
}
if ( options === 'start' ) {
this . buttons . navigation . splice ( 0 , 0 , button ) ;
}
if ( ! options || options === 'end' ) {
this . buttons . navigation . push ( button ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "addEditor" ,
value : function addEditor ( textarea ) {
textarea = external _jQuery _default ( ) ( textarea ) ;
var options = Object . assign ( { } , this . options . codemirror , textarea . data ( 'grav-editor' ) . codemirror ) ;
var theme = options . theme || 'paper' ;
this . editors = this . editors . add ( textarea ) ;
if ( theme && ! ~ ThemesMap . indexOf ( theme ) ) {
ThemesMap . push ( theme ) ;
// let themeCSS = `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.12.0/theme/${theme}.min.css`;
// $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', themeCSS));
2025-10-17 14:09:56 -06:00
}
2025-10-18 13:48:40 -06:00
if ( options . mode === 'yaml' ) {
Object . assign ( options . extraKeys , {
Tab : function Tab ( cm ) {
cm . replaceSelection ( ' ' , 'end' ) ;
2025-10-16 18:12:09 -06:00
}
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
var editor = codemirror _default ( ) . fromTextArea ( textarea . get ( 0 ) , options ) ;
textarea . data ( 'codemirror' , editor ) ;
textarea . data ( 'toolbar' , new Toolbar ( textarea ) ) ;
textarea . addClass ( 'code-mirrored' ) ;
if ( options . toolbar === false ) {
textarea . data ( 'toolbar' ) . ui . navigation . addClass ( 'grav-editor-hide-toolbar' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
editor . on ( 'change' , function ( ) {
return editor . save ( ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-17 22:15:39 -06:00
} , {
2025-10-18 13:48:40 -06:00
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this2 = this ;
var editors = external _jQuery _default ( ) ( target ) . find ( '[data-grav-editor]' ) ;
if ( ! editors . length ) {
return ;
}
editors . each ( function ( index , editor ) {
editor = external _jQuery _default ( ) ( editor ) ;
if ( ! ~ _this2 . editors . index ( editor ) ) {
_this2 . addEditor ( editor ) ;
}
} ) ;
2025-10-17 22:15:39 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
var Toolbar = /*#__PURE__*/ function ( ) {
function Toolbar ( editor ) {
editor _classCallCheck ( this , Toolbar ) ;
this . editor = external _jQuery _default ( ) ( editor ) ;
this . codemirror = this . editor . data ( 'codemirror' ) ;
this . buttons = buttons . navigation ;
this . ui = {
navigation : external _jQuery _default ( ) ( Toolbar . templates ( ) . navigation )
} ;
this . editor . parent ( '.grav-editor-content' ) . before ( this . ui . navigation ) . after ( this . ui . states ) ;
this . renderButtons ( ) ;
}
return editor _createClass ( Toolbar , [ {
key : "renderButtons" ,
value : function renderButtons ( ) {
var _this3 = this ;
var map = {
'actions' : 'navigation' ,
'modes' : 'states'
} ;
[ 'actions' , 'modes' ] . forEach ( function ( type ) {
_this3 . ui . navigation . find ( ".grav-editor-" . concat ( type ) ) . empty ( ) . append ( '<ul />' ) ;
buttons [ map [ type ] ] . forEach ( function ( button ) {
return _this3 . renderButton ( button , type ) ;
} ) ;
} ) ;
2025-10-17 15:07:46 -06:00
}
2025-10-17 14:09:56 -06:00
} , {
2025-10-18 13:48:40 -06:00
key : "renderButton" ,
value : function renderButton ( button , type ) {
var _this4 = this ;
var location = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : null ;
Object . keys ( button ) . forEach ( function ( key ) {
var obj = button [ key ] ;
if ( ! obj . modes ) {
obj . modes = [ ] ;
}
if ( ! ~ _this4 . codemirror . options . ignore . indexOf ( key ) && ( ! obj . modes . length || obj . modes . indexOf ( _this4 . codemirror . options . mode ) > - 1 ) ) {
var hint = obj . title ? "data-hint=\"" . concat ( obj . title , "\"" ) : '' ;
var element = external _jQuery _default ( ) ( "<li class=\"grav-editor-button-" . concat ( key , "\"><a class=\"hint--top\" " ) . concat ( hint , ">" ) . concat ( obj . label , "</a></li>" ) ) ;
( location || _this4 . ui . navigation . find ( ".grav-editor-" . concat ( type , " ul:not(.dropdown-menu)" ) ) ) . append ( element ) ;
if ( obj . shortcut ) {
_this4 . addShortcut ( obj . identifier , obj . shortcut , element ) ;
}
obj . action && obj . action . call ( obj . action , {
codemirror : _this4 . codemirror ,
button : element ,
textarea : _this4 . editor ,
ui : _this4 . ui
} ) ;
if ( obj . children ) {
var childrenContainer = external _jQuery _default ( ) ( '<ul class="dropdown-menu" />' ) ;
element . addClass ( 'button-group' ) . find ( 'a' ) . wrap ( '<div class="dropdown-toggle" data-toggle="dropdown"></div>' ) ;
element . find ( 'a' ) . append ( ' <i class="fa fa-caret-down"></i>' ) ;
element . append ( childrenContainer ) ;
obj . children . forEach ( function ( child ) {
return _this4 . renderButton ( child , type , childrenContainer ) ;
} ) ;
}
}
} ) ;
}
} , {
key : "addShortcut" ,
value : function addShortcut ( identifier , shortcut , element ) {
var _this5 = this ;
var map = { } ;
if ( ! Array . isArray ( shortcut ) ) {
shortcut = [ shortcut ] ;
2025-10-17 14:09:56 -06:00
}
2025-10-18 13:48:40 -06:00
shortcut . forEach ( function ( key ) {
map [ key ] = function ( ) {
element . trigger ( "click.editor." . concat ( identifier ) , [ _this5 . codemirror ] ) ;
} ;
} ) ;
this . codemirror . addKeyMap ( map ) ;
}
} ] , [ {
key : "templates" ,
value : function templates ( ) {
return {
navigation : "\n <div class=\"grav-editor-toolbar\">\n <div class=\"grav-editor-actions\"></div>\n <div class=\"grav-editor-modes\"></div>\n </div>\n "
} ;
2025-10-17 14:09:56 -06:00
}
2025-10-16 10:59:50 -06:00
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var editor _Instance = new EditorField ( ) ;
; // ./app/pages/page/media.js
function media _typeof ( o ) { "@babel/helpers - typeof" ; return media _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , media _typeof ( o ) ; }
function media _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function media _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , media _toPropertyKey ( o . key ) , o ) ; } }
function media _createClass ( e , r , t ) { return r && media _defineProperties ( e . prototype , r ) , t && media _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function media _toPropertyKey ( t ) { var i = media _toPrimitive ( t , "string" ) ; return "symbol" == media _typeof ( i ) ? i : i + "" ; }
function media _toPrimitive ( t , r ) { if ( "object" != media _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != media _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
function media _callSuper ( t , o , e ) { return o = media _getPrototypeOf ( o ) , media _possibleConstructorReturn ( t , media _isNativeReflectConstruct ( ) ? Reflect . construct ( o , e || [ ] , media _getPrototypeOf ( t ) . constructor ) : o . apply ( t , e ) ) ; }
function media _possibleConstructorReturn ( t , e ) { if ( e && ( "object" == media _typeof ( e ) || "function" == typeof e ) ) return e ; if ( void 0 !== e ) throw new TypeError ( "Derived constructors may only return object or undefined" ) ; return media _assertThisInitialized ( t ) ; }
function media _assertThisInitialized ( e ) { if ( void 0 === e ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; return e ; }
function media _isNativeReflectConstruct ( ) { try { var t = ! Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ; } catch ( t ) { } return ( media _isNativeReflectConstruct = function _isNativeReflectConstruct ( ) { return ! ! t ; } ) ( ) ; }
function media _superPropGet ( t , o , e , r ) { var p = media _get ( media _getPrototypeOf ( 1 & r ? t . prototype : t ) , o , e ) ; return 2 & r && "function" == typeof p ? function ( t ) { return p . apply ( e , t ) ; } : p ; }
function media _get ( ) { return media _get = "undefined" != typeof Reflect && Reflect . get ? Reflect . get . bind ( ) : function ( e , t , r ) { var p = media _superPropBase ( e , t ) ; if ( p ) { var n = Object . getOwnPropertyDescriptor ( p , t ) ; return n . get ? n . get . call ( arguments . length < 3 ? e : r ) : n . value ; } } , media _get . apply ( null , arguments ) ; }
function media _superPropBase ( t , o ) { for ( ; ! { } . hasOwnProperty . call ( t , o ) && null !== ( t = media _getPrototypeOf ( t ) ) ; ) ; return t ; }
function media _getPrototypeOf ( t ) { return media _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf . bind ( ) : function ( t ) { return t . _ _proto _ _ || Object . getPrototypeOf ( t ) ; } , media _getPrototypeOf ( t ) ; }
function media _inherits ( t , e ) { if ( "function" != typeof e && null !== e ) throw new TypeError ( "Super expression must either be null or a function" ) ; t . prototype = Object . create ( e && e . prototype , { constructor : { value : t , writable : ! 0 , configurable : ! 0 } } ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , e && media _setPrototypeOf ( t , e ) ; }
function media _setPrototypeOf ( t , e ) { return media _setPrototypeOf = Object . setPrototypeOf ? Object . setPrototypeOf . bind ( ) : function ( t , e ) { return t . _ _proto _ _ = e , t ; } , media _setPrototypeOf ( t , e ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var previewTemplate = "\n <div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>\u2714</span></div>\n <div class=\"dz-error-mark\"><span>\u2718</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <a class=\"dz-remove\" title=\"" . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DELETE , "\" href=\"javascript:undefined;\" data-dz-remove>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . DELETE , "</a>\n <a class=\"dz-metadata\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . METADATA , "\" href=\"#\" target=\"_blank\" data-dz-metadata>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . METADATA , "</a>\n <a class=\"dz-view\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . VIEW , "\" href=\"#\" target=\"_blank\" data-dz-view>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . VIEW , "</a>\n <a class=\"dz-insert\" title=\"" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . INSERT , "\" href=\"javascript:undefined;\" data-dz-insert>" ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . INSERT , "</a>\n </div>" ) . trim ( ) ;
var PageMedia = /*#__PURE__*/ function ( _FilesField ) {
function PageMedia ( ) {
var _this ;
var _ref = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ,
_ref$container = _ref . container ,
container = _ref$container === void 0 ? '#grav-dropzone' : _ref$container ,
_ref$options = _ref . options ,
options = _ref$options === void 0 ? { } : _ref$options ;
media _classCallCheck ( this , PageMedia ) ;
options = Object . assign ( options , {
previewTemplate : previewTemplate
} ) ;
_this = media _callSuper ( this , PageMedia , [ {
container : container ,
options : options
} ] ) ;
if ( ! _this . container . length ) {
return media _possibleConstructorReturn ( _this ) ;
}
_this . urls = {
fetch : "" . concat ( _this . container . data ( 'media-url' ) , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "listmedia" ) ,
add : "" . concat ( _this . container . data ( 'media-url' ) , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "addmedia" ) ,
"delete" : "" . concat ( _this . container . data ( 'media-url' ) , "/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "delmedia" )
} ;
_this . dropzone . options . url = _this . urls . add ;
if ( typeof _this . options . fetchMedia === 'undefined' || _this . options . fetchMedia ) {
_this . fetchMedia ( ) ;
}
if ( typeof _this . options . attachDragDrop === 'undefined' || _this . options . attachDragDrop ) {
_this . attachDragDrop ( ) ;
}
var field = external _jQuery _default ( ) ( "[name=\"" . concat ( _this . container . data ( 'dropzone-field' ) , "\"]" ) ) ;
if ( field . length ) {
_this . sortable = new sortable _esm /* default */ . Ay ( _this . container . get ( 0 ) , {
animation : 150 ,
// forceFallback: true,
setData : function setData ( dataTransfer , target ) {
target = external _jQuery _default ( ) ( target ) ;
var uri = encodeURI ( target . find ( '.dz-filename' ) . text ( ) ) ;
var shortcode = UriToMarkdown ( uri ) ;
_this . dropzone . disable ( ) ;
target . addClass ( 'hide-backface' ) ;
dataTransfer . effectAllowed = 'copy' ;
dataTransfer . setData ( 'text' , shortcode ) ;
} ,
onSort : function onSort ( ) {
var names = [ ] ;
_this . container . find ( '[data-dz-name]' ) . each ( function ( index , file ) {
file = external _jQuery _default ( ) ( file ) ;
var name = file . text ( ) . trim ( ) ;
names . push ( name ) ;
} ) ;
field . val ( names . join ( ',' ) ) ;
}
} ) ;
}
return _this ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
media _inherits ( PageMedia , _FilesField ) ;
return media _createClass ( PageMedia , [ {
key : "fetchMedia" ,
value : function fetchMedia ( ) {
var _this2 = this ;
var order = this . container . closest ( '.form-field' ) . find ( '[name="data[header][media_order]"]' ) . val ( ) ;
var body = {
uri : this . getURI ( ) ,
order : order
} ;
var url = this . urls . fetch ;
utils _request ( url , {
method : 'post' ,
body : body
} , function ( response ) {
var results = response . results ;
Object . keys ( results ) . forEach ( function ( name ) {
var data = results [ name ] ;
var mock = {
name : name ,
size : data . size ,
accepted : true ,
extras : data
} ;
_this2 . dropzone . files . push ( mock ) ;
_this2 . dropzone . options . addedfile . call ( _this2 . dropzone , mock ) ;
_this2 . dropzone . options . thumbnail . call ( _this2 . dropzone , mock , data . url ) ;
} ) ;
_this2 . updateThumbsSize ( ) ;
_this2 . container . find ( '.dz-preview' ) . prop ( 'draggable' , 'true' ) ;
} ) ;
}
} , {
key : "onDropzoneSending" ,
value : function onDropzoneSending ( file , xhr , formData ) {
/ *
// Cannot call super because Safari and IE API don't implement `delete`
super . onDropzoneSending ( file , xhr , formData ) ;
formData . delete ( 'task' ) ;
* /
formData . append ( 'name' , this . options . dotNotation || file . name ) ;
formData . append ( 'admin-nonce' , external _GravAdmin _namespaceObject . config . admin _nonce ) ;
formData . append ( 'uri' , this . getURI ( ) ) ;
}
} , {
key : "onDropzoneComplete" ,
value : function onDropzoneComplete ( file ) {
media _superPropGet ( PageMedia , "onDropzoneComplete" , this , 3 ) ( [ file ] ) ;
if ( this . sortable ) {
this . sortable . options . onSort ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// accepted
this . updateThumbsSize ( ) ;
this . updateMediaCount ( ) ;
external _jQuery _default ( ) ( '.dz-preview' ) . prop ( 'draggable' , 'true' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "onDropzoneAddedFile" ,
value : function onDropzoneAddedFile ( file ) {
for ( var _len = arguments . length , extra = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
extra [ _key - 1 ] = arguments [ _key ] ;
}
media _superPropGet ( PageMedia , "onDropzoneAddedFile" , this , 3 ) ( [ file , extra ] ) ;
this . updateThumbsSize ( ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "onDropzoneRemovedFile" ,
value : function onDropzoneRemovedFile ( file ) {
for ( var _len2 = arguments . length , extra = new Array ( _len2 > 1 ? _len2 - 1 : 0 ) , _key2 = 1 ; _key2 < _len2 ; _key2 ++ ) {
extra [ _key2 - 1 ] = arguments [ _key2 ] ;
}
media _superPropGet ( PageMedia , "onDropzoneRemovedFile" , this , 3 ) ( [ file ] . concat ( extra ) ) ;
this . updateMediaCount ( ) ;
if ( this . sortable ) {
this . sortable . options . onSort ( ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "updateThumbsSize" ,
value : function updateThumbsSize ( ) {
var status = JSON . parse ( cookies . get ( 'grav-admin-pagemedia' ) || '{}' ) ;
if ( status . width ) {
var input = this . container . closest ( '.pagemedia-field' ) . find ( '.media-resizer' ) ;
updateMediaSizes ( input [ 0 ] , status . width , false ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "updateMediaCount" ,
value : function updateMediaCount ( ) {
var element = this . container . closest ( '.pagemedia-field' ) . find ( '[data-pagemedia-count]' ) ;
element . text ( "(" . concat ( this . dropzone . files . length , ")" ) ) ;
}
} , {
key : "attachDragDrop" ,
value : function attachDragDrop ( ) {
var _this3 = this ;
this . container . delegate ( '[data-dz-insert]' , 'click' , function ( e ) {
var target = external _jQuery _default ( ) ( e . currentTarget ) . parent ( '.dz-preview' ) . find ( '.dz-filename' ) ;
var editor = editor _Instance . editors . filter ( function ( index , editor ) {
return external _jQuery _default ( ) ( editor ) . attr ( 'name' ) === 'data[content]' ;
} ) ;
if ( editor . length ) {
editor = editor . data ( 'codemirror' ) ;
editor . focus ( ) ;
var filename = encodeURI ( target . text ( ) ) ;
var shortcode = UriToMarkdown ( filename ) ;
editor . doc . replaceSelection ( shortcode ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
this . container . delegate ( '[data-dz-view]' , 'mouseenter' , function ( e ) {
var target = external _jQuery _default ( ) ( e . currentTarget ) ;
var file = target . parent ( '.dz-preview' ) . find ( '.dz-filename' ) ;
var filename = encodeURI ( file . text ( ) ) ;
var URL = target . closest ( '[data-media-path]' ) . data ( 'media-path' ) ;
var original = _this3 . dropzone . files . filter ( function ( file ) {
return encodeURI ( file . name ) === filename ;
} ) . shift ( ) ;
original = original && ( original . extras && original . extras . original || encodeURI ( original . name ) ) ;
target . attr ( 'href' , "" . concat ( URL , "/" ) . concat ( original ) ) ;
} ) ;
this . container . delegate ( '[data-dz-metadata]' , 'click' , function ( e ) {
e . preventDefault ( ) ;
var target = external _jQuery _default ( ) ( e . currentTarget ) ;
var file = target . parent ( '.dz-preview' ) . find ( '.dz-filename' ) ;
var filename = encodeURI ( file . text ( ) ) ;
var cleanName = file . text ( ) . replace ( '<' , '<' ) . replace ( '>' , '>' ) ;
var fileObj = _this3 . dropzone . files . filter ( function ( file ) {
return file . name === _ _webpack _require _ _ . g . decodeURI ( filename ) ;
} ) . shift ( ) || { } ;
if ( ! fileObj . extras ) {
fileObj . extras = {
metadata : [ ]
} ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( Array . isArray ( fileObj . extras . metadata ) && ! fileObj . extras . metadata . length ) {
fileObj . extras . metadata = {
'' : "" . concat ( cleanName , ".meta.yaml doesn't exist" )
} ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
fileObj = fileObj . extras ;
var modal _element = external _jQuery _default ( ) ( 'body' ) . find ( '[data-remodal-id="metadata"]' ) ;
var modal = ( external _jQuery _default ( ) ) . remodal . lookup [ modal _element . data ( 'remodal' ) ] ;
modal _element . find ( 'h1 strong' ) . html ( cleanName ) ;
if ( fileObj . url ) {
modal _element . find ( '.meta-preview' ) . html ( "<img src=\"" . concat ( fileObj . url , "\" />" ) ) ;
}
var container = modal _element . find ( '.meta-content' ) . html ( '<ul />' ) . find ( 'ul' ) ;
Object . keys ( fileObj . metadata ) . forEach ( function ( meta ) {
var cleanMeta = fileObj . metadata [ meta ] . replace ( '<' , '<' ) . replace ( '>' , '>' ) ;
container . append ( "<li><strong>" . concat ( meta ? meta + ':' : '' , "</strong> " ) . concat ( cleanMeta , "</li>" ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
modal . open ( ) ;
} ) ;
this . container . delegate ( '.dz-preview' , 'dragstart' , function ( e ) {
var target = external _jQuery _default ( ) ( e . currentTarget ) ;
var uri = encodeURI ( target . find ( '.dz-filename' ) . text ( ) ) ;
var shortcode = UriToMarkdown ( uri ) ;
_this3 . dropzone . disable ( ) ;
target . addClass ( 'hide-backface' ) ;
e . originalEvent . dataTransfer . effectAllowed = 'copy' ;
e . originalEvent . dataTransfer . setData ( 'text' , shortcode ) ;
} ) ;
this . container . delegate ( '.dz-preview' , 'dragend' , function ( e ) {
var target = external _jQuery _default ( ) ( e . currentTarget ) ;
_this3 . dropzone . enable ( ) ;
target . removeClass ( 'hide-backface' ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} ] ) ;
2025-10-18 13:48:40 -06:00
} ( FilesField ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var updateMediaSizes = function updateMediaSizes ( input , width ) {
var store = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : true ;
var storageLocation = input . dataset . storageLocation || 'grav-admin-pagemedia' ;
var status = JSON . parse ( cookies . get ( storageLocation ) || '{}' ) ;
var height = 150 * width / 200 ;
var media = external _jQuery _default ( ) ( input ) . closest ( '.pagemedia-field' ) . find ( '.dz-details, [data-dz-thumbnail]' ) ;
media . css ( {
width : width ,
height : height
} ) ;
if ( store ) {
var data = Object . assign ( { } , status , {
width : width
} ) ;
cookies . set ( storageLocation , JSON . stringify ( data ) , {
expires : Infinity
} ) ;
}
} ;
var updateMediaCollapseStatus = function updateMediaCollapseStatus ( element ) {
var store = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : true ;
var storageLocation = element . dataset . storageLocation || 'grav-admin-pagemedia' ;
var status = JSON . parse ( cookies . get ( storageLocation ) || '{}' ) ;
element = external _jQuery _default ( ) ( element ) ;
var icon = element . find ( 'i.fa' ) ;
var container = element . closest ( '.pagemedia-field' ) ;
var panel = container . find ( '.form-data' ) ;
var slider = container . find ( '.media-resizer' ) . parent ( ) ;
var isCollapsed = ! icon . hasClass ( 'fa-chevron-down' ) ;
var collapsed = ! isCollapsed ;
icon . removeClass ( 'fa-chevron-down fa-chevron-right' ) . addClass ( isCollapsed ? 'fa-chevron-down' : 'fa-chevron-right' ) ;
slider [ isCollapsed ? 'removeClass' : 'addClass' ] ( 'hidden' ) ;
panel [ isCollapsed ? 'slideDown' : 'slideUp' ] ( ) ;
if ( store ) {
var data = Object . assign ( { } , status , {
collapsed : collapsed
} ) ;
cookies . set ( storageLocation , JSON . stringify ( data ) , {
expires : Infinity
} ) ;
}
} ;
external _jQuery _default ( ) ( document ) . on ( 'input' , '.media-resizer' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var width = target . val ( ) ;
updateMediaSizes ( event . currentTarget , width ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( document ) . on ( 'click' , '.media-collapser' , function ( event ) {
updateMediaCollapseStatus ( event . currentTarget ) ;
} ) ;
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
external _jQuery _default ( ) ( '.media-resizer' ) . each ( function ( index , input ) {
var storageLocation = input . dataset . storageLocation || 'grav-admin-pagemedia' ;
var status = JSON . parse ( cookies . get ( storageLocation ) || '{}' ) ;
if ( status . width ) {
updateMediaSizes ( input , status . width , false ) ;
}
} ) ;
} ) ;
var media _Instance = new PageMedia ( ) ;
; // ./app/pages/page/multilang.js
external _jQuery _default ( ) ( '[name="task"][value="saveas"], [name="task"][value="switchlanguage"]' ) . on ( 'mousedown touchstart' , function ( event ) {
var fields = [ 'lang' , 'redirect' ] ;
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
var form = external _jQuery _default ( ) ( "#" . concat ( element . attr ( 'form' ) ) ) ;
if ( ! form . length ) {
return ;
}
fields . forEach ( function ( field ) {
var value = element . attr ( field ) ;
if ( ! value ) {
return ;
}
var input = form . find ( "[name=\"data[" . concat ( field , "]\"]" ) ) ;
if ( ! input . length ) {
input = external _jQuery _default ( ) ( "<input type=\"hidden\" name=\"data[" . concat ( field , "]\" value=\"\" />" ) ) ;
form . append ( input ) ;
}
input . val ( value ) ;
} ) ;
return true ;
} ) ;
; // ./app/pages/page/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var page _switcher = external _jQuery _default ( ) ( 'input[type="radio"][name="mode-switch"]' ) ;
if ( page _switcher ) {
var page _link = page _switcher . closest ( ':checked' ) . data ( 'leave-url' ) ;
var fakeLink = external _jQuery _default ( ) ( "<a href=\"" . concat ( page _link , "\" />" ) ) ;
page _switcher . parent ( ) . append ( fakeLink ) ;
page _switcher . siblings ( 'label' ) . on ( 'mousedown touchdown' , function ( event ) {
event . preventDefault ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// let remodal = $.remodal.lookup[$('[data-remodal-id="changes"]').data('remodal')];
var confirm = external _jQuery _default ( ) ( '[data-remodal-id="changes"] [data-leave-action="continue"]' ) ;
confirm . one ( 'click' , function ( ) {
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . on ( 'beforeunload._grav' ) ;
fakeLink . off ( 'click._grav' ) ;
external _jQuery _default ( ) ( event . target ) . trigger ( 'click' ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
fakeLink . trigger ( 'click._grav' ) ;
} ) ;
page _switcher . on ( 'change' , function ( event ) {
var radio = external _jQuery _default ( ) ( event . target ) ;
page _link = radio . data ( 'leave-url' ) ;
setTimeout ( function ( ) {
return fakeLink . attr ( 'href' , page _link ) . get ( 0 ) . click ( ) ;
} , 5 ) ;
} ) ;
}
/* harmony default export */ const page = ( {
Media : {
PageMedia : PageMedia ,
PageMediaInstances : media _Instance
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
; // ./app/pages/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var pad = function pad ( n , s ) {
return "000" . concat ( n ) . substr ( - s ) ;
} ;
// Pages Ordering
var Ordering = null ;
var orderingElement = external _jQuery _default ( ) ( '#ordering' ) ;
if ( orderingElement . length ) {
Ordering = new sortable _esm /* default */ . Ay ( orderingElement . get ( 0 ) , {
filter : '.ignore' ,
onUpdate : function onUpdate ( ) {
/ * O l d s i n g l e p a g e i n d e x b e h a v i o r
let item = $ ( event . item ) ;
let index = orderingElement . children ( ) . index ( item ) + 1 ;
$ ( '[data-order]' ) . val ( index ) ;
* /
var indexes = [ ] ;
var children = orderingElement . children ( ) ;
var padZero = ( children . length + '' ) . split ( '' ) . length ;
children . each ( function ( index , item ) {
item = external _jQuery _default ( ) ( item ) ;
indexes . push ( item . data ( 'id' ) ) ;
item . find ( '.page-order' ) . text ( "" . concat ( pad ( index + 1 , padZero ) , "." ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( '[data-order]' ) . val ( indexes . join ( ',' ) ) ;
}
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'input' , '[name="data[folder]"]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var activeOrder = external _jQuery _default ( ) ( '[data-id][data-active-id]' ) ;
activeOrder . data ( 'id' , target . val ( ) ) ;
Ordering . options . onUpdate ( ) ;
} ) ;
}
/* harmony default export */ const pages = ( {
Ordering : Ordering ,
Page : page ,
PageFilters : {
PageFilters : PagesFilter ,
Instance : filter _Instance
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
// EXTERNAL MODULE: ./node_modules/immutable/dist/immutable.es.js
var immutable _es = _ _webpack _require _ _ ( 49568 ) ;
// EXTERNAL MODULE: ./node_modules/immutablediff/src/diff.js
var src _diff = _ _webpack _require _ _ ( 57038 ) ;
var diff _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( src _diff ) ;
; // ./app/forms/state.js
function state _typeof ( o ) { "@babel/helpers - typeof" ; return state _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , state _typeof ( o ) ; }
function state _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function state _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , state _toPropertyKey ( o . key ) , o ) ; } }
function state _createClass ( e , r , t ) { return r && state _defineProperties ( e . prototype , r ) , t && state _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function state _toPropertyKey ( t ) { var i = state _toPrimitive ( t , "string" ) ; return "symbol" == state _typeof ( i ) ? i : i + "" ; }
function state _toPrimitive ( t , r ) { if ( "object" != state _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != state _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var FormLoadState = { } ;
var DOMBehaviors = {
attach : function attach ( ) {
this . preventUnload ( ) ;
this . preventClickAway ( ) ;
} ,
preventUnload : function preventUnload ( ) {
var selector = '[name="task"][value^="save"], [data-delete-action], [data-flex-safe-action]' ;
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
// or check with jQuery's internal data store for jQuery >= 3.0
try {
var hasData = typeof ( external _jQuery _default ( ) ) . _data === 'function' ;
if ( hasData && external _jQuery _default ( ) . _data ( window , 'events' ) && ( external _jQuery _default ( ) . _data ( window , 'events' ) . beforeunload || [ ] ) . filter ( function ( event ) {
return event . namespace === '_grav' ;
} ) . length ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
} catch ( e ) {
// $._data not available in jQuery 3.x+, continue with adding event handler
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// Allow some elements to leave the page without native confirmation
external _jQuery _default ( ) ( selector ) . on ( 'click._grav' , function ( event ) {
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . off ( 'beforeunload' ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Catch browser uri change / refresh attempt and stop it if the form state is dirty
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . on ( 'beforeunload._grav' , function ( ) {
if ( state _Instance . equals ( ) === false ) {
return 'You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will lose your unsaved changes.' ;
}
} ) ;
} ,
preventClickAway : function preventClickAway ( ) {
var selector = 'a[href]:not([href^="#"]):not([target="_blank"]):not([href^="javascript:"])' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
try {
var hasData = typeof ( external _jQuery _default ( ) ) . _data === 'function' ;
var element = external _jQuery _default ( ) ( selector ) . get ( 0 ) ;
if ( element && hasData && external _jQuery _default ( ) . _data ( element , 'events' ) && ( external _jQuery _default ( ) . _data ( element , 'events' ) . click || [ ] ) . filter ( function ( event ) {
return event . namespace === '_grav' ;
} ) ) {
return ;
}
} catch ( e ) {
// $._data not available in jQuery 3.x+, continue with adding event handler
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Prevent clicking away if the form state is dirty
// instead, display a confirmation before continuing
external _jQuery _default ( ) ( selector ) . on ( 'click._grav' , function ( event ) {
var isClean = state _Instance . equals ( ) ;
if ( isClean === null || isClean ) {
return true ;
}
event . preventDefault ( ) ;
var destination = external _jQuery _default ( ) ( this ) . attr ( 'href' ) ;
var modal = external _jQuery _default ( ) ( '[data-remodal-id="changes"]' ) ;
var lookup = ( external _jQuery _default ( ) ) . remodal . lookup [ modal . data ( 'remodal' ) ] ;
var buttons = external _jQuery _default ( ) ( 'a.button' , modal ) ;
var _handler = function handler ( event ) {
event . preventDefault ( ) ;
var action = external _jQuery _default ( ) ( this ) . data ( 'leave-action' ) ;
buttons . off ( 'click' , _handler ) ;
lookup . close ( ) ;
if ( action === 'continue' ) {
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . off ( 'beforeunload' ) ;
_ _webpack _require _ _ . g . location . href = destination ;
}
} ;
buttons . on ( 'click' , _handler ) ;
lookup . open ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
var FormState = /*#__PURE__*/ function ( ) {
function FormState ( ) {
var options = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : {
ignore : [ ] ,
form _id : 'blueprints'
} ;
state _classCallCheck ( this , FormState ) ;
this . options = options ;
this . refresh ( ) ;
if ( ! this . form || ! this . fields . length ) {
return ;
}
FormLoadState = this . collect ( ) ;
this . loadState = FormLoadState ;
DOMBehaviors . attach ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return state _createClass ( FormState , [ {
key : "refresh" ,
value : function refresh ( ) {
this . form = external _jQuery _default ( ) ( "form#" . concat ( this . options . form _id ) ) . filter ( ':noparents(.remodal)' ) ;
this . fields = external _jQuery _default ( ) ( "form#" . concat ( this . options . form _id , " *, [form=\"" ) . concat ( this . options . form _id , "\"]" ) ) . filter ( ':input:not(.no-form)' ) . filter ( ':noparents(.remodal)' ) ;
return this ;
}
} , {
key : "collect" ,
value : function collect ( ) {
var _this = this ;
if ( ! this . form || ! this . fields . length ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var values = { } ;
this . refresh ( ) . fields . each ( function ( index , field ) {
field = external _jQuery _default ( ) ( field ) ;
var name = field . prop ( 'name' ) ;
var type = field . prop ( 'type' ) ;
var tag = field . prop ( 'tagName' ) . toLowerCase ( ) ;
var value ;
if ( name . startsWith ( 'toggleable_' ) || name === 'data[lang]' || name === 'data[redirect]' ) {
return ;
}
switch ( type ) {
case 'checkbox' :
value = field . is ( ':checked' ) ;
break ;
case 'radio' :
if ( ! field . is ( ':checked' ) ) {
return ;
}
value = field . val ( ) ;
break ;
default :
value = field . val ( ) ;
}
if ( tag === 'select' && value === null ) {
value = '' ;
}
if ( Array . isArray ( value ) ) {
value = value . join ( '|' ) ;
}
if ( name && ! ~ _this . options . ignore . indexOf ( name ) ) {
values [ name ] = value ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
return immutable _es /* default.OrderedMap */ . Ay . OrderedMap ( values ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "diff" ,
value : function diff ( ) {
return diff _default ( ) ( FormLoadState , this . collect ( ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// When the form doesn't exist or there are no fields, `equals` returns `null`
// for this reason, _NEVER_ check with !Instance.equals(), use Instance.equals() === false
2025-10-16 10:59:50 -06:00
} , {
2025-10-18 13:48:40 -06:00
key : "equals" ,
value : function equals ( ) {
if ( ! this . form || ! this . fields . length ) {
return null ;
}
return immutable _es /* default.is */ . Ay . is ( FormLoadState , this . collect ( ) ) ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
;
var state _Instance = new FormState ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
; // ./app/forms/form.js
function form _typeof ( o ) { "@babel/helpers - typeof" ; return form _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , form _typeof ( o ) ; }
function form _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function form _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , form _toPropertyKey ( o . key ) , o ) ; } }
function form _createClass ( e , r , t ) { return r && form _defineProperties ( e . prototype , r ) , t && form _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function form _toPropertyKey ( t ) { var i = form _toPrimitive ( t , "string" ) ; return "symbol" == form _typeof ( i ) ? i : i + "" ; }
function form _toPrimitive ( t , r ) { if ( "object" != form _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != form _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * D e p e n d e n c i e s f o r c h e c k i n g i f c h a n g e s h a p p e n e d s i n c e l o a d o n a f o r m
import toastr from '../utils/toastr' ;
import { translations } from 'grav-config' ;
import { Instance as FormState } from './state' ;
* /
var Form = /*#__PURE__*/ function ( ) {
function Form ( form ) {
var _this = this ;
form _classCallCheck ( this , Form ) ;
this . form = external _jQuery _default ( ) ( form ) ;
if ( ! this . form . length || this . form . prop ( 'tagName' ) . toLowerCase ( ) !== 'form' ) {
return ;
}
/ * O p t i o n f o r n o t s a v i n g w h i l e n o t h i n g i n a f o r m h a s c h a n g e d
this . form . on ( 'submit' , ( event ) => {
if ( FormState . equals ( ) ) {
event . preventDefault ( ) ;
toastr . info ( translations . PLUGIN _ADMIN . NOTHING _TO _SAVE ) ;
}
} ) ; * /
this . _attachShortcuts ( ) ;
this . _attachToggleables ( ) ;
this . _attachDisabledFields ( ) ;
this . _submitUncheckedFields ( ) ;
this . observer = new MutationObserver ( this . addedNodes ) ;
this . form . each ( function ( index , form ) {
return _this . observer . observe ( form , {
subtree : true ,
childList : true
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
return form _createClass ( Form , [ {
key : "_attachShortcuts" ,
value : function _attachShortcuts ( ) {
// CTRL + S / CMD + S - shortcut for [Save] when available
var saveTask = external _jQuery _default ( ) ( '#titlebar [name="task"][value="save"][form="blueprints"]' ) ;
if ( saveTask . length ) {
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . on ( 'keydown' , function ( event ) {
var key = String . fromCharCode ( event . which ) . toLowerCase ( ) ;
if ( ! event . shiftKey && ( event . ctrlKey && ! event . altKey || event . metaKey ) && key === 's' ) {
event . preventDefault ( ) ;
saveTask . click ( ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "_attachToggleables" ,
value : function _attachToggleables ( ) {
var query = '[data-grav-field="toggleable"] input[type="checkbox"]' ;
this . form . on ( 'change' , query , function ( event ) {
var toggle = external _jQuery _default ( ) ( event . target ) ;
var enabled = toggle . is ( ':checked' ) ;
var parent = toggle . closest ( '.form-field' ) ;
var label = parent . find ( 'label.toggleable' ) ;
var fields = parent . find ( '.form-data' ) ;
var inputs = fields . find ( 'input, select, textarea, button' ) ;
label . add ( fields ) . css ( 'opacity' , enabled ? '' : 0.7 ) ;
inputs . map ( function ( index , input ) {
var isSelectize = input . selectize ;
input = external _jQuery _default ( ) ( input ) ;
if ( isSelectize ) {
isSelectize [ enabled ? 'enable' : 'disable' ] ( ) ;
} else {
input . prop ( 'disabled' , ! enabled ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
this . form . find ( query ) . trigger ( 'change' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "_attachDisabledFields" ,
value : function _attachDisabledFields ( ) {
var prefix = '.form-field-toggleable .form-data' ;
var query = [ ] ;
[ 'input' , 'select' , 'label[for]' , 'textarea' , '.selectize-control' ] . forEach ( function ( item ) {
query . push ( "" . concat ( prefix , " " ) . concat ( item ) ) ;
} ) ;
this . form . on ( 'mousedown' , query . join ( ', ' ) , function ( event ) {
var input = external _jQuery _default ( ) ( event . target ) ;
var isFor = input . prop ( 'for' ) ;
var isSelectize = ( input . hasClass ( 'selectize-control' ) || input . parents ( '.selectize-control' ) ) . length ;
if ( isFor ) {
input = external _jQuery _default ( ) ( "[id=\"" . concat ( isFor , "\"]" ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( isSelectize ) {
input = input . closest ( '.selectize-control' ) . siblings ( 'select[name]' ) ;
}
if ( ! input . prop ( 'disabled' ) ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var toggle = input . closest ( '.form-field' ) . find ( '[data-grav-field="toggleable"] input[type="checkbox"]' ) ;
toggle . trigger ( 'click' ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "_submitUncheckedFields" ,
value : function _submitUncheckedFields ( ) {
var submitted = false ;
this . form . each ( function ( index , form ) {
form = external _jQuery _default ( ) ( form ) ;
form . on ( 'submit' , function ( ) {
// workaround for MS Edge, submitting multiple forms at the same time
if ( submitted ) {
return false ;
}
var formId = form . attr ( 'id' ) ;
var unchecked = form . find ( 'input[type="checkbox"]:not(:checked):not(:disabled)' ) ;
var submit = form . find ( '[type="submit"]' ) . add ( "[form=\"" . concat ( formId , "\"][type=\"submit\"]" ) ) ;
if ( ! unchecked . length ) {
return true ;
}
submit . addClass ( 'pointer-events-disabled' ) ;
unchecked . each ( function ( index , element ) {
element = external _jQuery _default ( ) ( element ) ;
var name = element . prop ( 'name' ) ;
var fake = external _jQuery _default ( ) ( "<input type=\"hidden\" name=\"" . concat ( name , "\" value=\"0\" />" ) ) ;
form . append ( fake ) ;
} ) ;
submitted = true ;
return true ;
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "addedNodes" ,
value : function addedNodes ( mutations ) {
var _this2 = this ;
mutations . forEach ( function ( mutation ) {
if ( mutation . type !== 'childList' ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( mutation . addedNodes ) {
external _jQuery _default ( ) ( 'body' ) . trigger ( 'mutation._grav' , mutation . target , mutation , _this2 ) ;
}
if ( mutation . removedNodes ) {
external _jQuery _default ( ) ( 'body' ) . trigger ( 'mutation_removed._grav' , {
target : mutation . target ,
mutation : mutation
} , _this2 ) ;
}
} ) ;
}
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var form _Instance = new Form ( 'form#blueprints' ) ;
; // ./app/forms/fields/filepicker.js
function filepicker _typeof ( o ) { "@babel/helpers - typeof" ; return filepicker _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , filepicker _typeof ( o ) ; }
function filepicker _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function filepicker _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , filepicker _toPropertyKey ( o . key ) , o ) ; } }
function filepicker _createClass ( e , r , t ) { return r && filepicker _defineProperties ( e . prototype , r ) , t && filepicker _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function filepicker _toPropertyKey ( t ) { var i = filepicker _toPrimitive ( t , "string" ) ; return "symbol" == filepicker _typeof ( i ) ? i : i + "" ; }
function filepicker _toPrimitive ( t , r ) { if ( "object" != filepicker _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != filepicker _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// const insertTextAt = (string, index, text) => [string.slice(0, index), text, string.slice(index)].join('');
var FilePickerField = /*#__PURE__*/ function ( ) {
function FilePickerField ( options ) {
2025-10-16 10:59:50 -06:00
var _this = this ;
2025-10-18 13:48:40 -06:00
filepicker _classCallCheck ( this , FilePickerField ) ;
this . items = external _jQuery _default ( ) ( ) ;
this . options = Object . assign ( { } , this . defaults , options ) ;
external _jQuery _default ( ) ( '[data-grav-filepicker]' ) . each ( function ( index , element ) {
return _this . addItem ( element ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return filepicker _createClass ( FilePickerField , [ {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
2025-10-16 10:59:50 -06:00
var _this2 = this ;
2025-10-18 13:48:40 -06:00
var fields = external _jQuery _default ( ) ( target ) . find ( '[data-grav-filepicker]' ) ;
if ( ! fields . length ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
fields . each ( function ( index , field ) {
field = external _jQuery _default ( ) ( field ) ;
if ( ! ~ _this2 . items . index ( field ) ) {
_this2 . addItem ( field ) ;
}
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "addItem" ,
value : function addItem ( element ) {
element = external _jQuery _default ( ) ( element ) ;
this . items = this . items . add ( element ) ;
var tag = element . prop ( 'tagName' ) . toLowerCase ( ) ;
var isInput = tag === 'input' || tag === 'select' ;
var field = isInput ? element : element . find ( 'input, select' ) ;
var folder = '' ;
var thumbs = { } ;
var onDemand = field . closest ( '[data-ondemand]' ) . length > 0 ;
if ( ! field . length || field . get ( 0 ) . selectize ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
var getData = function getData ( field , callback ) {
var mode = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : 'all' ;
var url = external _GravAdmin _namespaceObject . config . current _url + ".json/task" . concat ( external _GravAdmin _namespaceObject . config . param _sep , "getFilesInFolder" ) ;
var parent = field . closest ( '[data-grav-filepicker]' ) ;
var name = parent . data ( 'name' ) ;
var value = parent . data ( 'value' ) ;
var params = JSON . stringify ( external _GravAdmin _namespaceObject . uri _params || '{}' ) ;
utils _request ( url , {
method : 'post' ,
body : {
name : name ,
params : params
}
} , function ( response ) {
if ( typeof response . files === 'undefined' ) {
return ;
}
var data = [ ] ;
thumbs = response . thumbs || { } ;
for ( var i = 0 ; i < response . files . length ; i ++ ) {
if ( mode === 'selected' && response . files [ i ] !== value ) {
continue ;
}
data . push ( {
'name' : response . files [ i ] ,
'status' : 'available' ,
thumb : thumbs [ response . files [ i ] ] || ''
} ) ;
}
for ( var _i = 0 ; _i < response . pending . length ; _i ++ ) {
if ( mode === 'selected' && response . pending [ _i ] !== value ) {
continue ;
}
data . push ( {
'name' : response . pending [ _i ] ,
'status' : 'pending' ,
thumb : thumbs [ response . pending [ _i ] ] || ''
} ) ;
}
folder = response . folder ;
callback ( data , value ) ;
} ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var imagesPreview = field . closest ( '[data-preview-images]' ) . length > 0 ;
var selectedIsRendered = false ;
var renderOption = function renderOption ( item , escape ) {
var image = '' ;
if ( imagesPreview && folder && ( ! item . status || item . status === 'available' ) && item . name . match ( /\.(jpg|jpeg|png|gif|webp|avif)$/i ) ) {
// const fallback2x = insertTextAt(`${config.base_url_relative}/../${folder}/${item.name}`, -4, '@2x');
// const fallback3x = insertTextAt(`${config.base_url_relative}/../${folder}/${item.name}`, -4, '@3x');
var source = thumbs [ item . name ] || "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/../" ) . concat ( folder , "/" ) . concat ( item . name ) ;
// onerror="if(this.src==='${fallback2x}'){this.src='${fallback3x}';}else{this.src='${fallback2x}'}"
image = "<img class=\"filepicker-field-image\" src=\"" . concat ( source , "\" />" ) ;
}
return "<div>\n <span class=\"title\">\n " . concat ( image , " <span class=\"name filepicker-field-name\">" ) . concat ( escape ( item . name ) , "</span>\n </span>\n </div>" ) ;
} ;
field . selectize ( {
plugins : [ 'required-fix' ] ,
valueField : 'name' ,
labelField : 'name' ,
searchField : 'name' ,
optgroups : [ {
$order : 1 ,
value : 'pending' ,
label : 'Pending'
} , {
$order : 2 ,
value : 'available' ,
label : 'Available'
} ] ,
optgroupField : 'status' ,
// lockOptgroupOrder: true,
create : false ,
preload : false ,
// 'focus',
render : {
option : function option ( item , escape ) {
return renderOption ( item , escape ) ;
} ,
item : function item ( _item , escape ) {
return renderOption ( _item , escape ) ;
}
} ,
onInitialize : function onInitialize ( ) {
if ( ! onDemand ) {
this . load ( function ( callback ) {
return getData ( field , function ( data ) {
return callback ( data ) ;
} , 'selected' ) ;
} ) ;
}
} ,
onLoad : function onLoad ( /* data */
) {
if ( ! selectedIsRendered ) {
var name = this . getValue ( ) ;
this . updateOption ( name , {
name : name
} ) ;
selectedIsRendered = true ;
}
} ,
onFocus : function onFocus ( ) {
this . load ( function ( callback ) {
return getData ( field , function ( data ) {
return callback ( data ) ;
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
2025-10-16 10:59:50 -06:00
} ) ;
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var filepicker _Instance = new FilePickerField ( ) ;
; // ./app/utils/selectize-option-click.js
2025-10-16 10:59:50 -06:00
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
selectize _default ( ) . define ( 'option_click' , function ( options ) {
var self = this ;
var setup = self . setup ;
this . setup = function ( ) {
setup . apply ( self , arguments ) ;
var clicking = false ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Detect click on a .clickable
self . $dropdown _content . on ( 'mousedown click' , function ( e ) {
var target = external _jQuery _default ( ) ( e . target ) ;
if ( target . hasClass ( 'clickable' ) || target . closest ( '.clickable' ) . length ) {
if ( e . type === 'mousedown' ) {
clicking = true ;
self . isFocused = false ; // awful hack to defuse the document mousedown listener
} else {
self . isFocused = true ;
setTimeout ( function ( ) {
clicking = false ; // wait until blur has been preempted
} ) ;
}
} else {
// cleanup in case user right-clicked or dragged off the element
clicking = false ;
self . isFocused = true ;
}
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Intercept default handlers
self . $dropdown . off ( 'mousedown click' , '[data-selectable]' ) . on ( 'mousedown click' , '[data-selectable]' , function ( ) {
if ( ! clicking ) {
return self . onOptionSelect . apply ( self , arguments ) ;
}
} ) ;
self . $control _input . off ( 'blur' ) . on ( 'blur' , function ( ) {
if ( ! clicking ) {
return self . onBlur . apply ( self , arguments ) ;
}
} ) ;
} ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
; // ./app/forms/fields/selectize.js
function selectize _typeof ( o ) { "@babel/helpers - typeof" ; return selectize _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , selectize _typeof ( o ) ; }
function selectize _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function selectize _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , selectize _toPropertyKey ( o . key ) , o ) ; } }
function selectize _createClass ( e , r , t ) { return r && selectize _defineProperties ( e . prototype , r ) , t && selectize _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function selectize _toPropertyKey ( t ) { var i = selectize _toPrimitive ( t , "string" ) ; return "symbol" == selectize _typeof ( i ) ? i : i + "" ; }
function selectize _toPrimitive ( t , r ) { if ( "object" != selectize _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != selectize _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
var PagesRoute = {
option : function option ( item , escape ) {
var label = escape ( item . text ) . split ( ' ' ) ;
var arrows = label . shift ( ) ;
var slug = label . shift ( ) ;
return "<div class=\"selectize-route-option\">\n <span class=\"text-grey\">" . concat ( arrows , "</span>\n <span>\n <span class=\"text-update\">" ) . concat ( slug . replace ( '(' , '/' ) . replace ( ')' , '' ) , "</span>\n <span>" ) . concat ( label . join ( ' ' ) , "</span>\n </span>\n </div>" ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
var SelectizeField = /*#__PURE__*/ function ( ) {
function SelectizeField ( ) {
var _this = this ;
var options = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
selectize _classCallCheck ( this , SelectizeField ) ;
this . options = Object . assign ( { } , options ) ;
this . elements = [ ] ;
external _jQuery _default ( ) ( '[data-grav-selectize]' ) . each ( function ( index , element ) {
return _this . add ( element ) ;
} ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
}
return selectize _createClass ( SelectizeField , [ {
key : "add" ,
value : function add ( element ) {
element = external _jQuery _default ( ) ( element ) ;
if ( element . closest ( 'template' ) . length ) {
return false ;
}
var tag = element . prop ( 'tagName' ) . toLowerCase ( ) ;
var isInput = tag === 'input' || tag === 'select' ;
var data = ( isInput ? element . closest ( '[data-grav-selectize]' ) : element ) . data ( 'grav-selectize' ) || { } ;
var field = isInput ? element : element . find ( 'input, select' ) ;
if ( field . attr ( 'name' ) === 'data[route]' ) {
data = external _jQuery _default ( ) . extend ( { } , data , {
render : PagesRoute
} ) ;
}
if ( ! field . length || field . get ( 0 ) . selectize ) {
return ;
}
var plugins = external _jQuery _default ( ) . merge ( data . plugins ? data . plugins : [ ] , [ 'required-fix' ] ) ;
field . selectize ( external _jQuery _default ( ) . extend ( { } , data , {
plugins : plugins
} ) ) ;
this . elements . push ( field . data ( 'selectize' ) ) ;
}
} , {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this2 = this ;
var fields = external _jQuery _default ( ) ( target ) . find ( 'select.fancy, input.fancy, [data-grav-selectize]' ) . filter ( function ( index , element ) {
return ! external _jQuery _default ( ) ( element ) . closest ( 'template' ) . length ;
} ) ;
if ( ! fields . length ) {
return ;
}
fields . each ( function ( index , field ) {
return _this2 . add ( field ) ;
} ) ;
}
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var selectize _Instance = new SelectizeField ( ) ;
; // ./app/forms/fields/array.js
function array _typeof ( o ) { "@babel/helpers - typeof" ; return array _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , array _typeof ( o ) ; }
function array _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function array _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , array _toPropertyKey ( o . key ) , o ) ; } }
function array _createClass ( e , r , t ) { return r && array _defineProperties ( e . prototype , r ) , t && array _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function array _toPropertyKey ( t ) { var i = array _toPrimitive ( t , "string" ) ; return "symbol" == array _typeof ( i ) ? i : i + "" ; }
function array _toPrimitive ( t , r ) { if ( "object" != array _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != array _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var body = external _jQuery _default ( ) ( 'body' ) ;
var Template = /*#__PURE__*/ function ( ) {
function Template ( container ) {
array _classCallCheck ( this , Template ) ;
this . container = external _jQuery _default ( ) ( container ) ;
if ( this . getName ( ) === undefined ) {
this . container = this . container . closest ( '[data-grav-array-name]' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
return array _createClass ( Template , [ {
key : "getName" ,
value : function getName ( ) {
return this . container . data ( 'grav-array-name' ) || '' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "getKeyPlaceholder" ,
value : function getKeyPlaceholder ( ) {
return this . container . data ( 'grav-array-keyname' ) || 'Key' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "getValuePlaceholder" ,
value : function getValuePlaceholder ( ) {
return this . container . data ( 'grav-array-valuename' ) || 'Value' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "isValueOnly" ,
value : function isValueOnly ( ) {
return this . container . find ( '[data-grav-array-mode="value_only"]:first' ) . length || false ;
}
} , {
key : "isTextArea" ,
value : function isTextArea ( ) {
return this . container . data ( 'grav-array-textarea' ) || false ;
}
} , {
key : "shouldBeDisabled" ,
value : function shouldBeDisabled ( ) {
// check for toggleables, if field is toggleable and it's not enabled, render disabled
var toggle = this . container . closest ( '.form-field' ) . find ( '[data-grav-field="toggleable"] input[type="checkbox"]' ) ;
return toggle . length && toggle . is ( ':not(:checked)' ) ;
}
} , {
key : "getNewRow" ,
value : function getNewRow ( ) {
var tpl = '' ;
var value = this . isTextArea ( ) ? "<textarea " . concat ( this . shouldBeDisabled ( ) ? 'disabled="disabled"' : '' , " data-grav-array-type=\"value\" name=\"\" placeholder=\"" ) . concat ( this . getValuePlaceholder ( ) , "\"></textarea>" ) : "<input " . concat ( this . shouldBeDisabled ( ) ? 'disabled="disabled"' : '' , " data-grav-array-type=\"value\" type=\"text\" name=\"\" value=\"\" placeholder=\"" ) . concat ( this . getValuePlaceholder ( ) , "\" />" ) ;
if ( this . isValueOnly ( ) ) {
tpl += "\n <div class=\"form-row array-field-value_only\" data-grav-array-type=\"row\">\n <span data-grav-array-action=\"sort\" class=\"fa fa-bars\"></span>\n " . concat ( value , "\n " ) ;
} else {
tpl += "\n <div class=\"form-row\" data-grav-array-type=\"row\">\n <span data-grav-array-action=\"sort\" class=\"fa fa-bars\"></span>\n <input " . concat ( this . shouldBeDisabled ( ) ? 'disabled="disabled"' : '' , " data-grav-array-type=\"key\" type=\"text\" value=\"\" placeholder=\"" ) . concat ( this . getKeyPlaceholder ( ) , "\" />\n " ) . concat ( value , "\n " ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
tpl += "\n <span data-grav-array-action=\"rem\" class=\"fa fa-minus\"></span>\n <span data-grav-array-action=\"add\" class=\"fa fa-plus\"></span>\n </div>" ;
return tpl ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
var ArrayField = /*#__PURE__*/ function ( ) {
function ArrayField ( ) {
var _this = this ;
array _classCallCheck ( this , ArrayField ) ;
body . on ( 'input' , '[data-grav-array-type="key"], [data-grav-array-type="value"]' , function ( event ) {
return _this . actionInput ( event ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
body . on ( 'click touch' , '[data-grav-array-action]:not([data-grav-array-action="sort"])' , function ( event ) {
return _this . actionEvent ( event ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
this . arrays = external _jQuery _default ( ) ( ) ;
external _jQuery _default ( ) ( '[data-grav-field="array"]' ) . each ( function ( index , list ) {
return _this . addArray ( list ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return array _createClass ( ArrayField , [ {
key : "addArray" ,
value : function addArray ( list ) {
var _this2 = this ;
list = external _jQuery _default ( ) ( list ) ;
list . find ( '[data-grav-array-type="container"]' ) . each ( function ( index , container ) {
container = external _jQuery _default ( ) ( container ) ;
if ( container . data ( 'array-sort' ) || container [ 0 ] . hasAttribute ( 'data-array-nosort' ) ) {
return ;
}
container . data ( 'array-sort' , new sortable _esm /* default */ . Ay ( container . get ( 0 ) , {
handle : '.fa-bars' ,
animation : 150 ,
onUpdate : function onUpdate ( ) {
var item = container . find ( '[data-grav-array-type="row"]:first' ) ;
_this2 . _setTemplate ( item ) ;
var template = item . data ( 'array-template' ) ;
_this2 . refreshNames ( template ) ;
}
} ) ) ;
} ) ;
}
} , {
key : "actionInput" ,
value : function actionInput ( event ) {
var element = external _jQuery _default ( ) ( event . target ) ;
var type = element . data ( 'grav-array-type' ) ;
this . _setTemplate ( element ) ;
var template = element . data ( 'array-template' ) ;
var keyElement = type === 'key' ? element : element . siblings ( '[data-grav-array-type="key"]:first' ) ;
var valueElement = type === 'value' ? element : element . siblings ( '[data-grav-array-type="value"]:first' ) ;
var escaped _name = ! template . isValueOnly ( ) ? keyElement . val ( ) : this . getIndexFor ( element ) ;
escaped _name = escaped _name . toString ( ) . replace ( /\[/g , '%5B' ) . replace ( /]/g , '%5D' ) ;
var name = "" . concat ( template . getName ( ) , "[" ) . concat ( escaped _name , "]" ) ;
if ( ! template . isValueOnly ( ) && ! keyElement . val ( ) && ! valueElement . val ( ) ) {
valueElement . attr ( 'name' , '' ) ;
} else {
// valueElement.attr('name', !valueElement.val() ? template.getName() : name);
valueElement . attr ( 'name' , name ) ;
}
this . refreshNames ( template ) ;
}
} , {
key : "actionEvent" ,
value : function actionEvent ( event ) {
event && event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( event . target ) ;
var action = element . data ( 'grav-array-action' ) ;
var container = element . parents ( '[data-grav-array-type="container"]' ) ;
this . _setTemplate ( element ) ;
this [ "" . concat ( action , "Action" ) ] ( element ) ;
var siblings = container . find ( '> div' ) ;
container [ siblings . length > 1 ? 'removeClass' : 'addClass' ] ( 'one-child' ) ;
}
} , {
key : "addAction" ,
value : function addAction ( element ) {
var template = element . data ( 'array-template' ) ;
var row = element . closest ( '[data-grav-array-type="row"]' ) ;
row . after ( template . getNewRow ( ) ) ;
}
} , {
key : "remAction" ,
value : function remAction ( element ) {
var template = element . data ( 'array-template' ) ;
var row = element . closest ( '[data-grav-array-type="row"]' ) ;
var isLast = ! row . siblings ( ) . length ;
if ( isLast ) {
var newRow = external _jQuery _default ( ) ( template . getNewRow ( ) ) ;
row . after ( newRow ) ;
newRow . find ( '[data-grav-array-type="value"]:last' ) . attr ( 'name' , template . getName ( ) ) ;
}
row . remove ( ) ;
this . refreshNames ( template ) ;
}
} , {
key : "refreshNames" ,
value : function refreshNames ( template ) {
if ( ! template . isValueOnly ( ) ) {
return ;
}
var row = template . container . find ( '> div > [data-grav-array-type="row"]' ) ;
var inputs = row . find ( '[name]:not([name=""])' ) ;
inputs . each ( function ( index , input ) {
input = external _jQuery _default ( ) ( input ) ;
var preserved _name = input . closest ( '[data-grav-array-name]' ) ;
var name = "" . concat ( preserved _name . attr ( 'data-grav-array-name' ) , "[" ) . concat ( index , "]" ) ;
input . attr ( 'name' , name ) ;
} ) ;
if ( ! inputs . length ) {
row . find ( '[data-grav-array-type="value"]' ) . attr ( 'name' , template . getName ( ) ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "getIndexFor" ,
value : function getIndexFor ( element ) {
var template = element . data ( 'array-template' ) ;
var row = element . closest ( '[data-grav-array-type="row"]' ) ;
return template . container . find ( "" . concat ( template . isValueOnly ( ) ? '> div ' : '' , " > [data-grav-array-type=\"row\"]" ) ) . index ( row ) ;
}
} , {
key : "_setTemplate" ,
value : function _setTemplate ( element ) {
if ( ! element . data ( 'array-template' ) ) {
element . data ( 'array-template' , new Template ( element . closest ( '[data-grav-array-name]' ) ) ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this3 = this ;
var arrays = external _jQuery _default ( ) ( target ) . find ( '[data-grav-field="array"]' ) ;
if ( ! arrays . length ) {
return ;
}
arrays . each ( function ( index , list ) {
list = external _jQuery _default ( ) ( list ) ;
if ( ! ~ _this3 . arrays . index ( list ) ) {
_this3 . addArray ( list ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
}
} ] ) ;
} ( ) ;
var array _Instance = new ArrayField ( ) ;
; // ./app/forms/fields/collections.js
function collections _typeof ( o ) { "@babel/helpers - typeof" ; return collections _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , collections _typeof ( o ) ; }
function collections _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function collections _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , collections _toPropertyKey ( o . key ) , o ) ; } }
function collections _createClass ( e , r , t ) { return r && collections _defineProperties ( e . prototype , r ) , t && collections _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function collections _toPropertyKey ( t ) { var i = collections _toPrimitive ( t , "string" ) ; return "symbol" == collections _typeof ( i ) ? i : i + "" ; }
function collections _toPrimitive ( t , r ) { if ( "object" != collections _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != collections _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var CollectionsField = /*#__PURE__*/ function ( ) {
function CollectionsField ( ) {
var _this = this ;
collections _classCallCheck ( this , CollectionsField ) ;
this . lists = external _jQuery _default ( ) ( ) ;
var body = external _jQuery _default ( ) ( 'body' ) ;
external _jQuery _default ( ) ( '[data-type="collection"]' ) . each ( function ( index , list ) {
return _this . addList ( list ) ;
} ) ;
body . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
body . on ( 'click' , function ( event ) {
var target = external _jQuery _default ( ) ( event . target ) ;
if ( ! ( target . is ( '[data-action="confirm"], [data-action="delete"]' ) || target . closest ( '[data-action="confirm"], [data-action="delete"]' ) . length ) ) {
CollectionsField . closeConfirmations ( ) ;
}
} ) ;
}
return collections _createClass ( CollectionsField , [ {
key : "addList" ,
value : function addList ( list ) {
var _this2 = this ;
list = external _jQuery _default ( ) ( list ) ;
this . lists = this . lists . add ( list ) ;
list . on ( 'click' , '> .collection-actions [data-action="add"]' , function ( event ) {
return _this2 . addItem ( event ) ;
} ) ;
list . on ( 'click' , '> ul > li > .item-actions [data-action="confirm"]' , function ( event ) {
return _this2 . confirmRemove ( event ) ;
} ) ;
list . on ( 'click' , '> ul > li > .item-actions [data-action="delete"]' , function ( event ) {
return _this2 . removeItem ( event ) ;
} ) ;
list . on ( 'click' , '> ul > li > .item-actions [data-action="collapse"]' , function ( event ) {
return _this2 . collapseItem ( event ) ;
} ) ;
list . on ( 'click' , '> ul > li > .item-actions [data-action="expand"]' , function ( event ) {
return _this2 . expandItem ( event ) ;
} ) ;
list . on ( 'click' , '> .collection-actions [data-action-sort="date"]' , function ( event ) {
return _this2 . sortItems ( event ) ;
} ) ;
list . on ( 'click' , '> .collection-actions [data-action="collapse_all"]' , function ( event ) {
return _this2 . collapseItems ( event ) ;
} ) ;
list . on ( 'click' , '> .collection-actions [data-action="expand_all"]' , function ( event ) {
return _this2 . expandItems ( event ) ;
} ) ;
list . on ( 'input change' , '[data-key-observe]' , function ( event ) {
return _this2 . observeKey ( event ) ;
} ) ;
list . find ( '[data-collection-holder]' ) . each ( function ( index , container ) {
container = external _jQuery _default ( ) ( container ) ;
if ( container . data ( 'collection-sort' ) || container [ 0 ] . hasAttribute ( 'data-collection-nosort' ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
container . data ( 'collection-sort' , new sortable _esm /* default */ . Ay ( container . get ( 0 ) , {
forceFallback : false ,
handle : '.collection-sort' ,
animation : 150 ,
onUpdate : function onUpdate ( ) {
return _this2 . reindex ( container ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ) ;
} ) ;
this . _updateActionsStateBasedOnMinMax ( list ) ;
}
} , {
key : "addItem" ,
value : function addItem ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var position = button . data ( 'action-add' ) || 'bottom' ;
var list = external _jQuery _default ( ) ( button . closest ( '[data-type="collection"]' ) ) ;
var template = external _jQuery _default ( ) ( list . find ( '> [data-collection-template="new"]' ) . data ( 'collection-template-html' ) ) ;
this . _updateActionsStateBasedOnMinMax ( list ) ;
var items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
var maxItems = list . data ( 'max' ) ;
if ( typeof maxItems !== 'undefined' && items . length >= maxItems ) {
return ;
}
list . find ( '> [data-collection-holder]' ) [ position === 'top' ? 'prepend' : 'append' ] ( template ) ;
this . reindex ( list ) ;
items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
var topAction = list . closest ( '[data-type="collection"]' ) . find ( '[data-action-add="top"]' ) ;
var sortAction = list . closest ( '[data-type="collection"]' ) . find ( '[data-action="sort"]' ) ;
if ( items . length ) {
if ( topAction . length ) {
topAction . parent ( ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( sortAction . length && items . length > 1 ) {
sortAction . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
// refresh toggleables in a list
external _jQuery _default ( ) ( '[data-grav-field="toggleable"] input[type="checkbox"]' ) . trigger ( 'change' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "confirmRemove" ,
value : function confirmRemove ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var list = external _jQuery _default ( ) ( button . closest ( '.item-actions' ) ) ;
var action = list . find ( '.list-confirm-deletion[data-action="delete"]' ) ;
var isHidden = action . hasClass ( 'hidden' ) ;
CollectionsField . closeConfirmations ( ) ;
action [ isHidden ? 'removeClass' : 'addClass' ] ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "removeItem" ,
value : function removeItem ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var item = button . closest ( '[data-collection-item]' ) ;
var list = external _jQuery _default ( ) ( button . closest ( '[data-type="collection"]' ) ) ;
var items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
var minItems = list . data ( 'min' ) ;
if ( typeof minItems !== 'undefined' && items . length <= minItems ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
item . remove ( ) ;
this . reindex ( list ) ;
items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
var topAction = list . closest ( '[data-type="collection"]' ) . find ( '[data-action-add="top"]' ) ;
var sortAction = list . closest ( '[data-type="collection"]' ) . find ( '[data-action="sort"]' ) ;
if ( ! items . length ) {
if ( topAction . length ) {
topAction . parent ( ) . addClass ( 'hidden' ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( sortAction . length && items . length <= 1 ) {
sortAction . addClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . _updateActionsStateBasedOnMinMax ( list ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "collapseItems" ,
value : function collapseItems ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var items = external _jQuery _default ( ) ( button . closest ( '[data-type="collection"]' ) ) . find ( '> ul > [data-collection-item] > .item-actions [data-action="collapse"]' ) ;
items . click ( ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "collapseItem" ,
value : function collapseItem ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var item = button . closest ( '[data-collection-item]' ) ;
button . attr ( 'data-action' , 'expand' ) . removeClass ( 'fa-chevron-circle-down' ) . addClass ( 'fa-chevron-circle-right' ) ;
item . addClass ( 'collection-collapsed' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "expandItems" ,
value : function expandItems ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var items = external _jQuery _default ( ) ( button . closest ( '[data-type="collection"]' ) ) . find ( '> ul > [data-collection-item] > .item-actions [data-action="expand"]' ) ;
items . click ( ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "expandItem" ,
value : function expandItem ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var item = button . closest ( '[data-collection-item]' ) ;
button . attr ( 'data-action' , 'collapse' ) . removeClass ( 'fa-chevron-circle-right' ) . addClass ( 'fa-chevron-circle-down' ) ;
item . removeClass ( 'collection-collapsed' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "sortItems" ,
value : function sortItems ( event ) {
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
var sortby = button . data ( 'action-sort' ) ;
var sortby _dir = button . data ( 'action-sort-dir' ) || 'asc' ;
var list = external _jQuery _default ( ) ( button . closest ( '[data-type="collection"]' ) ) ;
var items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
items . sort ( function ( a , b ) {
var A = external _jQuery _default ( ) ( a ) . find ( '[name$="[' + sortby + ']"]' ) ;
var B = external _jQuery _default ( ) ( b ) . find ( '[name$="[' + sortby + ']"]' ) ;
var sort ;
if ( sortby _dir === 'asc' ) {
sort = A . val ( ) < B . val ( ) ? - 1 : A . val ( ) > B . val ( ) ? 1 : 0 ;
} else {
sort = A . val ( ) > B . val ( ) ? - 1 : A . val ( ) < B . val ( ) ? 1 : 0 ;
}
return sort ;
} ) . each ( function ( _ , container ) {
external _jQuery _default ( ) ( container ) . parent ( ) . append ( container ) ;
} ) ;
this . reindex ( list ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "observeKey" ,
value : function observeKey ( event ) {
var input = external _jQuery _default ( ) ( event . target ) ;
var value = input . val ( ) ;
var item = input . closest ( '[data-collection-key]' ) ;
item . data ( 'collection-key-backup' , item . data ( 'collection-key' ) ) . data ( 'collection-key' , value ) ;
this . reindex ( null , item ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "reindex" ,
value : function reindex ( list , items ) {
items = items || external _jQuery _default ( ) ( list ) . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
items . each ( function ( index , item ) {
item = external _jQuery _default ( ) ( item ) ;
var observed = item . find ( '[data-key-observe]' ) ;
var observedValue = observed . val ( ) ;
var hasCustomKey = observed . length ;
var currentKey = item . data ( 'collection-key-backup' ) ;
item . attr ( 'data-collection-key' , hasCustomKey ? observedValue : index ) ;
[ 'name' , 'data-grav-field-name' , 'for' , 'id' , 'data-grav-file-settings' , 'data-file-post-add' , 'data-file-post-remove' , 'data-grav-array-name' , 'data-grav-elements' ] . forEach ( function ( prop ) {
item . find ( '[' + prop + '], [_' + prop + ']' ) . each ( function ( ) {
var element = external _jQuery _default ( ) ( this ) ;
var indexes = [ ] ;
var array _index = null ;
var regexps = [ new RegExp ( '\\[(\\d+|\\*|' + currentKey + ')\\]' , 'g' ) , new RegExp ( '\\.(\\d+|\\*|' + currentKey + ')\\.' , 'g' ) ] ;
// special case to preserve array field index keys
if ( prop === 'name' && element . data ( 'gravArrayType' ) ) {
var match _index = element . attr ( prop ) . match ( /\[[0-9]{1,}\]$/ ) ;
var array _container = element [ 0 ] . closest ( '[data-grav-array-name]' ) ;
if ( match _index ) {
array _index = match _index [ 0 ] ;
element . attr ( prop , element . attr ( prop ) . slice ( 0 , array _index . length * - 1 ) ) ;
}
if ( array _container && array _container . dataset && array _container . dataset . gravArrayName ) {
element . attr ( prop , array _container . dataset . gravArrayName ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( hasCustomKey && ! observedValue ) {
element . attr ( "_" . concat ( prop ) , element . attr ( prop ) ) ;
element . attr ( prop , null ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( element . attr ( "_" . concat ( prop ) ) ) {
element . attr ( prop , element . attr ( "_" . concat ( prop ) ) ) ;
element . attr ( "_" . concat ( prop ) , null ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
element . parents ( '[data-collection-key]' ) . map ( function ( idx , parent ) {
return indexes . push ( external _jQuery _default ( ) ( parent ) . attr ( 'data-collection-key' ) ) ;
} ) ;
indexes . reverse ( ) ;
var matchedKey = currentKey ;
var replaced = element . attr ( prop ) . replace ( regexps [ 0 ] , function /* str, p1, offset */
( ) {
matchedKey = indexes . shift ( ) || matchedKey ;
return "[" . concat ( matchedKey , "]" ) ;
} ) ;
replaced = replaced . replace ( regexps [ 1 ] , function /* str, p1, offset */
( ) {
matchedKey = indexes . shift ( ) || matchedKey ;
return "." . concat ( matchedKey , "." ) ;
} ) ;
element . attr ( prop , array _index ? "" . concat ( replaced ) . concat ( array _index ) : replaced ) ;
} ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} ) ;
}
} , {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this3 = this ;
var collections = external _jQuery _default ( ) ( target ) . find ( '[data-type="collection"]' ) ;
if ( ! collections . length ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
collections . each ( function ( index , collection ) {
collection = external _jQuery _default ( ) ( collection ) ;
if ( ! ~ _this3 . lists . index ( collection ) ) {
_this3 . addList ( collection ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "_updateActionsStateBasedOnMinMax" ,
value : function _updateActionsStateBasedOnMinMax ( list ) {
var items = list . closest ( '[data-type="collection"]' ) . find ( '> ul > [data-collection-item]' ) ;
var minItems = list . data ( 'min' ) ;
var maxItems = list . data ( 'max' ) ;
list . find ( '> .collection-actions [data-action="add"]' ) . attr ( 'disabled' , false ) ;
list . find ( '> ul > li > .item-actions [data-action="delete"]' ) . attr ( 'disabled' , false ) ;
if ( typeof minItems !== 'undefined' && items . length <= minItems ) {
list . find ( '> ul > li > .item-actions [data-action="delete"]' ) . attr ( 'disabled' , true ) ;
}
if ( typeof maxItems !== 'undefined' && items . length >= maxItems ) {
list . find ( '> .collection-actions [data-action="add"]' ) . attr ( 'disabled' , true ) ;
}
}
} ] , [ {
key : "closeConfirmations" ,
value : function closeConfirmations ( ) {
external _jQuery _default ( ) ( '.list-confirm-deletion[data-action="delete"]' ) . addClass ( 'hidden' ) ;
}
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var collections _Instance = new CollectionsField ( ) ;
// EXTERNAL MODULE: ./app/utils/bootstrap-datetimepicker.js
var bootstrap _datetimepicker = _ _webpack _require _ _ ( 70086 ) ;
; // ./app/forms/fields/datetime.js
function datetime _typeof ( o ) { "@babel/helpers - typeof" ; return datetime _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , datetime _typeof ( o ) ; }
function datetime _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function datetime _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , datetime _toPropertyKey ( o . key ) , o ) ; } }
function datetime _createClass ( e , r , t ) { return r && datetime _defineProperties ( e . prototype , r ) , t && datetime _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function datetime _toPropertyKey ( t ) { var i = datetime _toPrimitive ( t , "string" ) ; return "symbol" == datetime _typeof ( i ) ? i : i + "" ; }
function datetime _toPrimitive ( t , r ) { if ( "object" != datetime _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != datetime _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var DateTimeField = /*#__PURE__*/ function ( ) {
function DateTimeField ( options ) {
var _this = this ;
datetime _classCallCheck ( this , DateTimeField ) ;
this . items = external _jQuery _default ( ) ( ) ;
this . options = Object . assign ( { } , this . defaults , options ) ;
external _jQuery _default ( ) ( '[data-grav-datetime]' ) . each ( function ( index , field ) {
return _this . addItem ( field ) ;
} ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
}
return datetime _createClass ( DateTimeField , [ {
key : "defaults" ,
get : function get ( ) {
return {
showTodayButton : true ,
showClear : true ,
locale : external _GravAdmin _namespaceObject . config . language || 'en' ,
icons : {
time : 'fa fa-clock-o' ,
date : 'fa fa-calendar-o' ,
up : 'fa fa-chevron-up' ,
down : 'fa fa-chevron-down' ,
previous : 'fa fa-chevron-left' ,
next : 'fa fa-chevron-right' ,
today : 'fa fa-bullseye' ,
clear : 'fa fa-trash-o' ,
close : 'fa fa-remove'
}
} ;
}
} , {
key : "addItem" ,
value : function addItem ( list ) {
list = external _jQuery _default ( ) ( list ) ;
this . items = this . items . add ( list ) ;
if ( list . data ( 'DateTimePicker' ) ) {
return ;
}
var options = Object . assign ( { } , this . options , list . data ( 'grav-datetime' ) || { } ) ;
list . datetimepicker ( options ) . on ( 'dp.show dp.update' , this . _disableDecades ) ;
list . siblings ( '.field-icons' ) . on ( 'click' , function ( ) {
return list . mousedown ( ) . focus ( ) ;
} ) ;
}
} , {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this2 = this ;
var fields = external _jQuery _default ( ) ( target ) . find ( '[data-grav-datetime]' ) ;
if ( ! fields . length ) {
return ;
}
fields . each ( function ( index , field ) {
field = external _jQuery _default ( ) ( field ) ;
if ( ! ~ _this2 . items . index ( field ) ) {
_this2 . addItem ( field ) ;
}
} ) ;
}
} , {
key : "_disableDecades" ,
value : function _disableDecades ( ) {
external _jQuery _default ( ) ( '.datepicker-years .picker-switch' ) . removeAttr ( 'title' ) . on ( 'click' , function ( e ) {
return e . stopPropagation ( ) ;
} ) ;
}
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var datetime _Instance = new DateTimeField ( ) ;
// EXTERNAL MODULE: ./node_modules/mout/math/clamp.js
var clamp = _ _webpack _require _ _ ( 14544 ) ;
var clamp _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( clamp ) ;
// EXTERNAL MODULE: ./node_modules/mout/function/bind.js
var bind = _ _webpack _require _ _ ( 91390 ) ;
var bind _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( bind ) ;
; // ./app/utils/colors.js
// Parses a string and returns a valid hex string when possible
// parseHex('#fff') => '#ffffff'
var parseHex = function parseHex ( string ) {
string = string . replace ( /[^A-F0-9]/ig , '' ) ;
if ( string . length !== 3 && string . length !== 6 ) return '' ;
if ( string . length === 3 ) {
string = string [ 0 ] + string [ 0 ] + string [ 1 ] + string [ 1 ] + string [ 2 ] + string [ 2 ] ;
}
return '#' + string . toLowerCase ( ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts an HSB object to an RGB object
// hsb2rgb({h: 0, s: 0, b: 100}) => {r: 255, g: 255, b: 255}
var hsb2rgb = function hsb2rgb ( hsb ) {
var rgb = { } ;
var h = Math . round ( hsb . h ) ;
var s = Math . round ( hsb . s * 255 / 100 ) ;
var v = Math . round ( hsb . b * 255 / 100 ) ;
if ( s === 0 ) {
rgb . r = rgb . g = rgb . b = v ;
} else {
var t1 = v ;
var t2 = ( 255 - s ) * v / 255 ;
var t3 = ( t1 - t2 ) * ( h % 60 ) / 60 ;
if ( h === 360 ) h = 0 ;
if ( h < 60 ) {
rgb . r = t1 ;
rgb . b = t2 ;
rgb . g = t2 + t3 ;
} else if ( h < 120 ) {
rgb . g = t1 ;
rgb . b = t2 ;
rgb . r = t1 - t3 ;
} else if ( h < 180 ) {
rgb . g = t1 ;
rgb . r = t2 ;
rgb . b = t2 + t3 ;
} else if ( h < 240 ) {
rgb . b = t1 ;
rgb . r = t2 ;
rgb . g = t1 - t3 ;
} else if ( h < 300 ) {
rgb . b = t1 ;
rgb . g = t2 ;
rgb . r = t2 + t3 ;
} else if ( h < 360 ) {
rgb . r = t1 ;
rgb . g = t2 ;
rgb . b = t1 - t3 ;
} else {
rgb . r = 0 ;
rgb . g = 0 ;
rgb . b = 0 ;
}
}
return {
r : Math . round ( rgb . r ) ,
g : Math . round ( rgb . g ) ,
b : Math . round ( rgb . b )
} ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts an RGB object to a HEX string
// rgb2hex({r: 255, g: 255, b: 255}) => #ffffff
var rgb2hex = function rgb2hex ( rgb ) {
var hex = [ rgb . r . toString ( 16 ) , rgb . g . toString ( 16 ) , rgb . b . toString ( 16 ) ] ;
hex . forEach ( function ( val , nr ) {
if ( val . length === 1 ) hex [ nr ] = '0' + val ;
} ) ;
return '#' + hex . join ( '' ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts and RGB(a) string to a HEX string
// rgbstr2hex('rgba(255, 255, 255, 0.5)') => #ffffff
var rgbstr2hex = function rgbstr2hex ( rgb ) {
rgb = rgb . match ( /^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i ) ;
return rgb && rgb . length === 4 ? '#' + ( '0' + parseInt ( rgb [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( '0' + parseInt ( rgb [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( '0' + parseInt ( rgb [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) : '' ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts an HSB object to a HEX string
// hsb2hex({h: 0, s: 0, b: 100}) => #ffffff
var hsb2hex = function hsb2hex ( hsb ) {
return rgb2hex ( hsb2rgb ( hsb ) ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts a HEX string to an HSB object
// hex2hsb('#ffffff') => {h: 0, s: 0, b: 100}
var hex2hsb = function hex2hsb ( hex ) {
var hsb = rgb2hsb ( hex2rgb ( hex ) ) ;
if ( hsb . s === 0 ) hsb . h = 360 ;
return hsb ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts an RGB object to an HSB object
// rgb2hsb({r: 255, g: 255, b: 255}) => {h: 0, s: 0, b: 100}
var rgb2hsb = function rgb2hsb ( rgb ) {
var hsb = {
h : 0 ,
s : 0 ,
b : 0
} ;
var min = Math . min ( rgb . r , rgb . g , rgb . b ) ;
var max = Math . max ( rgb . r , rgb . g , rgb . b ) ;
var delta = max - min ;
hsb . b = max ;
hsb . s = max !== 0 ? 255 * delta / max : 0 ;
if ( hsb . s !== 0 ) {
if ( rgb . r === max ) {
hsb . h = ( rgb . g - rgb . b ) / delta ;
} else if ( rgb . g === max ) {
hsb . h = 2 + ( rgb . b - rgb . r ) / delta ;
} else {
hsb . h = 4 + ( rgb . r - rgb . g ) / delta ;
}
} else {
hsb . h = - 1 ;
}
hsb . h *= 60 ;
if ( hsb . h < 0 ) {
hsb . h += 360 ;
}
hsb . s *= 100 / 255 ;
hsb . b *= 100 / 255 ;
return hsb ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Converts a HEX string to an RGB object
// hex2rgb('#ffffff') => {r: 255, g: 255, b: 255}
var hex2rgb = function hex2rgb ( hex ) {
hex = parseInt ( hex . indexOf ( '#' ) > - 1 ? hex . substring ( 1 ) : hex , 16 ) ;
return {
/* jshint ignore:start */
r : hex >> 16 ,
g : ( hex & 0x00FF00 ) >> 8 ,
b : hex & 0x0000FF
/* jshint ignore:end */
} ;
} ;
; // ./app/forms/fields/colorpicker.js
function colorpicker _typeof ( o ) { "@babel/helpers - typeof" ; return colorpicker _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , colorpicker _typeof ( o ) ; }
function colorpicker _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function colorpicker _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , colorpicker _toPropertyKey ( o . key ) , o ) ; } }
function colorpicker _createClass ( e , r , t ) { return r && colorpicker _defineProperties ( e . prototype , r ) , t && colorpicker _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function colorpicker _toPropertyKey ( t ) { var i = colorpicker _toPrimitive ( t , "string" ) ; return "symbol" == colorpicker _typeof ( i ) ? i : i + "" ; }
function colorpicker _toPrimitive ( t , r ) { if ( "object" != colorpicker _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != colorpicker _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var isFirefox = navigator . userAgent . toLowerCase ( ) . indexOf ( 'firefox' ) > - 1 ;
var colorpicker _body = external _jQuery _default ( ) ( 'body' ) ;
var MOUSEDOWN = 'mousedown touchstart MSPointerDown pointerdown' ;
var MOUSEMOVE = 'mousemove touchmove MSPointerMove pointermove' ;
var MOUSEUP = 'mouseup touchend MSPointerUp pointerup' ;
var FOCUSIN = isFirefox ? 'focus' : 'focusin' ;
var ColorpickerField = /*#__PURE__*/ function ( ) {
function ColorpickerField ( selector ) {
var _this = this ;
colorpicker _classCallCheck ( this , ColorpickerField ) ;
this . selector = selector ;
this . field = external _jQuery _default ( ) ( this . selector ) ;
this . options = Object . assign ( { } , this . field . data ( 'grav-colorpicker' ) ) ;
this . built = false ;
this . attach ( ) ;
if ( this . options . update ) {
this . field . on ( 'change._grav_colorpicker' , function ( event , field , hex , opacity ) {
var backgroundColor = hex ;
var rgb = hex2rgb ( hex ) ;
if ( opacity < 1 ) {
backgroundColor = 'rgba(' + rgb . r + ', ' + rgb . g + ', ' + rgb . b + ', ' + opacity + ')' ;
}
var target = field . closest ( _this . options . update ) ;
if ( ! target . length ) {
target = field . siblings ( _this . options . update ) ;
}
if ( ! target . length ) {
target = field . parent ( '.g-colorpicker' ) . find ( _this . options . update ) ;
}
target . css ( {
backgroundColor : backgroundColor
} ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
return colorpicker _createClass ( ColorpickerField , [ {
key : "attach" ,
value : function attach ( ) {
var _this2 = this ;
colorpicker _body . on ( FOCUSIN , this . selector , function ( event ) {
return _this2 . show ( event , event . currentTarget ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
colorpicker _body . on ( MOUSEDOWN , this . selector + ' .g-colorpicker, ' + this . selector + ' .g-colorpicker i' , this . bound ( 'iconClick' ) ) ;
colorpicker _body . on ( 'keydown' , this . selector , function ( event ) {
switch ( event . keyCode ) {
case 9 :
// tab
_this2 . hide ( ) ;
break ;
case 13 : // enter
case 27 :
// esc
_this2 . hide ( ) ;
event . currentTarget . blur ( ) ;
break ;
}
2025-10-16 10:59:50 -06:00
return true ;
} ) ;
2025-10-18 13:48:40 -06:00
// Update on keyup
colorpicker _body . on ( 'keyup' , this . selector , function ( event ) {
_this2 . updateFromInput ( true , event . currentTarget ) ;
return true ;
} ) ;
// Update on paste
colorpicker _body . on ( 'paste' , this . selector , function ( event ) {
setTimeout ( function ( ) {
return _this2 . updateFromInput ( true , event . currentTarget ) ;
} , 1 ) ;
} ) ;
}
} , {
key : "show" ,
value : function show ( event , target ) {
target = external _jQuery _default ( ) ( target ) ;
if ( ! this . built ) {
this . build ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . element = target ;
this . reposition ( ) ;
this . wrapper . addClass ( 'cp-visible' ) ;
this . updateFromInput ( ) ;
this . wrapper . on ( MOUSEDOWN , '.cp-grid, .cp-slider, .cp-opacity-slider' , this . bound ( 'bodyDown' ) ) ;
colorpicker _body . on ( MOUSEMOVE , this . bound ( 'bodyMove' ) ) ;
colorpicker _body . on ( MOUSEDOWN , this . bound ( 'bodyClick' ) ) ;
colorpicker _body . on ( MOUSEUP , this . bound ( 'targetReset' ) ) ;
external _jQuery _default ( ) ( '#admin-main > .content-wrapper' ) . on ( 'scroll' , this . bound ( 'reposition' ) ) ;
}
} , {
key : "hide" ,
value : function hide ( ) {
if ( ! this . built ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . wrapper . removeClass ( 'cp-visible' ) ;
this . wrapper . undelegate ( MOUSEDOWN , '.cp-grid, .cp-slider, .cp-opacity-slider' , this . bound ( 'bodyDown' ) ) ;
colorpicker _body . off ( MOUSEMOVE , this . bound ( 'bodyMove' ) ) ;
colorpicker _body . off ( MOUSEDOWN , this . bound ( 'bodyClick' ) ) ;
colorpicker _body . off ( MOUSEUP , this . bound ( 'targetReset' ) ) ;
external _jQuery _default ( ) ( '#admin-main > .content-wrapper' ) . on ( 'scroll' , this . bound ( 'reposition' ) ) ;
}
} , {
key : "build" ,
value : function build ( ) {
var _this3 = this ;
this . wrapper = external _jQuery _default ( ) ( '<div class="cp-wrapper cp-with-opacity cp-mode-hue" />' ) ;
this . slider = external _jQuery _default ( ) ( '<div class="cp-slider cp-sprite" />' ) . appendTo ( this . wrapper ) . append ( external _jQuery _default ( ) ( '<div class="cp-picker" />' ) ) ;
this . opacitySlider = external _jQuery _default ( ) ( '<div class="cp-opacity-slider cp-sprite" />' ) . appendTo ( this . wrapper ) . append ( external _jQuery _default ( ) ( '<div class="cp-picker" />' ) ) ;
this . grid = external _jQuery _default ( ) ( '<div class="cp-grid cp-sprite" />' ) . appendTo ( this . wrapper ) . append ( external _jQuery _default ( ) ( '<div class="cp-grid-inner" />' ) ) . append ( external _jQuery _default ( ) ( '<div class="cp-picker" />' ) ) ;
external _jQuery _default ( ) ( '<div />' ) . appendTo ( this . grid . find ( '.cp-picker' ) ) ;
var tabs = external _jQuery _default ( ) ( '<div class="cp-tabs" />' ) . appendTo ( this . wrapper ) ;
this . tabs = {
hue : external _jQuery _default ( ) ( '<div class="cp-tab-hue active" />' ) . text ( 'HUE' ) . appendTo ( tabs ) ,
brightness : external _jQuery _default ( ) ( '<div class="cp-tab-brightness" />' ) . text ( 'BRI' ) . appendTo ( tabs ) ,
saturation : external _jQuery _default ( ) ( '<div class="cp-tab-saturation" />' ) . text ( 'SAT' ) . appendTo ( tabs ) ,
wheel : external _jQuery _default ( ) ( '<div class="cp-tab-wheel" />' ) . text ( 'WHEEL' ) . appendTo ( tabs ) ,
transparent : external _jQuery _default ( ) ( '<div class="cp-tab-transp" />' ) . text ( 'TRANSPARENT' ) . appendTo ( tabs )
} ;
tabs . on ( MOUSEDOWN , '> div' , function ( event ) {
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( element . is ( _this3 . tabs . transparent ) ) {
var sliderHeight = _this3 . opacitySlider . height ( ) ;
_this3 . opacity = 0 ;
_this3 . opacitySlider . find ( '.cp-picker' ) . css ( {
'top' : clamp _default ( ) ( sliderHeight - sliderHeight * _this3 . opacity , 0 , sliderHeight )
} ) ;
_this3 . move ( _this3 . opacitySlider , {
manualOpacity : true
} ) ;
return ;
}
var active = tabs . find ( '.active' ) ;
var mode = active . attr ( 'class' ) . replace ( /\s|active|cp-tab-/g , '' ) ;
var newMode = element . attr ( 'class' ) . replace ( /\s|active|cp-tab-/g , '' ) ;
_this3 . wrapper . removeClass ( 'cp-mode-' + mode ) . addClass ( 'cp-mode-' + newMode ) ;
active . removeClass ( 'active' ) ;
element . addClass ( 'active' ) ;
_this3 . mode = newMode ;
_this3 . updateFromInput ( ) ;
} ) ;
this . wrapper . appendTo ( '.content-wrapper' ) ;
this . built = true ;
this . mode = 'hue' ;
}
} , {
key : "reposition" ,
value : function reposition ( ) {
var ct = external _jQuery _default ( ) ( '.content-wrapper' ) [ 0 ] ;
var offset = this . element [ 0 ] . getBoundingClientRect ( ) ;
var ctOffset = ct . getBoundingClientRect ( ) ;
var delta = {
x : 0 ,
y : 0
} ;
if ( this . options . offset ) {
delta . x = this . options . offset . x || 0 ;
delta . y = this . options . offset . y || 0 ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . wrapper . css ( {
top : offset . top + offset . height + ct . scrollTop - ctOffset . top + delta . y ,
left : offset . left + ct . scrollLeft - ctOffset . left + delta . x
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "iconClick" ,
value : function iconClick ( event ) {
if ( this . wrapper && this . wrapper . hasClass ( 'cp-visible' ) ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
event && event . preventDefault ( ) ;
var input = external _jQuery _default ( ) ( event . currentTarget ) . find ( 'input' ) ;
setTimeout ( function ( ) {
return input . focus ( ) ;
} , 50 ) ;
}
} , {
key : "bodyMove" ,
value : function bodyMove ( event ) {
event && event . preventDefault ( ) ;
if ( this . target ) {
this . move ( this . target , event ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
} , {
key : "bodyClick" ,
value : function bodyClick ( event ) {
var target = external _jQuery _default ( ) ( event . target ) ;
if ( ! target . closest ( '.cp-wrapper' ) . length && ! target . is ( this . selector ) ) {
this . hide ( ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "bodyDown" ,
value : function bodyDown ( event ) {
event && event . preventDefault ( ) ;
this . target = external _jQuery _default ( ) ( event . currentTarget ) ;
this . move ( this . target , event , true ) ;
}
} , {
key : "targetReset" ,
value : function targetReset ( event ) {
event && event . preventDefault ( ) ;
this . target = null ;
}
} , {
key : "move" ,
value : function move ( target , event ) {
var input = this . element ;
var picker = target . find ( '.cp-picker' ) ;
var clientRect = target [ 0 ] . getBoundingClientRect ( ) ;
var offsetX = clientRect . left + window . scrollX ;
var offsetY = clientRect . top + window . scrollY ;
var x = Math . round ( ( event ? event . pageX : 0 ) - offsetX ) ;
var y = Math . round ( ( event ? event . pageY : 0 ) - offsetY ) ;
var wx ;
var wy ;
var r ;
var phi ;
// Touch support
var touchEvents = event . changedTouches || event . originalEvent && event . originalEvent . changedTouches ;
if ( event && touchEvents ) {
x = ( touchEvents ? touchEvents [ 0 ] . pageX : 0 ) - offsetX ;
y = ( touchEvents ? touchEvents [ 0 ] . pageY : 0 ) - offsetY ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( event && event . manualOpacity ) {
y = clientRect . height ;
}
// Constrain picker to its container
if ( x < 0 ) x = 0 ;
if ( y < 0 ) y = 0 ;
if ( x > clientRect . width ) x = clientRect . width ;
if ( y > clientRect . height ) y = clientRect . height ;
// Constrain color wheel values to the wheel
if ( target . parent ( '.cp-mode-wheel' ) . length && picker . parent ( '.cp-grid' ) . length ) {
wx = 75 - x ;
wy = 75 - y ;
r = Math . sqrt ( wx * wx + wy * wy ) ;
phi = Math . atan2 ( wy , wx ) ;
if ( phi < 0 ) phi += Math . PI * 2 ;
if ( r > 75 ) {
x = 75 - 75 * Math . cos ( phi ) ;
y = 75 - 75 * Math . sin ( phi ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
x = Math . round ( x ) ;
y = Math . round ( y ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Move the picker
if ( target . hasClass ( 'cp-grid' ) ) {
picker . css ( {
top : y ,
left : x
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
this . updateFromPicker ( input , target ) ;
} else {
picker . css ( {
top : y
} ) ;
this . updateFromPicker ( input , target ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "updateFromInput" ,
value : function updateFromInput ( dontFireEvent , element ) {
element = element ? external _jQuery _default ( ) ( element ) : this . element ;
var value = element . val ( ) ;
var opacity = value . replace ( /\s/g , '' ) . match ( /^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/ ) ;
var hex ;
var hsb ;
value = rgbstr2hex ( value ) || value ;
opacity = opacity ? clamp _default ( ) ( opacity [ 1 ] , 0 , 1 ) : 1 ;
if ( ! ( hex = parseHex ( value ) ) ) {
hex = '#ffffff' ;
}
hsb = hex2hsb ( hex ) ;
if ( this . built ) {
// opacity
this . opacity = opacity ;
var sliderHeight = this . opacitySlider . height ( ) ;
this . opacitySlider . find ( '.cp-picker' ) . css ( {
'top' : clamp _default ( ) ( sliderHeight - sliderHeight * this . opacity , 0 , sliderHeight )
} ) ;
// bg color
var gridHeight = this . grid . height ( ) ;
var gridWidth = this . grid . width ( ) ;
var r ;
var phi ;
var x ;
var y ;
sliderHeight = this . slider . height ( ) ;
switch ( this . mode ) {
case 'wheel' :
// Set grid position
r = clamp _default ( ) ( Math . ceil ( hsb . s * 0.75 ) , 0 , gridHeight / 2 ) ;
phi = hsb . h * Math . PI / 180 ;
x = clamp _default ( ) ( 75 - Math . cos ( phi ) * r , 0 , gridWidth ) ;
y = clamp _default ( ) ( 75 - Math . sin ( phi ) * r , 0 , gridHeight ) ;
this . grid . css ( {
backgroundColor : 'transparent'
} ) . find ( '.cp-picker' ) . css ( {
top : y ,
left : x
} ) ;
// Set slider position
y = 150 - hsb . b / ( 100 / gridHeight ) ;
if ( hex === '' ) y = 0 ;
this . slider . find ( '.cp-picker' ) . css ( {
top : y
} ) ;
// Update panel color
this . slider . css ( {
backgroundColor : hsb2hex ( {
h : hsb . h ,
s : hsb . s ,
b : 100
} )
} ) ;
break ;
case 'saturation' :
// Set grid position
x = clamp _default ( ) ( 5 * hsb . h / 12 , 0 , 150 ) ;
y = clamp _default ( ) ( gridHeight - Math . ceil ( hsb . b / ( 100 / gridHeight ) ) , 0 , gridHeight ) ;
this . grid . find ( '.cp-picker' ) . css ( {
top : y ,
left : x
} ) ;
// Set slider position
y = clamp _default ( ) ( sliderHeight - hsb . s * ( sliderHeight / 100 ) , 0 , sliderHeight ) ;
this . slider . find ( '.cp-picker' ) . css ( {
top : y
} ) ;
// Update UI
this . slider . css ( {
backgroundColor : hsb2hex ( {
h : hsb . h ,
s : 100 ,
b : hsb . b
} )
} ) ;
this . grid . find ( '.cp-grid-inner' ) . css ( {
opacity : hsb . s / 100
} ) ;
break ;
case 'brightness' :
// Set grid position
x = clamp _default ( ) ( 5 * hsb . h / 12 , 0 , 150 ) ;
y = clamp _default ( ) ( gridHeight - Math . ceil ( hsb . s / ( 100 / gridHeight ) ) , 0 , gridHeight ) ;
this . grid . find ( '.cp-picker' ) . css ( {
top : y ,
left : x
} ) ;
// Set slider position
y = clamp _default ( ) ( sliderHeight - hsb . b * ( sliderHeight / 100 ) , 0 , sliderHeight ) ;
this . slider . find ( '.cp-picker' ) . css ( {
top : y
} ) ;
// Update UI
this . slider . css ( {
backgroundColor : hsb2hex ( {
h : hsb . h ,
s : hsb . s ,
b : 100
} )
} ) ;
this . grid . find ( '.cp-grid-inner' ) . css ( {
opacity : 1 - hsb . b / 100
} ) ;
break ;
case 'hue' :
default :
// Set grid position
x = clamp _default ( ) ( Math . ceil ( hsb . s / ( 100 / gridWidth ) ) , 0 , gridWidth ) ;
y = clamp _default ( ) ( gridHeight - Math . ceil ( hsb . b / ( 100 / gridHeight ) ) , 0 , gridHeight ) ;
this . grid . find ( '.cp-picker' ) . css ( {
top : y ,
left : x
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
// Set slider position
y = clamp _default ( ) ( sliderHeight - hsb . h / ( 360 / sliderHeight ) , 0 , sliderHeight ) ;
this . slider . find ( '.cp-picker' ) . css ( {
top : y
} ) ;
// Update panel color
this . grid . css ( {
backgroundColor : hsb2hex ( {
h : hsb . h ,
s : 100 ,
b : 100
} )
} ) ;
break ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
if ( ! dontFireEvent ) {
element . val ( this . getValue ( hex ) ) ;
}
( this . element || element ) . trigger ( 'change._grav_colorpicker' , [ element , hex , opacity ] ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "updateFromPicker" ,
value : function updateFromPicker ( input , target ) {
var getCoords = function getCoords ( picker , container ) {
var left , top ;
if ( ! picker . length || ! container ) return null ;
left = picker [ 0 ] . getBoundingClientRect ( ) . left ;
top = picker [ 0 ] . getBoundingClientRect ( ) . top ;
return {
x : left - container [ 0 ] . getBoundingClientRect ( ) . left + picker [ 0 ] . offsetWidth / 2 ,
y : top - container [ 0 ] . getBoundingClientRect ( ) . top + picker [ 0 ] . offsetHeight / 2
2025-10-16 10:59:50 -06:00
} ;
} ;
2025-10-18 13:48:40 -06:00
var hex ;
var hue ;
var saturation ;
var brightness ;
var x ;
var y ;
var r ;
var phi ;
// Panel objects
var grid = this . wrapper . find ( '.cp-grid' ) ;
var slider = this . wrapper . find ( '.cp-slider' ) ;
var opacitySlider = this . wrapper . find ( '.cp-opacity-slider' ) ;
// Picker objects
var gridPicker = grid . find ( '.cp-picker' ) ;
var sliderPicker = slider . find ( '.cp-picker' ) ;
var opacityPicker = opacitySlider . find ( '.cp-picker' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Picker positions
var gridPos = getCoords ( gridPicker , grid ) ;
var sliderPos = getCoords ( sliderPicker , slider ) ;
var opacityPos = getCoords ( opacityPicker , opacitySlider ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Sizes
var gridWidth = grid [ 0 ] . getBoundingClientRect ( ) . width ;
var gridHeight = grid [ 0 ] . getBoundingClientRect ( ) . height ;
var sliderHeight = slider [ 0 ] . getBoundingClientRect ( ) . height ;
var opacitySliderHeight = opacitySlider [ 0 ] . getBoundingClientRect ( ) . height ;
var value = this . element . val ( ) ;
value = rgbstr2hex ( value ) || value ;
if ( ! ( hex = parseHex ( value ) ) ) {
hex = '#ffffff' ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Handle colors
if ( target . hasClass ( 'cp-grid' ) || target . hasClass ( 'cp-slider' ) ) {
// Determine HSB values
switch ( this . mode ) {
case 'wheel' :
// Calculate hue, saturation, and brightness
x = gridWidth / 2 - gridPos . x ;
y = gridHeight / 2 - gridPos . y ;
r = Math . sqrt ( x * x + y * y ) ;
phi = Math . atan2 ( y , x ) ;
if ( phi < 0 ) phi += Math . PI * 2 ;
if ( r > 75 ) {
r = 75 ;
gridPos . x = 69 - 75 * Math . cos ( phi ) ;
gridPos . y = 69 - 75 * Math . sin ( phi ) ;
}
saturation = clamp _default ( ) ( r / 0.75 , 0 , 100 ) ;
hue = clamp _default ( ) ( phi * 180 / Math . PI , 0 , 360 ) ;
brightness = clamp _default ( ) ( 100 - Math . floor ( sliderPos . y * ( 100 / sliderHeight ) ) , 0 , 100 ) ;
hex = hsb2hex ( {
h : hue ,
s : saturation ,
b : brightness
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Update UI
slider . css ( {
backgroundColor : hsb2hex ( {
h : hue ,
s : saturation ,
b : 100
} )
} ) ;
break ;
case 'saturation' :
// Calculate hue, saturation, and brightness
hue = clamp _default ( ) ( parseInt ( gridPos . x * ( 360 / gridWidth ) , 10 ) , 0 , 360 ) ;
saturation = clamp _default ( ) ( 100 - Math . floor ( sliderPos . y * ( 100 / sliderHeight ) ) , 0 , 100 ) ;
brightness = clamp _default ( ) ( 100 - Math . floor ( gridPos . y * ( 100 / gridHeight ) ) , 0 , 100 ) ;
hex = hsb2hex ( {
h : hue ,
s : saturation ,
b : brightness
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Update UI
slider . css ( {
backgroundColor : hsb2hex ( {
h : hue ,
s : 100 ,
b : brightness
} )
} ) ;
grid . find ( '.cp-grid-inner' ) . css ( {
opacity : saturation / 100
} ) ;
break ;
case 'brightness' :
// Calculate hue, saturation, and brightness
hue = clamp _default ( ) ( parseInt ( gridPos . x * ( 360 / gridWidth ) , 10 ) , 0 , 360 ) ;
saturation = clamp _default ( ) ( 100 - Math . floor ( gridPos . y * ( 100 / gridHeight ) ) , 0 , 100 ) ;
brightness = clamp _default ( ) ( 100 - Math . floor ( sliderPos . y * ( 100 / sliderHeight ) ) , 0 , 100 ) ;
hex = hsb2hex ( {
h : hue ,
s : saturation ,
b : brightness
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Update UI
slider . css ( {
backgroundColor : hsb2hex ( {
h : hue ,
s : saturation ,
b : 100
} )
} ) ;
grid . find ( '.cp-grid-inner' ) . css ( {
opacity : 1 - brightness / 100
} ) ;
break ;
default :
// Calculate hue, saturation, and brightness
hue = clamp _default ( ) ( 360 - parseInt ( sliderPos . y * ( 360 / sliderHeight ) , 10 ) , 0 , 360 ) ;
saturation = clamp _default ( ) ( Math . floor ( gridPos . x * ( 100 / gridWidth ) ) , 0 , 100 ) ;
brightness = clamp _default ( ) ( 100 - Math . floor ( gridPos . y * ( 100 / gridHeight ) ) , 0 , 100 ) ;
hex = hsb2hex ( {
h : hue ,
s : saturation ,
b : brightness
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Update UI
grid . css ( {
backgroundColor : hsb2hex ( {
h : hue ,
s : 100 ,
b : 100
} )
} ) ;
break ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Handle opacity
if ( target . hasClass ( 'cp-opacity-slider' ) ) {
this . opacity = parseFloat ( 1 - opacityPos . y / opacitySliderHeight ) . toFixed ( 2 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// Adjust case
input . val ( this . getValue ( hex ) ) ;
// Handle change event
this . element . trigger ( 'change._grav_colorpicker' , [ this . element , hex , this . opacity ] ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "getValue" ,
value : function getValue ( hex ) {
if ( this . opacity === 1 ) {
return hex ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var rgb = hex2rgb ( hex ) ;
return 'rgba(' + rgb . r + ', ' + rgb . g + ', ' + rgb . b + ', ' + this . opacity + ')' ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "bound" ,
value : function bound ( name ) {
var bound = this . _bound || ( this . _bound = { } ) ;
return bound [ name ] || ( bound [ name ] = bind _default ( ) ( this [ name ] , this ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ;
var colorpicker _Instance = new ColorpickerField ( '[data-grav-colorpicker]' ) ;
; // ./app/forms/fields/folder.js
var Regenerate = function Regenerate ( ) {
var field = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : '[name="data[folder]"]' ;
var element = external _jQuery _default ( ) ( field ) ;
var title = external _jQuery _default ( ) ( '[name="data[header][title]"]' ) ;
var slug = external _jQuery _default ( ) . slugify ( title . val ( ) , {
custom : {
"'" : ''
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
element . addClass ( 'highlight' ) . val ( slug ) ;
setTimeout ( function ( ) {
return element . removeClass ( 'highlight' ) ;
} , 500 ) ;
} ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-regenerate]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var field = external _jQuery _default ( ) ( target . data ( 'regenerate' ) ) ;
Regenerate ( field ) ;
} ) ;
/* harmony default export */ const fields _folder = ( Regenerate ) ;
// EXTERNAL MODULE: ./node_modules/mout/object/forIn.js
var forIn = _ _webpack _require _ _ ( 29690 ) ;
var forIn _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( forIn ) ;
; // ./app/forms/fields/selectunique.js
function selectunique _typeof ( o ) { "@babel/helpers - typeof" ; return selectunique _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , selectunique _typeof ( o ) ; }
function selectunique _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function selectunique _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , selectunique _toPropertyKey ( o . key ) , o ) ; } }
function selectunique _createClass ( e , r , t ) { return r && selectunique _defineProperties ( e . prototype , r ) , t && selectunique _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function selectunique _toPropertyKey ( t ) { var i = selectunique _toPrimitive ( t , "string" ) ; return "symbol" == selectunique _typeof ( i ) ? i : i + "" ; }
function selectunique _toPrimitive ( t , r ) { if ( "object" != selectunique _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != selectunique _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
// import { config } from 'grav-config';
var Data = { } ;
var SelectUniqueField = /*#__PURE__*/ function ( ) {
function SelectUniqueField ( options ) {
var _this = this ;
selectunique _classCallCheck ( this , SelectUniqueField ) ;
var body = external _jQuery _default ( ) ( 'body' ) ;
this . items = external _jQuery _default ( ) ( ) ;
this . options = Object . assign ( { } , this . defaults , options ) ;
external _jQuery _default ( ) ( '[data-select-observe]' ) . each ( function ( index , element ) {
return _this . addSelect ( element ) ;
} ) . last ( ) . trigger ( 'change' , {
load : true
} ) ;
body . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
body . on ( 'mutation_removed._grav' , this . _onRemovedNodes . bind ( this ) ) ;
}
return selectunique _createClass ( SelectUniqueField , [ {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target , record , instance ) {
var _this2 = this ;
var fields = external _jQuery _default ( ) ( target ) . find ( '[data-select-observe]' ) ;
if ( ! fields . length ) {
return ;
}
fields . each ( function ( index , field ) {
field = external _jQuery _default ( ) ( field ) ;
if ( ! ~ _this2 . items . index ( field ) ) {
_this2 . addSelect ( field ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "_onRemovedNodes" ,
value : function _onRemovedNodes ( event , data /* , instance */ ) {
2025-10-16 10:59:50 -06:00
var _this3 = this ;
2025-10-18 13:48:40 -06:00
var target = external _jQuery _default ( ) ( data . target ) ;
var holder = target . data ( 'collectionHolder' ) ;
if ( ! holder ) {
return false ;
}
var node = external _jQuery _default ( ) ( data . mutation . removedNodes ) ;
var value = node . find ( '[data-select-observe]' ) . val ( ) ;
if ( value ) {
Data [ holder ] . state [ value ] = value ;
}
target . find ( '[data-select-observe]' ) . each ( function ( index , field ) {
field = external _jQuery _default ( ) ( field ) ;
if ( field . val ( ) !== value ) {
_this3 . updateOptions ( field ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
}
} , {
key : "addSelect" ,
value : function addSelect ( element ) {
var _this4 = this ;
this . items = this . items . add ( element ) ;
element = external _jQuery _default ( ) ( element ) ;
var value = element . attr ( 'value' ) ;
var holder = element . closest ( '[data-collection-holder]' ) . data ( 'collectionHolder' ) ;
var options = element . closest ( '[data-select-unique]' ) . data ( 'selectUnique' ) ;
if ( ! Data [ holder ] ) {
var data = { } ;
if ( Array . isArray ( options ) ) {
options . slice ( 0 ) . map ( function ( item ) {
data [ item ] = item ;
} ) ;
} else {
data = Object . assign ( { } , options ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
Data [ holder ] = {
original : null ,
state : null
} ;
Data [ holder ] . original = Object . assign ( { } , data ) ;
Data [ holder ] . state = Object . assign ( { } , data ) ;
}
this . updateOptions ( element ) ;
element . data ( 'originalValue' , value ) ;
element . on ( 'change' , function ( event , extras ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( target . data ( 'dummyChange' ) ) {
target . data ( 'dummyChange' , false ) ;
return false ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_this4 . refreshOptions ( target , extras && extras . load ? null : element . data ( 'originalValue' ) ) ;
element . data ( 'originalValue' , target . val ( ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
} , {
key : "updateOptions" ,
value : function updateOptions ( element ) {
element = external _jQuery _default ( ) ( element ) ;
var value = element . attr ( 'value' ) ;
var holder = element . closest ( '[data-collection-holder]' ) . data ( 'collectionHolder' ) ;
forIn _default ( ) ( Data [ holder ] . state , function ( v , k ) {
var selected = k === value ? 'selected="selected"' : '' ;
if ( element . get ( 0 ) . selectize ) {
var selectize = element . data ( 'selectize' ) ;
selectize . removeOption ( k ) ;
selectize . addOption ( {
value : k ,
text : v
} ) ;
} else {
element . append ( "<option value=\"" . concat ( k , "\" " ) . concat ( selected , ">" ) . concat ( v , "</option>" ) ) ;
}
if ( selected ) {
if ( element . get ( 0 ) . selectize ) {
var _selectize = element . data ( 'selectize' ) ;
_selectize . setValue ( k ) ;
}
delete Data [ holder ] . state [ value ] ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
} , {
key : "refreshOptions" ,
value : function refreshOptions ( element , originalValue ) {
var value = element . val ( ) ;
var holder = element . closest ( '[data-collection-holder]' ) . data ( 'collectionHolder' ) ;
delete Data [ holder ] . state [ value ] ;
if ( originalValue && Data [ holder ] . original [ originalValue ] ) {
Data [ holder ] . state [ originalValue ] = Data [ holder ] . original [ originalValue ] ;
}
this . items . each ( function ( index , select ) {
select = external _jQuery _default ( ) ( select ) ;
if ( select [ 0 ] === element [ 0 ] ) {
return ;
}
var selectedValue = select . val ( ) ;
select . data ( 'dummyChange' , true ) ;
if ( select . get ( 0 ) . selectize ) {
var selectize = select . data ( 'selectize' ) ;
if ( selectize ) {
selectize . clearOptions ( ) ;
if ( selectedValue ) {
selectize . addOption ( {
value : selectedValue ,
text : Data [ holder ] . original [ selectedValue ] || selectedValue
} ) ;
}
forIn _default ( ) ( Data [ holder ] . state , function ( v , k ) {
selectize . addOption ( {
value : k ,
text : v
} ) ;
} ) ;
selectize . setValue ( selectedValue , true ) ;
}
} else {
select . empty ( ) ;
forIn _default ( ) ( Data [ holder ] . state , function ( v , k ) {
var selected = k === selectedValue ? 'selected="selected"' : '' ;
select . append ( "<option value=\"" . concat ( k , "\" " ) . concat ( selected , ">" ) . concat ( v , "</option>" ) ) ;
} ) ;
}
select . data ( 'dummyChange' , false ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} ] ) ;
2025-10-18 13:48:40 -06:00
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var selectunique _Instance = new SelectUniqueField ( ) ;
; // ./app/forms/fields/iconpicker.js
function iconpicker _typeof ( o ) { "@babel/helpers - typeof" ; return iconpicker _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , iconpicker _typeof ( o ) ; }
function iconpicker _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function iconpicker _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , iconpicker _toPropertyKey ( o . key ) , o ) ; } }
function iconpicker _createClass ( e , r , t ) { return r && iconpicker _defineProperties ( e . prototype , r ) , t && iconpicker _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function iconpicker _toPropertyKey ( t ) { var i = iconpicker _toPrimitive ( t , "string" ) ; return "symbol" == iconpicker _typeof ( i ) ? i : i + "" ; }
function iconpicker _toPrimitive ( t , r ) { if ( "object" != iconpicker _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != iconpicker _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * I c o n P i c k e r b y Q u e r y L o o p
* Author : @ eliorivero
* URL : http : //queryloop.com/
* License : GPLv2
* /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var iconpicker _defaults = {
'mode' : 'dialog' ,
// show overlay 'dialog' panel or slide down 'inline' panel
'closeOnPick' : true ,
// whether to close panel after picking or 'no'
'save' : 'class' ,
// save icon 'class' or 'code'
'size' : '' ,
'classes' : {
'launcher' : '' ,
// extra classes for launcher buttons
'clear' : 'remove-times' ,
// extra classes for button that removes preview and clears field
'highlight' : '' ,
// extra classes when highlighting an icon
'close' : '' // extra classes for close button
} ,
'iconSets' : {
// example data structure. Used to specify which launchers will be created
'genericon' : 'Genericon' ,
// create a launcher to pick genericon icons
'fa' : 'FontAwesome' // create a launcher to pick fontawesome icons
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
var QL _Icon _Picker = /*#__PURE__*/ function ( ) {
function QL _Icon _Picker ( element , options ) {
iconpicker _classCallCheck ( this , QL _Icon _Picker ) ;
this . iconSet = '' ;
this . iconSetName = '' ;
this . $field = '' ;
this . element = element ;
this . settings = external _jQuery _default ( ) . extend ( { } , iconpicker _defaults , options ) ;
this . _defaults = iconpicker _defaults ;
this . init ( ) ;
}
return iconpicker _createClass ( QL _Icon _Picker , [ {
key : "init" ,
value : function init ( ) {
var $brick = external _jQuery _default ( ) ( this . element ) ;
var pickerId = $brick . data ( 'pickerid' ) ;
var $preview = external _jQuery _default ( ) ( '<div class="icon-preview icon-preview-' + pickerId + '" />' ) ;
this . $field = $brick . find ( 'input' ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Add preview area
this . makePreview ( $brick , pickerId , $preview ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Make button to clear field and remove preview
this . makeClear ( pickerId , $preview ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Make buttons that open the panel of icons
this . makeLaunchers ( $brick , pickerId ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Prepare display styles, inline and dialog
this . makeDisplay ( $brick ) ;
}
} , {
key : "makePreview" ,
value : function makePreview ( $brick , pickerId , $preview ) {
var $icon = external _jQuery _default ( ) ( '<i />' ) ;
var iconValue = this . $field . val ( ) ;
$preview . prependTo ( $brick ) ;
$icon . prependTo ( $preview ) ;
if ( iconValue !== '' ) {
$preview . addClass ( 'icon-preview-on' ) ;
$icon . addClass ( iconValue ) ;
}
}
} , {
key : "makeClear" ,
value : function makeClear ( pickerId , $preview ) {
var base = this ;
var $clear = external _jQuery _default ( ) ( '<a class="remove-icon ' + base . settings . classes . clear + '" />' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Hide button to remove icon and preview and append it to preview area
$clear . hide ( ) . prependTo ( $preview ) ;
// If there's a icon saved in the field, show remove icon button
if ( base . $field . val ( ) !== '' ) {
$clear . show ( ) ;
}
$preview . on ( 'click' , '.remove-icon' , function ( e ) {
e . preventDefault ( ) ;
base . $field . val ( '' ) ;
$preview . removeClass ( 'icon-preview-on' ) . find ( 'i' ) . removeClass ( ) ;
external _jQuery _default ( ) ( this ) . hide ( ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
} , {
key : "makeDisplay" ,
value : function makeDisplay ( $brick ) {
var base = this ;
var close = base . settings . classes . close ;
var $body = external _jQuery _default ( ) ( 'body' ) ;
var $close = external _jQuery _default ( ) ( '<a href="#" class="icon-picker-close"/>' ) ;
if ( base . settings . mode === 'inline' ) {
$brick . find ( '.icon-set' ) . append ( $close ) . removeClass ( 'dialog' ) . addClass ( 'ip-inline ' + base . settings . size ) . parent ( ) . addClass ( 'icon-set-wrap' ) ;
} else if ( base . settings . mode === 'dialog' ) {
external _jQuery _default ( ) ( '.icon-set' ) . addClass ( 'dialog ' + base . settings . size ) ;
if ( external _jQuery _default ( ) ( '.icon-picker-overlay' ) . length <= 0 ) {
$body . append ( '<div class="icon-picker-overlay"/>' ) . append ( $close ) ;
}
}
$body . on ( 'click' , '.icon-picker-close, .icon-picker-overlay' , function ( e ) {
e . preventDefault ( ) ;
base . closePicker ( $brick , external _jQuery _default ( ) ( base . iconSet ) , base . settings . mode ) ;
} ) . on ( 'mouseenter mouseleave' , '.icon-picker-close' , function ( e ) {
if ( e . type === 'mouseenter' ) {
external _jQuery _default ( ) ( this ) . addClass ( close ) ;
} else {
external _jQuery _default ( ) ( this ) . removeClass ( close ) ;
}
} ) ;
}
} , {
key : "makeLaunchers" ,
value : function makeLaunchers ( $brick ) {
var base = this ;
var dataIconSets = $brick . data ( 'iconsets' ) ;
var iconSet ;
if ( typeof dataIconSets === 'undefined' ) {
dataIconSets = base . settings . iconSets ;
}
for ( iconSet in dataIconSets ) {
if ( dataIconSets . hasOwnProperty ( iconSet ) ) {
$brick . append ( '<a class="launch-icons button ' + base . settings . classes . launcher + '" data-icons="' + iconSet + '">' + dataIconSets [ iconSet ] + '</a>' ) ;
}
}
$brick . find ( '.launch-icons' ) . on ( 'click' , function ( e ) {
e . preventDefault ( ) ;
var $self = external _jQuery _default ( ) ( this ) ;
var theseIcons = $self . data ( 'icons' ) ;
base . iconSetName = theseIcons ;
base . iconSet = '.' + theseIcons + '-set' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Initialize picker
base . iconPick ( $brick ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Show icon picker
base . showPicker ( $brick , external _jQuery _default ( ) ( base . iconSet ) , base . settings . mode ) ;
} ) ;
}
} , {
key : "iconPick" ,
value : function iconPick ( $brick ) {
var base = this ;
var highlight = 'icon-highlight ' + base . settings . classes . highlight ;
external _jQuery _default ( ) ( base . iconSet ) . on ( 'click' , 'li' , function ( e ) {
e . preventDefault ( ) ;
var $icon = external _jQuery _default ( ) ( this ) ;
var icon = $icon . data ( base . settings . save ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Mark as selected
external _jQuery _default ( ) ( '.icon-selected' ) . removeClass ( 'icon-selected' ) ;
$icon . addClass ( 'icon-selected' ) ;
if ( base . $field . data ( 'format' ) === 'short' ) {
icon = icon . slice ( 6 ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Save icon value to field
base . $field . val ( icon ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Close icon picker
if ( base . settings . closeOnPick ) {
base . closePicker ( $brick , $icon . closest ( base . iconSet ) , base . settings . mode ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Set preview
base . setPreview ( $icon . data ( 'class' ) ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Broadcast event passing the selected icon.
external _jQuery _default ( ) ( 'body' ) . trigger ( 'iconselected.queryloop' , icon ) ;
} ) ;
external _jQuery _default ( ) ( base . iconSet ) . on ( 'mouseenter mouseleave' , 'li' , function ( e ) {
if ( e . type === 'mouseenter' ) {
external _jQuery _default ( ) ( this ) . addClass ( highlight ) ;
} else {
external _jQuery _default ( ) ( this ) . removeClass ( highlight ) ;
}
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "showPicker" ,
value : function showPicker ( $brick , $icons , mode ) {
if ( mode === 'inline' ) {
external _jQuery _default ( ) ( '.icon-set' ) . removeClass ( 'ip-inline-open' ) ;
$brick . find ( $icons ) . toggleClass ( 'ip-inline-open' ) ;
} else if ( mode === 'dialog' ) {
$brick . find ( '.icon-picker-close' ) . addClass ( 'make-visible' ) ;
$brick . find ( '.icon-picker-overlay' ) . addClass ( 'make-visible' ) ;
$icons . addClass ( 'dialog-open' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$icons . find ( '.icon-selected' ) . removeClass ( 'icon-selected' ) ;
var selectedIcon = this . $field . val ( ) . replace ( ' ' , '.' ) ;
if ( selectedIcon !== '' ) {
if ( this . settings . save === 'class' ) {
$icons . find ( '.' + selectedIcon ) . addClass ( 'icon-selected' ) ;
} else {
$icons . find ( '[data-code="' + selectedIcon + '"]' ) . addClass ( 'icon-selected' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
// Broadcast event when the picker is shown passing the picker mode.
external _jQuery _default ( ) ( 'body' ) . trigger ( 'iconpickershow.queryloop' , mode ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "closePicker" ,
value : function closePicker ( $brick , $icons , mode ) {
// Remove event so they don't fire from a different picker
external _jQuery _default ( ) ( this . iconSet ) . off ( 'click' , 'li' ) ;
if ( mode === 'inline' ) {
$brick . find ( $icons ) . removeClass ( 'ip-inline-open' ) ;
} else if ( mode === 'dialog' ) {
external _jQuery _default ( ) ( '.icon-picker-close, .icon-picker-overlay' ) . removeClass ( 'make-visible' ) ;
}
// Broadcast event when the picker is closed passing the picker mode.
external _jQuery _default ( ) ( 'body' ) . trigger ( 'iconpickerclose.queryloop' , mode ) ;
external _jQuery _default ( ) ( '.icon-set' ) . removeClass ( 'dialog-open' ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "setPreview" ,
value : function setPreview ( preview ) {
var $preview = external _jQuery _default ( ) ( this . element ) . find ( '.icon-preview' ) ;
$preview . addClass ( 'icon-preview-on' ) . find ( 'i' ) . removeClass ( ) . addClass ( this . iconSetName ) . addClass ( preview ) ;
$preview . find ( 'a' ) . show ( ) ;
}
} ] ) ;
} ( ) ;
/* Grav */
// extend $ with 3rd party QL Icon Picker
( external _jQuery _default ( ) ) . fn . qlIconPicker = function ( options ) {
this . each ( function ( ) {
if ( ! external _jQuery _default ( ) . data ( this , 'plugin_qlIconPicker' ) ) {
external _jQuery _default ( ) . data ( this , 'plugin_qlIconPicker' , new QL _Icon _Picker ( this , options ) ) ;
}
} ) ;
return this ;
} ;
var IconpickerField = /*#__PURE__*/ function ( ) {
function IconpickerField ( options ) {
var _this = this ;
iconpicker _classCallCheck ( this , IconpickerField ) ;
this . items = external _jQuery _default ( ) ( ) ;
this . options = Object . assign ( { } , this . defaults , options ) ;
external _jQuery _default ( ) ( '[data-grav-iconpicker]' ) . each ( function ( index , element ) {
return _this . addItem ( element ) ;
} ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
}
return iconpicker _createClass ( IconpickerField , [ {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
var _this2 = this ;
var fields = external _jQuery _default ( ) ( target ) . find ( '[data-grav-iconpicker]' ) ;
if ( ! fields . length ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
fields . each ( function ( index , field ) {
2025-10-16 10:59:50 -06:00
field = external _jQuery _default ( ) ( field ) ;
2025-10-18 13:48:40 -06:00
if ( ! ~ _this2 . items . index ( field ) ) {
_this2 . addItem ( field ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "addItem" ,
value : function addItem ( element ) {
element = external _jQuery _default ( ) ( element ) ;
this . items = this . items . add ( element ) ;
element . find ( '.icon-picker' ) . qlIconPicker ( {
'save' : 'class'
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// hack to remove extra icon sets that are just copies
external _jQuery _default ( ) ( '.icon-set:not(:first)' ) . remove ( ) ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var iconpicker _Instance = new IconpickerField ( ) ;
// Fix to close the dialog when clicking outside
external _jQuery _default ( ) ( document ) . on ( 'click' , function ( event ) {
var target = external _jQuery _default ( ) ( event . target ) ;
var match = '.icon-set.dialog-open, .launch-icons[data-icons]' ;
if ( ! target . is ( match ) && ! target . closest ( match ) . length ) {
var dialogs = external _jQuery _default ( ) ( '.icon-set.dialog-open' ) ;
// skip if there's no dialog open
if ( dialogs . length ) {
dialogs . each ( function ( index , dialog ) {
var picker = external _jQuery _default ( ) ( dialog ) . siblings ( '.icon-picker' ) ;
var data = picker . data ( 'plugin_qlIconPicker' ) ;
data . closePicker ( picker , external _jQuery _default ( ) ( data . iconSet ) , data . settings . mode ) ;
} ) ;
}
}
} ) ;
; // ./app/utils/cron-ui.js
function cron _ui _typeof ( o ) { "@babel/helpers - typeof" ; return cron _ui _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , cron _ui _typeof ( o ) ; }
/* eslint-disable */
/ *
* This file is part of the Arnapou jqCron package .
*
* ( c ) Arnaud Buathier < arnaud @ arnapou . net >
*
* For the full copyright and license information , please view the LICENSE
* file that was distributed with this source code .
* /
/ * *
* Default settings
* /
var jqCronDefaultSettings = {
texts : { } ,
monthdays : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ] ,
hours : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 ] ,
hour _labels : [ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12" , "13" , "14" , "15" , "16" , "17" , "18" , "19" , "20" , "21" , "22" , "23" ] ,
minutes : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 ] ,
lang : 'en' ,
enabled _minute : false ,
enabled _hour : true ,
enabled _day : true ,
enabled _week : true ,
enabled _month : true ,
enabled _year : true ,
multiple _dom : false ,
multiple _month : false ,
multiple _mins : false ,
multiple _dow : false ,
multiple _time _hours : false ,
multiple _time _minutes : false ,
numeric _zero _pad : false ,
default _period : 'day' ,
default _value : '' ,
no _reset _button : true ,
disabled : false ,
bind _to : null ,
bind _method : {
set : function set ( $element , value ) {
$element . is ( ':input' ) ? $element . val ( value ) : $element . data ( 'jqCronValue' , value ) ;
} ,
get : function get ( $element ) {
return $element . is ( ':input' ) ? $element . val ( ) : $element . data ( 'jqCronValue' ) ;
}
}
} ;
/ * *
* Custom extend of json for jqCron settings .
* We don ' t use jQuery . extend because simple extend does not fit our needs , and deep extend has a bad
* feature for us : it replaces keys of "Arrays" instead of replacing the full array .
* /
( function ( $ ) {
var _extend = function extend ( dst , src ) {
for ( var i in src ) {
if ( $ . isPlainObject ( src [ i ] ) ) {
dst [ i ] = _extend ( dst [ i ] && $ . isPlainObject ( dst [ i ] ) ? dst [ i ] : { } , src [ i ] ) ;
} else if ( $ . isArray ( src [ i ] ) ) {
dst [ i ] = src [ i ] . slice ( 0 ) ;
} else if ( src [ i ] !== undefined ) {
dst [ i ] = src [ i ] ;
}
}
return dst ;
} ;
this . jqCronMergeSettings = function ( obj ) {
return _extend ( _extend ( { } , jqCronDefaultSettings ) , obj || { } ) ;
} ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Shortcut to get the instance of jqCron instance from one jquery object
* /
( function ( $ ) {
$ . fn . jqCronGetInstance = function ( ) {
return this . data ( 'jqCron' ) ;
} ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * *
* Main plugin
* /
( function ( $ ) {
$ . fn . jqCron = function ( settings ) {
var saved _settings = settings ;
return this . each ( function ( ) {
var cron , saved ;
var $this = $ ( this ) ;
var settings = jqCronMergeSettings ( saved _settings ) ; // clone settings
var translations = settings . texts [ settings . lang ] ;
if ( cron _ui _typeof ( translations ) !== 'object' || $ . isEmptyObject ( translations ) ) {
console && console . error ( 'Missing translations for language "' + settings . lang + '". ' + 'Please include jqCron.' + settings . lang + '.js or manually provide ' + 'the necessary translations when calling $.fn.jqCron().' ) ;
return ;
}
if ( ! settings . jquery _container ) {
if ( $this . is ( ':container' ) ) {
settings . jquery _element = $this . uniqueId ( 'jqCron' ) ;
} else if ( $this . is ( ':autoclose' ) ) {
// delete already generated dom if exists
if ( $this . next ( '.jqCron' ) . length == 1 ) {
$this . next ( '.jqCron' ) . remove ( ) ;
}
// generate new
settings . jquery _element = $ ( '<span class="jqCron"></span>' ) . uniqueId ( 'jqCron' ) . insertAfter ( $this ) ;
} else {
console && console . error ( settings . texts [ settings . lang ] . error1 . replace ( '%s' , this . tagName ) ) ;
return ;
}
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// autoset bind_to if it is an input
if ( $this . is ( ':input' ) ) {
settings . bind _to = settings . bind _to || $this ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// init cron object
if ( settings . bind _to ) {
if ( settings . bind _to . is ( ':input' ) ) {
// auto bind from input to object if an input, textarea ...
settings . bind _to . blur ( function ( ) {
var value = settings . bind _method . get ( settings . bind _to ) ;
$this . jqCronGetInstance ( ) . setCron ( value ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
saved = settings . bind _method . get ( settings . bind _to ) ;
cron = new jqCron ( settings ) ;
cron . setCron ( saved ) ;
} else {
cron = new jqCron ( settings ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$ ( this ) . data ( 'jqCron' , cron ) ;
} ) ;
} ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
/ * *
* jqCron class
* /
( function ( $ ) {
var jqCronInstances = [ ] ;
function jqCron ( settings ) {
var _initialized = false ;
var _self = this ;
var _$elt = this ;
var _$obj = $ ( '<span class="jqCron-container"></span>' ) ;
var _$blocks = $ ( '<span class="jqCron-blocks"></span>' ) ;
var _$blockPERIOD = $ ( '<span class="jqCron-period"></span>' ) ;
var _$blockDOM = $ ( '<span class="jqCron-dom"></span>' ) ;
var _$blockMONTH = $ ( '<span class="jqCron-month"></span>' ) ;
var _$blockMINS = $ ( '<span class="jqCron-mins"></span>' ) ;
var _$blockDOW = $ ( '<span class="jqCron-dow"></span>' ) ;
var _$blockTIME = $ ( '<span class="jqCron-time"></span>' ) ;
var _$cross = $ ( '<span class="jqCron-cross">✘</span>' ) ;
var _selectors = [ ] ;
var _selectorPeriod , _selectorMins , _selectorTimeH , _selectorTimeM , _selectorDow , _selectorDom , _selectorMonth ;
// instanciate a new selector
function newSelector ( $block , multiple , type ) {
var selector = new jqCronSelector ( _self , $block , multiple , type ) ;
selector . $ . bind ( 'selector:open' , function ( ) {
// we close all opened selectors of all other jqCron
for ( var n = jqCronInstances . length ; n -- ; ) {
if ( jqCronInstances [ n ] != _self ) {
jqCronInstances [ n ] . closeSelectors ( ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
// we close all other opened selectors of this jqCron
for ( var o = _selectors . length ; o -- ; ) {
if ( _selectors [ o ] != selector ) {
_selectors [ o ] . close ( ) ;
}
}
2025-10-16 10:59:50 -06:00
}
}
} ) ;
2025-10-18 13:48:40 -06:00
selector . $ . bind ( 'selector:change' , function ( ) {
var boundChanged = false ;
// don't propagate if not initialized
if ( ! _initialized ) return ;
// bind data between two minute selectors (only if they have the same multiple settings)
if ( settings . multiple _mins == settings . multiple _time _minutes ) {
if ( selector == _selectorMins ) {
boundChanged = _selectorTimeM . setValue ( _selectorMins . getValue ( ) ) ;
} else if ( selector == _selectorTimeM ) {
boundChanged = _selectorMins . setValue ( _selectorTimeM . getValue ( ) ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
// we propagate the change event to the main object
boundChanged || _$obj . trigger ( 'cron:change' , _self . getCron ( ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
_selectors . push ( selector ) ;
return selector ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// disable the selector
this . disable = function ( ) {
_$obj . addClass ( 'disable' ) ;
settings . disable = true ;
_self . closeSelectors ( ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// return if the selector is disabled
this . isDisabled = function ( ) {
return settings . disable == true ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// enable the selector
this . enable = function ( ) {
_$obj . removeClass ( 'disable' ) ;
settings . disable = false ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// get cron value
this . getCron = function ( ) {
var period = _selectorPeriod . getValue ( ) ;
var items = [ '*' , '*' , '*' , '*' , '*' ] ;
if ( period == 'hour' ) {
items [ 0 ] = _selectorMins . getCronValue ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( period == 'day' || period == 'week' || period == 'month' || period == 'year' ) {
items [ 0 ] = _selectorTimeM . getCronValue ( ) ;
items [ 1 ] = _selectorTimeH . getCronValue ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( period == 'month' || period == 'year' ) {
items [ 2 ] = _selectorDom . getCronValue ( ) ;
}
if ( period == 'year' ) {
items [ 3 ] = _selectorMonth . getCronValue ( ) ;
}
if ( period == 'week' ) {
items [ 4 ] = _selectorDow . getCronValue ( ) ;
}
return items . join ( ' ' ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// set cron (string like * * * * *)
this . setCron = function ( str ) {
if ( ! str ) return ;
try {
str = str . replace ( /\s+/g , ' ' ) . replace ( /^ +/ , '' ) . replace ( / +$/ , '' ) ; // sanitize
var mask = str . replace ( /[^\* ]/g , '-' ) . replace ( /-+/g , '-' ) . replace ( / +/g , '' ) ;
var items = str . split ( ' ' ) ;
if ( items . length != 5 ) _self . error ( _self . getText ( 'error2' ) ) ;
if ( mask == '*****' ) {
// 1 possibility
_selectorPeriod . setValue ( 'minute' ) ;
} else if ( mask == '-****' ) {
// 1 possibility
_selectorPeriod . setValue ( 'hour' ) ;
_selectorMins . setCronValue ( items [ 0 ] ) ;
_selectorTimeM . setCronValue ( items [ 0 ] ) ;
} else if ( mask . substring ( 2 , mask . length ) == '***' ) {
// 4 possibilities
_selectorPeriod . setValue ( 'day' ) ;
_selectorMins . setCronValue ( items [ 0 ] ) ;
_selectorTimeM . setCronValue ( items [ 0 ] ) ;
_selectorTimeH . setCronValue ( items [ 1 ] ) ;
} else if ( mask . substring ( 2 , mask . length ) == '-**' ) {
// 4 possibilities
_selectorPeriod . setValue ( 'month' ) ;
_selectorMins . setCronValue ( items [ 0 ] ) ;
_selectorTimeM . setCronValue ( items [ 0 ] ) ;
_selectorTimeH . setCronValue ( items [ 1 ] ) ;
_selectorDom . setCronValue ( items [ 2 ] ) ;
} else if ( mask . substring ( 2 , mask . length ) == '**-' ) {
// 4 possibilities
_selectorPeriod . setValue ( 'week' ) ;
_selectorMins . setCronValue ( items [ 0 ] ) ;
_selectorTimeM . setCronValue ( items [ 0 ] ) ;
_selectorTimeH . setCronValue ( items [ 1 ] ) ;
_selectorDow . setCronValue ( items [ 4 ] ) ;
} else if ( mask . substring ( 3 , mask . length ) == '-*' ) {
// 8 possibilities
_selectorPeriod . setValue ( 'year' ) ;
_selectorMins . setCronValue ( items [ 0 ] ) ;
_selectorTimeM . setCronValue ( items [ 0 ] ) ;
_selectorTimeH . setCronValue ( items [ 1 ] ) ;
_selectorDom . setCronValue ( items [ 2 ] ) ;
_selectorMonth . setCronValue ( items [ 3 ] ) ;
} else {
_self . error ( _self . getText ( 'error4' ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_self . clearError ( ) ;
} catch ( e ) { }
} ;
// close all child selectors
this . closeSelectors = function ( ) {
for ( var n = _selectors . length ; n -- ; ) {
_selectors [ n ] . close ( ) ;
}
} ;
// get the main element id
this . getId = function ( ) {
return _$elt . attr ( 'id' ) ;
} ;
// get the translated text
this . getText = function ( key ) {
var text = settings . texts [ settings . lang ] [ key ] || null ;
if ( typeof text == "string" && text . match ( '<b' ) ) {
text = text . replace ( /(<b *\/>)/gi , '</span><b /><span class="jqCron-text">' ) ;
text = '<span class="jqCron-text">' + text + '</span>' ;
}
return text ;
} ;
// get the human readable text
this . getHumanText = function ( ) {
var texts = [ ] ;
_$obj . find ( '> span > span:visible' ) . find ( '.jqCron-text, .jqCron-selector > span' ) . each ( function ( ) {
var text = $ ( this ) . text ( ) . replace ( /\s+$/g , '' ) . replace ( /^\s+/g , '' ) ;
text && texts . push ( text ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
return texts . join ( ' ' ) . replace ( /\s:\s/g , ':' ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// get settings
this . getSettings = function ( ) {
return settings ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// display an error
this . error = function ( msg ) {
console && console . error ( '[jqCron Error] ' + msg ) ;
_$obj . addClass ( 'jqCron-error' ) . attr ( 'title' , msg ) ;
throw msg ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// clear error
this . clearError = function ( ) {
_$obj . attr ( 'title' , '' ) . removeClass ( 'jqCron-error' ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// clear
this . clear = function ( ) {
_selectorDom . setValue ( [ ] ) ;
_selectorDow . setValue ( [ ] ) ;
_selectorMins . setValue ( [ ] ) ;
_selectorMonth . setValue ( [ ] ) ;
_selectorTimeH . setValue ( [ ] ) ;
_selectorTimeM . setValue ( [ ] ) ;
_self . triggerChange ( ) ;
} ;
// init (called in constructor)
this . init = function ( ) {
var n , i , labelsList , list ;
if ( _initialized ) return ;
settings = jqCronMergeSettings ( settings ) ;
settings . jquery _element || _self . error ( _self . getText ( 'error3' ) ) ;
_$elt = settings . jquery _element ;
_$elt . append ( _$obj ) ;
_$obj . data ( 'id' , settings . id ) ;
_$obj . data ( 'jqCron' , _self ) ;
_$obj . append ( _$blocks ) ;
settings . no _reset _button || _$obj . append ( _$cross ) ;
! settings . disable || _$obj . addClass ( 'disable' ) ;
_$blocks . append ( _$blockPERIOD ) ;
if ( /^(ko)$/i . test ( settings . lang ) ) {
_$blocks . append ( _$blockMONTH , _$blockDOM ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
_$blocks . append ( _$blockDOM , _$blockMONTH ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_$blocks . append ( _$blockMINS ) ;
_$blocks . append ( _$blockDOW ) ;
_$blocks . append ( _$blockTIME ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// various binding
_$cross . click ( function ( ) {
_self . isDisabled ( ) || _self . clear ( ) ;
} ) ;
// binding from cron to target
_$obj . bind ( 'cron:change' , function ( evt , value ) {
if ( ! settings . bind _to ) return ;
settings . bind _method . set && settings . bind _method . set ( settings . bind _to , value ) ;
_self . clearError ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// PERIOD
_$blockPERIOD . append ( _self . getText ( 'text_period' ) ) ;
_selectorPeriod = newSelector ( _$blockPERIOD , false , 'period' ) ;
settings . enabled _minute && _selectorPeriod . add ( 'minute' , _self . getText ( 'name_minute' ) ) ;
settings . enabled _hour && _selectorPeriod . add ( 'hour' , _self . getText ( 'name_hour' ) ) ;
settings . enabled _day && _selectorPeriod . add ( 'day' , _self . getText ( 'name_day' ) ) ;
settings . enabled _week && _selectorPeriod . add ( 'week' , _self . getText ( 'name_week' ) ) ;
settings . enabled _month && _selectorPeriod . add ( 'month' , _self . getText ( 'name_month' ) ) ;
settings . enabled _year && _selectorPeriod . add ( 'year' , _self . getText ( 'name_year' ) ) ;
_selectorPeriod . $ . bind ( 'selector:change' , function ( e , value ) {
_$blockDOM . hide ( ) ;
_$blockMONTH . hide ( ) ;
_$blockMINS . hide ( ) ;
_$blockDOW . hide ( ) ;
_$blockTIME . hide ( ) ;
if ( value == 'hour' ) {
_$blockMINS . show ( ) ;
} else if ( value == 'day' ) {
_$blockTIME . show ( ) ;
} else if ( value == 'week' ) {
_$blockDOW . show ( ) ;
_$blockTIME . show ( ) ;
} else if ( value == 'month' ) {
_$blockDOM . show ( ) ;
_$blockTIME . show ( ) ;
} else if ( value == 'year' ) {
_$blockDOM . show ( ) ;
_$blockMONTH . show ( ) ;
_$blockTIME . show ( ) ;
}
} ) ;
_selectorPeriod . setValue ( settings . default _period ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// MINS (minutes)
_$blockMINS . append ( _self . getText ( 'text_mins' ) ) ;
_selectorMins = newSelector ( _$blockMINS , settings . multiple _mins , 'minutes' ) ;
for ( i = 0 , list = settings . minutes ; i < list . length ; i ++ ) {
_selectorMins . add ( list [ i ] , list [ i ] ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// TIME (hour:min)
_$blockTIME . append ( _self . getText ( 'text_time' ) ) ;
_selectorTimeH = newSelector ( _$blockTIME , settings . multiple _time _hours , 'time_hours' ) ;
for ( i = 0 , list = settings . hours , labelsList = settings . hour _labels ; i < list . length ; i ++ ) {
_selectorTimeH . add ( list [ i ] , labelsList [ i ] ) ;
}
_selectorTimeM = newSelector ( _$blockTIME , settings . multiple _time _minutes , 'time_minutes' ) ;
for ( i = 0 , list = settings . minutes ; i < list . length ; i ++ ) {
_selectorTimeM . add ( list [ i ] , list [ i ] ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// DOW (day of week)
_$blockDOW . append ( _self . getText ( 'text_dow' ) ) ;
_selectorDow = newSelector ( _$blockDOW , settings . multiple _dow , 'day_of_week' ) ;
for ( i = 0 , list = _self . getText ( 'weekdays' ) ; i < list . length ; i ++ ) {
_selectorDow . add ( i + 1 , list [ i ] ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// DOM (day of month)
_$blockDOM . append ( _self . getText ( 'text_dom' ) ) ;
_selectorDom = newSelector ( _$blockDOM , settings . multiple _dom , 'day_of_month' ) ;
for ( i = 0 , list = settings . monthdays ; i < list . length ; i ++ ) {
_selectorDom . add ( list [ i ] , list [ i ] ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// MONTH (day of week)
_$blockMONTH . append ( _self . getText ( 'text_month' ) ) ;
_selectorMonth = newSelector ( _$blockMONTH , settings . multiple _month , 'month' ) ;
for ( i = 0 , list = _self . getText ( 'months' ) ; i < list . length ; i ++ ) {
_selectorMonth . add ( i + 1 , list [ i ] ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// close all selectors when we click in body
$ ( 'body' ) . click ( function ( ) {
var i ,
n = _selectors . length ;
for ( i = 0 ; i < n ; i ++ ) {
_selectors [ i ] . close ( ) ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
_initialized = true ;
// default value
if ( settings . default _value ) {
_self . setCron ( settings . default _value ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// trigger a change event
this . triggerChange = function ( ) {
_$obj . trigger ( 'cron:change' , _self . getCron ( ) ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// store instance in array
jqCronInstances . push ( this ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// expose main jquery object
this . $ = _$obj ;
// init
try {
this . init ( ) ;
_self . triggerChange ( ) ;
} catch ( e ) { }
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . jqCron = jqCron ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
/ * *
* jqCronSelector class
* /
( function ( $ ) {
function jqCronSelector ( _cron , _$block , _multiple , _type ) {
var _self = this ;
var _$list = $ ( '<ul class="jqCron-selector-list"></ul>' ) ;
var _$title = $ ( '<span class="jqCron-selector-title"></span>' ) ;
var _$selector = $ ( '<span class="jqCron-selector"></span>' ) ;
var _values = { } ;
var _value = [ ] ;
var _hasNumericTexts = true ;
var _numeric _zero _pad = _cron . getSettings ( ) . numeric _zero _pad ;
// return an array without doublon
function array _unique ( l ) {
var i = 0 ,
n = l . length ,
k = { } ,
a = [ ] ;
while ( i < n ) {
k [ l [ i ] ] || ( k [ l [ i ] ] = true && a . push ( l [ i ] ) ) ;
i ++ ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return a ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// get the value (an array if multiple, else a single value)
this . getValue = function ( ) {
return _multiple ? _value : _value [ 0 ] ;
} ;
// get a correct string for cron
this . getCronValue = function ( ) {
if ( _value . length == 0 ) return '*' ;
var cron = [ _value [ 0 ] ] ,
i ,
s = _value [ 0 ] ,
c = _value [ 0 ] ,
n = _value . length ;
for ( i = 1 ; i < n ; i ++ ) {
if ( _value [ i ] == c + 1 ) {
c = _value [ i ] ;
cron [ cron . length - 1 ] = s + '-' + c ;
} else {
s = c = _value [ i ] ;
cron . push ( c ) ;
}
}
return cron . join ( ',' ) ;
} ;
// set the cron value
this . setCronValue = function ( str ) {
var values = [ ] ,
m ,
i ,
n ;
if ( str !== '*' ) {
while ( str != '' ) {
// test "*/n" expression
m = str . match ( /^\*\/([0-9]+),?/ ) ;
if ( m && m . length == 2 ) {
for ( i = 0 ; i <= 59 ; i += m [ 1 ] | 0 ) {
values . push ( i ) ;
}
str = str . replace ( m [ 0 ] , '' ) ;
continue ;
}
// test "a-b/n" expression
m = str . match ( /^([0-9]+)-([0-9]+)\/([0-9]+),?/ ) ;
if ( m && m . length == 4 ) {
for ( i = m [ 1 ] | 0 ; i <= ( m [ 2 ] | 0 ) ; i += m [ 3 ] | 0 ) {
values . push ( i ) ;
}
str = str . replace ( m [ 0 ] , '' ) ;
continue ;
}
// test "a-b" expression
m = str . match ( /^([0-9]+)-([0-9]+),?/ ) ;
if ( m && m . length == 3 ) {
for ( i = m [ 1 ] | 0 ; i <= ( m [ 2 ] | 0 ) ; i ++ ) {
values . push ( i ) ;
}
str = str . replace ( m [ 0 ] , '' ) ;
continue ;
}
// test "c" expression
m = str . match ( /^([0-9]+),?/ ) ;
if ( m && m . length == 2 ) {
values . push ( m [ 1 ] | 0 ) ;
str = str . replace ( m [ 0 ] , '' ) ;
continue ;
}
// something goes wrong in the expression
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
}
_self . setValue ( values ) ;
} ;
// close the selector
this . close = function ( ) {
_$selector . trigger ( 'selector:close' ) ;
} ;
// open the selector
this . open = function ( ) {
_$selector . trigger ( 'selector:open' ) ;
} ;
// whether the selector is open
this . isOpened = function ( ) {
return _$list . is ( ':visible' ) ;
} ;
// add a selected value to the list
this . addValue = function ( key ) {
var values = _multiple ? _value . slice ( 0 ) : [ ] ; // clone array
values . push ( key ) ;
_self . setValue ( values ) ;
} ;
// remove a selected value from the list
this . removeValue = function ( key ) {
if ( _multiple ) {
var i ,
newValue = [ ] ;
for ( i = 0 ; i < _value . length ; i ++ ) {
if ( key != [ _value [ i ] ] ) {
newValue . push ( _value [ i ] ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
_self . setValue ( newValue ) ;
} else {
_self . clear ( ) ;
}
} ;
// set the selected value(s) of the list
this . setValue = function ( keys ) {
var i ,
newKeys = [ ] ,
saved = _value . join ( ' ' ) ;
if ( ! $ . isArray ( keys ) ) keys = [ keys ] ;
_$list . find ( 'li' ) . removeClass ( 'selected' ) ;
keys = array _unique ( keys ) ;
keys . sort ( function ( a , b ) {
var ta = cron _ui _typeof ( a ) ;
var tb = cron _ui _typeof ( b ) ;
if ( ta == tb && ta == "number" ) return a - b ; else return String ( a ) == String ( b ) ? 0 : String ( a ) < String ( b ) ? - 1 : 1 ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
if ( _multiple ) {
for ( i = 0 ; i < keys . length ; i ++ ) {
if ( keys [ i ] in _values ) {
_values [ keys [ i ] ] . addClass ( 'selected' ) ;
newKeys . push ( keys [ i ] ) ;
}
}
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
if ( keys [ 0 ] in _values ) {
_values [ keys [ 0 ] ] . addClass ( 'selected' ) ;
newKeys . push ( keys [ 0 ] ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// remove unallowed values
_value = newKeys ;
if ( saved != _value . join ( ' ' ) ) {
_$selector . trigger ( 'selector:change' , _multiple ? keys : keys [ 0 ] ) ;
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return false ;
} ;
// get the title text
this . getTitleText = function ( ) {
var getValueText = function getValueText ( key ) {
return key in _values ? _values [ key ] . text ( ) : key ;
} ;
if ( _value . length == 0 ) {
return _cron . getText ( 'empty_' + _type ) || _cron . getText ( 'empty' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var cron = [ getValueText ( _value [ 0 ] ) ] ,
i ,
s = _value [ 0 ] ,
c = _value [ 0 ] ,
n = _value . length ;
for ( i = 1 ; i < n ; i ++ ) {
if ( _value [ i ] == c + 1 ) {
c = _value [ i ] ;
cron [ cron . length - 1 ] = getValueText ( s ) + '-' + getValueText ( c ) ;
} else {
s = c = _value [ i ] ;
cron . push ( getValueText ( c ) ) ;
}
}
return cron . join ( ',' ) ;
} ;
// clear list
this . clear = function ( ) {
_values = { } ;
_self . setValue ( [ ] ) ;
_$list . empty ( ) ;
} ;
// add a (key, value) pair
this . add = function ( key , value ) {
if ( ! ( value + '' ) . match ( /^[0-9]+$/ ) ) _hasNumericTexts = false ;
if ( _numeric _zero _pad && _hasNumericTexts && value < 10 ) {
value = '0' + value ;
}
var $item = $ ( '<li>' + value + '</li>' ) ;
_$list . append ( $item ) ;
_values [ key ] = $item ;
$item . click ( function ( ) {
if ( _multiple && $ ( this ) . hasClass ( 'selected' ) ) {
_self . removeValue ( key ) ;
} else {
_self . addValue ( key ) ;
if ( ! _multiple ) _self . close ( ) ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} ;
// expose main jquery object
this . $ = _$selector ;
// constructor
_$block . find ( 'b:eq(0)' ) . after ( _$selector ) . remove ( ) ;
_$selector . addClass ( 'jqCron-selector-' + _$block . find ( '.jqCron-selector' ) . length ) . append ( _$title ) . append ( _$list ) . bind ( 'selector:open' , function ( ) {
if ( _hasNumericTexts ) {
var nbcols = 1 ,
n = _$list . find ( 'li' ) . length ;
if ( n > 5 && n <= 16 ) nbcols = 2 ; else if ( n > 16 && n <= 23 ) nbcols = 3 ; else if ( n > 23 && n <= 40 ) nbcols = 4 ; else if ( n > 40 ) nbcols = 5 ;
_$list . addClass ( 'cols' + nbcols ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_$list . show ( ) ;
} ) . bind ( 'selector:close' , function ( ) {
_$list . hide ( ) ;
} ) . bind ( 'selector:change' , function ( ) {
_$title . html ( _self . getTitleText ( ) ) ;
} ) . click ( function ( e ) {
e . stopPropagation ( ) ;
} ) . trigger ( 'selector:change' ) ;
$ . fn . disableSelection && _$selector . disableSelection ( ) ; // only work with jQuery UI
_$title . click ( function ( e ) {
_self . isOpened ( ) || _cron . isDisabled ( ) ? _self . close ( ) : _self . open ( ) ;
} ) ;
_self . close ( ) ;
_self . clear ( ) ;
}
this . jqCronSelector = jqCronSelector ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
/ * *
* Generate unique id for each element .
* Skip elements which have already an id .
* /
( function ( $ ) {
var jqUID = 0 ;
var jqGetUID = function jqGetUID ( prefix ) {
var id ;
while ( 1 ) {
jqUID ++ ;
id = ( prefix || 'JQUID' ) + '' + jqUID ;
if ( ! document . getElementById ( id ) ) return id ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
$ . fn . uniqueId = function ( prefix ) {
return this . each ( function ( ) {
if ( $ ( this ) . attr ( 'id' ) ) return ;
var id = jqGetUID ( prefix ) ;
$ ( this ) . attr ( 'id' , id ) ;
} ) ;
} ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
/ * *
* Extends jQuery selectors with new block selector
* /
( function ( $ ) {
$ . extend ( $ . expr [ ':' ] , {
container : function container ( a ) {
return ( a . tagName + '' ) . toLowerCase ( ) in {
a : 1 ,
abbr : 1 ,
acronym : 1 ,
address : 1 ,
b : 1 ,
big : 1 ,
blockquote : 1 ,
button : 1 ,
cite : 1 ,
code : 1 ,
dd : 1 ,
del : 1 ,
dfn : 1 ,
div : 1 ,
dt : 1 ,
em : 1 ,
fieldset : 1 ,
form : 1 ,
h1 : 1 ,
h2 : 1 ,
h3 : 1 ,
h4 : 1 ,
h5 : 1 ,
h6 : 1 ,
i : 1 ,
ins : 1 ,
kbd : 1 ,
label : 1 ,
li : 1 ,
p : 1 ,
pre : 1 ,
q : 1 ,
samp : 1 ,
small : 1 ,
span : 1 ,
strong : 1 ,
sub : 1 ,
sup : 1 ,
td : 1 ,
tt : 1
} ;
} ,
autoclose : function autoclose ( a ) {
return ( a . tagName + '' ) . toLowerCase ( ) in {
area : 1 ,
base : 1 ,
basefont : 1 ,
br : 1 ,
col : 1 ,
frame : 1 ,
hr : 1 ,
img : 1 ,
input : 1 ,
link : 1 ,
meta : 1 ,
param : 1
} ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
} ) . call ( window , ( external _jQuery _default ( ) ) ) ;
; // ./app/forms/fields/cron.js
function cron _typeof ( o ) { "@babel/helpers - typeof" ; return cron _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , cron _typeof ( o ) ; }
function cron _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function cron _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , cron _toPropertyKey ( o . key ) , o ) ; } }
function cron _createClass ( e , r , t ) { return r && cron _defineProperties ( e . prototype , r ) , t && cron _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function cron _toPropertyKey ( t ) { var i = cron _toPrimitive ( t , "string" ) ; return "symbol" == cron _typeof ( i ) ? i : i + "" ; }
function cron _toPrimitive ( t , r ) { if ( "object" != cron _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != cron _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var CronField = /*#__PURE__*/ function ( ) {
function CronField ( ) {
var _this = this ;
cron _classCallCheck ( this , CronField ) ;
this . items = external _jQuery _default ( ) ( ) ;
external _jQuery _default ( ) ( '[data-grav-field="cron"]' ) . each ( function ( index , cron ) {
return _this . addCron ( cron ) ;
} ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'mutation._grav' , this . _onAddedNodes . bind ( this ) ) ;
}
return cron _createClass ( CronField , [ {
key : "addCron" ,
value : function addCron ( cron ) {
cron = external _jQuery _default ( ) ( cron ) ;
this . items = this . items . add ( cron ) ;
cron . find ( '.cron-selector' ) . each ( function ( index , container ) {
container = external _jQuery _default ( ) ( container ) ;
var input = container . closest ( '[data-grav-field]' ) . find ( 'input' ) ;
container . jqCron ( {
numeric _zero _pad : true ,
enabled _minute : true ,
multiple _dom : true ,
multiple _month : true ,
multiple _mins : true ,
multiple _dow : true ,
multiple _time _hours : true ,
multiple _time _minutes : true ,
default _period : 'hour' ,
default _value : input . val ( ) || '* * * * *' ,
no _reset _button : false ,
bind _to : input ,
bind _method : {
set : function set ( $element , value ) {
$element . val ( value ) ;
}
} ,
texts : {
en : {
empty : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY' ] ,
empty _minutes : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY' ] ,
empty _time _hours : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY_HOUR' ] ,
empty _time _minutes : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY_MINUTE' ] ,
empty _day _of _week : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY_DAY_OF_WEEK' ] ,
empty _day _of _month : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY_DAY_OF_MONTH' ] ,
empty _month : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.EVERY_MONTH' ] ,
name _minute : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.MINUTE' ] ,
name _hour : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.HOUR' ] ,
name _day : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.DAY' ] ,
name _week : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.WEEK' ] ,
name _month : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.MONTH' ] ,
name _year : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'NICETIME.YEAR' ] ,
text _period : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_PERIOD' ] ,
text _mins : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_MINS' ] ,
text _time : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_TIME' ] ,
text _dow : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_DOW' ] ,
text _month : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_MONTH' ] ,
text _dom : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.TEXT_DOM' ] ,
error1 : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.ERROR1' ] ,
error2 : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.ERROR2' ] ,
error3 : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.ERROR3' ] ,
error4 : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'CRON.ERROR4' ] ,
weekdays : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'DAYS_OF_THE_WEEK' ] ,
months : external _GravAdmin _namespaceObject . translations . GRAV _CORE [ 'MONTHS_OF_THE_YEAR' ]
}
}
} ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
key : "_onAddedNodes" ,
value : function _onAddedNodes ( event , target /* , record, instance */ ) {
2025-10-18 13:48:40 -06:00
var _this2 = this ;
var crons = external _jQuery _default ( ) ( target ) . find ( '[data-grav-field="cron"]' ) ;
if ( ! crons . length ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
crons . each ( function ( index , list ) {
2025-10-16 10:59:50 -06:00
list = external _jQuery _default ( ) ( list ) ;
2025-10-18 13:48:40 -06:00
if ( ! ~ _this2 . items . index ( list ) ) {
_this2 . addCron ( list ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var cron _Instance = new CronField ( ) ;
// EXTERNAL MODULE: ./node_modules/eventemitter3/index.mjs
var eventemitter3 = _ _webpack _require _ _ ( 74486 ) ;
; // ./app/utils/finderjs.js
function finderjs _typeof ( o ) { "@babel/helpers - typeof" ; return finderjs _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , finderjs _typeof ( o ) ; }
function finderjs _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function finderjs _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , finderjs _toPropertyKey ( o . key ) , o ) ; } }
function finderjs _createClass ( e , r , t ) { return r && finderjs _defineProperties ( e . prototype , r ) , t && finderjs _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function finderjs _toPropertyKey ( t ) { var i = finderjs _toPrimitive ( t , "string" ) ; return "symbol" == finderjs _typeof ( i ) ? i : i + "" ; }
function finderjs _toPrimitive ( t , r ) { if ( "object" != finderjs _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != finderjs _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
/ * *
* ( c ) Trilby Media , LLC
* Author Djamil Legato
*
* Based on Mark Matyas ' s Finderjs
* MIT License
* /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var DEFAULTS = {
labelKey : 'name' ,
valueKey : 'value' ,
// new
childKey : 'children' ,
iconKey : 'icon' ,
// new
itemKey : 'item-key' ,
// new
pathBar : true ,
className : {
container : 'fjs-container' ,
pathBar : 'fjs-path-bar' ,
col : 'fjs-col' ,
list : 'fjs-list' ,
item : 'fjs-item' ,
active : 'fjs-active' ,
children : 'fjs-has-children' ,
url : 'fjs-url' ,
itemPrepend : 'fjs-item-prepend' ,
itemContent : 'fjs-item-content' ,
itemAppend : 'fjs-item-append'
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
var Finder = /*#__PURE__*/ function ( ) {
function Finder ( container , data , options ) {
var _this = this ;
finderjs _classCallCheck ( this , Finder ) ;
this . $emitter = new eventemitter3 /* default */ . A ( ) ;
this . container = external _jQuery _default ( ) ( container ) ;
this . data = data ;
this . config = external _jQuery _default ( ) . extend ( { } , DEFAULTS , options ) ;
// dom events
this . container . on ( 'click' , this . clickEvent . bind ( this ) ) ;
this . container . on ( 'keydown' , this . keydownEvent . bind ( this ) ) ;
// internal events
this . $emitter . on ( 'item-selected' , this . itemSelected . bind ( this ) ) ;
this . $emitter . on ( 'create-column' , this . addColumn . bind ( this ) ) ;
this . $emitter . on ( 'navigate' , this . navigate . bind ( this ) ) ;
this . $emitter . on ( 'go-to' , this . goTo . bind ( this , this . data ) ) ;
this . container . addClass ( this . config . className . container ) . attr ( 'tabindex' , 0 ) ;
this . createColumn ( this . data ) ;
if ( this . config . pathBar ) {
this . pathBar = this . createPathBar ( ) ;
this . pathBar . on ( 'click' , '[data-breadcrumb-node]' , function ( event ) {
event . preventDefault ( ) ;
var location = external _jQuery _default ( ) ( event . currentTarget ) . data ( 'breadcrumbNode' ) ;
_this . goTo ( _this . data , location ) ;
} ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// '' is <Root>
if ( this . config . defaultPath || this . config . defaultPath === '' ) {
this . goTo ( this . data , this . config . defaultPath ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
return finderjs _createClass ( Finder , [ {
key : "reload" ,
value : function reload ( ) {
var data = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : this . data ;
this . createColumn ( data ) ;
// '' is <Root>
if ( this . config . defaultPath || this . config . defaultPath === '' ) {
this . goTo ( data , this . config . defaultPath ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "createColumn" ,
value : function createColumn ( data , parent ) {
var _this2 = this ;
var callback = function callback ( data ) {
return _this2 . createColumn ( data , parent ) ;
} ;
if ( typeof data === 'function' ) {
data . call ( this , parent , callback ) ;
} else if ( Array . isArray ( data ) || finderjs _typeof ( data ) === 'object' ) {
if ( finderjs _typeof ( data ) === 'object' ) {
data = Array . from ( data ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var list = this . createList ( data ) ;
var div = external _jQuery _default ( ) ( '<div />' ) ;
div . append ( list ) . addClass ( this . config . className . col ) ;
this . $emitter . emit ( 'create-column' , div ) ;
return div ;
} else {
throw new Error ( 'Unknown data type' ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "createPathBar" ,
value : function createPathBar ( ) {
this . container . siblings ( "." . concat ( this . config . className . pathBar ) ) . remove ( ) ;
var pathBar = external _jQuery _default ( ) ( "<div class=\"" . concat ( this . config . className . pathBar , "\" />" ) ) ;
pathBar . insertAfter ( this . container ) ;
return pathBar ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "clickEvent" ,
value : function clickEvent ( event ) {
event . stopPropagation ( ) ;
event . preventDefault ( ) ;
var target = external _jQuery _default ( ) ( event . target ) ;
var column = target . closest ( "." . concat ( this . config . className . col ) ) ;
var item = target . closest ( "." . concat ( this . config . className . item ) ) ;
if ( item . length ) {
this . $emitter . emit ( 'item-selected' , {
column : column ,
item : item
} ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "keydownEvent" ,
value : function keydownEvent ( event ) {
var codes = {
37 : 'left' ,
38 : 'up' ,
39 : 'right' ,
40 : 'down'
} ;
if ( event . keyCode in codes ) {
event . stopPropagation ( ) ;
event . preventDefault ( ) ;
this . $emitter . emit ( 'navigate' , {
direction : codes [ event . keyCode ]
} ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "itemSelected" ,
value : function itemSelected ( value ) {
var element = value . item ;
if ( ! element . length ) {
return false ;
}
var item = element [ 0 ] . _item ;
var column = value . column ;
var data = item [ this . config . childKey ] || this . data ;
var active = external _jQuery _default ( ) ( column ) . find ( "." . concat ( this . config . className . active ) ) ;
if ( active . length ) {
active . removeClass ( this . config . className . active ) ;
}
element . addClass ( this . config . className . active ) ;
column . nextAll ( ) . remove ( ) ; // ?!?!?
this . container [ 0 ] . focus ( ) ;
window . scrollTo ( window . pageXOffset , window . pageYOffset ) ;
this . updatePathBar ( ) ;
var newColumn ;
if ( data ) {
newColumn = this . createColumn ( data , item ) ;
this . $emitter . emit ( 'interior-selected' , item ) ;
} else {
this . $emitter . emit ( 'leaf-selected' , item ) ;
}
return newColumn ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "addColumn" ,
value : function addColumn ( column ) {
this . container . append ( column ) ;
this . $emitter . emit ( 'column-created' , column ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "navigate" ,
value : function navigate ( value ) {
var active = this . findLastActive ( ) ;
var direction = value . direction ;
var column ;
var item ;
var target ;
if ( active ) {
item = active . item ;
column = active . column ;
if ( direction === 'up' && item . prev ( ) . length ) {
target = item . prev ( ) ;
} else if ( direction === 'down' && item . next ( ) . length ) {
target = item . next ( ) ;
} else if ( direction === 'right' && column . next ( ) . length ) {
column = column . next ( ) ;
target = column . find ( "." . concat ( this . config . className . item ) ) . first ( ) ;
} else if ( direction === 'left' && column . prev ( ) . length ) {
column = column . prev ( ) ;
target = column . find ( "." . concat ( this . config . className . active ) ) . first ( ) || column . find ( "." . concat ( this . config . className . item ) ) ;
}
} else {
column = this . container . find ( "." . concat ( this . config . className . col ) ) . first ( ) ;
target = column . find ( "." . concat ( this . config . className . item ) ) . first ( ) ;
}
if ( target ) {
this . $emitter . emit ( 'item-selected' , {
column : column ,
item : target
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "goTo" ,
value : function goTo ( data , path ) {
2025-10-16 10:59:50 -06:00
var _this3 = this ;
2025-10-18 13:48:40 -06:00
path = Array . isArray ( path ) ? path : path . split ( '/' ) . map ( function ( bit ) {
return bit . trim ( ) ;
} ) . filter ( Boolean ) ;
if ( path . length ) {
this . container . children ( ) . remove ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof data === 'function' ) {
data . call ( this , null , function ( data ) {
return _this3 . selectPath ( path , data ) ;
} ) ;
} else {
this . selectPath ( path , data ) ;
}
}
} , {
key : "selectPath" ,
value : function selectPath ( path , data , column ) {
var _this4 = this ;
column = column || ( path . length ? this . createColumn ( data ) : this . container . find ( "> ." . concat ( this . config . className . col ) ) ) ;
var current = path [ 0 ] || '' ;
var children = data . find ( function ( item ) {
return item [ _this4 . config . itemKey ] === current ;
} ) ;
var newColumn = this . itemSelected ( {
column : column ,
item : column . find ( "[data-fjs-item=\"" . concat ( current , "\"]" ) ) . first ( )
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
path . shift ( ) ;
if ( path . length && children ) {
this . selectPath ( path , children [ this . config . childKey ] , newColumn ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "findLastActive" ,
value : function findLastActive ( ) {
var active = this . container . find ( "." . concat ( this . config . className . active ) ) ;
if ( ! active . length ) {
return null ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var item = active . last ( ) ;
var column = item . closest ( "." . concat ( this . config . className . col ) ) ;
return {
item : item ,
column : column
} ;
}
} , {
key : "createList" ,
value : function createList ( data ) {
var _this5 = this ;
var list = external _jQuery _default ( ) ( '<ul />' ) ;
var items = data . map ( function ( item ) {
return _this5 . createItem ( item ) ;
} ) ;
var fragments = items . reduce ( function ( fragment , current ) {
fragment . appendChild ( current [ 0 ] || current ) ;
return fragment ;
} , document . createDocumentFragment ( ) ) ;
list . append ( fragments ) . addClass ( this . config . className . list ) ;
return list ;
}
} , {
key : "createItem" ,
value : function createItem ( item ) {
var listItem = external _jQuery _default ( ) ( '<li />' ) ;
var listItemClasses = [ this . config . className . item ] ;
var link = external _jQuery _default ( ) ( '<a />' ) ;
var createItemContent = this . config . createItemContent || this . createItemContent ;
var fragment = createItemContent . call ( this , item ) ;
link . append ( fragment ) . attr ( 'href' , '' ) . attr ( 'tabindex' , - 1 ) ;
if ( item . url ) {
link . attr ( 'href' , item . url ) ;
listItemClasses . push ( item . className ) ;
}
if ( item [ this . config . childKey ] ) {
listItemClasses . push ( this . config . className [ this . config . childKey ] ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
listItemClasses . push ( "fjs-item-" . concat ( item . type ) ) ;
listItem . addClass ( listItemClasses . join ( ' ' ) ) ;
listItem . append ( link ) . attr ( 'data-fjs-item' , item [ this . config . itemKey ] ) ;
listItem [ 0 ] . _item = item ;
return listItem ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "updatePathBar" ,
value : function updatePathBar ( ) {
var _this6 = this ;
if ( ! this . config . pathBar ) {
return false ;
}
var activeItems = this . container . find ( "." . concat ( this . config . className . active ) ) ;
var itemKeys = '' ;
this . pathBar . children ( ) . empty ( ) ;
activeItems . each ( function ( index , activeItem ) {
var item = activeItem . _item ;
var isLast = index + 1 === activeItems . length ;
itemKeys += "/" . concat ( item [ _this6 . config . itemKey ] ) ;
_this6 . pathBar . append ( "\n <span class=\"breadcrumb-node breadcrumb-node-" . concat ( item . type , "\" " ) . concat ( item . type === 'dir' ? "data-breadcrumb-node=\"" . concat ( itemKeys , "\"" ) : '' , ">\n <i class=\"fa fa-fw " ) . concat ( _this6 . getIcon ( item . type ) , "\"></i>\n <span class=\"breadcrumb-node-name\">" ) . concat ( external _jQuery _default ( ) ( '<div />' ) . html ( item [ _this6 . config . labelKey ] ) . html ( ) , "</span>\n " ) . concat ( ! isLast ? '<i class="fa fa-fw fa-chevron-right"></i>' : '' , "\n </span>\n " ) ) ;
} ) ;
}
} , {
key : "getIcon" ,
value : function getIcon ( type ) {
switch ( type ) {
case 'root' :
return 'fa-sitemap' ;
case 'file' :
return 'fa-file-o' ;
case 'dir' :
default :
return 'fa-folder' ;
}
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
/* harmony default export */ const finderjs = ( Finder ) ;
; // ./app/forms/fields/parents.js
function parents _typeof ( o ) { "@babel/helpers - typeof" ; return parents _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , parents _typeof ( o ) ; }
function parents _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function parents _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , parents _toPropertyKey ( o . key ) , o ) ; } }
function parents _createClass ( e , r , t ) { return r && parents _defineProperties ( e . prototype , r ) , t && parents _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function parents _toPropertyKey ( t ) { var i = parents _toPrimitive ( t , "string" ) ; return "symbol" == parents _typeof ( i ) ? i : i + "" ; }
function parents _toPrimitive ( t , r ) { if ( "object" != parents _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != parents _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var XHRUUID = 0 ;
var parents _Instances = { } ;
var Parents = /*#__PURE__*/ function ( ) {
function Parents ( container , field , data ) {
2025-10-16 10:59:50 -06:00
var _this = this ;
2025-10-18 13:48:40 -06:00
parents _classCallCheck ( this , Parents ) ;
this . container = external _jQuery _default ( ) ( container ) ;
this . fieldName = field . attr ( 'name' ) ;
this . field = external _jQuery _default ( ) ( "[name=\"" . concat ( this . fieldName , "\"]" ) ) ;
this . data = data ;
this . parentLabel = external _jQuery _default ( ) ( "[data-parents-field-label=\"" . concat ( this . fieldName , "\"]" ) ) ;
this . parentName = external _jQuery _default ( ) ( "[data-parents-field-name=\"" . concat ( this . fieldName , "\"]" ) ) ;
var dataLoad = this . dataLoad ;
this . finder = new finderjs ( this . container , function ( parent , callback ) {
return dataLoad . call ( _this , parent , callback ) ;
} , {
labelKey : 'name' ,
defaultPath : this . field . val ( ) ,
createItemContent : function createItemContent ( item ) {
return Parents . createItemContent ( this . config , item ) ;
}
} ) ;
/ *
this . finder . $emitter . on ( 'leaf-selected' , ( item ) => {
console . log ( 'selected' , item ) ;
this . finder . emit ( 'create-column' , ( ) => this . createSimpleColumn ( item ) ) ;
} ) ;
this . finder . $emitter . on ( 'item-selected' , ( selected ) => {
console . log ( 'selected' , selected ) ;
// for future use only - create column-card creation for file with details like in macOS finder
// this.finder.$emitter('create-column', () => this.createSimpleColumn(selected));
} ) ; * /
this . finder . $emitter . on ( 'column-created' , function ( ) {
_this . container [ 0 ] . scrollLeft = _this . container [ 0 ] . scrollWidth - _this . container [ 0 ] . clientWidth ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
return parents _createClass ( Parents , [ {
key : "createSimpleColumn" ,
value : function createSimpleColumn ( item ) { }
} , {
key : "dataLoad" ,
value : function dataLoad ( parent , callback ) {
var _this2 = this ;
if ( ! parent ) {
return callback ( this . data ) ;
}
if ( parent . type !== 'dir' || ! parent [ 'has-children' ] ) {
return false ;
}
var UUID = ++ XHRUUID ;
this . startLoader ( ) ;
external _jQuery _default ( ) . ajax ( {
url : "" . concat ( external _GravAdmin _namespaceObject . config . current _url ) ,
method : 'post' ,
data : Object . assign ( { } , getExtraFormData ( this . container ) , {
route : b64 _encode _unicode ( parent . value ) ,
field : this . field . data ( 'fieldName' ) ,
action : 'getLevelListing' ,
'admin-nonce' : external _GravAdmin _namespaceObject . config . admin _nonce
} ) ,
success : function success ( response ) {
_this2 . stopLoader ( ) ;
if ( response . status === 'error' ) {
_this2 . finder . $emitter . emit ( 'create-column' , Parents . createErrorColumn ( response . message ) [ 0 ] ) ;
return false ;
}
// stale request
if ( UUID !== XHRUUID ) {
return false ;
}
return callback ( response . data ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "startLoader" ,
value : function startLoader ( ) {
this . loadingIndicator = Parents . createLoadingColumn ( ) ;
this . finder . $emitter . emit ( 'create-column' , this . loadingIndicator [ 0 ] ) ;
return this . loadingIndicator ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "stopLoader" ,
value : function stopLoader ( ) {
return this . loadingIndicator && this . loadingIndicator . remove ( ) ;
}
} ] , [ {
key : "createItemContent" ,
value : function createItemContent ( config , item ) {
var frag = document . createDocumentFragment ( ) ;
var label = external _jQuery _default ( ) ( "<span title=\"" . concat ( item [ config . labelKey ] , "\" />" ) ) ;
var infoContainer = external _jQuery _default ( ) ( '<span class="info-container" />' ) ;
var iconPrepend = external _jQuery _default ( ) ( '<i />' ) ;
var iconAppend = external _jQuery _default ( ) ( '<i />' ) ;
var badge = external _jQuery _default ( ) ( '<span class="badge" />' ) ;
var prependClasses = [ 'fa' ] ;
var appendClasses = [ 'fa' ] ;
// prepend icon
if ( item . children || item . type === 'dir' ) {
prependClasses . push ( 'fa-folder' ) ;
} else if ( item . type === 'root' ) {
prependClasses . push ( 'fa-sitemap' ) ;
} else if ( item . type === 'file' ) {
prependClasses . push ( 'fa-file-o' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
iconPrepend . addClass ( prependClasses . join ( ' ' ) ) ;
// text label
label . text ( item [ config . labelKey ] ) . prepend ( iconPrepend ) ;
label . appendTo ( frag ) ;
// append icon
if ( item . children || item [ 'has-children' ] ) {
appendClasses . push ( 'fa-caret-right' ) ;
badge . text ( item . size || item . count || 0 ) ;
badge . appendTo ( infoContainer ) ;
}
iconAppend . addClass ( appendClasses . join ( ' ' ) ) ;
iconAppend . appendTo ( infoContainer ) ;
infoContainer . appendTo ( frag ) ;
return frag ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "createLoadingColumn" ,
value : function createLoadingColumn ( ) {
return external _jQuery _default ( ) ( "\n <div class=\"fjs-col leaf-col\" style=\"overflow: hidden;\">\n <div class=\"leaf-row\">\n <div class=\"grav-loading\"><div class=\"grav-loader\">Loading...</div></div>\n </div>\n </div>\n " ) ;
}
} , {
key : "createErrorColumn" ,
value : function createErrorColumn ( error ) {
return external _jQuery _default ( ) ( "\n <div class=\"fjs-col leaf-col\" style=\"overflow: hidden;\">\n <div class=\"leaf-row error\">\n <i class=\"fa fa-fw fa-warning\"></i>\n <span>" . concat ( error , "</span>\n </div>\n </div>\n " ) ) ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var b64 _encode _unicode = function b64 _encode _unicode ( str ) {
return btoa ( encodeURIComponent ( str ) . replace ( /%([0-9A-F]{2})/g , function toSolidBytes ( match , p1 ) {
return String . fromCharCode ( '0x' + p1 ) ;
} ) ) ;
} ;
var b64 _decode _unicode = function b64 _decode _unicode ( str ) {
return decodeURIComponent ( atob ( str ) . split ( '' ) . map ( function ( c ) {
return '%' + ( '00' + c . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 2 ) ;
} ) . join ( '' ) ) ;
} ;
var getExtraFormData = function getExtraFormData ( container ) {
var form = container . closest ( 'form' ) ;
if ( container . closest ( '[data-remodal-id]' ) . length ) {
form = external _jQuery _default ( ) ( 'form#blueprints' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var data = { } ;
var unique _id = form . find ( '[name="__unique_form_id__"]' ) ;
data [ '__form-name__' ] = form . find ( '[name="__form-name__"]' ) . val ( ) ;
data [ 'form-nonce' ] = form . find ( '[name="form-nonce"]' ) . val ( ) ;
if ( unique _id . length ) {
data [ '__unique_form_id__' ] = unique _id . val ( ) ;
}
return data ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-parents]' , function ( event ) {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var field = target . closest ( '.parents-wrapper' ) . find ( 'input[name]' ) ;
var fieldName = field . attr ( 'name' ) ;
if ( ! field . length ) {
fieldName = target . data ( 'parents' ) ;
field = external _jQuery _default ( ) ( "[name=\"" . concat ( target . data ( 'parents' ) , "\"]" ) ) . first ( ) ;
}
var modal = external _jQuery _default ( ) ( "[data-remodal-id=\"" . concat ( target . data ( 'remodalTarget' ) || 'parents' , "\"]" ) ) ;
var loader = modal . find ( '.grav-loading' ) ;
var content = modal . find ( '.parents-content' ) ;
loader . css ( 'display' , 'block' ) ;
content . html ( '' ) ;
external _jQuery _default ( ) . ajax ( {
url : "" . concat ( external _GravAdmin _namespaceObject . config . current _url ) ,
method : 'post' ,
data : Object . assign ( { } , getExtraFormData ( target ) , {
route : b64 _encode _unicode ( field . val ( ) ) ,
field : field . data ( 'fieldName' ) ,
action : 'getLevelListing' ,
'admin-nonce' : external _GravAdmin _namespaceObject . config . admin _nonce ,
initial : true
} ) ,
success : function success ( response ) {
loader . css ( 'display' , 'none' ) ;
if ( response . status === 'error' ) {
content . html ( response . message ) ;
return true ;
}
if ( ! parents _Instances [ "" . concat ( fieldName , "-" ) . concat ( modal . data ( 'remodalId' ) ) ] ) {
parents _Instances [ "" . concat ( fieldName , "-" ) . concat ( modal . data ( 'remodalId' ) ) ] = new Parents ( content , field , response . data ) ;
} else {
parents _Instances [ "" . concat ( fieldName , "-" ) . concat ( modal . data ( 'remodalId' ) ) ] . finder . reload ( response . data ) ;
}
modal . data ( 'parents' , parents _Instances [ "" . concat ( fieldName , "-" ) . concat ( modal . data ( 'remodalId' ) ) ] ) ;
modal . data ( 'parents-selectedField' , field ) ;
}
} ) ;
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// apply finder selection to field
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-remodal-id].parents-container [data-parents-select]' , function ( event ) {
var modal = external _jQuery _default ( ) ( event . currentTarget ) . closest ( '[data-remodal-id]' ) ;
var parents = modal . data ( 'parents' ) ;
var selectedField = modal . data ( 'parentsSelectedField' ) ;
var finder = parents . finder ;
var field = parents . field ;
var parentLabel = parents . parentLabel ;
var parentName = parents . parentName ;
var selection = finder . findLastActive ( ) . item [ 0 ] ;
var value = selection . _item [ finder . config . valueKey ] ;
var name = selection . _item [ finder . config . labelKey ] ;
if ( selectedField . closest ( '.remodal' ) . length ) {
var index = field . index ( selectedField ) ;
selectedField . val ( value ) ;
external _jQuery _default ( ) ( parentLabel [ index ] ) . text ( value ) ;
external _jQuery _default ( ) ( parentName [ index ] ) . text ( name ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
field . val ( value ) ;
parentLabel . text ( value ) ;
parentName . text ( name ) ;
finder . config . defaultPath = value ;
}
var remodal = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( "[data-remodal-id=\"" . concat ( modal . data ( 'remodalId' ) , "\"]" ) ) . data ( 'remodal' ) ] ;
remodal . close ( ) ;
} ) ;
; // ./app/forms/fields/acl-picker.js
var acl _picker _body = external _jQuery _default ( ) ( 'body' ) ;
acl _picker _body . on ( 'change' , '[data-acl_picker] select' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var value = target . val ( ) ;
var item = target . closest ( '.permissions-item' ) ;
var inputs = item . find ( 'input[type="checkbox"], input[type="radio"]' ) ;
var hidden = item . find ( 'input[type="hidden"][name]' ) ;
var wrapper = target . closest ( '[data-acl_picker_id]' ) ;
var type = item . data ( 'fieldType' ) ;
if ( type === 'access' ) {
inputs . each ( function ( index , input ) {
input = external _jQuery _default ( ) ( input ) ;
var name = input . prop ( 'name' ) ;
input . prop ( 'name' , name . replace ( /(.*)(\[[^\]]*\])/ , "$1[" . concat ( value , "]" ) ) ) ;
} ) ;
} else if ( type === 'permissions' ) {
var crudpContainer = item . find ( '[data-field-name]' ) ;
inputs . each ( function ( index , input ) {
input = external _jQuery _default ( ) ( input ) ;
var rand = Math . round ( Math . random ( ) * 500 ) ;
var name = crudpContainer . data ( 'fieldName' ) ;
var id = input . prop ( 'id' ) . split ( '_' ) . slice ( 0 , - 1 ) . join ( '_' ) + "_" . concat ( value , "+" ) . concat ( rand ) ;
// const key = input.data('crudpKey');
hidden . prop ( 'name' , name . replace ( /(.*)(\[[^\]]*\])/ , "$1[" . concat ( value , "]" ) ) ) ;
input . prop ( 'id' , id ) ;
input . next ( 'label' ) . prop ( 'for' , id ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
wrapper . find ( '.permissions-item .button.add-item' ) [ ! value ? 'addClass' : 'removeClass' ] ( 'disabled' ) . prop ( 'disabled' , ! value ? 'disabled' : null ) ;
} ) ;
acl _picker _body . on ( 'input' , 'input[data-crudp-key]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var container = target . closest ( '.crudp-container' ) ;
var hidden = container . find ( 'input[type="hidden"][name]' ) ;
var key = target . data ( 'crudpKey' ) ;
var json = JSON . parse ( hidden . val ( ) || '{}' ) ;
json [ key ] = target . val ( ) ;
hidden . val ( JSON . stringify ( json ) ) ;
} ) ;
acl _picker _body . on ( 'click' , '[data-acl_picker] .remove-item' , function ( event ) {
event . preventDefault ( ) ;
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var container = target . closest ( '.permissions-item' ) ;
var wrapper = target . closest ( '[data-acl_picker_id]' ) ;
container . remove ( ) ;
var empty = wrapper . find ( '.permissions-item' ) . length === 1 ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// show the initial + button
if ( empty ) {
wrapper . find ( '.permissions-item.empty-list' ) . removeClass ( 'hidden' ) ;
}
} ) ;
acl _picker _body . on ( 'click' , '[data-acl_picker] .add-item' , function ( event ) {
event . preventDefault ( ) ;
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var item = target . closest ( '.permissions-item' ) ;
var wrapper = target . closest ( '[data-acl_picker_id]' ) ;
var ID = wrapper . data ( 'acl_picker_id' ) ;
var template = document . querySelector ( "template[data-id=\"acl_picker-" . concat ( ID , "\"]" ) ) ;
var clone = external _jQuery _default ( ) ( template . content . firstElementChild ) . clone ( ) ;
clone . insertAfter ( item ) ;
// randomize ids
clone . find ( '.switch-toggle input[type="radio"]' ) . each ( function ( index , input ) {
input = external _jQuery _default ( ) ( input ) ;
var id = input . prop ( 'id' ) ;
var label = input . next ( 'label' ) ;
var rand = ( Date . now ( ) . toString ( 36 ) + Math . random ( ) . toString ( 36 ) . substr ( 2 , 5 ) ) . toLowerCase ( ) ;
input . prop ( 'id' , "" . concat ( id ) . concat ( rand ) ) ;
label . prop ( 'for' , "" . concat ( id ) . concat ( rand ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// hide the initial + button
wrapper . find ( '.permissions-item.empty-list' ) . addClass ( 'hidden' ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// disable all + buttons until one is selected
wrapper . find ( '.permissions-item .button.add-item' ) . addClass ( 'disabled' ) . prop ( 'disabled' , 'disabled' ) ;
} ) ;
; // ./app/forms/fields/permissions.js
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
var permissions _body = external _jQuery _default ( ) ( 'body' ) ;
var radioSelector = '.permission-container.parent-section input[type="radio"]' ;
var handleParent = function handleParent ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var value = target . val ( ) ;
var container = target . closest ( '.parent-section' ) ;
var fieldset = container . next ( 'fieldset' ) ;
var radios = fieldset . find ( "input[type=\"radio\"][value=\"" . concat ( value , "\"]" ) ) ;
if ( container . data ( 'isLocked' ) !== false ) {
container . data ( 'isUpdating' , true ) ;
radios . each ( function ( index , radio ) {
var ID = radio . id ;
external _jQuery _default ( ) ( radio ) . siblings ( "[for=\"" . concat ( ID , "\"]" ) ) . trigger ( 'click' ) ;
} ) ;
container . data ( 'isUpdating' , false ) ;
}
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var boundHandleParent = handleParent . bind ( handleParent ) ;
permissions _body . on ( 'click' , '.permission-container.parent-section label' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var container = target . closest ( '.parent-section' ) ;
container . data ( 'isLocked' , true ) ;
} ) ;
permissions _body . on ( 'input' , radioSelector , boundHandleParent ) ;
permissions _body . on ( 'input' , '.permissions-container input[type="radio"][data-parent-id]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var parent = external _jQuery _default ( ) ( "[for=\"" . concat ( target . data ( 'parentId' ) , "\"]" ) ) ;
var container = target . closest ( 'fieldset' ) . prev ( '.permission-container.parent-section' ) ;
if ( container . data ( 'isUpdating' ) === true ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
permissions _body . off ( 'input' , radioSelector , boundHandleParent ) ;
container . data ( 'isLocked' , false ) ;
parent . trigger ( 'click' ) ;
permissions _body . on ( 'input' , radioSelector , boundHandleParent ) ;
} ) ;
; // ./app/forms/fields/indeterminate.js
document . addEventListener ( 'click' , function ( event ) {
if ( document . querySelector ( '#pages-filters' ) ) {
return true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var wrapper = event . target . closest ( '.checkboxes.indeterminate' ) ;
if ( wrapper ) {
event . preventDefault ( ) ;
var checkbox = wrapper . querySelector ( 'input[type="checkbox"]:not([disabled])' ) ;
var checkStatus = wrapper . dataset . _checkStatus ;
wrapper . classList . remove ( 'status-checked' , 'status-unchecked' , 'status-indeterminate' ) ;
switch ( checkStatus ) {
// checked, going indeterminate
case '1' :
wrapper . dataset . _checkStatus = '2' ;
checkbox . indeterminate = true ;
checkbox . checked = false ;
checkbox . value = 0 ;
wrapper . classList . add ( 'status-indeterminate' ) ;
break ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// indeterminate, going unchecked
case '2' :
wrapper . dataset . _checkStatus = '0' ;
checkbox . indeterminate = false ;
checkbox . checked = false ;
checkbox . value = '' ;
wrapper . classList . add ( 'status-unchecked' ) ;
break ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// unchecked, going checked
case '0' :
default :
wrapper . dataset . _checkStatus = '1' ;
checkbox . indeterminate = false ;
checkbox . checked = true ;
checkbox . value = 1 ;
wrapper . classList . add ( 'status-checked' ) ;
break ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// const input = new CustomEvent('input', { detail: { target: checkbox }});
// document.dispatchEvent(input);
external _jQuery _default ( ) ( checkbox ) . trigger ( 'input' ) ;
}
} ) ;
( document . querySelectorAll ( 'input[type="checkbox"][indeterminate="true"]' ) || [ ] ) . forEach ( function ( input ) {
input . indeterminate = true ;
} ) ;
; // ./app/forms/fields/mediapicker.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( function ( ) {
var modal = '' ;
var body = external _jQuery _default ( ) ( 'body' ) ;
// Thumb Resizer
external _jQuery _default ( ) ( document ) . on ( 'input change' , '.media-container .media-range' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var container = target . closest ( '.remodal' ) ;
var cards = container . find ( '.media-container div.card-item' ) ;
var width = target . val ( ) + 'px' ;
cards . each ( function ( ) {
external _jQuery _default ( ) ( this ) . css ( 'width' , width ) ;
} ) ;
} ) ;
body . on ( 'click' , '[data-mediapicker-modal-trigger]' , function ( event ) {
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
var modal _identifier = external _jQuery _default ( ) ( this ) . data ( 'grav-mediapicker-unique-identifier' ) ;
var modal _element = body . find ( "[data-remodal-unique-identifier=\"" . concat ( modal _identifier , "\"]" ) ) ;
modal = ( external _jQuery _default ( ) ) . remodal . lookup [ modal _element . data ( 'remodal' ) ] ;
if ( ! modal ) {
modal _element . remodal ( ) ;
modal = ( external _jQuery _default ( ) ) . remodal . lookup [ modal _element . data ( 'remodal' ) ] ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
modal . open ( ) ;
modal . dataField = element . find ( 'input' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// load all media
modal _element . find ( '.js__files' ) . trigger ( 'fillView' ) ;
setTimeout ( function ( ) {
return tree _Instance . reload ( ) ;
} , 100 ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle media modal click actions */
body . on ( 'click' , '[data-remodal-mediapicker] .media-container.in-modal .admin-media-details a' , function ( event ) {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
var val = external _jQuery _default ( ) ( event . target ) . parents ( '.js__media-element' ) . data ( 'file-url' ) ;
var string = val . replace ( / /g , '%20' ) ;
modal . dataField . val ( string ) ;
modal . close ( ) ;
} ) ;
} ) ;
; // ./app/forms/fields/multilevel.js
external _jQuery _default ( ) ( function ( ) {
var getField = function getField ( level , name ) {
var levelMargin = level * 50 ;
var top = level === 0 ? 'top' : '' ;
var the _name = 'name="' + name + '"' ;
if ( level === 0 ) {
// top
the _name = 'data-attr-name="' + name + '"' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var marginDir = window . getComputedStyle ( document . body ) . direction === 'ltr' ? 'margin-left' : 'margin-right' ;
var field = "\n <div class=\"element-wrapper\">\n <div class=\"form-row array-field-value_only js__multilevel-field " . concat ( top , "\"\n data-grav-array-type=\"row\">\n <input\n type=\"text\"\n " ) . concat ( the _name , "\n placeholder=\"Enter value\"\n style=\"" ) . concat ( marginDir , ": " ) . concat ( levelMargin , "px\"\n value=\"\" />\n\n <span class=\"fa fa-minus js__remove-item\"></span>\n <span class=\"fa fa-plus js__add-sibling hidden\" data-level=\"" ) . concat ( level , "\" ></span>\n <span class=\"fa fa-plus-circle js__add-children hidden\" data-level=\"" ) . concat ( level , "\"></span>\n </div>\n </div>\n " ) ;
return field ;
} ;
var hasChildInputs = function hasChildInputs ( $element ) {
if ( $element . attr ( 'name' ) ) {
return false ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return true ;
} ;
var getTopItems = function getTopItems ( element ) {
return external _jQuery _default ( ) ( element + ' .js__multilevel-field.top' ) ;
} ;
var refreshControls = function refreshControls ( unique _identifier ) {
var element = '[data-grav-multilevel-field]' ;
if ( unique _identifier ) {
element = '[data-grav-multilevel-field][data-id="' + unique _identifier + '"]' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var hideButtons = function hideButtons ( ) {
external _jQuery _default ( ) ( element + ' .js__add-sibling' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( element + ' .js__add-children' ) . addClass ( 'hidden' ) ;
} ;
var restoreAddSiblingButtons = function restoreAddSiblingButtons ( ) {
external _jQuery _default ( ) ( element + ' .children-wrapper' ) . each ( function ( ) {
var elements = external _jQuery _default ( ) ( this ) . children ( ) ;
elements . last ( ) . each ( function ( ) {
var field = external _jQuery _default ( ) ( this ) ;
if ( ! external _jQuery _default ( ) ( this ) . hasClass ( 'js__multilevel-field' ) ) {
field = external _jQuery _default ( ) ( this ) . find ( '.js__multilevel-field' ) . first ( ) ;
}
field . find ( '.js__add-sibling' ) . removeClass ( 'hidden' ) ;
} ) ;
} ) ;
// add sibling to the last top element
external _jQuery _default ( ) ( element + ' .js__multilevel-field.top' ) . last ( ) . find ( '.js__add-sibling' ) . removeClass ( 'hidden' ) ;
} ;
var restoreAddChildrenButtons = function restoreAddChildrenButtons ( ) {
external _jQuery _default ( ) ( element + ' .js__multilevel-field' ) . each ( function ( ) {
if ( external _jQuery _default ( ) ( this ) . siblings ( '.children-wrapper' ) . length === 0 || external _jQuery _default ( ) ( this ) . siblings ( '.children-wrapper' ) . find ( '.js__multilevel-field' ) . length === 0 ) {
external _jQuery _default ( ) ( this ) . find ( '.js__add-children' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
} ;
var preventRemovingLastTopItem = function preventRemovingLastTopItem ( ) {
var top _items = getTopItems ( element ) ;
if ( top _items . length === 1 ) {
top _items . first ( ) . find ( '.js__remove-item' ) . addClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
hideButtons ( ) ;
restoreAddSiblingButtons ( ) ;
restoreAddChildrenButtons ( ) ;
preventRemovingLastTopItem ( ) ;
} ;
var changeAllOccurrencesInTree = function changeAllOccurrencesInTree ( $el , current _name , new _name ) {
$el . parents ( '[data-grav-multilevel-field]' ) . find ( 'input' ) . each ( function ( ) {
var $input = external _jQuery _default ( ) ( this ) ;
if ( $input . attr ( 'name' ) ) {
$input . attr ( 'name' , $input . attr ( 'name' ) . replace ( current _name , new _name ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( $input . attr ( 'data-attr-name' ) ) {
$input . attr ( 'data-attr-name' , $input . attr ( 'data-attr-name' ) . replace ( current _name , new _name ) ) ;
}
} ) ;
} ;
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
refreshControls ( ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'mouseleave' , '[data-grav-multilevel-field]' , function ( event ) {
var top _items = getTopItems ( '[data-id="' + external _jQuery _default ( ) ( this ) . data ( 'id' ) + '"]' ) ;
var has _top _items _without _children = false ;
var element _content = '' ;
top _items . each ( function ( ) {
var item = external _jQuery _default ( ) ( this ) ;
if ( external _jQuery _default ( ) ( item ) . siblings ( '.children-wrapper' ) . find ( 'input' ) . length === 0 ) {
has _top _items _without _children = true ;
element _content = item . find ( 'input' ) . val ( ) ;
}
} ) ;
if ( has _top _items _without _children ) {
if ( element _content ) {
alert ( 'Warning: if you save now, the element ' + element _content + ', without children, will be removed, because it\'s invalid YAML' ) ;
} else {
alert ( 'Warning: if you save now, the top elements without children will be removed, because it\'s invalid YAML' ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-grav-multilevel-field] .js__add-children' , function ( event ) {
var element = external _jQuery _default ( ) ( this ) ;
var unique _container _id = element . closest ( '.js__multilevel-field' ) . data ( 'id' ) ;
var level = element . data ( 'level' ) + 1 ;
var getParentOfElement = function getParentOfElement ( element ) {
var parent = element . closest ( '.js__multilevel-field' ) . parent ( ) . first ( ) ;
if ( parent . find ( '.children-wrapper' ) . length === 0 ) {
external _jQuery _default ( ) ( parent ) . append ( '<div class="children-wrapper"></div>' ) ;
}
parent = parent . find ( '.children-wrapper' ) . first ( ) ;
return parent ;
} ;
var getNameFromParentInput = function getNameFromParentInput ( parentInput , attr ) {
if ( parentInput . hasClass ( 'children-wrapper' ) ) {
parentInput = parentInput . siblings ( '.js__multilevel-field' ) . first ( ) . find ( 'input' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return parentInput . attr ( attr ) + '[' + parentInput . val ( ) + ']' ;
} ;
var getInputFromChildrenWrapper = function getInputFromChildrenWrapper ( parentChildrenWrapper ) {
return parentChildrenWrapper . siblings ( '.js__multilevel-field' ) . first ( ) . find ( 'input' ) ;
} ;
var parentChildrenWrapper = getParentOfElement ( element ) ;
var parentInput = getInputFromChildrenWrapper ( parentChildrenWrapper ) ;
var attr = 'name' ;
if ( parentInput . closest ( '.js__multilevel-field' ) . hasClass ( 'top' ) ) {
attr = 'data-attr-name' ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
parentInput . attr ( attr , parentInput . attr ( attr ) . replace ( '[]' , '' ) ) ;
var name = getNameFromParentInput ( parentInput , attr ) ;
var field = getField ( level , name ) ;
external _jQuery _default ( ) ( parentChildrenWrapper ) . append ( field ) ;
refreshControls ( unique _container _id ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-grav-multilevel-field] .js__add-sibling' , function ( event ) {
var element = external _jQuery _default ( ) ( this ) ;
var unique _container _id = element . closest ( '.js__multilevel-field' ) . data ( 'id' ) ;
var level = element . data ( 'level' ) ;
element . closest ( '.children-wrapper' ) . find ( '.js__add-sibling' ) . addClass ( 'hidden' ) ;
var sibling = null ;
var is _top = false ;
if ( element . closest ( '.js__multilevel-field' ) . hasClass ( 'top' ) ) {
is _top = true ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( is _top ) {
sibling = element . closest ( '.js__multilevel-field' ) . first ( ) . find ( 'input' ) . last ( ) ;
} else {
sibling = element . siblings ( 'input' ) . first ( ) ;
if ( ! sibling ) {
sibling = element . closest ( '.children-wrapper' ) . first ( ) . find ( 'input' ) . last ( ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var getParentOfElement = function getParentOfElement ( element ) {
var parent = element . closest ( '.js__multilevel-field' ) . parent ( ) . first ( ) ;
if ( ! parent . hasClass ( 'element-wrapper' ) ) {
if ( parent . find ( '.element-wrapper' ) . length === 0 ) {
external _jQuery _default ( ) ( parent ) . append ( '<div class="element-wrapper"></div>' ) ;
}
parent = parent . find ( '.element-wrapper' ) . first ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return parent ;
} ;
var getNameFromSibling = function getNameFromSibling ( parent , sibling ) {
var is _top = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : false ;
var name = sibling . attr ( 'name' ) ;
if ( hasChildInputs ( sibling ) ) {
var val = sibling . data ( 'attr-name' ) + '[]' ;
sibling . removeAttr ( 'name' ) ;
return val ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var last _index = name . lastIndexOf ( '[' ) ;
var almost _there = name . substr ( last _index + 1 ) ;
var last _tag = almost _there . substr ( 0 , almost _there . length - 1 ) ;
if ( external _jQuery _default ( ) . isNumeric ( last _tag ) ) {
name = name . replace ( '[' + last _tag + ']' , '[' + ( parseInt ( last _tag , 10 ) + 1 ) + ']' ) ;
} else {
if ( is _top ) {
name = name . replace ( '[' + last _tag + ']' , '' ) ;
} else {
name = name + '[1]' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// change sibling name attr if necessary
if ( sibling . attr ( 'name' ) . slice ( '-2' ) !== '[0]' ) {
changeAllOccurrencesInTree ( sibling , sibling . attr ( 'name' ) , sibling . attr ( 'name' ) + '[0]' ) ;
}
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
return name ;
} ;
var parent = getParentOfElement ( element ) ;
var name = getNameFromSibling ( parent , sibling , is _top ) ;
var field = getField ( level , name ) ;
external _jQuery _default ( ) ( field ) . insertAfter ( parent ) ;
refreshControls ( unique _container _id ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-grav-multilevel-field] .js__remove-item' , function ( event ) {
external _jQuery _default ( ) ( this ) . parents ( '.element-wrapper' ) . first ( ) . remove ( ) ;
var unique _container _id = external _jQuery _default ( ) ( this ) . closest ( '.js__multilevel-field' ) . data ( 'id' ) ;
refreshControls ( unique _container _id ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Store old value before editing a field
external _jQuery _default ( ) ( document ) . on ( 'focusin' , '[data-grav-multilevel-field] input' , function ( event ) {
external _jQuery _default ( ) ( this ) . data ( 'current-value' , external _jQuery _default ( ) ( this ) . val ( ) ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Handle field edited event
external _jQuery _default ( ) ( document ) . on ( 'change' , '[data-grav-multilevel-field] input' , function ( event ) {
var $el = external _jQuery _default ( ) ( this ) ;
var old _value = $el . data ( 'current-value' ) ;
var new _value = $el . val ( ) ;
var full _name = $el . attr ( 'name' ) || $el . attr ( 'data-attr-name' ) ; // first-level items have `data-attr-name` instead of `name`
var old _name _attr = full _name + '[' + old _value + ']' ;
var new _name _attr = full _name + '[' + new _value + ']' ;
changeAllOccurrencesInTree ( $el , old _name _attr , new _name _attr ) ;
} ) ;
} ) ;
; // ./app/forms/fields/text.js
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
external _jQuery _default ( ) ( '.copy-to-clipboard' ) . click ( function ( event ) {
var $tempElement = external _jQuery _default ( ) ( '<input>' ) ;
external _jQuery _default ( ) ( 'body' ) . append ( $tempElement ) ;
$tempElement . val ( external _jQuery _default ( ) ( this ) . prev ( 'input' ) . val ( ) ) . select ( ) ;
document . execCommand ( 'Copy' ) ;
$tempElement . remove ( ) ;
external _jQuery _default ( ) ( this ) . attr ( 'data-hint' , 'Copied to clipboard!' ) . addClass ( 'hint--left' ) ;
} ) ;
} ) ;
; // ./app/forms/fields/range.js
external _jQuery _default ( ) ( document ) . on ( 'input' , '[type="range"].rangefield, [type="number"].rangefield' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var type = target . attr ( 'type' ) . toLowerCase ( ) ;
var sibling = type === 'range' ? 'number' : 'range' ;
var feedback = target . siblings ( "[type=\"" . concat ( sibling , "\"].rangefield" ) ) ;
feedback . val ( target . val ( ) ) ;
} ) ;
; // ./app/forms/fields/elements.js
external _jQuery _default ( ) ( document ) . on ( 'change' , '[data-grav-elements] select' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var value = target . val ( ) ;
var id = target . closest ( '[data-grav-elements]' ) . data ( 'gravElements' ) ;
external _jQuery _default ( ) ( "[id^=\"" . concat ( id , "_\"]" ) ) . css ( 'display' , 'none' ) ;
external _jQuery _default ( ) ( "[id=\"" . concat ( id , "__" ) . concat ( value , "\"]" ) ) . css ( 'display' , 'inherit' ) ;
} ) ;
external _jQuery _default ( ) ( '[data-grav-elements] select' ) . trigger ( 'change' ) ;
; // ./app/forms/fields/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* harmony default export */ const fields = ( {
FilepickerField : {
FilepickerField : FilePickerField ,
Instance : filepicker _Instance
} ,
SelectizeField : {
SelectizeField : SelectizeField ,
Instance : selectize _Instance
} ,
ArrayField : {
ArrayField : ArrayField ,
Instance : array _Instance
} ,
CollectionsField : {
CollectionsField : CollectionsField ,
Instance : collections _Instance
} ,
DateTimeField : {
DateTimeField : DateTimeField ,
Instance : datetime _Instance
} ,
EditorField : {
EditorField : EditorField ,
Instance : editor _Instance
} ,
ColorpickerField : {
ColorpickerField : ColorpickerField ,
Instance : colorpicker _Instance
} ,
FilesField : {
FilesField : FilesField ,
Instance : Instance
} ,
FolderField : {
Regenerate : fields _folder
} ,
SelectUniqueField : {
SelectUniqueField : SelectUniqueField ,
Instance : selectunique _Instance
} ,
IconpickerField : {
IconpickerField : IconpickerField ,
Instance : iconpicker _Instance
} ,
CronField : {
CronField : CronField ,
Instance : cron _Instance
} ,
ParentsField : {
ParentsField : Parents ,
Instance : parents _Instances
}
} ) ;
; // ./app/forms/index.js
/* harmony default export */ const app _forms = ( {
Form : {
Form : Form ,
Instance : form _Instance
} ,
Fields : fields ,
FormState : {
FormState : FormState ,
Instance : state _Instance
}
} ) ;
; // ./app/utils/packages.js
function packages _typeof ( o ) { "@babel/helpers - typeof" ; return packages _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , packages _typeof ( o ) ; }
function packages _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function packages _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , packages _toPropertyKey ( o . key ) , o ) ; } }
function packages _createClass ( e , r , t ) { return r && packages _defineProperties ( e . prototype , r ) , t && packages _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function packages _toPropertyKey ( t ) { var i = packages _toPrimitive ( t , "string" ) ; return "symbol" == packages _typeof ( i ) ? i : i + "" ; }
function packages _toPrimitive ( t , r ) { if ( "object" != packages _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != packages _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var Sorter = /*#__PURE__*/ function ( ) {
function Sorter ( ) {
packages _classCallCheck ( this , Sorter ) ;
}
return packages _createClass ( Sorter , [ {
key : "getElements" ,
value : function getElements ( elements , container ) {
this . elements = elements || document . querySelectorAll ( '[data-gpm-plugin], [data-gpm-theme]' ) ;
this . container = container || document . querySelector ( '.gpm-plugins > table > tbody, .gpm-themes > .themes.card-row' ) ;
return this . elements ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "byCommon" ,
value : function byCommon ( ) {
var _this = this ;
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : '' ;
var elements = this . getElements ( ) ;
this . removeGumroad ( ) ;
Array . from ( elements ) . sort ( function ( a , b ) {
var A = a . dataset [ data ] . toString ( ) . toLowerCase ( ) ;
var B = b . dataset [ data ] . toString ( ) . toLowerCase ( ) ;
return Sorter . sort ( A , B , direction ) ;
} ) . forEach ( function ( element ) {
_this . container . appendChild ( element ) ;
} ) ;
this . addGumroad ( ) ;
return this . container ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "byName" ,
value : function byName ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmName' ;
return this . byCommon ( direction , data ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "byAuthor" ,
value : function byAuthor ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmAuthor' ;
return this . byCommon ( direction , data ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "byOfficial" ,
value : function byOfficial ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmOfficial' ;
return this . byCommon ( direction , data ) ;
}
} , {
key : "byPremium" ,
value : function byPremium ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmPremium' ;
return this . byCommon ( direction , data ) ;
}
} , {
key : "byReleaseDate" ,
value : function byReleaseDate ( ) {
2025-10-16 10:59:50 -06:00
var _this2 = this ;
2025-10-18 13:48:40 -06:00
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmReleaseDate' ;
var elements = this . getElements ( ) ;
this . removeGumroad ( ) ;
Array . from ( elements ) . sort ( function ( a , b ) {
var A = new Date ( a . dataset [ data ] ) . getTime ( ) ;
var B = new Date ( b . dataset [ data ] ) . getTime ( ) ;
return Sorter . sort ( A , B , direction === 'asc' ? 'desc' : 'asc' ) ;
} ) . forEach ( function ( element ) {
_this2 . container . appendChild ( element ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
this . addGumroad ( ) ;
return this . container ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "byUpdatable" ,
value : function byUpdatable ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmUpdatable' ;
return this . byCommon ( direction , data ) ;
}
} , {
key : "byEnabled" ,
value : function byEnabled ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmEnabled' ;
return this . byCommon ( direction , data ) ;
}
} , {
key : "byTesting" ,
value : function byTesting ( ) {
var direction = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 'asc' ;
var data = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'gpmTesting' ;
return this . byCommon ( direction , data ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "addGumroad" ,
value : function addGumroad ( ) {
if ( window . GumroadOverlay ) {
window . GumroadOverlay . startNodeAdditionObserver ( ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "removeGumroad" ,
value : function removeGumroad ( ) {
if ( window . GumroadOverlay ) {
window . GumroadOverlay . nodeAdditionObserver . disconnect ( ) ;
}
}
} ] , [ {
key : "sort" ,
value : function sort ( A , B ) {
var direction = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : 'asc' ;
if ( A > B ) {
return direction === 'asc' ? 1 : - 1 ;
}
if ( A < B ) {
return direction === 'asc' ? - 1 : 1 ;
}
return 0 ;
}
} ] ) ;
} ( ) ;
var Packages = /*#__PURE__*/ function ( ) {
function Packages ( ) {
packages _classCallCheck ( this , Packages ) ;
this . Sort = new Sorter ( ) ;
}
return packages _createClass ( Packages , [ {
key : "addDependenciesToList" ,
value : function addDependenciesToList ( dependencies ) {
var slug = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : '' ;
dependencies . forEach ( function ( dependency ) {
Packages . addDependencyToList ( 'plugin' , dependency . name || dependency , slug ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "removePackage" ,
value : function removePackage ( type , slug ) {
var _this3 = this ;
var url = Packages . getRemovePackageUrl ( type ) ;
utils _request ( url , {
method : 'post' ,
body : {
"package" : slug
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , function ( response ) {
if ( response . status === 'success' ) {
external _jQuery _default ( ) ( '.remove-package-confirm' ) . addClass ( 'hidden' ) ;
if ( response . dependencies && response . dependencies . length > 0 ) {
_this3 . addDependenciesToList ( response . dependencies ) ;
external _jQuery _default ( ) ( '.remove-package-dependencies' ) . removeClass ( 'hidden' ) ;
} else {
external _jQuery _default ( ) ( '.remove-package-done' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// The package was removed. When the modal closes, move to the packages list
external _jQuery _default ( ) ( document ) . on ( 'closing' , '[data-remodal-id="remove-package"]' , function ( ) {
Packages . getBackToList ( type ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} else {
external _jQuery _default ( ) ( '.remove-package-confirm' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '.remove-package-error' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "reinstallPackage" ,
value : function reinstallPackage ( type , slug , package _name , current _version ) {
external _jQuery _default ( ) ( '.button-bar button' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '.button-bar .spinning-wheel' ) . removeClass ( 'hidden' ) ;
var url = Packages . getReinstallPackageUrl ( type ) ;
utils _request ( url , {
method : 'post' ,
body : {
slug : slug ,
type : type ,
package _name : package _name ,
current _version : current _version
}
} , function ( response ) {
if ( response . status === 'success' ) {
external _jQuery _default ( ) ( '.reinstall-package-confirm' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '.reinstall-package-done' ) . removeClass ( 'hidden' ) ;
} else {
external _jQuery _default ( ) ( '.reinstall-package-confirm' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '.reinstall-package-error' ) . removeClass ( 'hidden' ) ;
}
window . location . reload ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "removeDependency" ,
value : function removeDependency ( type , slug , button ) {
var _this4 = this ;
var url = Packages . getRemovePackageUrl ( type ) ;
utils _request ( url , {
method : 'post' ,
body : {
"package" : slug
}
} , function ( response ) {
if ( response . status === 'success' ) {
button . removeClass ( 'button' ) ;
button . replaceWith ( external _jQuery _default ( ) ( '<span>Removed successfully</span>' ) ) ;
if ( response . dependencies && response . dependencies . length > 0 ) {
_this4 . addDependenciesToList ( response . dependencies , slug ) ;
}
}
2025-10-16 10:59:50 -06:00
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "getPackagesDependencies" ,
value : function getPackagesDependencies ( type , slugs , finishedLoadingCallback ) {
var url = Packages . getGetPackagesDependenciesUrl ( type ) ;
utils _request ( url , {
method : 'post' ,
body : {
packages : slugs
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , function ( response ) {
finishedLoadingCallback ( ) ;
if ( response . status === 'success' ) {
if ( response . dependencies ) {
var hasDependencies = false ;
for ( var dependency in response . dependencies ) {
if ( response . dependencies . hasOwnProperty ( dependency ) ) {
if ( dependency === 'grav' ) {
continue ;
}
hasDependencies = true ;
var dependencyName = dependency ;
var action = response . dependencies [ dependency ] ;
Packages . addNeededDependencyToList ( action , dependencyName ) ;
}
}
if ( hasDependencies ) {
external _jQuery _default ( ) ( '[data-packages-modal] .install-dependencies-package-container' ) . removeClass ( 'hidden' ) ;
} else {
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-container' ) . removeClass ( 'hidden' ) ;
}
} else {
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-container' ) . removeClass ( 'hidden' ) ;
}
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-error' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "installDependenciesOfPackages" ,
value : function installDependenciesOfPackages ( type , slugs , callbackSuccess , callbackError ) {
var url = Packages . getInstallDependenciesOfPackagesUrl ( type ) ;
utils _request ( url , {
method : 'post' ,
body : {
packages : slugs
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , callbackSuccess ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "installPackages" ,
value : function installPackages ( type , slugs , callbackSuccess ) {
var url = Packages . getInstallPackageUrl ( type ) ;
_ _webpack _require _ _ . g . Promise . all ( slugs . map ( function ( slug ) {
return new _ _webpack _require _ _ . g . Promise ( function ( resolve , reject ) {
utils _request ( url , {
method : 'post' ,
body : {
"package" : slug ,
type : type
}
} , function ( response ) {
resolve ( response ) ;
} ) ;
} ) ;
} ) ) . then ( callbackSuccess ) ;
}
} , {
key : "handleGettingPackageDependencies" ,
value : function handleGettingPackageDependencies ( type , event ) {
var action = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : 'update' ;
var slugs = Packages . getSlugsFromEvent ( event ) ;
if ( ! slugs ) {
alert ( 'No slug set' ) ;
return ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Cleanup
external _jQuery _default ( ) ( '.packages-names-list' ) . html ( '' ) ;
external _jQuery _default ( ) ( '.install-dependencies-package-container li' ) . remove ( ) ;
slugs . forEach ( function ( slug ) {
if ( action === 'update' ) {
var current _version = '' ;
var available _version = '' ;
var _name = '' ;
var resources = gpm _Instance . payload . payload . resources ;
if ( resources . plugins [ slug ] ) {
available _version = resources . plugins [ slug ] . available ;
current _version = resources . plugins [ slug ] . version ;
_name = resources . plugins [ slug ] . name ;
} else if ( resources . themes [ slug ] ) {
available _version = resources . themes [ slug ] . available ;
current _version = resources . themes [ slug ] . version ;
_name = resources . themes [ slug ] . name ;
}
external _jQuery _default ( ) ( '.packages-names-list' ) . append ( "<li>" . concat ( _name ? _name : slug , ", " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FROM , " v<strong>" ) . concat ( current _version , "</strong> " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . TO , " v<strong>" ) . concat ( available _version , "</strong></li>" ) ) ;
} else {
external _jQuery _default ( ) ( '.packages-names-list' ) . append ( "<li>" . concat ( name ? name : slug , "</li>" ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// fix mismatching types when sharing install modal between plugins/themes
var query = '[data-packages-modal] [data-theme-action], [data-packages-modal] [data-plugin-action]' ;
var data = external _jQuery _default ( ) ( query ) . data ( 'themeAction' ) || external _jQuery _default ( ) ( query ) . data ( 'pluginAction' ) ;
external _jQuery _default ( ) ( query ) . removeAttr ( 'data-theme-action' ) . removeAttr ( 'data-plugin-action' ) . attr ( "data-" . concat ( type , "-action" ) , data ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Restore original state
external _jQuery _default ( ) ( '[data-packages-modal] .loading' ) . removeClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-dependencies-package-container' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-container' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installing-dependencies' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installing-package' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installation-complete' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-error' ) . addClass ( 'hidden' ) ;
this . getPackagesDependencies ( type , slugs , function ( ) {
var slugs _string = slugs . join ( ) ;
external _jQuery _default ( ) ( "[data-packages-modal] [data-" . concat ( type , "-action=\"install-dependencies-and-package\"]" ) ) . attr ( 'data-packages-slugs' , slugs _string ) ;
external _jQuery _default ( ) ( "[data-packages-modal] [data-" . concat ( type , "-action=\"install-package\"]" ) ) . attr ( 'data-packages-slugs' , slugs _string ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .loading' ) . addClass ( 'hidden' ) ;
} ) ;
}
} , {
key : "handleInstallingDependenciesAndPackage" ,
value : function handleInstallingDependenciesAndPackage ( type , event ) {
var _this5 = this ;
var slugs = Packages . getSlugsFromEvent ( event ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-dependencies-package-container' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-container' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installing-dependencies' ) . removeClass ( 'hidden' ) ;
this . installDependenciesOfPackages ( type , slugs , function ( response ) {
external _jQuery _default ( ) ( '[data-packages-modal] .installing-dependencies' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installing-package' ) . removeClass ( 'hidden' ) ;
_this5 . installPackages ( type , slugs , function ( ) {
external _jQuery _default ( ) ( '[data-packages-modal] .installing-package' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installation-complete' ) . removeClass ( 'hidden' ) ;
if ( response . status === 'error' ) {
var remodal = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( '[data-packages-modal]' ) . data ( 'remodal' ) ] ;
remodal . close ( ) ;
return ;
}
setTimeout ( function ( ) {
if ( slugs . length === 1 ) {
_ _webpack _require _ _ . g . location . href = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/" ) . concat ( type , "s/" ) . concat ( slugs [ 0 ] ) ;
} else {
_ _webpack _require _ _ . g . location . href = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/" ) . concat ( type , "s" ) ;
}
} , 1000 ) ;
} ) ;
} ) ;
}
} , {
key : "handleInstallingPackage" ,
value : function handleInstallingPackage ( type , event ) {
var slugs = Packages . getSlugsFromEvent ( event ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .install-package-container' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installing-package' ) . removeClass ( 'hidden' ) ;
this . installPackages ( type , slugs , function ( response ) {
external _jQuery _default ( ) ( '[data-packages-modal] .installing-package' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '[data-packages-modal] .installation-complete' ) . removeClass ( 'hidden' ) ;
var errors = Array . from ( response ) . filter ( function ( r ) {
return r . status === 'error' ;
} ) ;
if ( errors && errors . length ) {
var remodal = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( '[data-packages-modal].remodal-is-opened' ) . data ( 'remodal' ) ] ;
remodal . close ( ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( slugs . length === 1 ) {
_ _webpack _require _ _ . g . location . href = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/" ) . concat ( type , "s/" ) . concat ( slugs [ 0 ] ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
_ _webpack _require _ _ . g . location . href = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/" ) . concat ( type , "s" ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
}
} , {
2025-10-18 13:48:40 -06:00
key : "handleRemovingPackage" ,
value : function handleRemovingPackage ( type , event ) {
var slug = external _jQuery _default ( ) ( event . target ) . attr ( 'data-packages-slugs' ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
this . removePackage ( type , slug ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "handleReinstallPackage" ,
value : function handleReinstallPackage ( type , event ) {
var target = external _jQuery _default ( ) ( event . target ) ;
var slug = target . attr ( 'data-package-slug' ) ;
var package _name = target . attr ( 'data-package-name' ) ;
var current _version = target . attr ( 'data-package-current-version' ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
this . reinstallPackage ( type , slug , package _name , current _version ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "handleRemovingDependency" ,
value : function handleRemovingDependency ( type , event ) {
var slug = external _jQuery _default ( ) ( event . target ) . attr ( 'data-dependency-slug' ) ;
var button = external _jQuery _default ( ) ( event . target ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
this . removeDependency ( type , slug , button ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] , [ {
key : "getBackToList" ,
value : function getBackToList ( type ) {
_ _webpack _require _ _ . g . location . href = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/" ) . concat ( type , "s" ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "addDependencyToList" ,
value : function addDependencyToList ( type , dependency ) {
var slug = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : '' ;
if ( [ 'admin' , 'form' , 'login' , 'email' , 'grav' ] . indexOf ( dependency ) !== - 1 ) {
2025-10-16 10:59:50 -06:00
return ;
}
2025-10-18 13:48:40 -06:00
var container = external _jQuery _default ( ) ( '.package-dependencies-container' ) ;
var text = "" . concat ( dependency , " <a href=\"#\" class=\"button\" data-dependency-slug=\"" ) . concat ( dependency , "\" data-" ) . concat ( type , "-action=\"remove-dependency-package\">Remove</a>" ) ;
if ( slug ) {
text += " (was needed by " . concat ( slug , ")" ) ;
}
container . append ( "<li>" . concat ( text , "</li>" ) ) ;
}
} , {
key : "getTaskUrl" ,
value : function getTaskUrl ( type , task ) {
var url = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative ) ;
url += "/" . concat ( type , "s.json" ) ;
url += "/task" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( task ) ;
return url ;
}
} , {
key : "getRemovePackageUrl" ,
value : function getRemovePackageUrl ( type ) {
return "" . concat ( Packages . getTaskUrl ( type , 'removePackage' ) ) ;
}
} , {
key : "getReinstallPackageUrl" ,
value : function getReinstallPackageUrl ( type ) {
return "" . concat ( Packages . getTaskUrl ( type , 'reinstallPackage' ) ) ;
}
} , {
key : "getGetPackagesDependenciesUrl" ,
value : function getGetPackagesDependenciesUrl ( type ) {
return "" . concat ( Packages . getTaskUrl ( type , 'getPackagesDependencies' ) ) ;
}
} , {
key : "getInstallDependenciesOfPackagesUrl" ,
value : function getInstallDependenciesOfPackagesUrl ( type ) {
return "" . concat ( Packages . getTaskUrl ( type , 'installDependenciesOfPackages' ) ) ;
}
} , {
key : "getInstallPackageUrl" ,
value : function getInstallPackageUrl ( type ) {
return "" . concat ( Packages . getTaskUrl ( type , 'installPackage' ) ) ;
}
} , {
key : "addNeededDependencyToList" ,
value : function addNeededDependencyToList ( action , slug ) {
external _jQuery _default ( ) ( '.install-dependencies-package-container .type-' + action ) . removeClass ( 'hidden' ) ;
var list = external _jQuery _default ( ) ( '.install-dependencies-package-container .type-' + action + ' ul' ) ;
if ( action !== 'install' ) {
var current _version = '' ;
var available _version = '' ;
var _name2 = '' ;
var resources = gpm _Instance . payload . payload . resources ;
if ( resources . plugins [ slug ] ) {
available _version = resources . plugins [ slug ] . available ;
current _version = resources . plugins [ slug ] . version ;
_name2 = resources . plugins [ slug ] . name ;
} else if ( resources . themes [ slug ] ) {
available _version = resources . themes [ slug ] . available ;
current _version = resources . themes [ slug ] . version ;
_name2 = resources . themes [ slug ] . name ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
list . append ( "<li>" . concat ( _name2 ? _name2 : slug , ", " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . FROM , " v<strong>" ) . concat ( current _version , "</strong> " ) . concat ( external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . TO , " v<strong>" ) . concat ( available _version , "</strong></li>" ) ) ;
} else {
list . append ( "<li>" . concat ( name ? name : slug , "</li>" ) ) ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "getSlugsFromEvent" ,
value : function getSlugsFromEvent ( event ) {
var slugs = '' ;
if ( external _jQuery _default ( ) ( event . target ) . is ( '[data-packages-slugs]' ) ) {
slugs = external _jQuery _default ( ) ( event . target ) . attr ( 'data-packages-slugs' ) ;
} else {
slugs = external _jQuery _default ( ) ( event . target ) . parent ( '[data-packages-slugs]' ) . attr ( 'data-packages-slugs' ) ;
}
if ( typeof slugs === 'undefined' ) {
return null ;
}
slugs = slugs . split ( ',' ) ;
return typeof slugs === 'string' ? [ slugs ] : slugs ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
/* harmony default export */ const utils _packages = ( new Packages ( ) ) ;
// EXTERNAL MODULE: ./node_modules/mout/string/camelCase.js
var camelCase = _ _webpack _require _ _ ( 84958 ) ;
var camelCase _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( camelCase ) ;
// EXTERNAL MODULE: ./node_modules/mout/string/contains.js
var contains = _ _webpack _require _ _ ( 75019 ) ;
var contains _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( contains ) ;
; // ./app/plugins/index.js
// Plugins sliders details
external _jQuery _default ( ) ( '.gpm-name, .gpm-actions' ) . on ( 'click' , function ( e ) {
var element = external _jQuery _default ( ) ( this ) ;
var target = external _jQuery _default ( ) ( e . target ) ;
var tag = target . prop ( 'tagName' ) . toLowerCase ( ) ;
if ( tag === 'a' || element . parent ( 'a' ) . length || target . parent ( 'a' ) . length ) {
return true ;
}
var wrapper = element . siblings ( '.gpm-details' ) . find ( '.table-wrapper' ) ;
wrapper . slideToggle ( {
duration : 350 ,
complete : function complete ( ) {
var visible = wrapper . is ( ':visible' ) ;
wrapper . closest ( 'tr' ) . find ( '.gpm-details-expand i' ) . removeClass ( 'fa-chevron-' + ( visible ? 'down' : 'up' ) ) . addClass ( 'fa-chevron-' + ( visible ? 'up' : 'down' ) ) ;
}
} ) ;
} ) ;
// Removing plugin
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="remove-package"]' , function ( event ) {
utils _packages . handleRemovingPackage ( 'plugin' , event ) ;
} ) ;
// Reinstall plugin
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="reinstall-package"]' , function ( event ) {
utils _packages . handleReinstallPackage ( 'plugin' , event ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="remove-dependency-package"]' , function ( event ) {
utils _packages . handleRemovingDependency ( 'plugin' , event ) ;
} ) ;
// Trigger the add new plugin / update plugin modal
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="start-package-installation"]' , function ( event ) {
utils _packages . handleGettingPackageDependencies ( 'plugin' , event , 'install' ) ;
} ) ;
// Trigger the update all plugins modal
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="start-packages-update"]' , function ( event ) {
utils _packages . handleGettingPackageDependencies ( 'plugin' , event ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Install a plugin dependencies and the plugin
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="install-dependencies-and-package"]' , function ( event ) {
utils _packages . handleInstallingDependenciesAndPackage ( 'plugin' , event ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Install a plugin
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-plugin-action="install-package"]' , function ( event ) {
utils _packages . handleInstallingPackage ( 'plugin' , event ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Sort plugins/themes dropdown
external _jQuery _default ( ) ( document ) . on ( 'change' , '.sort-actions select' , function ( event ) {
var direction = external _jQuery _default ( ) ( '.sort-actions .sort-icon .fa' ) . hasClass ( 'fa-sort-amount-desc' ) ? 'desc' : 'asc' ;
var sorting = external _jQuery _default ( ) ( event . currentTarget ) . val ( ) ;
utils _packages . Sort [ camelCase _default ( ) ( "by-" . concat ( sorting ) ) ] ( direction ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Sort plugins/themes icon
external _jQuery _default ( ) ( document ) . on ( 'click' , '.sort-icon' , function ( event ) {
var icon = external _jQuery _default ( ) ( event . currentTarget ) . find ( '.fa' ) ;
var current = icon . hasClass ( 'fa-sort-amount-asc' ) ? 'asc' : 'desc' ;
var opposite = current === 'asc' ? 'desc' : 'asc' ;
icon . removeClass ( "fa-sort-amount-" . concat ( current ) ) . addClass ( "fa-sort-amount-" . concat ( opposite ) ) ;
external _jQuery _default ( ) ( '.sort-actions select' ) . trigger ( 'change' ) ;
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// Filter plugin/theme
external _jQuery _default ( ) ( document ) . on ( 'input' , '[data-gpm-filter]' , debounce _default ( ) ( function ( event ) {
var value = external _jQuery _default ( ) ( external _jQuery _default ( ) ( event . currentTarget ) ) . val ( ) ;
var items = external _jQuery _default ( ) ( '[data-gpm-plugin], [data-gpm-theme]' ) ;
items . hide ( ) . filter ( function ( index , item ) {
item = external _jQuery _default ( ) ( item ) ;
return contains _default ( ) ( item . data ( 'gpm-plugin' ) , value ) || contains _default ( ) ( item . data ( 'gpm-theme' ) , value ) || contains _default ( ) ( item . data ( 'gpm-name' ) . toLowerCase ( ) , value . toLowerCase ( ) ) ;
} ) . show ( ) ;
} , 250 ) ) ;
; // ./app/themes/index.js
2025-09-24 18:27:08 -06:00
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Themes Switcher Warning
external _jQuery _default ( ) ( document ) . on ( 'mousedown' , '[data-remodal-target="theme-switch-warn"]' , function ( event ) {
var name = external _jQuery _default ( ) ( event . target ) . closest ( '[data-gpm-theme]' ) . find ( '.gpm-name a:first' ) . text ( ) ;
var remodal = external _jQuery _default ( ) ( '.remodal.theme-switcher' ) ;
remodal . find ( 'strong' ) . text ( name ) ;
remodal . find ( '.button.continue' ) . attr ( 'href' , external _jQuery _default ( ) ( event . target ) . attr ( 'href' ) ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Removing theme
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="remove-package"]' , function ( event ) {
utils _packages . handleRemovingPackage ( 'theme' , event ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Reinstall theme
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="reinstall-package"]' , function ( event ) {
utils _packages . handleReinstallPackage ( 'theme' , event ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="remove-dependency-package"]' , function ( event ) {
utils _packages . handleRemovingDependency ( 'theme' , event ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Opened the add new theme / update theme modal
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="start-package-installation"]' , function ( event ) {
utils _packages . handleGettingPackageDependencies ( 'theme' , event , 'install' ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Trigger the update all themes modal
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="start-packages-update"]' , function ( event ) {
utils _packages . handleGettingPackageDependencies ( 'theme' , event ) ;
} ) ;
// Install a theme dependencies and the theme
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="install-dependencies-and-package"]' , function ( event ) {
utils _packages . handleInstallingDependenciesAndPackage ( 'theme' , event ) ;
} ) ;
// Install a theme
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-theme-action="install-package"]' , function ( event ) {
utils _packages . handleInstallingPackage ( 'theme' , event ) ;
} ) ;
; // ./app/media/index.js
function app _media _typeof ( o ) { "@babel/helpers - typeof" ; return app _media _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , app _media _typeof ( o ) ; }
function app _media _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function app _media _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , app _media _toPropertyKey ( o . key ) , o ) ; } }
function app _media _createClass ( e , r , t ) { return r && app _media _defineProperties ( e . prototype , r ) , t && app _media _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function app _media _toPropertyKey ( t ) { var i = app _media _toPrimitive ( t , "string" ) ; return "symbol" == app _media _typeof ( i ) ? i : i + "" ; }
function app _media _toPrimitive ( t , r ) { if ( "object" != app _media _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != app _media _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var Filter = /*#__PURE__*/ function ( ) {
function Filter ( ) {
app _media _classCallCheck ( this , Filter ) ;
this . URI = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/media-manager/" ) ;
}
return app _media _createClass ( Filter , [ {
key : "filter" ,
value : function filter ( name , value ) {
var filtered = [ ] ;
var keys = Object . keys ( external _GravAdmin _namespaceObject . uri _params ) ;
if ( ! ~ keys . indexOf ( name ) ) {
keys . push ( name ) ;
}
keys . forEach ( function ( key ) {
var filter = Filter . cleanValue ( key === name ? value : external _GravAdmin _namespaceObject . uri _params [ key ] ) ;
if ( filter !== '*' ) {
filtered . push ( "" . concat ( key ) . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( filter ) ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
_ _webpack _require _ _ . g . location = this . URI + filtered . join ( '/' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ] , [ {
key : "cleanValue" ,
value : function cleanValue ( value ) {
return encodeURIComponent ( value . replace ( '/' , '\\' ) ) ;
}
} ] ) ;
} ( ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var app _media _Instance = new Filter ( ) ;
var isLoading = false ;
var filters = { } ;
var global _index = 1 ;
var files _ended = false ;
var MEDIA _PAGINATION _INTERVAL = 20 ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle changing file type / date filter */
external _jQuery _default ( ) ( 'body' ) . on ( 'change' , '.thumbs-list-container select.filter' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var filterName = target . data ( 'name' ) ;
var filterValue = target . val ( ) ;
if ( filterValue ) {
filters [ filterName ] = filterValue ;
} else {
delete filters [ filterName ] ;
}
filterFiles ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* initialize media uploader */
if ( external _jQuery _default ( ) ( '.thumbs-list-container .dropzone' ) [ 0 ] ) {
external _jQuery _default ( ) ( '.thumbs-list-container .dropzone' ) [ 0 ] . dropzone . on ( 'queuecomplete' , function ( ) {
var body = { } ;
if ( filters . page ) {
body . page = filters . page ;
}
if ( filters . date ) {
body . date = filters . date ;
}
if ( filters . type ) {
body . type = filters . type ;
}
external _jQuery _default ( ) ( '.dropzone' ) [ 0 ] . dropzone . files . forEach ( function ( file ) {
file . previewElement . remove ( ) ;
} ) ;
external _jQuery _default ( ) ( '.dropzone' ) . first ( ) . removeClass ( 'dz-started' ) ;
utils _request ( "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/media-manager.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "clearMediaCache" ) , {
method : 'post' ,
body : body
} , function ( ) {
filterFiles ( ) ;
} ) ;
} ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle loading media */
var loadMedia = function loadMedia ( filters , callback ) {
var url = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/media.json/tmpl" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "media-list-content/index" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( global _index ) ;
if ( filters . page ) {
url += "/page" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( filters . page . split ( '/' ) . join ( '%5C' ) ) ;
}
if ( filters . type && filters . type !== '*' ) {
url += "/type" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( filters . type ) ;
}
if ( filters . date && filters . date !== '*' ) {
url += "/date" . concat ( external _GravAdmin _namespaceObject . config . param _sep ) . concat ( filters . date ) ;
}
if ( ! isLoading ) {
isLoading = true ;
external _jQuery _default ( ) ( '.spinning-wheel' ) . show ( ) ;
external _jQuery _default ( ) . get ( url , function ( content ) {
external _jQuery _default ( ) ( '.js__files' ) . append ( content ) ;
external _jQuery _default ( ) ( '.spinning-wheel' ) . hide ( ) ;
external _jQuery _default ( ) ( '.media-container .media-range' ) . trigger ( 'change' ) ;
isLoading = false ;
global _index ++ ;
callback ( content ) ;
} ) ;
}
} ;
var cleanFilesList = function cleanFilesList ( ) {
external _jQuery _default ( ) ( '.js__files .card-item' ) . remove ( ) ;
} ;
var resetActiveStateInSidebar = function resetActiveStateInSidebar ( ) {
external _jQuery _default ( ) ( '.pages-list-container .row' ) . removeClass ( 'active' ) ; // clear active state in sidebar
} ;
var showEmptyState = function showEmptyState ( ) {
external _jQuery _default ( ) ( '.thumbs-list-container' ) . append ( '<p class="card-item empty-space">No media found</p>' ) ;
} ;
var filterFiles = function filterFiles ( ) {
cleanFilesList ( ) ;
global _index = 0 ;
files _ended = false ;
external _jQuery _default ( ) ( '.empty-space' ) . remove ( ) ;
loadMedia ( filters , function ( content ) {
if ( ! content . trim ( ) . length ) {
showEmptyState ( ) ;
} else {
if ( ! filters . page && ( ! filters . date || filters . date === '*' ) && ( ! filters . type || filters . type === '*' ) ) {
external _jQuery _default ( ) ( '.js__files' ) . trigger ( 'fillView' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
} ) ;
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle changing page */
external _jQuery _default ( ) ( 'body' ) . on ( 'click' , '.pages-list-container .js__page-link' , function ( event ) {
var page = external _jQuery _default ( ) ( event . target ) . data ( 'page' ) ;
filters [ 'page' ] = page ;
external _jQuery _default ( ) ( '.media-list-title .page-indicator' ) . html ( page ) ; // set indication
external _jQuery _default ( ) ( '.js__reset-pages-filter' ) . removeClass ( 'hidden' ) ; // activate reset pages icon
resetActiveStateInSidebar ( ) ;
external _jQuery _default ( ) ( event . target ) . parents ( '.row' ) . addClass ( 'active' ) ; // set active state in sidebar
external _jQuery _default ( ) ( '.js__file-uploader' ) . removeClass ( 'hidden' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// customize processing URL, as the page changes dynamically
if ( external _jQuery _default ( ) ( '.dropzone' ) [ 0 ] ) {
external _jQuery _default ( ) ( '.dropzone' ) [ 0 ] . dropzone . on ( 'processing' , function ( file ) {
this . options . url = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/media-manager" ) . concat ( page , ".json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "addmedia" ) ;
} ) ;
}
external _jQuery _default ( ) ( '.js__button-clear-media-cache' ) . addClass ( 'hidden' ) ;
filterFiles ( ) ;
disableInfiniteScrolling ( ) ; // only infinite scroll on main list, not inside single pages
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle clearing page filter */
external _jQuery _default ( ) ( 'body' ) . on ( 'click' , '.js__reset-pages-filter' , function ( event ) {
external _jQuery _default ( ) ( '.media-list-title .page-indicator' ) . html ( 'All Pages' ) ; // set indication
cleanFilesList ( ) ;
resetActiveStateInSidebar ( ) ;
external _jQuery _default ( ) ( '.js__reset-pages-filter' ) . addClass ( 'hidden' ) ; // remove reset pages icon
external _jQuery _default ( ) ( '.js__file-uploader' ) . addClass ( 'hidden' ) ;
external _jQuery _default ( ) ( '.js__button-clear-media-cache' ) . removeClass ( 'hidden' ) ;
delete filters [ 'page' ] ;
filterFiles ( ) ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* handle infinite loading */
var enableInfiniteScrolling = function enableInfiniteScrolling ( ) {
external _jQuery _default ( ) ( '.spinning-wheel' ) . hide ( ) ;
var view = external _jQuery _default ( ) ( '.mediapicker-scroll' ) . last ( ) ;
if ( ! view . length ) {
return ;
}
external _jQuery _default ( ) ( view ) . on ( 'scroll' , function ( ) {
if ( external _jQuery _default ( ) ( this ) . scrollTop ( ) + external _jQuery _default ( ) ( this ) . innerHeight ( ) + 100 >= external _jQuery _default ( ) ( this ) [ 0 ] . scrollHeight ) {
fillView ( ) ;
}
} ) ;
} ;
var loadNextBatch = function loadNextBatch ( callback ) {
if ( files _ended ) {
return ;
}
loadMedia ( { } , function ( content ) {
if ( ! external _jQuery _default ( ) ( content ) . length || content . split ( 'card-item' ) . length - 1 < MEDIA _PAGINATION _INTERVAL ) {
files _ended = true ;
} else {
if ( callback ) {
callback ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
external _jQuery _default ( ) ( '.media-container .media-range' ) . trigger ( 'input' ) ;
} ) ;
} ;
var fillView = function fillView ( ) {
if ( ! external _jQuery _default ( ) ( '.js__files' ) . find ( '.card-item' ) . last ( ) . offset ( ) ) {
setTimeout ( function ( ) {
// retry later
fillView ( ) ;
} , 300 ) ;
return ;
}
if ( external _jQuery _default ( ) ( '.js__files' ) . find ( '.card-item' ) . last ( ) . offset ( ) . top - 1 <= external _jQuery _default ( ) ( '.media-container' ) . height ( ) ) {
loadNextBatch ( function ( ) {
fillView ( ) ;
} ) ;
}
} ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* disable infinite loading */
var disableInfiniteScrolling = function disableInfiniteScrolling ( ) {
external _jQuery _default ( ) ( '.spinning-wheel' ) . hide ( ) ;
external _jQuery _default ( ) ( '.content-wrapper' ) . unbind ( 'scroll' ) ;
} ;
external _jQuery _default ( ) ( '.js__files' ) . on ( 'fillView' , function ( event ) {
// the first batch got the max number of media files, try loading more
if ( external _jQuery _default ( ) ( '.js__files' ) [ 0 ] . innerHTML . split ( 'card-item' ) . length - 1 === MEDIA _PAGINATION _INTERVAL ) {
fillView ( ) ;
enableInfiniteScrolling ( ) ;
}
} ) ;
; // ./app/utils/2fa.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var _2fa _body = external _jQuery _default ( ) ( 'body' ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Dashboard update and Grav update
_2fa _body . on ( 'click' , '[data-2fa-regenerate]' , function ( event ) {
event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( this ) ;
var url = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/ajax.json/task" ) . concat ( external _GravAdmin _namespaceObject . config . param _sep , "regenerate2FASecret" ) ;
element . attr ( 'disabled' , 'disabled' ) . find ( '> .fa' ) . addClass ( 'fa-spin' ) ;
utils _request ( url , {
method : 'post'
} , function ( response ) {
external _jQuery _default ( ) ( '[data-2fa-image]' ) . attr ( 'src' , response . image ) ;
external _jQuery _default ( ) ( '[data-2fa-secret]' ) . text ( response . secret ) ;
external _jQuery _default ( ) ( '[data-2fa-value]' ) . val ( response . secret . replace ( ' ' , '' ) ) ;
element . removeAttr ( 'disabled' ) . find ( '> .fa' ) . removeClass ( 'fa-spin' ) ;
} ) ;
} ) ;
var toggleSecret = function toggleSecret ( ) {
var toggle = external _jQuery _default ( ) ( '#toggle_twofa_enabled1' ) ;
var secret = external _jQuery _default ( ) ( '.twofa-secret' ) ;
secret [ toggle . is ( ':checked' ) ? 'addClass' : 'removeClass' ] ( 'show' ) ;
} ;
_2fa _body . on ( 'click' , '.twofa-toggle input' , toggleSecret ) ;
toggleSecret ( ) ;
// EXTERNAL MODULE: ./node_modules/mout/queryString.js
var queryString = _ _webpack _require _ _ ( 66629 ) ;
; // ./app/tools/logs.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var prepareQuery = function prepareQuery ( key , value ) {
return ( 0 , queryString . setParam ) ( _ _webpack _require _ _ . g . location . href , key , value ) ;
} ;
external _jQuery _default ( ) ( document ) . on ( 'change' , '.logs-content .block-select select[name]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var name = target . attr ( 'name' ) ;
var value = target . val ( ) ;
_ _webpack _require _ _ . g . location . href = prepareQuery ( name , value ) ;
} ) ;
; // ./app/tools/restore.js
function restore _typeof ( o ) { "@babel/helpers - typeof" ; return restore _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , restore _typeof ( o ) ; }
function restore _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function restore _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , restore _toPropertyKey ( o . key ) , o ) ; } }
function restore _createClass ( e , r , t ) { return r && restore _defineProperties ( e . prototype , r ) , t && restore _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function restore _toPropertyKey ( t ) { var i = restore _toPrimitive ( t , "string" ) ; return "symbol" == restore _typeof ( i ) ? i : i + "" ; }
function restore _toPrimitive ( t , r ) { if ( "object" != restore _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != restore _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var paramSep = external _GravAdmin _namespaceObject . config . param _sep ;
var task = "task" . concat ( paramSep ) ;
var nonce = "admin-nonce" . concat ( paramSep ) . concat ( external _GravAdmin _namespaceObject . config . admin _nonce ) ;
var base = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , "/update.json" ) ;
var urls = {
restore : "" . concat ( base , "/" ) . concat ( task , "safeUpgradeRestore/" ) . concat ( nonce ) ,
status : "" . concat ( base , "/" ) . concat ( task , "safeUpgradeStatus/" ) . concat ( nonce )
} ;
var RestoreManager = /*#__PURE__*/ function ( ) {
function RestoreManager ( ) {
var _this = this ;
restore _classCallCheck ( this , RestoreManager ) ;
this . job = null ;
this . pollTimer = null ;
2025-10-18 18:26:38 -06:00
this . pollFailures = 0 ;
2025-10-18 13:48:40 -06:00
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-restore-snapshot]' , function ( event ) {
event . preventDefault ( ) ;
var button = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( _this . job ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_this . startRestore ( button ) ;
} ) ;
}
return restore _createClass ( RestoreManager , [ {
key : "startRestore" ,
value : function startRestore ( button ) {
var _this2 = this ;
var snapshot = button . data ( 'restore-snapshot' ) ;
if ( ! snapshot ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
button . prop ( 'disabled' , true ) . addClass ( 'is-loading' ) ;
var body = {
snapshot : snapshot
} ;
utils _request ( urls . restore , {
method : 'post' ,
body : body
} , function ( response ) {
var _translations$PLUGIN _4 ;
button . prop ( 'disabled' , false ) . removeClass ( 'is-loading' ) ;
if ( ! response ) {
var _translations$PLUGIN _ ;
utils _toastr . error ( ( ( _translations$PLUGIN _ = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) === null || _translations$PLUGIN _ === void 0 ? void 0 : _translations$PLUGIN _ . RESTORE _GRAV _FAILED ) || 'Snapshot restore failed.' ) ;
return ;
}
if ( response . status === 'error' ) {
var _translations$PLUGIN _2 ;
utils _toastr . error ( response . message || ( ( _translations$PLUGIN _2 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) === null || _translations$PLUGIN _2 === void 0 ? void 0 : _translations$PLUGIN _2 . RESTORE _GRAV _FAILED ) || 'Snapshot restore failed.' ) ;
return ;
}
var data = response . data || { } ;
var jobId = data . job _id || data . job && data . job . id ;
if ( ! jobId ) {
var _translations$PLUGIN _3 ;
var message = response . message || ( ( _translations$PLUGIN _3 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) === null || _translations$PLUGIN _3 === void 0 ? void 0 : _translations$PLUGIN _3 . RESTORE _GRAV _FAILED ) || 'Snapshot restore failed.' ;
utils _toastr . error ( message ) ;
return ;
}
_this2 . job = {
id : jobId ,
snapshot : snapshot
} ;
2025-10-18 18:26:38 -06:00
_this2 . pollFailures = 0 ;
2025-10-18 13:48:40 -06:00
var runningMessage = ( _translations$PLUGIN _4 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) !== null && _translations$PLUGIN _4 !== void 0 && _translations$PLUGIN _4 . RESTORE _GRAV _RUNNING ? external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . RESTORE _GRAV _RUNNING . replace ( '%s' , snapshot ) : "Restoring snapshot " . concat ( snapshot , "..." ) ;
utils _toastr . info ( runningMessage ) ;
_this2 . schedulePoll ( ) ;
} ) ;
}
} , {
key : "schedulePoll" ,
value : function schedulePoll ( ) {
var _this3 = this ;
var delay = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : 1200 ;
this . clearPoll ( ) ;
this . pollTimer = setTimeout ( function ( ) {
return _this3 . pollStatus ( ) ;
} , delay ) ;
}
} , {
key : "clearPoll" ,
value : function clearPoll ( ) {
if ( this . pollTimer ) {
clearTimeout ( this . pollTimer ) ;
this . pollTimer = null ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
} , {
key : "pollStatus" ,
value : function pollStatus ( ) {
var _this4 = this ;
if ( ! this . job ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var jobId = this . job . id ;
2025-10-18 18:26:38 -06:00
var handled = false ;
2025-10-18 13:48:40 -06:00
utils _request ( "" . concat ( urls . status , "?job=" ) . concat ( encodeURIComponent ( jobId ) ) , {
silentErrors : true
} , function ( response ) {
2025-10-18 18:26:38 -06:00
handled = true ;
_this4 . pollFailures = 0 ;
2025-10-18 13:48:40 -06:00
if ( ! response || response . status !== 'success' ) {
_this4 . schedulePoll ( ) ;
return ;
}
var data = response . data || { } ;
var job = data . job || { } ;
var progress = data . progress || { } ;
var stage = progress . stage || null ;
var status = job . status || progress . status || null ;
if ( stage === 'error' || status === 'error' ) {
var _translations$PLUGIN _5 ;
var message = job . error || progress . message || ( ( _translations$PLUGIN _5 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) === null || _translations$PLUGIN _5 === void 0 ? void 0 : _translations$PLUGIN _5 . RESTORE _GRAV _FAILED ) || 'Snapshot restore failed.' ;
utils _toastr . error ( message ) ;
_this4 . job = null ;
_this4 . clearPoll ( ) ;
return ;
}
if ( stage === 'complete' || status === 'success' ) {
var _translations$PLUGIN _6 , _translations$PLUGIN _7 ;
var snapshot = progress . snapshot || _this4 . job . snapshot ;
var version = job . result && job . result . version || progress . version || '' ;
var successMessage ;
if ( ( _translations$PLUGIN _6 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) !== null && _translations$PLUGIN _6 !== void 0 && _translations$PLUGIN _6 . RESTORE _GRAV _SUCCESS _MESSAGE && version ) {
successMessage = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . RESTORE _GRAV _SUCCESS _MESSAGE . replace ( '%1$s' , snapshot ) . replace ( '%2$s' , version ) ;
} else if ( ( _translations$PLUGIN _7 = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN ) !== null && _translations$PLUGIN _7 !== void 0 && _translations$PLUGIN _7 . RESTORE _GRAV _SUCCESS _SIMPLE ) {
successMessage = external _GravAdmin _namespaceObject . translations . PLUGIN _ADMIN . RESTORE _GRAV _SUCCESS _SIMPLE . replace ( '%s' , snapshot ) ;
} else {
successMessage = version ? "Snapshot " . concat ( snapshot , " restored (Grav " ) . concat ( version , ")." ) : "Snapshot " . concat ( snapshot , " restored." ) ;
}
utils _toastr . success ( successMessage ) ;
_this4 . job = null ;
_this4 . clearPoll ( ) ;
setTimeout ( function ( ) {
return window . location . reload ( ) ;
} , 1500 ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
_this4 . schedulePoll ( ) ;
2025-10-18 18:26:38 -06:00
} ) . then ( function ( ) {
if ( ! handled ) {
_this4 . handleSilentFailure ( ) ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
2025-10-18 18:26:38 -06:00
} , {
key : "handleSilentFailure" ,
value : function handleSilentFailure ( ) {
if ( ! this . job ) {
return ;
}
this . pollFailures += 1 ;
var snapshot = this . job . snapshot || '' ;
if ( this . pollFailures >= 3 ) {
var message = snapshot ? "Snapshot " . concat ( snapshot , " restore is completing. Reloading..." ) : 'Snapshot restore is completing. Reloading...' ;
utils _toastr . info ( message ) ;
this . job = null ;
this . clearPoll ( ) ;
setTimeout ( function ( ) {
return window . location . reload ( ) ;
} , 1500 ) ;
return ;
}
var delay = Math . min ( 5000 , 1200 * this . pollFailures ) ;
this . schedulePoll ( delay ) ;
}
2025-10-18 13:48:40 -06:00
} ] ) ;
} ( ) ; // Initialize restore manager when tools view loads.
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
new RestoreManager ( ) ;
} ) ;
; // ./app/tools/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
; // ./app/whitelabel/compile.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* harmony default export */ const compile = ( function ( ) {
var _ref = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ,
_ref$preview = _ref . preview ,
preview = _ref$preview === void 0 ? false : _ref$preview ,
_ref$exportScss = _ref . exportScss ,
exportScss = _ref$exportScss === void 0 ? false : _ref$exportScss ,
_ref$color _scheme = _ref . color _scheme ,
color _scheme = _ref$color _scheme === void 0 ? { } : _ref$color _scheme ,
_ref$fonts = _ref . fonts ,
fonts = _ref$fonts === void 0 ? { } : _ref$fonts ,
_ref$callback = _ref . callback ,
callback = _ref$callback === void 0 ? function ( ) { } : _ref$callback ;
var task = exportScss ? 'exportScss' : 'compileScss' ;
// console.log(config);
var URI = "" . concat ( external _GravAdmin _namespaceObject . config . base _url _relative , ".json/task:" ) . concat ( task ) ;
utils _request ( URI , {
method : 'post' ,
body : Object . assign ( { } , preview ? {
preview : preview
} : null , color _scheme )
} , callback ) ;
} ) ;
var prepareElement = function prepareElement ( element ) {
element . data ( 'busy_right_now' , true ) ;
if ( ! element . data ( 'current_icon' ) ) {
element . data ( 'current_icon' , element . find ( '.fa' ) . attr ( 'class' ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
element . find ( '.fa' ) . attr ( 'class' , 'fa fa-fw fa-spin fa-refresh' ) ;
} ;
var resetElement = function resetElement ( element ) {
element . data ( 'busy_right_now' , false ) ;
element . find ( '.fa' ) . attr ( 'class' , element . data ( 'current_icon' ) ) ;
} ;
; // ./app/whitelabel/presets.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var presets _body = external _jQuery _default ( ) ( 'body' ) ;
var presets _fields = [ ] ;
var presets _FormState = app _forms . FormState . Instance ;
var setField = function setField ( field , value ) {
var name = field . prop ( 'name' ) ;
var tag = field . prop ( 'tagName' ) . toLowerCase ( ) ;
var type = field . prop ( 'type' ) ;
presets _fields . push ( name ) ;
switch ( tag ) {
case 'select' :
field . val ( value ) ;
field . data ( 'selectize' ) . setValue ( value ) ;
field . trigger ( 'change' ) ;
break ;
case 'input' :
if ( type === 'radio' ) {
var strValue = value ? '1' : '0' ;
field . filter ( function ( index , radio ) {
return external _jQuery _default ( ) ( radio ) . val ( ) === strValue ;
} ) . prop ( 'checked' , true ) ;
break ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( type === 'checkbox' ) {
field . prop ( 'checked' , value ) ;
break ;
}
field . val ( value ) ;
field . trigger ( 'keyup' ) ;
}
} ;
presets _body . on ( 'click' , '[data-preset-values]' , function ( event ) {
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
var data = target . data ( 'preset-values' ) ;
Object . keys ( data ) . forEach ( function ( section ) {
if ( typeof data [ section ] === 'string' ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
Object . keys ( data [ section ] ) . forEach ( function ( key ) {
var field = external _jQuery _default ( ) ( "[name=\"data[whitelabel][color_scheme][" . concat ( section , "][" ) . concat ( key , "]\"], [name=\"data[" ) . concat ( section , "][" ) . concat ( key , "]\"]" ) ) ;
var value = data [ section ] [ key ] ;
setField ( field , value ) ;
} ) ;
} ) ;
} ) ;
presets _body . on ( 'click' , '[data-reset-scss]' , function ( event ) {
event && event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
var links = external _jQuery _default ( ) ( 'link[id^=admin-pro-preview-]' ) ;
element . remove ( ) ;
links . remove ( ) ;
presets _fields . forEach ( function ( field ) {
var value = presets _FormState . loadState . get ( field ) ;
setField ( external _jQuery _default ( ) ( "[name=\"" . concat ( field , "\"]" ) ) , value ) ;
} ) ;
presets _fields = [ ] ;
} ) ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Horizontal Scroll Functionality
( external _jQuery _default ( ) ) . fn . hscrollarrows = function ( ) {
return this . each ( function ( ) {
var navNext = external _jQuery _default ( ) ( '<a class="nav-next hide"></a>' ) ;
var navPrev = external _jQuery _default ( ) ( '<a class="nav-prev hide"></a>' ) ;
var scrollTime = null ;
var resizeTime = null ;
var scrolling = false ;
var elm _w = 0 ;
var elem _data _w = 0 ;
var max _scroll = 0 ;
var inc _scroll = 0 ;
var calcData = function calcData ( ) {
elm _w = elem . width ( ) ;
elem _data _w = elem _data . get ( 0 ) . scrollWidth ;
max _scroll = elem _data _w - elm _w ;
inc _scroll = elm _w * 0.3 ; // 20%
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var revalidate = function revalidate ( ) {
calcData ( ) ;
stateNavs ( ) ;
} ;
var run = function run ( ) {
calcData ( ) ;
setupNavs ( ) ;
} ;
var setupNavs = function setupNavs ( ) {
elem . parent ( ) . prepend ( navNext ) ;
elem . parent ( ) . prepend ( navPrev ) ;
navNext . on ( 'click' , next ) ;
navPrev . on ( 'click' , prev ) ;
stateNavs ( ) ;
external _jQuery _default ( ) ( elem ) . scroll ( function ( ) {
if ( ! scrolling ) {
clearTimeout ( scrollTime ) ;
scrollTime = setTimeout ( function ( ) {
stateNavs ( ) ;
} , 250 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
external _jQuery _default ( ) ( window ) . resize ( function ( ) {
clearTimeout ( resizeTime ) ;
resizeTime = setTimeout ( function ( ) {
revalidate ( ) ;
} , 250 ) ;
} ) ;
} ;
var stateNavs = function stateNavs ( ) {
var current _scroll = elem . scrollLeft ( ) ;
if ( current _scroll < max _scroll ) {
navNext . removeClass ( 'hide' ) ;
} else {
navNext . addClass ( 'hide' ) ;
}
if ( current _scroll > 0 ) {
navPrev . removeClass ( 'hide' ) ;
} else {
navPrev . addClass ( 'hide' ) ;
}
scrolling = false ;
} ;
var next = function next ( ) {
var current _scroll = elem . scrollLeft ( ) ;
if ( current _scroll < max _scroll ) {
scrolling = true ;
elem . stop ( ) . animate ( {
scrollLeft : current _scroll + inc _scroll
} , stateNavs ) ;
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
var prev = function prev ( ) {
var current _scroll = elem . scrollLeft ( ) ;
if ( current _scroll > 0 ) {
scrolling = true ;
elem . stop ( ) . animate ( {
scrollLeft : current _scroll - inc _scroll
} , stateNavs ) ;
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
var elem = external _jQuery _default ( ) ( this ) ;
var elem _data = external _jQuery _default ( ) ( ':first-child' , elem ) ;
run ( ) ;
} ) ;
} ;
external _jQuery _default ( ) ( document ) . ready ( function ( ) {
external _jQuery _default ( ) ( '.jquery-horizontal-scroll' ) . hscrollarrows ( ) ;
} ) ;
; // ./app/whitelabel/index.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var whitelabel _body = external _jQuery _default ( ) ( 'body' ) ;
var whitelabel _FormState = app _forms . FormState . Instance ;
var compiler = function compiler ( element ) {
var preview = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
var exportScss = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : false ;
var _callback = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : function ( ) { } ;
prepareElement ( element ) ;
var fields = whitelabel _FormState . collect ( ) ;
compile ( {
preview : preview ,
exportScss : exportScss ,
color _scheme : ! fields ? [ ] : fields . filter ( function ( value , key ) {
return key . match ( /^data\[whitelabel]\[color_scheme]/ ) ;
} ) . toJS ( ) ,
callback : function callback ( response ) {
_callback . call ( _callback , response ) ;
resetElement ( element ) ;
}
} ) ;
} ;
whitelabel _body . on ( 'click' , '[data-preview-scss]' , function ( event ) {
event && event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( element . data ( 'busy_right_now' ) ) {
return false ;
}
compiler ( element , true , false , function ( response ) {
if ( response . files ) {
Object . keys ( response . files ) . forEach ( function ( key ) {
var file = external _jQuery _default ( ) ( "#admin-pro-preview-" . concat ( key ) ) ;
var timestamp = Date . now ( ) ;
if ( ! file . length ) {
file = external _jQuery _default ( ) ( "<link id=\"admin-pro-preview-" . concat ( key , "\" type=\"text/css\" rel=\"stylesheet\" />" ) ) ;
external _jQuery _default ( ) ( 'head' ) . append ( file ) ;
if ( ! external _jQuery _default ( ) ( '[data-reset-scss]' ) . length ) {
var reset = external _jQuery _default ( ) ( '<button class="button" data-reset-scss style="margin-left: 5px;"><i class="fa fa-fw fa-history"></i> Reset</button>' ) ;
reset . insertAfter ( element ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
file . attr ( 'href' , "" . concat ( response . files [ key ] , "?" ) . concat ( timestamp ) ) ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
}
} ) ;
} ) ;
whitelabel _body . on ( 'click' , '[data-recompile-scss]' , function ( event ) {
event && event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( element . data ( 'busy_right_now' ) ) {
return false ;
}
compiler ( element , true , false ) ;
} ) ;
whitelabel _body . on ( 'click' , '[data-export-scss]' , function ( event ) {
event && event . preventDefault ( ) ;
var element = external _jQuery _default ( ) ( event . currentTarget ) ;
if ( element . data ( 'busy_right_now' ) ) {
return false ;
}
compiler ( element , true , true , function ( response ) {
if ( response . files ) {
Object . keys ( response . files ) . forEach ( function ( key ) {
if ( key === 'download' ) {
var _element = document . createElement ( 'a' ) ;
_element . setAttribute ( 'href' , response . files [ key ] ) ;
_element . setAttribute ( 'download' , '' ) ;
_element . style . display = 'none' ;
document . body . appendChild ( _element ) ;
_element . click ( ) ;
document . body . removeChild ( _element ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ) ;
}
} ) ;
} ) ;
whitelabel _body . on ( 'change._grav_colorpicker' , '[data-grav-colorpicker]' , function ( event , input , hex , opacity ) {
var RGB = hex2rgb ( hex ) ;
var YIQ = ( RGB . r * 299 + RGB . g * 587 + RGB . b * 114 ) / 1000 ;
var contrast = YIQ >= 128 || opacity <= 0.50 ? 'dark' : 'light' ;
input . parent ( ) . removeClass ( 'dark-text light-text' ) . addClass ( "" . concat ( contrast , "-text" ) ) ;
} ) ;
whitelabel _body . ready ( function ( ) {
external _jQuery _default ( ) ( '[data-grav-colorpicker]' ) . trigger ( 'keyup' ) ;
} ) ;
; // ./app/utils/bootstrap-transition.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
+ function ( $ ) {
'use strict' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd ( ) {
var el = document . createElement ( 'bootstrap' ) ;
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd' ,
MozTransition : 'transitionend' ,
OTransition : 'oTransitionEnd otransitionend' ,
transition : 'transitionend'
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
for ( var name in transEndEventNames ) {
if ( el . style [ name ] !== undefined ) {
return {
end : transEndEventNames [ name ]
} ;
}
}
return false ; // explicit for ie8 ( ._.)
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// http://blog.alexmaccaw.com/css-transitions
$ . fn . emulateTransitionEnd = function ( duration ) {
var called = false ;
var $el = this ;
$ ( this ) . one ( 'bsTransitionEnd' , function ( ) {
called = true ;
} ) ;
var callback = function callback ( ) {
if ( ! called ) $ ( $el ) . trigger ( $ . support . transition . end ) ;
} ;
setTimeout ( callback , duration ) ;
return this ;
} ;
$ ( function ( ) {
$ . support . transition = transitionEnd ( ) ;
if ( ! $ . support . transition ) return ;
$ . event . special . bsTransitionEnd = {
bindType : $ . support . transition . end ,
delegateType : $ . support . transition . end ,
handle : function handle ( e ) {
if ( $ ( e . target ) . is ( this ) ) return e . handleObj . handler . apply ( this , arguments ) ;
2025-10-16 10:59:50 -06:00
}
} ;
2025-10-18 13:48:40 -06:00
} ) ;
} ( ( external _jQuery _default ( ) ) ) ;
; // ./app/utils/bootstrap-collapse.js
function bootstrap _collapse _typeof ( o ) { "@babel/helpers - typeof" ; return bootstrap _collapse _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , bootstrap _collapse _typeof ( o ) ; }
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Bootstrap : collapse . js v3 . 4.0
* http : //getbootstrap.com/javascript/#collapse
* === === === === === === === === === === === === === === === === === === === === === === === ===
* Copyright 2011 - 2016 Twitter , Inc .
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/master/LICENSE)
* === === === === === === === === === === === === === === === === === === === === === === === === * /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/* jshint latedef: false */
+ function ( $ ) {
'use strict' ;
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var _Collapse = function Collapse ( element , options ) {
this . $element = $ ( element ) ;
this . options = $ . extend ( { } , _Collapse . DEFAULTS , options ) ;
this . $trigger = $ ( '[data-toggle="collapse"][href="#' + element . id + '"],' + '[data-toggle="collapse"][data-target="#' + element . id + '"]' ) ;
this . transitioning = null ;
if ( this . options . parent ) {
this . $parent = this . getParent ( ) ;
} else {
this . addAriaAndCollapsedClass ( this . $element , this . $trigger ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( this . options . toggle ) this . toggle ( ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
_Collapse . VERSION = '3.4.0' ;
_Collapse . TRANSITION _DURATION = 350 ;
_Collapse . DEFAULTS = {
toggle : true
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
_Collapse . prototype . dimension = function ( ) {
var hasWidth = this . $element . hasClass ( 'width' ) ;
return hasWidth ? 'width' : 'height' ;
} ;
_Collapse . prototype . show = function ( ) {
if ( this . transitioning || this . $element . hasClass ( 'in' ) ) return ;
var activesData ;
var actives = this . $parent && this . $parent . children ( '.panel' ) . children ( '.in, .collapsing' ) ;
if ( actives && actives . length ) {
activesData = actives . data ( 'bs.collapse' ) ;
if ( activesData && activesData . transitioning ) return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var startEvent = $ . Event ( 'show.bs.collapse' ) ;
this . $element . trigger ( startEvent ) ;
if ( startEvent . isDefaultPrevented ( ) ) return ;
if ( actives && actives . length ) {
Plugin . call ( actives , 'hide' ) ;
activesData || actives . data ( 'bs.collapse' , null ) ;
}
var dimension = this . dimension ( ) ;
this . $element . removeClass ( 'collapse' ) . addClass ( 'collapsing' ) [ dimension ] ( 0 ) . attr ( 'aria-expanded' , true ) ;
this . $trigger . removeClass ( 'collapsed' ) . attr ( 'aria-expanded' , true ) ;
this . transitioning = 1 ;
var complete = function complete ( ) {
this . $element . removeClass ( 'collapsing' ) . addClass ( 'collapse in' ) [ dimension ] ( '' ) ;
this . transitioning = 0 ;
this . $element . trigger ( 'shown.bs.collapse' ) ;
} ;
if ( ! $ . support . transition ) return complete . call ( this ) ;
var scrollSize = $ . camelCase ( [ 'scroll' , dimension ] . join ( '-' ) ) ;
this . $element . one ( 'bsTransitionEnd' , $ . proxy ( complete , this ) ) . emulateTransitionEnd ( _Collapse . TRANSITION _DURATION ) [ dimension ] ( this . $element [ 0 ] [ scrollSize ] ) ;
} ;
_Collapse . prototype . hide = function ( ) {
if ( this . transitioning || ! this . $element . hasClass ( 'in' ) ) return ;
var startEvent = $ . Event ( 'hide.bs.collapse' ) ;
this . $element . trigger ( startEvent ) ;
if ( startEvent . isDefaultPrevented ( ) ) return ;
var dimension = this . dimension ( ) ;
this . $element [ dimension ] ( this . $element [ dimension ] ( ) ) [ 0 ] . offsetHeight ;
this . $element . addClass ( 'collapsing' ) . removeClass ( 'collapse in' ) . attr ( 'aria-expanded' , false ) ;
this . $trigger . addClass ( 'collapsed' ) . attr ( 'aria-expanded' , false ) ;
this . transitioning = 1 ;
var complete = function complete ( ) {
this . transitioning = 0 ;
this . $element . removeClass ( 'collapsing' ) . addClass ( 'collapse' ) . trigger ( 'hidden.bs.collapse' ) ;
} ;
if ( ! $ . support . transition ) return complete . call ( this ) ;
this . $element [ dimension ] ( 0 ) . one ( 'bsTransitionEnd' , $ . proxy ( complete , this ) ) . emulateTransitionEnd ( _Collapse . TRANSITION _DURATION ) ;
} ;
_Collapse . prototype . toggle = function ( ) {
this [ this . $element . hasClass ( 'in' ) ? 'hide' : 'show' ] ( ) ;
} ;
_Collapse . prototype . getParent = function ( ) {
return $ ( this . options . parent ) . find ( '[data-toggle="collapse"][data-parent="' + this . options . parent + '"]' ) . each ( $ . proxy ( function ( i , element ) {
var $element = $ ( element ) ;
this . addAriaAndCollapsedClass ( getTargetFromTrigger ( $element ) , $element ) ;
} , this ) ) . end ( ) ;
} ;
_Collapse . prototype . addAriaAndCollapsedClass = function ( $element , $trigger ) {
var isOpen = $element . hasClass ( 'in' ) ;
$element . attr ( 'aria-expanded' , isOpen ) ;
$trigger . toggleClass ( 'collapsed' , ! isOpen ) . attr ( 'aria-expanded' , isOpen ) ;
} ;
function getTargetFromTrigger ( $trigger ) {
var href ;
var target = $trigger . attr ( 'data-target' ) || ( href = $trigger . attr ( 'href' ) ) && href . replace ( /.*(?=#[^\s]+$)/ , '' ) ; // strip for ie7
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
return $ ( target ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// COLLAPSE PLUGIN DEFINITION
// ==========================
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
function Plugin ( option ) {
return this . each ( function ( ) {
var $this = $ ( this ) ;
var data = $this . data ( 'bs.collapse' ) ;
var options = $ . extend ( { } , _Collapse . DEFAULTS , $this . data ( ) , bootstrap _collapse _typeof ( option ) === 'object' && option ) ;
if ( ! data && options . toggle && /show|hide/ . test ( option ) ) options . toggle = false ;
if ( ! data ) $this . data ( 'bs.collapse' , data = new _Collapse ( this , options ) ) ;
if ( typeof option === 'string' ) data [ option ] ( ) ;
2025-10-16 10:59:50 -06:00
} ) ;
}
2025-10-18 13:48:40 -06:00
var old = $ . fn . collapse ;
$ . fn . collapse = Plugin ;
$ . fn . collapse . Constructor = _Collapse ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// COLLAPSE NO CONFLICT
// ====================
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
$ . fn . collapse . noConflict = function ( ) {
$ . fn . collapse = old ;
return this ;
} ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
// COLLAPSE DATA-API
// =================
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
$ ( document ) . on ( 'click.bs.collapse.data-api' , '[data-toggle="collapse"]' , function ( e ) {
var $this = $ ( this ) ;
if ( ! $this . attr ( 'data-target' ) ) e . preventDefault ( ) ;
var $target = getTargetFromTrigger ( $this ) ;
var data = $target . data ( 'bs.collapse' ) ;
var option = data ? 'toggle' : $this . data ( ) ;
Plugin . call ( $target , option ) ;
} ) ;
} ( ( external _jQuery _default ( ) ) ) ;
; // ./app/utils/bootstrap-dropdown.js
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Bootstrap : dropdown . js v3 . 4.1
* https : //getbootstrap.com/docs/3.4/javascript/#dropdowns
* === === === === === === === === === === === === === === === === === === === === === === === ===
* Copyright 2011 - 2019 Twitter , Inc .
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/v3-dev/LICENSE)
* === === === === === === === === === === === === === === === === === === === === === === === === * /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
+ function ( $ ) {
'use strict' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop' ;
var toggle = '[data-toggle="dropdown"]' ;
var Dropdown = function Dropdown ( element ) {
$ ( element ) . on ( 'click.bs.dropdown' , this . toggle ) ;
} ;
Dropdown . VERSION = '3.4.1' ;
function getParent ( $this ) {
var selector = $this . attr ( 'data-target' ) ;
if ( ! selector ) {
selector = $this . attr ( 'href' ) ;
selector = selector && /#[A-Za-z]/ . test ( selector ) && selector . replace ( /.*(?=#[^\s]*$)/ , '' ) ; // strip for ie7
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var $parent = selector !== '#' ? $ ( document ) . find ( selector ) : null ;
return $parent && $parent . length ? $parent : $this . parent ( ) ;
}
function clearMenus ( e ) {
if ( e && e . which === 3 ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$ ( backdrop ) . remove ( ) ;
$ ( toggle ) . each ( function ( ) {
var $this = $ ( this ) ;
var $parent = getParent ( $this ) ;
var relatedTarget = {
relatedTarget : this
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
if ( ! $parent . hasClass ( 'open' ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( e && e . type === 'click' && /input|textarea/i . test ( e . target . tagName ) && $ . contains ( $parent [ 0 ] , e . target ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$parent . trigger ( e = $ . Event ( 'hide.bs.dropdown' , relatedTarget ) ) ;
if ( e . isDefaultPrevented ( ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$this . attr ( 'aria-expanded' , 'false' ) ;
$parent . removeClass ( 'open' ) . trigger ( $ . Event ( 'hidden.bs.dropdown' , relatedTarget ) ) ;
} ) ;
}
Dropdown . prototype . toggle = function ( e ) {
var $this = $ ( this ) ;
if ( $this . is ( '.disabled, :disabled' ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var $parent = getParent ( $this ) ;
var isActive = $parent . hasClass ( 'open' ) ;
clearMenus ( ) ;
if ( ! isActive ) {
if ( 'ontouchstart' in document . documentElement && ! $parent . closest ( '.navbar-nav' ) . length ) {
// if mobile we use a backdrop because click events don't delegate
$ ( document . createElement ( 'div' ) ) . addClass ( 'dropdown-backdrop' ) . insertAfter ( $ ( this ) ) . on ( 'click' , clearMenus ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var relatedTarget = {
relatedTarget : this
} ;
$parent . trigger ( e = $ . Event ( 'show.bs.dropdown' , relatedTarget ) ) ;
if ( e . isDefaultPrevented ( ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
$this . trigger ( 'focus' ) . attr ( 'aria-expanded' , 'true' ) ;
$parent . toggleClass ( 'open' ) . trigger ( $ . Event ( 'shown.bs.dropdown' , relatedTarget ) ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return false ;
} ;
Dropdown . prototype . keydown = function ( e ) {
if ( ! /(38|40|27|32)/ . test ( e . which ) || /input|textarea/i . test ( e . target . tagName ) ) return ;
var $this = $ ( this ) ;
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
if ( $this . is ( '.disabled, :disabled' ) ) {
return ;
}
var $parent = getParent ( $this ) ;
var isActive = $parent . hasClass ( 'open' ) ;
if ( ! isActive && e . which !== 27 || isActive && e . which === 27 ) {
if ( e . which === 27 ) {
$parent . find ( toggle ) . trigger ( 'focus' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return $this . trigger ( 'click' ) ;
}
var desc = ' li:not(.disabled):visible a' ;
var $items = $parent . find ( '.dropdown-menu' + desc ) ;
if ( ! $items . length ) {
return ;
}
var index = $items . index ( e . target ) ;
if ( e . which === 38 && index > 0 ) {
index -- ;
} // up
if ( e . which === 40 && index < $items . length - 1 ) {
index ++ ;
} // down
if ( ! ~ index ) {
index = 0 ;
}
$items . eq ( index ) . trigger ( 'focus' ) ;
} ;
// DROPDOWN PLUGIN DEFINITION
// ==========================
function Plugin ( option ) {
return this . each ( function ( ) {
var $this = $ ( this ) ;
var data = $this . data ( 'bs.dropdown' ) ;
if ( ! data ) $this . data ( 'bs.dropdown' , data = new Dropdown ( this ) ) ;
if ( typeof option === 'string' ) data [ option ] . call ( $this ) ;
} ) ;
}
var old = $ . fn . dropdown ;
$ . fn . dropdown = Plugin ;
$ . fn . dropdown . Constructor = Dropdown ;
// DROPDOWN NO CONFLICT
// ====================
$ . fn . dropdown . noConflict = function ( ) {
$ . fn . dropdown = old ;
return this ;
} ;
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$ ( document ) . on ( 'click.bs.dropdown.data-api' , clearMenus ) . on ( 'click.bs.dropdown.data-api' , '.dropdown form' , function ( e ) {
e . stopPropagation ( ) ;
} ) . on ( 'click.bs.dropdown.data-api' , toggle , Dropdown . prototype . toggle ) . on ( 'keydown.bs.dropdown.data-api' , toggle , Dropdown . prototype . keydown ) . on ( 'keydown.bs.dropdown.data-api' , '.dropdown-menu' , Dropdown . prototype . keydown ) ;
} ( ( external _jQuery _default ( ) ) ) ;
; // ./app/utils/tabs-memory.js
var tabs _memory _Data = JSON . parse ( cookies . get ( 'grav-tabs-state' ) || '{}' ) ;
external _jQuery _default ( ) ( 'body' ) . on ( 'touchstart click' , '[data-tabid]' , function ( event ) {
event && event . stopPropagation ( ) ;
var target = external _jQuery _default ( ) ( event . currentTarget ) ;
tabs _memory _Data [ target . data ( 'tabkey' ) ] = target . data ( 'scope' ) ;
cookies . set ( 'grav-tabs-state' , JSON . stringify ( tabs _memory _Data ) , {
expires : Infinity
} ) ;
var panel = external _jQuery _default ( ) ( "[id=\"" . concat ( target . data ( 'tabid' ) , "\"]" ) ) ;
target . siblings ( '[data-tabid]' ) . removeClass ( 'active' ) ;
target . addClass ( 'active' ) ;
panel . siblings ( '[id]' ) . removeClass ( 'active' ) ;
panel . addClass ( 'active' ) ;
editor _Instance . editors . each ( function ( index , editor ) {
var codemirror = external _jQuery _default ( ) ( editor ) . data ( 'codemirror' ) ;
if ( ! codemirror ) {
return ;
}
if ( codemirror . display . lastWrapWidth === 0 ) {
codemirror . refresh ( ) ;
}
} ) ;
} ) ;
; // ./app/utils/changelog.js
/* eslint-disable */
var TRIGGER = null ;
external _jQuery _default ( ) ( document ) . on ( 'click' , '[data-remodal-changelog]' , function ( event ) {
TRIGGER = event . currentTarget ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'opened' , '[data-remodal-id="changelog"]' , function ( ) {
var instance = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( '[data-remodal-id=changelog]' ) . data ( 'remodal' ) ] ;
instance . $modal . html ( '<div class="changelog-overflow center" style="padding:5rem 0;text-align:center;"><i class="fa fa-spinner fa-spin fa-3x fa-fw"></i></div>' ) ;
if ( ! TRIGGER ) {
return true ;
}
var url = external _jQuery _default ( ) ( TRIGGER ) . data ( 'remodalChangelog' ) ;
external _jQuery _default ( ) . ajax ( {
url : url
} ) . done ( function ( data ) {
instance . $modal . html ( data ) ;
} ) ;
} ) ;
external _jQuery _default ( ) ( document ) . on ( 'closed' , '[data-remodal-id="changelog"]' , function ( ) {
var instance = ( external _jQuery _default ( ) ) . remodal . lookup [ external _jQuery _default ( ) ( '[data-remodal-id=changelog]' ) . data ( 'remodal' ) ] ;
instance . $modal . html ( '' ) ;
} ) ;
; // ./app/utils/sidebar.js
function sidebar _typeof ( o ) { "@babel/helpers - typeof" ; return sidebar _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , sidebar _typeof ( o ) ; }
function sidebar _classCallCheck ( a , n ) { if ( ! ( a instanceof n ) ) throw new TypeError ( "Cannot call a class as a function" ) ; }
function sidebar _defineProperties ( e , r ) { for ( var t = 0 ; t < r . length ; t ++ ) { var o = r [ t ] ; o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( e , sidebar _toPropertyKey ( o . key ) , o ) ; } }
function sidebar _createClass ( e , r , t ) { return r && sidebar _defineProperties ( e . prototype , r ) , t && sidebar _defineProperties ( e , t ) , Object . defineProperty ( e , "prototype" , { writable : ! 1 } ) , e ; }
function sidebar _toPropertyKey ( t ) { var i = sidebar _toPrimitive ( t , "string" ) ; return "symbol" == sidebar _typeof ( i ) ? i : i + "" ; }
function sidebar _toPrimitive ( t , r ) { if ( "object" != sidebar _typeof ( t ) || ! t ) return t ; var e = t [ Symbol . toPrimitive ] ; if ( void 0 !== e ) { var i = e . call ( t , r || "default" ) ; if ( "object" != sidebar _typeof ( i ) ) return i ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( "string" === r ? String : Number ) ( t ) ; }
var MOBILE _BREAKPOINT = 48 - 0.062 ;
var DESKTOP _BREAKPOINT = 75 + 0.063 ;
var EVENTS = 'touchstart._grav click._grav' ;
var TARGETS = '[data-sidebar-mobile-toggle], #overlay' ;
var MOBILE _QUERY = "(max-width: " . concat ( MOBILE _BREAKPOINT , "em)" ) ;
var DESKTOP _QUERY = "(min-width: " . concat ( DESKTOP _BREAKPOINT , "em)" ) ;
var map = new _ _webpack _require _ _ . g . Map ( ) ;
var Sidebar = /*#__PURE__*/ function ( ) {
function Sidebar ( ) {
sidebar _classCallCheck ( this , Sidebar ) ;
this . timeout = null ;
this . isOpen = false ;
this . body = external _jQuery _default ( ) ( 'body' ) ;
this . matchMedia = _ _webpack _require _ _ . g . matchMedia ( MOBILE _QUERY ) ;
this . enable ( ) ;
}
return sidebar _createClass ( Sidebar , [ {
key : "enable" ,
value : function enable ( ) {
var sidebar = external _jQuery _default ( ) ( '#admin-sidebar' ) ;
this . matchMedia . addListener ( this . _getBound ( 'checkMatch' ) ) ;
this . checkMatch ( this . matchMedia ) ;
this . body . on ( EVENTS , '[data-sidebar-toggle]' , this . _getBound ( 'toggleSidebarState' ) ) ;
if ( sidebar . data ( 'quickopen' ) ) {
sidebar . hover ( this . _getBound ( 'quickOpenIn' ) , this . _getBound ( 'quickOpenOut' ) ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "disable" ,
value : function disable ( ) {
var sidebar = external _jQuery _default ( ) ( '#admin-sidebar' ) ;
this . close ( ) ;
this . matchMedia . removeListener ( this . _getBound ( 'checkMatch' ) ) ;
this . body . off ( EVENTS , '[data-sidebar-toggle]' , this . _getBound ( 'toggleSidebarState' ) ) ;
if ( sidebar . data ( 'quickopen' ) ) {
sidebar . off ( 'mouseenter mouseleave' ) ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "attach" ,
value : function attach ( ) {
this . body . on ( EVENTS , TARGETS , this . _getBound ( 'toggle' ) ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "detach" ,
value : function detach ( ) {
this . body . off ( EVENTS , TARGETS , this . _getBound ( 'toggle' ) ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "quickOpenIn" ,
value : function quickOpenIn ( /* event */
) {
var _this = this ;
var isDesktop = _ _webpack _require _ _ . g . matchMedia ( DESKTOP _QUERY ) . matches ;
var delay = external _jQuery _default ( ) ( '#admin-sidebar' ) . data ( 'quickopen-delay' ) || 500 ;
if ( this . body . hasClass ( 'sidebar-mobile-open' ) ) {
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var shouldQuickOpen = isDesktop ? this . body . hasClass ( 'sidebar-closed' ) : ! this . body . hasClass ( 'sidebar-open' ) ;
if ( ! shouldQuickOpen && ! this . body . hasClass ( 'sidebar-quickopen' ) ) {
return this . quickOpenOut ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
this . timeout = setTimeout ( function ( ) {
_this . body . addClass ( 'sidebar-open sidebar-quickopen' ) ;
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . trigger ( 'sidebar_state._grav' , isDesktop ) ;
} , delay ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "quickOpenOut" ,
value : function quickOpenOut ( /* event */
) {
clearTimeout ( this . timeout ) ;
if ( this . body . hasClass ( 'sidebar-quickopen' ) ) {
this . body . removeClass ( 'sidebar-open sidebar-quickopen' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return true ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "open" ,
value : function open ( event ) {
2025-10-16 10:59:50 -06:00
var _this2 = this ;
2025-10-18 13:48:40 -06:00
var quick = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
if ( event ) {
event . preventDefault ( ) ;
}
var overlay = external _jQuery _default ( ) ( '#overlay' ) ;
var sidebar = external _jQuery _default ( ) ( '#admin-sidebar' ) ;
this . body . addClass ( 'sidebar-mobile-open' ) ;
overlay . css ( 'display' , 'block' ) ;
if ( ! quick ) {
sidebar . css ( 'display' , 'block' ) . animate ( {
opacity : 1
} , 200 , function ( ) {
_this2 . isOpen = true ;
} ) ;
} else {
sidebar . css ( {
display : 'block' ,
opacity : 1
} ) ;
this . isOpen = true ;
2025-10-16 10:59:50 -06:00
}
}
} , {
2025-10-18 13:48:40 -06:00
key : "close" ,
value : function close ( event ) {
var _this3 = this ;
var quick = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
if ( event ) {
event . preventDefault ( ) ;
}
var overlay = external _jQuery _default ( ) ( '#overlay' ) ;
var sidebar = external _jQuery _default ( ) ( '#admin-sidebar' ) ;
this . body . removeClass ( 'sidebar-mobile-open' ) ;
overlay . css ( 'display' , 'none' ) ;
if ( ! quick ) {
sidebar . animate ( {
opacity : 0
} , 200 , function ( ) {
sidebar . css ( 'display' , 'none' ) ;
_this3 . isOpen = false ;
} ) ;
} else {
sidebar . css ( {
opacity : 0 ,
display : 'none'
} ) ;
this . isOpen = false ;
}
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "toggle" ,
value : function toggle ( event ) {
if ( event ) {
event . preventDefault ( ) ;
}
return this [ this . isOpen ? 'close' : 'open' ] ( event ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} , {
key : "toggleSidebarState" ,
value : function toggleSidebarState ( event ) {
if ( event ) {
event . preventDefault ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
clearTimeout ( this . timeout ) ;
var isDesktop = _ _webpack _require _ _ . g . matchMedia ( DESKTOP _QUERY ) . matches ;
var cookie = null ;
if ( isDesktop ) {
this . body . removeClass ( 'sidebar-open' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! isDesktop ) {
this . body . removeClass ( 'sidebar-closed' ) ;
this . body . removeClass ( 'sidebar-mobile-open' ) ;
}
this . body . toggleClass ( "sidebar-" . concat ( isDesktop ? 'closed' : 'open' ) ) ;
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . trigger ( 'sidebar_state._grav' , isDesktop ) ;
if ( isDesktop ) {
cookie = ! this . body . hasClass ( 'sidebar-closed' ) ;
} else {
cookie = this . body . hasClass ( 'sidebar-open' ) ;
}
cookies . set ( 'grav-admin-sidebar' , cookie , {
expires : Infinity
} ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "checkMatch" ,
value : function checkMatch ( data ) {
var sidebar = external _jQuery _default ( ) ( '#admin-sidebar' ) ;
var overlay = external _jQuery _default ( ) ( '#overlay' ) ;
this . isOpen = false ;
overlay . css ( 'display' , 'none' ) ;
sidebar . css ( {
display : data . matches ? 'none' : 'inherit' ,
opacity : data . matches ? 0 : 1
} ) ;
if ( data . matches ) {
this . body . removeClass ( 'sidebar-open sidebar-closed' ) ;
}
this [ data . matches ? 'attach' : 'detach' ] ( ) ;
2025-10-16 10:59:50 -06:00
}
} , {
2025-10-18 13:48:40 -06:00
key : "_resetMap" ,
value : function _resetMap ( ) {
return map . clear ( ) ;
}
} , {
key : "_getBound" ,
value : function _getBound ( fn ) {
if ( map . has ( fn ) ) {
return map . get ( fn ) ;
}
return map . set ( fn , this [ fn ] . bind ( this ) ) . get ( fn ) ;
2025-10-16 10:59:50 -06:00
}
} ] ) ;
} ( ) ;
2025-10-18 13:48:40 -06:00
var sidebar _Instance = new Sidebar ( ) ;
; // ./app/main.js
// polyfills
// bootstrap jQuery extensions
// tabs memory
// changelog
// Main Sidebar
// starts the keep alive (if enabled), but never on auth views like login/forgot/reset/register
var AUTH _VIEWS = [ 'login' , 'forgot' , 'reset' , 'register' ] ;
var isAuthView = AUTH _VIEWS . includes ( String ( external _GravAdmin _namespaceObject . config . route || '' ) ) ;
if ( ! isAuthView && String ( external _GravAdmin _namespaceObject . config . keep _alive _enabled ) !== '0' ) {
keepalive . start ( ) ;
}
// catch legacy jQuery XHR 401/403 globally
bindGlobalAjaxTrap ( ) ;
// intercept admin nav clicks to show modal before redirect on timeout
installNavigationGuard ( ) ;
// global event to catch sidebar_state changes
external _jQuery _default ( ) ( _ _webpack _require _ _ . g ) . on ( 'sidebar_state._grav' , function ( ) {
Object . keys ( dashboard . Chart . Instances ) . forEach ( function ( chart ) {
setTimeout ( function ( ) {
return dashboard . Chart . Instances [ chart ] . chart . update ( ) ;
} , 10 ) ;
2025-10-16 10:59:50 -06:00
} ) ;
} ) ;
2025-10-18 13:48:40 -06:00
/* harmony default export */ const main = ( {
GPM : {
GPM : GPM ,
Instance : gpm _Instance
} ,
KeepAlive : keepalive ,
Dashboard : dashboard ,
Pages : pages ,
Forms : app _forms ,
Updates : {
Updates : Updates ,
Notifications : updates _notifications ,
Feed : updates _feed ,
Instance : updates _Instance
} ,
Sidebar : {
Sidebar : Sidebar ,
Instance : sidebar _Instance
} ,
MediaFilter : {
MediaFilter : Filter ,
Instance : app _media _Instance
} ,
Scrollbar : {
Scrollbar : {
deprecated : true
} ,
Instance : {
deprecated : true
}
} ,
Utils : {
request : utils _request ,
toastr : utils _toastr ,
Cookies : cookies ,
UriToMarkdown : UriToMarkdown
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ 41669 :
/***/ ( ( module ) => {
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
"use strict" ;
module . exports = jQuery ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ 61954 :
/***/ ( ( module ) => {
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
"use strict" ;
module . exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=" ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ 70086 :
/***/ ( ( module , exports , _ _webpack _require _ _ ) => {
var _ _WEBPACK _AMD _DEFINE _FACTORY _ _ , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ , _ _WEBPACK _AMD _DEFINE _RESULT _ _ ; function _typeof ( o ) { "@babel/helpers - typeof" ; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , _typeof ( o ) ; }
/ * ! v e r s i o n : 4 . 1 7 . 4 7
=== === === === === === === === === === === === === === === === === === ===
bootstrap - datetimejs
https : //github.com/Eonasdan/bootstrap-datetimepicker
Copyright ( c ) 2015 Jonathan Peterson
=== === === === === === === === === === === === === === === === === === ===
* /
/ *
The MIT License ( MIT )
Copyright ( c ) 2015 Jonathan Peterson
Permission is hereby granted , free of charge , to any person obtaining a copy
of this software and associated documentation files ( the "Software" ) , to deal
in the Software without restriction , including without limitation the rights
to use , copy , modify , merge , publish , distribute , sublicense , and / or sell
copies of the Software , and to permit persons to whom the Software is
furnished to do so , subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software .
THE SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM ,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE .
* /
/* global define:false */
/* global jQuery:false */
/* global moment:false */
( function ( factory ) {
'use strict' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
if ( true ) {
// AMD is used - Register as an anonymous module.
! ( _ _WEBPACK _AMD _DEFINE _ARRAY _ _ = [ _ _webpack _require _ _ ( 41669 ) , _ _webpack _require _ _ ( 95093 ) ] , _ _WEBPACK _AMD _DEFINE _FACTORY _ _ = ( factory ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ = ( typeof _ _WEBPACK _AMD _DEFINE _FACTORY _ _ === 'function' ?
( _ _WEBPACK _AMD _DEFINE _FACTORY _ _ . apply ( exports , _ _WEBPACK _AMD _DEFINE _ARRAY _ _ ) ) : _ _WEBPACK _AMD _DEFINE _FACTORY _ _ ) ,
_ _WEBPACK _AMD _DEFINE _RESULT _ _ !== undefined && ( module . exports = _ _WEBPACK _AMD _DEFINE _RESULT _ _ ) ) ;
} else // removed by dead control flow
{ }
} ) ( function ( $ , moment ) {
'use strict' ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
if ( ! moment ) {
throw new Error ( 'bootstrap-datetimepicker requires Moment.js to be loaded first' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
var dateTimePicker = function dateTimePicker ( element , options ) {
var picker = { } ;
var date ;
var viewDate ;
var unset = true ;
var input ;
var component = false ;
var widget = false ;
var use24Hours ;
var minViewModeNumber = 0 ;
var actualFormat ;
var parseFormats ;
var currentViewMode ;
var datePickerModes = [ {
clsName : 'days' ,
navFnc : 'M' ,
navStep : 1
} , {
clsName : 'months' ,
navFnc : 'y' ,
navStep : 1
} , {
clsName : 'years' ,
navFnc : 'y' ,
navStep : 10
} , {
clsName : 'decades' ,
navFnc : 'y' ,
navStep : 100
} ] ;
var viewModes = [ 'days' , 'months' , 'years' , 'decades' ] ;
var verticalModes = [ 'top' , 'bottom' , 'auto' ] ;
var horizontalModes = [ 'left' , 'right' , 'auto' ] ;
var toolbarPlacements = [ 'default' , 'top' , 'bottom' ] ;
var keyMap = {
'up' : 38 ,
38 : 'up' ,
'down' : 40 ,
40 : 'down' ,
'left' : 37 ,
37 : 'left' ,
'right' : 39 ,
39 : 'right' ,
'tab' : 9 ,
9 : 'tab' ,
'escape' : 27 ,
27 : 'escape' ,
'enter' : 13 ,
13 : 'enter' ,
'pageUp' : 33 ,
33 : 'pageUp' ,
'pageDown' : 34 ,
34 : 'pageDown' ,
'shift' : 16 ,
16 : 'shift' ,
'control' : 17 ,
17 : 'control' ,
'space' : 32 ,
32 : 'space' ,
't' : 84 ,
84 : 't' ,
'delete' : 46 ,
46 : 'delete'
} ;
var keyState = { } ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Private functions
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
var hasTimeZone = function hasTimeZone ( ) {
return moment . tz !== undefined && options . timeZone !== undefined && options . timeZone !== null && options . timeZone !== '' ;
} ;
var getMoment = function getMoment ( d ) {
var returnMoment ;
if ( d === undefined || d === null ) {
returnMoment = moment ( ) ; // TODO should this use format? and locale?
} else if ( moment . isDate ( d ) || moment . isMoment ( d ) ) {
// If the date that is passed in is already a Date() or moment() object,
// pass it directly to moment.
returnMoment = moment ( d ) ;
} else if ( hasTimeZone ( ) ) {
// There is a string to parse and a default time zone
// parse with the tz function which takes a default time zone if it is not in the format string
returnMoment = moment . tz ( d , parseFormats , options . useStrict , options . timeZone ) ;
} else {
returnMoment = moment ( d , parseFormats , options . useStrict ) ;
}
if ( hasTimeZone ( ) ) {
returnMoment . tz ( options . timeZone ) ;
}
return returnMoment ;
} ;
var isEnabled = function isEnabled ( granularity ) {
if ( typeof granularity !== 'string' || granularity . length > 1 ) {
throw new TypeError ( 'isEnabled expects a single character string parameter' ) ;
}
switch ( granularity ) {
case 'y' :
return actualFormat . indexOf ( 'Y' ) !== - 1 ;
case 'M' :
return actualFormat . indexOf ( 'M' ) !== - 1 ;
case 'd' :
return actualFormat . toLowerCase ( ) . indexOf ( 'd' ) !== - 1 ;
case 'h' :
case 'H' :
return actualFormat . toLowerCase ( ) . indexOf ( 'h' ) !== - 1 ;
case 'm' :
return actualFormat . indexOf ( 'm' ) !== - 1 ;
case 's' :
return actualFormat . indexOf ( 's' ) !== - 1 ;
default :
return false ;
}
} ;
var hasTime = function hasTime ( ) {
return isEnabled ( 'h' ) || isEnabled ( 'm' ) || isEnabled ( 's' ) ;
} ;
var hasDate = function hasDate ( ) {
return isEnabled ( 'y' ) || isEnabled ( 'M' ) || isEnabled ( 'd' ) ;
} ;
var getDatePickerTemplate = function getDatePickerTemplate ( ) {
var headTemplate = $ ( '<thead>' ) . append ( $ ( '<tr>' ) . append ( $ ( '<th>' ) . addClass ( 'prev' ) . attr ( 'data-action' , 'previous' ) . append ( $ ( '<span>' ) . addClass ( options . icons . previous ) ) ) . append ( $ ( '<th>' ) . addClass ( 'picker-switch' ) . attr ( 'data-action' , 'pickerSwitch' ) . attr ( 'colspan' , options . calendarWeeks ? '6' : '5' ) ) . append ( $ ( '<th>' ) . addClass ( 'next' ) . attr ( 'data-action' , 'next' ) . append ( $ ( '<span>' ) . addClass ( options . icons . next ) ) ) ) ;
var contTemplate = $ ( '<tbody>' ) . append ( $ ( '<tr>' ) . append ( $ ( '<td>' ) . attr ( 'colspan' , options . calendarWeeks ? '8' : '7' ) ) ) ;
return [ $ ( '<div>' ) . addClass ( 'datepicker-days' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( headTemplate ) . append ( $ ( '<tbody>' ) ) ) , $ ( '<div>' ) . addClass ( 'datepicker-months' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( headTemplate . clone ( ) ) . append ( contTemplate . clone ( ) ) ) , $ ( '<div>' ) . addClass ( 'datepicker-years' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( headTemplate . clone ( ) ) . append ( contTemplate . clone ( ) ) ) , $ ( '<div>' ) . addClass ( 'datepicker-decades' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( headTemplate . clone ( ) ) . append ( contTemplate . clone ( ) ) ) ] ;
} ;
var getTimePickerMainTemplate = function getTimePickerMainTemplate ( ) {
var topRow = $ ( '<tr>' ) ;
var middleRow = $ ( '<tr>' ) ;
var bottomRow = $ ( '<tr>' ) ;
if ( isEnabled ( 'h' ) ) {
topRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . incrementHour
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'incrementHours' ) . append ( $ ( '<span>' ) . addClass ( options . icons . up ) ) ) ) ;
middleRow . append ( $ ( '<td>' ) . append ( $ ( '<span>' ) . addClass ( 'timepicker-hour' ) . attr ( {
'data-time-component' : 'hours' ,
'title' : options . tooltips . pickHour
} ) . attr ( 'data-action' , 'showHours' ) ) ) ;
bottomRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . decrementHour
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'decrementHours' ) . append ( $ ( '<span>' ) . addClass ( options . icons . down ) ) ) ) ;
}
if ( isEnabled ( 'm' ) ) {
if ( isEnabled ( 'h' ) ) {
topRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
middleRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) . html ( ':' ) ) ;
bottomRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
}
topRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . incrementMinute
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'incrementMinutes' ) . append ( $ ( '<span>' ) . addClass ( options . icons . up ) ) ) ) ;
middleRow . append ( $ ( '<td>' ) . append ( $ ( '<span>' ) . addClass ( 'timepicker-minute' ) . attr ( {
'data-time-component' : 'minutes' ,
'title' : options . tooltips . pickMinute
} ) . attr ( 'data-action' , 'showMinutes' ) ) ) ;
bottomRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . decrementMinute
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'decrementMinutes' ) . append ( $ ( '<span>' ) . addClass ( options . icons . down ) ) ) ) ;
}
if ( isEnabled ( 's' ) ) {
if ( isEnabled ( 'm' ) ) {
topRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
middleRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) . html ( ':' ) ) ;
bottomRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
}
topRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . incrementSecond
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'incrementSeconds' ) . append ( $ ( '<span>' ) . addClass ( options . icons . up ) ) ) ) ;
middleRow . append ( $ ( '<td>' ) . append ( $ ( '<span>' ) . addClass ( 'timepicker-second' ) . attr ( {
'data-time-component' : 'seconds' ,
'title' : options . tooltips . pickSecond
} ) . attr ( 'data-action' , 'showSeconds' ) ) ) ;
bottomRow . append ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
href : '#' ,
tabindex : '-1' ,
'title' : options . tooltips . decrementSecond
} ) . addClass ( 'btn' ) . attr ( 'data-action' , 'decrementSeconds' ) . append ( $ ( '<span>' ) . addClass ( options . icons . down ) ) ) ) ;
}
if ( ! use24Hours ) {
topRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
middleRow . append ( $ ( '<td>' ) . append ( $ ( '<button>' ) . addClass ( 'btn btn-primary' ) . attr ( {
'data-action' : 'togglePeriod' ,
tabindex : '-1' ,
'title' : options . tooltips . togglePeriod
} ) ) ) ;
bottomRow . append ( $ ( '<td>' ) . addClass ( 'separator' ) ) ;
}
return $ ( '<div>' ) . addClass ( 'timepicker-picker' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( [ topRow , middleRow , bottomRow ] ) ) ;
} ;
var getTimePickerTemplate = function getTimePickerTemplate ( ) {
var hoursView = $ ( '<div>' ) . addClass ( 'timepicker-hours' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) ) ;
var minutesView = $ ( '<div>' ) . addClass ( 'timepicker-minutes' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) ) ;
var secondsView = $ ( '<div>' ) . addClass ( 'timepicker-seconds' ) . append ( $ ( '<table>' ) . addClass ( 'table-condensed' ) ) ;
var ret = [ getTimePickerMainTemplate ( ) ] ;
if ( isEnabled ( 'h' ) ) {
ret . push ( hoursView ) ;
}
if ( isEnabled ( 'm' ) ) {
ret . push ( minutesView ) ;
}
if ( isEnabled ( 's' ) ) {
ret . push ( secondsView ) ;
}
return ret ;
} ;
var getToolbar = function getToolbar ( ) {
var row = [ ] ;
if ( options . showTodayButton ) {
row . push ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
'data-action' : 'today' ,
'title' : options . tooltips . today
} ) . append ( $ ( '<span>' ) . addClass ( options . icons . today ) ) ) ) ;
}
if ( ! options . sideBySide && hasDate ( ) && hasTime ( ) ) {
row . push ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
'data-action' : 'togglePicker' ,
'title' : options . tooltips . selectTime
} ) . append ( $ ( '<span>' ) . addClass ( options . icons . time ) ) ) ) ;
}
if ( options . showClear ) {
row . push ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
'data-action' : 'clear' ,
'title' : options . tooltips . clear
} ) . append ( $ ( '<span>' ) . addClass ( options . icons . clear ) ) ) ) ;
}
if ( options . showClose ) {
row . push ( $ ( '<td>' ) . append ( $ ( '<a>' ) . attr ( {
'data-action' : 'close' ,
'title' : options . tooltips . close
} ) . append ( $ ( '<span>' ) . addClass ( options . icons . close ) ) ) ) ;
}
return $ ( '<table>' ) . addClass ( 'table-condensed' ) . append ( $ ( '<tbody>' ) . append ( $ ( '<tr>' ) . append ( row ) ) ) ;
} ;
var getTemplate = function getTemplate ( ) {
var template = $ ( '<div>' ) . addClass ( 'bootstrap-datetimepicker-widget dropdown-menu' ) ;
var dateView = $ ( '<div>' ) . addClass ( 'datepicker' ) . append ( getDatePickerTemplate ( ) ) ;
var timeView = $ ( '<div>' ) . addClass ( 'timepicker' ) . append ( getTimePickerTemplate ( ) ) ;
var content = $ ( '<ul>' ) . addClass ( 'list-unstyled' ) ;
var toolbar = $ ( '<li>' ) . addClass ( 'picker-switch' + ( options . collapse ? ' accordion-toggle' : '' ) ) . append ( getToolbar ( ) ) ;
if ( options . inline ) {
template . removeClass ( 'dropdown-menu' ) ;
}
if ( use24Hours ) {
template . addClass ( 'usetwentyfour' ) ;
}
if ( isEnabled ( 's' ) && ! use24Hours ) {
template . addClass ( 'wider' ) ;
}
if ( options . sideBySide && hasDate ( ) && hasTime ( ) ) {
template . addClass ( 'timepicker-sbs' ) ;
if ( options . toolbarPlacement === 'top' ) {
template . append ( toolbar ) ;
}
template . append ( $ ( '<div>' ) . addClass ( 'row' ) . append ( dateView . addClass ( 'col-md-6' ) ) . append ( timeView . addClass ( 'col-md-6' ) ) ) ;
if ( options . toolbarPlacement === 'bottom' ) {
template . append ( toolbar ) ;
}
return template ;
}
if ( options . toolbarPlacement === 'top' ) {
content . append ( toolbar ) ;
}
if ( hasDate ( ) ) {
content . append ( $ ( '<li>' ) . addClass ( options . collapse && hasTime ( ) ? 'collapse in' : '' ) . append ( dateView ) ) ;
}
if ( options . toolbarPlacement === 'default' ) {
content . append ( toolbar ) ;
}
if ( hasTime ( ) ) {
content . append ( $ ( '<li>' ) . addClass ( options . collapse && hasDate ( ) ? 'collapse' : '' ) . append ( timeView ) ) ;
}
if ( options . toolbarPlacement === 'bottom' ) {
content . append ( toolbar ) ;
}
return template . append ( content ) ;
} ;
var dataToOptions = function dataToOptions ( ) {
var eData ;
var dataOptions = { } ;
if ( element . is ( 'input' ) || options . inline ) {
eData = element . data ( ) ;
} else {
eData = element . find ( 'input' ) . data ( ) ;
}
if ( eData . dateOptions && eData . dateOptions instanceof Object ) {
dataOptions = $ . extend ( true , dataOptions , eData . dateOptions ) ;
}
$ . each ( options , function ( key ) {
var attributeName = 'date' + key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) ;
if ( eData [ attributeName ] !== undefined ) {
dataOptions [ key ] = eData [ attributeName ] ;
}
} ) ;
return dataOptions ;
} ;
var place = function place ( ) {
var position = ( component || element ) . position ( ) ;
var offset = ( component || element ) . offset ( ) ;
var vertical = options . widgetPositioning . vertical ;
var horizontal = options . widgetPositioning . horizontal ;
var parent ;
if ( options . widgetParent ) {
parent = options . widgetParent . append ( widget ) ;
} else if ( element . is ( 'input' ) ) {
parent = element . after ( widget ) . parent ( ) ;
} else if ( options . inline ) {
parent = element . append ( widget ) ;
return ;
} else {
parent = element ;
element . children ( ) . first ( ) . after ( widget ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Top and bottom logic
if ( vertical === 'auto' ) {
if ( offset . top + widget . height ( ) * 1.5 >= $ ( window ) . height ( ) + $ ( window ) . scrollTop ( ) && widget . height ( ) + element . outerHeight ( ) < offset . top ) {
vertical = 'top' ;
} else {
vertical = 'bottom' ;
}
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// Left and right logic
if ( horizontal === 'auto' ) {
if ( parent . width ( ) < offset . left + widget . outerWidth ( ) / 2 && offset . left + widget . outerWidth ( ) > $ ( window ) . width ( ) ) {
horizontal = 'right' ;
} else {
horizontal = 'left' ;
}
}
if ( vertical === 'top' ) {
widget . addClass ( 'top' ) . removeClass ( 'bottom' ) ;
} else {
widget . addClass ( 'bottom' ) . removeClass ( 'top' ) ;
}
if ( horizontal === 'right' ) {
widget . addClass ( 'pull-right' ) ;
} else {
widget . removeClass ( 'pull-right' ) ;
}
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// find the first parent element that has a non-static css positioning
if ( parent . css ( 'position' ) === 'static' ) {
parent = parent . parents ( ) . filter ( function ( ) {
return $ ( this ) . css ( 'position' ) !== 'static' ;
} ) . first ( ) ;
}
if ( parent . length === 0 ) {
throw new Error ( 'datetimepicker component should be placed within a non-static positioned container' ) ;
}
widget . css ( {
top : vertical === 'top' ? 'auto' : position . top + element . outerHeight ( ) ,
bottom : vertical === 'top' ? parent . outerHeight ( ) - ( parent === element ? 0 : position . top ) : 'auto' ,
left : horizontal === 'left' ? parent === element ? 0 : position . left : 'auto' ,
right : horizontal === 'left' ? 'auto' : parent . outerWidth ( ) - element . outerWidth ( ) - ( parent === element ? 0 : position . left )
} ) ;
} ;
var notifyEvent = function notifyEvent ( e ) {
if ( e . type === 'dp.change' && ( e . date && e . date . isSame ( e . oldDate ) || ! e . date && ! e . oldDate ) ) {
return ;
}
element . trigger ( e ) ;
} ;
var viewUpdate = function viewUpdate ( e ) {
if ( e === 'y' ) {
e = 'YYYY' ;
}
notifyEvent ( {
type : 'dp.update' ,
change : e ,
viewDate : viewDate . clone ( )
} ) ;
} ;
var showMode = function showMode ( dir ) {
if ( ! widget ) {
return ;
}
if ( dir ) {
currentViewMode = Math . max ( minViewModeNumber , Math . min ( 3 , currentViewMode + dir ) ) ;
}
widget . find ( '.datepicker > div' ) . hide ( ) . filter ( '.datepicker-' + datePickerModes [ currentViewMode ] . clsName ) . show ( ) ;
} ;
var fillDow = function fillDow ( ) {
var row = $ ( '<tr>' ) ;
var currentDate = viewDate . clone ( ) . startOf ( 'w' ) . startOf ( 'd' ) ;
if ( options . calendarWeeks === true ) {
row . append ( $ ( '<th>' ) . addClass ( 'cw' ) . text ( '#' ) ) ;
}
while ( currentDate . isBefore ( viewDate . clone ( ) . endOf ( 'w' ) ) ) {
row . append ( $ ( '<th>' ) . addClass ( 'dow' ) . text ( currentDate . format ( 'dd' ) ) ) ;
currentDate . add ( 1 , 'd' ) ;
}
widget . find ( '.datepicker-days thead' ) . append ( row ) ;
} ;
var isInDisabledDates = function isInDisabledDates ( testDate ) {
return options . disabledDates [ testDate . format ( 'YYYY-MM-DD' ) ] === true ;
} ;
var isInEnabledDates = function isInEnabledDates ( testDate ) {
return options . enabledDates [ testDate . format ( 'YYYY-MM-DD' ) ] === true ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var isInDisabledHours = function isInDisabledHours ( testDate ) {
return options . disabledHours [ testDate . format ( 'H' ) ] === true ;
} ;
var isInEnabledHours = function isInEnabledHours ( testDate ) {
return options . enabledHours [ testDate . format ( 'H' ) ] === true ;
} ;
var isValid = function isValid ( targetMoment , granularity ) {
if ( ! targetMoment . isValid ( ) ) {
return false ;
}
if ( options . disabledDates && granularity === 'd' && isInDisabledDates ( targetMoment ) ) {
return false ;
}
if ( options . enabledDates && granularity === 'd' && ! isInEnabledDates ( targetMoment ) ) {
return false ;
}
if ( options . minDate && targetMoment . isBefore ( options . minDate , granularity ) ) {
return false ;
}
if ( options . maxDate && targetMoment . isAfter ( options . maxDate , granularity ) ) {
return false ;
}
if ( options . daysOfWeekDisabled && granularity === 'd' && options . daysOfWeekDisabled . indexOf ( targetMoment . day ( ) ) !== - 1 ) {
return false ;
}
if ( options . disabledHours && ( granularity === 'h' || granularity === 'm' || granularity === 's' ) && isInDisabledHours ( targetMoment ) ) {
return false ;
}
if ( options . enabledHours && ( granularity === 'h' || granularity === 'm' || granularity === 's' ) && ! isInEnabledHours ( targetMoment ) ) {
return false ;
}
if ( options . disabledTimeIntervals && ( granularity === 'h' || granularity === 'm' || granularity === 's' ) ) {
var found = false ;
$ . each ( options . disabledTimeIntervals , function ( ) {
if ( targetMoment . isBetween ( this [ 0 ] , this [ 1 ] ) ) {
found = true ;
return false ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
if ( found ) {
return false ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
}
return true ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var fillMonths = function fillMonths ( ) {
var spans = [ ] ;
var monthsShort = viewDate . clone ( ) . startOf ( 'y' ) . startOf ( 'd' ) ;
while ( monthsShort . isSame ( viewDate , 'y' ) ) {
spans . push ( $ ( '<span>' ) . attr ( 'data-action' , 'selectMonth' ) . addClass ( 'month' ) . text ( monthsShort . format ( 'MMM' ) ) ) ;
monthsShort . add ( 1 , 'M' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
widget . find ( '.datepicker-months td' ) . empty ( ) . append ( spans ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var updateMonths = function updateMonths ( ) {
var monthsView = widget . find ( '.datepicker-months' ) ;
var monthsViewHeader = monthsView . find ( 'th' ) ;
var months = monthsView . find ( 'tbody' ) . find ( 'span' ) ;
monthsViewHeader . eq ( 0 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . prevYear ) ;
monthsViewHeader . eq ( 1 ) . attr ( 'title' , options . tooltips . selectYear ) ;
monthsViewHeader . eq ( 2 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . nextYear ) ;
monthsView . find ( '.disabled' ) . removeClass ( 'disabled' ) ;
if ( ! isValid ( viewDate . clone ( ) . subtract ( 1 , 'y' ) , 'y' ) ) {
monthsViewHeader . eq ( 0 ) . addClass ( 'disabled' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
monthsViewHeader . eq ( 1 ) . text ( viewDate . year ( ) ) ;
if ( ! isValid ( viewDate . clone ( ) . add ( 1 , 'y' ) , 'y' ) ) {
monthsViewHeader . eq ( 2 ) . addClass ( 'disabled' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
months . removeClass ( 'active' ) ;
if ( date . isSame ( viewDate , 'y' ) && ! unset ) {
months . eq ( date . month ( ) ) . addClass ( 'active' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
months . each ( function ( index ) {
if ( ! isValid ( viewDate . clone ( ) . month ( index ) , 'M' ) ) {
$ ( this ) . addClass ( 'disabled' ) ;
}
} ) ;
} ;
var updateYears = function updateYears ( ) {
var yearsView = widget . find ( '.datepicker-years' ) ;
var yearsViewHeader = yearsView . find ( 'th' ) ;
var startYear = viewDate . clone ( ) . subtract ( 5 , 'y' ) ;
var endYear = viewDate . clone ( ) . add ( 6 , 'y' ) ;
var html = '' ;
yearsViewHeader . eq ( 0 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . prevDecade ) ;
yearsViewHeader . eq ( 1 ) . attr ( 'title' , options . tooltips . selectDecade ) ;
yearsViewHeader . eq ( 2 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . nextDecade ) ;
yearsView . find ( '.disabled' ) . removeClass ( 'disabled' ) ;
if ( options . minDate && options . minDate . isAfter ( startYear , 'y' ) ) {
yearsViewHeader . eq ( 0 ) . addClass ( 'disabled' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
yearsViewHeader . eq ( 1 ) . text ( startYear . year ( ) + '-' + endYear . year ( ) ) ;
if ( options . maxDate && options . maxDate . isBefore ( endYear , 'y' ) ) {
yearsViewHeader . eq ( 2 ) . addClass ( 'disabled' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
while ( ! startYear . isAfter ( endYear , 'y' ) ) {
html += '<span data-action="selectYear" class="year' + ( startYear . isSame ( date , 'y' ) && ! unset ? ' active' : '' ) + ( ! isValid ( startYear , 'y' ) ? ' disabled' : '' ) + '">' + startYear . year ( ) + '</span>' ;
startYear . add ( 1 , 'y' ) ;
}
yearsView . find ( 'td' ) . html ( html ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var updateDecades = function updateDecades ( ) {
var decadesView = widget . find ( '.datepicker-decades' ) ;
var decadesViewHeader = decadesView . find ( 'th' ) ;
var startDecade = moment ( {
y : viewDate . year ( ) - viewDate . year ( ) % 100 - 1
} ) ;
var endDecade = startDecade . clone ( ) . add ( 100 , 'y' ) ;
var startedAt = startDecade . clone ( ) ;
var minDateDecade = false ;
var maxDateDecade = false ;
var endDecadeYear ;
var html = '' ;
decadesViewHeader . eq ( 0 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . prevCentury ) ;
decadesViewHeader . eq ( 2 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . nextCentury ) ;
decadesView . find ( '.disabled' ) . removeClass ( 'disabled' ) ;
if ( startDecade . isSame ( moment ( {
y : 1900
} ) ) || options . minDate && options . minDate . isAfter ( startDecade , 'y' ) ) {
decadesViewHeader . eq ( 0 ) . addClass ( 'disabled' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
decadesViewHeader . eq ( 1 ) . text ( startDecade . year ( ) + '-' + endDecade . year ( ) ) ;
if ( startDecade . isSame ( moment ( {
y : 2000
} ) ) || options . maxDate && options . maxDate . isBefore ( endDecade , 'y' ) ) {
decadesViewHeader . eq ( 2 ) . addClass ( 'disabled' ) ;
}
while ( ! startDecade . isAfter ( endDecade , 'y' ) ) {
endDecadeYear = startDecade . year ( ) + 12 ;
minDateDecade = options . minDate && options . minDate . isAfter ( startDecade , 'y' ) && options . minDate . year ( ) <= endDecadeYear ;
maxDateDecade = options . maxDate && options . maxDate . isAfter ( startDecade , 'y' ) && options . maxDate . year ( ) <= endDecadeYear ;
html += '<span data-action="selectDecade" class="decade' + ( date . isAfter ( startDecade ) && date . year ( ) <= endDecadeYear ? ' active' : '' ) + ( ! isValid ( startDecade , 'y' ) && ! minDateDecade && ! maxDateDecade ? ' disabled' : '' ) + '" data-selection="' + ( startDecade . year ( ) + 6 ) + '">' + ( startDecade . year ( ) + 1 ) + ' - ' + ( startDecade . year ( ) + 12 ) + '</span>' ;
startDecade . add ( 12 , 'y' ) ;
}
html += '<span></span><span></span><span></span>' ; // push the dangling block over, at least this way it's even
decadesView . find ( 'td' ) . html ( html ) ;
decadesViewHeader . eq ( 1 ) . text ( startedAt . year ( ) + 1 + '-' + startDecade . year ( ) ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var fillDate = function fillDate ( ) {
var daysView = widget . find ( '.datepicker-days' ) ;
var daysViewHeader = daysView . find ( 'th' ) ;
var currentDate ;
var html = [ ] ;
var row ;
var clsNames = [ ] ;
var i ;
if ( ! hasDate ( ) ) {
return ;
}
daysViewHeader . eq ( 0 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . prevMonth ) ;
daysViewHeader . eq ( 1 ) . attr ( 'title' , options . tooltips . selectMonth ) ;
daysViewHeader . eq ( 2 ) . find ( 'span' ) . attr ( 'title' , options . tooltips . nextMonth ) ;
daysView . find ( '.disabled' ) . removeClass ( 'disabled' ) ;
daysViewHeader . eq ( 1 ) . text ( viewDate . format ( options . dayViewHeaderFormat ) ) ;
if ( ! isValid ( viewDate . clone ( ) . subtract ( 1 , 'M' ) , 'M' ) ) {
daysViewHeader . eq ( 0 ) . addClass ( 'disabled' ) ;
}
if ( ! isValid ( viewDate . clone ( ) . add ( 1 , 'M' ) , 'M' ) ) {
daysViewHeader . eq ( 2 ) . addClass ( 'disabled' ) ;
}
currentDate = viewDate . clone ( ) . startOf ( 'M' ) . startOf ( 'w' ) . startOf ( 'd' ) ;
for ( i = 0 ; i < 42 ; i ++ ) {
// always display 42 days (should show 6 weeks)
if ( currentDate . weekday ( ) === 0 ) {
row = $ ( '<tr>' ) ;
if ( options . calendarWeeks ) {
row . append ( '<td class="cw">' + currentDate . week ( ) + '</td>' ) ;
}
html . push ( row ) ;
}
clsNames = [ 'day' ] ;
if ( currentDate . isBefore ( viewDate , 'M' ) ) {
clsNames . push ( 'old' ) ;
}
if ( currentDate . isAfter ( viewDate , 'M' ) ) {
clsNames . push ( 'new' ) ;
}
if ( currentDate . isSame ( date , 'd' ) && ! unset ) {
clsNames . push ( 'active' ) ;
}
if ( ! isValid ( currentDate , 'd' ) ) {
clsNames . push ( 'disabled' ) ;
}
if ( currentDate . isSame ( getMoment ( ) , 'd' ) ) {
clsNames . push ( 'today' ) ;
}
if ( currentDate . day ( ) === 0 || currentDate . day ( ) === 6 ) {
clsNames . push ( 'weekend' ) ;
}
notifyEvent ( {
type : 'dp.classify' ,
date : currentDate ,
classNames : clsNames
} ) ;
row . append ( '<td data-action="selectDay" data-day="' + currentDate . format ( 'L' ) + '" class="' + clsNames . join ( ' ' ) + '">' + currentDate . date ( ) + '</td>' ) ;
currentDate . add ( 1 , 'd' ) ;
}
daysView . find ( 'tbody' ) . empty ( ) . append ( html ) ;
updateMonths ( ) ;
updateYears ( ) ;
updateDecades ( ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var fillHours = function fillHours ( ) {
var table = widget . find ( '.timepicker-hours table' ) ;
var currentHour = viewDate . clone ( ) . startOf ( 'd' ) ;
var html = [ ] ;
var row = $ ( '<tr>' ) ;
if ( viewDate . hour ( ) > 11 && ! use24Hours ) {
currentHour . hour ( 12 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
while ( currentHour . isSame ( viewDate , 'd' ) && ( use24Hours || viewDate . hour ( ) < 12 && currentHour . hour ( ) < 12 || viewDate . hour ( ) > 11 ) ) {
if ( currentHour . hour ( ) % 4 === 0 ) {
row = $ ( '<tr>' ) ;
html . push ( row ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
row . append ( '<td data-action="selectHour" class="hour' + ( ! isValid ( currentHour , 'h' ) ? ' disabled' : '' ) + '">' + currentHour . format ( use24Hours ? 'HH' : 'hh' ) + '</td>' ) ;
currentHour . add ( 1 , 'h' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
table . empty ( ) . append ( html ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var fillMinutes = function fillMinutes ( ) {
var table = widget . find ( '.timepicker-minutes table' ) ;
var currentMinute = viewDate . clone ( ) . startOf ( 'h' ) ;
var html = [ ] ;
var row = $ ( '<tr>' ) ;
var step = options . stepping === 1 ? 5 : options . stepping ;
while ( viewDate . isSame ( currentMinute , 'h' ) ) {
if ( currentMinute . minute ( ) % ( step * 4 ) === 0 ) {
row = $ ( '<tr>' ) ;
html . push ( row ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
row . append ( '<td data-action="selectMinute" class="minute' + ( ! isValid ( currentMinute , 'm' ) ? ' disabled' : '' ) + '">' + currentMinute . format ( 'mm' ) + '</td>' ) ;
currentMinute . add ( step , 'm' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
table . empty ( ) . append ( html ) ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
var fillSeconds = function fillSeconds ( ) {
var table = widget . find ( '.timepicker-seconds table' ) ;
var currentSecond = viewDate . clone ( ) . startOf ( 'm' ) ;
var html = [ ] ;
var row = $ ( '<tr>' ) ;
while ( viewDate . isSame ( currentSecond , 'm' ) ) {
if ( currentSecond . second ( ) % 20 === 0 ) {
row = $ ( '<tr>' ) ;
html . push ( row ) ;
}
row . append ( '<td data-action="selectSecond" class="second' + ( ! isValid ( currentSecond , 's' ) ? ' disabled' : '' ) + '">' + currentSecond . format ( 'ss' ) + '</td>' ) ;
currentSecond . add ( 5 , 's' ) ;
}
table . empty ( ) . append ( html ) ;
} ;
var fillTime = function fillTime ( ) {
var toggle ;
var newDate ;
var timeComponents = widget . find ( '.timepicker span[data-time-component]' ) ;
if ( ! use24Hours ) {
toggle = widget . find ( '.timepicker [data-action=togglePeriod]' ) ;
newDate = date . clone ( ) . add ( date . hours ( ) >= 12 ? - 12 : 12 , 'h' ) ;
toggle . text ( date . format ( 'A' ) ) ;
if ( isValid ( newDate , 'h' ) ) {
toggle . removeClass ( 'disabled' ) ;
} else {
toggle . addClass ( 'disabled' ) ;
}
}
timeComponents . filter ( '[data-time-component=hours]' ) . text ( date . format ( use24Hours ? 'HH' : 'hh' ) ) ;
timeComponents . filter ( '[data-time-component=minutes]' ) . text ( date . format ( 'mm' ) ) ;
timeComponents . filter ( '[data-time-component=seconds]' ) . text ( date . format ( 'ss' ) ) ;
fillHours ( ) ;
fillMinutes ( ) ;
fillSeconds ( ) ;
} ;
var update = function update ( ) {
if ( ! widget ) {
return ;
}
fillDate ( ) ;
fillTime ( ) ;
} ;
var setValue = function setValue ( targetMoment ) {
var oldDate = unset ? null : date ;
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
// case of calling setValue(null or false)
if ( ! targetMoment ) {
unset = true ;
input . val ( '' ) ;
element . data ( 'date' , '' ) ;
notifyEvent ( {
type : 'dp.change' ,
date : false ,
oldDate : oldDate
} ) ;
update ( ) ;
return ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
targetMoment = targetMoment . clone ( ) . locale ( options . locale ) ;
if ( hasTimeZone ( ) ) {
targetMoment . tz ( options . timeZone ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( options . stepping !== 1 ) {
targetMoment . minutes ( Math . round ( targetMoment . minutes ( ) / options . stepping ) * options . stepping ) . seconds ( 0 ) ;
while ( options . minDate && targetMoment . isBefore ( options . minDate ) ) {
targetMoment . add ( options . stepping , 'minutes' ) ;
}
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( isValid ( targetMoment ) ) {
date = targetMoment ;
viewDate = date . clone ( ) ;
input . val ( date . format ( actualFormat ) ) ;
element . data ( 'date' , date . format ( actualFormat ) ) ;
unset = false ;
update ( ) ;
notifyEvent ( {
type : 'dp.change' ,
date : date . clone ( ) ,
oldDate : oldDate
} ) ;
} else {
if ( ! options . keepInvalid ) {
input . val ( unset ? '' : date . format ( actualFormat ) ) ;
} else {
notifyEvent ( {
type : 'dp.change' ,
date : targetMoment ,
oldDate : oldDate
} ) ;
}
notifyEvent ( {
type : 'dp.error' ,
date : targetMoment ,
oldDate : oldDate
} ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
/ * *
* Hides the widget . Possibly will emit dp . hide
* /
var hide = function hide ( ) {
var transitioning = false ;
if ( ! widget ) {
return picker ;
}
// Ignore event if in the middle of a picker transition
widget . find ( '.collapse' ) . each ( function ( ) {
var collapseData = $ ( this ) . data ( 'collapse' ) ;
if ( collapseData && collapseData . transitioning ) {
transitioning = true ;
return false ;
}
return true ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
if ( transitioning ) {
return picker ;
}
if ( component && component . hasClass ( 'btn' ) ) {
component . toggleClass ( 'active' ) ;
}
widget . hide ( ) ;
$ ( window ) . off ( 'resize' , place ) ;
widget . off ( 'click' , '[data-action]' ) ;
widget . off ( 'mousedown' , false ) ;
widget . remove ( ) ;
widget = false ;
notifyEvent ( {
type : 'dp.hide' ,
date : date . clone ( )
} ) ;
input . blur ( ) ;
viewDate = date . clone ( ) ;
return picker ;
} ;
var clear = function clear ( ) {
setValue ( null ) ;
} ;
var parseInputDate = function parseInputDate ( inputDate ) {
if ( options . parseInputDate === undefined ) {
if ( ! moment . isMoment ( inputDate ) || inputDate instanceof Date ) {
inputDate = getMoment ( inputDate ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} else {
inputDate = options . parseInputDate ( inputDate ) ;
}
// inputDate.locale(options.locale);
return inputDate ;
} ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Widget UI interaction functions
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
var actions = {
next : function next ( ) {
var navFnc = datePickerModes [ currentViewMode ] . navFnc ;
viewDate . add ( datePickerModes [ currentViewMode ] . navStep , navFnc ) ;
fillDate ( ) ;
viewUpdate ( navFnc ) ;
} ,
previous : function previous ( ) {
var navFnc = datePickerModes [ currentViewMode ] . navFnc ;
viewDate . subtract ( datePickerModes [ currentViewMode ] . navStep , navFnc ) ;
fillDate ( ) ;
viewUpdate ( navFnc ) ;
} ,
pickerSwitch : function pickerSwitch ( ) {
showMode ( 1 ) ;
} ,
selectMonth : function selectMonth ( e ) {
var month = $ ( e . target ) . closest ( 'tbody' ) . find ( 'span' ) . index ( $ ( e . target ) ) ;
viewDate . month ( month ) ;
if ( currentViewMode === minViewModeNumber ) {
setValue ( date . clone ( ) . year ( viewDate . year ( ) ) . month ( viewDate . month ( ) ) ) ;
if ( ! options . inline ) {
hide ( ) ;
}
} else {
showMode ( - 1 ) ;
fillDate ( ) ;
}
viewUpdate ( 'M' ) ;
} ,
selectYear : function selectYear ( e ) {
var year = parseInt ( $ ( e . target ) . text ( ) , 10 ) || 0 ;
viewDate . year ( year ) ;
if ( currentViewMode === minViewModeNumber ) {
setValue ( date . clone ( ) . year ( viewDate . year ( ) ) ) ;
if ( ! options . inline ) {
hide ( ) ;
}
} else {
showMode ( - 1 ) ;
fillDate ( ) ;
}
viewUpdate ( 'YYYY' ) ;
} ,
selectDecade : function selectDecade ( e ) {
var year = parseInt ( $ ( e . target ) . data ( 'selection' ) , 10 ) || 0 ;
viewDate . year ( year ) ;
if ( currentViewMode === minViewModeNumber ) {
setValue ( date . clone ( ) . year ( viewDate . year ( ) ) ) ;
if ( ! options . inline ) {
hide ( ) ;
}
} else {
showMode ( - 1 ) ;
fillDate ( ) ;
}
viewUpdate ( 'YYYY' ) ;
} ,
selectDay : function selectDay ( e ) {
var day = viewDate . clone ( ) ;
if ( $ ( e . target ) . is ( '.old' ) ) {
day . subtract ( 1 , 'M' ) ;
}
if ( $ ( e . target ) . is ( '.new' ) ) {
day . add ( 1 , 'M' ) ;
}
setValue ( day . date ( parseInt ( $ ( e . target ) . text ( ) , 10 ) ) ) ;
if ( ! hasTime ( ) && ! options . keepOpen && ! options . inline ) {
hide ( ) ;
}
} ,
incrementHours : function incrementHours ( ) {
var newDate = date . clone ( ) . add ( 1 , 'h' ) ;
if ( isValid ( newDate , 'h' ) ) {
setValue ( newDate ) ;
}
} ,
incrementMinutes : function incrementMinutes ( ) {
var newDate = date . clone ( ) . add ( options . stepping , 'm' ) ;
if ( isValid ( newDate , 'm' ) ) {
setValue ( newDate ) ;
}
} ,
incrementSeconds : function incrementSeconds ( ) {
var newDate = date . clone ( ) . add ( 1 , 's' ) ;
if ( isValid ( newDate , 's' ) ) {
setValue ( newDate ) ;
}
} ,
decrementHours : function decrementHours ( ) {
var newDate = date . clone ( ) . subtract ( 1 , 'h' ) ;
if ( isValid ( newDate , 'h' ) ) {
setValue ( newDate ) ;
}
} ,
decrementMinutes : function decrementMinutes ( ) {
var newDate = date . clone ( ) . subtract ( options . stepping , 'm' ) ;
if ( isValid ( newDate , 'm' ) ) {
setValue ( newDate ) ;
}
} ,
decrementSeconds : function decrementSeconds ( ) {
var newDate = date . clone ( ) . subtract ( 1 , 's' ) ;
if ( isValid ( newDate , 's' ) ) {
setValue ( newDate ) ;
}
} ,
togglePeriod : function togglePeriod ( ) {
setValue ( date . clone ( ) . add ( date . hours ( ) >= 12 ? - 12 : 12 , 'h' ) ) ;
} ,
togglePicker : function togglePicker ( e ) {
var $this = $ ( e . target ) ;
var $parent = $this . closest ( 'ul' ) ;
var expanded = $parent . find ( '.in' ) ;
var closed = $parent . find ( '.collapse:not(.in)' ) ;
var collapseData ;
if ( expanded && expanded . length ) {
collapseData = expanded . data ( 'collapse' ) ;
if ( collapseData && collapseData . transitioning ) {
return ;
}
if ( expanded . collapse ) {
// if collapse plugin is available through bootstrap.js then use it
expanded . collapse ( 'hide' ) ;
closed . collapse ( 'show' ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
// otherwise just toggle in class on the two views
expanded . removeClass ( 'in' ) ;
closed . addClass ( 'in' ) ;
}
if ( $this . is ( 'span' ) ) {
$this . toggleClass ( options . icons . time + ' ' + options . icons . date ) ;
} else {
$this . find ( 'span' ) . toggleClass ( options . icons . time + ' ' + options . icons . date ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
// NOTE: uncomment if toggled state will be restored in show()
// if (component) {
// component.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
// }
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ,
showPicker : function showPicker ( ) {
widget . find ( '.timepicker > div:not(.timepicker-picker)' ) . hide ( ) ;
widget . find ( '.timepicker .timepicker-picker' ) . show ( ) ;
} ,
showHours : function showHours ( ) {
widget . find ( '.timepicker .timepicker-picker' ) . hide ( ) ;
widget . find ( '.timepicker .timepicker-hours' ) . show ( ) ;
} ,
showMinutes : function showMinutes ( ) {
widget . find ( '.timepicker .timepicker-picker' ) . hide ( ) ;
widget . find ( '.timepicker .timepicker-minutes' ) . show ( ) ;
} ,
showSeconds : function showSeconds ( ) {
widget . find ( '.timepicker .timepicker-picker' ) . hide ( ) ;
widget . find ( '.timepicker .timepicker-seconds' ) . show ( ) ;
} ,
selectHour : function selectHour ( e ) {
var hour = parseInt ( $ ( e . target ) . text ( ) , 10 ) ;
if ( ! use24Hours ) {
if ( date . hours ( ) >= 12 ) {
if ( hour !== 12 ) {
hour += 12 ;
}
} else {
if ( hour === 12 ) {
hour = 0 ;
}
}
}
setValue ( date . clone ( ) . hours ( hour ) ) ;
actions . showPicker . call ( picker ) ;
} ,
selectMinute : function selectMinute ( e ) {
setValue ( date . clone ( ) . minutes ( parseInt ( $ ( e . target ) . text ( ) , 10 ) ) ) ;
actions . showPicker . call ( picker ) ;
} ,
selectSecond : function selectSecond ( e ) {
setValue ( date . clone ( ) . seconds ( parseInt ( $ ( e . target ) . text ( ) , 10 ) ) ) ;
actions . showPicker . call ( picker ) ;
} ,
clear : clear ,
today : function today ( ) {
var todaysDate = getMoment ( ) ;
if ( isValid ( todaysDate , 'd' ) ) {
setValue ( todaysDate ) ;
}
} ,
close : hide
} ;
var doAction = function doAction ( e ) {
if ( $ ( e . currentTarget ) . is ( '.disabled' ) ) {
return false ;
}
actions [ $ ( e . currentTarget ) . data ( 'action' ) ] . apply ( picker , arguments ) ;
return false ;
} ;
/ * *
* Shows the widget . Possibly will emit dp . show and dp . change
* /
var show = function show ( ) {
var currentMoment ;
var useCurrentGranularity = {
'year' : function year ( m ) {
return m . month ( 0 ) . date ( 1 ) . hours ( 0 ) . seconds ( 0 ) . minutes ( 0 ) ;
} ,
'month' : function month ( m ) {
return m . date ( 1 ) . hours ( 0 ) . seconds ( 0 ) . minutes ( 0 ) ;
} ,
'day' : function day ( m ) {
return m . hours ( 0 ) . seconds ( 0 ) . minutes ( 0 ) ;
} ,
'hour' : function hour ( m ) {
return m . seconds ( 0 ) . minutes ( 0 ) ;
} ,
'minute' : function minute ( m ) {
return m . seconds ( 0 ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
if ( input . prop ( 'disabled' ) || ! options . ignoreReadonly && input . prop ( 'readonly' ) || widget ) {
return picker ;
}
if ( input . val ( ) !== undefined && input . val ( ) . trim ( ) . length !== 0 ) {
setValue ( parseInputDate ( input . val ( ) . trim ( ) ) ) ;
} else if ( unset && options . useCurrent && ( options . inline || input . is ( 'input' ) && input . val ( ) . trim ( ) . length === 0 ) ) {
currentMoment = getMoment ( ) ;
if ( typeof options . useCurrent === 'string' ) {
currentMoment = useCurrentGranularity [ options . useCurrent ] ( currentMoment ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
setValue ( currentMoment ) ;
}
widget = getTemplate ( ) ;
fillDow ( ) ;
fillMonths ( ) ;
widget . find ( '.timepicker-hours' ) . hide ( ) ;
widget . find ( '.timepicker-minutes' ) . hide ( ) ;
widget . find ( '.timepicker-seconds' ) . hide ( ) ;
update ( ) ;
showMode ( ) ;
$ ( window ) . on ( 'resize' , place ) ;
widget . on ( 'click' , '[data-action]' , doAction ) ; // this handles clicks on the widget
widget . on ( 'mousedown' , false ) ;
if ( component && component . hasClass ( 'btn' ) ) {
component . toggleClass ( 'active' ) ;
}
place ( ) ;
widget . show ( ) ;
if ( options . focusOnShow && ! input . is ( ':focus' ) ) {
input . focus ( ) ;
}
notifyEvent ( {
type : 'dp.show'
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
return picker ;
} ;
/ * *
* Shows or hides the widget
* /
var toggle = function toggle ( ) {
return widget ? hide ( ) : show ( ) ;
} ;
var keydown = function keydown ( e ) {
var handler = null ;
var index ;
var index2 ;
var pressedKeys = [ ] ;
var pressedModifiers = { } ;
var currentKey = e . which ;
var keyBindKeys ;
var allModifiersPressed ;
var pressed = 'p' ;
keyState [ currentKey ] = pressed ;
for ( index in keyState ) {
if ( keyState . hasOwnProperty ( index ) && keyState [ index ] === pressed ) {
pressedKeys . push ( index ) ;
if ( parseInt ( index , 10 ) !== currentKey ) {
pressedModifiers [ index ] = true ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
}
for ( index in options . keyBinds ) {
if ( options . keyBinds . hasOwnProperty ( index ) && typeof options . keyBinds [ index ] === 'function' ) {
keyBindKeys = index . split ( ' ' ) ;
if ( keyBindKeys . length === pressedKeys . length && keyMap [ currentKey ] === keyBindKeys [ keyBindKeys . length - 1 ] ) {
allModifiersPressed = true ;
for ( index2 = keyBindKeys . length - 2 ; index2 >= 0 ; index2 -- ) {
if ( ! ( keyMap [ keyBindKeys [ index2 ] ] in pressedModifiers ) ) {
allModifiersPressed = false ;
break ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
if ( allModifiersPressed ) {
handler = options . keyBinds [ index ] ;
break ;
2025-10-16 10:59:50 -06:00
}
}
}
2025-10-18 13:48:40 -06:00
}
if ( handler ) {
handler . call ( picker , widget ) ;
e . stopPropagation ( ) ;
e . preventDefault ( ) ;
}
} ;
var keyup = function keyup ( e ) {
keyState [ e . which ] = 'r' ;
e . stopPropagation ( ) ;
e . preventDefault ( ) ;
} ;
var change = function change ( e ) {
var val = $ ( e . target ) . val ( ) . trim ( ) ;
var parsedDate = val ? parseInputDate ( val ) : null ;
setValue ( parsedDate ) ;
e . stopImmediatePropagation ( ) ;
return false ;
} ;
var attachDatePickerElementEvents = function attachDatePickerElementEvents ( ) {
input . on ( {
'change' : change ,
'blur' : options . debug ? '' : hide ,
'keydown' : keydown ,
'keyup' : keyup ,
'focus' : options . allowInputToggle ? show : ''
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
if ( element . is ( 'input' ) ) {
input . on ( {
'focus' : show
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} else if ( component ) {
component . on ( 'click' , toggle ) ;
component . on ( 'mousedown' , false ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ;
var detachDatePickerElementEvents = function detachDatePickerElementEvents ( ) {
input . off ( {
'change' : change ,
'blur' : blur ,
'keydown' : keydown ,
'keyup' : keyup ,
'focus' : options . allowInputToggle ? hide : ''
} ) ;
if ( element . is ( 'input' ) ) {
input . off ( {
'focus' : show
} ) ;
} else if ( component ) {
component . off ( 'click' , toggle ) ;
component . off ( 'mousedown' , false ) ;
}
} ;
var indexGivenDates = function indexGivenDates ( givenDatesArray ) {
// Store given enabledDates and disabledDates as keys.
// This way we can check their existence in O(1) time instead of looping through whole array.
// (for example: options.enabledDates['2014-02-27'] === true)
var givenDatesIndexed = { } ;
$ . each ( givenDatesArray , function ( ) {
var dDate = parseInputDate ( this ) ;
if ( dDate . isValid ( ) ) {
givenDatesIndexed [ dDate . format ( 'YYYY-MM-DD' ) ] = true ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
return Object . keys ( givenDatesIndexed ) . length ? givenDatesIndexed : false ;
} ;
var indexGivenHours = function indexGivenHours ( givenHoursArray ) {
// Store given enabledHours and disabledHours as keys.
// This way we can check their existence in O(1) time instead of looping through whole array.
// (for example: options.enabledHours['2014-02-27'] === true)
var givenHoursIndexed = { } ;
$ . each ( givenHoursArray , function ( ) {
givenHoursIndexed [ this ] = true ;
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
return Object . keys ( givenHoursIndexed ) . length ? givenHoursIndexed : false ;
} ;
var initFormatting = function initFormatting ( ) {
var format = options . format || 'L LT' ;
actualFormat = format . replace ( /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g , function ( formatInput ) {
var newinput = date . localeData ( ) . longDateFormat ( formatInput ) || formatInput ;
return newinput . replace ( /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g , function ( formatInput2 ) {
// temp fix for #740
return date . localeData ( ) . longDateFormat ( formatInput2 ) || formatInput2 ;
2025-10-16 10:59:50 -06:00
} ) ;
} ) ;
2025-10-18 13:48:40 -06:00
parseFormats = options . extraFormats ? options . extraFormats . slice ( ) : [ ] ;
if ( parseFormats . indexOf ( format ) < 0 && parseFormats . indexOf ( actualFormat ) < 0 ) {
parseFormats . push ( actualFormat ) ;
}
use24Hours = actualFormat . toLowerCase ( ) . indexOf ( 'a' ) < 1 && actualFormat . replace ( /\[.*?\]/g , '' ) . indexOf ( 'h' ) < 1 ;
if ( isEnabled ( 'y' ) ) {
minViewModeNumber = 2 ;
}
if ( isEnabled ( 'M' ) ) {
minViewModeNumber = 1 ;
}
if ( isEnabled ( 'd' ) ) {
minViewModeNumber = 0 ;
}
currentViewMode = Math . max ( minViewModeNumber , currentViewMode ) ;
if ( ! unset ) {
setValue ( date ) ;
}
} ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Public API functions
* === === === === === === ===
*
* Important : Do not expose direct references to private objects or the options
* object to the outer world . Always return a clone when returning values or make
* a clone when setting a private variable .
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
picker . destroy = function ( ) {
// /<summary>Destroys the widget and removes all attached event listeners</summary>
hide ( ) ;
detachDatePickerElementEvents ( ) ;
element . removeData ( 'DateTimePicker' ) ;
element . removeData ( 'date' ) ;
} ;
picker . toggle = toggle ;
picker . show = show ;
picker . hide = hide ;
picker . disable = function ( ) {
// /<summary>Disables the input element, the component is attached to, by adding a disabled="true" attribute to it.
// /If the widget was visible before that call it is hidden. Possibly emits dp.hide</summary>
hide ( ) ;
if ( component && component . hasClass ( 'btn' ) ) {
component . addClass ( 'disabled' ) ;
}
input . prop ( 'disabled' , true ) ;
return picker ;
} ;
picker . enable = function ( ) {
// /<summary>Enables the input element, the component is attached to, by removing disabled attribute from it.</summary>
if ( component && component . hasClass ( 'btn' ) ) {
component . removeClass ( 'disabled' ) ;
}
input . prop ( 'disabled' , false ) ;
return picker ;
} ;
picker . ignoreReadonly = function ( ignoreReadonly ) {
if ( arguments . length === 0 ) {
return options . ignoreReadonly ;
}
if ( typeof ignoreReadonly !== 'boolean' ) {
throw new TypeError ( 'ignoreReadonly () expects a boolean parameter' ) ;
}
options . ignoreReadonly = ignoreReadonly ;
return picker ;
} ;
picker . options = function ( newOptions ) {
if ( arguments . length === 0 ) {
return $ . extend ( true , { } , options ) ;
}
if ( ! ( newOptions instanceof Object ) ) {
throw new TypeError ( 'options() options parameter should be an object' ) ;
}
$ . extend ( true , options , newOptions ) ;
$ . each ( options , function ( key , value ) {
if ( picker [ key ] !== undefined ) {
picker [ key ] ( value ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
throw new TypeError ( 'option ' + key + ' is not recognized!' ) ;
2025-10-16 10:59:50 -06:00
}
} ) ;
2025-10-18 13:48:40 -06:00
return picker ;
} ;
picker . date = function ( newDate ) {
// /<signature helpKeyword="$.fn.datetimepicker.date">
// /<summary>Returns the component's model current date, a moment object or null if not set.</summary>
// /<returns type="Moment">date.clone()</returns>
// /</signature>
// /<signature>
// /<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
// /<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, Date, moment, null parameter.</param>
// /</signature>
if ( arguments . length === 0 ) {
if ( unset ) {
return null ;
}
return date . clone ( ) ;
}
if ( newDate !== null && typeof newDate !== 'string' && ! moment . isMoment ( newDate ) && ! ( newDate instanceof Date ) ) {
throw new TypeError ( 'date() parameter must be one of [null, string, moment or Date]' ) ;
}
setValue ( newDate === null ? null : parseInputDate ( newDate ) ) ;
return picker ;
} ;
picker . format = function ( newFormat ) {
// /<summary>test su</summary>
// /<param name="newFormat">info about para</param>
// /<returns type="string|boolean">returns foo</returns>
if ( arguments . length === 0 ) {
return options . format ;
}
if ( typeof newFormat !== 'string' && ( typeof newFormat !== 'boolean' || newFormat !== false ) ) {
throw new TypeError ( 'format() expects a string or boolean:false parameter ' + newFormat ) ;
}
options . format = newFormat ;
if ( actualFormat ) {
initFormatting ( ) ; // reinit formatting
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return picker ;
} ;
picker . timeZone = function ( newZone ) {
if ( arguments . length === 0 ) {
return options . timeZone ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof newZone !== 'string' ) {
throw new TypeError ( 'newZone() expects a string parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . timeZone = newZone ;
return picker ;
} ;
picker . dayViewHeaderFormat = function ( newFormat ) {
if ( arguments . length === 0 ) {
return options . dayViewHeaderFormat ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof newFormat !== 'string' ) {
throw new TypeError ( 'dayViewHeaderFormat() expects a string parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . dayViewHeaderFormat = newFormat ;
return picker ;
} ;
picker . extraFormats = function ( formats ) {
if ( arguments . length === 0 ) {
return options . extraFormats ;
}
if ( formats !== false && ! ( formats instanceof Array ) ) {
throw new TypeError ( 'extraFormats() expects an array or false parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . extraFormats = formats ;
if ( parseFormats ) {
initFormatting ( ) ; // reinit formatting
}
return picker ;
} ;
picker . disabledDates = function ( dates ) {
// /<signature helpKeyword="$.fn.datetimepicker.disabledDates">
// /<summary>Returns an array with the currently set disabled dates on the component.</summary>
// /<returns type="array">options.disabledDates</returns>
// /</signature>
// /<signature>
// /<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
// /options.enabledDates if such exist.</summary>
// /<param name="dates" locid="$.fn.datetimepicker.disabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . disabledDates ? $ . extend ( { } , options . disabledDates ) : options . disabledDates ;
}
if ( ! dates ) {
options . disabledDates = false ;
update ( ) ;
return picker ;
}
if ( ! ( dates instanceof Array ) ) {
throw new TypeError ( 'disabledDates() expects an array parameter' ) ;
}
options . disabledDates = indexGivenDates ( dates ) ;
options . enabledDates = false ;
update ( ) ;
return picker ;
} ;
picker . enabledDates = function ( dates ) {
// /<signature helpKeyword="$.fn.datetimepicker.enabledDates">
// /<summary>Returns an array with the currently set enabled dates on the component.</summary>
// /<returns type="array">options.enabledDates</returns>
// /</signature>
// /<signature>
// /<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledDates if such exist.</summary>
// /<param name="dates" locid="$.fn.datetimepicker.enabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . enabledDates ? $ . extend ( { } , options . enabledDates ) : options . enabledDates ;
}
if ( ! dates ) {
options . enabledDates = false ;
update ( ) ;
return picker ;
}
if ( ! ( dates instanceof Array ) ) {
throw new TypeError ( 'enabledDates() expects an array parameter' ) ;
}
options . enabledDates = indexGivenDates ( dates ) ;
options . disabledDates = false ;
update ( ) ;
return picker ;
} ;
picker . daysOfWeekDisabled = function ( daysOfWeekDisabled ) {
if ( arguments . length === 0 ) {
return options . daysOfWeekDisabled . splice ( 0 ) ;
}
if ( typeof daysOfWeekDisabled === 'boolean' && ! daysOfWeekDisabled ) {
options . daysOfWeekDisabled = false ;
update ( ) ;
return picker ;
}
if ( ! ( daysOfWeekDisabled instanceof Array ) ) {
throw new TypeError ( 'daysOfWeekDisabled() expects an array parameter' ) ;
}
options . daysOfWeekDisabled = daysOfWeekDisabled . reduce ( function ( previousValue , currentValue ) {
currentValue = parseInt ( currentValue , 10 ) ;
if ( currentValue > 6 || currentValue < 0 || isNaN ( currentValue ) ) {
return previousValue ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( previousValue . indexOf ( currentValue ) === - 1 ) {
previousValue . push ( currentValue ) ;
}
return previousValue ;
} , [ ] ) . sort ( ) ;
if ( options . useCurrent && ! options . keepInvalid ) {
var tries = 0 ;
while ( ! isValid ( date , 'd' ) ) {
date . add ( 1 , 'd' ) ;
if ( tries === 31 ) {
throw new Error ( 'Tried 31 times to find a valid date' ) ;
}
tries ++ ;
}
setValue ( date ) ;
}
update ( ) ;
return picker ;
} ;
picker . maxDate = function ( maxDate ) {
if ( arguments . length === 0 ) {
return options . maxDate ? options . maxDate . clone ( ) : options . maxDate ;
}
if ( typeof maxDate === 'boolean' && maxDate === false ) {
options . maxDate = false ;
update ( ) ;
return picker ;
}
if ( typeof maxDate === 'string' ) {
if ( maxDate === 'now' || maxDate === 'moment' ) {
maxDate = getMoment ( ) ;
}
}
var parsedDate = parseInputDate ( maxDate ) ;
if ( ! parsedDate . isValid ( ) ) {
throw new TypeError ( 'maxDate() Could not parse date parameter: ' + maxDate ) ;
}
if ( options . minDate && parsedDate . isBefore ( options . minDate ) ) {
throw new TypeError ( 'maxDate() date parameter is before options.minDate: ' + parsedDate . format ( actualFormat ) ) ;
}
options . maxDate = parsedDate ;
if ( options . useCurrent && ! options . keepInvalid && date . isAfter ( maxDate ) ) {
setValue ( options . maxDate ) ;
}
if ( viewDate . isAfter ( parsedDate ) ) {
viewDate = parsedDate . clone ( ) . subtract ( options . stepping , 'm' ) ;
}
update ( ) ;
return picker ;
} ;
picker . minDate = function ( minDate ) {
if ( arguments . length === 0 ) {
return options . minDate ? options . minDate . clone ( ) : options . minDate ;
}
if ( typeof minDate === 'boolean' && minDate === false ) {
options . minDate = false ;
update ( ) ;
return picker ;
}
if ( typeof minDate === 'string' ) {
if ( minDate === 'now' || minDate === 'moment' ) {
minDate = getMoment ( ) ;
}
}
var parsedDate = parseInputDate ( minDate ) ;
if ( ! parsedDate . isValid ( ) ) {
throw new TypeError ( 'minDate() Could not parse date parameter: ' + minDate ) ;
}
if ( options . maxDate && parsedDate . isAfter ( options . maxDate ) ) {
throw new TypeError ( 'minDate() date parameter is after options.maxDate: ' + parsedDate . format ( actualFormat ) ) ;
}
options . minDate = parsedDate ;
if ( options . useCurrent && ! options . keepInvalid && date . isBefore ( minDate ) ) {
setValue ( options . minDate ) ;
}
if ( viewDate . isBefore ( parsedDate ) ) {
viewDate = parsedDate . clone ( ) . add ( options . stepping , 'm' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
update ( ) ;
return picker ;
} ;
picker . defaultDate = function ( defaultDate ) {
// /<signature helpKeyword="$.fn.datetimepicker.defaultDate">
// /<summary>Returns a moment with the options.defaultDate option configuration or false if not set</summary>
// /<returns type="Moment">date.clone()</returns>
// /</signature>
// /<signature>
// /<summary>Will set the picker's inital date. If a boolean:false value is passed the options.defaultDate parameter is cleared.</summary>
// /<param name="defaultDate" locid="$.fn.datetimepicker.defaultDate_p:defaultDate">Takes a string, Date, moment, boolean:false</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . defaultDate ? options . defaultDate . clone ( ) : options . defaultDate ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! defaultDate ) {
options . defaultDate = false ;
return picker ;
}
if ( typeof defaultDate === 'string' ) {
if ( defaultDate === 'now' || defaultDate === 'moment' ) {
defaultDate = getMoment ( ) ;
} else {
defaultDate = getMoment ( defaultDate ) ;
}
}
var parsedDate = parseInputDate ( defaultDate ) ;
if ( ! parsedDate . isValid ( ) ) {
throw new TypeError ( 'defaultDate() Could not parse date parameter: ' + defaultDate ) ;
}
if ( ! isValid ( parsedDate ) ) {
throw new TypeError ( 'defaultDate() date passed is invalid according to component setup validations' ) ;
}
options . defaultDate = parsedDate ;
if ( options . defaultDate && options . inline || input . val ( ) . trim ( ) === '' ) {
setValue ( options . defaultDate ) ;
}
return picker ;
} ;
picker . locale = function ( locale ) {
if ( arguments . length === 0 ) {
return options . locale ;
}
if ( ! moment . localeData ( locale ) ) {
throw new TypeError ( 'locale() locale ' + locale + ' is not loaded from moment locales!' ) ;
}
options . locale = locale ;
date . locale ( options . locale ) ;
viewDate . locale ( options . locale ) ;
if ( actualFormat ) {
initFormatting ( ) ; // reinit formatting
}
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
} ;
picker . stepping = function ( stepping ) {
if ( arguments . length === 0 ) {
return options . stepping ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
stepping = parseInt ( stepping , 10 ) ;
if ( isNaN ( stepping ) || stepping < 1 ) {
stepping = 1 ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . stepping = stepping ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . useCurrent = function ( useCurrent ) {
var useCurrentOptions = [ 'year' , 'month' , 'day' , 'hour' , 'minute' ] ;
if ( arguments . length === 0 ) {
return options . useCurrent ;
}
if ( typeof useCurrent !== 'boolean' && typeof useCurrent !== 'string' ) {
throw new TypeError ( 'useCurrent() expects a boolean or string parameter' ) ;
}
if ( typeof useCurrent === 'string' && useCurrentOptions . indexOf ( useCurrent . toLowerCase ( ) ) === - 1 ) {
throw new TypeError ( 'useCurrent() expects a string parameter of ' + useCurrentOptions . join ( ', ' ) ) ;
}
options . useCurrent = useCurrent ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . collapse = function ( collapse ) {
if ( arguments . length === 0 ) {
return options . collapse ;
}
if ( typeof collapse !== 'boolean' ) {
throw new TypeError ( 'collapse() expects a boolean parameter' ) ;
}
if ( options . collapse === collapse ) {
return picker ;
}
options . collapse = collapse ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . icons = function ( icons ) {
if ( arguments . length === 0 ) {
return $ . extend ( { } , options . icons ) ;
}
if ( ! ( icons instanceof Object ) ) {
throw new TypeError ( 'icons() expects parameter to be an Object' ) ;
}
$ . extend ( options . icons , icons ) ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
} ;
picker . tooltips = function ( tooltips ) {
if ( arguments . length === 0 ) {
return $ . extend ( { } , options . tooltips ) ;
}
if ( ! ( tooltips instanceof Object ) ) {
throw new TypeError ( 'tooltips() expects parameter to be an Object' ) ;
}
$ . extend ( options . tooltips , tooltips ) ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
} ;
picker . useStrict = function ( useStrict ) {
if ( arguments . length === 0 ) {
return options . useStrict ;
}
if ( typeof useStrict !== 'boolean' ) {
throw new TypeError ( 'useStrict() expects a boolean parameter' ) ;
}
options . useStrict = useStrict ;
return picker ;
} ;
picker . sideBySide = function ( sideBySide ) {
if ( arguments . length === 0 ) {
return options . sideBySide ;
}
if ( typeof sideBySide !== 'boolean' ) {
throw new TypeError ( 'sideBySide() expects a boolean parameter' ) ;
}
options . sideBySide = sideBySide ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
} ;
picker . viewMode = function ( viewMode ) {
if ( arguments . length === 0 ) {
return options . viewMode ;
}
if ( typeof viewMode !== 'string' ) {
throw new TypeError ( 'viewMode() expects a string parameter' ) ;
}
if ( viewModes . indexOf ( viewMode ) === - 1 ) {
throw new TypeError ( 'viewMode() parameter must be one of (' + viewModes . join ( ', ' ) + ') value' ) ;
}
options . viewMode = viewMode ;
currentViewMode = Math . max ( viewModes . indexOf ( viewMode ) , minViewModeNumber ) ;
showMode ( ) ;
return picker ;
} ;
picker . toolbarPlacement = function ( toolbarPlacement ) {
if ( arguments . length === 0 ) {
return options . toolbarPlacement ;
}
if ( typeof toolbarPlacement !== 'string' ) {
throw new TypeError ( 'toolbarPlacement() expects a string parameter' ) ;
}
if ( toolbarPlacements . indexOf ( toolbarPlacement ) === - 1 ) {
throw new TypeError ( 'toolbarPlacement() parameter must be one of (' + toolbarPlacements . join ( ', ' ) + ') value' ) ;
}
options . toolbarPlacement = toolbarPlacement ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
} ;
picker . widgetPositioning = function ( widgetPositioning ) {
if ( arguments . length === 0 ) {
return $ . extend ( { } , options . widgetPositioning ) ;
}
if ( { } . toString . call ( widgetPositioning ) !== '[object Object]' ) {
throw new TypeError ( 'widgetPositioning() expects an object variable' ) ;
}
if ( widgetPositioning . horizontal ) {
if ( typeof widgetPositioning . horizontal !== 'string' ) {
throw new TypeError ( 'widgetPositioning() horizontal variable must be a string' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
widgetPositioning . horizontal = widgetPositioning . horizontal . toLowerCase ( ) ;
if ( horizontalModes . indexOf ( widgetPositioning . horizontal ) === - 1 ) {
throw new TypeError ( 'widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes . join ( ', ' ) + ')' ) ;
}
options . widgetPositioning . horizontal = widgetPositioning . horizontal ;
}
if ( widgetPositioning . vertical ) {
if ( typeof widgetPositioning . vertical !== 'string' ) {
throw new TypeError ( 'widgetPositioning() vertical variable must be a string' ) ;
}
widgetPositioning . vertical = widgetPositioning . vertical . toLowerCase ( ) ;
if ( verticalModes . indexOf ( widgetPositioning . vertical ) === - 1 ) {
throw new TypeError ( 'widgetPositioning() expects vertical parameter to be one of (' + verticalModes . join ( ', ' ) + ')' ) ;
}
options . widgetPositioning . vertical = widgetPositioning . vertical ;
}
update ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . calendarWeeks = function ( calendarWeeks ) {
if ( arguments . length === 0 ) {
return options . calendarWeeks ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof calendarWeeks !== 'boolean' ) {
throw new TypeError ( 'calendarWeeks() expects parameter to be a boolean value' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . calendarWeeks = calendarWeeks ;
update ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . showTodayButton = function ( showTodayButton ) {
if ( arguments . length === 0 ) {
return options . showTodayButton ;
}
if ( typeof showTodayButton !== 'boolean' ) {
throw new TypeError ( 'showTodayButton() expects a boolean parameter' ) ;
}
options . showTodayButton = showTodayButton ;
if ( widget ) {
hide ( ) ;
show ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . showClear = function ( showClear ) {
if ( arguments . length === 0 ) {
return options . showClear ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof showClear !== 'boolean' ) {
throw new TypeError ( 'showClear() expects a boolean parameter' ) ;
}
options . showClear = showClear ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . widgetParent = function ( widgetParent ) {
if ( arguments . length === 0 ) {
return options . widgetParent ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof widgetParent === 'string' ) {
widgetParent = $ ( widgetParent ) ;
}
if ( widgetParent !== null && typeof widgetParent !== 'string' && ! ( widgetParent instanceof $ ) ) {
throw new TypeError ( 'widgetParent() expects a string or a jQuery object parameter' ) ;
}
options . widgetParent = widgetParent ;
if ( widget ) {
hide ( ) ;
show ( ) ;
}
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . keepOpen = function ( keepOpen ) {
if ( arguments . length === 0 ) {
return options . keepOpen ;
}
if ( typeof keepOpen !== 'boolean' ) {
throw new TypeError ( 'keepOpen() expects a boolean parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . keepOpen = keepOpen ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . focusOnShow = function ( focusOnShow ) {
if ( arguments . length === 0 ) {
return options . focusOnShow ;
}
if ( typeof focusOnShow !== 'boolean' ) {
throw new TypeError ( 'focusOnShow() expects a boolean parameter' ) ;
}
options . focusOnShow = focusOnShow ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . inline = function ( inline ) {
if ( arguments . length === 0 ) {
return options . inline ;
}
if ( typeof inline !== 'boolean' ) {
throw new TypeError ( 'inline() expects a boolean parameter' ) ;
}
options . inline = inline ;
return picker ;
2025-10-16 10:59:50 -06:00
} ;
2025-10-18 13:48:40 -06:00
picker . clear = function ( ) {
clear ( ) ;
return picker ;
} ;
picker . keyBinds = function ( keyBinds ) {
if ( arguments . length === 0 ) {
return options . keyBinds ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . keyBinds = keyBinds ;
return picker ;
} ;
picker . getMoment = function ( d ) {
return getMoment ( d ) ;
} ;
picker . debug = function ( debug ) {
if ( typeof debug !== 'boolean' ) {
throw new TypeError ( 'debug() expects a boolean parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . debug = debug ;
return picker ;
} ;
picker . allowInputToggle = function ( allowInputToggle ) {
if ( arguments . length === 0 ) {
return options . allowInputToggle ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof allowInputToggle !== 'boolean' ) {
throw new TypeError ( 'allowInputToggle() expects a boolean parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . allowInputToggle = allowInputToggle ;
return picker ;
} ;
picker . showClose = function ( showClose ) {
if ( arguments . length === 0 ) {
return options . showClose ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof showClose !== 'boolean' ) {
throw new TypeError ( 'showClose() expects a boolean parameter' ) ;
}
options . showClose = showClose ;
return picker ;
} ;
picker . keepInvalid = function ( keepInvalid ) {
if ( arguments . length === 0 ) {
return options . keepInvalid ;
}
if ( typeof keepInvalid !== 'boolean' ) {
throw new TypeError ( 'keepInvalid() expects a boolean parameter' ) ;
}
options . keepInvalid = keepInvalid ;
return picker ;
} ;
picker . datepickerInput = function ( datepickerInput ) {
if ( arguments . length === 0 ) {
return options . datepickerInput ;
}
if ( typeof datepickerInput !== 'string' ) {
throw new TypeError ( 'datepickerInput() expects a string parameter' ) ;
}
options . datepickerInput = datepickerInput ;
return picker ;
} ;
picker . parseInputDate = function ( parseInputDate ) {
if ( arguments . length === 0 ) {
return options . parseInputDate ;
}
if ( typeof parseInputDate !== 'function' ) {
throw new TypeError ( 'parseInputDate() sholud be as function' ) ;
}
options . parseInputDate = parseInputDate ;
return picker ;
} ;
picker . disabledTimeIntervals = function ( disabledTimeIntervals ) {
// /<signature helpKeyword="$.fn.datetimepicker.disabledTimeIntervals">
// /<summary>Returns an array with the currently set disabled dates on the component.</summary>
// /<returns type="array">options.disabledTimeIntervals</returns>
// /</signature>
// /<signature>
// /<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
// /options.enabledDates if such exist.</summary>
// /<param name="dates" locid="$.fn.datetimepicker.disabledTimeIntervals_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . disabledTimeIntervals ? $ . extend ( { } , options . disabledTimeIntervals ) : options . disabledTimeIntervals ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! disabledTimeIntervals ) {
options . disabledTimeIntervals = false ;
update ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! ( disabledTimeIntervals instanceof Array ) ) {
throw new TypeError ( 'disabledTimeIntervals() expects an array parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . disabledTimeIntervals = disabledTimeIntervals ;
update ( ) ;
return picker ;
} ;
picker . disabledHours = function ( hours ) {
// /<signature helpKeyword="$.fn.datetimepicker.disabledHours">
// /<summary>Returns an array with the currently set disabled hours on the component.</summary>
// /<returns type="array">options.disabledHours</returns>
// /</signature>
// /<signature>
// /<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
// /options.enabledHours if such exist.</summary>
// /<param name="hours" locid="$.fn.datetimepicker.disabledHours_p:hours">Takes an [ int ] of values and disallows the user to select only from those hours.</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . disabledHours ? $ . extend ( { } , options . disabledHours ) : options . disabledHours ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! hours ) {
options . disabledHours = false ;
update ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! ( hours instanceof Array ) ) {
throw new TypeError ( 'disabledHours() expects an array parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . disabledHours = indexGivenHours ( hours ) ;
options . enabledHours = false ;
if ( options . useCurrent && ! options . keepInvalid ) {
var tries = 0 ;
while ( ! isValid ( date , 'h' ) ) {
date . add ( 1 , 'h' ) ;
if ( tries === 24 ) {
throw new Error ( 'Tried 24 times to find a valid date' ) ;
}
tries ++ ;
}
setValue ( date ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
update ( ) ;
return picker ;
} ;
picker . enabledHours = function ( hours ) {
// /<signature helpKeyword="$.fn.datetimepicker.enabledHours">
// /<summary>Returns an array with the currently set enabled hours on the component.</summary>
// /<returns type="array">options.enabledHours</returns>
// /</signature>
// /<signature>
// /<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledHours if such exist.</summary>
// /<param name="hours" locid="$.fn.datetimepicker.enabledHours_p:hours">Takes an [ int ] of values and allows the user to select only from those hours.</param>
// /</signature>
if ( arguments . length === 0 ) {
return options . enabledHours ? $ . extend ( { } , options . enabledHours ) : options . enabledHours ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! hours ) {
options . enabledHours = false ;
update ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! ( hours instanceof Array ) ) {
throw new TypeError ( 'enabledHours() expects an array parameter' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
options . enabledHours = indexGivenHours ( hours ) ;
options . disabledHours = false ;
if ( options . useCurrent && ! options . keepInvalid ) {
var tries = 0 ;
while ( ! isValid ( date , 'h' ) ) {
date . add ( 1 , 'h' ) ;
if ( tries === 24 ) {
throw new Error ( 'Tried 24 times to find a valid date' ) ;
}
tries ++ ;
}
setValue ( date ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
update ( ) ;
return picker ;
} ;
/ * *
* Returns the component ' s model current viewDate , a moment object or null if not set . Passing a null value unsets the components model current moment . Parsing of the newDate parameter is made using moment library with the options . format and options . useStrict components configuration .
* @ param { Takes string , viewDate , moment , null parameter . } newDate
* @ returns { viewDate . clone ( ) }
* /
picker . viewDate = function ( newDate ) {
if ( arguments . length === 0 ) {
return viewDate . clone ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( ! newDate ) {
viewDate = date . clone ( ) ;
return picker ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
if ( typeof newDate !== 'string' && ! moment . isMoment ( newDate ) && ! ( newDate instanceof Date ) ) {
throw new TypeError ( 'viewDate() parameter must be one of [string, moment or Date]' ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
viewDate = parseInputDate ( newDate ) ;
viewUpdate ( ) ;
return picker ;
} ;
// initializing element and component attributes
if ( element . is ( 'input' ) ) {
input = element ;
} else {
input = element . find ( options . datepickerInput ) ;
if ( input . length === 0 ) {
input = element . find ( 'input' ) ;
} else if ( ! input . is ( 'input' ) ) {
throw new Error ( 'CSS class "' + options . datepickerInput + '" cannot be applied to non input element' ) ;
}
}
if ( element . hasClass ( 'input-group' ) ) {
// in case there is more then one 'input-group-addon' Issue #48
if ( element . find ( '.datepickerbutton' ) . length === 0 ) {
component = element . find ( '.input-group-addon' ) ;
2025-10-16 10:59:50 -06:00
} else {
2025-10-18 13:48:40 -06:00
component = element . find ( '.datepickerbutton' ) ;
2025-10-16 10:59:50 -06:00
}
}
2025-10-18 13:48:40 -06:00
if ( ! options . inline && ! input . is ( 'input' ) ) {
throw new Error ( 'Could not initialize DateTimePicker without an input element' ) ;
}
// Set defaults for date here now instead of in var declaration
date = getMoment ( ) ;
viewDate = date . clone ( ) ;
$ . extend ( true , options , dataToOptions ( ) ) ;
picker . options ( options ) ;
initFormatting ( ) ;
attachDatePickerElementEvents ( ) ;
if ( input . prop ( 'disabled' ) ) {
picker . disable ( ) ;
}
if ( input . is ( 'input' ) && input . val ( ) . trim ( ) . length !== 0 ) {
setValue ( parseInputDate ( input . val ( ) . trim ( ) ) ) ;
} else if ( options . defaultDate && input . attr ( 'placeholder' ) === undefined ) {
setValue ( options . defaultDate ) ;
}
if ( options . inline ) {
show ( ) ;
}
return picker ;
} ;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* jQuery plugin constructor and defaults object
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * *
* See ( http : //jquery.com/).
* @ name jQuery
* @ class
* See the jQuery Library ( http : //jquery.com/) for full details. This just
* documents the function and classes that are added to jQuery by this plug - in .
* /
/ * *
* See ( http : //jquery.com/)
* @ name fn
* @ class
* See the jQuery Library ( http : //jquery.com/) for full details. This just
* documents the function and classes that are added to jQuery by this plug - in .
* @ memberOf jQuery
* /
/ * *
* Show comments
* @ class datetimepicker
* @ memberOf jQuery . fn
* /
$ . fn . datetimepicker = function ( options ) {
options = options || { } ;
var args = Array . prototype . slice . call ( arguments , 1 ) ;
var isInstance = true ;
var thisMethods = [ 'destroy' , 'hide' , 'show' , 'toggle' ] ;
var returnValue ;
if ( _typeof ( options ) === 'object' ) {
return this . each ( function ( ) {
var $this = $ ( this ) ;
var _options ;
if ( ! $this . data ( 'DateTimePicker' ) ) {
// create a private copy of the defaults object
_options = $ . extend ( true , { } , $ . fn . datetimepicker . defaults , options ) ;
$this . data ( 'DateTimePicker' , dateTimePicker ( $this , _options ) ) ;
}
2025-10-16 10:59:50 -06:00
} ) ;
2025-10-18 13:48:40 -06:00
} else if ( typeof options === 'string' ) {
this . each ( function ( ) {
var $this = $ ( this ) ;
var instance = $this . data ( 'DateTimePicker' ) ;
if ( ! instance ) {
throw new Error ( 'bootstrap-datetimepicker("' + options + '") method was called on an element that is not using DateTimePicker' ) ;
}
returnValue = instance [ options ] . apply ( instance , args ) ;
isInstance = returnValue === instance ;
} ) ;
if ( isInstance || $ . inArray ( options , thisMethods ) > - 1 ) {
return this ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
return returnValue ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
throw new TypeError ( 'Invalid arguments for DateTimePicker: ' + options ) ;
} ;
$ . fn . datetimepicker . defaults = {
timeZone : '' ,
format : false ,
dayViewHeaderFormat : 'MMMM YYYY' ,
extraFormats : false ,
stepping : 1 ,
minDate : false ,
maxDate : false ,
useCurrent : true ,
collapse : true ,
locale : moment . locale ( ) ,
defaultDate : false ,
disabledDates : false ,
enabledDates : false ,
icons : {
time : 'glyphicon glyphicon-time' ,
date : 'glyphicon glyphicon-calendar' ,
up : 'glyphicon glyphicon-chevron-up' ,
down : 'glyphicon glyphicon-chevron-down' ,
previous : 'glyphicon glyphicon-chevron-left' ,
next : 'glyphicon glyphicon-chevron-right' ,
today : 'glyphicon glyphicon-screenshot' ,
clear : 'glyphicon glyphicon-trash' ,
close : 'glyphicon glyphicon-remove'
} ,
tooltips : {
today : 'Go to today' ,
clear : 'Clear selection' ,
close : 'Close the picker' ,
selectMonth : 'Select Month' ,
prevMonth : 'Previous Month' ,
nextMonth : 'Next Month' ,
selectYear : 'Select Year' ,
prevYear : 'Previous Year' ,
nextYear : 'Next Year' ,
selectDecade : 'Select Decade' ,
prevDecade : 'Previous Decade' ,
nextDecade : 'Next Decade' ,
prevCentury : 'Previous Century' ,
nextCentury : 'Next Century' ,
pickHour : 'Pick Hour' ,
incrementHour : 'Increment Hour' ,
decrementHour : 'Decrement Hour' ,
pickMinute : 'Pick Minute' ,
incrementMinute : 'Increment Minute' ,
decrementMinute : 'Decrement Minute' ,
pickSecond : 'Pick Second' ,
incrementSecond : 'Increment Second' ,
decrementSecond : 'Decrement Second' ,
togglePeriod : 'Toggle Period' ,
selectTime : 'Select Time'
} ,
useStrict : false ,
sideBySide : false ,
daysOfWeekDisabled : false ,
calendarWeeks : false ,
viewMode : 'days' ,
toolbarPlacement : 'default' ,
showTodayButton : false ,
showClear : false ,
showClose : false ,
widgetPositioning : {
horizontal : 'auto' ,
vertical : 'auto'
} ,
widgetParent : null ,
ignoreReadonly : false ,
keepOpen : false ,
focusOnShow : true ,
inline : false ,
keepInvalid : false ,
datepickerInput : '.datepickerinput' ,
keyBinds : {
up : function up ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . subtract ( 7 , 'd' ) ) ;
} else {
this . date ( d . clone ( ) . add ( this . stepping ( ) , 'm' ) ) ;
}
} ,
down : function down ( widget ) {
if ( ! widget ) {
this . show ( ) ;
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . add ( 7 , 'd' ) ) ;
} else {
this . date ( d . clone ( ) . subtract ( this . stepping ( ) , 'm' ) ) ;
}
} ,
'control up' : function control _up ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . subtract ( 1 , 'y' ) ) ;
} else {
this . date ( d . clone ( ) . add ( 1 , 'h' ) ) ;
}
} ,
'control down' : function control _down ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . add ( 1 , 'y' ) ) ;
} else {
this . date ( d . clone ( ) . subtract ( 1 , 'h' ) ) ;
}
} ,
left : function left ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . subtract ( 1 , 'd' ) ) ;
}
} ,
right : function right ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . add ( 1 , 'd' ) ) ;
}
} ,
pageUp : function pageUp ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . subtract ( 1 , 'M' ) ) ;
}
} ,
pageDown : function pageDown ( widget ) {
if ( ! widget ) {
return ;
}
var d = this . date ( ) || this . getMoment ( ) ;
if ( widget . find ( '.datepicker' ) . is ( ':visible' ) ) {
this . date ( d . clone ( ) . add ( 1 , 'M' ) ) ;
}
} ,
enter : function enter ( ) {
this . hide ( ) ;
} ,
escape : function escape ( ) {
this . hide ( ) ;
} ,
// tab: function (widget) { //this break the flow of the form. disabling for now
// var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
// if(toggle.length > 0) toggle.click();
// },
'control space' : function control _space ( widget ) {
if ( ! widget ) {
return ;
}
if ( widget . find ( '.timepicker' ) . is ( ':visible' ) ) {
widget . find ( '.btn[data-action="togglePeriod"]' ) . click ( ) ;
}
} ,
t : function t ( ) {
this . date ( this . getMoment ( ) ) ;
} ,
'delete' : function _delete ( ) {
this . clear ( ) ;
2025-10-16 10:59:50 -06:00
}
2025-10-18 13:48:40 -06:00
} ,
debug : false ,
allowInputToggle : false ,
disabledTimeIntervals : false ,
disabledHours : false ,
enabledHours : false ,
viewDate : false
} ;
return $ . fn . datetimepicker ;
} ) ;
2025-09-24 18:27:08 -06:00
2025-10-18 13:48:40 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
/***/ 75139 :
/***/ ( ( module ) => {
2025-10-16 10:59:50 -06:00
2025-10-18 13:48:40 -06:00
"use strict" ;
module . exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC" ;
2025-09-24 18:27:08 -06:00
/***/ } ) ,
2025-10-16 10:59:50 -06:00
/***/ 95851 :
/***/ ( ( ) => {
2025-09-24 18:27:08 -06:00
2025-10-16 10:59:50 -06:00
// localStorage
( function ( ) {
function isSupported ( ) {
var item = 'localStoragePollyfill' ;
try {
localStorage . setItem ( item , item ) ;
localStorage . removeItem ( item ) ;
sessionStorage . setItem ( item , item ) ;
sessionStorage . removeItem ( item ) ;
return true ;
} catch ( e ) {
return false ;
}
}
if ( ! isSupported ( ) ) {
try {
Storage . prototype . _data = { } ;
Storage . prototype . setItem = function ( id , val ) {
this . _data [ id ] = String ( val ) ;
return this . _data [ id ] ;
} ;
Storage . prototype . getItem = function ( id ) {
return this . _data . hasOwnProperty ( id ) ? this . _data [ id ] : undefined ;
} ;
Storage . prototype . removeItem = function ( id ) {
return delete this . _data [ id ] ;
} ;
Storage . prototype . clear = function ( ) {
this . _data = { } ;
return this . _data ;
} ;
} catch ( e ) {
console . error ( 'localStorage pollyfill error: ' , e ) ;
}
}
} ) ( ) ;
2020-11-18 13:36:30 -08:00
/***/ } )
/******/ } ) ;
/************************************************************************/
/******/ // The module cache
/******/ var _ _webpack _module _cache _ _ = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/ // Check if module is in cache
2021-04-20 11:51:53 -07:00
/******/ var cachedModule = _ _webpack _module _cache _ _ [ moduleId ] ;
/******/ if ( cachedModule !== undefined ) {
/******/ return cachedModule . exports ;
2020-11-18 13:36:30 -08:00
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = _ _webpack _module _cache _ _ [ moduleId ] = {
/******/ id : moduleId ,
/******/ loaded : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ _ _webpack _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 = _ _webpack _modules _ _ ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/amd define */
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . amdD = function ( ) {
/******/ throw new Error ( 'define cannot be used indirect' ) ;
/******/ } ;
/******/ } ) ( ) ;
/******/
2021-04-20 11:51:53 -07:00
/******/ /* webpack/runtime/chunk loaded */
/******/ ( ( ) => {
/******/ var deferred = [ ] ;
/******/ _ _webpack _require _ _ . O = ( result , chunkIds , fn , priority ) => {
/******/ if ( chunkIds ) {
/******/ priority = priority || 0 ;
/******/ for ( var i = deferred . length ; i > 0 && deferred [ i - 1 ] [ 2 ] > priority ; i -- ) deferred [ i ] = deferred [ i - 1 ] ;
/******/ deferred [ i ] = [ chunkIds , fn , priority ] ;
/******/ return ;
/******/ }
/******/ var notFulfilled = Infinity ;
/******/ for ( var i = 0 ; i < deferred . length ; i ++ ) {
/******/ var [ chunkIds , fn , priority ] = deferred [ i ] ;
/******/ var fulfilled = true ;
/******/ for ( var j = 0 ; j < chunkIds . length ; j ++ ) {
/******/ if ( ( priority & 1 === 0 || notFulfilled >= priority ) && Object . keys ( _ _webpack _require _ _ . O ) . every ( ( key ) => ( _ _webpack _require _ _ . O [ key ] ( chunkIds [ j ] ) ) ) ) {
/******/ chunkIds . splice ( j -- , 1 ) ;
/******/ } else {
/******/ fulfilled = false ;
/******/ if ( priority < notFulfilled ) notFulfilled = priority ;
/******/ }
/******/ }
/******/ if ( fulfilled ) {
/******/ deferred . splice ( i -- , 1 )
2022-01-07 21:49:32 -08:00
/******/ var r = fn ( ) ;
/******/ if ( r !== undefined ) result = r ;
2021-04-20 11:51:53 -07:00
/******/ }
/******/ }
/******/ return result ;
/******/ } ;
/******/ } ) ( ) ;
/******/
2020-11-18 13:36:30 -08:00
/******/ /* webpack/runtime/compat get default export */
/******/ ( ( ) => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = ( module ) => {
/******/ var getter = module && module . _ _esModule ?
2021-04-20 11:51:53 -07:00
/******/ ( ) => ( module [ 'default' ] ) :
/******/ ( ) => ( module ) ;
2020-11-18 13:36:30 -08:00
/******/ _ _webpack _require _ _ . d ( getter , { a : getter } ) ;
/******/ return getter ;
/******/ } ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/define property getters */
/******/ ( ( ) => {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = ( exports , definition ) => {
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/global */
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . g = ( function ( ) {
/******/ if ( typeof globalThis === 'object' ) return globalThis ;
/******/ try {
/******/ return this || new Function ( 'return this' ) ( ) ;
/******/ } catch ( e ) {
/******/ if ( typeof window === 'object' ) return window ;
/******/ }
/******/ } ) ( ) ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ( ( ) => {
2021-04-20 11:51:53 -07:00
/******/ _ _webpack _require _ _ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
2020-11-18 13:36:30 -08:00
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ ( ( ) => {
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = ( exports ) => {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/node module decorator */
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . nmd = ( module ) => {
/******/ module . paths = [ ] ;
/******/ if ( ! module . children ) module . children = [ ] ;
/******/ return module ;
/******/ } ;
/******/ } ) ( ) ;
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ ( ( ) => {
2022-02-03 13:59:14 -08:00
/******/ _ _webpack _require _ _ . b = document . baseURI || self . location . href ;
2020-11-18 13:36:30 -08:00
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
2021-04-20 11:51:53 -07:00
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
2020-11-18 13:36:30 -08:00
/******/ var installedChunks = {
2025-10-16 10:59:50 -06:00
/******/ 884 : 0
2020-11-18 13:36:30 -08:00
/******/ } ;
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
2021-04-20 11:51:53 -07:00
/******/ _ _webpack _require _ _ . O . j = ( chunkId ) => ( installedChunks [ chunkId ] === 0 ) ;
2020-11-18 13:36:30 -08:00
/******/
/******/ // install a JSONP callback for chunk loading
2021-04-20 11:51:53 -07:00
/******/ var webpackJsonpCallback = ( parentChunkLoadingFunction , data ) => {
/******/ var [ chunkIds , moreModules , runtime ] = data ;
2020-11-18 13:36:30 -08:00
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
2021-04-20 11:51:53 -07:00
/******/ var moduleId , chunkId , i = 0 ;
2022-01-07 21:49:32 -08:00
/******/ if ( chunkIds . some ( ( id ) => ( installedChunks [ id ] !== 0 ) ) ) {
/******/ for ( moduleId in moreModules ) {
/******/ if ( _ _webpack _require _ _ . o ( moreModules , moduleId ) ) {
/******/ _ _webpack _require _ _ . m [ moduleId ] = moreModules [ moduleId ] ;
/******/ }
2020-11-18 13:36:30 -08:00
/******/ }
2022-01-07 21:49:32 -08:00
/******/ if ( runtime ) var result = runtime ( _ _webpack _require _ _ ) ;
2020-11-18 13:36:30 -08:00
/******/ }
2021-04-20 11:51:53 -07:00
/******/ if ( parentChunkLoadingFunction ) parentChunkLoadingFunction ( data ) ;
/******/ for ( ; i < chunkIds . length ; i ++ ) {
/******/ chunkId = chunkIds [ i ] ;
/******/ if ( _ _webpack _require _ _ . o ( installedChunks , chunkId ) && installedChunks [ chunkId ] ) {
/******/ installedChunks [ chunkId ] [ 0 ] ( ) ;
/******/ }
2022-02-03 13:59:14 -08:00
/******/ installedChunks [ chunkId ] = 0 ;
2020-11-18 13:36:30 -08:00
/******/ }
2021-05-02 21:50:19 -07:00
/******/ return _ _webpack _require _ _ . O ( result ) ;
2020-11-18 13:36:30 -08:00
/******/ }
/******/
/******/ var chunkLoadingGlobal = self [ "webpackChunkGrav" ] = self [ "webpackChunkGrav" ] || [ ] ;
2021-04-20 11:51:53 -07:00
/******/ chunkLoadingGlobal . forEach ( webpackJsonpCallback . bind ( null , 0 ) ) ;
/******/ chunkLoadingGlobal . push = webpackJsonpCallback . bind ( null , chunkLoadingGlobal . push . bind ( chunkLoadingGlobal ) ) ;
2020-11-18 13:36:30 -08:00
/******/ } ) ( ) ;
/******/
2024-10-25 14:57:44 +01:00
/******/ /* webpack/runtime/nonce */
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . nc = undefined ;
/******/ } ) ( ) ;
/******/
2020-11-18 13:36:30 -08:00
/************************************************************************/
2021-04-20 11:51:53 -07:00
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
2025-10-18 13:48:40 -06:00
/******/ var _ _webpack _exports _ _ = _ _webpack _require _ _ . O ( undefined , [ 121 ] , ( ) => ( _ _webpack _require _ _ ( 36736 ) ) )
2021-04-20 11:51:53 -07:00
/******/ _ _webpack _exports _ _ = _ _webpack _require _ _ . O ( _ _webpack _exports _ _ ) ;
/******/ Grav = _ _webpack _exports _ _ ;
/******/
2020-11-18 13:36:30 -08:00
/******/ } ) ( )
2025-10-17 15:07:46 -06:00
;