diff --git a/CHANGELOG.md b/CHANGELOG.md index bcca71ff..79ace673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Get fresh media list for `Controller::getListMedia()` rather that cache so always latest. * Add translation strings for the new system.force_ssl option * Lists now features a new YAML option `controls: [top|bottom|both]` (default: bottom) which will display the "Add Item" button at the Top and/or Bottom position relative to the list. When the Top button is pressed, a new item will be added at the beginning of the list, when the Bottom button is pressed, a new item will be appended to the list. + * Lists now features two new YAML options `sortby: [field]` (default: disabled) and `sortby_dir: [asc|desc]` (default: asc) which will display a new Sorting button in the list allowing to automatically reindex the collection based on the given sort field set. 1. [](#bugfix) * Fixed issue in Admin favicon URL [#704](https://github.com/getgrav/grav-plugin-admin/issues/704) * Fixed issue in `selfupgrade` where the package would get downloaded in the wrong destination diff --git a/themes/grav/app/forms/fields/collections.js b/themes/grav/app/forms/fields/collections.js index e25f12da..e1a13709 100644 --- a/themes/grav/app/forms/fields/collections.js +++ b/themes/grav/app/forms/fields/collections.js @@ -17,6 +17,7 @@ export default class CollectionsField { list.on('click', '> .collection-actions [data-action="add"]', (event) => this.addItem(event)); list.on('click', '> ul > li > .item-actions [data-action="delete"]', (event) => this.removeItem(event)); + list.on('click', '> .collection-actions [data-action-sort="date"]', (event) => this.sortItems(event)); list.on('input', '[data-key-observe]', (event) => this.observeKey(event)); list.find('[data-collection-holder]').each((index, container) => { @@ -43,9 +44,11 @@ export default class CollectionsField { let items = list.closest('[data-type="collection"]').find('> ul > [data-collection-item]'); let topAction = list.closest('[data-type="collection"]').find('[data-action-add="top"]'); + let sortAction = list.closest('[data-type="collection"]').find('[data-action="sort"]'); - if (items.length && topAction.length) { - topAction.parent().removeClass('hidden'); + if (items.length) { + if (topAction.length) { topAction.parent().removeClass('hidden'); } + if (sortAction.length && items.length > 1) { sortAction.removeClass('hidden'); } } // refresh toggleables in a list @@ -62,10 +65,39 @@ export default class CollectionsField { let items = list.closest('[data-type="collection"]').find('> ul > [data-collection-item]'); let topAction = list.closest('[data-type="collection"]').find('[data-action-add="top"]'); + let sortAction = list.closest('[data-type="collection"]').find('[data-action="sort"]'); - if (!items.length && topAction.length) { - topAction.parent().addClass('hidden'); + if (!items.length) { + if (topAction.length) { topAction.parent().addClass('hidden'); } } + + if (sortAction.length && items.length <= 1) { sortAction.addClass('hidden'); } + } + + sortItems(event) { + let button = $(event.currentTarget); + let sortby = button.data('action-sort'); + let sortby_dir = button.data('action-sort-dir') || 'asc'; + let list = $(button.closest('[data-type="collection"]')); + let items = list.closest('[data-type="collection"]').find('> ul > [data-collection-item]'); + + items.sort((a, b) => { + let A = $(a).find('[name$="[' + sortby + ']"]'); + let B = $(b).find('[name$="[' + sortby + ']"]'); + let 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((_, container) => { + $(container).parent().append(container); + }); + + this.reindex(list); } observeKey(event) { diff --git a/themes/grav/js/admin.min.js b/themes/grav/js/admin.min.js index ba58de4a..d2020f47 100644 --- a/themes/grav/js/admin.min.js +++ b/themes/grav/js/admin.min.js @@ -9,7 +9,7 @@ aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h typeFirstDefinitions:!0,atoms:a("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(t){return t.eatWhile(/[\w\$_]/),"meta"},'"':function(t,e){return e.tokenize=y(t.match('""')?"triple":"single"),e.tokenize(t,e)},"`":function(t,e){return!(!x||!t.match("`"))&&(e.tokenize=x,x=null,e.tokenize(t,e))},"'":function(t){return t.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(t,e,n){if(("variable"==n||"variable-3"==n)&&"."==e.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";t.defineMode("sass",function(t){function e(t){return new RegExp("^"+t.join("|"))}function n(t,e){var n=t.peek();return")"===n?(t.next(),e.tokenizer=u,"operator"):"("===n?(t.next(),t.eatSpace(),"operator"):"'"===n||'"'===n?(e.tokenizer=i(t.next()),"string"):(e.tokenizer=i(")",!1),"string")}function r(t,e){return function(n,r){return n.sol()&&n.indentation()<=t?(r.tokenizer=u,u(n,r)):(e&&n.skipTo("*/")?(n.next(),n.next(),r.tokenizer=u):n.skipToEnd(),"comment")}}function i(t,e){function n(r,i){var a=r.next(),s=r.peek(),c=r.string.charAt(r.pos-2),l="\\"!==a&&s===t||a===t&&"\\"!==c;return l?(a!==t&&e&&r.next(),i.tokenizer=u,"string"):"#"===a&&"{"===s?(i.tokenizer=o(n),r.next(),"operator"):"string"}return null==e&&(e=!0),n}function o(t){return function(e,n){return"}"===e.peek()?(e.next(),n.tokenizer=t,"operator"):u(e,n)}}function a(e){if(0==e.indentCount){e.indentCount++;var n=e.scopes[0].offset,r=n+t.indentUnit;e.scopes.unshift({offset:r})}}function s(t){1!=t.scopes.length&&t.scopes.shift()}function u(t,e){var c=t.peek();if(t.match("/*"))return e.tokenizer=r(t.indentation(),!0),e.tokenizer(t,e);if(t.match("//"))return e.tokenizer=r(t.indentation(),!1),e.tokenizer(t,e);if(t.match("#{"))return e.tokenizer=o(u),"operator";if('"'===c||"'"===c)return t.next(),e.tokenizer=i(c),"string";if(e.cursorHalf){if("#"===c&&(t.next(),t.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return t.peek()||(e.cursorHalf=0),"number";if(t.match(/^-?[0-9\.]+/))return t.peek()||(e.cursorHalf=0),"number";if(t.match(/^(px|em|in)\b/))return t.peek()||(e.cursorHalf=0),"unit";if(t.match(f))return t.peek()||(e.cursorHalf=0),"keyword";if(t.match(/^url/)&&"("===t.peek())return e.tokenizer=n,t.peek()||(e.cursorHalf=0),"atom";if("$"===c)return t.next(),t.eatWhile(/[\w-]/),t.peek()||(e.cursorHalf=0),"variable-3";if("!"===c)return t.next(),t.peek()||(e.cursorHalf=0),t.match(/^[\w]+/)?"keyword":"operator";if(t.match(h))return t.peek()||(e.cursorHalf=0),"operator";if(t.eatWhile(/[\w-]/))return t.peek()||(e.cursorHalf=0),"attribute";if(!t.peek())return e.cursorHalf=0,null}else{if("."===c){if(t.next(),t.match(/^[\w-]+/))return a(e),"atom";if("#"===t.peek())return a(e),"atom"}if("#"===c){if(t.next(),t.match(/^[\w-]+/))return a(e),"atom";if("#"===t.peek())return a(e),"atom"}if("$"===c)return t.next(),t.eatWhile(/[\w-]/),"variable-2";if(t.match(/^-?[0-9\.]+/))return"number";if(t.match(/^(px|em|in)\b/))return"unit";if(t.match(f))return"keyword";if(t.match(/^url/)&&"("===t.peek())return e.tokenizer=n,"atom";if("="===c&&t.match(/^=[\w-]+/))return a(e),"meta";if("+"===c&&t.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&t.match(/@extend/)&&(t.match(/\s*[\w]/)||s(e)),t.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(e),"meta";if("@"===c)return t.next(),t.eatWhile(/[\w-]/),"meta";if(t.eatWhile(/[\w-]/))return t.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":t.match(/ *:/,!1)?(a(e),e.cursorHalf=1,"atom"):t.match(/ *,/,!1)?"atom":(a(e),"atom");if(":"===c)return t.match(p)?"keyword":(t.next(),e.cursorHalf=1,"operator")}return t.match(h)?"operator":(t.next(),null)}function c(e,n){e.sol()&&(n.indentCount=0);var r=n.tokenizer(e,n),i=e.current();if("@return"!==i&&"}"!==i||s(n),null!==r){for(var o=e.pos-i.length,a=o+t.indentUnit*n.indentCount,u=[],c=0;c","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],h=e(d),p=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:u,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(t,e){var n=c(t,e);return e.lastToken={style:n,content:t.current()},n},indent:function(t){return t.scopes[0].offset}}}),t.defineMIME("text/x-sass","sass")})},function(t,e,n){!function(t){t(n(353),n(402))}(function(t){"use strict";t.defineMode("twig:inner",function(){function t(t,a){var s=t.peek();if(a.incomment)return t.skipTo("#}")?(t.eatWhile(/\#|}/),a.incomment=!1):t.skipToEnd(),"comment";if(a.intag){if(a.operator){if(a.operator=!1,t.match(i))return"atom";if(t.match(o))return"number"}if(a.sign){if(a.sign=!1,t.match(i))return"atom";if(t.match(o))return"number"}if(a.instring)return s==a.instring&&(a.instring=!1),t.next(),"string";if("'"==s||'"'==s)return a.instring=s,t.next(),"string";if(t.match(a.intag+"}")||t.eat("-")&&t.match(a.intag+"}"))return a.intag=!1,"tag";if(t.match(n))return a.operator=!0,"operator";if(t.match(r))a.sign=!0;else if(t.eat(" ")||t.sol()){if(t.match(e))return"keyword";if(t.match(i))return"atom";if(t.match(o))return"number";t.sol()&&t.next()}else t.next();return"variable"}if(t.eat("{")){if(s=t.eat("#"))return a.incomment=!0,t.skipTo("#}")?(t.eatWhile(/\#|}/),a.incomment=!1):t.skipToEnd(),"comment";if(s=t.eat(/\{|%/))return a.intag=s,"{"==s&&(a.intag="}"),t.eat("-"),"tag"}t.next()}var e=["and","as","autoescape","endautoescape","block","do","endblock","else","elseif","extends","for","endfor","embed","endembed","filter","endfilter","flush","from","if","endif","in","is","include","import","not","or","set","spaceless","endspaceless","with","endwith","trans","endtrans","blocktrans","endblocktrans","macro","endmacro","use","verbatim","endverbatim"],n=/^[+\-*&%=<>!?|~^]/,r=/^[:\[\(\{]/,i=["true","false","null","empty","defined","divisibleby","divisible by","even","odd","iterable","sameas","same as"],o=/^(\d[+\-\*\/])?\d+(\.\d+)?/;return e=new RegExp("(("+e.join(")|(")+"))\\b"),i=new RegExp("(("+i.join(")|(")+"))\\b"),{startState:function(){return{}},token:function(e,n){return t(e,n)}}}),t.defineMode("twig",function(e,n){var r=t.getMode(e,"twig:inner");return n&&n.base?t.multiplexingMode(t.getMode(e,n.base),{open:/\{[{#%]/,close:/[}#%]\}/,mode:r,parseDelimiters:!0}):r}),t.defineMIME("text/x-twig","twig")})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";t.multiplexingMode=function(e){function n(t,e,n,r){if("string"==typeof e){var i=t.indexOf(e,n);return r&&i>-1?i+e.length:i}var o=e.exec(n?t.slice(n):t);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:t.startState(e),innerActive:null,inner:null}},copyState:function(n){return{outer:t.copyState(e,n.outer),innerActive:n.innerActive,inner:n.innerActive&&t.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var u=a.close?n(s,a.close,i.pos,a.parseDelimiters):-1;if(u==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";u>-1&&(i.string=s.slice(0,u));var c=a.mode.token(i,o.inner);return u>-1&&(i.string=s),u==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var l=1/0,s=i.string,f=0;fn.keyCol)return t.skipToEnd(),"string";if(n.literal&&(n.literal=!1),t.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,t.match(/---/))return"def";if(t.match(/\.\.\./))return"def";if(t.match(/\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return"{"==r?n.inlinePairs++:"}"==r?n.inlinePairs--:"["==r?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&","==r)return t.next(),"meta";if(n.inlinePairs>0&&!i&&","==r)return n.keyCol=0,n.pair=!1,n.pairStart=!1,t.next(),"meta";if(n.pairStart){if(t.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==n.inlinePairs&&t.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(t.match(e))return"keyword"}return!n.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=t.indentation(),"atom"):n.pair&&t.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==r,t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),t.defineMIME("text/x-yaml","yaml")})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";var e=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,r=/[*+-]\s/;t.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return t.Pass;for(var o=i.listSelections(),a=[],s=0;s")>=0?h[2]:parseInt(h[3],10)+1+h[4];a[s]="\n"+p+v+m}}i.replaceSelections(a)}})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";function e(t){for(var e=0;e1,n.options.tooltips))}}r.onUpdateLinting&&r.onUpdateLinting(e,i,t)}function m(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(function(){h(t)},e.options.delay||500))}function v(t,e){for(var n=e.target||e.srcElement,r=document.createDocumentFragment(),o=0;o=0&&_.splice(e,1)}function s(t){var e=document.createElement("style");return e.type="text/css",o(t,e),e}function u(t){var e=document.createElement("link");return e.rel="stylesheet",o(t,e),e}function c(t,e){var n,r,i;if(e.singleton){var o=y++;n=g||(g=s(e)),r=l.bind(null,n,o,!1),i=l.bind(null,n,o,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=u(e),r=d.bind(null,n),i=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),r=f.bind(null,n),i=function(){a(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}function l(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=b(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function f(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function d(t,e){var n=e.css,r=e.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var i=new Blob([n],{type:"text/css"}),o=t.href;t.href=URL.createObjectURL(i),o&&URL.revokeObjectURL(o)}var h={},p=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},m=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),v=p(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,y=0,_=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=m()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var n=i(t);return r(n,e),function(t){for(var o=[],a=0;a0){var l=o.character;u.forEach(function(t){l>t&&(l-=1)}),o.character=l}}var f=o.character-1,d=f+1;o.evidence&&(s=o.evidence.substring(f).search(/.\b/),s>-1&&(d+=s)),o.description=o.reason,o.start=o.character,o.end=d,o=n(o),o&&r.push({message:o.description,severity:o.severity,from:t.Pos(o.line-1,f),to:t.Pos(o.line-1,d)})}}}var a=["Dangerous comment"],s=[["Expected '{'","Statement body should be inside '{ }' braces."]],u=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];t.registerHelper("lint","javascript",e)})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";t.registerHelper("lint","json",function(e){var n=[];jsonlint.parseError=function(e,r){var i=r.loc;n.push({from:t.Pos(i.first_line-1,i.first_column),to:t.Pos(i.last_line-1,i.last_column),message:e})};try{jsonlint.parse(e)}catch(r){}return n})})},function(t,e,n){!function(t){t(n(353))}(function(t){"use strict";t.registerHelper("lint","yaml",function(e){var n=[];try{jsyaml.load(e)}catch(r){var i=r.mark;n.push({from:t.Pos(i.line,i.column),to:t.Pos(i.line,i.column),message:r.message})}return n})})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(1),o=r(i);(0,o["default"])('[name="task"][value="saveas"], [name="task"][value="switchlanguage"]').on("mousedown touchstart",function(t){var e=["lang","redirect"],n=(0,o["default"])(t.currentTarget),r=(0,o["default"])("#"+n.attr("form"));if(r.length)return e.forEach(function(t){var e=n.attr(t);if(e){var i=r.find('[name="data['+t+']"]');i.length||(i=(0,o["default"])(''),r.append(i)),i.val(e)}}),!0})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(417),o=r(i),a=n(423),s=r(a),u=n(424),c=r(u);e["default"]={Form:{Form:s["default"],Instance:a.Instance},Fields:c["default"],FormState:{FormState:o["default"],Instance:i.Instance}}},function(t,e,n){(function(t){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.DOMBehaviors=e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?p(t)+e:e}function v(){return!0}function g(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function y(t,e){return b(t,e,0)}function _(t,e){return b(t,e,e)}function b(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function x(t){this.next=t}function k(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function w(){return{value:void 0,done:!0}}function S(t){return!!M(t)}function E(t){return t&&"function"==typeof t.next}function A(t){var e=M(t);return e&&e.call(t)}function M(t){var e=t&&(wn&&t[wn]||t[Sn]);if("function"==typeof e)return e}function I(t){return t&&"number"==typeof t.length}function O(t){return null===t||void 0===t?q():o(t)?t.toSeq():R(t)}function C(t){return null===t||void 0===t?q().toKeyedSeq():o(t)?a(t)?t.toSeq():t.fromEntrySeq():F(t)}function P(t){return null===t||void 0===t?q():o(t)?a(t)?t.entrySeq():t.toIndexedSeq():U(t)}function T(t){return(null===t||void 0===t?q():o(t)?a(t)?t.entrySeq():t:U(t)).toSetSeq()}function j(t){this._array=t,this.size=t.length}function z(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function D(t){this._iterable=t,this.size=t.length||t.size}function L(t){this._iterator=t,this._iteratorCache=[]}function N(t){return!(!t||!t[An])}function q(){return Mn||(Mn=new j([]))}function F(t){var e=Array.isArray(t)?new j(t).fromEntrySeq():E(t)?new L(t).fromEntrySeq():S(t)?new D(t).fromEntrySeq():"object"==typeof t?new z(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function U(t){var e=B(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function R(t){var e=B(t)||"object"==typeof t&&new z(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function B(t){return I(t)?new j(t):E(t)?new L(t):S(t)?new D(t):void 0}function V(t,e,n,r){var i=t._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(e(s[1],r?s[0]:a,t)===!1)return a+1}return a}return t.__iterateUncached(e,n)}function H(t,e,n,r){var i=t._cache;if(i){var o=i.length-1,a=0;return new x(function(){var t=i[n?o-a:a];return a++>o?w():k(e,r?t[0]:a-1,t[1])})}return t.__iteratorUncached(e,n)}function G(t,e){return e?K(e,t,"",{"":t}):W(t)}function K(t,e,n,r){return Array.isArray(e)?t.call(r,n,P(e).map(function(n,r){return K(t,n,r,e)})):$(e)?t.call(r,n,C(e).map(function(n,r){return K(t,n,r,e)})):e}function W(t){return Array.isArray(t)?P(t).map(W).toList():$(t)?C(t).map(W).toMap():t; }function $(t){return t&&(t.constructor===Object||void 0===t.constructor)}function J(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function Y(t,e){if(t===e)return!0;if(!o(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||a(t)!==a(e)||s(t)!==s(e)||c(t)!==c(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!u(t);if(c(t)){var r=t.entries();return e.every(function(t,e){var i=r.next().value;return i&&J(i[1],t)&&(n||J(i[0],e))})&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var l=t;t=e,e=l}var f=!0,d=e.__iterate(function(e,r){if(n?!t.has(e):i?!J(e,t.get(r,gn)):!J(t.get(r,gn),e))return f=!1,!1});return f&&t.size===d}function X(t,e){if(!(this instanceof X))return new X(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(In)return In;In=this}}function Q(t,e){if(!t)throw new Error(e)}function Z(t,e,n){if(!(this instanceof Z))return new Z(t,e,n);if(Q(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e>>1&1073741824|3221225471&t}function ot(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if(t!==t||t===1/0)return 0;var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)t/=4294967295,n^=t;return it(n)}if("string"===e)return t.length>Nn?at(t):st(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return ut(t);if("function"==typeof t.toString)return st(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function at(t){var e=Un[t];return void 0===e&&(e=st(t),Fn===qn&&(Fn=0,Un={}),Fn++,Un[t]=e),e}function st(t){for(var e=0,n=0;n0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function lt(t){Q(t!==1/0,"Cannot perform this action with an infinite size.")}function ft(t){return null===t||void 0===t?kt():dt(t)&&!c(t)?t:kt().withMutations(function(e){var r=n(t);lt(r.size),r.forEach(function(t,n){return e.set(n,t)})})}function dt(t){return!(!t||!t[Rn])}function ht(t,e){this.ownerID=t,this.entries=e}function pt(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function mt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function vt(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function gt(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function yt(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&bt(t._root)}function _t(t,e){return k(t,e[0],e[1])}function bt(t,e){return{node:t,index:0,__prev:e}}function xt(t,e,n,r){var i=Object.create(Bn);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function kt(){return Vn||(Vn=xt(0))}function wt(t,e,n){var r,i;if(t._root){var o=l(yn),a=l(_n);if(r=St(t._root,t.__ownerID,0,void 0,e,n,o,a),!a.value)return t;i=t.size+(o.value?n===gn?-1:1:0)}else{if(n===gn)return t;i=1,r=new ht(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=i,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?xt(i,r):kt()}function St(t,e,n,r,i,o,a,s){return t?t.update(e,n,r,i,o,a,s):o===gn?t:(f(s),f(a),new gt(e,r,[i,o]))}function Et(t){return t.constructor===gt||t.constructor===vt}function At(t,e,n,r,i){if(t.keyHash===r)return new vt(e,r,[t.entry,i]);var o,a=(0===n?t.keyHash:t.keyHash>>>n)&vn,s=(0===n?r:r>>>n)&vn,u=a===s?[At(t,e,n+pn,r,i)]:(o=new gt(e,r,i),a>>=1)a[s]=1&n?e[o++]:void 0;return a[r]=i,new mt(t,o+1,a)}function Ct(t,e,r){for(var i=[],a=0;a>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Lt(t,e,n,r){var i=r?t:h(t);return i[e]=n,i}function Nt(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,c=a-n;return c>mn&&(c=mn),function(){if(i===c)return Yn;var t=e?--c:i++;return r&&r[t]}}function i(t,r,i){var s,u=t&&t.array,c=i>o?0:o-i>>r,l=(a-i>>r)+1;return l>mn&&(l=mn),function(){for(;;){if(s){var t=s();if(t!==Yn)return t;s=null}if(c===l)return Yn;var o=e?--l:c++;s=n(u&&u[o],r-pn,i+(o<=t.size||e<0)return t.withMutations(function(t){e<0?Jt(t,e).set(0,n):Jt(t,0,e+1).set(e,n)});e+=t._origin;var r=t._tail,i=t._root,o=l(_n);return e>=Xt(t._capacity)?r=Kt(r,t.__ownerID,0,e,n,o):i=Kt(i,t.__ownerID,t._level,e,n,o),o.value?t.__ownerID?(t._root=i,t._tail=r,t.__hash=void 0,t.__altered=!0,t):Vt(t._origin,t._capacity,t._level,i,r):t}function Kt(t,e,n,r,i,o){var a=r>>>n&vn,s=t&&a0){var c=t&&t.array[a],l=Kt(c,e,n-pn,r,i,o);return l===c?t:(u=Wt(t,e),u.array[a]=l,u)}return s&&t.array[a]===i?t:(f(o),u=Wt(t,e),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Wt(t,e){return e&&t&&e===t.ownerID?t:new Rt(t?t.array.slice():[],e)}function $t(t,e){if(e>=Xt(t._capacity))return t._tail;if(e<1<0;)n=n.array[e>>>r&vn],r-=pn;return n}}function Jt(t,e,n){void 0!==e&&(e=0|e),void 0!==n&&(n=0|n);var r=t.__ownerID||new d,i=t._origin,o=t._capacity,a=i+e,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return t;if(a>=s)return t.clear();for(var u=t._level,c=t._root,l=0;a+l<0;)c=new Rt(c&&c.array.length?[void 0,c]:[],r),u+=pn,l+=1<=1<f?new Rt([],r):p;if(p&&h>f&&apn;g-=pn){var y=f>>>g&vn;v=v.array[y]=Wt(v.array[y],r)}v.array[f>>>pn&vn]=p}if(s=h)a-=h,s-=h,u=pn,c=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&vn;if(_!==h>>>u&vn)break;_&&(l+=(1<i&&(c=c.removeBefore(r,u,a-l)),c&&ha&&(a=c.size),o(u)||(c=c.map(function(t){return G(t)})),i.push(c)}return a>t.size&&(t=t.setSize(a)),jt(t,e,i)}function Xt(t){return t>>pn<=mn&&a.size>=2*o.size?(i=a.filter(function(t,e){return void 0!==t&&s!==e}),r=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=o.remove(e),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return t;r=o,i=a.set(s,[e,n])}else r=o.set(e,a.size),i=a.set(a.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t):te(r,i)}function re(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ie(t){this._iter=t,this.size=t.size}function oe(t){this._iter=t,this.size=t.size}function ae(t){this._iter=t,this.size=t.size}function se(t){var e=Ie(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Oe,e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return e(n,t,r)!==!1},n)},e.__iteratorUncached=function(e,n){if(e===kn){var r=t.__iterator(e,n);return new x(function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===xn?bn:xn,n)},e}function ue(t,e,n){var r=Ie(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var o=t.get(r,gn);return o===gn?i:e.call(n,o,r,t)},r.__iterateUncached=function(r,i){var o=this;return t.__iterate(function(t,i,a){return r(e.call(n,t,i,a),i,o)!==!1},i)},r.__iteratorUncached=function(r,i){var o=t.__iterator(kn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return k(r,s,e.call(n,a[1],s,t),i)})},r}function ce(t,e){var n=Ie(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=se(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=Oe,n.__iterate=function(e,n){var r=this;return t.__iterate(function(t,n){return e(t,n,r)},!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function le(t,e,n,r){var i=Ie(t);return r&&(i.has=function(r){var i=t.get(r,gn);return i!==gn&&!!e.call(n,i,r,t)},i.get=function(r,i){var o=t.get(r,gn);return o!==gn&&e.call(n,o,r,t)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return t.__iterate(function(t,o,u){if(e.call(n,t,o,u))return s++,i(t,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=t.__iterator(kn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,c=u[0],l=u[1];if(e.call(n,l,c,t))return k(i,r?c:s++,l,o)}})},i}function fe(t,e,n){var r=ft().asMutable();return t.__iterate(function(i,o){r.update(e.call(n,i,o,t),0,function(t){return t+1})}),r.asImmutable()}function de(t,e,n){var r=a(t),i=(c(t)?Qt():ft()).asMutable();t.__iterate(function(o,a){i.update(e.call(n,o,a,t),function(t){return t=t||[],t.push(r?[a,o]:o),t})});var o=Me(t);return i.map(function(e){return Se(t,o(e))})}function he(t,e,n,r){var i=t.size;if(void 0!==e&&(e=0|e),void 0!==n&&(n=n===1/0?i:0|n),g(e,n,i))return t;var o=y(e,i),a=_(n,i);if(o!==o||a!==a)return he(t.toSeq().cacheResult(),e,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var c=Ie(t);return c.size=0===s?s:t.size&&s||void 0,!r&&N(t)&&s>=0&&(c.get=function(e,n){return e=m(this,e),e>=0&&es)return w();var t=i.next();return r||e===xn?t:e===bn?k(e,u-1,void 0,t):k(e,u-1,t.value[1],t)})},c}function pe(t,e,n){var r=Ie(t);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return t.__iterate(function(t,i,s){return e.call(n,t,i,s)&&++a&&r(t,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=t.__iterator(kn,i),s=!0;return new x(function(){if(!s)return w();var t=a.next();if(t.done)return t;var i=t.value,u=i[0],c=i[1];return e.call(n,c,u,o)?r===kn?t:k(r,u,c,t):(s=!1,w())})},r}function me(t,e,n,r){var i=Ie(t);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return t.__iterate(function(t,o,c){if(!s||!(s=e.call(n,t,o,c)))return u++,i(t,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=t.__iterator(kn,o),u=!0,c=0;return new x(function(){var t,o,l;do{if(t=s.next(),t.done)return r||i===xn?t:i===bn?k(i,c++,void 0,t):k(i,c++,t.value[1],t);var f=t.value;o=f[0],l=f[1],u&&(u=e.call(n,l,o,a))}while(u);return i===kn?t:k(i,o,l,t)})},i}function ve(t,e){var r=a(t),i=[t].concat(e).map(function(t){return o(t)?r&&(t=n(t)):t=r?F(t):U(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===i.length)return t;if(1===i.length){var u=i[0];if(u===t||r&&a(u)||s(t)&&s(u))return u}var c=new j(i);return r?c=c.toKeyedSeq():s(t)||(c=c.toSetSeq()),c=c.flatten(!0),c.size=i.reduce(function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}},0),c}function ge(t,e,n){var r=Ie(t);return r.__iterateUncached=function(r,i){function a(t,c){var l=this;t.__iterate(function(t,i){return(!e||c0}function we(t,n,r){var i=Ie(t);return i.size=new j(r).map(function(t){return t.size}).min(),i.__iterate=function(t,e){for(var n,r=this.__iterator(xn,e),i=0;!(n=r.next()).done&&t(n.value,i++,this)!==!1;);return i},i.__iteratorUncached=function(t,i){var o=r.map(function(t){return t=e(t),A(i?t.reverse():t)}),a=0,s=!1;return new x(function(){var e;return s||(e=o.map(function(t){return t.next()}),s=e.some(function(t){return t.done})),s?w():k(t,a++,n.apply(null,e.map(function(t){return t.value})))})},i}function Se(t,e){return N(t)?e:t.constructor(e)}function Ee(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Ae(t){return lt(t.size),p(t)}function Me(t){return a(t)?n:s(t)?r:i}function Ie(t){return Object.create((a(t)?C:s(t)?P:T).prototype)}function Oe(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Ce(t,e){return t>e?1:te?-1:0}function on(t){if(t.size===1/0)return 0;var e=c(t),n=a(t),r=e?1:0,i=t.__iterate(n?e?function(t,e){r=31*r+sn(ot(t),ot(e))|0}:function(t,e){r=r+sn(ot(t),ot(e))|0}:e?function(t){r=31*r+ot(t)|0}:function(t){r=r+ot(t)|0});return an(i,r)}function an(t,e){return e=Pn(e,3432918353),e=Pn(e<<15|e>>>-15,461845907),e=Pn(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Pn(e^e>>>16,2246822507),e=Pn(e^e>>>13,3266489909),e=it(e^e>>>16)}function sn(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var un=Array.prototype.slice;t(n,e),t(r,e),t(i,e),e.isIterable=o,e.isKeyed=a,e.isIndexed=s,e.isAssociative=u,e.isOrdered=c,e.Keyed=n,e.Indexed=r,e.Set=i;var cn="@@__IMMUTABLE_ITERABLE__@@",ln="@@__IMMUTABLE_KEYED__@@",fn="@@__IMMUTABLE_INDEXED__@@",dn="@@__IMMUTABLE_ORDERED__@@",hn="delete",pn=5,mn=1<r?w():k(t,i,n[e?r-i++:i++])})},t(z,C),z.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},z.prototype.has=function(t){return this._object.hasOwnProperty(t)},z.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[e?i-o:o];if(t(n[a],a,this)===!1)return o+1}return o},z.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[e?i-o:o];return o++>i?w():k(t,a,n[a])})},z.prototype[dn]=!0,t(D,P),D.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=this._iterable,r=A(n),i=0;if(E(r))for(var o;!(o=r.next()).done&&t(o.value,i++,this)!==!1;);return i},D.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterable,r=A(n);if(!E(r))return new x(w);var i=0;return new x(function(){var e=r.next();return e.done?e:k(t,i++,e.value)})},t(L,P),L.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var e=n.next();if(e.done)return e;r[i]=e.value}return k(t,i,r[i++])})};var Mn;t(X,P),X.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},X.prototype.get=function(t,e){return this.has(t)?this._value:e},X.prototype.includes=function(t){return J(this._value,t)},X.prototype.slice=function(t,e){var n=this.size;return g(t,e,n)?this:new X(this._value,_(e,n)-y(t,n))},X.prototype.reverse=function(){return this},X.prototype.indexOf=function(t){return J(this._value,t)?0:-1},X.prototype.lastIndexOf=function(t){return J(this._value,t)?this.size:-1},X.prototype.__iterate=function(t,e){for(var n=0;n=0&&e=0&&nn?w():k(t,o++,a)})},Z.prototype.equals=function(t){return t instanceof Z?this._start===t._start&&this._end===t._end&&this._step===t._step:Y(this,t)};var On;t(tt,e),t(et,tt),t(nt,tt),t(rt,tt),tt.Keyed=et,tt.Indexed=nt,tt.Set=rt;var Cn,Pn="function"==typeof Math.imul&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t=0|t,e=0|e;var n=65535&t,r=65535&e;return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0},Tn=Object.isExtensible,jn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),zn="function"==typeof WeakMap;zn&&(Cn=new WeakMap);var Dn=0,Ln="__immutablehash__";"function"==typeof Symbol&&(Ln=Symbol(Ln));var Nn=16,qn=255,Fn=0,Un={};t(ft,et),ft.of=function(){var t=un.call(arguments,0);return kt().withMutations(function(e){for(var n=0;n=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}})},ft.prototype.toString=function(){return this.__toString("Map {","}")},ft.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},ft.prototype.set=function(t,e){return wt(this,t,e)},ft.prototype.setIn=function(t,e){return this.updateIn(t,gn,function(){return e})},ft.prototype.remove=function(t){return wt(this,t,gn)},ft.prototype.deleteIn=function(t){return this.updateIn(t,function(){return gn})},ft.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},ft.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=zt(this,Pe(t),e,n);return r===gn?void 0:r},ft.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):kt()},ft.prototype.merge=function(){return Ct(this,void 0,arguments)},ft.prototype.mergeWith=function(t){var e=un.call(arguments,1);return Ct(this,t,e)},ft.prototype.mergeIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,kt(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},ft.prototype.mergeDeep=function(){return Ct(this,Pt,arguments)},ft.prototype.mergeDeepWith=function(t){var e=un.call(arguments,1);return Ct(this,Tt(t),e)},ft.prototype.mergeDeepIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,kt(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},ft.prototype.sort=function(t){return Qt(be(this,t))},ft.prototype.sortBy=function(t,e){return Qt(be(this,e,t))},ft.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},ft.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new d)},ft.prototype.asImmutable=function(){return this.__ensureOwner()},ft.prototype.wasAltered=function(){return this.__altered},ft.prototype.__iterator=function(t,e){return new yt(this,t,e)},ft.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},ft.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?xt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},ft.isMap=dt;var Rn="@@__IMMUTABLE_MAP__@@",Bn=ft.prototype;Bn[Rn]=!0,Bn[hn]=Bn.remove,Bn.removeIn=Bn.deleteIn,ht.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,a=i.length;o=Hn)return Mt(t,u,r,i);var p=t&&t===this.ownerID,m=p?u:h(u);return d?s?c===l-1?m.pop():m[c]=m.pop():m[c]=[r,i]:m.push([r,i]),p?(this.entries=m,this):new ht(t,m)}},pt.prototype.get=function(t,e,n,r){void 0===e&&(e=ot(n));var i=1<<((0===t?e:e>>>t)&vn),o=this.bitmap;return 0===(o&i)?r:this.nodes[Dt(o&i-1)].get(t+pn,e,n,r)},pt.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=ot(r));var s=(0===e?n:n>>>e)&vn,u=1<=Gn)return Ot(t,d,c,s,p);if(l&&!p&&2===d.length&&Et(d[1^f]))return d[1^f];if(l&&p&&1===d.length&&Et(p))return p;var m=t&&t===this.ownerID,v=l?p?c:c^u:c|u,g=l?p?Lt(d,f,p,m):qt(d,f,m):Nt(d,f,p,m);return m?(this.bitmap=v,this.nodes=g,this):new pt(t,v,g)},mt.prototype.get=function(t,e,n,r){void 0===e&&(e=ot(n));var i=(0===t?e:e>>>t)&vn,o=this.nodes[i];return o?o.get(t+pn,e,n,r):r},mt.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=ot(r));var s=(0===e?n:n>>>e)&vn,u=i===gn,c=this.nodes,l=c[s];if(u&&!l)return this;var f=St(l,t,e+pn,n,r,i,o,a);if(f===l)return this;var d=this.count;if(l){if(!f&&(d--,d=0&&t>>e&vn;if(r>=this.array.length)return new Rt([],t);var i,o=0===r;if(e>0){var a=this.array[r];if(i=a&&a.removeBefore(t,e-pn,n),i===a&&o)return this}if(o&&!i)return this;var s=Wt(this,t);if(!o)for(var u=0;u>>e&vn;if(r>=this.array.length)return this;var i;if(e>0){var o=this.array[r];if(i=o&&o.removeAfter(t,e-pn,n),i===o&&r===this.array.length-1)return this}var a=Wt(this,t);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Jn,Yn={};t(Qt,ft),Qt.of=function(){return this(arguments)},Qt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Qt.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Qt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):ee()},Qt.prototype.set=function(t,e){return ne(this,t,e)},Qt.prototype.remove=function(t){return ne(this,t,gn)},Qt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Qt.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],n)},e)},Qt.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Qt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?te(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Qt.isOrderedMap=Zt,Qt.prototype[dn]=!0,Qt.prototype[hn]=Qt.prototype.remove;var Xn;t(re,C),re.prototype.get=function(t,e){return this._iter.get(t,e)},re.prototype.has=function(t){return this._iter.has(t)},re.prototype.valueSeq=function(){return this._iter.valueSeq()},re.prototype.reverse=function(){var t=this,e=ce(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},re.prototype.map=function(t,e){var n=this,r=ue(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},re.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?Ae(this):0,function(i){return t(i,e?--n:n++,r)}),e)},re.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(xn,e),r=e?Ae(this):0;return new x(function(){var i=n.next();return i.done?i:k(t,e?--r:r++,i.value,i)})},re.prototype[dn]=!0,t(ie,P),ie.prototype.includes=function(t){return this._iter.includes(t)},ie.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate(function(e){return t(e,r++,n)},e)},ie.prototype.__iterator=function(t,e){var n=this._iter.__iterator(xn,e),r=0;return new x(function(){var e=n.next();return e.done?e:k(t,r++,e.value,e)})},t(oe,T),oe.prototype.has=function(t){return this._iter.includes(t)},oe.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){return t(e,e,n)},e)},oe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(xn,e);return new x(function(){var e=n.next();return e.done?e:k(t,e.value,e.value,e)})},t(ae,C),ae.prototype.entrySeq=function(){return this._iter.toSeq()},ae.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){if(e){Ee(e);var r=o(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}},e)},ae.prototype.__iterator=function(t,e){var n=this._iter.__iterator(xn,e);return new x(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){Ee(r);var i=o(r);return k(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}})},ie.prototype.cacheResult=re.prototype.cacheResult=oe.prototype.cacheResult=ae.prototype.cacheResult=Oe,t(Te,et),Te.prototype.toString=function(){return this.__toString(ze(this)+" {","}")},Te.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},Te.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},Te.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=je(this,kt()))},Te.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+ze(this));if(this._map&&!this._map.has(t)){var n=this._defaultValues[t];if(e===n)return this}var r=this._map&&this._map.set(t,e);return this.__ownerID||r===this._map?this:je(this,r)},Te.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:je(this,e)},Te.prototype.wasAltered=function(){return this._map.wasAltered()},Te.prototype.__iterator=function(t,e){var r=this;return n(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},Te.prototype.__iterate=function(t,e){var r=this;return n(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},Te.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?je(this,e,t):(this.__ownerID=t,this._map=e,this)};var Qn=Te.prototype;Qn[hn]=Qn.remove,Qn.deleteIn=Qn.removeIn=Bn.removeIn,Qn.merge=Bn.merge,Qn.mergeWith=Bn.mergeWith,Qn.mergeIn=Bn.mergeIn,Qn.mergeDeep=Bn.mergeDeep,Qn.mergeDeepWith=Bn.mergeDeepWith,Qn.mergeDeepIn=Bn.mergeDeepIn,Qn.setIn=Bn.setIn,Qn.update=Bn.update,Qn.updateIn=Bn.updateIn,Qn.withMutations=Bn.withMutations,Qn.asMutable=Bn.asMutable,Qn.asImmutable=Bn.asImmutable,t(Ne,rt),Ne.of=function(){return this(arguments)},Ne.fromKeys=function(t){return this(n(t).keySeq())},Ne.prototype.toString=function(){return this.__toString("Set {","}")},Ne.prototype.has=function(t){return this._map.has(t)},Ne.prototype.add=function(t){return Fe(this,this._map.set(t,!0))},Ne.prototype.remove=function(t){return Fe(this,this._map.remove(t))},Ne.prototype.clear=function(){return Fe(this,this._map.clear())},Ne.prototype.union=function(){var t=un.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var n=0;n=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):$e(t,e)},Ke.prototype.pushAll=function(t){if(t=r(t),0===t.size)return this;lt(t.size);var e=this.size,n=this._head;return t.reverse().forEach(function(t){e++,n={value:t,next:n}}),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):$e(e,n)},Ke.prototype.pop=function(){return this.slice(1)},Ke.prototype.unshift=function(){return this.push.apply(this,arguments)},Ke.prototype.unshiftAll=function(t){return this.pushAll(t)},Ke.prototype.shift=function(){return this.pop.apply(this,arguments)},Ke.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Je()},Ke.prototype.slice=function(t,e){if(g(t,e,this.size))return this;var n=y(t,this.size),r=_(e,this.size);if(r!==this.size)return nt.prototype.slice.call(this,t,e);for(var i=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):$e(i,o)},Ke.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?$e(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Ke.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&t(r.value,n++,this)!==!1;)r=r.next;return n},Ke.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new x(function(){if(r){var e=r.value;return r=r.next,k(t,n++,e)}return w()})},Ke.isStack=We;var ir="@@__IMMUTABLE_STACK__@@",or=Ke.prototype;or[ir]=!0,or.withMutations=Bn.withMutations,or.asMutable=Bn.asMutable,or.asImmutable=Bn.asImmutable,or.wasAltered=Bn.wasAltered;var ar;e.Iterator=x,Ye(e,{toArray:function(){lt(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate(function(e,n){t[n]=e}),t},toIndexedSeq:function(){return new ie(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new re(this,(!0))},toMap:function(){return ft(this.toKeyedSeq())},toObject:function(){lt(this.size);var t={};return this.__iterate(function(e,n){t[n]=e}),t},toOrderedMap:function(){return Qt(this.toKeyedSeq())},toOrderedSet:function(){return Be(a(this)?this.valueSeq():this)},toSet:function(){return Ne(a(this)?this.valueSeq():this)},toSetSeq:function(){return new oe(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Ke(a(this)?this.valueSeq():this)},toList:function(){return Ft(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){var t=un.call(arguments,0);return Se(this,ve(this,t))},includes:function(t){return this.some(function(e){return J(e,t)})},entries:function(){return this.__iterator(kn)},every:function(t,e){lt(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!t.call(e,r,i,o))return n=!1,!1}),n},filter:function(t,e){return Se(this,le(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},forEach:function(t,e){return lt(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){lt(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate(function(r){n?n=!1:e+=t,e+=null!==r&&void 0!==r?r.toString():""}),e},keys:function(){return this.__iterator(bn)},map:function(t,e){return Se(this,ue(this,t,e))},reduce:function(t,e,n){lt(this.size);var r,i;return arguments.length<2?i=!0:r=e,this.__iterate(function(e,o,a){i?(i=!1,r=e):r=t.call(n,r,e,o,a)}),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Se(this,ce(this,!0))},slice:function(t,e){return Se(this,he(this,t,e,!0))},some:function(t,e){return!this.every(Ze(t),e)},sort:function(t){return Se(this,be(this,t))},values:function(){return this.__iterator(xn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return p(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return fe(this,t,e)},equals:function(t){return Y(this,t)},entrySeq:function(){var t=this;if(t._cache)return new j(t._cache);var e=t.toSeq().map(Qe).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Ze(t),e)},findEntry:function(t,e,n){var r=n;return this.__iterate(function(n,i,o){if(t.call(e,n,i,o))return r=[i,n],!1}),r},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(v)},flatMap:function(t,e){return Se(this,ye(this,t,e))},flatten:function(t){return Se(this,ge(this,t,!0))},fromEntrySeq:function(){return new ae(this)},get:function(t,e){return this.find(function(e,n){return J(n,t)},void 0,e)},getIn:function(t,e){for(var n,r=this,i=Pe(t);!(n=i.next()).done;){var o=n.value;if(r=r&&r.get?r.get(o,gn):gn,r===gn)return e}return r},groupBy:function(t,e){return de(this,t,e)},has:function(t){return this.get(t,gn)!==gn},hasIn:function(t){return this.getIn(t,gn)!==gn},isSubset:function(t){return t="function"==typeof t.includes?t:e(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t="function"==typeof t.isSubset?t:e(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return J(e,t)})},keySeq:function(){return this.toSeq().map(Xe).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return xe(this,t)},maxBy:function(t,e){return xe(this,e,t)},min:function(t){return xe(this,t?tn(t):rn)},minBy:function(t,e){return xe(this,e?tn(e):rn,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return Se(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return Se(this,me(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Ze(t),e)},sortBy:function(t,e){return Se(this,be(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return Se(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return Se(this,pe(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Ze(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var sr=e.prototype;sr[cn]=!0,sr[En]=sr.values,sr.__toJS=sr.toArray,sr.__toStringMapper=en,sr.inspect=sr.toSource=function(){return this.toString()},sr.chain=sr.flatMap,sr.contains=sr.includes,Ye(n,{flip:function(){return Se(this,se(this))},mapEntries:function(t,e){var n=this,r=0;return Se(this,this.toSeq().map(function(i,o){return t.call(e,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return Se(this,this.toSeq().flip().map(function(r,i){return t.call(e,r,i,n)}).flip())}});var ur=n.prototype;ur[ln]=!0,ur[En]=sr.entries,ur.__toJS=sr.toObject,ur.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+en(t)},Ye(r,{toKeyedSeq:function(){return new re(this,(!1))},filter:function(t,e){return Se(this,le(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Se(this,ce(this,!1))},slice:function(t,e){return Se(this,he(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=y(t,t<0?this.count():this.size);var r=this.slice(0,t);return Se(this,1===n?r:r.concat(h(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(t){return Se(this,ge(this,t,!1))},get:function(t,e){return t=m(this,t),t<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,n){return n===t},void 0,e)},has:function(t){return t=m(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t100)return d(t,e,n);var u=o.diff(t,e),f=0;return u.forEach(function(t){if("="===t.op)f++;else if("!="===t.op){if(l(t.val)&&l(t.newVal)){var e=d(t.val,t.newVal,s(a,f));i=i.concat(e)}else i.push(c("replace",s(a,f),t.newVal));f++}else"+"===t.op?(i.push(c("add",s(a,f),t.val)),f++):"-"===t.op&&i.push(c("remove",s(a,f)))}),i},p=function(t,e,n){var r=n||"";return t===e?[]:[c("replace",s(r,""),e)]},m=function(t,e,n){return r.is(t,e)?r.List():t==e||null!=t&&null!=e?f(t)&&f(e)?r.fromJS(h(t,e)):l(t)&&l(e)?r.fromJS(d(t,e)):r.fromJS(p(t,e,n)):r.fromJS([c("replace","/",e)])};t.exports=m},function(t,e,n){"use strict";var r=n(418),i=function(t){return r.Iterable.isKeyed(t)},o=function(t){return r.Iterable.isIndexed(t)},a=function(t,e,n){return"remove"===t?{op:t,path:e}:{op:t,path:e,value:n}};t.exports={isMap:i,isIndexed:o,op:a}},function(t,e,n){"use strict";function r(t,e){for(var n=t.size||0,r=e.size||0,a=o(n+1,r+1,0),s=0;s0&&o>0&&i.is(e.get(r-1),n.get(o-1))?l(t,e,n,r-1,o-1).concat(new s({op:"=",val:e.get(r-1)})):r>0&&o>0&&r===o&&!i.is(e.get(r-1),n.get(o-1))?l(t,e,n,r-1,o-1).concat(new u({val:e.get(r-1),newVal:n.get(r-1)})):o>0&&(0===r||t[r][o-1]>=t[r-1][o])?l(t,e,n,r,o-1).concat(new s({op:"+",val:n.get(o-1)})):r>0&&(0===o||t[r][o-1]');n.append(i)}),t=!0,!0)})})}},{key:"addedNodes",value:function(t){var e=this;t.forEach(function(t){"childList"===t.type&&t.addedNodes&&(0,s["default"])("body").trigger("mutation._grav",t.target,t,e)})}}]),e}();e["default"]=u;e.Instance=new u("form#blueprints")}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(425),o=r(i),a=n(426),s=r(a),u=n(427),c=r(u),l=n(428),f=r(l),d=n(351),h=r(d),p=n(510),m=r(p);n(515),e["default"]={SelectizeField:{SelectizeField:o["default"],Instance:i.Instance},ArrayField:{ArrayField:s["default"],Instance:a.Instance},CollectionsField:{CollectionsField:c["default"],Instance:u.Instance},DateTimeField:{DateTimeField:f["default"],Instance:l.Instance},EditorField:{EditorField:h["default"],Instance:d.Instance},ColorpickerField:{ColorpickerField:m["default"],Instance:p.Instance}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n\n \n ':'\n
\n \n \n ',t+='\n \n \n
'}}]),t}(),l=function(){function t(){var e=this;i(this,t),u.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(t){return e.actionInput(t)}),u.on("click touch","[data-grav-array-action]",function(t){return e.actionEvent(t)})}return o(t,[{key:"actionInput", -value:function(t){var e=(0,s["default"])(t.target),n=e.data("grav-array-type");this._setTemplate(e);var r=e.data("array-template"),i="key"===n?e:e.siblings('[data-grav-array-type="key"]:first'),o="value"===n?e:e.siblings('[data-grav-array-type="value"]:first'),a=r.getName()+"["+(r.isValueOnly()?this.getIndexFor(e):i.val())+"]";o.attr("name",o.val()?a:r.getName()),this.refreshNames(r)}},{key:"actionEvent",value:function(t){t&&t.preventDefault();var e=(0,s["default"])(t.target),n=e.data("grav-array-action");this._setTemplate(e),this[n+"Action"](e)}},{key:"addAction",value:function(t){var e=t.data("array-template"),n=t.closest('[data-grav-array-type="row"]');n.after(e.getNewRow())}},{key:"remAction",value:function(t){var e=t.data("array-template"),n=t.closest('[data-grav-array-type="row"]'),r=!n.siblings().length;if(r){var i=(0,s["default"])(e.getNewRow());n.after(i),i.find('[data-grav-array-type="value"]:last').attr("name",e.getName())}n.remove(),this.refreshNames(e)}},{key:"refreshNames",value:function(t){if(t.isValueOnly()){var e=t.container.find('> div > [data-grav-array-type="row"]'),n=e.find('[name]:not([name=""])');n.each(function(t,e){e=(0,s["default"])(e);var n=e.attr("name");n=n.replace(/\[\d+\]$/,"["+t+"]"),e.attr("name",n)}),n.length||e.find('[data-grav-array-type="value"]').attr("name",t.getName())}}},{key:"getIndexFor",value:function(t){var e=t.data("array-template"),n=t.closest('[data-grav-array-type="row"]');return e.container.find((e.isValueOnly()?"> div ":"")+' > [data-grav-array-type="row"]').index(n)}},{key:"_setTemplate",value:function(t){t.data("array-template")||t.data("array-template",new c(t.closest("[data-grav-array-name]")))}}]),t}();e["default"]=l;e.Instance=new l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n .collection-actions [data-action="add"]',function(t){return e.addItem(t)}),t.on("click",'> ul > li > .item-actions [data-action="delete"]',function(t){return e.removeItem(t)}),t.on("input","[data-key-observe]",function(t){return e.observeKey(t)}),t.find("[data-collection-holder]").each(function(t,n){n=(0,s["default"])(n),n.data("collection-sort")||n[0].hasAttribute("data-collection-nosort")||n.data("collection-sort",new c["default"](n.get(0),{forceFallback:!1,animation:150,filter:".CodeMirror, .grav-editor-resizer",onUpdate:function(){return e.reindex(n)}}))})}},{key:"addItem",value:function(t){var e=(0,s["default"])(t.currentTarget),n=e.data("action-add")||"bottom",r=(0,s["default"])(e.closest('[data-type="collection"]')),i=(0,s["default"])(r.find('> [data-collection-template="new"]').data("collection-template-html"));r.find("> [data-collection-holder]")["top"===n?"prepend":"append"](i),this.reindex(r);var o=r.closest('[data-type="collection"]').find("> ul > [data-collection-item]"),a=r.closest('[data-type="collection"]').find('[data-action-add="top"]');o.length&&a.length&&a.parent().removeClass("hidden"),(0,s["default"])('[data-grav-field="toggleable"] input[type="checkbox"]').trigger("change")}},{key:"removeItem",value:function(t){var e=(0,s["default"])(t.currentTarget),n=e.closest("[data-collection-item]"),r=(0,s["default"])(e.closest('[data-type="collection"]'));n.remove(),this.reindex(r);var i=r.closest('[data-type="collection"]').find("> ul > [data-collection-item]"),o=r.closest('[data-type="collection"]').find('[data-action-add="top"]');!i.length&&o.length&&o.parent().addClass("hidden")}},{key:"observeKey",value:function(t){var e=(0,s["default"])(t.target),n=e.val(),r=e.closest("[data-collection-key]");r.data("collection-key-backup",r.data("collection-key")).data("collection-key",n),this.reindex(null,r)}},{key:"reindex",value:function(t,e){e=e||(0,s["default"])(t).closest('[data-type="collection"]').find("> ul > [data-collection-item]"),e.each(function(t,e){e=(0,s["default"])(e);var n=e.find("[data-key-observe]"),r=n.val(),i=n.length,o=e.data("collection-key-backup");e.attr("data-collection-key",i?r:t),["name","data-grav-field-name","for","id"].forEach(function(t){e.find("["+t+"], [_"+t+"]").each(function(){var e=(0,s["default"])(this),n=[],a=[new RegExp("\\[(\\d+|\\*|"+o+")\\]","g"),new RegExp("\\.(\\d+|\\*|"+o+")\\.","g")];if(i&&!r)return e.attr("_"+t,e.attr(t)),void e.attr(t,null);e.attr("_"+t)&&(e.attr(t,e.attr("_"+t)),e.attr("_"+t,null)),e.parents("[data-collection-key]").map(function(t,e){return n.push((0,s["default"])(e).attr("data-collection-key"))}),n.reverse();var u=e.attr(t).replace(a[0],function(){return"["+(n.shift()||o)+"]"});u=u.replace(a[1],function(){return"."+n.shift()+"."}),e.attr(t,u)})})})}},{key:"_onAddedNodes",value:function(t,e){var n=this,r=(0,s["default"])(e).find('[data-type="collection"]');r.length&&r.each(function(t,e){e=(0,s["default"])(e),~n.lists.index(e)||n.addList(e)})}}]),t}();e["default"]=l;e.Instance=new l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n-1,p=(0,s["default"])("body"),m="mousedown touchstart MSPointerDown pointerdown",v="mousemove touchmove MSPointerMove pointermove",g="mouseup touchend MSPointerUp pointerup",y=h?"focus":"focusin",_=function(){function t(e){var n=this;i(this,t),this.selector=e,this.field=(0,s["default"])(this.selector),this.options=Object.assign({},this.field.data("grav-colorpicker")),this.built=!1,this.attach(),this.options.update&&this.field.on("change._grav_colorpicker",function(t,e,r,i){var o=r,a=(0,d.hex2rgb)(r);i<1&&(o="rgba("+a.r+", "+a.g+", "+a.b+", "+i+")");var s=e.closest(n.options.update);s.length||(s=e.siblings(n.options.update)),s.length||(s=e.parent(".g-colorpicker").find(n.options.update)),s.css({backgroundColor:o})})}return o(t,[{key:"attach",value:function(){var t=this;p.on(y,this.selector,function(e){return t.show(e,e.currentTarget)}),p.on(m,".g-colorpicker, .g-colorpicker i",this.bound("iconClick")),p.on("keydown",this.selector,function(e){switch(e.keyCode){case 9:t.hide();break;case 13:case 27:t.hide(),e.currentTarget.blur()}return!0}),p.on("keyup",this.selector,function(e){return t.updateFromInput(!0,e.currentTarget),!0}),p.on("paste",this.selector,function(e){setTimeout(function(){return t.updateFromInput(!0,e.currentTarget)},1)})}},{key:"show",value:function(t,e){e=(0,s["default"])(e),this.built||this.build(),this.element=e,this.reposition(),this.wrapper.addClass("cp-visible"),this.updateFromInput();var n=(0,s["default"])("#admin-main .content-wrapper").data("scrollbar").getViewElement();this.wrapper.on(m,".cp-grid, .cp-slider, .cp-opacity-slider",this.bound("bodyDown")),p.on(v,this.bound("bodyMove")),p.on(m,this.bound("bodyClick")),p.on(g,this.bound("targetReset")),(0,s["default"])(n).on("scroll",this.bound("reposition"))}},{key:"hide",value:function(){if(this.built){this.wrapper.removeClass("cp-visible");var t=(0,s["default"])("#admin-main .content-wrapper").data("scrollbar").getViewElement();this.wrapper.undelegate(m,".cp-grid, .cp-slider, .cp-opacity-slider",this.bound("bodyDown")),p.off(v,this.bound("bodyMove")),p.off(m,this.bound("bodyClick")),p.off(g,this.bound("targetReset")),(0,s["default"])(t).off("scroll",this.bound("reposition"))}}},{key:"build",value:function(){var t=this;this.wrapper=(0,s["default"])('
'),this.slider=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')),this.opacitySlider=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')),this.grid=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')).append((0,s["default"])('
')),(0,s["default"])("
").appendTo(this.grid.find(".cp-picker"));var e=(0,s["default"])('
').appendTo(this.wrapper);this.tabs={hue:(0,s["default"])('
').text("HUE").appendTo(e),brightness:(0,s["default"])('
').text("BRI").appendTo(e),saturation:(0,s["default"])('
').text("SAT").appendTo(e),wheel:(0,s["default"])('
').text("WHEEL").appendTo(e),transparent:(0,s["default"])('
').text("TRANSPARENT").appendTo(e)},e.on(m,"> div",function(n){var r=(0,s["default"])(n.currentTarget);if(r.is(t.tabs.transparent)){var i=t.opacitySlider.height();return t.opacity=0,t.opacitySlider.find(".cp-picker").css({top:(0,c["default"])(i-i*t.opacity,0,i)}),void t.move(t.opacitySlider,{manualOpacity:!0})}var o=e.find(".active"),a=o.attr("class").replace(/\s|active|cp-tab-/g,""),u=r.attr("class").replace(/\s|active|cp-tab-/g,"");t.wrapper.removeClass("cp-mode-"+a).addClass("cp-mode-"+u),o.removeClass("active"),r.addClass("active"),t.mode=u,t.updateFromInput()}),this.wrapper.appendTo(".content-wrapper"),this.built=!0,this.mode="hue"}},{key:"reposition",value:function(){var t=(0,s["default"])(".content-wrapper")[0],e=this.element[0].getBoundingClientRect(),n=t.getBoundingClientRect(),r={x:0,y:0};this.options.offset&&(r.x=this.options.offset.x||0,r.y=this.options.offset.y||0),this.wrapper.css({top:e.top+e.height+t.scrollTop-n.top+r.y,left:e.left+t.scrollLeft-n.left+r.x})}},{key:"iconClick",value:function(t){if(this.wrapper&&this.wrapper.hasClass("cp-visible"))return!0;t&&t.preventDefault();var e=(0,s["default"])(t.currentTarget).find("input");setTimeout(function(){return e.focus()},50)}},{key:"bodyMove",value:function(t){t&&t.preventDefault(),this.target&&this.move(this.target,t)}},{key:"bodyClick",value:function(t){var e=(0,s["default"])(t.target);e.closest(".cp-wrapper").length||e.is(this.selector)||this.hide()}},{key:"bodyDown",value:function(t){t&&t.preventDefault(),this.target=(0,s["default"])(t.currentTarget),this.move(this.target,t,!0)}},{key:"targetReset",value:function(t){t&&t.preventDefault(),this.target=null}},{key:"move",value:function(t,e){var n=this.element,r=t.find(".cp-picker"),i=t[0].getBoundingClientRect(),o=i.left+window.scrollX,a=i.top+window.scrollY,s=Math.round((e?e.pageX:0)-o),u=Math.round((e?e.pageY:0)-a),c=void 0,l=void 0,f=void 0,d=void 0,h=e.changedTouches||e.originalEvent&&e.originalEvent.changedTouches;e&&h&&(s=(h?h[0].pageX:0)-o,u=(h?h[0].pageY:0)-a),e&&e.manualOpacity&&(u=i.height),s<0&&(s=0),u<0&&(u=0),s>i.width&&(s=i.width),u>i.height&&(u=i.height),t.parent(".cp-mode-wheel").length&&r.parent(".cp-grid").length&&(c=75-s,l=75-u,f=Math.sqrt(c*c+l*l),d=Math.atan2(l,c),d<0&&(d+=2*Math.PI),f>75&&(s=75-75*Math.cos(d),u=75-75*Math.sin(d)),s=Math.round(s),u=Math.round(u)),t.hasClass("cp-grid")?(r.css({top:u,left:s}),this.updateFromPicker(n,t)):(r.css({top:u}),this.updateFromPicker(n,t))}},{key:"updateFromInput",value:function(t,e){e=e?(0,s["default"])(e):this.element;var n=e.val(),r=n.replace(/\s/g,"").match(/^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/),i=void 0,o=void 0;if(n=(0,d.rgbstr2hex)(n)||n,r=r?(0,c["default"])(r[1],0,1):1,(i=(0,d.parseHex)(n))||(i="#ffffff"),o=(0,d.hex2hsb)(i),this.built){this.opacity=r;var a=this.opacitySlider.height();this.opacitySlider.find(".cp-picker").css({top:(0,c["default"])(a-a*this.opacity,0,a)});var u=this.grid.height(),l=this.grid.width(),f=void 0,h=void 0,p=void 0,m=void 0;switch(a=this.slider.height(),this.mode){case"wheel":f=(0,c["default"])(Math.ceil(.75*o.s),0,u/2),h=o.h*Math.PI/180,p=(0,c["default"])(75-Math.cos(h)*f,0,l),m=(0,c["default"])(75-Math.sin(h)*f,0,u),this.grid.css({backgroundColor:"transparent"}).find(".cp-picker").css({top:m,left:p}),m=150-o.b/(100/u),""===i&&(m=0),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:o.s,b:100})});break;case"saturation":p=(0,c["default"])(5*o.h/12,0,150),m=(0,c["default"])(u-Math.ceil(o.b/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.s*(a/100),0,a),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:100,b:o.b})}),this.grid.find(".cp-grid-inner").css({opacity:o.s/100});break;case"brightness":p=(0,c["default"])(5*o.h/12,0,150),m=(0,c["default"])(u-Math.ceil(o.s/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.b*(a/100),0,a),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:o.s,b:100})}),this.grid.find(".cp-grid-inner").css({opacity:1-o.b/100});break;case"hue":default:p=(0,c["default"])(Math.ceil(o.s/(100/l)),0,l),m=(0,c["default"])(u-Math.ceil(o.b/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.h/(360/a),0,a),this.slider.find(".cp-picker").css({top:m}),this.grid.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:100,b:100})})}}t||e.val(this.getValue(i)),(this.element||e).trigger("change._grav_colorpicker",[e,i,r])}},{key:"updateFromPicker",value:function(t,e){var n=function(t,e){var n,r;return t.length&&e?(n=t[0].getBoundingClientRect().left,r=t[0].getBoundingClientRect().top,{x:n-e[0].getBoundingClientRect().left+t[0].offsetWidth/2,y:r-e[0].getBoundingClientRect().top+t[0].offsetHeight/2}):null},r=void 0,i=void 0,o=void 0,a=void 0,s=void 0,u=void 0,l=void 0,f=void 0,h=this.wrapper.find(".cp-grid"),p=this.wrapper.find(".cp-slider"),m=this.wrapper.find(".cp-opacity-slider"),v=h.find(".cp-picker"),g=p.find(".cp-picker"),y=m.find(".cp-picker"),_=n(v,h),b=n(g,p),x=n(y,m),k=h[0].getBoundingClientRect().width,w=h[0].getBoundingClientRect().height,S=p[0].getBoundingClientRect().height,E=m[0].getBoundingClientRect().height,A=this.element.val();if(A=(0,d.rgbstr2hex)(A)||A,(r=(0,d.parseHex)(A))||(r="#ffffff"),e.hasClass("cp-grid")||e.hasClass("cp-slider"))switch(this.mode){case"wheel":s=k/2-_.x,u=w/2-_.y,l=Math.sqrt(s*s+u*u),f=Math.atan2(u,s),f<0&&(f+=2*Math.PI),l>75&&(l=75,_.x=69-75*Math.cos(f),_.y=69-75*Math.sin(f)),o=(0,c["default"])(l/.75,0,100),i=(0,c["default"])(180*f/Math.PI,0,360),a=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:o,b:100})});break;case"saturation":i=(0,c["default"])(parseInt(_.x*(360/k),10),0,360),o=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),a=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:100,b:a})}),h.find(".cp-grid-inner").css({opacity:o/100});break;case"brightness":i=(0,c["default"])(parseInt(_.x*(360/k),10),0,360),o=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),a=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:o,b:100})}),h.find(".cp-grid-inner").css({opacity:1-a/100});break;default:i=(0,c["default"])(360-parseInt(b.y*(360/S),10),0,360),o=(0,c["default"])(Math.floor(_.x*(100/k)),0,100),a=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),h.css({backgroundColor:(0,d.hsb2hex)({h:i,s:100,b:100})})}e.hasClass("cp-opacity-slider")&&(this.opacity=parseFloat(1-x.y/E).toFixed(2)),t.val(this.getValue(r)),this.element.trigger("change._grav_colorpicker",[this.element,r,this.opacity])}},{key:"getValue",value:function(t){if(1===this.opacity)return t;var e=(0,d.hex2rgb)(t);return"rgba("+e.r+", "+e.g+", "+e.b+", "+this.opacity+")"}},{key:"bound",value:function e(t){var e=this._bound||(this._bound={});return e[t]||(e[t]=(0,f["default"])(this[t],this))}}]),t}();e["default"]=_;e.Instance=new _("[data-grav-colorpicker]")},function(t,e){function n(t,e,n){return tn?n:t}t.exports=n},function(t,e,n){function r(t,e,n){var r=i(arguments,2);return function(){return t.apply(e,r.concat(i(arguments)))}}var i=n(513);t.exports=r},function(t,e){function n(t,e,n){var r=t.length;e=null==e?0:e<0?Math.max(r+e,0):Math.min(e,r),n=null==n?r:n<0?Math.max(r+n,0):Math.min(n,r);for(var i=[];e-1?t.substring(1):t,16),{r:t>>16,g:(65280&t)>>8,b:255&t}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(1),o=r(i),a=n(321),s=r(a);(0,o["default"])("body").on("change",'.form-input-file > input[type="file"]',function(t){var e=t.target,n=e.files,r=(0,o["default"])(e).next();if(n.length){var i=n.length>1?"s":"",a="";a+=n.length+" file"+i+" selected",a+="
    ";for(var u=0;u"+n[u].name+" ("+(0,s["default"])(n[u].size,2)+")";a+="
",r.html(a)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n div > [data-grav-array-type="row"]'),n=e.find('[name]:not([name=""])');n.each(function(t,e){e=(0,s["default"])(e);var n=e.attr("name");n=n.replace(/\[\d+\]$/,"["+t+"]"),e.attr("name",n)}),n.length||e.find('[data-grav-array-type="value"]').attr("name",t.getName())}}},{key:"getIndexFor",value:function(t){var e=t.data("array-template"),n=t.closest('[data-grav-array-type="row"]');return e.container.find((e.isValueOnly()?"> div ":"")+' > [data-grav-array-type="row"]').index(n)}},{key:"_setTemplate",value:function(t){t.data("array-template")||t.data("array-template",new c(t.closest("[data-grav-array-name]")))}}]),t}();e["default"]=l;e.Instance=new l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n .collection-actions [data-action="add"]',function(t){return e.addItem(t)}),t.on("click",'> ul > li > .item-actions [data-action="delete"]',function(t){return e.removeItem(t)}),t.on("click",'> .collection-actions [data-action-sort="date"]',function(t){return e.sortItems(t)}),t.on("input","[data-key-observe]",function(t){return e.observeKey(t)}),t.find("[data-collection-holder]").each(function(t,n){n=(0,s["default"])(n),n.data("collection-sort")||n[0].hasAttribute("data-collection-nosort")||n.data("collection-sort",new c["default"](n.get(0),{forceFallback:!1,animation:150,filter:".CodeMirror, .grav-editor-resizer",onUpdate:function(){return e.reindex(n)}}))})}},{key:"addItem",value:function(t){var e=(0,s["default"])(t.currentTarget),n=e.data("action-add")||"bottom",r=(0,s["default"])(e.closest('[data-type="collection"]')),i=(0,s["default"])(r.find('> [data-collection-template="new"]').data("collection-template-html"));r.find("> [data-collection-holder]")["top"===n?"prepend":"append"](i),this.reindex(r);var o=r.closest('[data-type="collection"]').find("> ul > [data-collection-item]"),a=r.closest('[data-type="collection"]').find('[data-action-add="top"]'),u=r.closest('[data-type="collection"]').find('[data-action="sort"]');o.length&&(a.length&&a.parent().removeClass("hidden"),u.length&&o.length>1&&u.removeClass("hidden")),(0,s["default"])('[data-grav-field="toggleable"] input[type="checkbox"]').trigger("change")}},{key:"removeItem",value:function(t){var e=(0,s["default"])(t.currentTarget),n=e.closest("[data-collection-item]"),r=(0,s["default"])(e.closest('[data-type="collection"]'));n.remove(),this.reindex(r);var i=r.closest('[data-type="collection"]').find("> ul > [data-collection-item]"),o=r.closest('[data-type="collection"]').find('[data-action-add="top"]'),a=r.closest('[data-type="collection"]').find('[data-action="sort"]');i.length||o.length&&o.parent().addClass("hidden"),a.length&&i.length<=1&&a.addClass("hidden")}},{key:"sortItems",value:function(t){var e=(0,s["default"])(t.currentTarget),n=e.data("action-sort"),r=e.data("action-sort-dir")||"asc",i=(0,s["default"])(e.closest('[data-type="collection"]')),o=i.closest('[data-type="collection"]').find("> ul > [data-collection-item]");o.sort(function(t,e){var i=(0,s["default"])(t).find('[name$="['+n+']"]'),o=(0,s["default"])(e).find('[name$="['+n+']"]'),a=void 0;return a="asc"==r?i.val()o.val()?1:0:i.val()>o.val()?-1:i.val() ul > [data-collection-item]"),e.each(function(t,e){e=(0,s["default"])(e);var n=e.find("[data-key-observe]"),r=n.val(),i=n.length,o=e.data("collection-key-backup");e.attr("data-collection-key",i?r:t),["name","data-grav-field-name","for","id"].forEach(function(t){e.find("["+t+"], [_"+t+"]").each(function(){var e=(0,s["default"])(this),n=[],a=[new RegExp("\\[(\\d+|\\*|"+o+")\\]","g"),new RegExp("\\.(\\d+|\\*|"+o+")\\.","g")];if(i&&!r)return e.attr("_"+t,e.attr(t)),void e.attr(t,null);e.attr("_"+t)&&(e.attr(t,e.attr("_"+t)),e.attr("_"+t,null)),e.parents("[data-collection-key]").map(function(t,e){return n.push((0,s["default"])(e).attr("data-collection-key"))}),n.reverse();var u=e.attr(t).replace(a[0],function(){return"["+(n.shift()||o)+"]"});u=u.replace(a[1],function(){return"."+n.shift()+"."}),e.attr(t,u)})})}),e.find('input[type="radio"][checked]').each(function(t,e){e.checked=!0})}},{key:"_onAddedNodes",value:function(t,e){var n=this,r=(0,s["default"])(e).find('[data-type="collection"]');r.length&&r.each(function(t,e){e=(0,s["default"])(e),~n.lists.index(e)||n.addList(e)})}}]),t}();e["default"]=l;e.Instance=new l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n-1,p=(0,s["default"])("body"),m="mousedown touchstart MSPointerDown pointerdown",v="mousemove touchmove MSPointerMove pointermove",g="mouseup touchend MSPointerUp pointerup",y=h?"focus":"focusin",_=function(){function t(e){var n=this;i(this,t),this.selector=e,this.field=(0,s["default"])(this.selector),this.options=Object.assign({},this.field.data("grav-colorpicker")),this.built=!1,this.attach(),this.options.update&&this.field.on("change._grav_colorpicker",function(t,e,r,i){var o=r,a=(0,d.hex2rgb)(r);i<1&&(o="rgba("+a.r+", "+a.g+", "+a.b+", "+i+")");var s=e.closest(n.options.update);s.length||(s=e.siblings(n.options.update)),s.length||(s=e.parent(".g-colorpicker").find(n.options.update)),s.css({backgroundColor:o})})}return o(t,[{key:"attach",value:function(){var t=this;p.on(y,this.selector,function(e){return t.show(e,e.currentTarget)}),p.on(m,".g-colorpicker, .g-colorpicker i",this.bound("iconClick")),p.on("keydown",this.selector,function(e){switch(e.keyCode){case 9:t.hide();break;case 13:case 27:t.hide(),e.currentTarget.blur()}return!0}),p.on("keyup",this.selector,function(e){return t.updateFromInput(!0,e.currentTarget),!0}),p.on("paste",this.selector,function(e){setTimeout(function(){return t.updateFromInput(!0,e.currentTarget)},1)})}},{key:"show",value:function(t,e){e=(0,s["default"])(e),this.built||this.build(),this.element=e,this.reposition(),this.wrapper.addClass("cp-visible"),this.updateFromInput();var n=(0,s["default"])("#admin-main .content-wrapper").data("scrollbar").getViewElement();this.wrapper.on(m,".cp-grid, .cp-slider, .cp-opacity-slider",this.bound("bodyDown")),p.on(v,this.bound("bodyMove")),p.on(m,this.bound("bodyClick")),p.on(g,this.bound("targetReset")),(0,s["default"])(n).on("scroll",this.bound("reposition"))}},{key:"hide",value:function(){if(this.built){this.wrapper.removeClass("cp-visible");var t=(0,s["default"])("#admin-main .content-wrapper").data("scrollbar").getViewElement();this.wrapper.undelegate(m,".cp-grid, .cp-slider, .cp-opacity-slider",this.bound("bodyDown")),p.off(v,this.bound("bodyMove")),p.off(m,this.bound("bodyClick")),p.off(g,this.bound("targetReset")),(0,s["default"])(t).off("scroll",this.bound("reposition"))}}},{key:"build",value:function(){var t=this;this.wrapper=(0,s["default"])('
'),this.slider=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')),this.opacitySlider=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')),this.grid=(0,s["default"])('
').appendTo(this.wrapper).append((0,s["default"])('
')).append((0,s["default"])('
')),(0,s["default"])("
").appendTo(this.grid.find(".cp-picker"));var e=(0,s["default"])('
').appendTo(this.wrapper);this.tabs={hue:(0,s["default"])('
').text("HUE").appendTo(e),brightness:(0,s["default"])('
').text("BRI").appendTo(e),saturation:(0,s["default"])('
').text("SAT").appendTo(e),wheel:(0,s["default"])('
').text("WHEEL").appendTo(e),transparent:(0,s["default"])('
').text("TRANSPARENT").appendTo(e)},e.on(m,"> div",function(n){var r=(0,s["default"])(n.currentTarget);if(r.is(t.tabs.transparent)){var i=t.opacitySlider.height();return t.opacity=0,t.opacitySlider.find(".cp-picker").css({top:(0,c["default"])(i-i*t.opacity,0,i)}),void t.move(t.opacitySlider,{manualOpacity:!0})}var o=e.find(".active"),a=o.attr("class").replace(/\s|active|cp-tab-/g,""),u=r.attr("class").replace(/\s|active|cp-tab-/g,"");t.wrapper.removeClass("cp-mode-"+a).addClass("cp-mode-"+u),o.removeClass("active"),r.addClass("active"),t.mode=u,t.updateFromInput()}),this.wrapper.appendTo(".content-wrapper"),this.built=!0,this.mode="hue"}},{key:"reposition",value:function(){var t=(0,s["default"])(".content-wrapper")[0],e=this.element[0].getBoundingClientRect(),n=t.getBoundingClientRect(),r={x:0,y:0};this.options.offset&&(r.x=this.options.offset.x||0,r.y=this.options.offset.y||0),this.wrapper.css({top:e.top+e.height+t.scrollTop-n.top+r.y,left:e.left+t.scrollLeft-n.left+r.x})}},{key:"iconClick",value:function(t){if(this.wrapper&&this.wrapper.hasClass("cp-visible"))return!0;t&&t.preventDefault();var e=(0,s["default"])(t.currentTarget).find("input");setTimeout(function(){return e.focus()},50)}},{key:"bodyMove",value:function(t){t&&t.preventDefault(),this.target&&this.move(this.target,t)}},{key:"bodyClick",value:function(t){var e=(0,s["default"])(t.target);e.closest(".cp-wrapper").length||e.is(this.selector)||this.hide()}},{key:"bodyDown",value:function(t){t&&t.preventDefault(),this.target=(0,s["default"])(t.currentTarget),this.move(this.target,t,!0)}},{key:"targetReset",value:function(t){t&&t.preventDefault(),this.target=null}},{key:"move",value:function(t,e){var n=this.element,r=t.find(".cp-picker"),i=t[0].getBoundingClientRect(),o=i.left+window.scrollX,a=i.top+window.scrollY,s=Math.round((e?e.pageX:0)-o),u=Math.round((e?e.pageY:0)-a),c=void 0,l=void 0,f=void 0,d=void 0,h=e.changedTouches||e.originalEvent&&e.originalEvent.changedTouches;e&&h&&(s=(h?h[0].pageX:0)-o,u=(h?h[0].pageY:0)-a),e&&e.manualOpacity&&(u=i.height),s<0&&(s=0),u<0&&(u=0),s>i.width&&(s=i.width),u>i.height&&(u=i.height),t.parent(".cp-mode-wheel").length&&r.parent(".cp-grid").length&&(c=75-s,l=75-u,f=Math.sqrt(c*c+l*l),d=Math.atan2(l,c),d<0&&(d+=2*Math.PI),f>75&&(s=75-75*Math.cos(d),u=75-75*Math.sin(d)),s=Math.round(s),u=Math.round(u)),t.hasClass("cp-grid")?(r.css({top:u,left:s}),this.updateFromPicker(n,t)):(r.css({top:u}),this.updateFromPicker(n,t))}},{key:"updateFromInput",value:function(t,e){e=e?(0,s["default"])(e):this.element;var n=e.val(),r=n.replace(/\s/g,"").match(/^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/),i=void 0,o=void 0;if(n=(0,d.rgbstr2hex)(n)||n,r=r?(0,c["default"])(r[1],0,1):1,(i=(0,d.parseHex)(n))||(i="#ffffff"),o=(0,d.hex2hsb)(i),this.built){this.opacity=r;var a=this.opacitySlider.height();this.opacitySlider.find(".cp-picker").css({top:(0,c["default"])(a-a*this.opacity,0,a)});var u=this.grid.height(),l=this.grid.width(),f=void 0,h=void 0,p=void 0,m=void 0;switch(a=this.slider.height(),this.mode){case"wheel":f=(0,c["default"])(Math.ceil(.75*o.s),0,u/2),h=o.h*Math.PI/180,p=(0,c["default"])(75-Math.cos(h)*f,0,l),m=(0,c["default"])(75-Math.sin(h)*f,0,u),this.grid.css({backgroundColor:"transparent"}).find(".cp-picker").css({top:m,left:p}),m=150-o.b/(100/u),""===i&&(m=0),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:o.s,b:100})});break;case"saturation":p=(0,c["default"])(5*o.h/12,0,150),m=(0,c["default"])(u-Math.ceil(o.b/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.s*(a/100),0,a),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:100,b:o.b})}),this.grid.find(".cp-grid-inner").css({opacity:o.s/100});break;case"brightness":p=(0,c["default"])(5*o.h/12,0,150),m=(0,c["default"])(u-Math.ceil(o.s/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.b*(a/100),0,a),this.slider.find(".cp-picker").css({top:m}),this.slider.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:o.s,b:100})}),this.grid.find(".cp-grid-inner").css({opacity:1-o.b/100});break;case"hue":default:p=(0,c["default"])(Math.ceil(o.s/(100/l)),0,l),m=(0,c["default"])(u-Math.ceil(o.b/(100/u)),0,u),this.grid.find(".cp-picker").css({top:m,left:p}),m=(0,c["default"])(a-o.h/(360/a),0,a),this.slider.find(".cp-picker").css({top:m}),this.grid.css({backgroundColor:(0,d.hsb2hex)({h:o.h,s:100,b:100})})}}t||e.val(this.getValue(i)),(this.element||e).trigger("change._grav_colorpicker",[e,i,r])}},{key:"updateFromPicker",value:function(t,e){var n=function(t,e){var n,r;return t.length&&e?(n=t[0].getBoundingClientRect().left,r=t[0].getBoundingClientRect().top,{x:n-e[0].getBoundingClientRect().left+t[0].offsetWidth/2,y:r-e[0].getBoundingClientRect().top+t[0].offsetHeight/2}):null},r=void 0,i=void 0,o=void 0,a=void 0,s=void 0,u=void 0,l=void 0,f=void 0,h=this.wrapper.find(".cp-grid"),p=this.wrapper.find(".cp-slider"),m=this.wrapper.find(".cp-opacity-slider"),v=h.find(".cp-picker"),g=p.find(".cp-picker"),y=m.find(".cp-picker"),_=n(v,h),b=n(g,p),x=n(y,m),k=h[0].getBoundingClientRect().width,w=h[0].getBoundingClientRect().height,S=p[0].getBoundingClientRect().height,E=m[0].getBoundingClientRect().height,A=this.element.val();if(A=(0,d.rgbstr2hex)(A)||A,(r=(0,d.parseHex)(A))||(r="#ffffff"),e.hasClass("cp-grid")||e.hasClass("cp-slider"))switch(this.mode){case"wheel":s=k/2-_.x,u=w/2-_.y,l=Math.sqrt(s*s+u*u),f=Math.atan2(u,s),f<0&&(f+=2*Math.PI),l>75&&(l=75,_.x=69-75*Math.cos(f),_.y=69-75*Math.sin(f)),o=(0,c["default"])(l/.75,0,100),i=(0,c["default"])(180*f/Math.PI,0,360),a=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:o,b:100})});break;case"saturation":i=(0,c["default"])(parseInt(_.x*(360/k),10),0,360),o=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),a=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:100,b:a})}),h.find(".cp-grid-inner").css({opacity:o/100});break;case"brightness":i=(0,c["default"])(parseInt(_.x*(360/k),10),0,360),o=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),a=(0,c["default"])(100-Math.floor(b.y*(100/S)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),p.css({backgroundColor:(0,d.hsb2hex)({h:i,s:o,b:100})}),h.find(".cp-grid-inner").css({opacity:1-a/100});break;default:i=(0,c["default"])(360-parseInt(b.y*(360/S),10),0,360),o=(0,c["default"])(Math.floor(_.x*(100/k)),0,100),a=(0,c["default"])(100-Math.floor(_.y*(100/w)),0,100),r=(0,d.hsb2hex)({h:i,s:o,b:a}),h.css({backgroundColor:(0,d.hsb2hex)({h:i,s:100,b:100})})}e.hasClass("cp-opacity-slider")&&(this.opacity=parseFloat(1-x.y/E).toFixed(2)),t.val(this.getValue(r)),this.element.trigger("change._grav_colorpicker",[this.element,r,this.opacity])}},{key:"getValue",value:function(t){if(1===this.opacity)return t;var e=(0,d.hex2rgb)(t);return"rgba("+e.r+", "+e.g+", "+e.b+", "+this.opacity+")"}},{key:"bound",value:function e(t){var e=this._bound||(this._bound={});return e[t]||(e[t]=(0,f["default"])(this[t],this))}}]),t}();e["default"]=_;e.Instance=new _("[data-grav-colorpicker]")},function(t,e){function n(t,e,n){return tn?n:t}t.exports=n},function(t,e,n){function r(t,e,n){var r=i(arguments,2);return function(){return t.apply(e,r.concat(i(arguments)))}}var i=n(513);t.exports=r},function(t,e){function n(t,e,n){var r=t.length;e=null==e?0:e<0?Math.max(r+e,0):Math.min(e,r),n=null==n?r:n<0?Math.max(r+n,0):Math.min(n,r);for(var i=[];e-1?t.substring(1):t,16),{r:t>>16,g:(65280&t)>>8,b:255&t}}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(1),o=r(i),a=n(321),s=r(a);(0,o["default"])("body").on("change",'.form-input-file > input[type="file"]',function(t){var e=t.target,n=e.files,r=(0,o["default"])(e).next();if(n.length){var i=n.length>1?"s":"",a="";a+=n.length+" file"+i+" selected",a+="
    ";for(var u=0;u"+n[u].name+" ("+(0,s["default"])(n[u].size,2)+")";a+="
",r.html(a)}})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Instance=void 0;var o=function(){function t(t,e){for(var n=0;n {% if fieldControls in ['top', 'both'] %}
+ {% if field.sortby %} + + {% endif %}
@@ -90,6 +95,10 @@ {% if fieldControls in ['bottom', 'both'] %}
+ {% if field.sortby %} + + {% endif %}