decap-cms-backend-bitbucket 3.3.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.5.0](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-bitbucket@3.4.0...decap-cms-backend-bitbucket@3.5.0) (2026-06-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ - remove unused dependencies and specify missing dependencies ([#7833](https://github.com/decaporg/decap-cms/issues/7833)) ([e324a14](https://github.com/decaporg/decap-cms/commit/e324a142f7f0ba63c760b2e8524d971c35200f87))
11
+
12
+ # [3.4.0](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-bitbucket@3.3.1...decap-cms-backend-bitbucket@3.4.0) (2026-06-01)
13
+
14
+ **Note:** Version bump only for package decap-cms-backend-bitbucket
15
+
6
16
  ## [3.3.1](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-bitbucket@3.3.0...decap-cms-backend-bitbucket@3.3.1) (2026-02-23)
7
17
 
8
18
  ### Bug Fixes
@@ -1,14 +1,14 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("decap-cms-lib-util"),require("decap-cms-lib-auth"),require("@emotion/react"),require("react"),require("prop-types"),require("decap-cms-ui-default")):"function"==typeof define&&define.amd?define("DecapCmsBackendBitbucket",["decap-cms-lib-util","decap-cms-lib-auth","@emotion/react","react","prop-types","decap-cms-ui-default"],t):"object"==typeof exports?exports.DecapCmsBackendBitbucket=t(require("decap-cms-lib-util"),require("decap-cms-lib-auth"),require("@emotion/react"),require("react"),require("prop-types"),require("decap-cms-ui-default")):e.DecapCmsBackendBitbucket=t(e.DecapCmsLibUtil,e.DecapCmsLibAuth,e.DecapCmsDefaultExports.EmotionCore,e.React,e.DecapCmsDefaultExports.PropTypes,e.DecapCmsUiDefault)}(window,(e,t,r,n,s,i)=>(()=>{var o={9986(e){"use strict";function t(e,t,s){e instanceof RegExp&&(e=r(e,s)),t instanceof RegExp&&(t=r(t,s));var i=n(e,t,s);return i&&{start:i[0],end:i[1],pre:s.slice(0,i[0]),body:s.slice(i[0]+e.length,i[1]),post:s.slice(i[1]+t.length)}}function r(e,t){var r=t.match(e);return r?r[0]:null}function n(e,t,r){var n,s,i,o,a,u=r.indexOf(e),l=r.indexOf(t,u+1),c=u;if(u>=0&&l>0){if(e===t)return[u,l];for(n=[],i=r.length;c>=0&&!a;)c==u?(n.push(c),u=r.indexOf(e,c+1)):1==n.length?a=[n.pop(),l]:((s=n.pop())<i&&(i=s,o=l),l=r.indexOf(t,c+1)),c=u<l&&u>=0?u:l;n.length&&(a=[i,o])}return a}e.exports=t,t.range=n},5098(e,t,r){var n=r(3305),s=r(9361),i=r(1112),o=r(5276),a=r(7452);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=o,u.prototype.set=a,e.exports=u},7553(e,t,r){var n=r(9747),s=r(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=n(s.prototype),i.prototype.constructor=i,e.exports=i},1386(e,t,r){var n=r(2393),s=r(2049),i=r(7144),o=r(5071),a=r(3964);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=o,u.prototype.set=a,e.exports=u},528(e,t,r){var n=r(9747),s=r(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=n(s.prototype),i.prototype.constructor=i,e.exports=i},9770(e,t,r){var n=r(4715)(r(8942),"Map");e.exports=n},8250(e,t,r){var n=r(9753),s=r(5681),i=r(88),o=r(4732),a=r(9068);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=o,u.prototype.set=a,e.exports=u},5650(e,t,r){var n=r(8942).Symbol;e.exports=n},9270(e,t,r){var n=r(4715)(r(8942),"WeakMap");e.exports=n},6912(e){e.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},5111(e){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}},1129(e){e.exports=function(e,t){for(var r=-1,n=t.length,s=e.length;++r<n;)e[s+r]=t[r];return e}},2837(e){e.exports=function(e){return e.split("")}},7034(e,t,r){var n=r(6285);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},9747(e,t,r){var n=r(1580),s=Object.create,i=function(){function e(){}return function(t){if(!n(t))return{};if(s)return s(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=i},7250(e){e.exports=function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}},313(e,t,r){var n=r(1129),s=r(714);e.exports=function e(t,r,i,o,a){var u=-1,l=t.length;for(i||(i=s),a||(a=[]);++u<l;){var c=t[u];r>0&&i(c)?r>1?e(c,r-1,i,o,a):n(a,c):o||(a[a.length]=c)}return a}},7923(e,t,r){var n=r(3526),s=r(6040);e.exports=function(e,t){for(var r=0,i=(t=n(t,e)).length;null!=e&&r<i;)e=e[s(t[r++])];return r&&r==i?e:void 0}},7379(e,t,r){var n=r(5650),s=r(8870),i=r(9005),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?s(e):i(e)}},2478(e,t,r){var n=r(7250),s=r(9454),i=r(7706);e.exports=function(e,t,r){return t==t?i(e,t,r):n(e,s,r)}},6027(e,t,r){var n=r(7379),s=r(547);e.exports=function(e){return s(e)&&"[object Arguments]"==n(e)}},9454(e){e.exports=function(e){return e!=e}},9624(e,t,r){var n=r(3655),s=r(4759),i=r(1580),o=r(4066),a=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,c=u.toString,h=l.hasOwnProperty,p=RegExp("^"+c.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||s(e))&&(n(e)?p:a).test(o(e))}},5962(e){e.exports=function(){}},7403(e,t,r){var n=r(2619),s=r(2532),i=r(2053),o=s?function(e,t){return s(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i;e.exports=o},3501(e){e.exports=function(e,t,r){var n=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(r=r>s?s:r)<0&&(r+=s),s=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(s);++n<s;)i[n]=e[n+t];return i}},2291(e,t,r){var n=r(5650),s=r(5111),i=r(3142),o=r(1187),a=n?n.prototype:void 0,u=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return s(t,e)+"";if(o(t))return u?u.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},3526(e,t,r){var n=r(3142),s=r(5187),i=r(6493),o=r(5243);e.exports=function(e,t){return n(e)?e:s(e,t)?[e]:i(o(e))}},8931(e,t,r){var n=r(3501);e.exports=function(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:n(e,t,r)}},7905(e,t,r){var n=r(2478);e.exports=function(e,t){for(var r=-1,s=e.length;++r<s&&n(t,e[r],0)>-1;);return r}},4354(e){e.exports=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}},1950(e,t,r){var n=r(8942)["__core-js_shared__"];e.exports=n},1942(e,t,r){var n=r(528),s=r(1439),i=r(5196),o=r(961),a=r(3142),u=r(6648);e.exports=function(e){return s(function(t){var r=t.length,s=r,l=n.prototype.thru;for(e&&t.reverse();s--;){var c=t[s];if("function"!=typeof c)throw new TypeError("Expected a function");if(l&&!h&&"wrapper"==o(c))var h=new n([],!0)}for(s=h?s:r;++s<r;){c=t[s];var p=o(c),f="wrapper"==p?i(c):void 0;h=f&&u(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?h[o(f[0])].apply(h,f[3]):1==c.length&&u(c)?h[p]():h.thru(c)}return function(){var e=arguments,n=e[0];if(h&&1==e.length&&a(n))return h.plant(n).value();for(var s=0,i=r?t[s].apply(this,e):n;++s<r;)i=t[s].call(this,i);return i}})}},2532(e,t,r){var n=r(4715),s=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=s},1439(e,t,r){var n=r(5857),s=r(5234),i=r(796);e.exports=function(e){return i(s(e,void 0,n),e+"")}},4967(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},5196(e,t,r){var n=r(6065),s=r(9071),i=n?function(e){return n.get(e)}:s;e.exports=i},961(e,t,r){var n=r(3476),s=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",r=n[t],i=s.call(n,t)?r.length:0;i--;){var o=r[i],a=o.func;if(null==a||a==e)return o.name}return t}},4700(e,t,r){var n=r(9067);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},4715(e,t,r){var n=r(9624),s=r(155);e.exports=function(e,t){var r=s(e,t);return n(r)?r:void 0}},8870(e,t,r){var n=r(5650),s=Object.prototype,i=s.hasOwnProperty,o=s.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var s=o.call(e);return n&&(t?e[a]=r:delete e[a]),s}},155(e){e.exports=function(e,t){return null==e?void 0:e[t]}},3417(e){var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},3305(e,t,r){var n=r(4497);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},9361(e){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},1112(e,t,r){var n=r(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return s.call(t,e)?t[e]:void 0}},5276(e,t,r){var n=r(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:s.call(t,e)}},7452(e,t,r){var n=r(4497);e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},714(e,t,r){var n=r(5650),s=r(3283),i=r(3142),o=n?n.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||s(e)||!!(o&&e&&e[o])}},5187(e,t,r){var n=r(3142),s=r(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!s(e))||o.test(e)||!i.test(e)||null!=t&&e in Object(t)}},9067(e){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},6648(e,t,r){var n=r(7553),s=r(5196),i=r(961),o=r(3321);e.exports=function(e){var t=i(e),r=o[t];if("function"!=typeof r||!(t in n.prototype))return!1;if(e===r)return!0;var a=s(r);return!!a&&e===a[0]}},4759(e,t,r){var n,s=r(1950),i=(n=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},2393(e){e.exports=function(){this.__data__=[],this.size=0}},2049(e,t,r){var n=r(7034),s=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0||(r==t.length-1?t.pop():s.call(t,r,1),--this.size,0))}},7144(e,t,r){var n=r(7034);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},5071(e,t,r){var n=r(7034);e.exports=function(e){return n(this.__data__,e)>-1}},3964(e,t,r){var n=r(7034);e.exports=function(e,t){var r=this.__data__,s=n(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this}},9753(e,t,r){var n=r(5098),s=r(1386),i=r(9770);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||s),string:new n}}},5681(e,t,r){var n=r(4700);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},88(e,t,r){var n=r(4700);e.exports=function(e){return n(this,e).get(e)}},4732(e,t,r){var n=r(4700);e.exports=function(e){return n(this,e).has(e)}},9068(e,t,r){var n=r(4700);e.exports=function(e,t){var r=n(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this}},6853(e,t,r){var n=r(9011);e.exports=function(e){var t=n(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}},6065(e,t,r){var n=r(9270),s=n&&new n;e.exports=s},4497(e,t,r){var n=r(4715)(Object,"create");e.exports=n},9005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5234(e,t,r){var n=r(6912),s=Math.max;e.exports=function(e,t,r){return t=s(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,a=s(i.length-t,0),u=Array(a);++o<a;)u[o]=i[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=i[o];return l[t]=r(u),n(e,this,l)}}},3476(e){e.exports={}},8942(e,t,r){var n=r(4967),s="object"==typeof self&&self&&self.Object===Object&&self,i=n||s||Function("return this")();e.exports=i},796(e,t,r){var n=r(7403),s=r(3316)(n);e.exports=s},3316(e){var t=Date.now;e.exports=function(e){var r=0,n=0;return function(){var s=t(),i=16-(s-n);if(n=s,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}},7706(e){e.exports=function(e,t,r){for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}},2237(e,t,r){var n=r(2837),s=r(3417),i=r(2013);e.exports=function(e){return s(e)?i(e):n(e)}},6493(e,t,r){var n=r(6853),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(s,function(e,r,n,s){t.push(n?s.replace(i,"$1"):r||e)}),t});e.exports=o},6040(e,t,r){var n=r(1187);e.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},4066(e){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},2013(e){var t="\\ud800-\\udfff",r="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",s="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+s+")?",l="[\\ufe0e\\ufe0f]?",c=l+u+"(?:\\u200d(?:"+[i,o,a].join("|")+")"+l+u+")*",h="(?:"+[i+n+"?",n,o,a,r].join("|")+")",p=RegExp(s+"(?="+s+")|"+h+c,"g");e.exports=function(e){return e.match(p)||[]}},3410(e,t,r){var n=r(7553),s=r(528),i=r(4354);e.exports=function(e){if(e instanceof n)return e.clone();var t=new s(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},2619(e){e.exports=function(e){return function(){return e}}},6285(e){e.exports=function(e,t){return e===t||e!=e&&t!=t}},5857(e,t,r){var n=r(313);e.exports=function(e){return null!=e&&e.length?n(e,1):[]}},2879(e,t,r){var n=r(1942)();e.exports=n},6123(e,t,r){var n=r(7923);e.exports=function(e,t,r){var s=null==e?void 0:n(e,t);return void 0===s?r:s}},2053(e){e.exports=function(e){return e}},3283(e,t,r){var n=r(6027),s=r(547),i=Object.prototype,o=i.hasOwnProperty,a=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return s(e)&&o.call(e,"callee")&&!a.call(e,"callee")};e.exports=u},3142(e){var t=Array.isArray;e.exports=t},3655(e,t,r){var n=r(7379),s=r(1580);e.exports=function(e){if(!s(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1187(e,t,r){var n=r(7379),s=r(547);e.exports=function(e){return"symbol"==typeof e||s(e)&&"[object Symbol]"==n(e)}},9011(e,t,r){var n=r(8250);function s(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,s=t?t.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var o=e.apply(this,n);return r.cache=i.set(s,o)||i,o};return r.cache=new(s.Cache||n),r}s.Cache=n,e.exports=s},9071(e){e.exports=function(){}},5243(e,t,r){var n=r(2291);e.exports=function(e){return null==e?"":n(e)}},959(e,t,r){var n=r(2291),s=r(8931),i=r(7905),o=r(2237),a=r(5243),u=/^\s+/;e.exports=function(e,t,r){if((e=a(e))&&(r||void 0===t))return e.replace(u,"");if(!e||!(t=n(t)))return e;var l=o(e),c=i(l,o(t));return s(l,c).join("")}},3321(e,t,r){var n=r(7553),s=r(528),i=r(5962),o=r(3142),a=r(547),u=r(3410),l=Object.prototype.hasOwnProperty;function c(e){if(a(e)&&!o(e)&&!(e instanceof n)){if(e instanceof s)return e;if(l.call(e,"__wrapped__"))return u(e)}return new s(e)}c.prototype=i.prototype,c.prototype.constructor=c,e.exports=c},9942(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",s=0,i=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===o);else if(i!==a-1&&2===o){if(n.length<2||2!==s||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",s=0):s=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),i=a,o=0;continue}}else if(2===n.length||1===n.length){n="",s=0,i=a,o=0;continue}t&&(n.length>0?n+="/..":n="..",s=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),s=a-i-1;i=a,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var n={resolve:function(){for(var e,n="",s=!1,i=arguments.length-1;i>=-1&&!s;i--){var o;i>=0?o=arguments[i]:(void 0===e&&(e=process.cwd()),o=e),t(o),0!==o.length&&(n=o+"/"+n,s=47===o.charCodeAt(0))}return n=r(n,!s),s?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),s=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&s&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var s=arguments[r];t(s),s.length>0&&(void 0===e?e=s:e+="/"+s)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var s=1;s<e.length&&47===e.charCodeAt(s);++s);for(var i=e.length,o=i-s,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var u=r.length-a,l=o<u?o:u,c=-1,h=0;h<=l;++h){if(h===l){if(u>l){if(47===r.charCodeAt(a+h))return r.slice(a+h+1);if(0===h)return r.slice(a+h)}else o>l&&(47===e.charCodeAt(s+h)?c=h:0===h&&(c=0));break}var p=e.charCodeAt(s+h);if(p!==r.charCodeAt(a+h))break;47===p&&(c=h)}var f="";for(h=s+c+1;h<=i;++h)h!==i&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(a+c):(a+=c,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,s=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!i){s=o;break}}else i=!1;return-1===s?n?"/":".":n&&1===s?"//":e.slice(0,s)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,s=0,i=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!o){s=n+1;break}}else-1===u&&(o=!1,u=n+1),a>=0&&(l===r.charCodeAt(a)?-1===--a&&(i=n):(a=-1,i=u))}return s===i?i=u:-1===i&&(i=e.length),e.slice(s,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){s=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":e.slice(s,i)},extname:function(e){t(e);for(var r=-1,n=0,s=-1,i=!0,o=0,a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(47!==u)-1===s&&(i=!1,s=a+1),46===u?-1===r?r=a:1!==o&&(o=1):-1!==r&&(o=-1);else if(!i){n=a+1;break}}return-1===r||-1===s||0===o||1===o&&r===s-1&&r===n+1?"":e.slice(r,s)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,s=e.charCodeAt(0),i=47===s;i?(r.root="/",n=1):n=0;for(var o=-1,a=0,u=-1,l=!0,c=e.length-1,h=0;c>=n;--c)if(47!==(s=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===s?-1===o?o=c:1!==h&&(h=1):-1!==o&&(h=-1);else if(!l){a=c+1;break}return-1===o||-1===u||0===h||1===h&&o===u-1&&o===a+1?-1!==u&&(r.base=r.name=0===a&&i?e.slice(1,u):e.slice(a,u)):(0===a&&i?(r.name=e.slice(1,o),r.base=e.slice(1,u)):(r.name=e.slice(a,o),r.base=e.slice(a,u)),r.ext=e.slice(o,u)),a>0?r.dir=e.slice(0,a-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n},3554(e){!function(){"use strict";var t=function(e){setTimeout(e,0)};"undefined"!=typeof process&&process&&"function"==typeof process.nextTick&&(t=process.nextTick),e.exports=function(e){var r={capacity:e||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===r.firstHere){r.current++,r.firstHere=!0;var e=1}else e=0;var t={n:1};"function"==typeof arguments[0]?t.task=arguments[0]:t.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?t.task=arguments[1]:t.n=arguments[1]);var n=t.task;if(t.task=function(){n(r.leave)},r.current+t.n-e>r.capacity)return 1===e&&(r.current--,r.firstHere=!1),r.queue.push(t);r.current+=t.n-e,t.task(r.leave),1===e&&(r.firstHere=!1)},leave:function(e){if(e=e||1,r.current-=e,r.queue.length){var n=r.queue[0];n.n+r.current>r.capacity||(r.queue.shift(),r.current+=n.n,t(n.task))}else if(r.current<0)throw new Error("leave called too many times.")},available:function(e){return e=e||1,r.current+e<=r.capacity}};return r}}()},7330(e,t,r){var n=r(3063);e.exports={parse:function(e){return n.parse(e.toString())}}},3063(e){"use strict";function t(e,r,n,s){this.message=e,this.expected=r,this.found=n,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}!function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(t,Error),t.buildMessage=function(e,t){var r={literal:function(e){return'"'+s(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?i(e.parts[t][0])+"-"+i(e.parts[t][1]):i(e.parts[t]);return"["+(e.inverted?"^":"")+r+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function s(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function i(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function o(e){return r[e.type](e)}return"Expected "+function(e){var t,r,n=new Array(e.length);for(t=0;t<e.length;t++)n[t]=o(e[t]);if(n.sort(),n.length>0){for(t=1,r=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+function(e){return e?'"'+s(e)+'"':"end of input"}(t)+" found."},e.exports={SyntaxError:t,parse:function(e,r){r=void 0!==r?r:{};var n,s,i,o,a={},u={diffs:at},l=at,c=function(e){return e},h=function(e,t){return kt(e,t,void 0,!0)},p="Binary files ",f=rt("Binary files ",!1),d=function(e,t,r){return kt(e,t,r)},g=function(e){return St(e,void 0,!0)},m=function(e,t,r,n,s,i){return function(e,t,r,n,s,i){const o={oldPath:r,newPath:n,hunks:i?i.hunks:[],status:"copy"===e?"copied":"renamed",similarity:t};return s&&(o.oldMode=s.old_mode,o.newMode=s.new_mode),o}(r.operation,t,r.file,n.file,e||s,i)},b=function(e,t){return St(e,t)},y="diff --cc ",v=rt("diff --cc ",!1),w=function(e){return e},x="* Unmerged path ",_=rt("* Unmerged path ",!1),P=function(e){return St(e)},k=function(e,t){return{hunks:t}},S="--- ",C=rt("--- ",!1),A="+++ ",R=rt("+++ ",!1),E=function(e,t){return{old_file_name:e,new_file_name:t}},O=function(e,t){return Object.assign({},e,{lines:t})},F="@@@ -",L=rt("@@@ -",!1),j=" -",q=rt(" -",!1),M=" +",T=rt(" +",!1),$=" @@@",B=rt(" @@@",!1),U=function(e,t,r,n){return{ourStartLine:e.start,ourLineCount:e.count,theirStartLine:r.start,theirLineCount:r.count,baseStartLine:t.start,baseLineCount:t.count,heading:n?n.trim():""}},N="@@ -",D=rt("@@ -",!1),z=" @@",I=rt(" @@",!1),W=function(e,t,r){return{oldStartLine:e.start,oldLineCount:e.count,newStartLine:t.start,newLineCount:t.count,heading:r?r.trim():""}},H=",",G=rt(",",!1),J=function(e,t){return{start:e,count:t}},K=function(e){return{start:e,count:1}},Y="+",V=rt("+",!1),X="-",Z=rt("-",!1),Q=" ",ee=rt(" ",!1),te="\\",re=rt("\\",!1),ne=function(e){return e.join("")},se="diff ",ie=rt("diff ",!1),oe=function(e,t){return{file_name:t}},ae=function(e){return e.substr(e.length/2+1)},ue="similarity index ",le=rt("similarity index ",!1),ce="%",he=rt("%",!1),pe=function(e){return e},fe=function(e,t){return e||t},de="new",ge=rt("new",!1),me="deleted",be=rt("deleted",!1),ye=" file mode ",ve=rt(" file mode ",!1),we=function(e,t){return"new"===e?{old_mode:null,new_mode:t}:{old_mode:t,new_mode:null}},xe="old mode ",_e=rt("old mode ",!1),Pe="new mode ",ke=rt("new mode ",!1),Se=function(e,t){return{old_mode:e,new_mode:t}},Ce="rename",Ae=rt("rename",!1),Re="copy",Ee=rt("copy",!1),Oe=" from ",Fe=rt(" from ",!1),Le=function(e,t){return{operation:e,file:t}},je=" to ",qe=rt(" to ",!1),Me="index ",Te=rt("index ",!1),$e=function(e){return{old_mode:e,new_mode:e}},Be=(nt([" ","\t"],!1,!1),"\n"),Ue=rt("\n",!1),Ne="\r\n",De=rt("\r\n",!1),ze={type:"any"},Ie=/^[^\r\n]/,We=nt(["\r","\n"],!0,!1),He=/^[^ \t\r\n]/,Ge=nt([" ","\t","\r","\n"],!0,!1),Je=/^[0-9]/,Ke=nt([["0","9"]],!1,!1),Ye=function(e){return parseInt(e.join(""),10)},Ve=0,Xe=[{line:1,column:1}],Ze=0,Qe=[],et=0,tt={};if("startRule"in r){if(!(r.startRule in u))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=u[r.startRule]}function rt(e,t){return{type:"literal",text:e,ignoreCase:t}}function nt(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function st(t){var r,n=Xe[t];if(n)return n;for(r=t-1;!Xe[r];)r--;for(n={line:(n=Xe[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Xe[t]=n,n}function it(e,t){var r=st(e),n=st(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function ot(e){Ve<Ze||(Ve>Ze&&(Ze=Ve,Qe=[]),Qe.push(e))}function at(){var e,t,r,n=35*Ve+0,s=tt[n];if(s)return Ve=s.nextPos,s.result;for(Ve,t=[],r=ut();r!==a;)t.push(r),r=ut();return t!==a&&(t=c(t)),e=t,tt[n]={nextPos:Ve,result:e},e}function ut(){var t,r=35*Ve+1,n=tt[r];return n?(Ve=n.nextPos,n.result):(t=function(){var e,t,r=35*Ve+5,n=tt[r];return n?(Ve=n.nextPos,n.result):(e=Ve,(t=ct())!==a&&vt()!==a&&lt()!==a?e=t=g(t):(Ve=e,e=a),tt[r]={nextPos:Ve,result:e},e)}(),t===a&&(t=function(){var t,r,n,s,i,o,u,l,c=35*Ve+6,h=tt[c];return h?(Ve=h.nextPos,h.result):(t=Ve,r=function(){var t,r,n,s,i,o,u=35*Ve+19,l=tt[u];return l?(Ve=l.nextPos,l.result):(t=Ve,e.substr(Ve,5)===se?(r=se,Ve+=5):(r=a,0===et&&ot(ie)),r!==a&&(n=_t())!==a?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=a,0===et&&ot(ee)),s!==a&&(i=xt())!==a&&(o=wt())!==a?t=r=[r,n,s,i,o]:(Ve=t,t=a)):(Ve=t,t=a),tt[u]={nextPos:Ve,result:t},t)}(),r!==a?((n=yt())===a&&(n=null),n!==a?(s=function(){var t,r,n,s,i=35*Ve+21,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,e.substr(Ve,17)===ue?(r=ue,Ve+=17):(r=a,0===et&&ot(le)),r!==a&&(n=Pt())!==a?(37===e.charCodeAt(Ve)?(s=ce,Ve++):(s=a,0===et&&ot(he)),s!==a&&wt()!==a?t=r=pe(n):(Ve=t,t=a)):(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}(),s!==a?(i=function(){var t,r,n,s,i=35*Ve+25,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,e.substr(Ve,6)===Ce?(r=Ce,Ve+=6):(r=a,0===et&&ot(Ae)),r===a&&(e.substr(Ve,4)===Re?(r=Re,Ve+=4):(r=a,0===et&&ot(Ee))),r!==a?(e.substr(Ve,6)===Oe?(n=Oe,Ve+=6):(n=a,0===et&&ot(Fe)),n!==a&&(s=xt())!==a&&wt()!==a?t=r=Le(r,s):(Ve=t,t=a)):(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}(),i!==a?(o=function(){var t,r,n,s,i=35*Ve+26,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,e.substr(Ve,6)===Ce?(r=Ce,Ve+=6):(r=a,0===et&&ot(Ae)),r===a&&(e.substr(Ve,4)===Re?(r=Re,Ve+=4):(r=a,0===et&&ot(Ee))),r!==a?(e.substr(Ve,4)===je?(n=je,Ve+=4):(n=a,0===et&&ot(qe)),n!==a&&(s=xt())!==a&&wt()!==a?t=r=Le(r,s):(Ve=t,t=a)):(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}(),o!==a?((u=vt())===a&&(u=null),u!==a?((l=lt())===a&&(l=ht()),l===a&&(l=null),l!==a?t=r=m(n,s,i,o,u,l):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a),tt[c]={nextPos:Ve,result:t},t)}(),t===a&&(t=function(){var e,t,r,n=35*Ve+7,s=tt[n];return s?(Ve=s.nextPos,s.result):(e=Ve,(t=ct())!==a&&vt()!==a?((r=ht())===a&&(r=null),r!==a?e=t=b(t,r):(Ve=e,e=a)):(Ve=e,e=a),tt[n]={nextPos:Ve,result:e},e)}(),t===a&&(t=function(){var t,r,n,s=35*Ve+9,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,e.substr(Ve,16)===x?(r=x,Ve+=16):(r=a,0===et&&ot(_)),r!==a&&(n=xt())!==a&&wt()!==a?t=r=P(n):(Ve=t,t=a),tt[s]={nextPos:Ve,result:t},t)}(),t===a&&(t=function(){var e,t,r,n,s=35*Ve+2,i=tt[s];return i?(Ve=i.nextPos,i.result):(e=Ve,(t=mt())!==a?((r=bt())===a&&(r=null),r!==a?((n=pt())===a&&(n=null),n!==a&&lt()!==a?e=t=h(t,r):(Ve=e,e=a)):(Ve=e,e=a)):(Ve=e,e=a),tt[s]={nextPos:Ve,result:e},e)}(),t===a&&(t=function(){var e,t,r,n,s=35*Ve+4,i=tt[s];return i?(Ve=i.nextPos,i.result):(e=Ve,(t=mt())!==a?((r=bt())===a&&(r=null),r!==a?((n=ht())===a&&(n=null),n!==a?e=t=d(t,r,n):(Ve=e,e=a)):(Ve=e,e=a)):(Ve=e,e=a),tt[s]={nextPos:Ve,result:e},e)}()))))),tt[r]={nextPos:Ve,result:t},t)}function lt(){var t,r,n,s,i=35*Ve+3,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,e.substr(Ve,13)===p?(r=p,Ve+=13):(r=a,0===et&&ot(f)),r!==a&&(n=xt())!==a&&(s=wt())!==a?t=r=[r,n,s]:(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}function ct(){var t,r,n,s=35*Ve+8,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,e.substr(Ve,10)===y?(r=y,Ve+=10):(r=a,0===et&&ot(v)),r!==a&&(n=xt())!==a&&wt()!==a?t=r=w(n):(Ve=t,t=a),tt[s]={nextPos:Ve,result:t},t)}function ht(){var e,t,r,n,s=35*Ve+10,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(e=Ve,(t=pt())!==a){for(r=[],n=ft();n!==a;)r.push(n),n=ft();r!==a?e=t=k(t,r):(Ve=e,e=a)}else Ve=e,e=a;return tt[s]={nextPos:Ve,result:e},e}function pt(){var t,r,n,s,i,o=35*Ve+11,u=tt[o];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,4)===S?(r=S,Ve+=4):(r=a,0===et&&ot(C)),r!==a&&(n=xt())!==a&&wt()!==a?(e.substr(Ve,4)===A?(s=A,Ve+=4):(s=a,0===et&&ot(R)),s!==a&&(i=xt())!==a&&wt()!==a?t=r=E(n,i):(Ve=t,t=a)):(Ve=t,t=a),tt[o]={nextPos:Ve,result:t},t)}function ft(){var t,r,n,s,i=35*Ve+12,o=tt[i];if(o)return Ve=o.nextPos,o.result;if(t=Ve,r=function(){var t,r=35*Ve+13,n=tt[r];return n?(Ve=n.nextPos,n.result):(t=function(){var t,r,n,s,i,o,u,l,c,h=35*Ve+14,p=tt[h];return p?(Ve=p.nextPos,p.result):(t=Ve,e.substr(Ve,5)===F?(r=F,Ve+=5):(r=a,0===et&&ot(L)),r!==a&&(n=dt())!==a?(e.substr(Ve,2)===j?(s=j,Ve+=2):(s=a,0===et&&ot(q)),s!==a&&(i=dt())!==a?(e.substr(Ve,2)===M?(o=M,Ve+=2):(o=a,0===et&&ot(T)),o!==a&&(u=dt())!==a?(e.substr(Ve,4)===$?(l=$,Ve+=4):(l=a,0===et&&ot(B)),l!==a?((c=xt())===a&&(c=null),c!==a&&wt()!==a?t=r=U(n,i,u,c):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a),tt[h]={nextPos:Ve,result:t},t)}(),t===a&&(t=function(){var t,r,n,s,i,o,u,l=35*Ve+15,c=tt[l];return c?(Ve=c.nextPos,c.result):(t=Ve,e.substr(Ve,4)===N?(r=N,Ve+=4):(r=a,0===et&&ot(D)),r!==a&&(n=dt())!==a?(e.substr(Ve,2)===M?(s=M,Ve+=2):(s=a,0===et&&ot(T)),s!==a&&(i=dt())!==a?(e.substr(Ve,3)===z?(o=z,Ve+=3):(o=a,0===et&&ot(I)),o!==a?((u=xt())===a&&(u=null),u!==a&&wt()!==a?t=r=W(n,i,u):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a),tt[l]={nextPos:Ve,result:t},t)}()),tt[r]={nextPos:Ve,result:t},t)}(),r!==a){if(n=[],(s=gt())!==a)for(;s!==a;)n.push(s),s=gt();else n=a;n!==a?t=r=O(r,n):(Ve=t,t=a)}else Ve=t,t=a;return tt[i]={nextPos:Ve,result:t},t}function dt(){var t,r,n,s,i=35*Ve+16,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,(r=Pt())!==a?(44===e.charCodeAt(Ve)?(n=H,Ve++):(n=a,0===et&&ot(G)),n!==a&&(s=Pt())!==a?t=r=J(r,s):(Ve=t,t=a)):(Ve=t,t=a),t===a&&(t=Ve,(r=Pt())!==a&&(r=K(r)),t=r),tt[i]={nextPos:Ve,result:t},t)}function gt(){var t,r,n,s,i=35*Ve+17,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,r=Ve,43===e.charCodeAt(Ve)?(n=Y,Ve++):(n=a,0===et&&ot(V)),n===a&&(45===e.charCodeAt(Ve)?(n=X,Ve++):(n=a,0===et&&ot(Z)),n===a&&(32===e.charCodeAt(Ve)?(n=Q,Ve++):(n=a,0===et&&ot(ee)),n===a&&(92===e.charCodeAt(Ve)?(n=te,Ve++):(n=a,0===et&&ot(re))))),n!==a?((s=xt())===a&&(s=null),s!==a?r=n=[n,s]:(Ve=r,r=a)):(Ve=r,r=a),r!==a&&(n=wt())!==a?t=r=ne(r):(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}function mt(){var t,r,n,s,i,o=35*Ve+18,u=tt[o];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,5)===se?(r=se,Ve+=5):(r=a,0===et&&ot(ie)),r!==a&&(n=_t())!==a?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=a,0===et&&ot(ee)),s!==a?(i=function(){var e,t,r=35*Ve+20,n=tt[r];return n?(Ve=n.nextPos,n.result):(Ve,(t=xt())!==a&&(t=ae(t)),e=t,tt[r]={nextPos:Ve,result:e},e)}(),i!==a&&wt()!==a?t=r=oe(n,i):(Ve=t,t=a)):(Ve=t,t=a)):(Ve=t,t=a),tt[o]={nextPos:Ve,result:t},t)}function bt(){var t,r,n,s=35*Ve+22,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,r=function(){var t,r,n,s,i=35*Ve+23,o=tt[i];return o?(Ve=o.nextPos,o.result):(t=Ve,e.substr(Ve,3)===de?(r=de,Ve+=3):(r=a,0===et&&ot(ge)),r===a&&(e.substr(Ve,7)===me?(r=me,Ve+=7):(r=a,0===et&&ot(be))),r!==a?(e.substr(Ve,11)===ye?(n=ye,Ve+=11):(n=a,0===et&&ot(ve)),n!==a&&(s=xt())!==a&&wt()!==a?t=r=we(r,s):(Ve=t,t=a)):(Ve=t,t=a),tt[i]={nextPos:Ve,result:t},t)}(),r===a&&(r=yt()),r===a&&(r=null),r!==a?((n=vt())===a&&(n=null),n!==a?t=r=fe(r,n):(Ve=t,t=a)):(Ve=t,t=a),tt[s]={nextPos:Ve,result:t},t)}function yt(){var t,r,n,s,i,o=35*Ve+24,u=tt[o];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,9)===xe?(r=xe,Ve+=9):(r=a,0===et&&ot(_e)),r!==a&&(n=xt())!==a&&wt()!==a?(e.substr(Ve,9)===Pe?(s=Pe,Ve+=9):(s=a,0===et&&ot(ke)),s!==a&&(i=xt())!==a&&wt()!==a?t=r=Se(n,i):(Ve=t,t=a)):(Ve=t,t=a),tt[o]={nextPos:Ve,result:t},t)}function vt(){var t,r,n,s,i,o=35*Ve+27,u=tt[o];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,6)===Me?(r=Me,Ve+=6):(r=a,0===et&&ot(Te)),r!==a&&(n=_t())!==a?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=a,0===et&&ot(ee)),s!==a&&(i=xt())!==a&&wt()!==a?t=r=$e(i):(Ve=t,t=a)):(Ve=t,t=a),t===a&&(t=Ve,e.substr(Ve,6)===Me?(r=Me,Ve+=6):(r=a,0===et&&ot(Te)),r!==a&&(n=_t())!==a&&(s=wt())!==a?t=r=[r,n,s]:(Ve=t,t=a)),tt[o]={nextPos:Ve,result:t},t)}function wt(){var t,r=35*Ve+29,n=tt[r];return n?(Ve=n.nextPos,n.result):(10===e.charCodeAt(Ve)?(t=Be,Ve++):(t=a,0===et&&ot(Ue)),t===a&&(e.substr(Ve,2)===Ne?(t=Ne,Ve+=2):(t=a,0===et&&ot(De))),t===a&&(t=function(){var t,r,n=35*Ve+31,s=tt[n];return s?(Ve=s.nextPos,s.result):(t=Ve,et++,e.length>Ve?(r=e.charAt(Ve),Ve++):(r=a,0===et&&ot(ze)),et--,r===a?t=void 0:(Ve=t,t=a),tt[n]={nextPos:Ve,result:t},t)}()),tt[r]={nextPos:Ve,result:t},t)}function xt(){var t,r,n,s=35*Ve+32,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],Ie.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(We)),n!==a)for(;n!==a;)r.push(n),Ie.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(We));else r=a;return r!==a&&(r=ne(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function _t(){var t,r,n,s=35*Ve+33,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],He.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(Ge)),n!==a)for(;n!==a;)r.push(n),He.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(Ge));else r=a;return r!==a&&(r=ne(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function Pt(){var t,r,n,s=35*Ve+34,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],Je.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(Ke)),n!==a)for(;n!==a;)r.push(n),Je.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=a,0===et&&ot(Ke));else r=a;return r!==a&&(r=Ye(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function kt(e,t,r,n){if(t.old_mode&&!t.new_mode)return{newPath:null,oldPath:e.file_name,newMode:null,oldMode:t.old_mode,hunks:r?r.hunks:[],status:"deleted",binary:!!n};if(!t.old_mode&&t.new_mode)return{oldPath:null,newPath:e.file_name,oldMode:null,newMode:t.new_mode,hunks:r?r.hunks:[],status:"added",binary:!!n};if(t.old_mode&&t.new_mode)return{newPath:e.file_name,oldPath:e.file_name,oldMode:t.old_mode,newMode:t.new_mode,hunks:r?r.hunks:[],status:"modified",binary:!!n};throw new Error("file modes missing")}function St(e,t,r){return(t=t||{}).filePath=e,t.status="unmerged",t.binary=!!r,t}if((n=l())!==a&&Ve===e.length)return n;throw n!==a&&Ve<e.length&&ot({type:"end"}),s=Qe,i=Ze<e.length?e.charAt(Ze):null,o=Ze<e.length?it(Ze,Ze+1):it(Ze,Ze),new t(t.buildMessage(s,i),s,i,o)}}},8928(e,t,r){var n=r(9986);e.exports=function(e){return e?("{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),m(function(e){return e.split("\\\\").join(s).split("\\{").join(i).split("\\}").join(o).split("\\,").join(a).split("\\.").join(u)}(e),!0).map(c)):[]};var s="\0SLASH"+Math.random()+"\0",i="\0OPEN"+Math.random()+"\0",o="\0CLOSE"+Math.random()+"\0",a="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function c(e){return e.split(s).join("\\").split(i).join("{").split(o).join("}").split(a).join(",").split(u).join(".")}function h(e){if(!e)return[""];var t=[],r=n("{","}",e);if(!r)return e.split(",");var s=r.pre,i=r.body,o=r.post,a=s.split(",");a[a.length-1]+="{"+i+"}";var u=h(o);return o.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),t.push.apply(t,a),t}function p(e){return"{"+e+"}"}function f(e){return/^-?0\d/.test(e)}function d(e,t){return e<=t}function g(e,t){return e>=t}function m(e,t){var r=[],s=n("{","}",e);if(!s)return[e];var i=s.pre,a=s.post.length?m(s.post,!1):[""];if(/\$$/.test(s.pre))for(var u=0;u<a.length;u++){var c=i+"{"+s.body+"}"+a[u];r.push(c)}else{var b,y,v=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),w=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),x=v||w,_=s.body.indexOf(",")>=0;if(!x&&!_)return s.post.match(/,(?!,).*\}/)?m(e=s.pre+"{"+s.body+o+s.post):[e];if(x)b=s.body.split(/\.\./);else if(1===(b=h(s.body)).length&&1===(b=m(b[0],!1).map(p)).length)return a.map(function(e){return s.pre+b[0]+e});if(x){var P=l(b[0]),k=l(b[1]),S=Math.max(b[0].length,b[1].length),C=3==b.length?Math.abs(l(b[2])):1,A=d;k<P&&(C*=-1,A=g);var R=b.some(f);y=[];for(var E=P;A(E,k);E+=C){var O;if(w)"\\"===(O=String.fromCharCode(E))&&(O="");else if(O=String(E),R){var F=S-O.length;if(F>0){var L=new Array(F+1).join("0");O=E<0?"-"+L+O.slice(1):L+O}}y.push(O)}}else{y=[];for(var j=0;j<b.length;j++)y.push.apply(y,m(b[j],!1))}for(j=0;j<y.length;j++)for(u=0;u<a.length;u++)c=i+y[j]+a[u],(!t||x||c)&&r.push(c)}return r}},4119(e){"use strict";e.exports=n},8110(e){"use strict";e.exports=r},7434(e){"use strict";e.exports=s},7125(e){"use strict";e.exports=t},3135(t){"use strict";t.exports=e},6171(e){"use strict";e.exports=i}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e].call(r.exports,r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var l={};return(()=>{"use strict";u.d(l,{DecapCmsBackendBitbucket:()=>nt});var e,t,r=u(3554),n=u.n(r),s=u(959),i=u.n(s),o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=(e=["",""],t=["",""],Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))),c=function(){function e(){for(var t=this,r=arguments.length,n=Array(r),s=0;s<r;s++)n[s]=arguments[s];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tag=function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return"function"==typeof e?t.interimTag.bind(t,e):"string"==typeof e?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return"function"==typeof e?e():e}),this.tag}return o(e,[{key:"interimTag",value:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];return this.tag(a,e.apply(void 0,[t].concat(n)))}},{key:"processSubstitutions",value:function(e,t,r){var n=this.transformSubstitution(e.shift(),t);return"".concat(t,n,r)}},{key:"transformString",value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:"transformSubstitution",value:function(e,t){return this.transformers.reduce(function(e,r){return r.onSubstitution?r.onSubstitution(e,t):e},e)}},{key:"transformEndResult",value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}();const h=c;var p={separator:"",conjunction:"",serial:!1};const f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;return{onSubstitution:function(t,r){if(Array.isArray(t)){var n=t.length,s=e.separator,i=e.conjunction,o=e.serial,a=r.match(/(\n?[^\S\n]+)$/);if(t=a?t.join(s+a[1]):t.join(s+" "),i&&n>1){var u=t.lastIndexOf(s);t=t.slice(0,u)+(o?s:"")+" "+i+t.slice(u+1)}}return t}}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"initial";return{onEndResult:function(t){if("initial"===e){var r=t.match(/^[^\S\n]*(?=\S)/gm),n=r&&Math.min.apply(Math,function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(r.map(function(e){return e.length})));if(n){var s=new RegExp("^.{"+n+"}","gm");return t.replace(s,"")}return t}if("all"===e)return t.replace(/^[^\S\n]+/gm,"");throw new Error("Unknown type: "+e)}}},g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return{onEndResult:function(t){if(""===e)return t.trim();if("start"===(e=e.toLowerCase())||"left"===e)return t.replace(/^\s*/,"");if("end"===e||"right"===e)return t.replace(/\s*$/,"");throw new Error("Side not supported: "+e)}}};new h(f({separator:","}),d,g),new h(f({separator:",",conjunction:"and"}),d,g),new h(f({separator:",",conjunction:"or"}),d,g);const m=function(e){return{onSubstitution:function(t,r){if(null==e||"string"!=typeof e)throw new Error("You need to specify a string character to split by.");return"string"==typeof t&&t.includes(e)&&(t=t.split(e)),t}}};var b=function(e){return null!=e&&!Number.isNaN(e)&&"boolean"!=typeof e};new h(m("\n"),function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(b):b(e)?e:""}}},f,d,g);const y=function(e,t){return{onSubstitution:function(r,n){if(null==e||null==t)throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");return null==r?r:r.toString().replace(e,t)}}};new h(m("\n"),f,d,g,y(/&/g,"&amp;"),y(/</g,"&lt;"),y(/>/g,"&gt;"),y(/"/g,"&quot;"),y(/'/g,"&#x27;"),y(/`/g,"&#x60;"));const v=function(e,t){return{onEndResult:function(r){if(null==e||null==t)throw new Error("replaceResultTransformer requires at least 2 arguments.");return r.replace(e,t)}}},w=new h(v(/(?:\n(?:\s*))+/g," "),g);new h(v(/(?:\n\s*)/g,""),g),new h(f({separator:","}),v(/(?:\s+)/g," "),g),new h(f({separator:",",conjunction:"or"}),v(/(?:\s+)/g," "),g),new h(f({separator:",",conjunction:"and"}),v(/(?:\s+)/g," "),g),new h(f,d,g),new h(f,v(/(?:\s+)/g," "),g);const x=new h(d,g);new h(d("all"),g);var _=u(3135),P=u(7125);function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(null,arguments)}var S=u(8110),C={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function A(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}var R=/[A-Z]|^ms/g,E=/_EMO_([^_]+?)_([^]*?)_EMO_/g,O=function(e){return 45===e.charCodeAt(1)},F=function(e){return null!=e&&"boolean"!=typeof e},L=A(function(e){return O(e)?e:e.replace(R,"-$&").toLowerCase()}),j=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(E,function(e,t,r){return M={name:t,styles:r,next:M},t})}return 1===C[e]||O(e)||"number"!=typeof t||0===t?t:t+"px"};function q(e,t,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var s=r;if(1===s.anim)return M={name:s.name,styles:s.styles,next:M},s.name;var i=r;if(void 0!==i.styles){var o=i.next;if(void 0!==o)for(;void 0!==o;)M={name:o.name,styles:o.styles,next:M},o=o.next;return i.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var s=0;s<r.length;s++)n+=q(e,t,r[s])+";";else for(var i in r){var o=r[i];if("object"!=typeof o){var a=o;null!=t&&void 0!==t[a]?n+=i+"{"+t[a]+"}":F(a)&&(n+=L(i)+":"+j(i,a)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var u=q(e,t,o);switch(i){case"animation":case"animationName":n+=L(i)+":"+u+";";break;default:n+=i+"{"+u+"}"}}else for(var l=0;l<o.length;l++)F(o[l])&&(n+=L(i)+":"+j(i,o[l])+";")}return n}(e,t,r);case"function":if(void 0!==e){var a=M,u=r(e);return M=a,q(e,t,u)}}var l=r;if(null==t)return l;var c=t[l];return void 0!==c?c:l}var M,T=/label:\s*([^\s;{]+)\s*(;|$)/g,$=u(4119),B=u.n($),U=!!$.useInsertionEffect&&$.useInsertionEffect,N=U||function(e){return e()};U||$.useLayoutEffect;var D=function(e,t,r){var n=e.key+"-"+t.name;!1===r&&void 0===e.registered[n]&&(e.registered[n]=t.styles)},z=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,I=A(function(e){return z.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),W=function(e){return"theme"!==e},H=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?I:W},G=function(e,t,r){var n;if(t){var s=t.shouldForwardProp;n=e.__emotion_forwardProp&&s?function(t){return e.__emotion_forwardProp(t)&&s(t)}:s}return"function"!=typeof n&&r&&(n=e.__emotion_forwardProp),n},J=function(e){var t=e.cache,r=e.serialized,n=e.isStringTag;return D(t,r,n),N(function(){return function(e,t,r){D(e,t,r);var n=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var s=t;do{e.insert(t===s?"."+n:"",s,e.sheet,!0),s=s.next}while(void 0!==s)}}(t,r,n)}),null},K=function e(t,r){var n,s,i=t.__emotion_real===t,o=i&&t.__emotion_base||t;void 0!==r&&(n=r.label,s=r.target);var a=G(t,r,i),u=a||H(o),l=!u("as");return function(){var c=arguments,h=i&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==n&&h.push("label:"+n+";"),null==c[0]||void 0===c[0].raw)h.push.apply(h,c);else{var p=c[0];h.push(p[0]);for(var f=c.length,d=1;d<f;d++)h.push(c[d],p[d])}var g=(0,S.withEmotionCache)(function(e,t,r){var n,i,c,p,f=l&&e.as||o,d="",g=[],m=e;if(null==e.theme){for(var b in m={},e)m[b]=e[b];m.theme=$.useContext(S.ThemeContext)}"string"==typeof e.className?(n=t.registered,i=g,c=e.className,p="",c.split(" ").forEach(function(e){void 0!==n[e]?i.push(n[e]+";"):e&&(p+=e+" ")}),d=p):null!=e.className&&(d=e.className+" ");var y=function(e,t,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,s="";M=void 0;var i=e[0];null==i||void 0===i.raw?(n=!1,s+=q(r,t,i)):s+=i[0];for(var o=1;o<e.length;o++)s+=q(r,t,e[o]),n&&(s+=i[o]);T.lastIndex=0;for(var a,u="";null!==(a=T.exec(s));)u+="-"+a[1];var l=function(e){for(var t,r=0,n=0,s=e.length;s>=4;++n,s-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(s){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(s)+u;return{name:l,styles:s,next:M}}(h.concat(g),t.registered,m);d+=t.key+"-"+y.name,void 0!==s&&(d+=" "+s);var v=l&&void 0===a?H(f):u,w={};for(var x in e)l&&"as"===x||v(x)&&(w[x]=e[x]);return w.className=d,r&&(w.ref=r),$.createElement($.Fragment,null,$.createElement(J,{cache:t,serialized:y,isStringTag:"string"==typeof f}),$.createElement(f,w))});return g.displayName=void 0!==n?n:"Styled("+("string"==typeof o?o:o.displayName||o.name||"Component")+")",g.defaultProps=t.defaultProps,g.__emotion_real=g,g.__emotion_base=o,g.__emotion_styles=h,g.__emotion_forwardProp=a,Object.defineProperty(g,"toString",{value:function(){return"."+s}}),g.withComponent=function(t,n){return e(t,k({},r,n,{shouldForwardProp:G(g,n,!0)})).apply(void 0,h)},g}},Y=u(7434),V=u.n(Y),X=u(6171);const Z=K(X.Icon,{target:"e15sc0jo0",label:"LoginButtonIcon"})({name:"1gnqu05",styles:"margin-right:18px"});class Q extends B().Component{static propTypes={onLogin:V().func.isRequired,inProgress:V().bool,base_url:V().string,siteId:V().string,authEndpoint:V().string,config:V().object.isRequired,clearHash:V().func,t:V().func.isRequired};state={};componentDidMount(){V().checkPropTypes(Q.propTypes,this.props,"prop","BitbucketAuthenticationPage");const{auth_type:e=""}=this.props.config.backend;if("implicit"===e){const{base_url:e="https://bitbucket.org",auth_endpoint:t="site/oauth2/authorize",app_id:r=""}=this.props.config.backend;this.auth=new P.ImplicitAuthenticator({base_url:e,auth_endpoint:t,app_id:r,clearHash:this.props.clearHash}),this.auth.completeAuth((e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)}),this.authSettings={scope:"repository:write"}}else this.auth=new P.NetlifyAuthenticator({base_url:this.props.base_url,site_id:"localhost"===document.location.host.split(":")[0]?"demo.decapcms.org":this.props.siteId,auth_endpoint:this.props.authEndpoint}),this.authSettings={provider:"bitbucket",scope:"repo"}}handleLogin=e=>{e.preventDefault(),this.auth.authenticate(this.authSettings,(e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)})};render(){const{inProgress:e,config:t,t:r}=this.props;return(0,S.jsx)(X.AuthenticationPage,{onLogin:this.handleLogin,loginDisabled:e,loginErrorMessage:this.state.loginError,logoUrl:t.logo_url,logo:t.logo,siteUrl:t.site_url,renderButtonContent:()=>(0,S.jsx)(B().Fragment,null,(0,S.jsx)(Z,{type:"bitbucket"}),r(e?"auth.loggingIn":"auth.loginWithBitbucket")),t:r})}}var ee=u(2879),te=u.n(ee),re=u(6123),ne=u.n(re),se=u(9942),ie=u(7330),oe=function(e){return e.MERGED="MERGED",e.SUPERSEDED="SUPERSEDED",e.OPEN="OPEN",e.DECLINED="DECLINED",e}(oe||{}),ae=function(e){return e.Successful="SUCCESSFUL",e.Failed="FAILED",e.InProgress="INPROGRESS",e.Stopped="STOPPED",e}(ae||{});const ue="Bitbucket",le="application/json; charset=utf-8";function ce(e){return e&&404===e.status?(console.log("This 404 was expected and handled appropriately."),{size:0,values:[]}):Promise.reject(e)}class he{constructor(e){this.apiRoot=e.apiRoot||"https://api.bitbucket.org/2.0",this.branch=e.branch||"master",this.repo=e.repo||"",this.requestFunction=e.requestFunction||_.unsentRequest.performRequest,this.hasWriteAccess=e.hasWriteAccess||this.hasWriteAccess,this.repoURL=this.repo?`/repositories/${this.repo}`:"",this.mergeStrategy=e.squashMerges?"squash":"merge_commit",this.initialWorkflowStatus=e.initialWorkflowStatus,this.cmsLabelPrefix=e.cmsLabelPrefix}buildRequest=e=>{const t=_.unsentRequest.withRoot(this.apiRoot)(e);return t.has("cache")?t:_.unsentRequest.withNoCache(t)};request=e=>{try{return(0,_.requestWithBackoff)(this,e)}catch(e){throw new _.APIError(e.message,null,ue)}};responseToJSON=(0,_.responseParser)({format:"json",apiName:ue});responseToBlob=(0,_.responseParser)({format:"blob",apiName:ue});responseToText=(0,_.responseParser)({format:"text",apiName:ue});requestJSON=e=>this.request(e).then(this.responseToJSON);requestText=e=>this.request(e).then(this.responseToText);user=()=>this.requestJSON("/user");hasWriteAccess=async()=>{const e=await this.request(this.repoURL);if(404===e.status)throw Error("Repo not found");return e.ok};getBranch=async e=>await this.requestJSON(`${this.repoURL}/refs/branches/${e}`);branchCommitSha=async e=>{const{target:{hash:t}}=await this.getBranch(e);return t};defaultBranchCommitSha=()=>this.branchCommitSha(this.branch);isFile=({type:e})=>"commit_file"===e;getFileId=(e,t)=>`${e}/${t}`;processFile=e=>({id:e.id,type:e.type,path:e.path,name:(0,_.basename)(e.path),...e.commit&&e.commit.hash?{id:this.getFileId(e.commit.hash,e.path)}:{}});processFiles=e=>e.filter(this.isFile).map(this.processFile);readFile=async(e,t,{parseText:r=!0,branch:n=this.branch,head:s=""}={})=>await(0,_.readFile)(t,async()=>{const t=s||await this.branchCommitSha(n);return await this.request({url:`${this.repoURL}/src/${t}/${e}`,cache:"no-store"}).then(r?this.responseToText:this.responseToBlob)},_.localForage,r);async readFileMetadata(e,t){return await(0,_.readFileMetadata)(t,async()=>{try{const{values:t}=await this.requestJSON({url:`${this.repoURL}/commits`,params:{path:e,include:this.branch}}),r=t[0];return{author:r.author.user?r.author.user.display_name||r.author.user.nickname:r.author.raw,updatedOn:r.date}}catch(e){return{author:"",updatedOn:""}}},_.localForage)}async isShaExistsInBranch(e,t){const{values:r}=await this.requestJSON({url:`${this.repoURL}/commits`,params:{include:e,pagelen:100}}).catch(t=>(console.log(`Failed getting commits for branch '${e}'`,t),[]));return r.some(e=>e.hash===t)}getEntriesAndCursor=e=>{const{size:t,page:r,pagelen:n,next:s,previous:i,values:o}=e,a=n&&t?Math.ceil(t/n):void 0;return{entries:o,cursor:_.Cursor.create({actions:[...s?["next"]:[],...i?["prev"]:[]],meta:{page:r,count:t,pageSize:n,pageCount:a},data:{links:{next:s,prev:i}}})}};listFiles=async(e,t=1,r,n)=>{const s=await this.branchCommitSha(n),i=await this.requestJSON({url:`${this.repoURL}/src/${s}/${e}`,params:{max_depth:t,pagelen:r}}).catch(ce),{entries:o,cursor:a}=this.getEntriesAndCursor(i);return{entries:this.processFiles(o),cursor:a}};traverseCursor=async(e,t)=>te()([this.requestJSON,(0,_.then)(this.getEntriesAndCursor),(0,_.then)(({cursor:e,entries:t})=>({cursor:e,entries:this.processFiles(t)}))])(e.data.getIn(["links",t]));listAllFiles=async(e,t,r)=>{const{cursor:n,entries:s}=await this.listFiles(e,t,100,r),i=[...s];let o=n;for(;o&&o.actions.has("next");){const{cursor:e,entries:t}=await this.traverseCursor(o,"next");i.push(...t),o=e}return this.processFiles(i)};async uploadFiles(e,{commitMessage:t,branch:r,parentSha:n}){const s=new FormData,i=[];e.forEach(e=>{if(e.delete)s.append("files",e.path);else if(e.newPath){const t=ne()(e,"fileObj",new Blob([e.raw]));i.push({from:e.path,to:e.newPath,contentBlob:t})}else{const t=ne()(e,"fileObj",new Blob([e.raw]));s.append(e.path,t,(0,_.basename)(e.path))}});for(const{from:e,to:t,contentBlob:o}of i){const i=(0,se.dirname)(e),a=(0,se.dirname)(t),u=n?this.branch:r,l=await this.listAllFiles(i,100,u);for(const t of l){s.append("files",t.path);const r=t.path===e?o:await this.readFile(t.path,null,{branch:u,parseText:!1});s.append(t.path.replace(i,a),r,(0,_.basename)(t.path))}}if(t&&s.append("message",t),this.commitAuthor){const{name:e,email:t}=this.commitAuthor;s.append("author",`${e} <${t}>`)}s.append("branch",r),n&&s.append("parents",n);try{await this.requestText({url:`${this.repoURL}/src`,method:"POST",body:s})}catch(e){const t=e.message||"";throw n&&t.includes("Something went wrong")&&await(0,_.throwOnConflictingBranches)(r,e=>this.getBranch(e),ue),e}return e}async persistFiles(e,t,r){const n=[...e,...t];if(r.useWorkflow){const t=e[0].slug;return this.editorialWorkflowGit(n,t,r)}return this.uploadFiles(n,{commitMessage:r.commitMessage,branch:this.branch})}async addPullRequestComment(e,t){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/comments`,headers:{"Content-Type":le},body:JSON.stringify({content:{raw:t}})})}async getPullRequestLabel(e){const t=await this.requestJSON({url:`${this.repoURL}/pullrequests/${e}/comments`,params:{pagelen:100}});return t.values.map(e=>e.content.raw)[t.values.length-1]}async createPullRequest(e,t,r){const n=await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests`,headers:{"Content-Type":le},body:JSON.stringify({title:t,source:{branch:{name:e}},destination:{branch:{name:this.branch}},description:_.DEFAULT_PR_BODY,close_source_branch:!0})});await this.addPullRequestComment(n,(0,_.statusToLabel)(r,this.cmsLabelPrefix))}async getDifferences(e,t=this.branch){if(e===t)return[];const r=await this.requestText({url:`${this.repoURL}/diff/${e}..${t}`,params:{binary:!1}});return(0,ie.parse)(r).map(e=>{const t=e.oldPath?.replace(/b\//,"")||"",r=e.newPath?.replace(/b\//,"")||"",n=r||t;return{oldPath:t,newPath:r,status:e.status,newFile:"added"===e.status,path:n,binary:e.binary||/.svg$/.test(n)}})}async editorialWorkflowGit(e,t,r){const n=(0,_.generateContentKey)(r.collectionName,t),s=(0,_.branchFromContentKey)(n);if(r.unpublished){const t=await this.getDifferences(s),n=[];for(const r of t.filter(e=>e.binary&&"deleted"!==e.status))e.some(e=>e.path===r.path)||n.push({path:r.path,delete:!0});await this.uploadFiles([...e,...n],{commitMessage:r.commitMessage,branch:s})}else{const t=await this.branchCommitSha(this.branch);await this.uploadFiles(e,{commitMessage:r.commitMessage,branch:s,parentSha:t}),await this.createPullRequest(s,r.commitMessage,r.status||this.initialWorkflowStatus)}}deleteFiles=(e,t)=>{const r=new FormData;if(e.forEach(e=>{r.append("files",e)}),r.append("branch",this.branch),t&&r.append("message",t),this.commitAuthor){const{name:e,email:t}=this.commitAuthor;r.append("author",`${e} <${t}>`)}return te()([_.unsentRequest.withMethod("POST"),_.unsentRequest.withBody(r),this.request])(`${this.repoURL}/src`)};async getPullRequests(e){const t=e?`source.branch.name = "${e}"`:`source.branch.name ~ "${_.CMS_BRANCH_PREFIX}/"`,r=await this.requestJSON({url:`${this.repoURL}/pullrequests`,params:{pagelen:50,q:w`
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("decap-cms-lib-util"),require("decap-cms-lib-auth"),require("@emotion/react"),require("react"),require("prop-types"),require("decap-cms-ui-default")):"function"==typeof define&&define.amd?define("DecapCmsBackendBitbucket",["decap-cms-lib-util","decap-cms-lib-auth","@emotion/react","react","prop-types","decap-cms-ui-default"],t):"object"==typeof exports?exports.DecapCmsBackendBitbucket=t(require("decap-cms-lib-util"),require("decap-cms-lib-auth"),require("@emotion/react"),require("react"),require("prop-types"),require("decap-cms-ui-default")):e.DecapCmsBackendBitbucket=t(e.DecapCmsLibUtil,e.DecapCmsLibAuth,e.DecapCmsDefaultExports.EmotionCore,e.React,e.DecapCmsDefaultExports.PropTypes,e.DecapCmsUiDefault)}(window,(e,t,r,n,s,i)=>(()=>{var a={9986(e){"use strict";function t(e,t,s){e instanceof RegExp&&(e=r(e,s)),t instanceof RegExp&&(t=r(t,s));var i=n(e,t,s);return i&&{start:i[0],end:i[1],pre:s.slice(0,i[0]),body:s.slice(i[0]+e.length,i[1]),post:s.slice(i[1]+t.length)}}function r(e,t){var r=t.match(e);return r?r[0]:null}function n(e,t,r){var n,s,i,a,o,u=r.indexOf(e),l=r.indexOf(t,u+1),c=u;if(u>=0&&l>0){if(e===t)return[u,l];for(n=[],i=r.length;c>=0&&!o;)c==u?(n.push(c),u=r.indexOf(e,c+1)):1==n.length?o=[n.pop(),l]:((s=n.pop())<i&&(i=s,a=l),l=r.indexOf(t,c+1)),c=u<l&&u>=0?u:l;n.length&&(o=[i,a])}return o}e.exports=t,t.range=n},5098(e,t,r){var n=r(3305),s=r(9361),i=r(1112),a=r(5276),o=r(7452);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=a,u.prototype.set=o,e.exports=u},7553(e,t,r){var n=r(9747),s=r(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=n(s.prototype),i.prototype.constructor=i,e.exports=i},1386(e,t,r){var n=r(2393),s=r(2049),i=r(7144),a=r(5071),o=r(3964);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=a,u.prototype.set=o,e.exports=u},528(e,t,r){var n=r(9747),s=r(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=n(s.prototype),i.prototype.constructor=i,e.exports=i},9770(e,t,r){var n=r(4715)(r(8942),"Map");e.exports=n},8250(e,t,r){var n=r(9753),s=r(5681),i=r(88),a=r(4732),o=r(9068);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=s,u.prototype.get=i,u.prototype.has=a,u.prototype.set=o,e.exports=u},5650(e,t,r){var n=r(8942).Symbol;e.exports=n},9270(e,t,r){var n=r(4715)(r(8942),"WeakMap");e.exports=n},6912(e){e.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},5111(e){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}},1129(e){e.exports=function(e,t){for(var r=-1,n=t.length,s=e.length;++r<n;)e[s+r]=t[r];return e}},2837(e){e.exports=function(e){return e.split("")}},7034(e,t,r){var n=r(6285);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},9747(e,t,r){var n=r(1580),s=Object.create,i=function(){function e(){}return function(t){if(!n(t))return{};if(s)return s(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=i},7250(e){e.exports=function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}},313(e,t,r){var n=r(1129),s=r(714);e.exports=function e(t,r,i,a,o){var u=-1,l=t.length;for(i||(i=s),o||(o=[]);++u<l;){var c=t[u];r>0&&i(c)?r>1?e(c,r-1,i,a,o):n(o,c):a||(o[o.length]=c)}return o}},7923(e,t,r){var n=r(3526),s=r(6040);e.exports=function(e,t){for(var r=0,i=(t=n(t,e)).length;null!=e&&r<i;)e=e[s(t[r++])];return r&&r==i?e:void 0}},7379(e,t,r){var n=r(5650),s=r(8870),i=r(9005),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?s(e):i(e)}},2478(e,t,r){var n=r(7250),s=r(9454),i=r(7706);e.exports=function(e,t,r){return t==t?i(e,t,r):n(e,s,r)}},6027(e,t,r){var n=r(7379),s=r(547);e.exports=function(e){return s(e)&&"[object Arguments]"==n(e)}},9454(e){e.exports=function(e){return e!=e}},9624(e,t,r){var n=r(3655),s=r(4759),i=r(1580),a=r(4066),o=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,c=u.toString,h=l.hasOwnProperty,p=RegExp("^"+c.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||s(e))&&(n(e)?p:o).test(a(e))}},5962(e){e.exports=function(){}},7403(e,t,r){var n=r(2619),s=r(2532),i=r(2053),a=s?function(e,t){return s(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i;e.exports=a},3501(e){e.exports=function(e,t,r){var n=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(r=r>s?s:r)<0&&(r+=s),s=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(s);++n<s;)i[n]=e[n+t];return i}},2291(e,t,r){var n=r(5650),s=r(5111),i=r(3142),a=r(1187),o=n?n.prototype:void 0,u=o?o.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return s(t,e)+"";if(a(t))return u?u.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},3526(e,t,r){var n=r(3142),s=r(5187),i=r(6493),a=r(5243);e.exports=function(e,t){return n(e)?e:s(e,t)?[e]:i(a(e))}},8931(e,t,r){var n=r(3501);e.exports=function(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:n(e,t,r)}},7905(e,t,r){var n=r(2478);e.exports=function(e,t){for(var r=-1,s=e.length;++r<s&&n(t,e[r],0)>-1;);return r}},4354(e){e.exports=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}},1950(e,t,r){var n=r(8942)["__core-js_shared__"];e.exports=n},1942(e,t,r){var n=r(528),s=r(1439),i=r(5196),a=r(961),o=r(3142),u=r(6648);e.exports=function(e){return s(function(t){var r=t.length,s=r,l=n.prototype.thru;for(e&&t.reverse();s--;){var c=t[s];if("function"!=typeof c)throw new TypeError("Expected a function");if(l&&!h&&"wrapper"==a(c))var h=new n([],!0)}for(s=h?s:r;++s<r;){c=t[s];var p=a(c),f="wrapper"==p?i(c):void 0;h=f&&u(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?h[a(f[0])].apply(h,f[3]):1==c.length&&u(c)?h[p]():h.thru(c)}return function(){var e=arguments,n=e[0];if(h&&1==e.length&&o(n))return h.plant(n).value();for(var s=0,i=r?t[s].apply(this,e):n;++s<r;)i=t[s].call(this,i);return i}})}},2532(e,t,r){var n=r(4715),s=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=s},1439(e,t,r){var n=r(5857),s=r(5234),i=r(796);e.exports=function(e){return i(s(e,void 0,n),e+"")}},4967(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},5196(e,t,r){var n=r(6065),s=r(9071),i=n?function(e){return n.get(e)}:s;e.exports=i},961(e,t,r){var n=r(3476),s=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",r=n[t],i=s.call(n,t)?r.length:0;i--;){var a=r[i],o=a.func;if(null==o||o==e)return a.name}return t}},4700(e,t,r){var n=r(9067);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},4715(e,t,r){var n=r(9624),s=r(155);e.exports=function(e,t){var r=s(e,t);return n(r)?r:void 0}},8870(e,t,r){var n=r(5650),s=Object.prototype,i=s.hasOwnProperty,a=s.toString,o=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,o),r=e[o];try{e[o]=void 0;var n=!0}catch(e){}var s=a.call(e);return n&&(t?e[o]=r:delete e[o]),s}},155(e){e.exports=function(e,t){return null==e?void 0:e[t]}},3417(e){var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},3305(e,t,r){var n=r(4497);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},9361(e){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},1112(e,t,r){var n=r(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return s.call(t,e)?t[e]:void 0}},5276(e,t,r){var n=r(4497),s=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:s.call(t,e)}},7452(e,t,r){var n=r(4497);e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},714(e,t,r){var n=r(5650),s=r(3283),i=r(3142),a=n?n.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||s(e)||!!(a&&e&&e[a])}},5187(e,t,r){var n=r(3142),s=r(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!s(e))||a.test(e)||!i.test(e)||null!=t&&e in Object(t)}},9067(e){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},6648(e,t,r){var n=r(7553),s=r(5196),i=r(961),a=r(3321);e.exports=function(e){var t=i(e),r=a[t];if("function"!=typeof r||!(t in n.prototype))return!1;if(e===r)return!0;var o=s(r);return!!o&&e===o[0]}},4759(e,t,r){var n,s=r(1950),i=(n=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},2393(e){e.exports=function(){this.__data__=[],this.size=0}},2049(e,t,r){var n=r(7034),s=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0||(r==t.length-1?t.pop():s.call(t,r,1),--this.size,0))}},7144(e,t,r){var n=r(7034);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},5071(e,t,r){var n=r(7034);e.exports=function(e){return n(this.__data__,e)>-1}},3964(e,t,r){var n=r(7034);e.exports=function(e,t){var r=this.__data__,s=n(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this}},9753(e,t,r){var n=r(5098),s=r(1386),i=r(9770);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||s),string:new n}}},5681(e,t,r){var n=r(4700);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},88(e,t,r){var n=r(4700);e.exports=function(e){return n(this,e).get(e)}},4732(e,t,r){var n=r(4700);e.exports=function(e){return n(this,e).has(e)}},9068(e,t,r){var n=r(4700);e.exports=function(e,t){var r=n(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this}},6853(e,t,r){var n=r(9011);e.exports=function(e){var t=n(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}},6065(e,t,r){var n=r(9270),s=n&&new n;e.exports=s},4497(e,t,r){var n=r(4715)(Object,"create");e.exports=n},9005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5234(e,t,r){var n=r(6912),s=Math.max;e.exports=function(e,t,r){return t=s(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=s(i.length-t,0),u=Array(o);++a<o;)u[a]=i[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=i[a];return l[t]=r(u),n(e,this,l)}}},3476(e){e.exports={}},8942(e,t,r){var n=r(4967),s="object"==typeof self&&self&&self.Object===Object&&self,i=n||s||Function("return this")();e.exports=i},796(e,t,r){var n=r(7403),s=r(3316)(n);e.exports=s},3316(e){var t=Date.now;e.exports=function(e){var r=0,n=0;return function(){var s=t(),i=16-(s-n);if(n=s,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}},7706(e){e.exports=function(e,t,r){for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}},2237(e,t,r){var n=r(2837),s=r(3417),i=r(2013);e.exports=function(e){return s(e)?i(e):n(e)}},6493(e,t,r){var n=r(6853),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=n(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(s,function(e,r,n,s){t.push(n?s.replace(i,"$1"):r||e)}),t});e.exports=a},6040(e,t,r){var n=r(1187);e.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},4066(e){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},2013(e){var t="\\ud800-\\udfff",r="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",s="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",o="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+s+")?",l="[\\ufe0e\\ufe0f]?",c=l+u+"(?:\\u200d(?:"+[i,a,o].join("|")+")"+l+u+")*",h="(?:"+[i+n+"?",n,a,o,r].join("|")+")",p=RegExp(s+"(?="+s+")|"+h+c,"g");e.exports=function(e){return e.match(p)||[]}},3410(e,t,r){var n=r(7553),s=r(528),i=r(4354);e.exports=function(e){if(e instanceof n)return e.clone();var t=new s(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},2619(e){e.exports=function(e){return function(){return e}}},6285(e){e.exports=function(e,t){return e===t||e!=e&&t!=t}},5857(e,t,r){var n=r(313);e.exports=function(e){return null!=e&&e.length?n(e,1):[]}},2879(e,t,r){var n=r(1942)();e.exports=n},6123(e,t,r){var n=r(7923);e.exports=function(e,t,r){var s=null==e?void 0:n(e,t);return void 0===s?r:s}},2053(e){e.exports=function(e){return e}},3283(e,t,r){var n=r(6027),s=r(547),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return s(e)&&a.call(e,"callee")&&!o.call(e,"callee")};e.exports=u},3142(e){var t=Array.isArray;e.exports=t},3655(e,t,r){var n=r(7379),s=r(1580);e.exports=function(e){if(!s(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1580(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1187(e,t,r){var n=r(7379),s=r(547);e.exports=function(e){return"symbol"==typeof e||s(e)&&"[object Symbol]"==n(e)}},9011(e,t,r){var n=r(8250);function s(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,s=t?t.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var a=e.apply(this,n);return r.cache=i.set(s,a)||i,a};return r.cache=new(s.Cache||n),r}s.Cache=n,e.exports=s},9071(e){e.exports=function(){}},5243(e,t,r){var n=r(2291);e.exports=function(e){return null==e?"":n(e)}},959(e,t,r){var n=r(2291),s=r(8931),i=r(7905),a=r(2237),o=r(5243),u=/^\s+/;e.exports=function(e,t,r){if((e=o(e))&&(r||void 0===t))return e.replace(u,"");if(!e||!(t=n(t)))return e;var l=a(e),c=i(l,a(t));return s(l,c).join("")}},3321(e,t,r){var n=r(7553),s=r(528),i=r(5962),a=r(3142),o=r(547),u=r(3410),l=Object.prototype.hasOwnProperty;function c(e){if(o(e)&&!a(e)&&!(e instanceof n)){if(e instanceof s)return e;if(l.call(e,"__wrapped__"))return u(e)}return new s(e)}c.prototype=i.prototype,c.prototype.constructor=c,e.exports=c},9942(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",s=0,i=-1,a=0,o=0;o<=e.length;++o){if(o<e.length)r=e.charCodeAt(o);else{if(47===r)break;r=47}if(47===r){if(i===o-1||1===a);else if(i!==o-1&&2===a){if(n.length<2||2!==s||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",s=0):s=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),i=o,a=0;continue}}else if(2===n.length||1===n.length){n="",s=0,i=o,a=0;continue}t&&(n.length>0?n+="/..":n="..",s=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),s=o-i-1;i=o,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var e,n="",s=!1,i=arguments.length-1;i>=-1&&!s;i--){var a;i>=0?a=arguments[i]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(n=a+"/"+n,s=47===a.charCodeAt(0))}return n=r(n,!s),s?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),s=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&s&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var s=arguments[r];t(s),s.length>0&&(void 0===e?e=s:e+="/"+s)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var s=1;s<e.length&&47===e.charCodeAt(s);++s);for(var i=e.length,a=i-s,o=1;o<r.length&&47===r.charCodeAt(o);++o);for(var u=r.length-o,l=a<u?a:u,c=-1,h=0;h<=l;++h){if(h===l){if(u>l){if(47===r.charCodeAt(o+h))return r.slice(o+h+1);if(0===h)return r.slice(o+h)}else a>l&&(47===e.charCodeAt(s+h)?c=h:0===h&&(c=0));break}var p=e.charCodeAt(s+h);if(p!==r.charCodeAt(o+h))break;47===p&&(c=h)}var f="";for(h=s+c+1;h<=i;++h)h!==i&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(o+c):(o+=c,47===r.charCodeAt(o)&&++o,r.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,s=-1,i=!0,a=e.length-1;a>=1;--a)if(47===(r=e.charCodeAt(a))){if(!i){s=a;break}}else i=!1;return-1===s?n?"/":".":n&&1===s?"//":e.slice(0,s)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,s=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var o=r.length-1,u=-1;for(n=e.length-1;n>=0;--n){var l=e.charCodeAt(n);if(47===l){if(!a){s=n+1;break}}else-1===u&&(a=!1,u=n+1),o>=0&&(l===r.charCodeAt(o)?-1===--o&&(i=n):(o=-1,i=u))}return s===i?i=u:-1===i&&(i=e.length),e.slice(s,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!a){s=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":e.slice(s,i)},extname:function(e){t(e);for(var r=-1,n=0,s=-1,i=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(47!==u)-1===s&&(i=!1,s=o+1),46===u?-1===r?r=o:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=o+1;break}}return-1===r||-1===s||0===a||1===a&&r===s-1&&r===n+1?"":e.slice(r,s)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,s=e.charCodeAt(0),i=47===s;i?(r.root="/",n=1):n=0;for(var a=-1,o=0,u=-1,l=!0,c=e.length-1,h=0;c>=n;--c)if(47!==(s=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===s?-1===a?a=c:1!==h&&(h=1):-1!==a&&(h=-1);else if(!l){o=c+1;break}return-1===a||-1===u||0===h||1===h&&a===u-1&&a===o+1?-1!==u&&(r.base=r.name=0===o&&i?e.slice(1,u):e.slice(o,u)):(0===o&&i?(r.name=e.slice(1,a),r.base=e.slice(1,u)):(r.name=e.slice(o,a),r.base=e.slice(o,u)),r.ext=e.slice(a,u)),o>0?r.dir=e.slice(0,o-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n},3554(e){!function(){"use strict";var t=function(e){setTimeout(e,0)};"undefined"!=typeof process&&process&&"function"==typeof process.nextTick&&(t=process.nextTick),e.exports=function(e){var r={capacity:e||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===r.firstHere){r.current++,r.firstHere=!0;var e=1}else e=0;var t={n:1};"function"==typeof arguments[0]?t.task=arguments[0]:t.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?t.task=arguments[1]:t.n=arguments[1]);var n=t.task;if(t.task=function(){n(r.leave)},r.current+t.n-e>r.capacity)return 1===e&&(r.current--,r.firstHere=!1),r.queue.push(t);r.current+=t.n-e,t.task(r.leave),1===e&&(r.firstHere=!1)},leave:function(e){if(e=e||1,r.current-=e,r.queue.length){var n=r.queue[0];n.n+r.current>r.capacity||(r.queue.shift(),r.current+=n.n,t(n.task))}else if(r.current<0)throw new Error("leave called too many times.")},available:function(e){return e=e||1,r.current+e<=r.capacity}};return r}}()},7330(e,t,r){var n=r(3063);e.exports={parse:function(e){return n.parse(e.toString())}}},3063(e){"use strict";function t(e,r,n,s){this.message=e,this.expected=r,this.found=n,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}!function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(t,Error),t.buildMessage=function(e,t){var r={literal:function(e){return'"'+s(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?i(e.parts[t][0])+"-"+i(e.parts[t][1]):i(e.parts[t]);return"["+(e.inverted?"^":"")+r+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function s(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function i(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function a(e){return r[e.type](e)}return"Expected "+function(e){var t,r,n=new Array(e.length);for(t=0;t<e.length;t++)n[t]=a(e[t]);if(n.sort(),n.length>0){for(t=1,r=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+function(e){return e?'"'+s(e)+'"':"end of input"}(t)+" found."},e.exports={SyntaxError:t,parse:function(e,r){r=void 0!==r?r:{};var n,s,i,a,o={},u={diffs:ot},l=ot,c=function(e){return e},h=function(e,t){return kt(e,t,void 0,!0)},p="Binary files ",f=rt("Binary files ",!1),d=function(e,t,r){return kt(e,t,r)},g=function(e){return St(e,void 0,!0)},m=function(e,t,r,n,s,i){return function(e,t,r,n,s,i){const a={oldPath:r,newPath:n,hunks:i?i.hunks:[],status:"copy"===e?"copied":"renamed",similarity:t};return s&&(a.oldMode=s.old_mode,a.newMode=s.new_mode),a}(r.operation,t,r.file,n.file,e||s,i)},b=function(e,t){return St(e,t)},y="diff --cc ",v=rt("diff --cc ",!1),w=function(e){return e},x="* Unmerged path ",_=rt("* Unmerged path ",!1),P=function(e){return St(e)},k=function(e,t){return{hunks:t}},S="--- ",C=rt("--- ",!1),A="+++ ",R=rt("+++ ",!1),E=function(e,t){return{old_file_name:e,new_file_name:t}},O=function(e,t){return Object.assign({},e,{lines:t})},F="@@@ -",L=rt("@@@ -",!1),j=" -",q=rt(" -",!1),M=" +",T=rt(" +",!1),$=" @@@",B=rt(" @@@",!1),U=function(e,t,r,n){return{ourStartLine:e.start,ourLineCount:e.count,theirStartLine:r.start,theirLineCount:r.count,baseStartLine:t.start,baseLineCount:t.count,heading:n?n.trim():""}},N="@@ -",D=rt("@@ -",!1),z=" @@",I=rt(" @@",!1),W=function(e,t,r){return{oldStartLine:e.start,oldLineCount:e.count,newStartLine:t.start,newLineCount:t.count,heading:r?r.trim():""}},H=",",G=rt(",",!1),J=function(e,t){return{start:e,count:t}},K=function(e){return{start:e,count:1}},Y="+",V=rt("+",!1),X="-",Z=rt("-",!1),Q=" ",ee=rt(" ",!1),te="\\",re=rt("\\",!1),ne=function(e){return e.join("")},se="diff ",ie=rt("diff ",!1),ae=function(e,t){return{file_name:t}},oe=function(e){return e.substr(e.length/2+1)},ue="similarity index ",le=rt("similarity index ",!1),ce="%",he=rt("%",!1),pe=function(e){return e},fe=function(e,t){return e||t},de="new",ge=rt("new",!1),me="deleted",be=rt("deleted",!1),ye=" file mode ",ve=rt(" file mode ",!1),we=function(e,t){return"new"===e?{old_mode:null,new_mode:t}:{old_mode:t,new_mode:null}},xe="old mode ",_e=rt("old mode ",!1),Pe="new mode ",ke=rt("new mode ",!1),Se=function(e,t){return{old_mode:e,new_mode:t}},Ce="rename",Ae=rt("rename",!1),Re="copy",Ee=rt("copy",!1),Oe=" from ",Fe=rt(" from ",!1),Le=function(e,t){return{operation:e,file:t}},je=" to ",qe=rt(" to ",!1),Me="index ",Te=rt("index ",!1),$e=function(e){return{old_mode:e,new_mode:e}},Be=(nt([" ","\t"],!1,!1),"\n"),Ue=rt("\n",!1),Ne="\r\n",De=rt("\r\n",!1),ze={type:"any"},Ie=/^[^\r\n]/,We=nt(["\r","\n"],!0,!1),He=/^[^ \t\r\n]/,Ge=nt([" ","\t","\r","\n"],!0,!1),Je=/^[0-9]/,Ke=nt([["0","9"]],!1,!1),Ye=function(e){return parseInt(e.join(""),10)},Ve=0,Xe=[{line:1,column:1}],Ze=0,Qe=[],et=0,tt={};if("startRule"in r){if(!(r.startRule in u))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=u[r.startRule]}function rt(e,t){return{type:"literal",text:e,ignoreCase:t}}function nt(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function st(t){var r,n=Xe[t];if(n)return n;for(r=t-1;!Xe[r];)r--;for(n={line:(n=Xe[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Xe[t]=n,n}function it(e,t){var r=st(e),n=st(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function at(e){Ve<Ze||(Ve>Ze&&(Ze=Ve,Qe=[]),Qe.push(e))}function ot(){var e,t,r,n=35*Ve+0,s=tt[n];if(s)return Ve=s.nextPos,s.result;for(Ve,t=[],r=ut();r!==o;)t.push(r),r=ut();return t!==o&&(t=c(t)),e=t,tt[n]={nextPos:Ve,result:e},e}function ut(){var t,r=35*Ve+1,n=tt[r];return n?(Ve=n.nextPos,n.result):(t=function(){var e,t,r=35*Ve+5,n=tt[r];return n?(Ve=n.nextPos,n.result):(e=Ve,(t=ct())!==o&&vt()!==o&&lt()!==o?e=t=g(t):(Ve=e,e=o),tt[r]={nextPos:Ve,result:e},e)}(),t===o&&(t=function(){var t,r,n,s,i,a,u,l,c=35*Ve+6,h=tt[c];return h?(Ve=h.nextPos,h.result):(t=Ve,r=function(){var t,r,n,s,i,a,u=35*Ve+19,l=tt[u];return l?(Ve=l.nextPos,l.result):(t=Ve,e.substr(Ve,5)===se?(r=se,Ve+=5):(r=o,0===et&&at(ie)),r!==o&&(n=_t())!==o?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=o,0===et&&at(ee)),s!==o&&(i=xt())!==o&&(a=wt())!==o?t=r=[r,n,s,i,a]:(Ve=t,t=o)):(Ve=t,t=o),tt[u]={nextPos:Ve,result:t},t)}(),r!==o?((n=yt())===o&&(n=null),n!==o?(s=function(){var t,r,n,s,i=35*Ve+21,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,e.substr(Ve,17)===ue?(r=ue,Ve+=17):(r=o,0===et&&at(le)),r!==o&&(n=Pt())!==o?(37===e.charCodeAt(Ve)?(s=ce,Ve++):(s=o,0===et&&at(he)),s!==o&&wt()!==o?t=r=pe(n):(Ve=t,t=o)):(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}(),s!==o?(i=function(){var t,r,n,s,i=35*Ve+25,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,e.substr(Ve,6)===Ce?(r=Ce,Ve+=6):(r=o,0===et&&at(Ae)),r===o&&(e.substr(Ve,4)===Re?(r=Re,Ve+=4):(r=o,0===et&&at(Ee))),r!==o?(e.substr(Ve,6)===Oe?(n=Oe,Ve+=6):(n=o,0===et&&at(Fe)),n!==o&&(s=xt())!==o&&wt()!==o?t=r=Le(r,s):(Ve=t,t=o)):(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}(),i!==o?(a=function(){var t,r,n,s,i=35*Ve+26,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,e.substr(Ve,6)===Ce?(r=Ce,Ve+=6):(r=o,0===et&&at(Ae)),r===o&&(e.substr(Ve,4)===Re?(r=Re,Ve+=4):(r=o,0===et&&at(Ee))),r!==o?(e.substr(Ve,4)===je?(n=je,Ve+=4):(n=o,0===et&&at(qe)),n!==o&&(s=xt())!==o&&wt()!==o?t=r=Le(r,s):(Ve=t,t=o)):(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}(),a!==o?((u=vt())===o&&(u=null),u!==o?((l=lt())===o&&(l=ht()),l===o&&(l=null),l!==o?t=r=m(n,s,i,a,u,l):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o),tt[c]={nextPos:Ve,result:t},t)}(),t===o&&(t=function(){var e,t,r,n=35*Ve+7,s=tt[n];return s?(Ve=s.nextPos,s.result):(e=Ve,(t=ct())!==o&&vt()!==o?((r=ht())===o&&(r=null),r!==o?e=t=b(t,r):(Ve=e,e=o)):(Ve=e,e=o),tt[n]={nextPos:Ve,result:e},e)}(),t===o&&(t=function(){var t,r,n,s=35*Ve+9,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,e.substr(Ve,16)===x?(r=x,Ve+=16):(r=o,0===et&&at(_)),r!==o&&(n=xt())!==o&&wt()!==o?t=r=P(n):(Ve=t,t=o),tt[s]={nextPos:Ve,result:t},t)}(),t===o&&(t=function(){var e,t,r,n,s=35*Ve+2,i=tt[s];return i?(Ve=i.nextPos,i.result):(e=Ve,(t=mt())!==o?((r=bt())===o&&(r=null),r!==o?((n=pt())===o&&(n=null),n!==o&&lt()!==o?e=t=h(t,r):(Ve=e,e=o)):(Ve=e,e=o)):(Ve=e,e=o),tt[s]={nextPos:Ve,result:e},e)}(),t===o&&(t=function(){var e,t,r,n,s=35*Ve+4,i=tt[s];return i?(Ve=i.nextPos,i.result):(e=Ve,(t=mt())!==o?((r=bt())===o&&(r=null),r!==o?((n=ht())===o&&(n=null),n!==o?e=t=d(t,r,n):(Ve=e,e=o)):(Ve=e,e=o)):(Ve=e,e=o),tt[s]={nextPos:Ve,result:e},e)}()))))),tt[r]={nextPos:Ve,result:t},t)}function lt(){var t,r,n,s,i=35*Ve+3,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,e.substr(Ve,13)===p?(r=p,Ve+=13):(r=o,0===et&&at(f)),r!==o&&(n=xt())!==o&&(s=wt())!==o?t=r=[r,n,s]:(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}function ct(){var t,r,n,s=35*Ve+8,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,e.substr(Ve,10)===y?(r=y,Ve+=10):(r=o,0===et&&at(v)),r!==o&&(n=xt())!==o&&wt()!==o?t=r=w(n):(Ve=t,t=o),tt[s]={nextPos:Ve,result:t},t)}function ht(){var e,t,r,n,s=35*Ve+10,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(e=Ve,(t=pt())!==o){for(r=[],n=ft();n!==o;)r.push(n),n=ft();r!==o?e=t=k(t,r):(Ve=e,e=o)}else Ve=e,e=o;return tt[s]={nextPos:Ve,result:e},e}function pt(){var t,r,n,s,i,a=35*Ve+11,u=tt[a];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,4)===S?(r=S,Ve+=4):(r=o,0===et&&at(C)),r!==o&&(n=xt())!==o&&wt()!==o?(e.substr(Ve,4)===A?(s=A,Ve+=4):(s=o,0===et&&at(R)),s!==o&&(i=xt())!==o&&wt()!==o?t=r=E(n,i):(Ve=t,t=o)):(Ve=t,t=o),tt[a]={nextPos:Ve,result:t},t)}function ft(){var t,r,n,s,i=35*Ve+12,a=tt[i];if(a)return Ve=a.nextPos,a.result;if(t=Ve,r=function(){var t,r=35*Ve+13,n=tt[r];return n?(Ve=n.nextPos,n.result):(t=function(){var t,r,n,s,i,a,u,l,c,h=35*Ve+14,p=tt[h];return p?(Ve=p.nextPos,p.result):(t=Ve,e.substr(Ve,5)===F?(r=F,Ve+=5):(r=o,0===et&&at(L)),r!==o&&(n=dt())!==o?(e.substr(Ve,2)===j?(s=j,Ve+=2):(s=o,0===et&&at(q)),s!==o&&(i=dt())!==o?(e.substr(Ve,2)===M?(a=M,Ve+=2):(a=o,0===et&&at(T)),a!==o&&(u=dt())!==o?(e.substr(Ve,4)===$?(l=$,Ve+=4):(l=o,0===et&&at(B)),l!==o?((c=xt())===o&&(c=null),c!==o&&wt()!==o?t=r=U(n,i,u,c):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o),tt[h]={nextPos:Ve,result:t},t)}(),t===o&&(t=function(){var t,r,n,s,i,a,u,l=35*Ve+15,c=tt[l];return c?(Ve=c.nextPos,c.result):(t=Ve,e.substr(Ve,4)===N?(r=N,Ve+=4):(r=o,0===et&&at(D)),r!==o&&(n=dt())!==o?(e.substr(Ve,2)===M?(s=M,Ve+=2):(s=o,0===et&&at(T)),s!==o&&(i=dt())!==o?(e.substr(Ve,3)===z?(a=z,Ve+=3):(a=o,0===et&&at(I)),a!==o?((u=xt())===o&&(u=null),u!==o&&wt()!==o?t=r=W(n,i,u):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o),tt[l]={nextPos:Ve,result:t},t)}()),tt[r]={nextPos:Ve,result:t},t)}(),r!==o){if(n=[],(s=gt())!==o)for(;s!==o;)n.push(s),s=gt();else n=o;n!==o?t=r=O(r,n):(Ve=t,t=o)}else Ve=t,t=o;return tt[i]={nextPos:Ve,result:t},t}function dt(){var t,r,n,s,i=35*Ve+16,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,(r=Pt())!==o?(44===e.charCodeAt(Ve)?(n=H,Ve++):(n=o,0===et&&at(G)),n!==o&&(s=Pt())!==o?t=r=J(r,s):(Ve=t,t=o)):(Ve=t,t=o),t===o&&(t=Ve,(r=Pt())!==o&&(r=K(r)),t=r),tt[i]={nextPos:Ve,result:t},t)}function gt(){var t,r,n,s,i=35*Ve+17,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,r=Ve,43===e.charCodeAt(Ve)?(n=Y,Ve++):(n=o,0===et&&at(V)),n===o&&(45===e.charCodeAt(Ve)?(n=X,Ve++):(n=o,0===et&&at(Z)),n===o&&(32===e.charCodeAt(Ve)?(n=Q,Ve++):(n=o,0===et&&at(ee)),n===o&&(92===e.charCodeAt(Ve)?(n=te,Ve++):(n=o,0===et&&at(re))))),n!==o?((s=xt())===o&&(s=null),s!==o?r=n=[n,s]:(Ve=r,r=o)):(Ve=r,r=o),r!==o&&(n=wt())!==o?t=r=ne(r):(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}function mt(){var t,r,n,s,i,a=35*Ve+18,u=tt[a];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,5)===se?(r=se,Ve+=5):(r=o,0===et&&at(ie)),r!==o&&(n=_t())!==o?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=o,0===et&&at(ee)),s!==o?(i=function(){var e,t,r=35*Ve+20,n=tt[r];return n?(Ve=n.nextPos,n.result):(Ve,(t=xt())!==o&&(t=oe(t)),e=t,tt[r]={nextPos:Ve,result:e},e)}(),i!==o&&wt()!==o?t=r=ae(n,i):(Ve=t,t=o)):(Ve=t,t=o)):(Ve=t,t=o),tt[a]={nextPos:Ve,result:t},t)}function bt(){var t,r,n,s=35*Ve+22,i=tt[s];return i?(Ve=i.nextPos,i.result):(t=Ve,r=function(){var t,r,n,s,i=35*Ve+23,a=tt[i];return a?(Ve=a.nextPos,a.result):(t=Ve,e.substr(Ve,3)===de?(r=de,Ve+=3):(r=o,0===et&&at(ge)),r===o&&(e.substr(Ve,7)===me?(r=me,Ve+=7):(r=o,0===et&&at(be))),r!==o?(e.substr(Ve,11)===ye?(n=ye,Ve+=11):(n=o,0===et&&at(ve)),n!==o&&(s=xt())!==o&&wt()!==o?t=r=we(r,s):(Ve=t,t=o)):(Ve=t,t=o),tt[i]={nextPos:Ve,result:t},t)}(),r===o&&(r=yt()),r===o&&(r=null),r!==o?((n=vt())===o&&(n=null),n!==o?t=r=fe(r,n):(Ve=t,t=o)):(Ve=t,t=o),tt[s]={nextPos:Ve,result:t},t)}function yt(){var t,r,n,s,i,a=35*Ve+24,u=tt[a];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,9)===xe?(r=xe,Ve+=9):(r=o,0===et&&at(_e)),r!==o&&(n=xt())!==o&&wt()!==o?(e.substr(Ve,9)===Pe?(s=Pe,Ve+=9):(s=o,0===et&&at(ke)),s!==o&&(i=xt())!==o&&wt()!==o?t=r=Se(n,i):(Ve=t,t=o)):(Ve=t,t=o),tt[a]={nextPos:Ve,result:t},t)}function vt(){var t,r,n,s,i,a=35*Ve+27,u=tt[a];return u?(Ve=u.nextPos,u.result):(t=Ve,e.substr(Ve,6)===Me?(r=Me,Ve+=6):(r=o,0===et&&at(Te)),r!==o&&(n=_t())!==o?(32===e.charCodeAt(Ve)?(s=Q,Ve++):(s=o,0===et&&at(ee)),s!==o&&(i=xt())!==o&&wt()!==o?t=r=$e(i):(Ve=t,t=o)):(Ve=t,t=o),t===o&&(t=Ve,e.substr(Ve,6)===Me?(r=Me,Ve+=6):(r=o,0===et&&at(Te)),r!==o&&(n=_t())!==o&&(s=wt())!==o?t=r=[r,n,s]:(Ve=t,t=o)),tt[a]={nextPos:Ve,result:t},t)}function wt(){var t,r=35*Ve+29,n=tt[r];return n?(Ve=n.nextPos,n.result):(10===e.charCodeAt(Ve)?(t=Be,Ve++):(t=o,0===et&&at(Ue)),t===o&&(e.substr(Ve,2)===Ne?(t=Ne,Ve+=2):(t=o,0===et&&at(De))),t===o&&(t=function(){var t,r,n=35*Ve+31,s=tt[n];return s?(Ve=s.nextPos,s.result):(t=Ve,et++,e.length>Ve?(r=e.charAt(Ve),Ve++):(r=o,0===et&&at(ze)),et--,r===o?t=void 0:(Ve=t,t=o),tt[n]={nextPos:Ve,result:t},t)}()),tt[r]={nextPos:Ve,result:t},t)}function xt(){var t,r,n,s=35*Ve+32,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],Ie.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(We)),n!==o)for(;n!==o;)r.push(n),Ie.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(We));else r=o;return r!==o&&(r=ne(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function _t(){var t,r,n,s=35*Ve+33,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],He.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(Ge)),n!==o)for(;n!==o;)r.push(n),He.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(Ge));else r=o;return r!==o&&(r=ne(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function Pt(){var t,r,n,s=35*Ve+34,i=tt[s];if(i)return Ve=i.nextPos,i.result;if(Ve,r=[],Je.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(Ke)),n!==o)for(;n!==o;)r.push(n),Je.test(e.charAt(Ve))?(n=e.charAt(Ve),Ve++):(n=o,0===et&&at(Ke));else r=o;return r!==o&&(r=Ye(r)),t=r,tt[s]={nextPos:Ve,result:t},t}function kt(e,t,r,n){if(t.old_mode&&!t.new_mode)return{newPath:null,oldPath:e.file_name,newMode:null,oldMode:t.old_mode,hunks:r?r.hunks:[],status:"deleted",binary:!!n};if(!t.old_mode&&t.new_mode)return{oldPath:null,newPath:e.file_name,oldMode:null,newMode:t.new_mode,hunks:r?r.hunks:[],status:"added",binary:!!n};if(t.old_mode&&t.new_mode)return{newPath:e.file_name,oldPath:e.file_name,oldMode:t.old_mode,newMode:t.new_mode,hunks:r?r.hunks:[],status:"modified",binary:!!n};throw new Error("file modes missing")}function St(e,t,r){return(t=t||{}).filePath=e,t.status="unmerged",t.binary=!!r,t}if((n=l())!==o&&Ve===e.length)return n;throw n!==o&&Ve<e.length&&at({type:"end"}),s=Qe,i=Ze<e.length?e.charAt(Ze):null,a=Ze<e.length?it(Ze,Ze+1):it(Ze,Ze),new t(t.buildMessage(s,i),s,i,a)}}},8928(e,t,r){var n=r(9986);e.exports=function(e){return e?("{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),m(function(e){return e.split("\\\\").join(s).split("\\{").join(i).split("\\}").join(a).split("\\,").join(o).split("\\.").join(u)}(e),!0).map(c)):[]};var s="\0SLASH"+Math.random()+"\0",i="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",o="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function c(e){return e.split(s).join("\\").split(i).join("{").split(a).join("}").split(o).join(",").split(u).join(".")}function h(e){if(!e)return[""];var t=[],r=n("{","}",e);if(!r)return e.split(",");var s=r.pre,i=r.body,a=r.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var u=h(a);return a.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),t.push.apply(t,o),t}function p(e){return"{"+e+"}"}function f(e){return/^-?0\d/.test(e)}function d(e,t){return e<=t}function g(e,t){return e>=t}function m(e,t){var r=[],s=n("{","}",e);if(!s)return[e];var i=s.pre,o=s.post.length?m(s.post,!1):[""];if(/\$$/.test(s.pre))for(var u=0;u<o.length;u++){var c=i+"{"+s.body+"}"+o[u];r.push(c)}else{var b,y,v=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),w=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),x=v||w,_=s.body.indexOf(",")>=0;if(!x&&!_)return s.post.match(/,(?!,).*\}/)?m(e=s.pre+"{"+s.body+a+s.post):[e];if(x)b=s.body.split(/\.\./);else if(1===(b=h(s.body)).length&&1===(b=m(b[0],!1).map(p)).length)return o.map(function(e){return s.pre+b[0]+e});if(x){var P=l(b[0]),k=l(b[1]),S=Math.max(b[0].length,b[1].length),C=3==b.length?Math.abs(l(b[2])):1,A=d;k<P&&(C*=-1,A=g);var R=b.some(f);y=[];for(var E=P;A(E,k);E+=C){var O;if(w)"\\"===(O=String.fromCharCode(E))&&(O="");else if(O=String(E),R){var F=S-O.length;if(F>0){var L=new Array(F+1).join("0");O=E<0?"-"+L+O.slice(1):L+O}}y.push(O)}}else{y=[];for(var j=0;j<b.length;j++)y.push.apply(y,m(b[j],!1))}for(j=0;j<y.length;j++)for(u=0;u<o.length;u++)c=i+y[j]+o[u],(!t||x||c)&&r.push(c)}return r}},4119(e){"use strict";e.exports=n},8110(e){"use strict";e.exports=r},7434(e){"use strict";e.exports=s},7125(e){"use strict";e.exports=t},3135(t){"use strict";t.exports=e},6171(e){"use strict";e.exports=i}},o={};function u(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return a[e].call(r.exports,r,r.exports,u),r.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var l={};return(()=>{"use strict";u.d(l,{DecapCmsBackendBitbucket:()=>nt});var e,t,r=u(3554),n=u.n(r),s=u(959),i=u.n(s),a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=(e=["",""],t=["",""],Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))),c=function(){function e(){for(var t=this,r=arguments.length,n=Array(r),s=0;s<r;s++)n[s]=arguments[s];return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tag=function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return"function"==typeof e?t.interimTag.bind(t,e):"string"==typeof e?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return"function"==typeof e?e():e}),this.tag}return a(e,[{key:"interimTag",value:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];return this.tag(o,e.apply(void 0,[t].concat(n)))}},{key:"processSubstitutions",value:function(e,t,r){var n=this.transformSubstitution(e.shift(),t);return"".concat(t,n,r)}},{key:"transformString",value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:"transformSubstitution",value:function(e,t){return this.transformers.reduce(function(e,r){return r.onSubstitution?r.onSubstitution(e,t):e},e)}},{key:"transformEndResult",value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}();const h=c;var p={separator:"",conjunction:"",serial:!1};const f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;return{onSubstitution:function(t,r){if(Array.isArray(t)){var n=t.length,s=e.separator,i=e.conjunction,a=e.serial,o=r.match(/(\n?[^\S\n]+)$/);if(t=o?t.join(s+o[1]):t.join(s+" "),i&&n>1){var u=t.lastIndexOf(s);t=t.slice(0,u)+(a?s:"")+" "+i+t.slice(u+1)}}return t}}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"initial";return{onEndResult:function(t){if("initial"===e){var r=t.match(/^[^\S\n]*(?=\S)/gm),n=r&&Math.min.apply(Math,function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(r.map(function(e){return e.length})));if(n){var s=new RegExp("^.{"+n+"}","gm");return t.replace(s,"")}return t}if("all"===e)return t.replace(/^[^\S\n]+/gm,"");throw new Error("Unknown type: "+e)}}},g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return{onEndResult:function(t){if(""===e)return t.trim();if("start"===(e=e.toLowerCase())||"left"===e)return t.replace(/^\s*/,"");if("end"===e||"right"===e)return t.replace(/\s*$/,"");throw new Error("Side not supported: "+e)}}};new h(f({separator:","}),d,g),new h(f({separator:",",conjunction:"and"}),d,g),new h(f({separator:",",conjunction:"or"}),d,g);const m=function(e){return{onSubstitution:function(t,r){if(null==e||"string"!=typeof e)throw new Error("You need to specify a string character to split by.");return"string"==typeof t&&t.includes(e)&&(t=t.split(e)),t}}};var b=function(e){return null!=e&&!Number.isNaN(e)&&"boolean"!=typeof e};new h(m("\n"),function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(b):b(e)?e:""}}},f,d,g);const y=function(e,t){return{onSubstitution:function(r,n){if(null==e||null==t)throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");return null==r?r:r.toString().replace(e,t)}}};new h(m("\n"),f,d,g,y(/&/g,"&amp;"),y(/</g,"&lt;"),y(/>/g,"&gt;"),y(/"/g,"&quot;"),y(/'/g,"&#x27;"),y(/`/g,"&#x60;"));const v=function(e,t){return{onEndResult:function(r){if(null==e||null==t)throw new Error("replaceResultTransformer requires at least 2 arguments.");return r.replace(e,t)}}},w=new h(v(/(?:\n(?:\s*))+/g," "),g);new h(v(/(?:\n\s*)/g,""),g),new h(f({separator:","}),v(/(?:\s+)/g," "),g),new h(f({separator:",",conjunction:"or"}),v(/(?:\s+)/g," "),g),new h(f({separator:",",conjunction:"and"}),v(/(?:\s+)/g," "),g),new h(f,d,g),new h(f,v(/(?:\s+)/g," "),g);const x=new h(d,g);new h(d("all"),g);var _=u(3135),P=u(7125);function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(null,arguments)}var S=u(8110),C={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function A(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}var R=/[A-Z]|^ms/g,E=/_EMO_([^_]+?)_([^]*?)_EMO_/g,O=function(e){return 45===e.charCodeAt(1)},F=function(e){return null!=e&&"boolean"!=typeof e},L=A(function(e){return O(e)?e:e.replace(R,"-$&").toLowerCase()}),j=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(E,function(e,t,r){return M={name:t,styles:r,next:M},t})}return 1===C[e]||O(e)||"number"!=typeof t||0===t?t:t+"px"};function q(e,t,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var s=r;if(1===s.anim)return M={name:s.name,styles:s.styles,next:M},s.name;var i=r;if(void 0!==i.styles){var a=i.next;if(void 0!==a)for(;void 0!==a;)M={name:a.name,styles:a.styles,next:M},a=a.next;return i.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var s=0;s<r.length;s++)n+=q(e,t,r[s])+";";else for(var i in r){var a=r[i];if("object"!=typeof a){var o=a;null!=t&&void 0!==t[o]?n+=i+"{"+t[o]+"}":F(o)&&(n+=L(i)+":"+j(i,o)+";")}else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var u=q(e,t,a);switch(i){case"animation":case"animationName":n+=L(i)+":"+u+";";break;default:n+=i+"{"+u+"}"}}else for(var l=0;l<a.length;l++)F(a[l])&&(n+=L(i)+":"+j(i,a[l])+";")}return n}(e,t,r);case"function":if(void 0!==e){var o=M,u=r(e);return M=o,q(e,t,u)}}var l=r;if(null==t)return l;var c=t[l];return void 0!==c?c:l}var M,T=/label:\s*([^\s;{]+)\s*(;|$)/g,$=u(4119),B=u.n($),U=!!$.useInsertionEffect&&$.useInsertionEffect,N=U||function(e){return e()};U||$.useLayoutEffect;var D=function(e,t,r){var n=e.key+"-"+t.name;!1===r&&void 0===e.registered[n]&&(e.registered[n]=t.styles)},z=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,I=A(function(e){return z.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),W=function(e){return"theme"!==e},H=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?I:W},G=function(e,t,r){var n;if(t){var s=t.shouldForwardProp;n=e.__emotion_forwardProp&&s?function(t){return e.__emotion_forwardProp(t)&&s(t)}:s}return"function"!=typeof n&&r&&(n=e.__emotion_forwardProp),n},J=function(e){var t=e.cache,r=e.serialized,n=e.isStringTag;return D(t,r,n),N(function(){return function(e,t,r){D(e,t,r);var n=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var s=t;do{e.insert(t===s?"."+n:"",s,e.sheet,!0),s=s.next}while(void 0!==s)}}(t,r,n)}),null},K=function e(t,r){var n,s,i=t.__emotion_real===t,a=i&&t.__emotion_base||t;void 0!==r&&(n=r.label,s=r.target);var o=G(t,r,i),u=o||H(a),l=!u("as");return function(){var c=arguments,h=i&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==n&&h.push("label:"+n+";"),null==c[0]||void 0===c[0].raw)h.push.apply(h,c);else{var p=c[0];h.push(p[0]);for(var f=c.length,d=1;d<f;d++)h.push(c[d],p[d])}var g=(0,S.withEmotionCache)(function(e,t,r){var n,i,c,p,f=l&&e.as||a,d="",g=[],m=e;if(null==e.theme){for(var b in m={},e)m[b]=e[b];m.theme=$.useContext(S.ThemeContext)}"string"==typeof e.className?(n=t.registered,i=g,c=e.className,p="",c.split(" ").forEach(function(e){void 0!==n[e]?i.push(n[e]+";"):e&&(p+=e+" ")}),d=p):null!=e.className&&(d=e.className+" ");var y=function(e,t,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,s="";M=void 0;var i=e[0];null==i||void 0===i.raw?(n=!1,s+=q(r,t,i)):s+=i[0];for(var a=1;a<e.length;a++)s+=q(r,t,e[a]),n&&(s+=i[a]);T.lastIndex=0;for(var o,u="";null!==(o=T.exec(s));)u+="-"+o[1];var l=function(e){for(var t,r=0,n=0,s=e.length;s>=4;++n,s-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(s){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(s)+u;return{name:l,styles:s,next:M}}(h.concat(g),t.registered,m);d+=t.key+"-"+y.name,void 0!==s&&(d+=" "+s);var v=l&&void 0===o?H(f):u,w={};for(var x in e)l&&"as"===x||v(x)&&(w[x]=e[x]);return w.className=d,r&&(w.ref=r),$.createElement($.Fragment,null,$.createElement(J,{cache:t,serialized:y,isStringTag:"string"==typeof f}),$.createElement(f,w))});return g.displayName=void 0!==n?n:"Styled("+("string"==typeof a?a:a.displayName||a.name||"Component")+")",g.defaultProps=t.defaultProps,g.__emotion_real=g,g.__emotion_base=a,g.__emotion_styles=h,g.__emotion_forwardProp=o,Object.defineProperty(g,"toString",{value:function(){return"."+s}}),g.withComponent=function(t,n){return e(t,k({},r,n,{shouldForwardProp:G(g,n,!0)})).apply(void 0,h)},g}},Y=u(7434),V=u.n(Y),X=u(6171);const Z=K(X.Icon,{target:"e15sc0jo0",label:"LoginButtonIcon"})({name:"1gnqu05",styles:"margin-right:18px"});class Q extends B().Component{static propTypes={onLogin:V().func.isRequired,inProgress:V().bool,base_url:V().string,siteId:V().string,authEndpoint:V().string,config:V().object.isRequired,clearHash:V().func,t:V().func.isRequired};state={};componentDidMount(){V().checkPropTypes(Q.propTypes,this.props,"prop","BitbucketAuthenticationPage");const{auth_type:e=""}=this.props.config.backend;if("implicit"===e){const{base_url:e="https://bitbucket.org",auth_endpoint:t="site/oauth2/authorize",app_id:r=""}=this.props.config.backend;this.auth=new P.ImplicitAuthenticator({base_url:e,auth_endpoint:t,app_id:r,clearHash:this.props.clearHash}),this.auth.completeAuth((e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)}),this.authSettings={scope:"repository:write"}}else this.auth=new P.NetlifyAuthenticator({base_url:this.props.base_url,site_id:"localhost"===document.location.host.split(":")[0]?"demo.decapcms.org":this.props.siteId,auth_endpoint:this.props.authEndpoint}),this.authSettings={provider:"bitbucket",scope:"repo"}}handleLogin=e=>{e.preventDefault(),this.auth.authenticate(this.authSettings,(e,t)=>{e?this.setState({loginError:e.toString()}):this.props.onLogin(t)})};render(){const{inProgress:e,config:t,t:r}=this.props;return(0,S.jsx)(X.AuthenticationPage,{onLogin:this.handleLogin,loginDisabled:e,loginErrorMessage:this.state.loginError,logoUrl:t.logo_url,logo:t.logo,siteUrl:t.site_url,renderButtonContent:()=>(0,S.jsx)(B().Fragment,null,(0,S.jsx)(Z,{type:"bitbucket"}),r(e?"auth.loggingIn":"auth.loginWithBitbucket")),t:r})}}var ee=u(2879),te=u.n(ee),re=u(6123),ne=u.n(re),se=u(7330),ie=u(9942),ae=function(e){return e.MERGED="MERGED",e.SUPERSEDED="SUPERSEDED",e.OPEN="OPEN",e.DECLINED="DECLINED",e}(ae||{}),oe=function(e){return e.Successful="SUCCESSFUL",e.Failed="FAILED",e.InProgress="INPROGRESS",e.Stopped="STOPPED",e}(oe||{});const ue="Bitbucket",le="application/json; charset=utf-8";function ce(e){return e&&404===e.status?(console.log("This 404 was expected and handled appropriately."),{size:0,values:[]}):Promise.reject(e)}class he{constructor(e){this.apiRoot=e.apiRoot||"https://api.bitbucket.org/2.0",this.branch=e.branch||"master",this.repo=e.repo||"",this.requestFunction=e.requestFunction||_.unsentRequest.performRequest,this.hasWriteAccess=e.hasWriteAccess||this.hasWriteAccess,this.repoURL=this.repo?`/repositories/${this.repo}`:"",this.mergeStrategy=e.squashMerges?"squash":"merge_commit",this.initialWorkflowStatus=e.initialWorkflowStatus,this.cmsLabelPrefix=e.cmsLabelPrefix}buildRequest=e=>{const t=_.unsentRequest.withRoot(this.apiRoot)(e);return t.has("cache")?t:_.unsentRequest.withNoCache(t)};request=e=>{try{return(0,_.requestWithBackoff)(this,e)}catch(e){throw new _.APIError(e.message,null,ue)}};responseToJSON=(0,_.responseParser)({format:"json",apiName:ue});responseToBlob=(0,_.responseParser)({format:"blob",apiName:ue});responseToText=(0,_.responseParser)({format:"text",apiName:ue});requestJSON=e=>this.request(e).then(this.responseToJSON);requestText=e=>this.request(e).then(this.responseToText);user=()=>this.requestJSON("/user");hasWriteAccess=async()=>{const e=await this.request(this.repoURL);if(404===e.status)throw Error("Repo not found");return e.ok};getBranch=async e=>await this.requestJSON(`${this.repoURL}/refs/branches/${e}`);branchCommitSha=async e=>{const{target:{hash:t}}=await this.getBranch(e);return t};defaultBranchCommitSha=()=>this.branchCommitSha(this.branch);isFile=({type:e})=>"commit_file"===e;getFileId=(e,t)=>`${e}/${t}`;processFile=e=>({id:e.id,type:e.type,path:e.path,name:(0,_.basename)(e.path),...e.commit&&e.commit.hash?{id:this.getFileId(e.commit.hash,e.path)}:{}});processFiles=e=>e.filter(this.isFile).map(this.processFile);readFile=async(e,t,{parseText:r=!0,branch:n=this.branch,head:s=""}={})=>await(0,_.readFile)(t,async()=>{const t=s||await this.branchCommitSha(n);return await this.request({url:`${this.repoURL}/src/${t}/${e}`,cache:"no-store"}).then(r?this.responseToText:this.responseToBlob)},_.localForage,r);async readFileMetadata(e,t){return await(0,_.readFileMetadata)(t,async()=>{try{const{values:t}=await this.requestJSON({url:`${this.repoURL}/commits`,params:{path:e,include:this.branch}}),r=t[0];return{author:r.author.user?r.author.user.display_name||r.author.user.nickname:r.author.raw,updatedOn:r.date}}catch(e){return{author:"",updatedOn:""}}},_.localForage)}async isShaExistsInBranch(e,t){const{values:r}=await this.requestJSON({url:`${this.repoURL}/commits`,params:{include:e,pagelen:100}}).catch(t=>(console.log(`Failed getting commits for branch '${e}'`,t),[]));return r.some(e=>e.hash===t)}getEntriesAndCursor=e=>{const{size:t,page:r,pagelen:n,next:s,previous:i,values:a}=e,o=n&&t?Math.ceil(t/n):void 0;return{entries:a,cursor:_.Cursor.create({actions:[...s?["next"]:[],...i?["prev"]:[]],meta:{page:r,count:t,pageSize:n,pageCount:o},data:{links:{next:s,prev:i}}})}};listFiles=async(e,t=1,r,n)=>{const s=await this.branchCommitSha(n),i=await this.requestJSON({url:`${this.repoURL}/src/${s}/${e}`,params:{max_depth:t,pagelen:r}}).catch(ce),{entries:a,cursor:o}=this.getEntriesAndCursor(i);return{entries:this.processFiles(a),cursor:o}};traverseCursor=async(e,t)=>te()([this.requestJSON,(0,_.then)(this.getEntriesAndCursor),(0,_.then)(({cursor:e,entries:t})=>({cursor:e,entries:this.processFiles(t)}))])(e.data.getIn(["links",t]));listAllFiles=async(e,t,r)=>{const{cursor:n,entries:s}=await this.listFiles(e,t,100,r),i=[...s];let a=n;for(;a&&a.actions.has("next");){const{cursor:e,entries:t}=await this.traverseCursor(a,"next");i.push(...t),a=e}return this.processFiles(i)};async uploadFiles(e,{commitMessage:t,branch:r,parentSha:n,hasSubfolders:s=!0}){const i=new FormData,a=[];e.forEach(e=>{if(e.delete)i.append("files",e.path);else if(e.newPath){const t=ne()(e,"fileObj",new Blob([e.raw]));a.push({from:e.path,to:e.newPath,contentBlob:t,hasSubfolders:s})}else{const t=ne()(e,"fileObj",new Blob([e.raw]));i.append(e.path,t,(0,_.basename)(e.path))}});for(const{from:e,to:t,contentBlob:s,hasSubfolders:o}of a)if(o){const a=(0,ie.dirname)(e),o=(0,ie.dirname)(t),u=n?this.branch:r,l=await this.listAllFiles(a,100,u);for(const t of l){i.append("files",t.path);const r=t.path===e?s:await this.readFile(t.path,null,{branch:u,parseText:!1});i.append(t.path.replace(a,o),r,(0,_.basename)(t.path))}}else i.append("files",e),i.append(t,s,(0,_.basename)(t));if(t&&i.append("message",t),this.commitAuthor){const{name:e,email:t}=this.commitAuthor;i.append("author",`${e} <${t}>`)}i.append("branch",r),n&&i.append("parents",n);try{await this.requestText({url:`${this.repoURL}/src`,method:"POST",body:i})}catch(e){const t=e.message||"";throw n&&t.includes("Something went wrong")&&await(0,_.throwOnConflictingBranches)(r,e=>this.getBranch(e),ue),e}return e}async persistFiles(e,t,r){const n=[...e,...t],s=!1!==r.hasSubfolders;if(r.useWorkflow){const t=e[0].slug;return this.editorialWorkflowGit(n,t,r)}return this.uploadFiles(n,{commitMessage:r.commitMessage,branch:this.branch,hasSubfolders:s})}async addPullRequestComment(e,t){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/comments`,headers:{"Content-Type":le},body:JSON.stringify({content:{raw:t}})})}async getPullRequestLabel(e){const t=await this.requestJSON({url:`${this.repoURL}/pullrequests/${e}/comments`,params:{pagelen:100}});return t.values.map(e=>e.content.raw)[t.values.length-1]}async createPullRequest(e,t,r){const n=await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests`,headers:{"Content-Type":le},body:JSON.stringify({title:t,source:{branch:{name:e}},destination:{branch:{name:this.branch}},description:_.DEFAULT_PR_BODY,close_source_branch:!0})});await this.addPullRequestComment(n,(0,_.statusToLabel)(r,this.cmsLabelPrefix))}async getDifferences(e,t=this.branch){if(e===t)return[];const r=await this.requestText({url:`${this.repoURL}/diff/${e}..${t}`,params:{binary:!1}});return(0,se.parse)(r).map(e=>{const t=e.oldPath?.replace(/b\//,"")||"",r=e.newPath?.replace(/b\//,"")||"",n=r||t;return{oldPath:t,newPath:r,status:e.status,newFile:"added"===e.status,path:n,binary:e.binary||/.svg$/.test(n)}})}async editorialWorkflowGit(e,t,r){const n=(0,_.generateContentKey)(r.collectionName,t),s=(0,_.branchFromContentKey)(n),i=r.unpublished||!1,a=!1!==r.hasSubfolders;if(i){const t=await this.getDifferences(s),n=[];for(const r of t.filter(e=>e.binary&&"deleted"!==e.status))e.some(e=>e.path===r.path)||n.push({path:r.path,delete:!0});await this.uploadFiles([...e,...n],{commitMessage:r.commitMessage,branch:s,hasSubfolders:a})}else{const t=await this.branchCommitSha(this.branch);await this.uploadFiles(e,{commitMessage:r.commitMessage,branch:s,parentSha:t,hasSubfolders:a}),await this.createPullRequest(s,r.commitMessage,r.status||this.initialWorkflowStatus)}}deleteFiles=(e,t)=>{const r=new FormData;if(e.forEach(e=>{r.append("files",e)}),r.append("branch",this.branch),t&&r.append("message",t),this.commitAuthor){const{name:e,email:t}=this.commitAuthor;r.append("author",`${e} <${t}>`)}return te()([_.unsentRequest.withMethod("POST"),_.unsentRequest.withBody(r),this.request])(`${this.repoURL}/src`)};async getPullRequests(e){const t=e?`source.branch.name = "${e}"`:`source.branch.name ~ "${_.CMS_BRANCH_PREFIX}/"`,r=await this.requestJSON({url:`${this.repoURL}/pullrequests`,params:{pagelen:50,q:w`
2
2
  source.repository.full_name = "${this.repo}"
3
- AND state = "${oe.OPEN}"
3
+ AND state = "${ae.OPEN}"
4
4
  AND destination.branch.name = "${this.branch}"
5
5
  AND comment_count > 0
6
6
  AND ${t}
7
- `}}),n=await Promise.all(r.values.map(e=>this.getPullRequestLabel(e.id)));return r.values.filter((e,t)=>(0,_.isCMSLabel)(n[t],this.cmsLabelPrefix))}async getBranchPullRequest(e){const t=await this.getPullRequests(e);if(t.length<=0)throw new _.EditorialWorkflowError("content is not under editorial workflow",!0);return t[0]}async listUnpublishedBranches(){return console.log("%c Checking for Unpublished entries","line-height: 30px;text-align: center;font-weight: bold"),(await this.getPullRequests()).map(e=>e.source.branch.name)}async retrieveUnpublishedEntryData(e){const{collection:t,slug:r}=(0,_.parseContentKey)(e),n=(0,_.branchFromContentKey)(e),s=await this.getBranchPullRequest(n),i=await this.getDifferences(n),o=await this.getPullRequestLabel(s.id),a=(0,_.labelToStatus)(o,this.cmsLabelPrefix),u=s.updated_on,l=s.author.display_name;return{collection:t,slug:r,status:a,diffs:i.filter(e=>"deleted"!==e.status).map(e=>({path:e.path,newFile:e.newFile,id:""})),updatedAt:u,pullRequestAuthor:l}}async updateUnpublishedEntryStatus(e,t,r){const n=(0,_.generateContentKey)(e,t),s=(0,_.branchFromContentKey)(n),i=await this.getBranchPullRequest(s);await this.addPullRequestComment(i,(0,_.statusToLabel)(r,this.cmsLabelPrefix))}async mergePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/merge`,headers:{"Content-Type":le},body:JSON.stringify({message:_.MERGE_COMMIT_MESSAGE,close_source_branch:!0,merge_strategy:this.mergeStrategy})})}async publishUnpublishedEntry(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);await this.mergePullRequest(s)}async declinePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/decline`})}async deleteBranch(e){await this.request({method:"DELETE",url:`${this.repoURL}/refs/branches/${e}`})}async deleteUnpublishedEntry(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);await this.declinePullRequest(s),await this.deleteBranch(n)}async getPullRequestStatuses(e){return(await this.requestJSON({url:`${this.repoURL}/pullrequests/${e.id}/statuses`,params:{pagelen:100}})).values}async getStatuses(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);return(await this.getPullRequestStatuses(s)).map(({key:e,state:t,url:r})=>({context:e,state:t===ae.Successful?_.PreviewState.Success:_.PreviewState.Other,target_url:r}))}async getUnpublishedEntrySha(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r);return(await this.getBranchPullRequest(n)).destination.commit.hash}}var pe=u(8928);const fe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},de=e=>e.replace(/[[\]\\-]/g,"\\$&"),ge=e=>e.join(""),me=(e,t)=>{const r=t;if("["!==e.charAt(r))throw new Error("not in a brace expression");const n=[],s=[];let i=r+1,o=!1,a=!1,u=!1,l=!1,c=r,h="";e:for(;i<e.length;){const t=e.charAt(i);if("!"!==t&&"^"!==t||i!==r+1){if("]"===t&&o&&!u){c=i+1;break}if(o=!0,"\\"!==t||u){if("["===t&&!u)for(const[t,[o,u,l]]of Object.entries(fe))if(e.startsWith(t,i)){if(h)return["$.",!1,e.length-r,!0];i+=t.length,l?s.push(o):n.push(o),a=a||u;continue e}u=!1,h?(t>h?n.push(de(h)+"-"+de(t)):t===h&&n.push(de(t)),h="",i++):e.startsWith("-]",i+1)?(n.push(de(t+"-")),i+=2):e.startsWith("-",i+1)?(h=t,i+=2):(n.push(de(t)),i++)}else u=!0,i++}else l=!0,i++}if(c<i)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(0===s.length&&1===n.length&&/^\\?.$/.test(n[0])&&!l){return[(p=2===n[0].length?n[0].slice(-1):n[0],p.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,c-r,!1]}var p;const f="["+(l?"^":"")+ge(n)+"]",d="["+(l?"":"^")+ge(s)+"]";return[n.length&&s.length?"("+f+"|"+d+")":n.length?f:d,a,c-r,!0]},be=(e,t,r={})=>(Ke(t),!(!r.nocomment&&"#"===t.charAt(0))&&new Xe(t,r).match(e)),ye=/^\*+([^+@!?\*\[\(]*)$/,ve=e=>t=>!t.startsWith(".")&&t.endsWith(e),we=e=>t=>t.endsWith(e),xe=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),_e=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Pe=/^\*+\.\*+$/,ke=e=>!e.startsWith(".")&&e.includes("."),Se=e=>"."!==e&&".."!==e&&e.includes("."),Ce=/^\.\*+$/,Ae=e=>"."!==e&&".."!==e&&e.startsWith("."),Re=/^\*+$/,Ee=e=>0!==e.length&&!e.startsWith("."),Oe=e=>0!==e.length&&"."!==e&&".."!==e,Fe=/^\?+([^+@!?\*\[\(]*)?$/,Le=([e,t=""])=>{const r=Te([e]);return t?(t=t.toLowerCase(),e=>r(e)&&e.toLowerCase().endsWith(t)):r},je=([e,t=""])=>{const r=$e([e]);return t?(t=t.toLowerCase(),e=>r(e)&&e.toLowerCase().endsWith(t)):r},qe=([e,t=""])=>{const r=$e([e]);return t?e=>r(e)&&e.endsWith(t):r},Me=([e,t=""])=>{const r=Te([e]);return t?e=>r(e)&&e.endsWith(t):r},Te=([e])=>{const t=e.length;return e=>e.length===t&&!e.startsWith(".")},$e=([e])=>{const t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},Be="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";be.sep="win32"===Be?"\\":"/";const Ue=Symbol("globstar **");be.GLOBSTAR=Ue;const Ne={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},De="[^/]",ze=De+"*?",Ie=e=>e.split("").reduce((e,t)=>(e[t]=!0,e),{}),We=Ie("().*{}+?[]^$\\!"),He=Ie("[.(");be.filter=(e,t={})=>r=>be(r,e,t);const Ge=(e,t={})=>Object.assign({},e,t);be.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return be;const t=be;return Object.assign((r,n,s={})=>t(r,n,Ge(e,s)),{Minimatch:class extends t.Minimatch{constructor(t,r={}){super(t,Ge(e,r))}static defaults(r){return t.defaults(Ge(e,r)).Minimatch}},unescape:(r,n={})=>t.unescape(r,Ge(e,n)),escape:(r,n={})=>t.escape(r,Ge(e,n)),filter:(r,n={})=>t.filter(r,Ge(e,n)),defaults:r=>t.defaults(Ge(e,r)),makeRe:(r,n={})=>t.makeRe(r,Ge(e,n)),braceExpand:(r,n={})=>t.braceExpand(r,Ge(e,n)),match:(r,n,s={})=>t.match(r,n,Ge(e,s)),sep:t.sep,GLOBSTAR:Ue})};const Je=(e,t={})=>(Ke(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:pe(e));be.braceExpand=Je;const Ke=e=>{if("string"!=typeof e)throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};be.makeRe=(e,t={})=>new Xe(e,t).makeRe(),be.match=(e,t,r={})=>{const n=new Xe(t,r);return e=e.filter(e=>n.match(e)),n.options.nonull&&!e.length&&e.push(t),e};const Ye=/[?*]|[+@!]\(.*?\)|\[|\]/,Ve=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Xe{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){Ke(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Be,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const e of this.set)for(const t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){const e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);const r=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let n=this.globParts.map((e,t,r)=>{if(this.isWindows&&this.windowsNoMagicRoot){const t=!(""!==e[0]||""!==e[1]||"?"!==e[2]&&Ye.test(e[2])||Ye.test(e[3])),r=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(r)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,n),this.set=n.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e<this.set.length;e++){const t=this.set[e];""===t[0]&&""===t[1]&&"?"===this.globParts[e][2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])&&(t[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let r=0;r<e[t].length;r++)"**"===e[t][r]&&(e[t][r]="*");const{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let r=t;for(;"**"===e[r+1];)r++;r!==t&&e.splice(t,r-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{const r=e[e.length-1];return"**"===t&&"**"===r?e:".."===t&&r&&".."!==r&&"."!==r&&"**"!==r?(e.pop(),e):(e.push(t),e)},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let r=1;r<e.length-1;r++){const n=e[r];1===r&&""===n&&""===e[0]||"."!==n&&""!==n||(t=!0,e.splice(r,1),r--)}"."!==e[0]||2!==e.length||"."!==e[1]&&""!==e[1]||(t=!0,e.pop())}let r=0;for(;-1!==(r=e.indexOf("..",r+1));){const n=e[r-1];n&&"."!==n&&".."!==n&&"**"!==n&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return 0===e.length?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let n=-1;for(;-1!==(n=r.indexOf("**",n+1));){let s=n;for(;"**"===r[s+1];)s++;s>n&&r.splice(n+1,s-n);let i=r[n+1];const o=r[n+2],a=r[n+3];if(".."!==i)continue;if(!o||"."===o||".."===o||!a||"."===a||".."===a)continue;t=!0,r.splice(n,1);const u=r.slice(0);u[n]="**",e.push(u),n--}if(!this.preserveMultipleSlashes){for(let e=1;e<r.length-1;e++){const n=r[e];1===e&&""===n&&""===r[0]||"."!==n&&""!==n||(t=!0,r.splice(e,1),e--)}"."!==r[0]||2!==r.length||"."!==r[1]&&""!==r[1]||(t=!0,r.pop())}let s=0;for(;-1!==(s=r.indexOf("..",s+1));){const e=r[s-1];if(e&&"."!==e&&".."!==e&&"**"!==e){t=!0;const e=1===s&&"**"===r[s+1]?["."]:[];r.splice(s-1,2,...e),0===r.length&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){const n=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);n&&(e[t]=n,e[r]=[])}return e.filter(e=>e.length)}partsMatch(e,t,r=!1){let n=0,s=0,i=[],o="";for(;n<e.length&&s<t.length;)if(e[n]===t[s])i.push("b"===o?t[s]:e[n]),n++,s++;else if(r&&"**"===e[n]&&t[s]===e[n+1])i.push(e[n]),n++;else if(r&&"**"===t[s]&&e[n]===t[s+1])i.push(t[s]),s++;else if("*"!==e[n]||!t[s]||!this.options.dot&&t[s].startsWith(".")||"**"===t[s]){if("*"!==t[s]||!e[n]||!this.options.dot&&e[n].startsWith(".")||"**"===e[n])return!1;if("a"===o)return!1;o="b",i.push(t[s]),n++,s++}else{if("b"===o)return!1;o="a",i.push(e[n]),n++,s++}return e.length===t.length&&i}parseNegate(){if(this.nonegate)return;const e=this.pattern;let t=!1,r=0;for(let n=0;n<e.length&&"!"===e.charAt(n);n++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){const n=this.options;if(this.isWindows){const r=""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3]),n=""===t[0]&&""===t[1]&&"?"===t[2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3]);if(r&&n){const r=e[3],n=t[3];r.toLowerCase()===n.toLowerCase()&&(e[3]=n)}else if(n&&"string"==typeof e[0]){const r=t[3],n=e[0];r.toLowerCase()===n.toLowerCase()&&(t[3]=n,t=t.slice(3))}else if(r&&"string"==typeof t[0]){const r=e[3];r.toLowerCase()===t[0].toLowerCase()&&(t[0]=r,e=e.slice(3))}}const{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,o=0,a=e.length,u=t.length;i<a&&o<u;i++,o++){this.debug("matchOne loop");var l=t[o],c=e[i];if(this.debug(t,l,c),!1===l)return!1;if(l===Ue){this.debug("GLOBSTAR",[t,l,c]);var h=i,p=o+1;if(p===u){for(this.debug("** at the end");i<a;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;h<a;){var f=e[h];if(this.debug("\nglobstar while",e,h,t,p,f),this.matchOne(e.slice(h),t.slice(p),r))return this.debug("globstar found match!",h,a,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,h,t,p);break}this.debug("globstar swallow a segment, and continue"),h++}return!(!r||(this.debug("\n>>> no match, partial?",e,h,t,p),h!==a))}let s;if("string"==typeof l?(s=c===l,this.debug("string match",l,c,s)):(s=l.test(c),this.debug("pattern match",l,c,s)),!s)return!1}if(i===a&&o===u)return!0;if(i===a)return r;if(o===u)return i===a-1&&""===e[i];throw new Error("wtf?")}braceExpand(){return Je(this.pattern,this.options)}parse(e){Ke(e);const t=this.options;if("**"===e)return Ue;if(""===e)return"";let r,n=null;(r=e.match(Re))?n=t.dot?Oe:Ee:(r=e.match(ye))?n=(t.nocase?t.dot?_e:xe:t.dot?we:ve)(r[1]):(r=e.match(Fe))?n=(t.nocase?t.dot?je:Le:t.dot?qe:Me)(r):(r=e.match(Pe))?n=t.dot?Se:ke:(r=e.match(Ce))&&(n=Ae);let s="",i=!1,o=!1;const a=[],u=[];let l,c=!1,h=!1,p="."===e.charAt(0),f=t.dot||p;const d=e=>"."===e.charAt(0)?"":t.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=()=>{if(c){switch(c){case"*":s+=ze,i=!0;break;case"?":s+=De,i=!0;break;default:s+="\\"+c}this.debug("clearStateChar %j %j",c,s),c=!1}};for(let r,n=0;n<e.length&&(r=e.charAt(n));n++)if(this.debug("%s\t%s %s %j",e,n,s,r),o){if("/"===r)return!1;We[r]&&(s+="\\"),s+=r,o=!1}else switch(r){case"/":return!1;case"\\":g(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":this.debug("%s\t%s %s %j <-- stateChar",e,n,s,r),this.debug("call clearStateChar %j",c),g(),c=r,t.noext&&g();continue;case"(":{if(!c){s+="\\(";continue}const t={type:c,start:n-1,reStart:s.length,open:Ne[c].open,close:Ne[c].close};this.debug(this.pattern,"\t",t),a.push(t),s+=t.open,0===t.start&&"!"!==t.type&&(p=!0,s+=d(e.slice(n+1))),this.debug("plType %j %j",c,s),c=!1;continue}case")":{const e=a[a.length-1];if(!e){s+="\\)";continue}a.pop(),g(),i=!0,l=e,s+=l.close,"!"===l.type&&u.push(Object.assign(l,{reEnd:s.length}));continue}case"|":{const t=a[a.length-1];if(!t){s+="\\|";continue}g(),s+="|",0===t.start&&"!"!==t.type&&(p=!0,s+=d(e.slice(n+1)));continue}case"[":g();const[f,m,b,y]=me(e,n);b?(s+=f,h=h||m,n+=b-1,i=i||y):s+="\\[";continue;case"]":s+="\\"+r;continue;default:g(),s+=Ve(r)}for(l=a.pop();l;l=a.pop()){let e;e=s.slice(l.reStart+l.open.length),this.debug(this.pattern,"setting tail",s,l),e=e.replace(/((?:\\{2}){0,64})(\\?)\|/g,(e,t,r)=>(r||(r="\\"),t+t+r+"|")),this.debug("tail=%j\n %s",e,e,l,s);const t="*"===l.type?ze:"?"===l.type?De:"\\"+l.type;i=!0,s=s.slice(0,l.reStart)+t+"\\("+e}g(),o&&(s+="\\\\");const m=He[s.charAt(0)];for(let e=u.length-1;e>-1;e--){const t=u[e],r=s.slice(0,t.reStart),n=s.slice(t.reStart,t.reEnd-8);let i=s.slice(t.reEnd);const o=s.slice(t.reEnd-8,t.reEnd)+i,a=r.split(")").length,l=r.split("(").length-a;let c=i;for(let e=0;e<l;e++)c=c.replace(/\)[+*?]?/,"");i=c,s=r+n+i+(""===i?"(?:$|\\/)":"")+o}if(""!==s&&i&&(s="(?=.)"+s),m&&(s=(p?"":f?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)")+s),!t.nocase||i||t.nocaseMagicOnly||(i=e.toUpperCase()!==e.toLowerCase()),!i)return s.replace(/\\(.)/g,"$1");const b=(t.nocase?"i":"")+(h?"u":"");try{const t=n?{_glob:e,_src:s,test:n}:{_glob:e,_src:s};return Object.assign(new RegExp("^"+s+"$",b),t)}catch(e){return this.debug("invalid regexp",e),new RegExp("$.")}}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const e=this.set;if(!e.length)return this.regexp=!1,this.regexp;const t=this.options,r=t.noglobstar?ze:t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",n=t.nocase?"i":"";let s=e.map(e=>{const t=e.map(e=>"string"==typeof e?Ve(e):e===Ue?Ue:e._src);return t.forEach((e,n)=>{const s=t[n+1],i=t[n-1];e===Ue&&i!==Ue&&(void 0===i?void 0!==s&&s!==Ue?t[n+1]="(?:\\/|"+r+"\\/)?"+s:t[n]=r:void 0===s?t[n-1]=i+"(?:\\/|"+r+")?":s!==Ue&&(t[n-1]=i+"(?:\\/|\\/"+r+"\\/)"+s,t[n+1]=Ue))}),t.filter(e=>e!==Ue).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;const r=this.options;this.isWindows&&(e=e.split("\\").join("/"));const n=this.slashSplit(e);this.debug(this.pattern,"split",n);const s=this.set;this.debug(this.pattern,"set",s);let i=n[n.length-1];if(!i)for(let e=n.length-2;!i&&e>=0;e--)i=n[e];for(let e=0;e<s.length;e++){const o=s[e];let a=n;if(r.matchBase&&1===o.length&&(a=[i]),this.matchOne(a,o,t))return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate}static defaults(e){return be.defaults(e).Minimatch}}be.Minimatch=Xe,be.escape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),be.unescape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");class Ze{static defaultContentHeaders={Accept:"application/vnd.git-lfs+json","Content-Type":"application/vnd.git-lfs+json"};constructor(e,t,r,n){this.enabled=e,this.rootURL=t,this.patterns=r,this.makeAuthorizedRequest=n}matchPath(e){return this.patterns.some(t=>be(e,t,{matchBase:!0}))}async uploadResource(e,t){const r=await this.getResourceUploadRequests([e]);for(const e of r)await this.doUpload(e.actions.upload,t),e.actions.verify&&await this.doVerify(e.actions.verify,e);return e.sha}async doUpload(e,t){await _.unsentRequest.fetchWithTimeout(decodeURI(e.href),{method:"PUT",body:t,headers:e.header})}async doVerify(e,t){this.makeAuthorizedRequest({url:decodeURI(e.href),method:"POST",headers:{...Ze.defaultContentHeaders,...e.header},body:JSON.stringify({oid:t.oid,size:t.size})})}async getResourceUploadRequests(e){const t=await this.makeAuthorizedRequest({url:`${this.rootURL}/objects/batch`,method:"POST",headers:Ze.defaultContentHeaders,body:JSON.stringify({operation:"upload",transfers:["basic"],objects:e.map(({sha:e,...t})=>({...t,oid:e}))})});return(await t.json()).objects.filter(e=>"error"in e?(console.error(e.error),!1):e.actions)}}const Qe="https://bitbucket.status.atlassian.com",et=`${Qe}/api/v2/components.json`,tt=["API","Authentication and user management","Git LFS"],{fetchWithTimeout:rt}=_.unsentRequest,nt={BitbucketBackend:class{constructor(e,t={}){if(this.options={proxied:!1,API:null,updateUserCredentials:async()=>null,initialWorkflowStatus:"",...t},!this.options.proxied&&(null===e.backend.repo||void 0===e.backend.repo))throw new Error('The BitBucket backend needs a "repo" in the backend configuration.');this.api=this.options.API||null,this.updateUserCredentials=this.options.updateUserCredentials,this.repo=e.backend.repo||"",this.branch=e.backend.branch||"master",this.isBranchConfigured=!!e.backend.branch,this.apiRoot=e.backend.api_root||"https://api.bitbucket.org/2.0",this.baseUrl=e.base_url||"",this.siteId=e.site_id||"",this.largeMediaURL=e.backend.large_media_url||`https://bitbucket.org/${e.backend.repo}/info/lfs`,this.token="",this.mediaFolder=e.media_folder,this.squashMerges=e.backend.squash_merges||!1,this.cmsLabelPrefix=e.backend.cms_label_prefix||"",this.previewContext=e.backend.preview_context||"",this.lock=(0,_.asyncLock)(),this.authType=e.backend.auth_type||""}isGitBackend(){return!0}async status(){const e=await rt(et).then(e=>e.json()).then(e=>e.components.filter(e=>tt.includes(e.name)).every(e=>"operational"===e.status)).catch(e=>(console.warn("Failed getting BitBucket status",e),!0));let t=!1;return e&&(t=await(this.api?.user().then(e=>!!e).catch(e=>(console.warn("Failed getting Bitbucket user",e),!1)))||!1),{auth:{status:t},api:{status:e,statusPage:Qe}}}authComponent(){return Q}setUser(e){this.token=e.token,this.api=new he({requestFunction:this.apiRequestFunction,branch:this.branch,repo:this.repo,squashMerges:this.squashMerges,cmsLabelPrefix:this.cmsLabelPrefix,initialWorkflowStatus:this.options.initialWorkflowStatus})}requestFunction=async e=>{const t=await this.getToken(),r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e);return _.unsentRequest.performRequest(r)};restoreUser(e){return this.authenticate(e)}async authenticate(e){if(this.token=e.token,!this.isBranchConfigured){const e=await rt(`${this.apiRoot}/repositories/${this.repo}`,{headers:{Authorization:`token ${this.token}`}}).then(e=>e.json()).catch(()=>null);e&&(this.branch=e.mainbranch.name)}if(this.refreshToken=e.refresh_token,this.api=new he({requestFunction:this.apiRequestFunction,branch:this.branch,repo:this.repo,apiRoot:this.apiRoot,squashMerges:this.squashMerges,cmsLabelPrefix:this.cmsLabelPrefix,initialWorkflowStatus:this.options.initialWorkflowStatus}),!await this.api.hasWriteAccess().catch(e=>{throw e.message=x`
7
+ `}}),n=await Promise.all(r.values.map(e=>this.getPullRequestLabel(e.id)));return r.values.filter((e,t)=>(0,_.isCMSLabel)(n[t],this.cmsLabelPrefix))}async getBranchPullRequest(e){const t=await this.getPullRequests(e);if(t.length<=0)throw new _.EditorialWorkflowError("content is not under editorial workflow",!0);return t[0]}async listUnpublishedBranches(){return console.log("%c Checking for Unpublished entries","line-height: 30px;text-align: center;font-weight: bold"),(await this.getPullRequests()).map(e=>e.source.branch.name)}async retrieveUnpublishedEntryData(e){const{collection:t,slug:r}=(0,_.parseContentKey)(e),n=(0,_.branchFromContentKey)(e),s=await this.getBranchPullRequest(n),i=await this.getDifferences(n),a=await this.getPullRequestLabel(s.id),o=(0,_.labelToStatus)(a,this.cmsLabelPrefix),u=s.updated_on,l=s.author.display_name;return{collection:t,slug:r,status:o,diffs:i.filter(e=>"deleted"!==e.status).map(e=>({path:e.path,newFile:e.newFile,id:""})),updatedAt:u,pullRequestAuthor:l}}async updateUnpublishedEntryStatus(e,t,r){const n=(0,_.generateContentKey)(e,t),s=(0,_.branchFromContentKey)(n),i=await this.getBranchPullRequest(s);await this.addPullRequestComment(i,(0,_.statusToLabel)(r,this.cmsLabelPrefix))}async mergePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/merge`,headers:{"Content-Type":le},body:JSON.stringify({message:_.MERGE_COMMIT_MESSAGE,close_source_branch:!0,merge_strategy:this.mergeStrategy})})}async publishUnpublishedEntry(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);await this.mergePullRequest(s)}async declinePullRequest(e){await this.requestJSON({method:"POST",url:`${this.repoURL}/pullrequests/${e.id}/decline`})}async deleteBranch(e){await this.request({method:"DELETE",url:`${this.repoURL}/refs/branches/${e}`})}async deleteUnpublishedEntry(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);await this.declinePullRequest(s),await this.deleteBranch(n)}async getPullRequestStatuses(e){return(await this.requestJSON({url:`${this.repoURL}/pullrequests/${e.id}/statuses`,params:{pagelen:100}})).values}async getStatuses(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r),s=await this.getBranchPullRequest(n);return(await this.getPullRequestStatuses(s)).map(({key:e,state:t,url:r})=>({context:e,state:t===oe.Successful?_.PreviewState.Success:_.PreviewState.Other,target_url:r}))}async getUnpublishedEntrySha(e,t){const r=(0,_.generateContentKey)(e,t),n=(0,_.branchFromContentKey)(r);return(await this.getBranchPullRequest(n)).destination.commit.hash}}var pe=u(8928);const fe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},de=e=>e.replace(/[[\]\\-]/g,"\\$&"),ge=e=>e.join(""),me=(e,t)=>{const r=t;if("["!==e.charAt(r))throw new Error("not in a brace expression");const n=[],s=[];let i=r+1,a=!1,o=!1,u=!1,l=!1,c=r,h="";e:for(;i<e.length;){const t=e.charAt(i);if("!"!==t&&"^"!==t||i!==r+1){if("]"===t&&a&&!u){c=i+1;break}if(a=!0,"\\"!==t||u){if("["===t&&!u)for(const[t,[a,u,l]]of Object.entries(fe))if(e.startsWith(t,i)){if(h)return["$.",!1,e.length-r,!0];i+=t.length,l?s.push(a):n.push(a),o=o||u;continue e}u=!1,h?(t>h?n.push(de(h)+"-"+de(t)):t===h&&n.push(de(t)),h="",i++):e.startsWith("-]",i+1)?(n.push(de(t+"-")),i+=2):e.startsWith("-",i+1)?(h=t,i+=2):(n.push(de(t)),i++)}else u=!0,i++}else l=!0,i++}if(c<i)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(0===s.length&&1===n.length&&/^\\?.$/.test(n[0])&&!l){return[(p=2===n[0].length?n[0].slice(-1):n[0],p.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,c-r,!1]}var p;const f="["+(l?"^":"")+ge(n)+"]",d="["+(l?"":"^")+ge(s)+"]";return[n.length&&s.length?"("+f+"|"+d+")":n.length?f:d,o,c-r,!0]},be=(e,t,r={})=>(Ke(t),!(!r.nocomment&&"#"===t.charAt(0))&&new Xe(t,r).match(e)),ye=/^\*+([^+@!?\*\[\(]*)$/,ve=e=>t=>!t.startsWith(".")&&t.endsWith(e),we=e=>t=>t.endsWith(e),xe=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),_e=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Pe=/^\*+\.\*+$/,ke=e=>!e.startsWith(".")&&e.includes("."),Se=e=>"."!==e&&".."!==e&&e.includes("."),Ce=/^\.\*+$/,Ae=e=>"."!==e&&".."!==e&&e.startsWith("."),Re=/^\*+$/,Ee=e=>0!==e.length&&!e.startsWith("."),Oe=e=>0!==e.length&&"."!==e&&".."!==e,Fe=/^\?+([^+@!?\*\[\(]*)?$/,Le=([e,t=""])=>{const r=Te([e]);return t?(t=t.toLowerCase(),e=>r(e)&&e.toLowerCase().endsWith(t)):r},je=([e,t=""])=>{const r=$e([e]);return t?(t=t.toLowerCase(),e=>r(e)&&e.toLowerCase().endsWith(t)):r},qe=([e,t=""])=>{const r=$e([e]);return t?e=>r(e)&&e.endsWith(t):r},Me=([e,t=""])=>{const r=Te([e]);return t?e=>r(e)&&e.endsWith(t):r},Te=([e])=>{const t=e.length;return e=>e.length===t&&!e.startsWith(".")},$e=([e])=>{const t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},Be="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";be.sep="win32"===Be?"\\":"/";const Ue=Symbol("globstar **");be.GLOBSTAR=Ue;const Ne={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},De="[^/]",ze=De+"*?",Ie=e=>e.split("").reduce((e,t)=>(e[t]=!0,e),{}),We=Ie("().*{}+?[]^$\\!"),He=Ie("[.(");be.filter=(e,t={})=>r=>be(r,e,t);const Ge=(e,t={})=>Object.assign({},e,t);be.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return be;const t=be;return Object.assign((r,n,s={})=>t(r,n,Ge(e,s)),{Minimatch:class extends t.Minimatch{constructor(t,r={}){super(t,Ge(e,r))}static defaults(r){return t.defaults(Ge(e,r)).Minimatch}},unescape:(r,n={})=>t.unescape(r,Ge(e,n)),escape:(r,n={})=>t.escape(r,Ge(e,n)),filter:(r,n={})=>t.filter(r,Ge(e,n)),defaults:r=>t.defaults(Ge(e,r)),makeRe:(r,n={})=>t.makeRe(r,Ge(e,n)),braceExpand:(r,n={})=>t.braceExpand(r,Ge(e,n)),match:(r,n,s={})=>t.match(r,n,Ge(e,s)),sep:t.sep,GLOBSTAR:Ue})};const Je=(e,t={})=>(Ke(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:pe(e));be.braceExpand=Je;const Ke=e=>{if("string"!=typeof e)throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};be.makeRe=(e,t={})=>new Xe(e,t).makeRe(),be.match=(e,t,r={})=>{const n=new Xe(t,r);return e=e.filter(e=>n.match(e)),n.options.nonull&&!e.length&&e.push(t),e};const Ye=/[?*]|[+@!]\(.*?\)|\[|\]/,Ve=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class Xe{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){Ke(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Be,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const e of this.set)for(const t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){const e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);const r=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let n=this.globParts.map((e,t,r)=>{if(this.isWindows&&this.windowsNoMagicRoot){const t=!(""!==e[0]||""!==e[1]||"?"!==e[2]&&Ye.test(e[2])||Ye.test(e[3])),r=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(r)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,n),this.set=n.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e<this.set.length;e++){const t=this.set[e];""===t[0]&&""===t[1]&&"?"===this.globParts[e][2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])&&(t[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let r=0;r<e[t].length;r++)"**"===e[t][r]&&(e[t][r]="*");const{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let r=t;for(;"**"===e[r+1];)r++;r!==t&&e.splice(t,r-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{const r=e[e.length-1];return"**"===t&&"**"===r?e:".."===t&&r&&".."!==r&&"."!==r&&"**"!==r?(e.pop(),e):(e.push(t),e)},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let r=1;r<e.length-1;r++){const n=e[r];1===r&&""===n&&""===e[0]||"."!==n&&""!==n||(t=!0,e.splice(r,1),r--)}"."!==e[0]||2!==e.length||"."!==e[1]&&""!==e[1]||(t=!0,e.pop())}let r=0;for(;-1!==(r=e.indexOf("..",r+1));){const n=e[r-1];n&&"."!==n&&".."!==n&&"**"!==n&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return 0===e.length?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let n=-1;for(;-1!==(n=r.indexOf("**",n+1));){let s=n;for(;"**"===r[s+1];)s++;s>n&&r.splice(n+1,s-n);let i=r[n+1];const a=r[n+2],o=r[n+3];if(".."!==i)continue;if(!a||"."===a||".."===a||!o||"."===o||".."===o)continue;t=!0,r.splice(n,1);const u=r.slice(0);u[n]="**",e.push(u),n--}if(!this.preserveMultipleSlashes){for(let e=1;e<r.length-1;e++){const n=r[e];1===e&&""===n&&""===r[0]||"."!==n&&""!==n||(t=!0,r.splice(e,1),e--)}"."!==r[0]||2!==r.length||"."!==r[1]&&""!==r[1]||(t=!0,r.pop())}let s=0;for(;-1!==(s=r.indexOf("..",s+1));){const e=r[s-1];if(e&&"."!==e&&".."!==e&&"**"!==e){t=!0;const e=1===s&&"**"===r[s+1]?["."]:[];r.splice(s-1,2,...e),0===r.length&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){const n=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);n&&(e[t]=n,e[r]=[])}return e.filter(e=>e.length)}partsMatch(e,t,r=!1){let n=0,s=0,i=[],a="";for(;n<e.length&&s<t.length;)if(e[n]===t[s])i.push("b"===a?t[s]:e[n]),n++,s++;else if(r&&"**"===e[n]&&t[s]===e[n+1])i.push(e[n]),n++;else if(r&&"**"===t[s]&&e[n]===t[s+1])i.push(t[s]),s++;else if("*"!==e[n]||!t[s]||!this.options.dot&&t[s].startsWith(".")||"**"===t[s]){if("*"!==t[s]||!e[n]||!this.options.dot&&e[n].startsWith(".")||"**"===e[n])return!1;if("a"===a)return!1;a="b",i.push(t[s]),n++,s++}else{if("b"===a)return!1;a="a",i.push(e[n]),n++,s++}return e.length===t.length&&i}parseNegate(){if(this.nonegate)return;const e=this.pattern;let t=!1,r=0;for(let n=0;n<e.length&&"!"===e.charAt(n);n++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){const n=this.options;if(this.isWindows){const r=""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3]),n=""===t[0]&&""===t[1]&&"?"===t[2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3]);if(r&&n){const r=e[3],n=t[3];r.toLowerCase()===n.toLowerCase()&&(e[3]=n)}else if(n&&"string"==typeof e[0]){const r=t[3],n=e[0];r.toLowerCase()===n.toLowerCase()&&(t[3]=n,t=t.slice(3))}else if(r&&"string"==typeof t[0]){const r=e[3];r.toLowerCase()===t[0].toLowerCase()&&(t[0]=r,e=e.slice(3))}}const{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,o=e.length,u=t.length;i<o&&a<u;i++,a++){this.debug("matchOne loop");var l=t[a],c=e[i];if(this.debug(t,l,c),!1===l)return!1;if(l===Ue){this.debug("GLOBSTAR",[t,l,c]);var h=i,p=a+1;if(p===u){for(this.debug("** at the end");i<o;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;h<o;){var f=e[h];if(this.debug("\nglobstar while",e,h,t,p,f),this.matchOne(e.slice(h),t.slice(p),r))return this.debug("globstar found match!",h,o,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,h,t,p);break}this.debug("globstar swallow a segment, and continue"),h++}return!(!r||(this.debug("\n>>> no match, partial?",e,h,t,p),h!==o))}let s;if("string"==typeof l?(s=c===l,this.debug("string match",l,c,s)):(s=l.test(c),this.debug("pattern match",l,c,s)),!s)return!1}if(i===o&&a===u)return!0;if(i===o)return r;if(a===u)return i===o-1&&""===e[i];throw new Error("wtf?")}braceExpand(){return Je(this.pattern,this.options)}parse(e){Ke(e);const t=this.options;if("**"===e)return Ue;if(""===e)return"";let r,n=null;(r=e.match(Re))?n=t.dot?Oe:Ee:(r=e.match(ye))?n=(t.nocase?t.dot?_e:xe:t.dot?we:ve)(r[1]):(r=e.match(Fe))?n=(t.nocase?t.dot?je:Le:t.dot?qe:Me)(r):(r=e.match(Pe))?n=t.dot?Se:ke:(r=e.match(Ce))&&(n=Ae);let s="",i=!1,a=!1;const o=[],u=[];let l,c=!1,h=!1,p="."===e.charAt(0),f=t.dot||p;const d=e=>"."===e.charAt(0)?"":t.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=()=>{if(c){switch(c){case"*":s+=ze,i=!0;break;case"?":s+=De,i=!0;break;default:s+="\\"+c}this.debug("clearStateChar %j %j",c,s),c=!1}};for(let r,n=0;n<e.length&&(r=e.charAt(n));n++)if(this.debug("%s\t%s %s %j",e,n,s,r),a){if("/"===r)return!1;We[r]&&(s+="\\"),s+=r,a=!1}else switch(r){case"/":return!1;case"\\":g(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":this.debug("%s\t%s %s %j <-- stateChar",e,n,s,r),this.debug("call clearStateChar %j",c),g(),c=r,t.noext&&g();continue;case"(":{if(!c){s+="\\(";continue}const t={type:c,start:n-1,reStart:s.length,open:Ne[c].open,close:Ne[c].close};this.debug(this.pattern,"\t",t),o.push(t),s+=t.open,0===t.start&&"!"!==t.type&&(p=!0,s+=d(e.slice(n+1))),this.debug("plType %j %j",c,s),c=!1;continue}case")":{const e=o[o.length-1];if(!e){s+="\\)";continue}o.pop(),g(),i=!0,l=e,s+=l.close,"!"===l.type&&u.push(Object.assign(l,{reEnd:s.length}));continue}case"|":{const t=o[o.length-1];if(!t){s+="\\|";continue}g(),s+="|",0===t.start&&"!"!==t.type&&(p=!0,s+=d(e.slice(n+1)));continue}case"[":g();const[f,m,b,y]=me(e,n);b?(s+=f,h=h||m,n+=b-1,i=i||y):s+="\\[";continue;case"]":s+="\\"+r;continue;default:g(),s+=Ve(r)}for(l=o.pop();l;l=o.pop()){let e;e=s.slice(l.reStart+l.open.length),this.debug(this.pattern,"setting tail",s,l),e=e.replace(/((?:\\{2}){0,64})(\\?)\|/g,(e,t,r)=>(r||(r="\\"),t+t+r+"|")),this.debug("tail=%j\n %s",e,e,l,s);const t="*"===l.type?ze:"?"===l.type?De:"\\"+l.type;i=!0,s=s.slice(0,l.reStart)+t+"\\("+e}g(),a&&(s+="\\\\");const m=He[s.charAt(0)];for(let e=u.length-1;e>-1;e--){const t=u[e],r=s.slice(0,t.reStart),n=s.slice(t.reStart,t.reEnd-8);let i=s.slice(t.reEnd);const a=s.slice(t.reEnd-8,t.reEnd)+i,o=r.split(")").length,l=r.split("(").length-o;let c=i;for(let e=0;e<l;e++)c=c.replace(/\)[+*?]?/,"");i=c,s=r+n+i+(""===i?"(?:$|\\/)":"")+a}if(""!==s&&i&&(s="(?=.)"+s),m&&(s=(p?"":f?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)")+s),!t.nocase||i||t.nocaseMagicOnly||(i=e.toUpperCase()!==e.toLowerCase()),!i)return s.replace(/\\(.)/g,"$1");const b=(t.nocase?"i":"")+(h?"u":"");try{const t=n?{_glob:e,_src:s,test:n}:{_glob:e,_src:s};return Object.assign(new RegExp("^"+s+"$",b),t)}catch(e){return this.debug("invalid regexp",e),new RegExp("$.")}}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const e=this.set;if(!e.length)return this.regexp=!1,this.regexp;const t=this.options,r=t.noglobstar?ze:t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",n=t.nocase?"i":"";let s=e.map(e=>{const t=e.map(e=>"string"==typeof e?Ve(e):e===Ue?Ue:e._src);return t.forEach((e,n)=>{const s=t[n+1],i=t[n-1];e===Ue&&i!==Ue&&(void 0===i?void 0!==s&&s!==Ue?t[n+1]="(?:\\/|"+r+"\\/)?"+s:t[n]=r:void 0===s?t[n-1]=i+"(?:\\/|"+r+")?":s!==Ue&&(t[n-1]=i+"(?:\\/|\\/"+r+"\\/)"+s,t[n+1]=Ue))}),t.filter(e=>e!==Ue).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;const r=this.options;this.isWindows&&(e=e.split("\\").join("/"));const n=this.slashSplit(e);this.debug(this.pattern,"split",n);const s=this.set;this.debug(this.pattern,"set",s);let i=n[n.length-1];if(!i)for(let e=n.length-2;!i&&e>=0;e--)i=n[e];for(let e=0;e<s.length;e++){const a=s[e];let o=n;if(r.matchBase&&1===a.length&&(o=[i]),this.matchOne(o,a,t))return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate}static defaults(e){return be.defaults(e).Minimatch}}be.Minimatch=Xe,be.escape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),be.unescape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");class Ze{static defaultContentHeaders={Accept:"application/vnd.git-lfs+json","Content-Type":"application/vnd.git-lfs+json"};constructor(e,t,r,n){this.enabled=e,this.rootURL=t,this.patterns=r,this.makeAuthorizedRequest=n}matchPath(e){return this.patterns.some(t=>be(e,t,{matchBase:!0}))}async uploadResource(e,t){const r=await this.getResourceUploadRequests([e]);for(const e of r)await this.doUpload(e.actions.upload,t),e.actions.verify&&await this.doVerify(e.actions.verify,e);return e.sha}async doUpload(e,t){await _.unsentRequest.fetchWithTimeout(decodeURI(e.href),{method:"PUT",body:t,headers:e.header})}async doVerify(e,t){this.makeAuthorizedRequest({url:decodeURI(e.href),method:"POST",headers:{...Ze.defaultContentHeaders,...e.header},body:JSON.stringify({oid:t.oid,size:t.size})})}async getResourceUploadRequests(e){const t=await this.makeAuthorizedRequest({url:`${this.rootURL}/objects/batch`,method:"POST",headers:Ze.defaultContentHeaders,body:JSON.stringify({operation:"upload",transfers:["basic"],objects:e.map(({sha:e,...t})=>({...t,oid:e}))})});return(await t.json()).objects.filter(e=>"error"in e?(console.error(e.error),!1):e.actions)}}const Qe="https://bitbucket.status.atlassian.com",et=`${Qe}/api/v2/components.json`,tt=["API","Authentication and user management","Git LFS"],{fetchWithTimeout:rt}=_.unsentRequest,nt={BitbucketBackend:class{constructor(e,t={}){if(this.options={proxied:!1,API:null,updateUserCredentials:async()=>null,initialWorkflowStatus:"",...t},!this.options.proxied&&(null===e.backend.repo||void 0===e.backend.repo))throw new Error('The BitBucket backend needs a "repo" in the backend configuration.');this.api=this.options.API||null,this.updateUserCredentials=this.options.updateUserCredentials,this.repo=e.backend.repo||"",this.branch=e.backend.branch||"master",this.isBranchConfigured=!!e.backend.branch,this.apiRoot=e.backend.api_root||"https://api.bitbucket.org/2.0",this.baseUrl=e.base_url||"",this.siteId=e.site_id||"",this.largeMediaURL=e.backend.large_media_url||`https://bitbucket.org/${e.backend.repo}/info/lfs`,this.token="",this.mediaFolder=e.media_folder,this.squashMerges=e.backend.squash_merges||!1,this.cmsLabelPrefix=e.backend.cms_label_prefix||"",this.previewContext=e.backend.preview_context||"",this.lock=(0,_.asyncLock)(),this.authType=e.backend.auth_type||""}isGitBackend(){return!0}async status(){const e=await rt(et).then(e=>e.json()).then(e=>e.components.filter(e=>tt.includes(e.name)).every(e=>"operational"===e.status)).catch(e=>(console.warn("Failed getting BitBucket status",e),!0));let t=!1;return e&&(t=await(this.api?.user().then(e=>!!e).catch(e=>(console.warn("Failed getting Bitbucket user",e),!1)))||!1),{auth:{status:t},api:{status:e,statusPage:Qe}}}authComponent(){return Q}setUser(e){this.token=e.token,this.api=new he({requestFunction:this.apiRequestFunction,branch:this.branch,repo:this.repo,squashMerges:this.squashMerges,cmsLabelPrefix:this.cmsLabelPrefix,initialWorkflowStatus:this.options.initialWorkflowStatus})}requestFunction=async e=>{const t=await this.getToken(),r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e);return _.unsentRequest.performRequest(r)};restoreUser(e){return this.authenticate(e)}async authenticate(e){if(this.token=e.token,!this.isBranchConfigured){const e=await rt(`${this.apiRoot}/repositories/${this.repo}`,{headers:{Authorization:`token ${this.token}`}}).then(e=>e.json()).catch(()=>null);e&&(this.branch=e.mainbranch.name)}if(this.refreshToken=e.refresh_token,this.api=new he({requestFunction:this.apiRequestFunction,branch:this.branch,repo:this.repo,apiRoot:this.apiRoot,squashMerges:this.squashMerges,cmsLabelPrefix:this.cmsLabelPrefix,initialWorkflowStatus:this.options.initialWorkflowStatus}),!await this.api.hasWriteAccess().catch(e=>{throw e.message=x`
8
8
  Repo "${this.repo}" not found.
9
9
 
10
10
  Please ensure the repo information is spelled correctly.
11
11
 
12
12
  If the repo is private, make sure you're logged into a Bitbucket account with access.
13
- `,e}))throw new Error("Your BitBucket user account does not have access to this repo.");const t=await this.api.user();return{...t,name:t.display_name,login:t.username,token:e.token,avatar_url:t.links.avatar.href,refresh_token:e.refresh_token}}getRefreshedAccessToken(){if("implicit"===this.authType)throw new _.AccessTokenError("Can't refresh access token when using implicit auth");if(this.refreshedTokenPromise)return this.refreshedTokenPromise;if(!this.authenticator){const e={base_url:this.baseUrl,site_id:this.siteId};this.authenticator=new P.NetlifyAuthenticator(e)}return this.refreshedTokenPromise=this.authenticator.refresh({provider:"bitbucket",refresh_token:this.refreshToken}).then(({token:e,refresh_token:t})=>(this.token=e,this.refreshToken=t,this.refreshedTokenPromise=void 0,this.updateUserCredentials({token:e,refresh_token:t}),e)),this.refreshedTokenPromise}logout(){this.token=null}getToken(){return this.refreshedTokenPromise?this.refreshedTokenPromise:Promise.resolve(this.token)}apiRequestFunction=async e=>{const t=this.refreshedTokenPromise?await this.refreshedTokenPromise:this.token,r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e),n=await _.unsentRequest.performRequest(r);if(401===n.status){const t=await n.json().catch(()=>null);if(t&&"error"===t.type&&/^access token expired/i.test(t.error.message)){const t=await this.getRefreshedAccessToken(),r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e);return _.unsentRequest.performRequest(r)}}return n};async entriesByFolder(e,t,r){let n;const s=await this.api.defaultBranchCommitSha(),i=await(0,_.entriesByFolder)(()=>this.api.listFiles(e,r,20,this.branch).then(({entries:e,cursor:r})=>(n=r.mergeMeta({extension:t}),e.filter(e=>(0,_.filterByExtension)(e,t)))),(e,t)=>this.api.readFile(e,t,{head:s}),this.api.readFileMetadata.bind(this.api),ue);return i[_.CURSOR_COMPATIBILITY_SYMBOL]=n,i}async listAllFiles(e,t,r){return(await this.api.listAllFiles(e,r,this.branch)).filter(e=>(0,_.filterByExtension)(e,t))}async allEntriesByFolder(e,t,r){const n=await this.api.defaultBranchCommitSha();return await(0,_.allEntriesByFolder)({listAllFiles:()=>this.listAllFiles(e,t,r),readFile:(e,t)=>this.api.readFile(e,t,{head:n}),readFileMetadata:this.api.readFileMetadata.bind(this.api),apiName:ue,branch:this.branch,localForage:_.localForage,folder:e,extension:t,depth:r,getDefaultBranch:()=>Promise.resolve({name:this.branch,sha:n}),isShaExistsInBranch:this.api.isShaExistsInBranch.bind(this.api),getDifferences:(e,t)=>this.api.getDifferences(e,t),getFileId:e=>Promise.resolve(this.api.getFileId(n,e)),filterFile:e=>(0,_.filterByExtension)(e,t)})}async entriesByFiles(e){const t=await this.api.defaultBranchCommitSha();return(0,_.entriesByFiles)(e,(e,r)=>this.api.readFile(e,r,{head:t}),this.api.readFileMetadata.bind(this.api),ue)}getEntry(e){return this.api.readFile(e).then(t=>({file:{path:e,id:null},data:t}))}getMedia(e=this.mediaFolder){return this.api.listAllFiles(e,1,this.branch).then(e=>e.map(({id:e,name:t,path:r})=>({id:e,name:t,path:r,displayURL:{id:e,path:r}})))}getLargeMediaClient(){return this._largeMediaClientPromise||(this._largeMediaClientPromise=(async()=>{const e=await this.api.readFile(".gitattributes").then(e=>(0,_.getLargeMediaPatternsFromGitAttributesFile)(e)).catch(e=>(404===e.status?console.log("This 404 was expected and handled appropriately."):console.error(e),[]));return new Ze(!!(this.largeMediaURL&&e.length>0),this.largeMediaURL,e,this.requestFunction)})()),this._largeMediaClientPromise}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||n()(10),(0,_.getMediaDisplayURL)(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}async getMediaFile(e){const t=(0,_.basename)(e),r=await(0,_.getMediaAsBlob)(e,null,this.api.readFile.bind(this.api)),n=(0,_.blobToFileObj)(t,r),s=URL.createObjectURL(n);return{id:await(0,_.getBlobSHA)(n),displayURL:s,path:e,name:t,size:n.size,file:n,url:s}}async persistEntry(e,t){const r=await this.getLargeMediaClient();return(0,_.runWithLock)(this.lock,async()=>this.api.persistFiles(e.dataFiles,r.enabled?await(0,_.getLargeMediaFilteredMediaFiles)(r,e.assets):e.assets,t),"Failed to acquire persist entry lock")}async persistMedia(e,t){const{fileObj:r,path:n}=e,s=r?URL.createObjectURL(r):"",i=await this.getLargeMediaClient(),o=n.startsWith("/")?n.slice(1):n;if(!i.enabled||!i.matchPath(o))return this._persistMedia(e,t);const a=await(0,_.getPointerFileForMediaFileObj)(i,r,n);return{...await this._persistMedia(a,t),displayURL:s}}async _persistMedia(e,t){const r=e.fileObj,[n]=await Promise.all([(0,_.getBlobSHA)(r),this.api.persistFiles([],[e],t)]),s=URL.createObjectURL(r);return{displayURL:s,path:i()(e.path,"/k"),name:r.name,size:r.size,id:n,file:r,url:s}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}traverseCursor(e,t){return this.api.traverseCursor(e,t).then(async({entries:t,cursor:r})=>{const n=e.meta?.get("extension");n&&(t=t.filter(e=>(0,_.filterByExtension)(e,n)),r=r.mergeMeta({extension:n}));const s=await this.api.defaultBranchCommitSha();return{entries:await(0,_.entriesByFiles)(t,(e,t)=>this.api.readFile(e,t,{head:s}),this.api.readFileMetadata.bind(this.api),ue),cursor:r}})}async loadMediaFile(e,t,{branch:r}){const n=await(0,_.getMediaAsBlob)(e,t,async(e,t,{parseText:n})=>await this.api.readFile(e,t,{branch:r,parseText:n})),s=(0,_.basename)(e),i=(0,_.blobToFileObj)(s,n);return{id:e,displayURL:URL.createObjectURL(i),path:e,name:s,size:i.size,file:i}}async unpublishedEntries(){return await(0,_.unpublishedEntries)(()=>this.api.listUnpublishedBranches().then(e=>e.map(e=>(0,_.contentKeyFromBranch)(e))))}async unpublishedEntry({id:e,collection:t,slug:r}){if(e)return await this.api.retrieveUnpublishedEntryData(e);if(t&&r){const e=(0,_.generateContentKey)(t,r);return await this.api.retrieveUnpublishedEntryData(e)}throw new Error("Missing unpublished entry id or collection and slug")}getBranch(e,t){const r=(0,_.generateContentKey)(e,t);return(0,_.branchFromContentKey)(r)}async unpublishedEntryDataFile(e,t,r,n){const s=this.getBranch(e,t);return await this.api.readFile(r,n,{branch:s})}async unpublishedEntryMediaFile(e,t,r,n){const s=this.getBranch(e,t);return await this.loadMediaFile(r,n,{branch:s})}async updateUnpublishedEntryStatus(e,t,r){return(0,_.runWithLock)(this.lock,()=>this.api.updateUnpublishedEntryStatus(e,t,r),"Failed to acquire update entry status lock")}async deleteUnpublishedEntry(e,t){return(0,_.runWithLock)(this.lock,()=>this.api.deleteUnpublishedEntry(e,t),"Failed to acquire delete entry lock")}async publishUnpublishedEntry(e,t){return(0,_.runWithLock)(this.lock,()=>this.api.publishUnpublishedEntry(e,t),"Failed to acquire publish entry lock")}async getDeployPreview(e,t){try{const r=await this.api.getStatuses(e,t),n=(0,_.getPreviewStatus)(r,this.previewContext);if(n){const{target_url:e,state:t}=n;return{url:e,status:t}}return null}catch(e){return null}}},API:he,AuthenticationPage:Q}})(),l.DecapCmsBackendBitbucket})());
13
+ `,e}))throw new Error("Your BitBucket user account does not have access to this repo.");const t=await this.api.user();return{...t,name:t.display_name,login:t.username,token:e.token,avatar_url:t.links.avatar.href,refresh_token:e.refresh_token}}getRefreshedAccessToken(){if("implicit"===this.authType)throw new _.AccessTokenError("Can't refresh access token when using implicit auth");if(this.refreshedTokenPromise)return this.refreshedTokenPromise;if(!this.authenticator){const e={base_url:this.baseUrl,site_id:this.siteId};this.authenticator=new P.NetlifyAuthenticator(e)}return this.refreshedTokenPromise=this.authenticator.refresh({provider:"bitbucket",refresh_token:this.refreshToken}).then(({token:e,refresh_token:t})=>(this.token=e,this.refreshToken=t,this.refreshedTokenPromise=void 0,this.updateUserCredentials({token:e,refresh_token:t}),e)),this.refreshedTokenPromise}logout(){this.token=null}getToken(){return this.refreshedTokenPromise?this.refreshedTokenPromise:Promise.resolve(this.token)}apiRequestFunction=async e=>{const t=this.refreshedTokenPromise?await this.refreshedTokenPromise:this.token,r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e),n=await _.unsentRequest.performRequest(r);if(401===n.status){const t=await n.json().catch(()=>null);if(t&&"error"===t.type&&/^access token expired/i.test(t.error.message)){const t=await this.getRefreshedAccessToken(),r=_.unsentRequest.withHeaders({Authorization:`Bearer ${t}`},e);return _.unsentRequest.performRequest(r)}}return n};async entriesByFolder(e,t,r){let n;const s=await this.api.defaultBranchCommitSha(),i=await(0,_.entriesByFolder)(()=>this.api.listFiles(e,r,20,this.branch).then(({entries:e,cursor:r})=>(n=r.mergeMeta({extension:t}),e.filter(e=>(0,_.filterByExtension)(e,t)))),(e,t)=>this.api.readFile(e,t,{head:s}),this.api.readFileMetadata.bind(this.api),ue);return i[_.CURSOR_COMPATIBILITY_SYMBOL]=n,i}async listAllFiles(e,t,r){return(await this.api.listAllFiles(e,r,this.branch)).filter(e=>(0,_.filterByExtension)(e,t))}async allEntriesByFolder(e,t,r){const n=await this.api.defaultBranchCommitSha();return await(0,_.allEntriesByFolder)({listAllFiles:()=>this.listAllFiles(e,t,r),readFile:(e,t)=>this.api.readFile(e,t,{head:n}),readFileMetadata:this.api.readFileMetadata.bind(this.api),apiName:ue,branch:this.branch,localForage:_.localForage,folder:e,extension:t,depth:r,getDefaultBranch:()=>Promise.resolve({name:this.branch,sha:n}),isShaExistsInBranch:this.api.isShaExistsInBranch.bind(this.api),getDifferences:(e,t)=>this.api.getDifferences(e,t),getFileId:e=>Promise.resolve(this.api.getFileId(n,e)),filterFile:e=>(0,_.filterByExtension)(e,t)})}async entriesByFiles(e){const t=await this.api.defaultBranchCommitSha();return(0,_.entriesByFiles)(e,(e,r)=>this.api.readFile(e,r,{head:t}),this.api.readFileMetadata.bind(this.api),ue)}getEntry(e){return this.api.readFile(e).then(t=>({file:{path:e,id:null},data:t}))}getMedia(e=this.mediaFolder){return this.api.listAllFiles(e,1,this.branch).then(e=>e.map(({id:e,name:t,path:r})=>({id:e,name:t,path:r,displayURL:{id:e,path:r}})))}getLargeMediaClient(){return this._largeMediaClientPromise||(this._largeMediaClientPromise=(async()=>{const e=await this.api.readFile(".gitattributes").then(e=>(0,_.getLargeMediaPatternsFromGitAttributesFile)(e)).catch(e=>(404===e.status?console.log("This 404 was expected and handled appropriately."):console.error(e),[]));return new Ze(!!(this.largeMediaURL&&e.length>0),this.largeMediaURL,e,this.requestFunction)})()),this._largeMediaClientPromise}getMediaDisplayURL(e){return this._mediaDisplayURLSem=this._mediaDisplayURLSem||n()(10),(0,_.getMediaDisplayURL)(e,this.api.readFile.bind(this.api),this._mediaDisplayURLSem)}async getMediaFile(e){const t=(0,_.basename)(e),r=await(0,_.getMediaAsBlob)(e,null,this.api.readFile.bind(this.api)),n=(0,_.blobToFileObj)(t,r),s=URL.createObjectURL(n);return{id:await(0,_.getBlobSHA)(n),displayURL:s,path:e,name:t,size:n.size,file:n,url:s}}async persistEntry(e,t){const r=await this.getLargeMediaClient();return(0,_.runWithLock)(this.lock,async()=>this.api.persistFiles(e.dataFiles,r.enabled?await(0,_.getLargeMediaFilteredMediaFiles)(r,e.assets):e.assets,t),"Failed to acquire persist entry lock")}async persistMedia(e,t){const{fileObj:r,path:n}=e,s=r?URL.createObjectURL(r):"",i=await this.getLargeMediaClient(),a=n.startsWith("/")?n.slice(1):n;if(!i.enabled||!i.matchPath(a))return this._persistMedia(e,t);const o=await(0,_.getPointerFileForMediaFileObj)(i,r,n);return{...await this._persistMedia(o,t),displayURL:s}}async _persistMedia(e,t){const r=e.fileObj,[n]=await Promise.all([(0,_.getBlobSHA)(r),this.api.persistFiles([],[e],t)]),s=URL.createObjectURL(r);return{displayURL:s,path:i()(e.path,"/k"),name:r.name,size:r.size,id:n,file:r,url:s}}deleteFiles(e,t){return this.api.deleteFiles(e,t)}traverseCursor(e,t){return this.api.traverseCursor(e,t).then(async({entries:t,cursor:r})=>{const n=e.meta?.get("extension");n&&(t=t.filter(e=>(0,_.filterByExtension)(e,n)),r=r.mergeMeta({extension:n}));const s=await this.api.defaultBranchCommitSha();return{entries:await(0,_.entriesByFiles)(t,(e,t)=>this.api.readFile(e,t,{head:s}),this.api.readFileMetadata.bind(this.api),ue),cursor:r}})}async loadMediaFile(e,t,{branch:r}){const n=await(0,_.getMediaAsBlob)(e,t,async(e,t,{parseText:n})=>await this.api.readFile(e,t,{branch:r,parseText:n})),s=(0,_.basename)(e),i=(0,_.blobToFileObj)(s,n);return{id:e,displayURL:URL.createObjectURL(i),path:e,name:s,size:i.size,file:i}}async unpublishedEntries(){return await(0,_.unpublishedEntries)(()=>this.api.listUnpublishedBranches().then(e=>e.map(e=>(0,_.contentKeyFromBranch)(e))))}async unpublishedEntry({id:e,collection:t,slug:r}){if(e)return await this.api.retrieveUnpublishedEntryData(e);if(t&&r){const e=(0,_.generateContentKey)(t,r);return await this.api.retrieveUnpublishedEntryData(e)}throw new Error("Missing unpublished entry id or collection and slug")}getBranch(e,t){const r=(0,_.generateContentKey)(e,t);return(0,_.branchFromContentKey)(r)}async unpublishedEntryDataFile(e,t,r,n){const s=this.getBranch(e,t);return await this.api.readFile(r,n,{branch:s})}async unpublishedEntryMediaFile(e,t,r,n){const s=this.getBranch(e,t);return await this.loadMediaFile(r,n,{branch:s})}async updateUnpublishedEntryStatus(e,t,r){return(0,_.runWithLock)(this.lock,()=>this.api.updateUnpublishedEntryStatus(e,t,r),"Failed to acquire update entry status lock")}async deleteUnpublishedEntry(e,t){return(0,_.runWithLock)(this.lock,()=>this.api.deleteUnpublishedEntry(e,t),"Failed to acquire delete entry lock")}async publishUnpublishedEntry(e,t){return(0,_.runWithLock)(this.lock,()=>this.api.publishUnpublishedEntry(e,t),"Failed to acquire publish entry lock")}async getDeployPreview(e,t){try{const r=await this.api.getStatuses(e,t),n=(0,_.getPreviewStatus)(r,this.previewContext);if(n){const{target_url:e,state:t}=n;return{url:e,status:t}}return null}catch(e){return null}}},API:he,AuthenticationPage:Q}})(),l.DecapCmsBackendBitbucket})());
14
14
  //# sourceMappingURL=decap-cms-backend-bitbucket.js.map