diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ffc693..7f617b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,9 @@ jobs: docker-image: type: string default: movabletype/test:buster + phpunit: + type: boolean + default: true docker: - image: << parameters.docker-image >> steps: @@ -26,13 +29,16 @@ jobs: - run: name: Test command: | - git clone -b develop --depth 1 https://github.com/movabletype/movabletype.git mt + git clone -b develop --depth 1 https://github.com/movabletype/movabletype.git mt cp -r mt/* . cp mt/.proverc . if [ -f t/cpanfile ]; then cpanm --installdeps -n . --cpanfile=t/cpanfile fi prove -j4 -PMySQLPool=MT::Test::Env -It/lib plugins/MTBlockEditor/t + if [ "<< parameters.phpunit >>" = "true" ]; then + phpunit plugins/MTBlockEditor/php + fi test-js: docker: @@ -74,21 +80,16 @@ workflows: version: 2 test-and-build: jobs: - - test-perl: - name: test-perl with centos6 - docker-image: movabletype/test:centos6 - - test-perl: - name: test-perl with jessie - docker-image: movabletype/test:jessie - test-perl: name: test-perl with buster docker-image: movabletype/test:buster - - test-perl: - name: test-perl with fedora - docker-image: movabletype/test:fedora + phpunit: false - test-perl: name: test-perl with bullseye docker-image: movabletype/test:bullseye + - test-perl: + name: test-perl with fedora39 + docker-image: movabletype/test:fedora - test-perl: name: test-perl with cloud7 docker-image: movabletype/test:cloud7 diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 9b942d1..8b27f8f 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -49,6 +49,7 @@ mt-static/plugins/MTBlockEditor/src/ # test plugins/MTBlockEditor/t/ plugins/MTBlockEditor/xt/ +plugins/MTBlockEditor/php/tests # distribution files and directories ^MTBlockEditor diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.js b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.js deleted file mode 100644 index 1a81167..0000000 --- a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see mt-block-editor-block-oembed.js.LICENSE.txt */ -(()=>{var t={264:t=>{t.exports={locales:["en","ja"]}},9944:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},6112:(t,e,r)=>{var n=r(8759);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},1984:(t,e,r)=>{"use strict";var n=r(8062).forEach,o=r(2802),i=r(3002),a=o("forEach"),c=i("forEach");t.exports=a&&c?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},6198:(t,e,r)=>{var n=r(4088),o=r(4005),i=r(7740),a=function(t){return function(e,r,a){var c,u=n(e),s=o(u.length),l=i(a,s);if(t&&r!=r){for(;s>l;)if((c=u[l++])!=c)return!0}else for(;s>l;l++)if((t||l in u)&&u[l]===r)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},8062:(t,e,r)=>{var n=r(8516),o=r(5974),i=r(3060),a=r(4005),c=r(5574),u=[].push,s=function(t){var e=1==t,r=2==t,s=3==t,l=4==t,f=6==t,p=7==t,h=5==t||f;return function(v,d,y,m){for(var g,b,w=i(v),x=o(w),E=n(d,y,3),S=a(x.length),L=0,O=m||c,k=e?O(v,S):r||p?O(v,0):void 0;S>L;L++)if((h||L in x)&&(b=E(g=x[L],L,w),t))if(e)k[L]=b;else if(b)switch(t){case 3:return!0;case 5:return g;case 6:return L;case 2:u.call(k,g)}else switch(t){case 4:return!1;case 7:u.call(k,g)}return f?-1:s||l?l:k}};t.exports={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterOut:s(7)}},2802:(t,e,r)=>{"use strict";var n=r(3677);t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},3002:(t,e,r)=>{var n=r(5283),o=r(3677),i=r(3167),a=Object.defineProperty,c={},u=function(t){throw t};t.exports=function(t,e){if(i(c,t))return c[t];e||(e={});var r=[][t],s=!!i(e,"ACCESSORS")&&e.ACCESSORS,l=i(e,0)?e[0]:u,f=i(e,1)?e[1]:void 0;return c[t]=!!r&&!o((function(){if(s&&!n)return!0;var t={length:-1};s?a(t,1,{enumerable:!0,get:u}):t[1]=1,r.call(t,l,f)}))}},5574:(t,e,r)=>{var n=r(8759),o=r(6526),i=r(211)("species");t.exports=function(t,e){var r;return o(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!o(r.prototype)?n(r)&&null===(r=r[i])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)}},2306:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},8474:(t,e,r)=>{var n=r(3167),o=r(6095),i=r(4399),a=r(7826);t.exports=function(t,e){for(var r=o(e),c=a.f,u=i.f,s=0;s{var n=r(5283),o=r(7826),i=r(5736);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},5736:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},5283:(t,e,r)=>{var n=r(3677);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},821:(t,e,r)=>{var n=r(2086),o=r(8759),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},933:t=>{t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8684:t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1695:(t,e,r)=>{var n=r(2086),o=r(4399).f,i=r(2585),a=r(1007),c=r(3648),u=r(8474),s=r(7189);t.exports=function(t,e){var r,l,f,p,h,v=t.target,d=t.global,y=t.stat;if(r=d?n:y?n[v]||c(v,{}):(n[v]||{}).prototype)for(l in e){if(p=e[l],f=t.noTargetGet?(h=o(r,l))&&h.value:r[l],!s(d?l:v+(y?".":"#")+l,t.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(t.sham||f&&f.sham)&&i(p,"sham",!0),a(r,l,p,t)}}},3677:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},8516:(t,e,r)=>{var n=r(9944);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},563:(t,e,r)=>{var n=r(9775),o=r(2086),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},2086:(t,e,r)=>{var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},3167:t=>{var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},7153:t=>{t.exports={}},6761:(t,e,r)=>{var n=r(5283),o=r(3677),i=r(821);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5974:(t,e,r)=>{var n=r(3677),o=r(2306),i="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},9277:(t,e,r)=>{var n=r(4489),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},3278:(t,e,r)=>{var n,o,i,a=r(9316),c=r(2086),u=r(8759),s=r(2585),l=r(3167),f=r(4489),p=r(8944),h=r(7153),v=c.WeakMap;if(a){var d=f.state||(f.state=new v),y=d.get,m=d.has,g=d.set;n=function(t,e){return e.facade=t,g.call(d,t,e),e},o=function(t){return y.call(d,t)||{}},i=function(t){return m.call(d,t)}}else{var b=p("state");h[b]=!0,n=function(t,e){return e.facade=t,s(t,b,e),e},o=function(t){return l(t,b)?t[b]:{}},i=function(t){return l(t,b)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},6526:(t,e,r)=>{var n=r(2306);t.exports=Array.isArray||function(t){return"Array"==n(t)}},7189:(t,e,r)=>{var n=r(3677),o=/#|\.prototype\./,i=function(t,e){var r=c[a(t)];return r==s||r!=u&&("function"==typeof e?n(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",s=i.POLYFILL="P";t.exports=i},8759:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},3296:t=>{t.exports=!1},3193:(t,e,r)=>{var n=r(3677);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},9316:(t,e,r)=>{var n=r(2086),o=r(9277),i=n.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},8675:(t,e,r)=>{"use strict";var n=r(5283),o=r(3677),i=r(8779),a=r(6952),c=r(7446),u=r(3060),s=r(5974),l=Object.assign,f=Object.defineProperty;t.exports=!l||o((function(){if(n&&1!==l({b:1},l(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){e[t]=t})),7!=l({},t)[r]||"abcdefghijklmnopqrst"!=i(l({},e)).join("")}))?function(t,e){for(var r=u(t),o=arguments.length,l=1,f=a.f,p=c.f;o>l;)for(var h,v=s(arguments[l++]),d=f?i(v).concat(f(v)):i(v),y=d.length,m=0;y>m;)h=d[m++],n&&!p.call(v,h)||(r[h]=v[h]);return r}:l},7826:(t,e,r)=>{var n=r(5283),o=r(6761),i=r(6112),a=r(1288),c=Object.defineProperty;e.f=n?c:function(t,e,r){if(i(t),e=a(e,!0),i(r),o)try{return c(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},4399:(t,e,r)=>{var n=r(5283),o=r(7446),i=r(5736),a=r(4088),c=r(1288),u=r(3167),s=r(6761),l=Object.getOwnPropertyDescriptor;e.f=n?l:function(t,e){if(t=a(t),e=c(e,!0),s)try{return l(t,e)}catch(t){}if(u(t,e))return i(!o.f.call(t,e),t[e])}},62:(t,e,r)=>{var n=r(1352),o=r(8684).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},6952:(t,e)=>{e.f=Object.getOwnPropertySymbols},1352:(t,e,r)=>{var n=r(3167),o=r(4088),i=r(6198).indexOf,a=r(7153);t.exports=function(t,e){var r,c=o(t),u=0,s=[];for(r in c)!n(a,r)&&n(c,r)&&s.push(r);for(;e.length>u;)n(c,r=e[u++])&&(~i(s,r)||s.push(r));return s}},8779:(t,e,r)=>{var n=r(1352),o=r(8684);t.exports=Object.keys||function(t){return n(t,o)}},7446:(t,e)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},6095:(t,e,r)=>{var n=r(563),o=r(62),i=r(6952),a=r(6112);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(a(t)),r=i.f;return r?e.concat(r(t)):e}},9775:(t,e,r)=>{var n=r(2086);t.exports=n},1007:(t,e,r)=>{var n=r(2086),o=r(2585),i=r(3167),a=r(3648),c=r(9277),u=r(3278),s=u.get,l=u.enforce,f=String(String).split("String");(t.exports=function(t,e,r,c){var u,s=!!c&&!!c.unsafe,p=!!c&&!!c.enumerable,h=!!c&&!!c.noTargetGet;"function"==typeof r&&("string"!=typeof e||i(r,"name")||o(r,"name",e),(u=l(r)).source||(u.source=f.join("string"==typeof e?e:""))),t!==n?(s?!h&&t[e]&&(p=!0):delete t[e],p?t[e]=r:o(t,e,r)):p?t[e]=r:a(e,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&s(this).source||c(this)}))},9586:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},3648:(t,e,r)=>{var n=r(2086),o=r(2585);t.exports=function(t,e){try{o(n,t,e)}catch(r){n[t]=e}return e}},8944:(t,e,r)=>{var n=r(9197),o=r(5422),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},4489:(t,e,r)=>{var n=r(2086),o=r(3648),i=n["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},9197:(t,e,r)=>{var n=r(3296),o=r(4489);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},7740:(t,e,r)=>{var n=r(9679),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},4088:(t,e,r)=>{var n=r(5974),o=r(9586);t.exports=function(t){return n(o(t))}},9679:t=>{var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},4005:(t,e,r)=>{var n=r(9679),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},3060:(t,e,r)=>{var n=r(9586);t.exports=function(t){return Object(n(t))}},1288:(t,e,r)=>{var n=r(8759);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},5422:t=>{var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},1876:(t,e,r)=>{var n=r(3193);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},211:(t,e,r)=>{var n=r(2086),o=r(9197),i=r(3167),a=r(5422),c=r(3193),u=r(1876),s=o("wks"),l=n.Symbol,f=u?l:l&&l.withoutSetter||a;t.exports=function(t){return i(s,t)||(c&&i(l,t)?s[t]=l[t]:s[t]=f("Symbol."+t)),s[t]}},5374:(t,e,r)=>{"use strict";var n=r(1695),o=r(1984);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},3023:(t,e,r)=>{r(1695)({target:"Array",stat:!0},{isArray:r(6526)})},8410:(t,e,r)=>{var n=r(1695),o=r(8675);n({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},5849:(t,e,r)=>{var n=r(2086),o=r(933),i=r(1984),a=r(2585);for(var c in o){var u=n[c],s=u&&u.prototype;if(s&&s.forEach!==i)try{a(s,"forEach",i)}catch(t){s.forEach=i}}},8551:t=>{t.exports={Oembed:"_1P5orKhnvj0DdRlgDHQ28m"}},3380:(t,e)=>{"use strict";e.Z=window.MTBlockEditor.Block},9178:(t,e)=>{"use strict";e.iw=e.Pb=e.ij=void 0;var r=window.MTBlockEditor.Component,n=r.BlockIframePreview,o=r.BlockToolbar,i=r.BlockToolbarButton,a=r.BlockSetup,c=r.BlockSetupCommon,u=r.BlockLabel,s=r.EditorMode;e.ij=n,e.Pb=c,e.iw=u},3010:(t,e)=>{"use strict";e._i=void 0;var r=window.MTBlockEditor.Context,n=r.EditorContext,o=r.useEditorContext,i=r.BlocksContext,a=r.useBlocksContext;e._i=o},7445:(t,e)=>{"use strict";e.d4=e.eJ=e.ZP=void 0;var r=window.MTBlockEditor.React;e.ZP=r;var n=r.useState,o=r.useEffect,i=r.useRef;e.eJ=n,e.d4=o},1507:(t,e)=>{"use strict";e.b=void 0;var r=window.MTBlockEditor.decorator.blockProperty;e.b=r},7556:(t,e)=>{"use strict";var r=window.MTBlockEditor.i18n;e.Z=r},6248:t=>{var e=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function p(){}function h(){}var v={};v[o]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(L([])));y&&y!==e&&r.call(y,o)&&(v=y);var m=h.prototype=f.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},8361:t=>{t.exports="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cstyle%3E.st0%7Bfill:%23666%7D%3C/style%3E%3Cpath class='st0' d='M320 1C179.2 1 65 115.2 65 256s114.2 255 255 255 255-114.2 255-255S460.8 1 320 1zm-57.5 313.9c3.8 3.3 4 9.1.6 12.7L231 362c-3.3 3.6-8.9 3.8-12.6.4l-106.6-99.9c-3.8-3.5-3.8-9.5 0-12.9l106.6-99.8c3.6-3.4 9.2-3.2 12.6.4l32.2 34.3c3.5 3.6 3.2 9.4-.6 12.7l-67 58.9 66.9 58.8zm159.1 47.5c-3.6 3.3-9.2 3.2-12.6-.4l-32.2-34.3c-3.5-3.6-3.2-9.4.6-12.7l67-58.9-67-59c-3.8-3.3-4-9.1-.6-12.7L409 150c3.4-3.5 9-3.7 12.6-.4l106.6 100c3.8 3.5 3.8 9.5 0 12.9l-106.6 99.9z'/%3E%3C/svg%3E"},4796:t=>{"use strict";t.exports={}},3641:t=>{"use strict";t.exports=JSON.parse('{"oEmbed":"oEmbed","Please input URL to be resolved by oEmbed API":"URLを入力してください","Max Width (optional)":"最大幅(任意)","Max Height (optional)":"最大高さ(任意)","Could not retrieve HTML for embedding from {{URL}}":"埋め込み用のHTMLを取得することができませんでした: {{URL}}"}')},3936:(t,e,r)=>{var n={"./en/translation.json":4796,"./ja/translation.json":3641};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=3936}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";r(5374),r(5849);var t=r(7556),e=r(264);function n(e,r){return t.Z.t(e,r)}t.Z.on("initialized",(function(){e.locales.forEach((function(e){var n=r(3936)("./".concat(e,"/translation.json"));t.Z.addResourceBundle(e,"translation",n,!0,!1)}))}));r(3023),r(8410),r(6248);var o=r(7445),i=r(1507),a=r(9178),c=r(3380),u=r(3010),s=r(8361),l=r.n(s),f=r(8551),p=r.n(f);function h(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1 ? arguments[1] : undefined);\n} : [].forEach;\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toLength = require('../internals/to-length');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var bind = require('../internals/function-bind-context');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = [].push;\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var IS_FILTER_OUT = TYPE == 7;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else switch (TYPE) {\n case 4: return false; // every\n case 7: push.call(target, value); // filterOut\n }\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6),\n // `Array.prototype.filterOut` method\n // https://github.com/tc39/proposal-array-filtering\n filterOut: createMethod(7)\n};\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\n\nvar defineProperty = Object.defineProperty;\nvar cache = {};\n\nvar thrower = function (it) { throw it; };\n\nmodule.exports = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !DESCRIPTORS) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n};\n","var isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.github.io/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var has = require('../internals/has');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var fails = require('../internals/fails');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var aFunction = require('../internals/a-function');\n\n// optional / simple context binding\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var path = require('../internals/path');\nvar global = require('../internals/global');\n\nvar aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func\n (function () { return this; })() || Function('return this')();\n","var hasOwnProperty = {}.hasOwnProperty;\n\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","module.exports = {};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar split = ''.split;\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split.call(it, '') : Object(it);\n} : Object;\n","var store = require('../internals/shared-store');\n\nvar functionToString = Function.toString;\n\n// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\nif (typeof store.inspectSource != 'function') {\n store.inspectSource = function (it) {\n return functionToString.call(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar objectHas = require('../internals/has');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = store.get;\n var wmhas = store.has;\n var wmset = store.set;\n set = function (it, metadata) {\n metadata.facade = it;\n wmset.call(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store, it) || {};\n };\n has = function (it) {\n return wmhas.call(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return objectHas(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return objectHas(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.github.io/ecma262/#sec-isarray\nmodule.exports = Array.isArray || function isArray(arg) {\n return classof(arg) == 'Array';\n};\n","var fails = require('../internals/fails');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","module.exports = false;\n","var fails = require('../internals/fails');\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n});\n","var global = require('../internals/global');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\nvar nativeAssign = Object.assign;\nvar defineProperty = Object.defineProperty;\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\nmodule.exports = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : nativeAssign;\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar anObject = require('../internals/an-object');\nvar toPrimitive = require('../internals/to-primitive');\n\nvar nativeDefineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar has = require('../internals/has');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","var has = require('../internals/has');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar nativePropertyIsEnumerable = {}.propertyIsEnumerable;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : nativePropertyIsEnumerable;\n","var getBuiltIn = require('../internals/get-built-in');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n};\n","var global = require('../internals/global');\n\nmodule.exports = global;\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar setGlobal = require('../internals/set-global');\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar getInternalState = InternalStateModule.get;\nvar enforceInternalState = InternalStateModule.enforce;\nvar TEMPLATE = String(String).split('String');\n\n(module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n var state;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) {\n createNonEnumerableProperty(value, 'name', key);\n }\n state = enforceInternalState(value);\n if (!state.source) {\n state.source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n }\n if (O === global) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n});\n","// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (key, value) {\n try {\n createNonEnumerableProperty(global, key, value);\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","var global = require('../internals/global');\nvar setGlobal = require('../internals/set-global');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || setGlobal(SHARED, {});\n\nmodule.exports = store;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.8.1',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n","var toInteger = require('../internals/to-integer');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `ToInteger` abstract operation\n// https://tc39.github.io/ecma262/#sec-tointeger\nmodule.exports = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n};\n","var toInteger = require('../internals/to-integer');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.github.io/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `ToObject` abstract operation\n// https://tc39.github.io/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n","var isObject = require('../internals/is-object');\n\n// `ToPrimitive` abstract operation\n// https://tc39.github.io/ecma262/#sec-toprimitive\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var id = 0;\nvar postfix = Math.random();\n\nmodule.exports = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n};\n","var NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar has = require('../internals/has');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {\n forEach: forEach\n});\n","var $ = require('../internals/export');\nvar isArray = require('../internals/is-array');\n\n// `Array.isArray` method\n// https://tc39.github.io/ecma262/#sec-array.isarray\n$({ target: 'Array', stat: true }, {\n isArray: isArray\n});\n","var $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\n$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {\n assign: assign\n});\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar forEach = require('../internals/array-for-each');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);\n } catch (error) {\n CollectionPrototype.forEach = forEach;\n }\n}\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"Oembed\":\"_1P5orKhnvj0DdRlgDHQ28m\"};","\"use strict\";\nexports.__esModule = true;\nexports[\"default\"] = window.MTBlockEditor.Block;\n","\"use strict\";\nexports.__esModule = true;\nexports.EditorMode = exports.BlockLabel = exports.BlockSetupCommon = exports.BlockSetup = exports.BlockToolbarButton = exports.BlockToolbar = exports.BlockIframePreview = void 0;\nvar _a = window.MTBlockEditor.Component, BlockIframePreview = _a.BlockIframePreview, BlockToolbar = _a.BlockToolbar, BlockToolbarButton = _a.BlockToolbarButton, BlockSetup = _a.BlockSetup, BlockSetupCommon = _a.BlockSetupCommon, BlockLabel = _a.BlockLabel, EditorMode = _a.EditorMode;\nexports.BlockIframePreview = BlockIframePreview;\nexports.BlockToolbar = BlockToolbar;\nexports.BlockToolbarButton = BlockToolbarButton;\nexports.BlockSetup = BlockSetup;\nexports.BlockSetupCommon = BlockSetupCommon;\nexports.BlockLabel = BlockLabel;\nexports.EditorMode = EditorMode;\n","\"use strict\";\nexports.__esModule = true;\nexports.useBlocksContext = exports.BlocksContext = exports.useEditorContext = exports.EditorContext = void 0;\nvar _a = window.MTBlockEditor.Context, EditorContext = _a.EditorContext, useEditorContext = _a.useEditorContext, BlocksContext = _a.BlocksContext, useBlocksContext = _a.useBlocksContext;\nexports.EditorContext = EditorContext;\nexports.useEditorContext = useEditorContext;\nexports.BlocksContext = BlocksContext;\nexports.useBlocksContext = useBlocksContext;\n","\"use strict\";\nexports.__esModule = true;\nexports.useRef = exports.useEffect = exports.useState = exports[\"default\"] = void 0;\nvar React = window.MTBlockEditor.React;\nexports[\"default\"] = React;\nvar useState = React.useState, useEffect = React.useEffect, useRef = React.useRef;\nexports.useState = useState;\nexports.useEffect = useEffect;\nexports.useRef = useRef;\n","\"use strict\";\nexports.__esModule = true;\nexports.blockProperty = void 0;\nvar blockProperty = window.MTBlockEditor.decorator.blockProperty;\nexports.blockProperty = blockProperty;\n","\"use strict\";\nexports.__esModule = true;\nvar i18n = window.MTBlockEditor.i18n;\nexports[\"default\"] = i18n;\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cstyle%3E.st0%7Bfill:%23666%7D%3C/style%3E%3Cpath class='st0' d='M320 1C179.2 1 65 115.2 65 256s114.2 255 255 255 255-114.2 255-255S460.8 1 320 1zm-57.5 313.9c3.8 3.3 4 9.1.6 12.7L231 362c-3.3 3.6-8.9 3.8-12.6.4l-106.6-99.9c-3.8-3.5-3.8-9.5 0-12.9l106.6-99.8c3.6-3.4 9.2-3.2 12.6.4l32.2 34.3c3.5 3.6 3.2 9.4-.6 12.7l-67 58.9 66.9 58.8zm159.1 47.5c-3.6 3.3-9.2 3.2-12.6-.4l-32.2-34.3c-3.5-3.6-3.2-9.4.6-12.7l67-58.9-67-59c-3.8-3.3-4-9.1-.6-12.7L409 150c3.4-3.5 9-3.7 12.6-.4l106.6 100c3.8 3.5 3.8 9.5 0 12.9l-106.6 99.9z'/%3E%3C/svg%3E\"","var map = {\n\t\"./en/translation.json\": 4796,\n\t\"./ja/translation.json\": 3641\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 3936;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => module['default'] :\n\t\t() => module;\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","import i18n from \"mt-block-editor-block/i18n\";\nimport { locales } from \"../i18next-parser.config\";\n\ni18n.on(\"initialized\", () => {\n locales.forEach((lang) => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const l = require(`./locales/${lang}/translation.json`);\n i18n.addResourceBundle(lang, \"translation\", l, true, false);\n });\n});\n\nexport function t(\n args: string | string[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record\n): string {\n return i18n.t(args, params);\n}\n","import { t } from \"../i18n\";\nimport React, { useState, useEffect } from \"mt-block-editor-block/React\";\nimport { blockProperty } from \"mt-block-editor-block/decorator\";\nimport {\n BlockIframePreview,\n BlockSetupCommon,\n BlockLabel,\n} from \"mt-block-editor-block/Component\";\nimport Block, {\n Metadata,\n NewFromHtmlOptions,\n EditorOptions,\n SerializeOptions,\n} from \"mt-block-editor-block/Block\";\nimport { useEditorContext } from \"mt-block-editor-block/Context\";\n\nimport icon from \"../img/icon/oembed.svg\";\nimport css from \"../css/Oembed.scss\";\n\ninterface EditorProps {\n block: Oembed;\n}\n\ninterface HtmlProps {\n block: Oembed;\n}\n\ninterface OembedData {\n version: string;\n type: string;\n width: number;\n height: number;\n title: string;\n html: string;\n author_name: string;\n author_url: string;\n provider_name: string;\n provider_url: string;\n}\n\ntype Resolver = (params: {\n url: string;\n maxwidth: number | null;\n maxheight: number | null;\n}) => Promise;\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n \n \n
\n )\n);\n\nconst Html: React.FC = ({ block }: HtmlProps) => {\n const { editor } = useEditorContext();\n const [, setCompiledHtml] = useState(\"\");\n\n useEffect(() => {\n (async () => {\n await block.compile({ editor });\n setCompiledHtml(block.compiledHtml);\n })();\n });\n\n return block.compiledHtml ? (\n \n ) : (\n <>{block.url}\n );\n};\n\nclass Oembed extends Block {\n public static typeId = \"sixapart-oembed\";\n public static selectable = true;\n public static shouldBeCompiled = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"oEmbed\");\n }\n\n public url = \"\";\n public width: number | null = null;\n public height: number | null = null;\n public maxwidth: number | null = null;\n public maxheight: number | null = null;\n public providerName: string | null = null;\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public metadata(): Metadata | null {\n return this.metadataByOwnKeys();\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n if (focus || focusBlock) {\n this.reset();\n return ;\n } else if (this.url) {\n return this.html();\n } else {\n return (\n \n {t(\"Please input URL to be resolved by oEmbed API\")}\n \n );\n }\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public async serializedString(): Promise {\n return \"\";\n }\n\n public async compile({ editor }: SerializeOptions): Promise {\n if (!this.url) {\n this.reset();\n return;\n }\n\n const opts = editor.opts.block[\"sixapart-oembed\"] || {};\n if (typeof opts.resolver !== \"function\") {\n throw \"Requires resolver function for sixapart-oembed.\";\n }\n const resolver = opts.resolver as Resolver;\n try {\n const res = await resolver({\n url: this.url,\n maxwidth: this.maxwidth || null,\n maxheight: this.maxheight || null,\n });\n\n if (!res.html) {\n throw res;\n }\n\n this.compiledHtml = res.html;\n this.width = res.width;\n this.height = res.height;\n this.providerName = res.provider_name;\n } catch (e) {\n this.reset();\n this.compiledHtml = t(\n \"Could not retrieve HTML for embedding from {{URL}}\",\n {\n URL: this.url,\n }\n );\n }\n }\n\n public static async newFromHtml({\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Oembed(meta);\n }\n\n private reset(): void {\n this.compiledHtml = \"\";\n this.width = null;\n this.height = null;\n this.providerName = null;\n }\n}\n\nexport default Oembed;\n","/** @license mt-block-editor-block-oembed\n\nCopyright (c) 2020 Six Apart Ltd.\n\nThis source code is licensed under the MIT license found in the\nLICENSE file in the root directory of this source tree.\n*/\nimport \"./i18n\";\nimport Oembed from \"./Block/Oembed\";\n\nwindow.MTBlockEditor.registerBlockType(Oembed);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.css b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.css similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.css rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.css diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.css.map b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.css.map similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.css.map rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.css.map diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.js b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.js new file mode 100644 index 0000000..acfa22c --- /dev/null +++ b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.js @@ -0,0 +1,3 @@ +/*! For license information please see mt-block-editor-block-oembed.js.LICENSE.txt */ +(()=>{var t={8393:t=>{t.exports={locales:["en","ja"]}},6689:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},1326:(t,e,r)=>{var n=r(6827);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},9352:(t,e,r)=>{"use strict";var n=r(5860).forEach,o=r(8809),i=r(778),a=o("forEach"),c=i("forEach");t.exports=a&&c?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},5254:(t,e,r)=>{var n=r(3016),o=r(9223),i=r(847),a=function(t){return function(e,r,a){var c,u=n(e),l=o(u.length),s=i(a,l);if(t&&r!=r){for(;l>s;)if((c=u[s++])!=c)return!0}else for(;l>s;s++)if((t||s in u)&&u[s]===r)return t||s||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},5860:(t,e,r)=>{var n=r(8273),o=r(8188),i=r(4440),a=r(9223),c=r(5309),u=[].push,l=function(t){var e=1==t,r=2==t,l=3==t,s=4==t,f=6==t,p=7==t,h=5==t||f;return function(v,y,d,m){for(var g,b,w=i(v),x=o(w),E=n(y,d,3),S=a(x.length),L=0,O=m||c,k=e?O(v,S):r||p?O(v,0):void 0;S>L;L++)if((h||L in x)&&(b=E(g=x[L],L,w),t))if(e)k[L]=b;else if(b)switch(t){case 3:return!0;case 5:return g;case 6:return L;case 2:u.call(k,g)}else switch(t){case 4:return!1;case 7:u.call(k,g)}return f?-1:l||s?s:k}};t.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterOut:l(7)}},8809:(t,e,r)=>{"use strict";var n=r(8462);t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},778:(t,e,r)=>{var n=r(6953),o=r(8462),i=r(991),a=Object.defineProperty,c={},u=function(t){throw t};t.exports=function(t,e){if(i(c,t))return c[t];e||(e={});var r=[][t],l=!!i(e,"ACCESSORS")&&e.ACCESSORS,s=i(e,0)?e[0]:u,f=i(e,1)?e[1]:void 0;return c[t]=!!r&&!o((function(){if(l&&!n)return!0;var t={length:-1};l?a(t,1,{enumerable:!0,get:u}):t[1]=1,r.call(t,s,f)}))}},5309:(t,e,r)=>{var n=r(6827),o=r(3115),i=r(7166)("species");t.exports=function(t,e){var r;return o(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!o(r.prototype)?n(r)&&null===(r=r[i])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===e?0:e)}},661:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},9621:(t,e,r)=>{var n=r(991),o=r(1804),i=r(172),a=r(7614);t.exports=function(t,e){for(var r=o(e),c=a.f,u=i.f,l=0;l{var n=r(6953),o=r(7614),i=r(9367);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},9367:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},6953:(t,e,r)=>{var n=r(8462);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3018:(t,e,r)=>{var n=r(2756),o=r(6827),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},8993:t=>{t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},4798:t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},5689:(t,e,r)=>{var n=r(2756),o=r(172).f,i=r(4100),a=r(57),c=r(1979),u=r(9621),l=r(5149);t.exports=function(t,e){var r,s,f,p,h,v=t.target,y=t.global,d=t.stat;if(r=y?n:d?n[v]||c(v,{}):(n[v]||{}).prototype)for(s in e){if(p=e[s],f=t.noTargetGet?(h=o(r,s))&&h.value:r[s],!l(y?s:v+(d?".":"#")+s,t.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(t.sham||f&&f.sham)&&i(p,"sham",!0),a(r,s,p,t)}}},8462:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},8273:(t,e,r)=>{var n=r(6689);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},5072:(t,e,r)=>{var n=r(8844),o=r(2756),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},2756:(t,e,r)=>{var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},991:t=>{var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},3472:t=>{t.exports={}},7106:(t,e,r)=>{var n=r(6953),o=r(8462),i=r(3018);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8188:(t,e,r)=>{var n=r(8462),o=r(661),i="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},1633:(t,e,r)=>{var n=r(410),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},3962:(t,e,r)=>{var n,o,i,a=r(1602),c=r(2756),u=r(6827),l=r(4100),s=r(991),f=r(410),p=r(5868),h=r(3472),v=c.WeakMap;if(a){var y=f.state||(f.state=new v),d=y.get,m=y.has,g=y.set;n=function(t,e){return e.facade=t,g.call(y,t,e),e},o=function(t){return d.call(y,t)||{}},i=function(t){return m.call(y,t)}}else{var b=p("state");h[b]=!0,n=function(t,e){return e.facade=t,l(t,b,e),e},o=function(t){return s(t,b)?t[b]:{}},i=function(t){return s(t,b)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},3115:(t,e,r)=>{var n=r(661);t.exports=Array.isArray||function(t){return"Array"==n(t)}},5149:(t,e,r)=>{var n=r(8462),o=/#|\.prototype\./,i=function(t,e){var r=c[a(t)];return r==l||r!=u&&("function"==typeof e?n(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},u=i.NATIVE="N",l=i.POLYFILL="P";t.exports=i},6827:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},7690:t=>{t.exports=!1},3165:(t,e,r)=>{var n=r(8462);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},1602:(t,e,r)=>{var n=r(2756),o=r(1633),i=n.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},9484:(t,e,r)=>{"use strict";var n=r(6953),o=r(8462),i=r(4565),a=r(864),c=r(6492),u=r(4440),l=r(8188),s=Object.assign,f=Object.defineProperty;t.exports=!s||o((function(){if(n&&1!==s({b:1},s(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){e[t]=t})),7!=s({},t)[r]||"abcdefghijklmnopqrst"!=i(s({},e)).join("")}))?function(t,e){for(var r=u(t),o=arguments.length,s=1,f=a.f,p=c.f;o>s;)for(var h,v=l(arguments[s++]),y=f?i(v).concat(f(v)):i(v),d=y.length,m=0;d>m;)h=y[m++],n&&!p.call(v,h)||(r[h]=v[h]);return r}:s},7614:(t,e,r)=>{var n=r(6953),o=r(7106),i=r(1326),a=r(7806),c=Object.defineProperty;e.f=n?c:function(t,e,r){if(i(t),e=a(e,!0),i(r),o)try{return c(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},172:(t,e,r)=>{var n=r(6953),o=r(6492),i=r(9367),a=r(3016),c=r(7806),u=r(991),l=r(7106),s=Object.getOwnPropertyDescriptor;e.f=n?s:function(t,e){if(t=a(t),e=c(e,!0),l)try{return s(t,e)}catch(t){}if(u(t,e))return i(!o.f.call(t,e),t[e])}},4161:(t,e,r)=>{var n=r(9583),o=r(4798).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},864:(t,e)=>{e.f=Object.getOwnPropertySymbols},9583:(t,e,r)=>{var n=r(991),o=r(3016),i=r(5254).indexOf,a=r(3472);t.exports=function(t,e){var r,c=o(t),u=0,l=[];for(r in c)!n(a,r)&&n(c,r)&&l.push(r);for(;e.length>u;)n(c,r=e[u++])&&(~i(l,r)||l.push(r));return l}},4565:(t,e,r)=>{var n=r(9583),o=r(4798);t.exports=Object.keys||function(t){return n(t,o)}},6492:(t,e)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},1804:(t,e,r)=>{var n=r(5072),o=r(4161),i=r(864),a=r(1326);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(a(t)),r=i.f;return r?e.concat(r(t)):e}},8844:(t,e,r)=>{var n=r(2756);t.exports=n},57:(t,e,r)=>{var n=r(2756),o=r(4100),i=r(991),a=r(1979),c=r(1633),u=r(3962),l=u.get,s=u.enforce,f=String(String).split("String");(t.exports=function(t,e,r,c){var u,l=!!c&&!!c.unsafe,p=!!c&&!!c.enumerable,h=!!c&&!!c.noTargetGet;"function"==typeof r&&("string"!=typeof e||i(r,"name")||o(r,"name",e),(u=s(r)).source||(u.source=f.join("string"==typeof e?e:""))),t!==n?(l?!h&&t[e]&&(p=!0):delete t[e],p?t[e]=r:o(t,e,r)):p?t[e]=r:a(e,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&l(this).source||c(this)}))},5065:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},1979:(t,e,r)=>{var n=r(2756),o=r(4100);t.exports=function(t,e){try{o(n,t,e)}catch(r){n[t]=e}return e}},5868:(t,e,r)=>{var n=r(3662),o=r(637),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},410:(t,e,r)=>{var n=r(2756),o=r(1979),i=n["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},3662:(t,e,r)=>{var n=r(7690),o=r(410);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},847:(t,e,r)=>{var n=r(8577),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},3016:(t,e,r)=>{var n=r(8188),o=r(5065);t.exports=function(t){return n(o(t))}},8577:t=>{var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},9223:(t,e,r)=>{var n=r(8577),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},4440:(t,e,r)=>{var n=r(5065);t.exports=function(t){return Object(n(t))}},7806:(t,e,r)=>{var n=r(6827);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},637:t=>{var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},4717:(t,e,r)=>{var n=r(3165);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7166:(t,e,r)=>{var n=r(2756),o=r(3662),i=r(991),a=r(637),c=r(3165),u=r(4717),l=o("wks"),s=n.Symbol,f=u?s:s&&s.withoutSetter||a;t.exports=function(t){return i(l,t)||(c&&i(s,t)?l[t]=s[t]:l[t]=f("Symbol."+t)),l[t]}},2064:(t,e,r)=>{"use strict";var n=r(5689),o=r(9352);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},8811:(t,e,r)=>{r(5689)({target:"Array",stat:!0},{isArray:r(3115)})},9206:(t,e,r)=>{var n=r(5689),o=r(9484);n({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},4439:(t,e,r)=>{var n=r(2756),o=r(8993),i=r(9352),a=r(4100);for(var c in o){var u=n[c],l=u&&u.prototype;if(l&&l.forEach!==i)try{a(l,"forEach",i)}catch(t){l.forEach=i}}},1671:t=>{t.exports={Oembed:"_1P5orKhnvj0DdRlgDHQ28m"}},8871:(t,e)=>{"use strict";e.A=window.MTBlockEditor.Block},3277:(t,e)=>{"use strict";e._M=e._n=e.yR=void 0;var r=window.MTBlockEditor.Component,n=r.BlockIframePreview,o=r.BlockToolbar,i=r.BlockToolbarButton,a=r.BlockConfigPanel,c=r.BlockSetup,u=r.BlockSetupCommon,l=r.BlockLabel,s=r.EditorMode,f=r.Dialog,p=r.DialogHeader,h=r.DialogBody,v=r.DialogFooter;e.yR=n,e._n=u,e._M=l},6609:(t,e)=>{"use strict";e.mi=void 0;var r=window.MTBlockEditor.Context,n=r.EditorContext,o=r.useEditorContext,i=r.BlocksContext,a=r.useBlocksContext;e.mi=o},9885:(t,e)=>{"use strict";e.vJ=e.J0=e.Ay=void 0;var r=window.MTBlockEditor.React;e.Ay=r;var n=r.useState,o=r.useEffect,i=r.useRef,a=r.useCallback;e.J0=n,e.vJ=o},2495:(t,e)=>{"use strict";e.D=void 0;var r=window.MTBlockEditor.decorator.blockProperty;e.D=r},6463:(t,e)=>{"use strict";var r=window.MTBlockEditor.i18n;e.A=r},3960:t=>{var e=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===s)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var s={};function f(){}function p(){}function h(){}var v={};v[o]=function(){return this};var y=Object.getPrototypeOf,d=y&&y(y(L([])));d&&d!==e&&r.call(d,o)&&(v=d);var m=h.prototype=f.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},6551:t=>{t.exports="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cstyle%3E.st0%7Bfill:%23666%7D%3C/style%3E%3Cpath class='st0' d='M320 1C179.2 1 65 115.2 65 256s114.2 255 255 255 255-114.2 255-255S460.8 1 320 1zm-57.5 313.9c3.8 3.3 4 9.1.6 12.7L231 362c-3.3 3.6-8.9 3.8-12.6.4l-106.6-99.9c-3.8-3.5-3.8-9.5 0-12.9l106.6-99.8c3.6-3.4 9.2-3.2 12.6.4l32.2 34.3c3.5 3.6 3.2 9.4-.6 12.7l-67 58.9 66.9 58.8zm159.1 47.5c-3.6 3.3-9.2 3.2-12.6-.4l-32.2-34.3c-3.5-3.6-3.2-9.4.6-12.7l67-58.9-67-59c-3.8-3.3-4-9.1-.6-12.7L409 150c3.4-3.5 9-3.7 12.6-.4l106.6 100c3.8 3.5 3.8 9.5 0 12.9l-106.6 99.9z'/%3E%3C/svg%3E"},6913:(t,e,r)=>{var n={"./en/translation.json":4985,"./ja/translation.json":9143};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=6913},4985:t=>{"use strict";t.exports={}},9143:t=>{"use strict";t.exports=JSON.parse('{"oEmbed":"oEmbed","Please input URL to be resolved by oEmbed API":"URLを入力してください","Max Width (optional)":"最大幅(任意)","Max Height (optional)":"最大高さ(任意)","Could not retrieve HTML for embedding from {{URL}}":"埋め込み用のHTMLを取得することができませんでした: {{URL}}"}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";r(2064),r(4439);var t=r(6463),e=r(8393);function n(e,r){return t.A.t(e,r)}t.A.on("initialized",(function(){e.locales.forEach((function(e){var n=r(6913)("./".concat(e,"/translation.json"));t.A.addResourceBundle(e,"translation",n,!0,!1)}))}));r(8811),r(9206),r(3960);var o=r(9885),i=r(2495),a=r(3277),c=r(8871),u=r(6609),l=r(6551),s=r.n(l),f=r(1671),p=r.n(f);function h(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1 ? arguments[1] : undefined);\n} : [].forEach;\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toLength = require('../internals/to-length');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","var bind = require('../internals/function-bind-context');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar toLength = require('../internals/to-length');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = [].push;\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var IS_FILTER_OUT = TYPE == 7;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push.call(target, value); // filter\n } else switch (TYPE) {\n case 4: return false; // every\n case 7: push.call(target, value); // filterOut\n }\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6),\n // `Array.prototype.filterOut` method\n // https://github.com/tc39/proposal-array-filtering\n filterOut: createMethod(7)\n};\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call,no-throw-literal\n method.call(null, argument || function () { throw 1; }, 1);\n });\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar has = require('../internals/has');\n\nvar defineProperty = Object.defineProperty;\nvar cache = {};\n\nvar thrower = function (it) { throw it; };\n\nmodule.exports = function (METHOD_NAME, options) {\n if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];\n if (!options) options = {};\n var method = [][METHOD_NAME];\n var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;\n var argument0 = has(options, 0) ? options[0] : thrower;\n var argument1 = has(options, 1) ? options[1] : undefined;\n\n return cache[METHOD_NAME] = !!method && !fails(function () {\n if (ACCESSORS && !DESCRIPTORS) return true;\n var O = { length: -1 };\n\n if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });\n else O[1] = 1;\n\n method.call(O, argument0, argument1);\n });\n};\n","var isObject = require('../internals/is-object');\nvar isArray = require('../internals/is-array');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.github.io/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var has = require('../internals/has');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var fails = require('../internals/fails');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !fails(function () {\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var aFunction = require('../internals/a-function');\n\n// optional / simple context binding\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var path = require('../internals/path');\nvar global = require('../internals/global');\n\nvar aFunction = function (variable) {\n return typeof variable == 'function' ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line no-undef\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func\n (function () { return this; })() || Function('return this')();\n","var hasOwnProperty = {}.hasOwnProperty;\n\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","module.exports = {};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar split = ''.split;\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split.call(it, '') : Object(it);\n} : Object;\n","var store = require('../internals/shared-store');\n\nvar functionToString = Function.toString;\n\n// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper\nif (typeof store.inspectSource != 'function') {\n store.inspectSource = function (it) {\n return functionToString.call(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar objectHas = require('../internals/has');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = store.get;\n var wmhas = store.has;\n var wmset = store.set;\n set = function (it, metadata) {\n metadata.facade = it;\n wmset.call(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget.call(store, it) || {};\n };\n has = function (it) {\n return wmhas.call(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return objectHas(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return objectHas(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.github.io/ecma262/#sec-isarray\nmodule.exports = Array.isArray || function isArray(arg) {\n return classof(arg) == 'Array';\n};\n","var fails = require('../internals/fails');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : typeof detection == 'function' ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","module.exports = false;\n","var fails = require('../internals/fails');\n\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n // Chrome 38 Symbol has incorrect toString conversion\n // eslint-disable-next-line no-undef\n return !String(Symbol());\n});\n","var global = require('../internals/global');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\nvar nativeAssign = Object.assign;\nvar defineProperty = Object.defineProperty;\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\nmodule.exports = !nativeAssign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : nativeAssign;\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar anObject = require('../internals/an-object');\nvar toPrimitive = require('../internals/to-primitive');\n\nvar nativeDefineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return nativeDefineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar has = require('../internals/has');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","exports.f = Object.getOwnPropertySymbols;\n","var has = require('../internals/has');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~indexOf(result, key) || result.push(key);\n }\n return result;\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.github.io/ecma262/#sec-object.keys\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar nativePropertyIsEnumerable = {}.propertyIsEnumerable;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : nativePropertyIsEnumerable;\n","var getBuiltIn = require('../internals/get-built-in');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;\n};\n","var global = require('../internals/global');\n\nmodule.exports = global;\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar has = require('../internals/has');\nvar setGlobal = require('../internals/set-global');\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar getInternalState = InternalStateModule.get;\nvar enforceInternalState = InternalStateModule.enforce;\nvar TEMPLATE = String(String).split('String');\n\n(module.exports = function (O, key, value, options) {\n var unsafe = options ? !!options.unsafe : false;\n var simple = options ? !!options.enumerable : false;\n var noTargetGet = options ? !!options.noTargetGet : false;\n var state;\n if (typeof value == 'function') {\n if (typeof key == 'string' && !has(value, 'name')) {\n createNonEnumerableProperty(value, 'name', key);\n }\n state = enforceInternalState(value);\n if (!state.source) {\n state.source = TEMPLATE.join(typeof key == 'string' ? key : '');\n }\n }\n if (O === global) {\n if (simple) O[key] = value;\n else setGlobal(key, value);\n return;\n } else if (!unsafe) {\n delete O[key];\n } else if (!noTargetGet && O[key]) {\n simple = true;\n }\n if (simple) O[key] = value;\n else createNonEnumerableProperty(O, key, value);\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, 'toString', function toString() {\n return typeof this == 'function' && getInternalState(this).source || inspectSource(this);\n});\n","// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","var global = require('../internals/global');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (key, value) {\n try {\n createNonEnumerableProperty(global, key, value);\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","var global = require('../internals/global');\nvar setGlobal = require('../internals/set-global');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || setGlobal(SHARED, {});\n\nmodule.exports = store;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.8.1',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n","var toInteger = require('../internals/to-integer');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `ToInteger` abstract operation\n// https://tc39.github.io/ecma262/#sec-tointeger\nmodule.exports = function (argument) {\n return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);\n};\n","var toInteger = require('../internals/to-integer');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.github.io/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\n// `ToObject` abstract operation\n// https://tc39.github.io/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n","var isObject = require('../internals/is-object');\n\n// `ToPrimitive` abstract operation\n// https://tc39.github.io/ecma262/#sec-toprimitive\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (input, PREFERRED_STRING) {\n if (!isObject(input)) return input;\n var fn, val;\n if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;\n if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var id = 0;\nvar postfix = Math.random();\n\nmodule.exports = function (key) {\n return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);\n};\n","var NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n // eslint-disable-next-line no-undef\n && !Symbol.sham\n // eslint-disable-next-line no-undef\n && typeof Symbol.iterator == 'symbol';\n","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar has = require('../internals/has');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!has(WellKnownSymbolsStore, name)) {\n if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];\n else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.foreach\n$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {\n forEach: forEach\n});\n","var $ = require('../internals/export');\nvar isArray = require('../internals/is-array');\n\n// `Array.isArray` method\n// https://tc39.github.io/ecma262/#sec-array.isarray\n$({ target: 'Array', stat: true }, {\n isArray: isArray\n});\n","var $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.github.io/ecma262/#sec-object.assign\n$({ target: 'Object', stat: true, forced: Object.assign !== assign }, {\n assign: assign\n});\n","var global = require('../internals/global');\nvar DOMIterables = require('../internals/dom-iterables');\nvar forEach = require('../internals/array-for-each');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n // some Chrome versions have non-configurable methods on DOMTokenList\n if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {\n createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);\n } catch (error) {\n CollectionPrototype.forEach = forEach;\n }\n}\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"Oembed\":\"_1P5orKhnvj0DdRlgDHQ28m\"};","\"use strict\";\nexports.__esModule = true;\nexports[\"default\"] = window.MTBlockEditor.Block;\n","\"use strict\";\nexports.__esModule = true;\nexports.DialogFooter = exports.DialogBody = exports.DialogHeader = exports.Dialog = exports.EditorMode = exports.BlockLabel = exports.BlockSetupCommon = exports.BlockSetup = exports.BlockConfigPanel = exports.BlockToolbarButton = exports.BlockToolbar = exports.BlockIframePreview = void 0;\nvar _a = window.MTBlockEditor.Component, BlockIframePreview = _a.BlockIframePreview, BlockToolbar = _a.BlockToolbar, BlockToolbarButton = _a.BlockToolbarButton, BlockConfigPanel = _a.BlockConfigPanel, BlockSetup = _a.BlockSetup, BlockSetupCommon = _a.BlockSetupCommon, BlockLabel = _a.BlockLabel, EditorMode = _a.EditorMode, Dialog = _a.Dialog, DialogHeader = _a.DialogHeader, DialogBody = _a.DialogBody, DialogFooter = _a.DialogFooter;\nexports.BlockIframePreview = BlockIframePreview;\nexports.BlockToolbar = BlockToolbar;\nexports.BlockToolbarButton = BlockToolbarButton;\nexports.BlockConfigPanel = BlockConfigPanel;\nexports.BlockSetup = BlockSetup;\nexports.BlockSetupCommon = BlockSetupCommon;\nexports.BlockLabel = BlockLabel;\nexports.EditorMode = EditorMode;\nexports.Dialog = Dialog;\nexports.DialogHeader = DialogHeader;\nexports.DialogBody = DialogBody;\nexports.DialogFooter = DialogFooter;\n","\"use strict\";\nexports.__esModule = true;\nexports.useBlocksContext = exports.BlocksContext = exports.useEditorContext = exports.EditorContext = void 0;\nvar _a = window.MTBlockEditor.Context, EditorContext = _a.EditorContext, useEditorContext = _a.useEditorContext, BlocksContext = _a.BlocksContext, useBlocksContext = _a.useBlocksContext;\nexports.EditorContext = EditorContext;\nexports.useEditorContext = useEditorContext;\nexports.BlocksContext = BlocksContext;\nexports.useBlocksContext = useBlocksContext;\n","\"use strict\";\nexports.__esModule = true;\nexports.useCallback = exports.useRef = exports.useEffect = exports.useState = exports[\"default\"] = void 0;\nvar React = window.MTBlockEditor.React;\nexports[\"default\"] = React;\nvar useState = React.useState, useEffect = React.useEffect, useRef = React.useRef, useCallback = React.useCallback;\nexports.useState = useState;\nexports.useEffect = useEffect;\nexports.useRef = useRef;\nexports.useCallback = useCallback;\n","\"use strict\";\nexports.__esModule = true;\nexports.blockProperty = void 0;\nvar blockProperty = window.MTBlockEditor.decorator.blockProperty;\nexports.blockProperty = blockProperty;\n","\"use strict\";\nexports.__esModule = true;\nvar i18n = window.MTBlockEditor.i18n;\nexports[\"default\"] = i18n;\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cstyle%3E.st0%7Bfill:%23666%7D%3C/style%3E%3Cpath class='st0' d='M320 1C179.2 1 65 115.2 65 256s114.2 255 255 255 255-114.2 255-255S460.8 1 320 1zm-57.5 313.9c3.8 3.3 4 9.1.6 12.7L231 362c-3.3 3.6-8.9 3.8-12.6.4l-106.6-99.9c-3.8-3.5-3.8-9.5 0-12.9l106.6-99.8c3.6-3.4 9.2-3.2 12.6.4l32.2 34.3c3.5 3.6 3.2 9.4-.6 12.7l-67 58.9 66.9 58.8zm159.1 47.5c-3.6 3.3-9.2 3.2-12.6-.4l-32.2-34.3c-3.5-3.6-3.2-9.4.6-12.7l67-58.9-67-59c-3.8-3.3-4-9.1-.6-12.7L409 150c3.4-3.5 9-3.7 12.6-.4l106.6 100c3.8 3.5 3.8 9.5 0 12.9l-106.6 99.9z'/%3E%3C/svg%3E\"","var map = {\n\t\"./en/translation.json\": 4985,\n\t\"./ja/translation.json\": 9143\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6913;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import i18n from \"mt-block-editor-block/i18n\";\nimport { locales } from \"../i18next-parser.config\";\n\ni18n.on(\"initialized\", () => {\n locales.forEach((lang) => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const l = require(`./locales/${lang}/translation.json`);\n i18n.addResourceBundle(lang, \"translation\", l, true, false);\n });\n});\n\nexport function t(\n args: string | string[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record\n): string {\n return i18n.t(args, params);\n}\n","import { t } from \"../i18n\";\nimport React, { useState, useEffect } from \"mt-block-editor-block/React\";\nimport { blockProperty } from \"mt-block-editor-block/decorator\";\nimport {\n BlockIframePreview,\n BlockSetupCommon,\n BlockLabel,\n} from \"mt-block-editor-block/Component\";\nimport Block, {\n Metadata,\n NewFromHtmlOptions,\n EditorOptions,\n SerializeOptions,\n} from \"mt-block-editor-block/Block\";\nimport { useEditorContext } from \"mt-block-editor-block/Context\";\n\nimport icon from \"../img/icon/oembed.svg\";\nimport css from \"../css/Oembed.scss\";\n\ninterface EditorProps {\n block: Oembed;\n}\n\ninterface HtmlProps {\n block: Oembed;\n}\n\ninterface OembedData {\n version: string;\n type: string;\n width: number;\n height: number;\n title: string;\n html: string;\n author_name: string;\n author_url: string;\n provider_name: string;\n provider_url: string;\n}\n\ntype Resolver = (params: {\n url: string;\n maxwidth: number | null;\n maxheight: number | null;\n}) => Promise;\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n \n \n
\n )\n);\n\nconst Html: React.FC = ({ block }: HtmlProps) => {\n const { editor } = useEditorContext();\n const [, setCompiledHtml] = useState(\"\");\n\n useEffect(() => {\n (async () => {\n await block.compile({ editor });\n setCompiledHtml(block.compiledHtml);\n })();\n });\n\n return block.compiledHtml !== undefined ? (\n \n ) : (\n <>{block.url}\n );\n};\n\nclass Oembed extends Block {\n public static typeId = \"sixapart-oembed\";\n public static selectable = true;\n public static shouldBeCompiled = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"oEmbed\");\n }\n\n public url = \"\";\n public width: number | null = null;\n public height: number | null = null;\n public maxwidth: number | null = null;\n public maxheight: number | null = null;\n public providerName: string | null = null;\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public metadata(): Metadata | null {\n return this.metadataByOwnKeys();\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n if (focus || focusBlock) {\n this.reset();\n return ;\n } else if (this.url) {\n return this.html();\n } else {\n return (\n \n {t(\"Please input URL to be resolved by oEmbed API\")}\n \n );\n }\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public async serializedString(): Promise {\n return \"\";\n }\n\n public async compile({ editor }: SerializeOptions): Promise {\n if (!this.url) {\n this.reset();\n return;\n }\n\n const opts = editor.opts.block[\"sixapart-oembed\"] || {};\n if (typeof opts.resolver !== \"function\") {\n throw \"Requires resolver function for sixapart-oembed.\";\n }\n const resolver = opts.resolver as Resolver;\n try {\n const res = await resolver({\n url: this.url,\n maxwidth: this.maxwidth || null,\n maxheight: this.maxheight || null,\n });\n\n if (!res.html) {\n throw res;\n }\n\n this.compiledHtml = res.html;\n this.width = res.width;\n this.height = res.height;\n this.providerName = res.provider_name;\n } catch (e) {\n this.reset();\n this.compiledHtml = t(\n \"Could not retrieve HTML for embedding from {{URL}}\",\n {\n URL: this.url,\n }\n );\n }\n }\n\n public static async newFromHtml({\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Oembed(meta);\n }\n\n private reset(): void {\n this.compiledHtml = undefined;\n this.width = null;\n this.height = null;\n this.providerName = null;\n }\n}\n\nexport default Oembed;\n","/** @license mt-block-editor-block-oembed\n\nCopyright (c) 2020 Six Apart Ltd.\n\nThis source code is licensed under the MIT license found in the\nLICENSE file in the root directory of this source tree.\n*/\nimport \"./i18n\";\nimport Oembed from \"./Block/Oembed\";\n\nwindow.MTBlockEditor.registerBlockType(Oembed);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.js b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.js deleted file mode 100644 index a7112e6..0000000 --- a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! -# Movable Type Block Editor (C) 2020 Six Apart Ltd. All Rights Reserved. -# This code cannot be redistributed without permission from www.sixapart.com. -# -# This distribution contains several open source products. -# Their license information can be found in mt-block-editor.js.LICENSE.txt. - */ -(()=>{var e={264:e=>{e.exports={locales:["en","ja"]}},9944:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},1378:(e,t,n)=>{var r=n(8759);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},8669:(e,t,n)=>{var r=n(211),o=n(4710),i=n(7826),a=r("unscopables"),u=Array.prototype;null==u[a]&&i.f(u,a,{configurable:!0,value:o(null)}),e.exports=function(e){u[a][e]=!0}},9966:(e,t,n)=>{"use strict";var r=n(3448).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},1855:e=>{e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},6112:(e,t,n)=>{var r=n(8759);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},1984:(e,t,n)=>{"use strict";var r=n(8062).forEach,o=n(2802),i=n(3002),a=o("forEach"),u=i("forEach");e.exports=a&&u?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},1842:(e,t,n)=>{"use strict";var r=n(8516),o=n(3060),i=n(7850),a=n(2814),u=n(4005),l=n(9720),c=n(1667);e.exports=function(e){var t,n,s,f,d,p,h=o(e),v="function"==typeof this?this:Array,m=arguments.length,g=m>1?arguments[1]:void 0,y=void 0!==g,b=c(h),w=0;if(y&&(g=r(g,m>2?arguments[2]:void 0,2)),null==b||v==Array&&a(b))for(n=new v(t=u(h.length));t>w;w++)p=y?g(h[w],w):h[w],l(n,w,p);else for(d=(f=b.call(h)).next,n=new v;!(s=d.call(f)).done;w++)p=y?i(f,g,[s.value,w],!0):s.value,l(n,w,p);return n.length=w,n}},6198:(e,t,n)=>{var r=n(4088),o=n(4005),i=n(7740),a=function(e){return function(t,n,a){var u,l=r(t),c=o(l.length),s=i(a,c);if(e&&n!=n){for(;c>s;)if((u=l[s++])!=u)return!0}else for(;c>s;s++)if((e||s in l)&&l[s]===n)return e||s||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},8062:(e,t,n)=>{var r=n(8516),o=n(5974),i=n(3060),a=n(4005),u=n(5574),l=[].push,c=function(e){var t=1==e,n=2==e,c=3==e,s=4==e,f=6==e,d=5==e||f;return function(p,h,v,m){for(var g,y,b=i(p),w=o(b),k=r(h,v,3),x=a(w.length),S=0,E=m||u,O=t?E(p,x):n?E(p,0):void 0;x>S;S++)if((d||S in w)&&(y=k(g=w[S],S,b),e))if(t)O[S]=y;else if(y)switch(e){case 3:return!0;case 5:return g;case 6:return S;case 2:l.call(O,g)}else if(s)return!1;return f?-1:c||s?s:O}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},9955:(e,t,n)=>{var r=n(3677),o=n(211),i=n(1448),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},2802:(e,t,n)=>{"use strict";var r=n(3677);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},3002:(e,t,n)=>{var r=n(5283),o=n(3677),i=n(3167),a=Object.defineProperty,u={},l=function(e){throw e};e.exports=function(e,t){if(i(u,e))return u[e];t||(t={});var n=[][e],c=!!i(t,"ACCESSORS")&&t.ACCESSORS,s=i(t,0)?t[0]:l,f=i(t,1)?t[1]:void 0;return u[e]=!!n&&!o((function(){if(c&&!r)return!0;var e={length:-1};c?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,s,f)}))}},8758:(e,t,n)=>{var r=n(9944),o=n(3060),i=n(5974),a=n(4005),u=function(e){return function(t,n,u,l){r(n);var c=o(t),s=i(c),f=a(c.length),d=e?f-1:0,p=e?-1:1;if(u<2)for(;;){if(d in s){l=s[d],d+=p;break}if(d+=p,e?d<0:f<=d)throw TypeError("Reduce of empty array with no initial value")}for(;e?d>=0:f>d;d+=p)d in s&&(l=n(l,s[d],d,c));return l}};e.exports={left:u(!1),right:u(!0)}},5574:(e,t,n)=>{var r=n(8759),o=n(6526),i=n(211)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},7850:(e,t,n)=>{var r=n(6112);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},8939:(e,t,n)=>{var r=n(211)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},2306:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},375:(e,t,n)=>{var r=n(2371),o=n(2306),i=n(211)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},6449:(e,t,n)=>{"use strict";var r=n(6112),o=n(9944);e.exports=function(){for(var e=r(this),t=o(e.add),n=0,i=arguments.length;n{"use strict";var r=n(6112),o=n(9944);e.exports=function(){for(var e,t=r(this),n=o(t.delete),i=!0,a=0,u=arguments.length;a{"use strict";var r=n(7826).f,o=n(4710),i=n(9431),a=n(8516),u=n(1855),l=n(4722),c=n(8432),s=n(7420),f=n(5283),d=n(2423).fastKey,p=n(3278),h=p.set,v=p.getterFor;e.exports={getConstructor:function(e,t,n,c){var s=e((function(e,r){u(e,s,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),f||(e.size=0),null!=r&&l(r,e[c],e,n)})),p=v(t),m=function(e,t,n){var r,o,i=p(e),a=g(e,t);return a?a.value=n:(i.last=a={index:o=d(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),f?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},g=function(e,t){var n,r=p(e),o=d(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(s.prototype,{clear:function(){for(var e=p(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,f?e.size=0:this.size=0},delete:function(e){var t=p(this),n=g(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),f?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=p(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!g(this,e)}}),i(s.prototype,n?{get:function(e){var t=g(this,e);return t&&t.value},set:function(e,t){return m(this,0===e?0:e,t)}}:{add:function(e){return m(this,e=0===e?0:e,e)}}),f&&r(s.prototype,"size",{get:function(){return p(this).size}}),s},setStrong:function(e,t,n){var r=t+" Iterator",o=v(t),i=v(r);c(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),s(t)}}},4909:(e,t,n)=>{"use strict";var r=n(1695),o=n(2086),i=n(7189),a=n(1007),u=n(2423),l=n(4722),c=n(1855),s=n(8759),f=n(3677),d=n(8939),p=n(914),h=n(5070);e.exports=function(e,t,n){var v=-1!==e.indexOf("Map"),m=-1!==e.indexOf("Weak"),g=v?"set":"add",y=o[e],b=y&&y.prototype,w=y,k={},x=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(m&&!s(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return m&&!s(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(m&&!s(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(m||b.forEach&&!f((function(){(new y).entries().next()})))))w=n.getConstructor(t,e,v,g),u.REQUIRED=!0;else if(i(e,!0)){var S=new w,E=S[g](m?{}:-0,1)!=S,O=f((function(){S.has(1)})),T=d((function(e){new y(e)})),C=!m&&f((function(){for(var e=new y,t=5;t--;)e[g](t,t);return!e.has(-0)}));T||((w=t((function(t,n){c(t,w,e);var r=h(new y,t,w);return null!=n&&l(n,r[g],r,v),r}))).prototype=b,b.constructor=w),(O||C)&&(x("delete"),x("has"),v&&x("get")),(C||E)&&x(g),m&&b.clear&&delete b.clear}return k[e]=w,r({global:!0,forced:w!=y},k),p(w,e),m||n.setStrong(w,e,v),w}},8474:(e,t,n)=>{var r=n(3167),o=n(6095),i=n(4399),a=n(7826);e.exports=function(e,t){for(var n=o(t),u=a.f,l=i.f,c=0;c{var r=n(211)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},7209:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},1068:(e,t,n)=>{var r=n(9586),o=/"/g;e.exports=function(e,t,n,i){var a=String(r(e)),u="<"+t;return""!==n&&(u+=" "+n+'="'+String(i).replace(o,""")+'"'),u+">"+a+""}},471:(e,t,n)=>{"use strict";var r=n(3083).IteratorPrototype,o=n(4710),i=n(5736),a=n(914),u=n(7719),l=function(){return this};e.exports=function(e,t,n){var c=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,c,!1,!0),u[c]=l,e}},2585:(e,t,n)=>{var r=n(5283),o=n(7826),i=n(5736);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},5736:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9720:(e,t,n)=>{"use strict";var r=n(1288),o=n(7826),i=n(5736);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},8432:(e,t,n)=>{"use strict";var r=n(1695),o=n(471),i=n(2130),a=n(7530),u=n(914),l=n(2585),c=n(1007),s=n(211),f=n(3296),d=n(7719),p=n(3083),h=p.IteratorPrototype,v=p.BUGGY_SAFARI_ITERATORS,m=s("iterator"),g=function(){return this};e.exports=function(e,t,n,s,p,y,b){o(n,t,s);var w,k,x,S=function(e){if(e===p&&P)return P;if(!v&&e in T)return T[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},E=t+" Iterator",O=!1,T=e.prototype,C=T[m]||T["@@iterator"]||p&&T[p],P=!v&&C||S(p),I="Array"==t&&T.entries||C;if(I&&(w=i(I.call(new e)),h!==Object.prototype&&w.next&&(f||i(w)===h||(a?a(w,h):"function"!=typeof w[m]&&l(w,m,g)),u(w,E,!0,!0),f&&(d[E]=g))),"values"==p&&C&&"values"!==C.name&&(O=!0,P=function(){return C.call(this)}),f&&!b||T[m]===P||l(T,m,P),d[t]=P,p)if(k={values:S("values"),keys:y?P:S("keys"),entries:S("entries")},b)for(x in k)(v||O||!(x in T))&&c(T,x,k[x]);else r({target:t,proto:!0,forced:v||O},k);return k}},4145:(e,t,n)=>{var r=n(9775),o=n(3167),i=n(9251),a=n(7826).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},5283:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},821:(e,t,n)=>{var r=n(2086),o=n(8759),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},933:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},4344:(e,t,n)=>{var r=n(4999);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},4999:(e,t,n)=>{var r=n(563);e.exports=r("navigator","userAgent")||""},1448:(e,t,n)=>{var r,o,i=n(2086),a=n(4999),u=i.process,l=u&&u.versions,c=l&&l.v8;c?o=(r=c.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},8684:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1695:(e,t,n)=>{var r=n(2086),o=n(4399).f,i=n(2585),a=n(1007),u=n(3648),l=n(8474),c=n(7189);e.exports=function(e,t){var n,s,f,d,p,h=e.target,v=e.global,m=e.stat;if(n=v?r:m?r[h]||u(h,{}):(r[h]||{}).prototype)for(s in t){if(d=t[s],f=e.noTargetGet?(p=o(n,s))&&p.value:n[s],!c(v?s:h+(m?".":"#")+s,e.forced)&&void 0!==f){if(typeof d==typeof f)continue;l(d,f)}(e.sham||f&&f.sham)&&i(d,"sham",!0),a(n,s,d,e)}}},3677:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},2331:(e,t,n)=>{"use strict";n(2077);var r=n(1007),o=n(3677),i=n(211),a=n(4861),u=n(2585),l=i("species"),c=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),s="$0"==="a".replace(/./,"$0"),f=i("replace"),d=!!/./[f]&&""===/./[f]("a","$0"),p=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,f){var h=i(e),v=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),m=v&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!v||!m||"replace"===e&&(!c||!s||d)||"split"===e&&!p){var g=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?v&&!o?{done:!0,value:g.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:s,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:d}),b=y[0],w=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return w.call(e,this,t)}:function(e){return w.call(e,this)})}f&&u(RegExp.prototype[h],"sham",!0)}},7561:(e,t,n)=>{"use strict";var r=n(6526),o=n(4005),i=n(8516),a=function(e,t,n,u,l,c,s,f){for(var d,p=l,h=0,v=!!s&&i(s,f,3);h0&&r(d))p=a(e,t,d,o(d.length),p,c-1)-1;else{if(p>=9007199254740991)throw TypeError("Exceed the acceptable array length");e[p]=d}p++}h++}return p};e.exports=a},6910:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},8516:(e,t,n)=>{var r=n(9944);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},2395:(e,t,n)=>{"use strict";var r=n(9944),o=n(8759),i=[].slice,a={},u=function(e,t,n){if(!(t in a)){for(var r=[],o=0;o{var r=n(9775),o=n(2086),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},1667:(e,t,n)=>{var r=n(375),o=n(7719),i=n(211)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},3546:(e,t,n)=>{var r=n(6112),o=n(1667);e.exports=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return r(t.call(e))}},6230:(e,t,n)=>{var r=n(3296),o=n(3546);e.exports=r?o:function(e){return Map.prototype.entries.call(e)}},5521:(e,t,n)=>{var r=n(3296),o=n(3546);e.exports=r?o:function(e){return Set.prototype.values.call(e)}},2086:(e,t,n)=>{var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||Function("return this")()},3167:e=>{var t={}.hasOwnProperty;e.exports=function(e,n){return t.call(e,n)}},7153:e=>{e.exports={}},1670:(e,t,n)=>{var r=n(2086);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},5963:(e,t,n)=>{var r=n(563);e.exports=r("document","documentElement")},6761:(e,t,n)=>{var r=n(5283),o=n(3677),i=n(821);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5974:(e,t,n)=>{var r=n(3677),o=n(2306),i="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==o(e)?i.call(e,""):Object(e)}:Object},5070:(e,t,n)=>{var r=n(8759),o=n(7530);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},9277:(e,t,n)=>{var r=n(4489),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},2423:(e,t,n)=>{var r=n(7153),o=n(8759),i=n(3167),a=n(7826).f,u=n(5422),l=n(6910),c=u("meta"),s=0,f=Object.isExtensible||function(){return!0},d=function(e){a(e,c,{value:{objectID:"O"+ ++s,weakData:{}}})},p=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,c)){if(!f(e))return"F";if(!t)return"E";d(e)}return e[c].objectID},getWeakData:function(e,t){if(!i(e,c)){if(!f(e))return!0;if(!t)return!1;d(e)}return e[c].weakData},onFreeze:function(e){return l&&p.REQUIRED&&f(e)&&!i(e,c)&&d(e),e}};r[c]=!0},3278:(e,t,n)=>{var r,o,i,a=n(9316),u=n(2086),l=n(8759),c=n(2585),s=n(3167),f=n(8944),d=n(7153),p=u.WeakMap;if(a){var h=new p,v=h.get,m=h.has,g=h.set;r=function(e,t){return g.call(h,e,t),t},o=function(e){return v.call(h,e)||{}},i=function(e){return m.call(h,e)}}else{var y=f("state");d[y]=!0,r=function(e,t){return c(e,y,t),t},o=function(e){return s(e,y)?e[y]:{}},i=function(e){return s(e,y)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},2814:(e,t,n)=>{var r=n(211),o=n(7719),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},6526:(e,t,n)=>{var r=n(2306);e.exports=Array.isArray||function(e){return"Array"==r(e)}},7189:(e,t,n)=>{var r=n(3677),o=/#|\.prototype\./,i=function(e,t){var n=u[a(e)];return n==c||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=i.data={},l=i.NATIVE="N",c=i.POLYFILL="P";e.exports=i},8759:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},3296:e=>{e.exports=!1},7994:(e,t,n)=>{var r=n(8759),o=n(2306),i=n(211)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},4722:(e,t,n)=>{var r=n(6112),o=n(2814),i=n(4005),a=n(8516),u=n(1667),l=n(7850),c=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,s,f){var d,p,h,v,m,g,y,b=a(t,n,s?2:1);if(f)d=e;else{if("function"!=typeof(p=u(e)))throw TypeError("Target is not iterable");if(o(p)){for(h=0,v=i(e.length);v>h;h++)if((m=s?b(r(y=e[h])[0],y[1]):b(e[h]))&&m instanceof c)return m;return new c(!1)}d=p.call(e)}for(g=d.next;!(y=g.call(d)).done;)if("object"==typeof(m=l(d,b,y.value,s))&&m&&m instanceof c)return m;return new c(!1)}).stop=function(e){return new c(!0,e)}},3083:(e,t,n)=>{"use strict";var r,o,i,a=n(2130),u=n(2585),l=n(3167),c=n(211),s=n(3296),f=c("iterator"),d=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):d=!0),null==r&&(r={}),s||l(r,f)||u(r,f,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},7719:e=>{e.exports={}},3173:(e,t,n)=>{var r,o,i,a,u,l,c,s,f=n(2086),d=n(4399).f,p=n(2306),h=n(4953).set,v=n(4344),m=f.MutationObserver||f.WebKitMutationObserver,g=f.process,y=f.Promise,b="process"==p(g),w=d(f,"queueMicrotask"),k=w&&w.value;k||(r=function(){var e,t;for(b&&(e=g.domain)&&e.exit();o;){t=o.fn,o=o.next;try{t()}catch(e){throw o?a():i=void 0,e}}i=void 0,e&&e.enter()},b?a=function(){g.nextTick(r)}:m&&!v?(u=!0,l=document.createTextNode(""),new m(r).observe(l,{characterData:!0}),a=function(){l.data=u=!u}):y&&y.resolve?(c=y.resolve(void 0),s=c.then,a=function(){s.call(c,r)}):a=function(){h.call(f,r)}),e.exports=k||function(e){var t={fn:e,next:void 0};i&&(i.next=t),o||(o=t,a()),i=t}},8109:(e,t,n)=>{var r=n(2086);e.exports=r.Promise},3193:(e,t,n)=>{var r=n(3677);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},4634:(e,t,n)=>{var r=n(3677),o=n(211),i=n(3296),a=o("iterator");e.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),i&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[a]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host}))},9316:(e,t,n)=>{var r=n(2086),o=n(9277),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},8722:(e,t,n)=>{"use strict";var r=n(9944),o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},7725:(e,t,n)=>{var r=n(7994);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},2252:(e,t,n)=>{var r=n(2086),o=n(4080).trim,i=n(9439),a=r.parseFloat,u=1/a(i+"-0")!=-1/0;e.exports=u?function(e){var t=o(String(e)),n=a(t);return 0===n&&"-"==t.charAt(0)?-0:n}:a},2194:(e,t,n)=>{var r=n(2086),o=n(4080).trim,i=n(9439),a=r.parseInt,u=/^[+-]?0[Xx]/,l=8!==a(i+"08")||22!==a(i+"0x16");e.exports=l?function(e,t){var n=o(String(e));return a(n,t>>>0||(u.test(n)?16:10))}:a},8675:(e,t,n)=>{"use strict";var r=n(5283),o=n(3677),i=n(8779),a=n(6952),u=n(7446),l=n(3060),c=n(5974),s=Object.assign,f=Object.defineProperty;e.exports=!s||o((function(){if(r&&1!==s({b:1},s(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=s({},e)[n]||"abcdefghijklmnopqrst"!=i(s({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,s=1,f=a.f,d=u.f;o>s;)for(var p,h=c(arguments[s++]),v=f?i(h).concat(f(h)):i(h),m=v.length,g=0;m>g;)p=v[g++],r&&!d.call(h,p)||(n[p]=h[p]);return n}:s},4710:(e,t,n)=>{var r,o=n(6112),i=n(7711),a=n(8684),u=n(7153),l=n(5963),c=n(821),s=n(8944),f=s("IE_PROTO"),d=function(){},p=function(e){return"\n \n ${editor.stylesheets\n .map((s) => {\n if (s.type === StylesheetType.css) {\n return ``;\n } else {\n return ``;\n }\n })\n .join(\"\")}\n ${header || \"\"}\n ${htmlText}`,\n ],\n { type: \"text/html\" }\n );\n\n if (beforeRenderIframePreviewOpt.scheme === \"blob\") {\n setSrc(URL.createObjectURL(blob));\n } else {\n const reader = new FileReader();\n reader.readAsDataURL(blob);\n reader.onload = () => {\n setSrc(reader.result?.toString() || \"\");\n };\n }\n }, [block.compiledHtml, header, htmlText]);\n\n useEffect(() => {\n const onMessage = (ev: MessageEvent): void => {\n const containerEl = containerElRef.current;\n\n if (\n !(\n containerEl &&\n ev.source ===\n (containerEl.firstChild as HTMLIFrameElement).contentWindow &&\n ev.data &&\n ev.data.blockId === block.id\n )\n ) {\n return;\n }\n\n switch (ev.data.method) {\n case \"MTBlockEditorInitSize\":\n if (!isDefaultSize(size)) {\n break;\n }\n\n setSize({ ...size, ...ev.data.arguments });\n break;\n case \"MTBlockEditorSetSize\":\n (Object.keys(size) as Array).forEach((k) => {\n const oldValue =\n typeof size[k] === \"number\"\n ? (size[k] as number)\n : parseFloat(size[k] as string);\n const newValue =\n typeof ev.data.arguments[k] === \"number\"\n ? (ev.data.arguments[k] as number)\n : parseFloat(ev.data.arguments[k] as string);\n if (\n oldValue &&\n newValue &&\n oldValue > newValue &&\n Math.abs(oldValue - newValue) < SHRINK_THRESHOLD\n ) {\n ev.data.arguments[k] = size[k];\n }\n });\n\n if (\n size.width !== ev.data.arguments.width ||\n size.height !== ev.data.arguments.height\n ) {\n setSize(ev.data.arguments);\n }\n break;\n case \"MTBlockEditorOnClick\":\n (\n containerEl.closest(\"[data-mt-block-editor-block-id]\") ||\n (containerEl.getRootNode() as ShadowRoot)?.host\n )?.dispatchEvent(\n new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n ...ev.data.arguments,\n })\n );\n break;\n case \"MTBlockEditorOnKeydown\":\n window.dispatchEvent(new KeyboardEvent(\"keydown\", ev.data.arguments));\n break;\n case \"MTBlockEditorSetCompiledHtml\":\n setCompiledHtml(\n ev.data.html,\n ev.data.html ? null : new Error(ev.data.error || \"Error\"),\n {\n addEditHistory:\n ev.data.arguments && ev.data.arguments.addEditHistory,\n }\n );\n break;\n }\n };\n\n window.addEventListener(\"message\", onMessage, {\n capture: true,\n passive: true,\n });\n return () => {\n window.removeEventListener(\"message\", onMessage, {\n capture: true,\n });\n };\n }, [size]);\n\n return (\n
\n \n
\n );\n};\n\nexport default BlockIframePreview;\n","import { t } from \"../i18n\";\nimport React, {\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n CSSProperties,\n} from \"react\";\nimport { render, unmountComponentAtNode } from \"react-dom\";\nimport {\n EditorContext,\n useEditorContext,\n BlocksContext,\n BlocksContextProps,\n} from \"../Context\";\nimport Block, {\n NewFromHtmlOptions,\n EditorOptions,\n SerializeOptions,\n CompileOptions,\n HasBlocks,\n} from \"../Block\";\nimport AddButton from \"../Component/AddButton\";\nimport BlockItem from \"../Component/BlockItem\";\nimport BlockIframePreview from \"../Component/BlockIframePreview\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport {\n parseContent,\n NO_BLOCK_TYPE_FALLBACK,\n preParseContent,\n escapeSingleQuoteAttribute,\n ParserContext,\n} from \"../util\";\n\ninterface EditorProps extends EditorOptions {\n block: Column;\n}\n\nconst COMPILE_TIMEOUT = 2000;\n\nconst STYLE_HIDDEN: CSSProperties = {\n position: \"absolute\",\n overflow: \"hidden\",\n height: \"0px\",\n border: \"none\",\n};\n\nconst Editor: React.FC = ({\n block,\n focus,\n focusBlock,\n focusDescendant,\n canRemove,\n}: EditorProps) => {\n if (\n (block.constructor as typeof Block).typeId !== \"core-column\" ||\n canRemove === undefined\n ) {\n canRemove = block.canRemoveBlock;\n }\n\n const { editor, setFocusedIds } = useEditorContext();\n\n const blocksContext = useMemo(\n () => ({\n panelBlockTypes: block.panelBlockTypes,\n shortcutBlockTypes: block.shortcutBlockTypes,\n addBlock: (b: Block, index: number | Block) => {\n if (index instanceof Block) {\n index = block.blocks.indexOf(index) + 1;\n }\n editor.addBlock(block, b, index);\n setFocusedIds([b.id]);\n },\n mergeBlock: (b: Block) => {\n const index = block.blocks.indexOf(b);\n if (editor.mergeBlock(block, b)) {\n setFocusedIds([block.blocks[index - 1].id]);\n }\n },\n removeBlock: (b: Block) => {\n const index = block.blocks.indexOf(b);\n editor.removeBlock(block, b);\n if (index > 0) {\n setFocusedIds([block.blocks[index - 1].id]);\n }\n },\n swapBlocks: (dragIndex: number, hoverIndex: number, scroll?: boolean) => {\n if (\n dragIndex === undefined ||\n hoverIndex === undefined ||\n !block.blocks[dragIndex] ||\n !block.blocks[hoverIndex]\n ) {\n return;\n }\n\n if (scroll) {\n const destEl = block.blocks[dragIndex].wrapperRef.current;\n if (!destEl) {\n return;\n }\n\n const rect = destEl.getBoundingClientRect();\n const scrollTop =\n window.pageYOffset || document.documentElement.scrollTop;\n const offsetTop = rect.height + 22;\n\n window.scrollTo({\n top: scrollTop + (dragIndex > hoverIndex ? -offsetTop : offsetTop),\n behavior: \"smooth\",\n });\n }\n\n editor.swapBlocks(block, dragIndex, hoverIndex);\n },\n }),\n []\n );\n\n const resetCompiledHtml = useCallback(() => {\n block.resetCompiledHtml();\n }, []);\n useEffect(() => {\n editor.on(\"change\", resetCompiledHtml);\n\n if (block._html !== \"\") {\n parseContent(\n preParseContent(block._html),\n editor.factory,\n new ParserContext()\n ).then((blocks) => {\n block._html = \"\";\n block.blocks = blocks;\n if (blocks[0]) {\n setFocusedIds([blocks[0].id]);\n }\n });\n }\n\n return () => {\n editor.off(\"change\", resetCompiledHtml);\n };\n }, []);\n\n useEffect(() => {\n if (focusDescendant) {\n resetCompiledHtml();\n return;\n }\n\n if (\n (block.constructor as typeof Block).shouldBeCompiled &&\n !block.compiledHtml &&\n !focus &&\n !focusDescendant\n ) {\n block.compile({ editor });\n }\n }, [focus, focusDescendant]);\n\n const res = (\n \n \n {block.blocks.map((b, i) => {\n const focusFirstBlock = canRemove !== true && block.blocks.length === 1;\n const focusItem = (focus && focusFirstBlock) || undefined;\n return (\n \n );\n })}\n {canRemove && (\n
\n \n
\n )}\n
\n );\n\n if (block.rootBlock) {\n return React.createElement(\n block.rootBlock,\n {\n className: \"mt-be-column\",\n style: {\n width: \"100%\",\n },\n },\n res\n );\n } else {\n return res;\n }\n};\n\nclass Column extends Block implements HasBlocks {\n public static typeId = \"core-column\";\n public static className = \"mt-be-column\";\n public static rootBlock: string | null = \"div\";\n public static selectable = false;\n public static showPreview = true;\n public static get label(): string {\n return t(\"Column\");\n }\n\n public _html = \"\";\n public previewHeader = \"\";\n public showShortcuts = true;\n public blocks: Block[] = [];\n public cancelOngoingCompilationHandlers: (() => void)[] = [];\n\n public canRemoveBlock = true;\n public panelBlockTypes: string[] | null = null;\n public shortcutBlockTypes: string[] | null = null;\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public childBlocks(): Block[] {\n return this.blocks;\n }\n\n public get rootBlock(): string | null {\n return (this.constructor as typeof Column).rootBlock;\n }\n\n public get showPreview(): boolean {\n return (this.constructor as typeof Column).showPreview;\n }\n\n public resetCompiledHtml(): void {\n this.compiledHtml = \"\";\n\n this.cancelOngoingCompilationHandlers.map((h) => {\n h();\n });\n this.cancelOngoingCompilationHandlers = [];\n }\n\n public editor({\n focus,\n focusBlock,\n focusDescendant,\n canRemove,\n }: EditorOptions): JSX.Element {\n if (\n this.showPreview &&\n (this.constructor as typeof Column).typeId !== \"core-column\" &&\n ((this._html === \"\" &&\n this.blocks.length === 0 &&\n this.effectiveAddableBlockTypes().length === 0) ||\n (!focus && !focusDescendant && !focusBlock))\n ) {\n let preview: JSX.Element;\n\n const iframePreview = (\n \n );\n\n if (this.rootBlock) {\n preview = React.createElement(\n this.rootBlock,\n {\n key: this.id,\n className: \"mt-be-column\",\n style: {\n width: \"100%\",\n },\n },\n iframePreview\n );\n } else {\n preview = iframePreview;\n }\n\n return preview;\n }\n\n return (\n \n \n \n );\n }\n\n public isBlank(): boolean {\n return this.blocks.length === 0;\n }\n\n public async serializedString(opts: SerializeOptions): Promise {\n const classNames = [\n (this.constructor as typeof Column).className,\n this.className,\n ].filter((c) => c);\n const serializedBlocks = await Promise.all(\n this.blocks.map((c) => c.serialize(opts))\n );\n\n return [\n this.rootBlock\n ? `<${this.rootBlock}${\n classNames.length\n ? ` class='${escapeSingleQuoteAttribute(classNames.join(\" \"))}'`\n : \"\"\n }>`\n : \"\",\n serializedBlocks.join(\"\"),\n this.rootBlock ? `` : \"\",\n ].join(\"\");\n }\n\n public async compile({ editor }: CompileOptions): Promise {\n let canceled = false;\n this.cancelOngoingCompilationHandlers.push(() => {\n canceled = true;\n });\n const onBeforeSetCompiledHtml = (): boolean => !canceled;\n\n const sourceHtml = await this.serializedString({ editor, external: false });\n return new Promise((resolve, reject) => {\n let timeoutId: ReturnType | null = null;\n\n const div = document.createElement(\"div\");\n Object.assign(div.style, STYLE_HIDDEN);\n document.body.appendChild(div);\n\n const onSetCompiledHtml = (error: Error | null): void => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n unmountComponentAtNode(div);\n div.remove();\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n };\n\n const editorContext = {\n editor,\n setFocusedIds: () => undefined,\n getFocusedIds: () => [],\n };\n\n render(\n \n \n ,\n div\n );\n\n const opts = editor.opts.block[\"core-column\"] || {};\n timeoutId = setTimeout(async () => {\n if (!canceled) {\n this.compiledHtml ||= sourceHtml;\n }\n onSetCompiledHtml(null);\n }, opts[\"compile-timeout\"] || COMPILE_TIMEOUT);\n });\n }\n\n public async serialize(opts: SerializeOptions): Promise {\n if (\n (this.constructor as typeof Block).shouldBeCompiled ||\n this.compiledHtml\n ) {\n return super.serialize(opts);\n }\n\n const m = opts.editor.serializeMeta(this, opts.external);\n const typeId = (this.constructor as typeof Column).typeId;\n return [\n ``,\n await this.serializedString(opts),\n ``,\n ].join(\"\");\n }\n\n public static async newFromHtml({\n node,\n factory,\n meta,\n context,\n }: NewFromHtmlOptions): Promise {\n const html = node.hasAttribute(\"h\")\n ? preParseContent(node.getAttribute(\"h\") || \"\")\n : node.innerHTML;\n const blocks = await parseContent(\n html,\n factory,\n context,\n NO_BLOCK_TYPE_FALLBACK\n );\n const compiledHtml = node.hasAttribute(\"h\") ? node.textContent : \"\";\n\n return new this(\n Object.assign(\n { blocks, compiledHtml, _html: \"\" },\n meta as Partial\n )\n );\n }\n\n private effectiveAddableBlockTypes(): string[] {\n if (!this.canRemoveBlock) {\n return [];\n }\n return (this.panelBlockTypes || []).concat(this.shortcutBlockTypes || []);\n }\n}\n\nexport default Column;\n","import Editor from \"../Editor\";\nimport Block from \"../Block\";\nimport BlockFactory from \"../BlockFactory\";\nimport Text from \"../Block/Text\";\nimport Column from \"../Block/Column\";\nimport ParserContext from \"./ParserContext\";\n\nexport const preParseContent = (() => {\n const entityMap = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n } as { [key: string]: string };\n const entityReverseMap = Object.fromEntries(\n Object.entries(entityMap).map(([k, v]) => [v, k])\n );\n const entityRegExp = new RegExp(`[${Object.keys(entityMap).join(\"\")}]`, \"g\");\n const entityReverseRegExp = new RegExp(\n `(?:${Object.keys(entityReverseMap).join(\"|\")})`,\n \"g\"\n );\n\n return (value: string): string => {\n return value\n .replace(entityRegExp, (match) => entityMap[match])\n .replace(/<!--\\s+(\\/?mt-beb.*?)-->/g, (all, tag: string) => {\n return `<${tag.replace(\n entityReverseRegExp,\n (match) => entityReverseMap[match]\n )}>`;\n });\n };\n})();\n\nexport function removeControlCharacters(str: string): string {\n return str.replace(\n // eslint-disable-next-line no-control-regex,no-misleading-character-class\n /&#(?:0*?(?:[0-8]|1[124-9]|2\\d|3[01])?|x0*?(?:[0-8bcefBCEF]|1[0-9a-fA-F])?);|[^\\x09\\x0A\\x0D\\x20-\\xFF\\x85\\xA0-\\uD7FF\\uE000-\\uFDCF\\uFDE0-\\uFFFD\\uD800-\\uDBFF\\uDC00-\\uDFFF]/gm,\n \"\"\n );\n}\n\nexport const NO_BLOCK_TYPE_FALLBACK = \"\";\n\nexport async function parseContent(\n value: string,\n factory: BlockFactory,\n context: ParserContext,\n fallbackBlockType: string | typeof NO_BLOCK_TYPE_FALLBACK = \"core-html\"\n): Promise {\n if (!value) {\n return [];\n }\n\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(\n `${removeControlCharacters(value)}`,\n \"application/xml\"\n );\n\n if (!doc.children[0]) {\n return [];\n }\n\n let children = [...doc.children[0].children];\n if (children.length === 0) {\n if (fallbackBlockType !== NO_BLOCK_TYPE_FALLBACK) {\n const fallback = document.createElement(\"div\");\n fallback.setAttribute(\"t\", fallbackBlockType);\n fallback.innerHTML = value;\n children = [fallback];\n } else {\n return [];\n }\n }\n\n // TODO: verify\n const blocks = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n const typeId = node.getAttribute(\"t\") || \"core-text\";\n\n const metaRawValue = node.getAttribute(\"m\") || \"{}\";\n const metaArray = (metaRawValue.match(/\\w+|,|.+/g) || [])\n .filter((str) => str !== \",\")\n .map((str) =>\n /^[^{]/.test(str) ? context.get(str) || {} : JSON.parse(str)\n );\n const meta =\n metaArray.length === 1\n ? metaArray[0]\n : Object.assign.apply(null, [{}, ...metaArray]);\n\n if (typeId === \"core-context\") {\n for (const k in meta) {\n context.set(k, meta[k]);\n }\n continue;\n }\n\n let html = node.getAttribute(\"h\") || \"\";\n if (!html && node.textContent) {\n let c = node.textContent;\n if (meta.className) {\n c = c.replace(\n /^(<[^>]+)( class=\")([^\"]+)\"/,\n (m, tag, prefix, classNames) => {\n const filtered = classNames\n .split(/\\s+/)\n .filter((c: string) => c !== meta.className)\n .join(\" \");\n\n if (filtered) {\n return `${tag}${prefix}${filtered}\"`;\n } else {\n return tag;\n }\n }\n );\n }\n html = c;\n }\n\n const param = {\n html,\n node,\n factory,\n meta,\n context,\n };\n\n const t =\n factory.types().find((t: typeof Block) => t.typeId === typeId) || Column;\n const block = await t\n .newFromHtml(param)\n .catch(() => Text.newFromHtml(param));\n blocks.push(block);\n }\n\n return blocks;\n}\n\nconst emptyBlocks: Block[] = [];\nexport function findDescendantBlocks(\n ancestor: Block | Editor,\n ids: Readonly\n): Readonly {\n if (ids.length === 0) {\n return emptyBlocks;\n }\n\n const childBlocks =\n ancestor instanceof Editor ? ancestor.blocks : ancestor.childBlocks();\n if (childBlocks.length === 0) {\n return emptyBlocks;\n }\n\n return findDescendantBlocksInternal([...ids], childBlocks);\n}\n\nfunction findDescendantBlocksInternal(\n ids: string[],\n childBlocks: Readonly\n): Readonly {\n const result: Block[] = [];\n for (let i = 0, len = childBlocks.length; i < len; i++) {\n const b = childBlocks[i];\n const index = ids.indexOf(b.id);\n if (index !== -1) {\n result.push(b);\n ids.splice(index, 1);\n if (ids.length === 0) {\n return result;\n }\n }\n\n result.push(...findDescendantBlocksInternal(ids, b.childBlocks()));\n if (ids.length === 0) {\n return result;\n }\n }\n\n return result;\n}\n\ninterface GetBlocksByRangeState {\n ids: Readonly>;\n rootBlocks: Readonly;\n foundCount: number;\n startBlocks?: Readonly;\n endBlocks?: Readonly;\n result?: Readonly;\n}\nexport function getBlocksByRange(\n ancestor: Block | Editor,\n ids: Readonly\n): Readonly {\n const childBlocks =\n ancestor instanceof Editor ? ancestor.blocks : ancestor.childBlocks();\n const state: GetBlocksByRangeState = {\n ids: new Set(ids),\n rootBlocks: childBlocks,\n foundCount: 0,\n };\n getBlocksByRangeInternal(childBlocks, state);\n return state.result || emptyBlocks;\n}\n\nfunction getBlocksByRangeInternal(\n childBlocks: Readonly,\n state: GetBlocksByRangeState,\n parents: Readonly = []\n): Readonly | undefined {\n if (state.result && state.foundCount === state.ids.size) {\n return;\n }\n childBlocks.forEach((b) => {\n const currentBlocks = [...parents, b];\n\n getBlocksByRangeInternal(b.childBlocks(), state, currentBlocks);\n if (state.result && state.foundCount === state.ids.size) {\n return;\n }\n if (state.ids.has(b.id)) {\n state.foundCount++;\n\n if (state.ids.size === 1) {\n state.result = [b];\n } else if (state.startBlocks) {\n let range: {\n blocks: Readonly;\n start: string;\n end: string;\n };\n findRange: for (let i = state.startBlocks.length - 2; i >= 0; i--) {\n for (let j = currentBlocks.length - 2; j >= 0; j--) {\n if (state.startBlocks[i] === currentBlocks[j]) {\n range = {\n blocks: state.startBlocks[i].childBlocks(),\n start: state.startBlocks[i + 1].id,\n end: currentBlocks[j + 1].id,\n };\n break findRange;\n }\n }\n }\n\n range ||= {\n blocks: state.rootBlocks,\n start: state.startBlocks[0].id,\n end: currentBlocks[0].id,\n };\n\n const blockIds = range.blocks.map((b) => b.id);\n state.result = range.blocks.slice(\n blockIds.indexOf(range.start),\n blockIds.indexOf(range.end) + 1\n );\n } else {\n state.startBlocks = currentBlocks;\n }\n }\n });\n}\n","import platform from \"platform\";\n\nconst labels = {\n mac: {\n cmd: \"⌘\",\n alt: \"⌥\",\n ctrl: \"⌃\",\n shift: \"⇧\",\n },\n other: {\n cmd: \"Ctrl+\",\n alt: \"Alt+\",\n ctrl: \"Ctrl+\",\n shift: \"Shift+\",\n },\n};\n\nlet isMac = false;\nlet labelMap = labels.other;\n\nexport function setPlatform(_platform: typeof platform): void {\n isMac = [\"OS X\", \"iOS\"].includes(_platform.os?.family || \"\");\n labelMap = isMac ? labels.mac : labels.other;\n}\nsetPlatform(platform);\n\nexport function toKeyboardShortcutKey(ev: KeyboardEvent): string {\n return `${ev.ctrlKey && isMac ? \"ctrl+\" : \"\"}${ev.altKey ? \"alt+\" : \"\"}${\n ev.shiftKey ? \"shift+\" : \"\"\n }${ev.metaKey || (ev.ctrlKey && !isMac) ? \"cmd+\" : \"\"}${ev.key}`;\n}\n\nexport function toKeyboardShortcutLabel(key: string): string {\n return key.replace(\n /(ctrl|cmd|alt|shift)\\+/g,\n (all, key: keyof typeof labelMap) => {\n return labelMap[key] || key;\n }\n );\n}\n","class ParserContext extends Map {}\n\nexport default ParserContext;\n","export var INIT_COORDS = 'dnd-core/INIT_COORDS';\nexport var BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';\nexport var PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';\nexport var HOVER = 'dnd-core/HOVER';\nexport var DROP = 'dnd-core/DROP';\nexport var END_DRAG = 'dnd-core/END_DRAG';","import { INIT_COORDS } from '../types';\nexport function setClientOffset(clientOffset, sourceClientOffset) {\n return {\n type: INIT_COORDS,\n payload: {\n sourceClientOffset: sourceClientOffset || null,\n clientOffset: clientOffset || null\n }\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// cheap lodash replacements\n\n/**\n * drop-in replacement for _.get\n * @param obj\n * @param path\n * @param defaultValue\n */\nexport function get(obj, path, defaultValue) {\n return path.split('.').reduce(function (a, c) {\n return a && a[c] ? a[c] : defaultValue || null;\n }, obj);\n}\n/**\n * drop-in replacement for _.without\n */\n\nexport function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isString(input) {\n return typeof input === 'string';\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isObject(input) {\n return _typeof(input) === 'object';\n}\n/**\n * repalcement for _.xor\n * @param itemsA\n * @param itemsB\n */\n\nexport function xor(itemsA, itemsB) {\n var map = new Map();\n\n var insertItem = function insertItem(item) {\n map.set(item, map.has(item) ? map.get(item) + 1 : 1);\n };\n\n itemsA.forEach(insertItem);\n itemsB.forEach(insertItem);\n var result = [];\n map.forEach(function (count, key) {\n if (count === 1) {\n result.push(key);\n }\n });\n return result;\n}\n/**\n * replacement for _.intersection\n * @param itemsA\n * @param itemsB\n */\n\nexport function intersection(itemsA, itemsB) {\n return itemsA.filter(function (t) {\n return itemsB.indexOf(t) > -1;\n });\n}","import { invariant } from '@react-dnd/invariant';\nimport { setClientOffset } from './local/setClientOffset';\nimport { isObject } from '../../utils/js_utils';\nimport { BEGIN_DRAG, INIT_COORDS } from './types';\nvar ResetCoordinatesAction = {\n type: INIT_COORDS,\n payload: {\n clientOffset: null,\n sourceClientOffset: null\n }\n};\nexport function createBeginDrag(manager) {\n return function beginDrag() {\n var sourceIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n publishSource: true\n };\n var _options$publishSourc = options.publishSource,\n publishSource = _options$publishSourc === void 0 ? true : _options$publishSourc,\n clientOffset = options.clientOffset,\n getSourceClientOffset = options.getSourceClientOffset;\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry(); // Initialize the coordinates using the client offset\n\n manager.dispatch(setClientOffset(clientOffset));\n verifyInvariants(sourceIds, monitor, registry); // Get the draggable source\n\n var sourceId = getDraggableSource(sourceIds, monitor);\n\n if (sourceId === null) {\n manager.dispatch(ResetCoordinatesAction);\n return;\n } // Get the source client offset\n\n\n var sourceClientOffset = null;\n\n if (clientOffset) {\n if (!getSourceClientOffset) {\n throw new Error('getSourceClientOffset must be defined');\n }\n\n verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);\n sourceClientOffset = getSourceClientOffset(sourceId);\n } // Initialize the full coordinates\n\n\n manager.dispatch(setClientOffset(clientOffset, sourceClientOffset));\n var source = registry.getSource(sourceId);\n var item = source.beginDrag(monitor, sourceId); // If source.beginDrag returns null, this is an indicator to cancel the drag\n\n if (item == null) {\n return undefined;\n }\n\n verifyItemIsObject(item);\n registry.pinSource(sourceId);\n var itemType = registry.getSourceType(sourceId);\n return {\n type: BEGIN_DRAG,\n payload: {\n itemType: itemType,\n item: item,\n sourceId: sourceId,\n clientOffset: clientOffset || null,\n sourceClientOffset: sourceClientOffset || null,\n isSourcePublic: !!publishSource\n }\n };\n };\n}\n\nfunction verifyInvariants(sourceIds, monitor, registry) {\n invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');\n sourceIds.forEach(function (sourceId) {\n invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');\n });\n}\n\nfunction verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {\n invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');\n}\n\nfunction verifyItemIsObject(item) {\n invariant(isObject(item), 'Item must be an object.');\n}\n\nfunction getDraggableSource(sourceIds, monitor) {\n var sourceId = null;\n\n for (var i = sourceIds.length - 1; i >= 0; i--) {\n if (monitor.canDragSource(sourceIds[i])) {\n sourceId = sourceIds[i];\n break;\n }\n }\n\n return sourceId;\n}","import { PUBLISH_DRAG_SOURCE } from './types';\nexport function createPublishDragSource(manager) {\n return function publishDragSource() {\n var monitor = manager.getMonitor();\n\n if (monitor.isDragging()) {\n return {\n type: PUBLISH_DRAG_SOURCE\n };\n }\n };\n}","export function matchesType(targetType, draggedItemType) {\n if (draggedItemType === null) {\n return targetType === null;\n }\n\n return Array.isArray(targetType) ? targetType.some(function (t) {\n return t === draggedItemType;\n }) : targetType === draggedItemType;\n}","import { invariant } from '@react-dnd/invariant';\nimport { matchesType } from '../../utils/matchesType';\nimport { HOVER } from './types';\nexport function createHover(manager) {\n return function hover(targetIdsArg) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n clientOffset = _ref.clientOffset;\n\n verifyTargetIdsIsArray(targetIdsArg);\n var targetIds = targetIdsArg.slice(0);\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n checkInvariants(targetIds, monitor, registry);\n var draggedItemType = monitor.getItemType();\n removeNonMatchingTargetIds(targetIds, registry, draggedItemType);\n hoverAllTargets(targetIds, monitor, registry);\n return {\n type: HOVER,\n payload: {\n targetIds: targetIds,\n clientOffset: clientOffset || null\n }\n };\n };\n}\n\nfunction verifyTargetIdsIsArray(targetIdsArg) {\n invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');\n}\n\nfunction checkInvariants(targetIds, monitor, registry) {\n invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call hover after drop.');\n\n for (var i = 0; i < targetIds.length; i++) {\n var targetId = targetIds[i];\n invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');\n var target = registry.getTarget(targetId);\n invariant(target, 'Expected targetIds to be registered.');\n }\n}\n\nfunction removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {\n // Remove those targetIds that don't match the targetType. This\n // fixes shallow isOver which would only be non-shallow because of\n // non-matching targets.\n for (var i = targetIds.length - 1; i >= 0; i--) {\n var targetId = targetIds[i];\n var targetType = registry.getTargetType(targetId);\n\n if (!matchesType(targetType, draggedItemType)) {\n targetIds.splice(i, 1);\n }\n }\n}\n\nfunction hoverAllTargets(targetIds, monitor, registry) {\n // Finally call hover on all matching targets.\n targetIds.forEach(function (targetId) {\n var target = registry.getTarget(targetId);\n target.hover(monitor, targetId);\n });\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { DROP } from './types';\nimport { isObject } from '../../utils/js_utils';\nexport function createDrop(manager) {\n return function drop() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyInvariants(monitor);\n var targetIds = getDroppableTargets(monitor); // Multiple actions are dispatched here, which is why this doesn't return an action\n\n targetIds.forEach(function (targetId, index) {\n var dropResult = determineDropResult(targetId, index, registry, monitor);\n var action = {\n type: DROP,\n payload: {\n dropResult: _objectSpread(_objectSpread({}, options), dropResult)\n }\n };\n manager.dispatch(action);\n });\n };\n}\n\nfunction verifyInvariants(monitor) {\n invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');\n}\n\nfunction determineDropResult(targetId, index, registry, monitor) {\n var target = registry.getTarget(targetId);\n var dropResult = target ? target.drop(monitor, targetId) : undefined;\n verifyDropResultType(dropResult);\n\n if (typeof dropResult === 'undefined') {\n dropResult = index === 0 ? {} : monitor.getDropResult();\n }\n\n return dropResult;\n}\n\nfunction verifyDropResultType(dropResult) {\n invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');\n}\n\nfunction getDroppableTargets(monitor) {\n var targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);\n targetIds.reverse();\n return targetIds;\n}","import { invariant } from '@react-dnd/invariant';\nimport { END_DRAG } from './types';\nexport function createEndDrag(manager) {\n return function endDrag() {\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyIsDragging(monitor);\n var sourceId = monitor.getSourceId();\n\n if (sourceId != null) {\n var source = registry.getSource(sourceId, true);\n source.endDrag(monitor, sourceId);\n registry.unpinSource();\n }\n\n return {\n type: END_DRAG\n };\n };\n}\n\nfunction verifyIsDragging(monitor) {\n invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { createDragDropActions } from '../actions/dragDrop';\nexport var DragDropManagerImpl = /*#__PURE__*/function () {\n function DragDropManagerImpl(store, monitor) {\n var _this = this;\n\n _classCallCheck(this, DragDropManagerImpl);\n\n this.isSetUp = false;\n\n this.handleRefCountChange = function () {\n var shouldSetUp = _this.store.getState().refCount > 0;\n\n if (_this.backend) {\n if (shouldSetUp && !_this.isSetUp) {\n _this.backend.setup();\n\n _this.isSetUp = true;\n } else if (!shouldSetUp && _this.isSetUp) {\n _this.backend.teardown();\n\n _this.isSetUp = false;\n }\n }\n };\n\n this.store = store;\n this.monitor = monitor;\n store.subscribe(this.handleRefCountChange);\n }\n\n _createClass(DragDropManagerImpl, [{\n key: \"receiveBackend\",\n value: function receiveBackend(backend) {\n this.backend = backend;\n }\n }, {\n key: \"getMonitor\",\n value: function getMonitor() {\n return this.monitor;\n }\n }, {\n key: \"getBackend\",\n value: function getBackend() {\n return this.backend;\n }\n }, {\n key: \"getRegistry\",\n value: function getRegistry() {\n return this.monitor.registry;\n }\n }, {\n key: \"getActions\",\n value: function getActions() {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n var manager = this;\n var dispatch = this.store.dispatch;\n\n function bindActionCreator(actionCreator) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var action = actionCreator.apply(manager, args);\n\n if (typeof action !== 'undefined') {\n dispatch(action);\n }\n };\n }\n\n var actions = createDragDropActions(this);\n return Object.keys(actions).reduce(function (boundActions, key) {\n var action = actions[key];\n boundActions[key] = bindActionCreator(action);\n return boundActions;\n }, {});\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(action) {\n this.store.dispatch(action);\n }\n }]);\n\n return DragDropManagerImpl;\n}();","import { createBeginDrag } from './beginDrag';\nimport { createPublishDragSource } from './publishDragSource';\nimport { createHover } from './hover';\nimport { createDrop } from './drop';\nimport { createEndDrag } from './endDrag';\nexport * from './types';\nexport function createDragDropActions(manager) {\n return {\n beginDrag: createBeginDrag(manager),\n publishDragSource: createPublishDragSource(manager),\n hover: createHover(manager),\n drop: createDrop(manager),\n endDrag: createEndDrag(manager)\n };\n}","import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\n\n/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nfunction formatProdErrorMessage(code) {\n return \"Minified Redux error #\" + code + \"; visit https://redux.js.org/Errors?code=\" + code + \" for the full message or \" + 'use the non-minified dev environment for full errors. ';\n}\n\n// Inlined version of the `symbol-observable` polyfill\nvar $$observable = (function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n})();\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nfunction miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n var constructorName = ctorName(val);\n\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n } // other\n\n\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\n\nfunction ctorName(val) {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\n\nfunction isError(val) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\n\nfunction kindOf(val) {\n var typeOfVal = typeof val;\n\n if (process.env.NODE_ENV !== 'production') {\n typeOfVal = miniKindOf(val);\n }\n\n return typeOfVal;\n}\n\n/**\n * @deprecated\n *\n * **We recommend using the `configureStore` method\n * of the `@reduxjs/toolkit` package**, which replaces `createStore`.\n *\n * Redux Toolkit is our recommended approach for writing Redux logic today,\n * including store setup, reducers, data fetching, and more.\n *\n * **For more details, please read this Redux docs page:**\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * `configureStore` from Redux Toolkit is an improved version of `createStore` that\n * simplifies setup and helps avoid common bugs.\n *\n * You should not be using the `redux` core package by itself today, except for learning purposes.\n * The `createStore` method from the core `redux` package will not be removed, but we encourage\n * all users to migrate to using Redux Toolkit for all Redux code.\n *\n * If you want to use `createStore` without this visual deprecation warning, use\n * the `legacy_createStore` import instead:\n *\n * `import { legacy_createStore as createStore} from 'redux'`\n *\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(1) : \"Expected the enhancer to be a function. Instead, received: '\" + kindOf(enhancer) + \"'\");\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(2) : \"Expected the root reducer to be a function. Instead, received: '\" + kindOf(reducer) + \"'\");\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(4) : \"Expected the listener to be a function. Instead, received: '\" + kindOf(listener) + \"'\");\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(7) : \"Actions must be plain objects. Instead, the actual type was: '\" + kindOf(action) + \"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.\");\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(8) : 'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.');\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(10) : \"Expected the nextReducer to be a function. Instead, received: '\" + kindOf(nextReducer));\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(11) : \"Expected the observer to be an object. Instead, received: '\" + kindOf(observer) + \"'\");\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n/**\n * Creates a Redux store that holds the state tree.\n *\n * **We recommend using `configureStore` from the\n * `@reduxjs/toolkit` package**, which replaces `createStore`:\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nvar legacy_createStore = createStore;\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + kindOf(inputState) + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(12) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(13) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle '\" + ActionTypes.INIT + \"' or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(14) : \"When called with an action of type \" + (actionType ? \"\\\"\" + String(actionType) + \"\\\"\" : '(unknown type)') + \", the slice reducer for key \\\"\" + _key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\");\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(16) : \"bindActionCreators expected an object or a function, but instead received: '\" + kindOf(actionCreators) + \"'. \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore };\n","export var strictEquality = function strictEquality(a, b) {\n return a === b;\n};\n/**\n * Determine if two cartesian coordinate offsets are equal\n * @param offsetA\n * @param offsetB\n */\n\nexport function areCoordsEqual(offsetA, offsetB) {\n if (!offsetA && !offsetB) {\n return true;\n } else if (!offsetA || !offsetB) {\n return false;\n } else {\n return offsetA.x === offsetB.x && offsetA.y === offsetB.y;\n }\n}\n/**\n * Determines if two arrays of items are equal\n * @param a The first array of items\n * @param b The second array of items\n */\n\nexport function areArraysEqual(a, b) {\n var isEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : strictEquality;\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (var i = 0; i < a.length; ++i) {\n if (!isEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { INIT_COORDS, BEGIN_DRAG, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { areCoordsEqual } from '../utils/equality';\nvar initialState = {\n initialSourceClientOffset: null,\n initialClientOffset: null,\n clientOffset: null\n};\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case INIT_COORDS:\n case BEGIN_DRAG:\n return {\n initialSourceClientOffset: payload.sourceClientOffset,\n initialClientOffset: payload.clientOffset,\n clientOffset: payload.clientOffset\n };\n\n case HOVER:\n if (areCoordsEqual(state.clientOffset, payload.clientOffset)) {\n return state;\n }\n\n return _objectSpread(_objectSpread({}, state), {}, {\n clientOffset: payload.clientOffset\n });\n\n case END_DRAG:\n case DROP:\n return initialState;\n\n default:\n return state;\n }\n}","export var ADD_SOURCE = 'dnd-core/ADD_SOURCE';\nexport var ADD_TARGET = 'dnd-core/ADD_TARGET';\nexport var REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';\nexport var REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';\nexport function addSource(sourceId) {\n return {\n type: ADD_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function addTarget(targetId) {\n return {\n type: ADD_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}\nexport function removeSource(sourceId) {\n return {\n type: REMOVE_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function removeTarget(targetId) {\n return {\n type: REMOVE_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { REMOVE_TARGET } from '../actions/registry';\nimport { without } from '../utils/js_utils';\nvar initialState = {\n itemType: null,\n item: null,\n sourceId: null,\n targetIds: [],\n dropResult: null,\n didDrop: false,\n isSourcePublic: null\n};\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case BEGIN_DRAG:\n return _objectSpread(_objectSpread({}, state), {}, {\n itemType: payload.itemType,\n item: payload.item,\n sourceId: payload.sourceId,\n isSourcePublic: payload.isSourcePublic,\n dropResult: null,\n didDrop: false\n });\n\n case PUBLISH_DRAG_SOURCE:\n return _objectSpread(_objectSpread({}, state), {}, {\n isSourcePublic: true\n });\n\n case HOVER:\n return _objectSpread(_objectSpread({}, state), {}, {\n targetIds: payload.targetIds\n });\n\n case REMOVE_TARGET:\n if (state.targetIds.indexOf(payload.targetId) === -1) {\n return state;\n }\n\n return _objectSpread(_objectSpread({}, state), {}, {\n targetIds: without(state.targetIds, payload.targetId)\n });\n\n case DROP:\n return _objectSpread(_objectSpread({}, state), {}, {\n dropResult: payload.dropResult,\n didDrop: true,\n targetIds: []\n });\n\n case END_DRAG:\n return _objectSpread(_objectSpread({}, state), {}, {\n itemType: null,\n item: null,\n sourceId: null,\n dropResult: null,\n didDrop: false,\n isSourcePublic: null,\n targetIds: []\n });\n\n default:\n return state;\n }\n}","import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case ADD_SOURCE:\n case ADD_TARGET:\n return state + 1;\n\n case REMOVE_SOURCE:\n case REMOVE_TARGET:\n return state - 1;\n\n default:\n return state;\n }\n}","import { intersection } from './js_utils';\nexport var NONE = [];\nexport var ALL = [];\nNONE.__IS_NONE__ = true;\nALL.__IS_ALL__ = true;\n/**\n * Determines if the given handler IDs are dirty or not.\n *\n * @param dirtyIds The set of dirty handler ids\n * @param handlerIds The set of handler ids to check\n */\n\nexport function areDirty(dirtyIds, handlerIds) {\n if (dirtyIds === NONE) {\n return false;\n }\n\n if (dirtyIds === ALL || typeof handlerIds === 'undefined') {\n return true;\n }\n\n var commonIds = intersection(handlerIds, dirtyIds);\n return commonIds.length > 0;\n}","import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nimport { areArraysEqual } from '../utils/equality';\nimport { NONE, ALL } from '../utils/dirtiness';\nimport { xor } from '../utils/js_utils';\nexport function reduce() {\n var _state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NONE;\n\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case HOVER:\n break;\n\n case ADD_SOURCE:\n case ADD_TARGET:\n case REMOVE_TARGET:\n case REMOVE_SOURCE:\n return NONE;\n\n case BEGIN_DRAG:\n case PUBLISH_DRAG_SOURCE:\n case END_DRAG:\n case DROP:\n default:\n return ALL;\n }\n\n var _action$payload = action.payload,\n _action$payload$targe = _action$payload.targetIds,\n targetIds = _action$payload$targe === void 0 ? [] : _action$payload$targe,\n _action$payload$prevT = _action$payload.prevTargetIds,\n prevTargetIds = _action$payload$prevT === void 0 ? [] : _action$payload$prevT;\n var result = xor(targetIds, prevTargetIds);\n var didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds);\n\n if (!didChange) {\n return NONE;\n } // Check the target ids at the innermost position. If they are valid, add them\n // to the result\n\n\n var prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];\n var innermostTargetId = targetIds[targetIds.length - 1];\n\n if (prevInnermostTargetId !== innermostTargetId) {\n if (prevInnermostTargetId) {\n result.push(prevInnermostTargetId);\n }\n\n if (innermostTargetId) {\n result.push(innermostTargetId);\n }\n }\n\n return result;\n}","export function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n return state + 1;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { reduce as dragOffset } from './dragOffset';\nimport { reduce as dragOperation } from './dragOperation';\nimport { reduce as refCount } from './refCount';\nimport { reduce as dirtyHandlerIds } from './dirtyHandlerIds';\nimport { reduce as stateId } from './stateId';\nimport { get } from '../utils/js_utils';\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments.length > 1 ? arguments[1] : undefined;\n return {\n dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {\n type: action.type,\n payload: _objectSpread(_objectSpread({}, action.payload), {}, {\n prevTargetIds: get(state, 'dragOperation.targetIds', [])\n })\n }),\n dragOffset: dragOffset(state.dragOffset, action),\n refCount: refCount(state.refCount, action),\n dragOperation: dragOperation(state.dragOperation, action),\n stateId: stateId(state.stateId)\n };\n}","/**\n * Coordinate addition\n * @param a The first coordinate\n * @param b The second coordinate\n */\nexport function add(a, b) {\n return {\n x: a.x + b.x,\n y: a.y + b.y\n };\n}\n/**\n * Coordinate subtraction\n * @param a The first coordinate\n * @param b The second coordinate\n */\n\nexport function subtract(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n/**\n * Returns the cartesian distance of the drag source component's position, based on its position\n * at the time when the current drag operation has started, and the movement difference.\n *\n * Returns null if no item is being dragged.\n *\n * @param state The offset state to compute from\n */\n\nexport function getSourceClientOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset,\n initialSourceClientOffset = state.initialSourceClientOffset;\n\n if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {\n return null;\n }\n\n return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);\n}\n/**\n * Determines the x,y offset between the client offset and the initial client offset\n *\n * @param state The offset state to compute from\n */\n\nexport function getDifferenceFromInitialOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset;\n\n if (!clientOffset || !initialClientOffset) {\n return null;\n }\n\n return subtract(clientOffset, initialClientOffset);\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { matchesType } from '../utils/matchesType';\nimport { getSourceClientOffset as _getSourceClientOffset, getDifferenceFromInitialOffset as _getDifferenceFromInitialOffset } from '../utils/coords';\nimport { areDirty } from '../utils/dirtiness';\nexport var DragDropMonitorImpl = /*#__PURE__*/function () {\n function DragDropMonitorImpl(store, registry) {\n _classCallCheck(this, DragDropMonitorImpl);\n\n this.store = store;\n this.registry = registry;\n }\n\n _createClass(DragDropMonitorImpl, [{\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n handlerIds: undefined\n };\n var handlerIds = options.handlerIds;\n invariant(typeof listener === 'function', 'listener must be a function.');\n invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');\n var prevStateId = this.store.getState().stateId;\n\n var handleChange = function handleChange() {\n var state = _this.store.getState();\n\n var currentStateId = state.stateId;\n\n try {\n var canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);\n\n if (!canSkipListener) {\n listener();\n }\n } finally {\n prevStateId = currentStateId;\n }\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"subscribeToOffsetChange\",\n value: function subscribeToOffsetChange(listener) {\n var _this2 = this;\n\n invariant(typeof listener === 'function', 'listener must be a function.');\n var previousState = this.store.getState().dragOffset;\n\n var handleChange = function handleChange() {\n var nextState = _this2.store.getState().dragOffset;\n\n if (nextState === previousState) {\n return;\n }\n\n previousState = nextState;\n listener();\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"canDragSource\",\n value: function canDragSource(sourceId) {\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId);\n invariant(source, \"Expected to find a valid source. sourceId=\".concat(sourceId));\n\n if (this.isDragging()) {\n return false;\n }\n\n return source.canDrag(this, sourceId);\n }\n }, {\n key: \"canDropOnTarget\",\n value: function canDropOnTarget(targetId) {\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var target = this.registry.getTarget(targetId);\n invariant(target, \"Expected to find a valid target. targetId=\".concat(targetId));\n\n if (!this.isDragging() || this.didDrop()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);\n }\n }, {\n key: \"isDragging\",\n value: function isDragging() {\n return Boolean(this.getItemType());\n }\n }, {\n key: \"isDraggingSource\",\n value: function isDraggingSource(sourceId) {\n // undefined on initial render\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId, true);\n invariant(source, \"Expected to find a valid source. sourceId=\".concat(sourceId));\n\n if (!this.isDragging() || !this.isSourcePublic()) {\n return false;\n }\n\n var sourceType = this.registry.getSourceType(sourceId);\n var draggedItemType = this.getItemType();\n\n if (sourceType !== draggedItemType) {\n return false;\n }\n\n return source.isDragging(this, sourceId);\n }\n }, {\n key: \"isOverTarget\",\n value: function isOverTarget(targetId) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n shallow: false\n };\n\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var shallow = options.shallow;\n\n if (!this.isDragging()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n\n if (draggedItemType && !matchesType(targetType, draggedItemType)) {\n return false;\n }\n\n var targetIds = this.getTargetIds();\n\n if (!targetIds.length) {\n return false;\n }\n\n var index = targetIds.indexOf(targetId);\n\n if (shallow) {\n return index === targetIds.length - 1;\n } else {\n return index > -1;\n }\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.store.getState().dragOperation.itemType;\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.store.getState().dragOperation.item;\n }\n }, {\n key: \"getSourceId\",\n value: function getSourceId() {\n return this.store.getState().dragOperation.sourceId;\n }\n }, {\n key: \"getTargetIds\",\n value: function getTargetIds() {\n return this.store.getState().dragOperation.targetIds;\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.store.getState().dragOperation.dropResult;\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.store.getState().dragOperation.didDrop;\n }\n }, {\n key: \"isSourcePublic\",\n value: function isSourcePublic() {\n return Boolean(this.store.getState().dragOperation.isSourcePublic);\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.store.getState().dragOffset.initialClientOffset;\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.store.getState().dragOffset.initialSourceClientOffset;\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.store.getState().dragOffset.clientOffset;\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return _getSourceClientOffset(this.store.getState().dragOffset);\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return _getDifferenceFromInitialOffset(this.store.getState().dragOffset);\n }\n }]);\n\n return DragDropMonitorImpl;\n}();","export var HandlerRole;\n\n(function (HandlerRole) {\n HandlerRole[\"SOURCE\"] = \"SOURCE\";\n HandlerRole[\"TARGET\"] = \"TARGET\";\n})(HandlerRole || (HandlerRole = {}));","var nextUniqueId = 0;\nexport function getNextUniqueId() {\n return nextUniqueId++;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { invariant } from '@react-dnd/invariant';\nexport function validateSourceContract(source) {\n invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');\n invariant(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');\n invariant(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');\n}\nexport function validateTargetContract(target) {\n invariant(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');\n invariant(typeof target.hover === 'function', 'Expected hover to be a function.');\n invariant(typeof target.drop === 'function', 'Expected beginDrag to be a function.');\n}\nexport function validateType(type, allowArray) {\n if (allowArray && Array.isArray(type)) {\n type.forEach(function (t) {\n return validateType(t, false);\n });\n return;\n }\n\n invariant(typeof type === 'string' || _typeof(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.');\n}","// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n/* globals self */ const scope = typeof global !== 'undefined' ? global : self;\nconst BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\nexport function makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n const timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n const intervalHandle = setInterval(handleTimer, 50);\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nexport function makeRequestCallFromMutationObserver(callback) {\n let toggle = 1;\n const observer = new BrowserMutationObserver(callback);\n const node = document.createTextNode('');\n observer.observe(node, {\n characterData: true\n });\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\nexport const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nmakeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\nmakeRequestCallFromTimer;\n\n//# sourceMappingURL=makeRequestCall.mjs.map","// `call`, just like a function.\nexport class RawTask {\n call() {\n try {\n this.task && this.task();\n } catch (error) {\n this.onError(error);\n } finally{\n this.task = null;\n this.release(this);\n }\n }\n constructor(onError, release){\n this.onError = onError;\n this.release = release;\n this.task = null;\n }\n}\n\n//# sourceMappingURL=RawTask.mjs.map","import { AsapQueue } from './AsapQueue.mjs';\nimport { TaskFactory } from './TaskFactory.mjs';\nconst asapQueue = new AsapQueue();\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError);\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */ export function asap(task) {\n asapQueue.enqueueTask(taskFactory.create(task));\n}\n\n//# sourceMappingURL=asap.mjs.map","import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.mjs';\nexport class AsapQueue {\n // Use the fastest means possible to execute a task in its own turn, with\n // priority over other events including IO, animation, reflow, and redraw\n // events in browsers.\n //\n // An exception thrown by a task will permanently interrupt the processing of\n // subsequent tasks. The higher level `asap` function ensures that if an\n // exception is thrown by a task, that the task queue will continue flushing as\n // soon as possible, but if you use `rawAsap` directly, you are responsible to\n // either ensure that no exceptions are thrown from your task, or to manually\n // call `rawAsap.requestFlush` if an exception is thrown.\n enqueueTask(task) {\n const { queue: q , requestFlush } = this;\n if (!q.length) {\n requestFlush();\n this.flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n q[q.length] = task;\n }\n constructor(){\n this.queue = [];\n // We queue errors to ensure they are thrown in right order (FIFO).\n // Array-as-queue is good enough here, since we are just dealing with exceptions.\n this.pendingErrors = [];\n // Once a flush has been requested, no further calls to `requestFlush` are\n // necessary until the next `flush` completes.\n // @ts-ignore\n this.flushing = false;\n // The position of the next task to execute in the task queue. This is\n // preserved between calls to `flush` so that it can be resumed if\n // a task throws an exception.\n this.index = 0;\n // If a task schedules additional tasks recursively, the task queue can grow\n // unbounded. To prevent memory exhaustion, the task queue will periodically\n // truncate already-completed tasks.\n this.capacity = 1024;\n // The flush function processes all tasks that have been scheduled with\n // `rawAsap` unless and until one of those tasks throws an exception.\n // If a task throws an exception, `flush` ensures that its state will remain\n // consistent and will resume where it left off when called again.\n // However, `flush` does not make any arrangements to be called again if an\n // exception is thrown.\n this.flush = ()=>{\n const { queue: q } = this;\n while(this.index < q.length){\n const currentIndex = this.index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n this.index++;\n q[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (this.index > this.capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){\n q[scan] = q[scan + this.index];\n }\n q.length -= this.index;\n this.index = 0;\n }\n }\n q.length = 0;\n this.index = 0;\n this.flushing = false;\n };\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n this.registerPendingError = (err)=>{\n this.pendingErrors.push(err);\n this.requestErrorThrow();\n };\n // `requestFlush` requests that the high priority event queue be flushed as\n // soon as possible.\n // This is useful to prevent an error thrown in a task from stalling the event\n // queue if the exception handled by Node.js’s\n // `process.on(\"uncaughtException\")` or by a domain.\n // `requestFlush` is implemented using a strategy based on data collected from\n // every available SauceLabs Selenium web driver worker at time of writing.\n // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n this.requestFlush = makeRequestCall(this.flush);\n this.requestErrorThrow = makeRequestCallFromTimer(()=>{\n // Throw first error\n if (this.pendingErrors.length) {\n throw this.pendingErrors.shift();\n }\n });\n }\n} // The message channel technique was discovered by Malte Ubl and was the\n // original foundation for this library.\n // http://www.nonblocking.io/2011/06/windownexttick.html\n // Safari 6.0.5 (at least) intermittently fails to create message ports on a\n // page's first load. Thankfully, this version of Safari supports\n // MutationObservers, so we don't need to fall back in that case.\n // function makeRequestCallFromMessageChannel(callback) {\n // var channel = new MessageChannel();\n // channel.port1.onmessage = callback;\n // return function requestCall() {\n // channel.port2.postMessage(0);\n // };\n // }\n // For reasons explained above, we are also unable to use `setImmediate`\n // under any circumstances.\n // Even if we were, there is another bug in Internet Explorer 10.\n // It is not sufficient to assign `setImmediate` to `requestFlush` because\n // `setImmediate` must be called *by name* and therefore must be wrapped in a\n // closure.\n // Never forget.\n // function makeRequestCallFromSetImmediate(callback) {\n // return function requestCall() {\n // setImmediate(callback);\n // };\n // }\n // Safari 6.0 has a problem where timers will get lost while the user is\n // scrolling. This problem does not impact ASAP because Safari 6.0 supports\n // mutation observers, so that implementation is used instead.\n // However, if we ever elect to use timers in Safari, the prevalent work-around\n // is to add a scroll event listener that calls for a flush.\n // `setTimeout` does not call the passed callback if the delay is less than\n // approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n // even then.\n // This is for `asap.js` only.\n // Its name will be periodically randomized to break any code that depends on\n // // its existence.\n // rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer\n // ASAP was originally a nextTick shim included in Q. This was factored out\n // into this ASAP package. It was later adapted to RSVP which made further\n // amendments. These decisions, particularly to marginalize MessageChannel and\n // to capture the MutationObserver implementation in a closure, were integrated\n // back into ASAP proper.\n // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n//# sourceMappingURL=AsapQueue.mjs.map","import { RawTask } from './RawTask.mjs';\nexport class TaskFactory {\n create(task) {\n const tasks = this.freeTasks;\n const t1 = tasks.length ? tasks.pop() : new RawTask(this.onError, (t)=>tasks[tasks.length] = t\n );\n t1.task = task;\n return t1;\n }\n constructor(onError){\n this.onError = onError;\n this.freeTasks = [];\n }\n}\n\n//# sourceMappingURL=TaskFactory.mjs.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { addSource as _addSource, addTarget as _addTarget, removeSource as _removeSource, removeTarget as _removeTarget } from '../actions/registry';\nimport { getNextUniqueId } from '../utils/getNextUniqueId';\nimport { HandlerRole } from '../interfaces';\nimport { validateSourceContract, validateTargetContract, validateType } from '../contracts';\nimport { asap } from '@react-dnd/asap';\n\nfunction getNextHandlerId(role) {\n var id = getNextUniqueId().toString();\n\n switch (role) {\n case HandlerRole.SOURCE:\n return \"S\".concat(id);\n\n case HandlerRole.TARGET:\n return \"T\".concat(id);\n\n default:\n throw new Error(\"Unknown Handler Role: \".concat(role));\n }\n}\n\nfunction parseRoleFromHandlerId(handlerId) {\n switch (handlerId[0]) {\n case 'S':\n return HandlerRole.SOURCE;\n\n case 'T':\n return HandlerRole.TARGET;\n\n default:\n invariant(false, \"Cannot parse handler ID: \".concat(handlerId));\n }\n}\n\nfunction mapContainsValue(map, searchValue) {\n var entries = map.entries();\n var isDone = false;\n\n do {\n var _entries$next = entries.next(),\n done = _entries$next.done,\n _entries$next$value = _slicedToArray(_entries$next.value, 2),\n value = _entries$next$value[1];\n\n if (value === searchValue) {\n return true;\n }\n\n isDone = !!done;\n } while (!isDone);\n\n return false;\n}\n\nexport var HandlerRegistryImpl = /*#__PURE__*/function () {\n function HandlerRegistryImpl(store) {\n _classCallCheck(this, HandlerRegistryImpl);\n\n this.types = new Map();\n this.dragSources = new Map();\n this.dropTargets = new Map();\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n this.store = store;\n }\n\n _createClass(HandlerRegistryImpl, [{\n key: \"addSource\",\n value: function addSource(type, source) {\n validateType(type);\n validateSourceContract(source);\n var sourceId = this.addHandler(HandlerRole.SOURCE, type, source);\n this.store.dispatch(_addSource(sourceId));\n return sourceId;\n }\n }, {\n key: \"addTarget\",\n value: function addTarget(type, target) {\n validateType(type, true);\n validateTargetContract(target);\n var targetId = this.addHandler(HandlerRole.TARGET, type, target);\n this.store.dispatch(_addTarget(targetId));\n return targetId;\n }\n }, {\n key: \"containsHandler\",\n value: function containsHandler(handler) {\n return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler);\n }\n }, {\n key: \"getSource\",\n value: function getSource(sourceId) {\n var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n var isPinned = includePinned && sourceId === this.pinnedSourceId;\n var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);\n return source;\n }\n }, {\n key: \"getTarget\",\n value: function getTarget(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.dropTargets.get(targetId);\n }\n }, {\n key: \"getSourceType\",\n value: function getSourceType(sourceId) {\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n return this.types.get(sourceId);\n }\n }, {\n key: \"getTargetType\",\n value: function getTargetType(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.types.get(targetId);\n }\n }, {\n key: \"isSourceId\",\n value: function isSourceId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.SOURCE;\n }\n }, {\n key: \"isTargetId\",\n value: function isTargetId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.TARGET;\n }\n }, {\n key: \"removeSource\",\n value: function removeSource(sourceId) {\n var _this = this;\n\n invariant(this.getSource(sourceId), 'Expected an existing source.');\n this.store.dispatch(_removeSource(sourceId));\n asap(function () {\n _this.dragSources.delete(sourceId);\n\n _this.types.delete(sourceId);\n });\n }\n }, {\n key: \"removeTarget\",\n value: function removeTarget(targetId) {\n invariant(this.getTarget(targetId), 'Expected an existing target.');\n this.store.dispatch(_removeTarget(targetId));\n this.dropTargets.delete(targetId);\n this.types.delete(targetId);\n }\n }, {\n key: \"pinSource\",\n value: function pinSource(sourceId) {\n var source = this.getSource(sourceId);\n invariant(source, 'Expected an existing source.');\n this.pinnedSourceId = sourceId;\n this.pinnedSource = source;\n }\n }, {\n key: \"unpinSource\",\n value: function unpinSource() {\n invariant(this.pinnedSource, 'No source is pinned at the time.');\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n }\n }, {\n key: \"addHandler\",\n value: function addHandler(role, type, handler) {\n var id = getNextHandlerId(role);\n this.types.set(id, type);\n\n if (role === HandlerRole.SOURCE) {\n this.dragSources.set(id, handler);\n } else if (role === HandlerRole.TARGET) {\n this.dropTargets.set(id, handler);\n }\n\n return id;\n }\n }]);\n\n return HandlerRegistryImpl;\n}();","import { DragDropManagerImpl } from './classes/DragDropManagerImpl';\nimport { createStore } from 'redux';\nimport { reduce } from './reducers';\nimport { DragDropMonitorImpl } from './classes/DragDropMonitorImpl';\nimport { HandlerRegistryImpl } from './classes/HandlerRegistryImpl';\nexport function createDragDropManager(backendFactory) {\n var globalContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n var backendOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var debugMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var store = makeStoreInstance(debugMode);\n var monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store));\n var manager = new DragDropManagerImpl(store, monitor);\n var backend = backendFactory(manager, globalContext, backendOptions);\n manager.receiveBackend(backend);\n return manager;\n}\n\nfunction makeStoreInstance(debugMode) {\n // TODO: if we ever make a react-native version of this,\n // we'll need to consider how to pull off dev-tooling\n var reduxDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;\n return createStore(reduce, debugMode && reduxDevTools && reduxDevTools({\n name: 'dnd-core',\n instanceId: 'dnd-core'\n }));\n}","var _excluded = [\"children\"];\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, memo } from 'react';\nimport { createDragDropManager } from 'dnd-core';\nimport { DndContext } from './DndContext';\nvar refCount = 0;\nvar INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');\n/**\n * A React component that provides the React-DnD context\n */\n\nexport var DndProvider = memo(function DndProvider(_ref) {\n var children = _ref.children,\n props = _objectWithoutProperties(_ref, _excluded);\n\n var _getDndContextValue = getDndContextValue(props),\n _getDndContextValue2 = _slicedToArray(_getDndContextValue, 2),\n manager = _getDndContextValue2[0],\n isGlobalInstance = _getDndContextValue2[1]; // memoized from props\n\n /**\n * If the global context was used to store the DND context\n * then where theres no more references to it we should\n * clean it up to avoid memory leaks\n */\n\n\n useEffect(function () {\n if (isGlobalInstance) {\n var context = getGlobalContext();\n ++refCount;\n return function () {\n if (--refCount === 0) {\n context[INSTANCE_SYM] = null;\n }\n };\n }\n }, []);\n return _jsx(DndContext.Provider, Object.assign({\n value: manager\n }, {\n children: children\n }), void 0);\n});\n\nfunction getDndContextValue(props) {\n if ('manager' in props) {\n var _manager = {\n dragDropManager: props.manager\n };\n return [_manager, false];\n }\n\n var manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);\n var isGlobalInstance = !props.context;\n return [manager, isGlobalInstance];\n}\n\nfunction createSingletonDndContext(backend) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getGlobalContext();\n var options = arguments.length > 2 ? arguments[2] : undefined;\n var debugMode = arguments.length > 3 ? arguments[3] : undefined;\n var ctx = context;\n\n if (!ctx[INSTANCE_SYM]) {\n ctx[INSTANCE_SYM] = {\n dragDropManager: createDragDropManager(backend, context, options, debugMode)\n };\n }\n\n return ctx[INSTANCE_SYM];\n}\n\nfunction getGlobalContext() {\n return typeof global !== 'undefined' ? global : window;\n}","import { t } from \"../i18n\";\nimport React, { useState, useEffect, useRef, useMemo } from \"react\";\nimport { DndProvider } from \"react-dnd\";\nimport { DndBackend } from \"./DndBackend\";\n\nimport Editor from \"../Editor\";\nimport Block from \"../Block\";\nimport BlockItem from \"./BlockItem\";\nimport {\n EditorContext,\n BlocksContext,\n EditorContextProps,\n BlocksContextProps,\n} from \"../Context\";\nimport AddButton from \"./AddButton\";\nimport { getBlocksByRange } from \"../util\";\nimport { BlockEditorCommandEvent } from \"../CommandManager\";\n\ndeclare global {\n interface WindowEventMap {\n \"mt-block-editor-command\": BlockEditorCommandEvent;\n \"mt-block-editor-click-block\": CustomEvent;\n }\n}\n\ninterface AppProps {\n editor: Editor;\n}\n\nfunction arrayEquals(a: T[], b: T[]): boolean {\n if (a === b) {\n return true;\n }\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0, len = a.length; i < len; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nconst App: React.FC = ({ editor }: AppProps) => {\n const [_focusedIds, _setFocusedIds] = useState([]);\n const focusedIdsRef = useRef(_focusedIds);\n\n const editorContext = useMemo(\n () => ({\n editor: editor,\n setFocusedIds: (ids, opts?) => {\n const focusedIds = focusedIdsRef.current;\n if (\n focusedIds.length >= 2 &&\n ids.length === 1 &&\n focusedIds.includes(ids[0])\n ) {\n // do nothing\n return;\n }\n\n if (!opts?.forceUpdate && arrayEquals(focusedIds, ids)) {\n return;\n }\n\n focusedIdsRef.current = ids;\n _setFocusedIds(ids);\n },\n getFocusedIds: () => focusedIdsRef.current,\n }),\n []\n );\n const setFocusedIds = editorContext.setFocusedIds;\n\n const blocksContext = useMemo(\n () => ({\n panelBlockTypes: null,\n shortcutBlockTypes: null,\n addBlock: (b: Block, index: number | Block) => {\n if (index instanceof Block) {\n index = editor.blocks.indexOf(index) + 1;\n }\n editor.addBlock(editor, b, index);\n setFocusedIds([b.id]);\n },\n mergeBlock: (b: Block) => {\n const index = editor.blocks.indexOf(b);\n if (editor.mergeBlock(editor, b)) {\n setFocusedIds([editor.blocks[index - 1].id]);\n }\n },\n removeBlock: (b: Block) => {\n const index = editor.blocks.indexOf(b);\n editor.removeBlock(editor, b);\n if (index > 0) {\n setFocusedIds([editor.blocks[index - 1].id]);\n }\n },\n swapBlocks: (dragIndex: number, hoverIndex: number, scroll?: boolean) => {\n if (\n dragIndex === undefined ||\n hoverIndex === undefined ||\n !editor.blocks[dragIndex] ||\n !editor.blocks[hoverIndex]\n ) {\n return;\n }\n\n if (scroll) {\n const destEl = editor.blocks[hoverIndex].wrapperRef.current;\n if (!destEl) {\n return;\n }\n\n const rect = destEl.getBoundingClientRect();\n const scrollTop =\n window.pageYOffset || document.documentElement.scrollTop;\n const offsetTop = rect.height;\n\n window.scrollTo({\n top: scrollTop + (dragIndex > hoverIndex ? -offsetTop : offsetTop),\n behavior: \"smooth\",\n });\n }\n\n editor.swapBlocks(editor, dragIndex, hoverIndex);\n },\n }),\n []\n );\n\n useEffect(() => {\n const onWindowClick = (ev: Event): void => {\n if (document.querySelector(\".mt-be-overlay\")) {\n return;\n }\n\n const editorEl = editor.editorElement;\n\n if (editorEl.querySelector(`[data-mt-block-editor-keep-focus=\"1\"]`)) {\n return;\n }\n\n let target = ev.target as HTMLElement;\n\n while (target.parentNode && target.parentNode !== target) {\n if (target.classList.contains(\"mce-container\")) {\n return;\n }\n if (target === editorEl) {\n if (focusedIdsRef.current.length === 0) {\n setFocusedIds([\"editor\"]);\n }\n return;\n }\n target = target.parentNode as HTMLElement;\n }\n\n setFocusedIds([]);\n };\n\n const onWindowKeydown = (ev: KeyboardEvent): void => {\n const editorEl = editor.editorElement;\n const focusedIds = focusedIdsRef.current;\n\n if (focusedIds.length === 0) {\n return;\n }\n\n if (!(ev.ctrlKey || ev.metaKey || ev.altKey || ev.shiftKey)) {\n return;\n }\n\n // stay focused but not edit\n if (editorEl.querySelector(`[data-mt-block-editor-keep-focus=\"1\"]`)) {\n return;\n }\n\n const key = ev.key;\n\n if (key === \"z\" && (ev.ctrlKey || ev.metaKey) && !ev.shiftKey) {\n ev.preventDefault();\n ev.stopPropagation();\n ev.stopImmediatePropagation();\n editor.editManager.undo({\n editor,\n getFocusedIds: () => focusedIds,\n setFocusedIds,\n });\n } else if (\n (key === \"z\" && (ev.ctrlKey || ev.metaKey) && ev.shiftKey) ||\n (key === \"y\" && (ev.ctrlKey || ev.metaKey))\n ) {\n ev.preventDefault();\n ev.stopPropagation();\n ev.stopImmediatePropagation();\n editor.editManager.redo({\n editor,\n getFocusedIds: () => focusedIds,\n setFocusedIds,\n });\n }\n };\n\n let startId = \"\";\n const onEditorMousedown = (ev: MouseEvent): void => {\n if (ev.target instanceof HTMLElement) {\n startId =\n ev.target.closest(\"[data-mt-block-editor-block-id]\")\n ?.dataset.mtBlockEditorBlockId || \"\";\n }\n };\n\n const onEditorMouseup = (ev: MouseEvent): void => {\n if (ev.target instanceof HTMLElement) {\n const endId =\n ev.target.closest(\"[data-mt-block-editor-block-id]\")\n ?.dataset.mtBlockEditorBlockId || \"\";\n if (startId && endId && startId !== endId) {\n setFocusedIds(\n getBlocksByRange(editor, [startId, endId]).map((b) => b.id)\n );\n\n ev.preventDefault();\n ev.stopPropagation();\n }\n }\n\n startId = \"\";\n };\n\n const onBlockEditorCommand = (ev: BlockEditorCommandEvent): void => {\n editor.commandManager.execute({\n ...ev.detail,\n event: ev,\n });\n };\n\n editor.editorElement.addEventListener(\"mousedown\", onEditorMousedown);\n editor.editorElement.addEventListener(\"mouseup\", onEditorMouseup);\n\n window.addEventListener(\"click\", onWindowClick, {\n capture: true,\n passive: true,\n });\n\n window.addEventListener(\"keydown\", onWindowKeydown);\n window.addEventListener(\"mt-block-editor-command\", onBlockEditorCommand);\n\n return () => {\n editor.editorElement.removeEventListener(\"mousedown\", onEditorMousedown);\n editor.editorElement.removeEventListener(\"mouseup\", onEditorMouseup);\n window.removeEventListener(\"click\", onWindowClick, {\n capture: true,\n });\n window.removeEventListener(\"keydown\", onWindowKeydown);\n window.removeEventListener(\n \"mt-block-editor-command\",\n onBlockEditorCommand\n );\n };\n }, []);\n\n return (\n \n \n \n
\n {editor.blocks.map((b, i) => {\n return (\n \n );\n })}\n {editor.opts.addButtons[\"bottom\"] && (\n
\n \n
\n )}\n
\n
\n
\n
\n );\n};\n\nexport default App;\n","import Block from \"./Block\";\n\nclass BlockFactory {\n public static allTypes: Array = [];\n\n public static registerType(t: typeof Block): void {\n this.allTypes.push(t);\n }\n\n public static deregisterType(t: typeof Block | string): void {\n this.allTypes = this.allTypes.filter((registered) =>\n typeof t === \"string\" ? registered.typeId === t : registered !== t\n );\n }\n\n public types(): Array {\n return BlockFactory.allTypes;\n }\n\n public selectableTypes(): Array {\n return BlockFactory.allTypes.filter((t) => t.selectable);\n }\n\n public lookupType(typeId: string): typeof Block {\n const t = BlockFactory.allTypes.find((t) => t.typeId === typeId);\n\n if (!t) {\n throw `Unknown typeId: ${typeId}`;\n }\n\n return t;\n }\n}\n\nexport default BlockFactory;\n","import Editor from \"./Editor\";\nimport Block from \"./Block\";\nimport { EditorContextProps } from \"./Context\";\n\nconst DEFAULT_LIMIT = 100;\nconst NO_GROUP = undefined;\n\nexport interface EditHistoryHandlers {\n id: symbol;\n merge?: (a: EditHistory, b: EditHistory) => EditHistory | undefined | null;\n undo: (history: EditHistory, props: EditorContextProps) => void;\n redo: (history: EditHistory, props: EditorContextProps) => void;\n}\n\nexport interface EditHistory {\n block: Block;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n group?: number | undefined;\n handlers: EditHistoryHandlers;\n}\n\nclass EditManager {\n private editor: Editor | null = null;\n private limit = DEFAULT_LIMIT;\n private index = 0;\n private ignore = false;\n private histories: EditHistory[] = [];\n private group: number | undefined = NO_GROUP;\n\n public constructor(init: {\n editor: EditManager[\"editor\"];\n limit?: EditManager[\"limit\"];\n }) {\n Object.assign(this, init);\n }\n\n public unload(): void {\n this.editor = null;\n this.histories = [];\n }\n\n public canUndo(): boolean {\n return this.histories.length !== 0 && this.histories.length > this.index;\n }\n\n public canRedo(): boolean {\n return this.index !== 0;\n }\n\n public add(history: EditHistory): void {\n if (this.ignore) {\n return;\n }\n\n this._add(history);\n\n if (this.group === NO_GROUP) {\n this.emitChange();\n }\n }\n\n private _add(history: EditHistory): void {\n if (this.index !== 0) {\n this.histories.splice(-this.index, this.index);\n }\n this.index = 0;\n\n if (this.group !== NO_GROUP && !history.group) {\n history.group = this.group;\n }\n\n if (history.handlers.merge) {\n const last = this.histories[this.histories.length - 1];\n if (\n last &&\n last.group === history.group &&\n last.handlers.id === history.handlers.id\n ) {\n const merged = history.handlers.merge.call(undefined, last, history);\n if (merged) {\n this.histories[this.histories.length - 1] = merged;\n return;\n }\n }\n }\n\n this.histories.push(history);\n\n if (this.histories.length > this.limit) {\n const count = this.histories.length - this.limit;\n this.histories.splice(0, count);\n }\n }\n\n public undo(props: EditorContextProps, group?: number): void {\n const history = this.histories[this.histories.length - this.index - 1];\n if (!history || (group !== undefined && group !== history.group)) {\n if (group !== undefined) {\n this.emitChange();\n }\n return;\n }\n\n this.index++;\n\n this.ignore = true;\n history.handlers.undo.call(undefined, history, props);\n this.ignore = false;\n\n if (history.group === NO_GROUP) {\n this.emitChange();\n } else {\n this.undo(props, history.group);\n }\n }\n\n public redo(props: EditorContextProps, group?: number): void {\n const history = this.histories[this.histories.length - this.index];\n if (!history || (group !== undefined && group !== history.group)) {\n if (group !== undefined) {\n this.emitChange();\n }\n return;\n }\n\n this.index--;\n this.ignore = true;\n history.handlers.redo.call(undefined, history, props);\n this.ignore = false;\n\n if (history.group === NO_GROUP) {\n this.emitChange();\n } else {\n this.redo(props, history.group);\n }\n }\n\n public generateGroup(): number {\n return Math.round(Math.random() * 100000);\n }\n\n public beginGrouping(): void {\n this.group = this.generateGroup();\n }\n\n public endGrouping(): void {\n if (this.group === NO_GROUP) {\n return;\n }\n\n const last = this.histories[this.histories.length - 1];\n if (last && last.group === this.group) {\n this.emitChange();\n }\n\n this.group = NO_GROUP;\n }\n\n private emitChange(): void {\n if (this.editor) {\n this.editor.emit(\"change\", { editor: this.editor });\n }\n }\n}\n\nexport default EditManager;\n","import { EditHistoryHandlers } from \"../EditManager\";\nimport Block from \"../Block\";\n\nexport const add: EditHistoryHandlers = {\n id: Symbol(\"add\"),\n undo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n const index = parent.blocks.indexOf(hist.block);\n editor.removeBlock(parent, hist.block);\n\n const nextFocusBlock =\n parent.blocks[Math.max(0, index - 1)] ||\n (parent instanceof Block ? parent : null);\n\n setFocusedIds([nextFocusBlock?.id ?? \"editor\"]);\n },\n redo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n editor.addBlock(parent, hist.block, hist.data.index);\n setFocusedIds([hist.block.id]);\n\n // You need to force a re-render to see the block\n if (parent.blocks.length === 1) {\n editor.render();\n }\n },\n};\n\nexport const remove: EditHistoryHandlers = {\n id: Symbol(\"remove\"),\n undo(hist, { editor, setFocusedIds }) {\n editor.addBlock(hist.data.parent || editor, hist.block, hist.data.index);\n setFocusedIds([hist.block.id], { forceUpdate: true });\n },\n redo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n const index = parent.blocks.indexOf(hist.block);\n editor.removeBlock(parent, hist.block);\n if (index > 0) {\n setFocusedIds([parent.blocks[index - 1].id]);\n }\n },\n};\n\nexport const swap: EditHistoryHandlers = {\n id: Symbol(\"swap\"),\n undo(hist, { editor }) {\n editor.swapBlocks(hist.data.parent || editor, hist.data.a, hist.data.b);\n },\n redo(hist, { editor }) {\n editor.swapBlocks(hist.data.parent || editor, hist.data.a, hist.data.b);\n },\n};\n","import React, { ReactNode, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { CSSTransition } from \"react-transition-group\";\n\nconst OVERLAY_CLASS_NAME = \"mt-be-overlay\";\nconst PORTAL_STYLE = { position: \"relative\", zIndex: 1000 };\nexport const TRANSITION_TIMEOUT = 300;\n\ninterface OverlayProps {\n open: boolean;\n onClose?: () => void;\n children?: ReactNode;\n}\n\nconst Overlay: React.FC = ({\n open,\n onClose = () => null,\n children,\n}: OverlayProps) => {\n const [portal] = useState(() =>\n document.createElement(\"div\")\n );\n\n useEffect(() => {\n Object.assign(portal.style, PORTAL_STYLE);\n portal.classList.add(\"mt-block-editor\");\n document.body.appendChild(portal);\n return () => portal.remove();\n }, []);\n\n useEffect(() => {\n if (!open) {\n return;\n }\n\n function onKeydown(ev: KeyboardEvent): void {\n if (ev.key === \"Escape\") {\n onClose();\n }\n }\n\n document.addEventListener(\"keydown\", onKeydown);\n return () => document.removeEventListener(\"keydown\", onKeydown);\n }, [open]);\n\n return createPortal(\n \n document.body.classList.add(\"mt-block-editor-overlay-open\")\n }\n onExit={() =>\n document.body.classList.remove(\"mt-block-editor-overlay-open\")\n }\n classNames={OVERLAY_CLASS_NAME}\n unmountOnExit\n timeout={TRANSITION_TIMEOUT}\n >\n
{children}
\n ,\n portal\n );\n};\n\nexport default Overlay;\n","import { t } from \"../i18n\";\nimport React, {\n ReactNode,\n useRef,\n useEffect,\n createContext,\n useContext,\n} from \"react\";\nimport Overlay, { TRANSITION_TIMEOUT } from \"./Overlay\";\n\nexport interface DialogProps {\n children?: ReactNode;\n open: boolean;\n onClose?: () => void;\n id?: string;\n className?: string;\n}\ntype DialogContextProps = Pick;\n\nconst DialogContext = createContext({});\nexport const Dialog: React.FC = (props: DialogProps) => {\n const modalRef = useRef(null);\n const className = `mt-be-dialog ${props.className || \"\"}`;\n\n useEffect(() => {\n if (!props.open) {\n return;\n }\n\n const modalEl = modalRef.current;\n if (!modalEl) {\n return;\n }\n\n const focusEl = modalEl.querySelector(\n `[data-mt-block-editor-focus-default]`\n );\n if (!focusEl) {\n return;\n }\n\n setTimeout(() => {\n focusEl.focus();\n }, TRANSITION_TIMEOUT);\n }, [props.open]);\n\n return (\n \n \n
\n
{props.children}
\n
\n
\n
\n );\n};\n\nexport const DialogHeader: React.FC = (props: { children?: ReactNode }) => {\n const { onClose = () => null } = useContext(DialogContext);\n return (\n
\n {props.children}\n \n ×\n \n
\n );\n};\n\nexport const DialogBody: React.FC = (props: { children?: ReactNode }) => (\n
{props.children}
\n);\n\nexport const DialogFooter: React.FC = (props: { children?: ReactNode }) => (\n
{props.children}
\n);\n\nexport default Dialog;\n","import { t } from \"../i18n\";\nimport React, { useState, useRef } from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { nl2br } from \"../util\";\nimport { blockProperty } from \"../decorator\";\nimport icon from \"../img/icon/image.svg\";\nimport iconLink from \"../img/icon/link.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\nimport BlockToolbar from \"../Component/BlockToolbar\";\nimport BlockToolbarButton from \"../Component/BlockToolbarButton\";\nimport {\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n} from \"../Component/Dialog\";\nimport { useCommands } from \"../CommandManager\";\n\ninterface EditorProps {\n block: Image;\n}\n\nconst Html: React.FC = ({ block }: EditorProps) => {\n let img = {block.alt};\n if (block.linkUrl) {\n img = (\n \n {img}\n
\n );\n }\n\n return block.caption ? (\n
\n {img}\n
{nl2br(block.caption)}
\n
\n ) : (\n

{img}

\n );\n};\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => {\n const [isLinkDialogOpen, setLinkDialogOpen] = useState(false);\n const formRef = useRef(null);\n\n useCommands(\n {\n block,\n commands: [\n {\n command: \"core-insertLink\",\n callback: () => {\n setLinkDialogOpen(true);\n },\n },\n ],\n },\n []\n );\n\n return (\n <>\n \n setLinkDialogOpen(true)}\n />\n \n setLinkDialogOpen(false)}\n >\n \n

{t(\"Insert Link\")}

\n
\n
\n \n \n \n \n \n\n \n {\n setLinkDialogOpen(false);\n }}\n >\n {t(\"Close\")}\n \n {\n const form = formRef.current;\n if (!form) {\n return;\n }\n\n const keys = [\"linkUrl\", \"linkTitle\", \"linkTarget\"] as const;\n keys.forEach((name) => {\n block[name] =\n form.querySelector(\n `[data-property-name=\"${name}\"]`\n )?.value || \"\";\n });\n\n setLinkDialogOpen(false);\n }}\n >\n {t(\"Save\")}\n \n \n
\n \n \n \n \n \n \n \n \n \n );\n }\n);\n\nclass Image extends Block {\n public static typeId = \"core-image\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Image\");\n }\n\n public url = \"\";\n public alt = \"\";\n public caption = \"\";\n public linkUrl = \"\";\n public linkTarget = \"_self\";\n public linkTitle = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n return focus || focusBlock ? (\n \n ) : (\n this.html()\n );\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public static canNewFromFile(): boolean {\n return true;\n }\n\n public static async newFromFile({ file }: { file: File }): Promise {\n return new Image({\n url: URL.createObjectURL(file),\n });\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(html, \"text/html\");\n\n return new Image(\n Object.assign(\n {\n url: (doc.querySelector(\"IMG\") as HTMLImageElement).src || \"\",\n className:\n (doc.querySelector(\"IMG\") as HTMLImageElement).className || \"\",\n alt: (doc.querySelector(\"IMG\") as HTMLImageElement).alt || \"\",\n caption:\n (doc.querySelector(\"FIGCAPTION\") &&\n (\n doc.querySelector(\"FIGCAPTION\") as HTMLElement\n ).innerHTML.replace(/]*>/g, \"\\n\")) ||\n \"\",\n },\n meta\n )\n );\n }\n}\n\nexport default Image;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { sanitize } from \"../util\";\nimport { blockProperty } from \"../decorator\";\nimport icon from \"../img/icon/file.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\n\ninterface HtmlProps {\n block: File;\n}\ninterface EditorProps extends EditorOptions {\n block: File;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n \n
\n )\n);\n\nconst Html: React.FC = ({ block }: HtmlProps) => (\n <>\n {block.text}\n \n);\n\nclass File extends Block {\n public static typeId = \"core-file\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"File\");\n }\n\n public text = \"\";\n public url = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus }: EditorOptions): JSX.Element {\n return focus ? (\n \n ) : (\n \n );\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(html, \"text/html\");\n\n return new File(\n Object.assign(\n {\n url: (doc.querySelector(\"A\") as HTMLAnchorElement).href || \"\",\n text: (doc.querySelector(\"A\") as HTMLAnchorElement).textContent || \"\",\n },\n meta\n )\n );\n }\n}\n\nexport default File;\n","import { t } from \"../i18n\";\nimport React, { useEffect, CSSProperties } from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { sanitize, getShadowDomSelectorSet } from \"../util\";\nimport type {\n Editor as TinyMCEEditor,\n TinyMCE,\n RawEditorOptions as TinyMCESettings,\n} from \"tinymce\";\nimport { useBlocksContext, useEditorContext } from \"../Context\";\nimport icon from \"../img/icon/table.svg\";\nimport EditorMode from \"../Component/EditorMode\";\nimport BlockToolbar from \"../Component/BlockToolbar\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\nimport BlockContentEditablePreview, {\n HasEditorStyle,\n} from \"../Component/BlockContentEditablePreview\";\nimport { editHandlers } from \"./Text/edit\";\nimport {\n installPlugins as installTinyMCEPlugins,\n commonSettings,\n getTinymceMajorVersion,\n} from \"./Text/tinymce\";\n\nimport {\n HasTinyMCE,\n tinymceFocus,\n removeTinyMCEFromBlock,\n adjustToolbar,\n} from \"./Text/util\";\n\ndeclare const tinymce: TinyMCE;\n\ninterface EditorProps extends Omit {\n block: Table;\n}\n\nconst Editor: React.FC = ({ block }: EditorProps) => {\n const blocksContext = useBlocksContext();\n const editorContext = useEditorContext();\n const { editor } = editorContext;\n const { addBlock } = useBlocksContext();\n\n const selectorSet = getShadowDomSelectorSet(block.id);\n\n useEffect(() => {\n installTinyMCEPlugins();\n\n const pluginsSettings: TinyMCESettings =\n getTinymceMajorVersion() >= 6\n ? {\n plugins: [\"table\", \"code\", \"media\", \"link\", \"MTBlockEditor\"],\n }\n : {\n plugins: \"table code paste media textcolor link MTBlockEditor\",\n };\n\n const settings: TinyMCESettings = {\n ...commonSettings(editor, block, editorContext, blocksContext),\n ...pluginsSettings,\n toolbar:\n \"table | bold italic underline strikethrough forecolor backcolor removeformat | alignleft aligncenter alignright | link unlink | code\",\n init_instance_callback: (ed: TinyMCEEditor) => {\n block.tinymce = ed;\n\n ed.setContent(block.text);\n tinymceFocus(ed, selectorSet);\n\n const root = ed.dom.getRoot();\n\n // XXX: disable undo feature focefully\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ed.undoManager.add = (): any => {\n // XXX: improve performance\n if (getTinymceMajorVersion() >= 6) {\n ed.dispatch(\"Change\");\n } else {\n ed.fire(\"Change\");\n }\n return null;\n };\n\n let last = block.text;\n ed.on(\"MTBlockEditorEdit\", (ev) => {\n ed.dom.setHTML(ed.getBody(), ev.html);\n last = ev.html;\n });\n\n const addEdit = (): void => {\n const cur = ed.getContent();\n if (last === cur) {\n return;\n }\n\n editor.editManager.add({\n block,\n data: {\n last,\n },\n handlers: editHandlers,\n });\n\n last = cur;\n };\n\n ed.on(\"NodeChange Change\", (ev) => {\n if (root.childNodes.length <= 1) {\n addEdit();\n return;\n }\n\n if (ev.type === \"change\") {\n return;\n }\n\n let children = [...root.childNodes] as HTMLElement[];\n\n children = children\n .filter((c) => !c.classList.contains(\"mce-pastebin\"))\n .map((c) => {\n if (c.tagName === \"TABLE\") {\n return c;\n } else {\n const grandChildren: HTMLElement[] = [];\n\n [...c.querySelectorAll(\"TABLE\")].forEach((t) => {\n if ((t.parentElement as HTMLElement).closest(\"TABLE\")) {\n // nest\n return;\n }\n\n root.insertBefore(t, c);\n grandChildren.push(t as HTMLElement);\n });\n ed.dom.remove(c);\n\n return grandChildren;\n }\n })\n .flat() as HTMLElement[];\n\n if (children.length === 1) {\n addEdit();\n return;\n }\n\n children.shift();\n children.reverse();\n children.forEach((c) => {\n ed.dom.remove(c);\n });\n\n editor.editManager.beginGrouping();\n\n addEdit();\n\n children.forEach((c) => {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n addBlock(new Table({ text: c.outerHTML }), block);\n });\n\n editor.editManager.endGrouping();\n });\n\n adjustToolbar(ed, block, editor.editorElement);\n },\n };\n\n editor.emit(\"buildTinyMCESettings\", {\n editor,\n block,\n settings,\n });\n tinymce.init(settings);\n\n return () => {\n removeTinyMCEFromBlock(block);\n };\n }, []);\n\n const isInSetupMode = editor.opts.mode === \"setup\";\n\n return (\n
\n \n \n
\n \n {\n if (ev.target instanceof HTMLElement && ev.target.closest(\".tox\")) {\n return;\n }\n\n ev.preventDefault();\n }}\n >\n \n );\n};\n\nclass Table extends Block implements HasTinyMCE, HasEditorStyle {\n public static typeId = \"core-table\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Table\");\n }\n\n public text = \"\";\n public tinymce: TinyMCEEditor | null = null;\n public editorStyle: CSSProperties = {};\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public focusEditor(): void {\n if (this.tinymce) {\n this.tinymce.focus(false);\n }\n }\n\n public tinymceId(): string {\n return `textarea-${this.id}`;\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n if (focus) {\n return ;\n }\n\n if (focusBlock || this.htmlString()) {\n const preview = (\n \n );\n return (\n <>\n \n {preview}\n \n {preview}\n \n );\n } else {\n return this.placeholder();\n }\n }\n\n public html(): string {\n if (this.tinymce) {\n try {\n return this.tinymce.getContent();\n } catch (e) {\n console.log(e);\n }\n }\n return this.text;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Table(Object.assign({ text: html }, meta));\n }\n}\n\nexport default Table;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block from \"../Block\";\nimport icon from \"../img/icon/horizontalrule.svg\";\n\nconst Editor: React.FC = () => {\n return
;\n};\n\nclass Horizontalrule extends Block {\n public static typeId = \"core-horizontalrule\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Horizontalrule\");\n }\n\n public editor(): JSX.Element {\n return ;\n }\n\n public html(): JSX.Element {\n return
;\n }\n\n public static async newFromHtml(): Promise {\n return new Horizontalrule();\n }\n}\n\nexport default Horizontalrule;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { blockProperty } from \"../decorator\";\nimport BlockIframePreview from \"../Component/BlockIframePreview\";\nimport icon from \"../img/icon/html.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\n\ninterface EditorProps {\n block: Html;\n}\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n
\n )\n);\n\nclass Html extends Block {\n public static typeId = \"core-html\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"HTML\");\n }\n\n public text = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n return focus || focusBlock ? (\n \n ) : (\n \n );\n }\n\n public html(): string {\n return this.text;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Html(\n Object.assign(\n {\n text: html,\n },\n meta\n )\n );\n }\n}\n\nexport default Html;\n","import BlockFactory from \"./BlockFactory\";\n\nimport Text from \"./Block/Text\";\nimport Image from \"./Block/Image\";\nimport File from \"./Block/File\";\nimport Table from \"./Block/Table\";\nimport Horizontalrule from \"./Block/Horizontalrule\";\nimport Html from \"./Block/Html\";\nimport Columns from \"./Block/Columns\";\nimport Column from \"./Block/Column\";\n\nBlockFactory.registerType(Text);\nBlockFactory.registerType(Image);\nBlockFactory.registerType(File);\nBlockFactory.registerType(Table);\nBlockFactory.registerType(Horizontalrule);\nBlockFactory.registerType(Html);\nBlockFactory.registerType(Columns);\nBlockFactory.registerType(Column);\n","import { t } from \"../i18n\";\nimport icon from \"../img/copy.svg\";\nimport type { Command } from \"../CommandManager\";\nimport { tinymceFocus } from \"../Block/Text/util\";\nimport Text from \"../Block/Text\";\nimport Table from \"../Block/Table\";\n\nconst isClipboardAPIAvailable: () => boolean = () =>\n typeof navigator.clipboard?.write === \"function\" ||\n typeof navigator.clipboard?.writeText === \"function\";\nconst command: Command = {\n get label() {\n return t(\"Copy\");\n },\n icon,\n shortcut: \"cmd+c\",\n command: \"core-copyBlock\",\n condition: isClipboardAPIAvailable,\n callback: async ({ blocks, editorContext: { editor }, event }) => {\n if (!isClipboardAPIAvailable()) {\n return;\n }\n\n const selection = window.getSelection();\n if (selection && (!selection.isCollapsed || selection.toString() !== \"\")) {\n // Prefer browser default behavior\n return;\n }\n\n if (blocks.length === 0) {\n return;\n }\n\n event.preventDefault();\n\n if (blocks.length === 1) {\n const block = blocks[0];\n block.wrapperRef.current?.classList.add(\"mt-be-focus\");\n setTimeout(() => {\n block.wrapperRef.current?.classList.remove(\"mt-be-focus\");\n }, 100);\n if ((block instanceof Text || block instanceof Table) && block.tinymce) {\n tinymceFocus(block.tinymce, null);\n }\n }\n\n let data = (\n await Promise.all(\n blocks.map((block) => block.toClipboardItem({ editor }))\n )\n ).reduce((acc, item) => {\n if (item instanceof Array) {\n acc ||= [];\n } else {\n acc ||= \"\";\n }\n\n if (acc instanceof Array && item instanceof Array) {\n return acc.concat(item);\n } else if (typeof acc === \"string\" && typeof item === \"string\") {\n return acc + item;\n }\n }, undefined);\n\n if (typeof data === \"string\" && typeof ClipboardItem === \"function\") {\n const htmlBlob = new Blob([data], { type: \"text/html\" });\n const plainBlob = new Blob([data], { type: \"text/plain\" });\n data = [\n new ClipboardItem({\n \"text/html\": htmlBlob,\n \"text/plain\": plainBlob,\n }),\n ];\n }\n\n if (data instanceof Array) {\n navigator.clipboard.write(data);\n } else if (typeof data === \"string\") {\n navigator.clipboard.writeText(data);\n }\n },\n};\n\nexport default command;\n","import { t } from \"../i18n\";\nimport icon from \"../img/duplicate.svg\";\nimport type { Command } from \"../CommandManager\";\nimport { parseContent, preParseContent, ParserContext } from \"../util\";\n\nconst command: Command = {\n get label() {\n return t(\"Duplicate\");\n },\n icon,\n shortcut: \"cmd+d\",\n command: \"core-duplicateBlock\",\n callback: async ({\n blocks,\n editorContext: { editor, setFocusedIds },\n blocksContext: { addBlock },\n event,\n }) => {\n if (blocks.length === 0) {\n return;\n }\n\n event?.preventDefault();\n\n const html = (\n await Promise.all(\n blocks.map((block) => block.serialize({ editor, external: true }))\n )\n ).join(\"\");\n\n const newBlocks = await parseContent(\n preParseContent(html),\n editor.factory,\n new ParserContext()\n );\n\n editor.editManager.beginGrouping();\n for (const newBlock of newBlocks.reverse()) {\n addBlock(newBlock, blocks[blocks.length - 1]);\n }\n editor.editManager.endGrouping();\n setFocusedIds([newBlocks[0].id]);\n\n editor.render();\n },\n};\n\nexport default command;\n","import { t } from \"../i18n\";\nimport { isTouchDevice } from \"../util\";\nimport icon from \"../img/remove.svg\";\nimport type { Command } from \"../CommandManager\";\n\nconst command: Command = {\n get label() {\n return t(\"Delete\");\n },\n icon,\n command: \"core-deleteBlock\",\n callback: ({ blocks, editorContext: { editor }, event }) => {\n event.preventDefault();\n\n if (isTouchDevice()) {\n if (!window.confirm(t(\"Are you sure you want to remove the block?\"))) {\n return;\n }\n }\n\n editor.editManager.beginGrouping();\n blocks.forEach((block) => editor.removeBlock(editor, block));\n editor.editManager.endGrouping();\n\n editor.render();\n },\n};\n\nexport default command;\n","import type { Command } from \"../CommandManager\";\n\nconst command: Command = {\n shortcut: \"cmd+k\",\n command: \"core-insertLink\",\n callback: ({\n blocks,\n editorContext: {\n editor: { commandManager },\n },\n event,\n }) => {\n event?.preventDefault();\n\n commandManager.emit(blocks, \"core-insertLink\");\n },\n};\n\nexport default command;\n","import EventEmitter from \"eventemitter3\";\nimport React from \"react\";\nimport { render } from \"react-dom\";\nimport { InitOptions as InitOptionsI18n } from \"i18next\";\n\nimport resetCss from \"./reset.css?raw\";\nimport editorContentCss from \"./editor-content.css?raw\";\nimport {\n getElementById,\n preParseContent,\n parseContent,\n escapeSingleQuoteAttribute,\n ParserContext,\n} from \"./util\";\nimport Block, { HasBlocks, DEFAULT_KEYS_FOR_SETUP } from \"./Block\";\nimport App from \"./Component/App\";\nimport BlockFactory from \"./BlockFactory\";\nimport EditManager from \"./EditManager\";\nimport CommandManager, { Command } from \"./CommandManager\";\nimport {\n add as editHandlersAdd,\n remove as editHandlersRemove,\n swap as editHandlersSwap,\n} from \"./Editor/edit\";\n\nimport \"./import-default-blocks\";\nimport \"./import-default-commands\";\n\nexport enum StylesheetType {\n url,\n css,\n}\n\ninterface Stylesheet {\n type: StylesheetType;\n data: string;\n}\n\ninterface Metadata {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport interface EditorOptions {\n id: string;\n mode: string;\n stylesheets: Array;\n rootClassName?: string;\n rootAttributes?: Record;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n addButtons: Metadata;\n editManager?: Partial;\n block: Metadata;\n i18n: InitOptionsI18n;\n}\n\ninterface MetadataMapData {\n id: string;\n blockIds: Set;\n}\n\nclass Editor extends EventEmitter implements HasBlocks {\n public id: string;\n public opts: EditorOptions;\n public factory: BlockFactory;\n public editManager: EditManager;\n public commandManager: CommandManager;\n public blocks: Block[] = [];\n public stylesheets: Stylesheet[] = [];\n public editorElement: HTMLElement;\n\n private inputElement: HTMLInputElement;\n private metadataMap: Map = new Map<\n string,\n MetadataMapData\n >();\n private metadataMapSequence = 1;\n private keyboardShortcutCache: Record = {};\n\n public constructor(opts: EditorOptions) {\n super();\n\n this.id = opts.id;\n this.opts = opts;\n opts.block = opts.block || {};\n opts.i18n = opts.i18n || {};\n opts.addButtons = opts.addButtons || { bottom: true };\n opts.rootClassName = opts.rootClassName || \"\";\n opts.rootAttributes = opts.rootAttributes || {};\n\n this.factory = new BlockFactory();\n this.editManager = new EditManager(\n Object.assign({ editor: this }, opts.editManager || {})\n );\n this.commandManager = new CommandManager({ editor: this });\n\n this.inputElement = getElementById(this.id) as HTMLInputElement;\n this.inputElement.style.display = \"none\";\n if (!this.inputElement.parentNode) {\n throw \"error\";\n }\n\n this.editorElement = document.createElement(\"div\");\n this.editorElement.setAttribute(\"data-mt-be-id\", this.id);\n this.editorElement.classList.add(\"mt-block-editor\");\n\n this.inputElement.parentNode.insertBefore(\n this.editorElement,\n this.inputElement\n );\n\n setTimeout(async () => {\n this.keyboardShortcutCache = await this.buildKeyboardShortcutCache();\n this.stylesheets = await Promise.all(this.buildStylesheets());\n const blocks = await parseContent(\n preParseContent(this.inputElement.value),\n this.factory,\n new ParserContext()\n );\n this.blocks = blocks;\n this.emit(\"initializeBlocks\", { editor: this, blocks });\n\n this.render();\n }, 0);\n }\n\n public selectableTypes(typeIds: string[]): Array {\n const types = this.factory.selectableTypes();\n return typeIds\n .map((typeId) => types.find((t) => t.typeId === typeId))\n .filter((t) => t) as Array;\n }\n\n public panelTypes(): Array {\n return this.opts.panelBlockTypes\n ? this.selectableTypes(this.opts.panelBlockTypes)\n : this.factory.selectableTypes();\n }\n\n public shortcutTypes(): Array {\n return this.opts.shortcutBlockTypes\n ? this.selectableTypes(this.opts.shortcutBlockTypes)\n : [];\n }\n\n public async buildKeyboardShortcutCache(): Promise> {\n const cache: Record = {};\n for (const command of await this.commandManager.commands()) {\n if (command.shortcut) {\n cache[command.shortcut] = command;\n }\n }\n return cache;\n }\n\n public keyboardShortcutMap(): Record {\n return this.keyboardShortcutCache;\n }\n\n public addBlock(parent: HasBlocks, block: Block, index: number): void {\n const blocks = parent.blocks;\n\n blocks.splice(index, 0, block);\n\n // XXX: Skip render by default\n // this.render();\n\n this.editManager.add({\n block: block,\n data: {\n parent: parent instanceof Editor ? null : parent,\n index,\n },\n handlers: editHandlersAdd,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks: blocks,\n });\n }\n\n public mergeBlock(parent: HasBlocks, block: Block): boolean {\n const blocks = parent.blocks;\n\n const index = blocks.indexOf(block);\n if (index === -1) {\n return false;\n }\n const before = blocks[index - 1];\n if (!before) {\n return false;\n }\n if (!before.canMerge(block)) {\n return false;\n }\n\n this.editManager.beginGrouping();\n\n this.editManager.add(before.merge(block));\n this.removeBlock(parent, block);\n\n this.editManager.endGrouping();\n\n return true;\n }\n\n public removeBlock(parent: HasBlocks, block: Block): void {\n const blocks = parent.blocks;\n\n this.emit(\"removeBlock\", {\n editor: this,\n blocks,\n block,\n });\n\n const index = blocks.indexOf(block);\n if (index === -1) {\n return;\n }\n\n blocks.splice(index, 1);\n this.render();\n\n this.editManager.add({\n block: block,\n data: {\n parent: parent instanceof Editor ? null : parent,\n index,\n },\n handlers: editHandlersRemove,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks,\n });\n }\n\n public swapBlocks(parent: HasBlocks, a: number, b: number): void {\n const blocks = parent.blocks;\n\n [blocks[a], blocks[b]] = [blocks[b], blocks[a]];\n this.render();\n\n this.editManager.add({\n block: blocks[a],\n data: {\n parent: parent instanceof Editor ? null : parent,\n a,\n b,\n },\n handlers: editHandlersSwap,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks,\n });\n }\n\n public async serialize(): Promise {\n const blocks = this.blocks.concat();\n this.emit(\"serialize\", {\n editor: this,\n blocks,\n });\n\n const values = await Promise.all(\n blocks.map((b) => b.serialize({ editor: this, external: false }))\n );\n\n const metadataReverseMap: Metadata = {};\n this.metadataMap.forEach(({ id }, v) => {\n metadataReverseMap[id] = JSON.parse(v);\n });\n\n this.inputElement.value =\n (this.metadataMap.size > 0\n ? ``\n : \"\") + values.join(\"\");\n }\n\n private getMetadataMapIndexes(\n blockId: string,\n stringArray: string[]\n ): string[] {\n const targetMap: Record = {};\n stringArray.forEach((str) => {\n targetMap[str] = this.metadataMap.get(str);\n });\n\n const reusableIds = [];\n for (const [k, data] of this.metadataMap) {\n if (targetMap[k]) {\n continue;\n }\n\n if (data.blockIds.has(blockId)) {\n if (data.blockIds.size === 1) {\n this.metadataMap.delete(k);\n reusableIds.push(data.id);\n } else {\n data.blockIds.delete(blockId);\n }\n }\n }\n\n for (const str of Object.keys(targetMap)) {\n const data = (targetMap[str] ||= {\n id: reusableIds.shift() || (this.metadataMapSequence++).toString(36),\n blockIds: new Set(),\n });\n\n data.blockIds.add(blockId);\n if (!this.metadataMap.has(str)) {\n this.metadataMap.set(str, data);\n }\n }\n\n return Object.values(targetMap)\n .filter((td): td is MetadataMapData => !!td)\n .map((td) => td.id);\n }\n\n public serializeMeta(block: Block, external: boolean): string | null {\n const meta = block.metadata();\n if (!meta) {\n return null;\n }\n\n if (external) {\n return JSON.stringify(meta);\n }\n\n const metaSetup: Metadata = {};\n DEFAULT_KEYS_FOR_SETUP.concat(block.keysForSetup()).forEach((k) => {\n if (k in meta) {\n metaSetup[k] = meta[k];\n Reflect.deleteProperty(meta, k);\n }\n });\n\n const metaStrings = [metaSetup, meta]\n .map((m) => (Object.keys(m).length > 0 ? JSON.stringify(m) : null))\n .filter((s): s is string => !!s);\n\n return this.getMetadataMapIndexes(block.id, metaStrings).join(\",\");\n }\n\n public unload(): void {\n this.emit(\"beforeUnload\", {\n editor: this,\n });\n this.editManager.unload();\n this.editorElement.remove();\n this.inputElement.style.display = \"\";\n this.emit(\"unload\", {\n editor: this,\n });\n }\n\n public render(): void {\n render(React.createElement(App, { editor: this }), this.editorElement);\n }\n\n private buildStylesheets(): Array> {\n return [\n {\n type: StylesheetType.css,\n data: resetCss + editorContentCss,\n },\n ...this.opts.stylesheets\n .filter((s) => s)\n .map(async (s) => {\n if (/^blob:/.test(s)) {\n const res = await fetch(s);\n return {\n type: StylesheetType.css,\n data: await res.text(),\n };\n } else if (/^https?:/.test(s)) {\n return {\n type: StylesheetType.url,\n data: s,\n };\n } else {\n return {\n type: StylesheetType.css,\n data: s,\n };\n }\n }),\n ];\n }\n}\n\nexport default Editor;\n","import CommandManager from \"./CommandManager\";\n\nimport copyBlock from \"./commands/copyBlock\";\nimport pasteBlock from \"./commands/pasteBlock\";\nimport duplicateBlock from \"./commands/duplicateBlock\";\nimport deleteBlock from \"./commands/deleteBlock\";\nimport insertLink from \"./commands/insertLink\";\n\nCommandManager.registerCommand(copyBlock);\nCommandManager.registerCommand(pasteBlock);\nCommandManager.registerCommand(duplicateBlock);\nCommandManager.registerCommand(deleteBlock);\nCommandManager.registerCommand(insertLink);\n","import Editor from \"./Editor\";\n\nclass EditorManager {\n private static _instance: EditorManager;\n public editors: Editor[];\n\n public static instance(): EditorManager {\n this._instance = this._instance || new EditorManager();\n return this._instance;\n }\n\n public constructor() {\n this.editors = [];\n }\n\n public add(e: Editor): void {\n this.editors.push(e);\n }\n\n public get(id: string): Editor | undefined {\n return this.editors.find((e: Editor) => e.id === id);\n }\n\n public async remove(id: string): Promise {\n const e = this.get(id);\n if (!e) {\n return;\n }\n await e.serialize();\n e.unload();\n\n const index = this.editors.indexOf(e);\n if (index === -1) {\n return;\n }\n this.editors.splice(index, 1);\n }\n}\n\nexport default EditorManager;\n","/** @license\n# Movable Type Block Editor (C) 2020 Six Apart Ltd. All Rights Reserved.\n# This code cannot be redistributed without permission from www.sixapart.com.\n*/\n\nimport packageInfo from \"../package.json\";\nimport i18n, { init as initI18n } from \"./i18n\";\nimport { InitOptions as InitOptionsI18n } from \"i18next\";\nimport \"./mt-block-editor.scss\";\nimport Editor, { EditorOptions } from \"./Editor\";\nimport EditorManager from \"./EditorManager\";\n\nimport React from \"react\";\nimport Block from \"./Block\";\nimport Column from \"./Block/Column\";\nimport BlockFactory from \"./BlockFactory\";\n\nimport BlockIframePreview from \"./Component/BlockIframePreview\";\nimport BlockToolbar from \"./Component/BlockToolbar\";\nimport BlockToolbarButton from \"./Component/BlockToolbarButton\";\nimport BlockConfigPanel from \"./Component/BlockConfigPanel\";\nimport BlockSetup from \"./Component/BlockSetup\";\nimport BlockSetupCommon from \"./Component/BlockSetupCommon\";\nimport BlockLabel from \"./Component/BlockLabel\";\nimport EditorMode from \"./Component/EditorMode\";\nimport {\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n} from \"./Component/Dialog\";\n\nimport * as Context from \"./Context\";\nimport * as Hook from \"./Hook\";\nimport * as icon from \"./icon\";\nimport * as util from \"./util\";\nimport * as decorator from \"./decorator\";\n\nexport interface BoilerplateBlockOptions {\n typeId: string;\n className: string;\n rootBlock?: string | null;\n label: string;\n icon: string;\n iconString: string;\n html: string;\n canRemoveBlock: boolean;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n shouldBeCompiled: boolean;\n showPreview: boolean;\n previewHeader: string;\n}\n\ninterface BoilerplateBlockOverwrites {\n _html: string;\n canRemoveBlock?: boolean;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n previewHeader?: string;\n}\n\ninterface BoilerplateBlockInitOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport class EditorUtil {\n public static version = packageInfo.version;\n public static i18n = i18n;\n public static Component = {\n BlockIframePreview,\n BlockToolbar,\n BlockToolbarButton,\n BlockConfigPanel,\n BlockSetup,\n BlockSetupCommon,\n BlockLabel,\n EditorMode,\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n };\n public static decorator = decorator;\n public static React = React;\n public static Block = Block;\n public static Context = Context;\n public static Hook = Hook;\n public static icon = icon;\n public static util = util;\n\n public static async apply(opts: EditorOptions): Promise {\n const optsI18n: InitOptionsI18n = opts.i18n || {};\n await initI18n(optsI18n);\n\n const m = EditorManager.instance();\n const e = new Editor(opts as EditorOptions);\n m.add(e);\n\n return e;\n }\n\n public static get({ id }: { id: string }): Editor | undefined {\n const m = EditorManager.instance();\n return m.get(id);\n }\n\n public static async unload({ id }: { id: string }): Promise {\n const m = EditorManager.instance();\n await m.remove(id);\n }\n\n public static async serialize(): Promise {\n const m = EditorManager.instance();\n await Promise.all(m.editors.map((e) => e.serialize()));\n }\n\n public static registerBlockType(block: typeof Block): void {\n BlockFactory.registerType(block);\n }\n\n public static deregisterBlockType(block: typeof Block | string): void {\n BlockFactory.deregisterType(block);\n }\n\n public static createBoilerplateBlock({\n typeId,\n className,\n rootBlock,\n label,\n icon,\n iconString,\n html,\n canRemoveBlock,\n panelBlockTypes,\n shortcutBlockTypes,\n shouldBeCompiled,\n showPreview,\n previewHeader,\n }: BoilerplateBlockOptions): typeof Block {\n const BoilerplateBlock = function (\n this: Column,\n init: BoilerplateBlockInitOptions\n ): void {\n const overwrite: BoilerplateBlockOverwrites = {\n _html: html,\n };\n if (canRemoveBlock !== undefined) {\n overwrite.canRemoveBlock = !!canRemoveBlock;\n }\n if (panelBlockTypes) {\n overwrite.panelBlockTypes = panelBlockTypes;\n }\n if (shortcutBlockTypes) {\n overwrite.shortcutBlockTypes = shortcutBlockTypes;\n }\n if (previewHeader !== undefined) {\n overwrite.previewHeader = previewHeader;\n }\n\n return Reflect.construct(\n Column,\n [Object.assign(overwrite, init || {})],\n BoilerplateBlock\n );\n };\n\n BoilerplateBlock.prototype = Object.create(Column.prototype);\n BoilerplateBlock.prototype.constructor = BoilerplateBlock;\n BoilerplateBlock.typeId = typeId;\n BoilerplateBlock.className = className;\n BoilerplateBlock.label = label;\n if (rootBlock !== undefined) {\n BoilerplateBlock.rootBlock = rootBlock;\n }\n if (icon) {\n BoilerplateBlock.icon = icon;\n }\n if (iconString) {\n BoilerplateBlock.iconString = iconString;\n }\n BoilerplateBlock.selectable = true;\n if (shouldBeCompiled !== undefined) {\n BoilerplateBlock.shouldBeCompiled = shouldBeCompiled;\n }\n if (showPreview !== undefined) {\n BoilerplateBlock.showPreview = showPreview;\n }\n\n Object.setPrototypeOf(BoilerplateBlock, Column);\n\n return BoilerplateBlock as unknown as typeof Block;\n }\n\n public static isSupportedEnvironment(): boolean {\n if (/Trident|MSIE|Edge/.test(window.navigator.userAgent)) {\n return false;\n }\n\n return true;\n }\n}\n\ndeclare global {\n interface Window {\n MTBlockEditor: typeof EditorUtil;\n }\n}\n\nwindow.MTBlockEditor = EditorUtil;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.css b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.css similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.css rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.css diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.css.map b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.css.map similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.css.map rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.css.map diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.js b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.js new file mode 100644 index 0000000..2519d56 --- /dev/null +++ b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.js @@ -0,0 +1,9 @@ +/*! +# Movable Type Block Editor (C) 2020 Six Apart Ltd. All Rights Reserved. +# This code cannot be redistributed without permission from www.sixapart.com. +# +# This distribution contains several open source products. +# Their license information can be found in mt-block-editor.js.LICENSE.txt. + */ +(()=>{var e={264:e=>{e.exports={locales:["en","ja"]}},9944:e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},1378:(e,t,n)=>{var r=n(8759);e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},8669:(e,t,n)=>{var r=n(211),o=n(4710),i=n(7826),a=r("unscopables"),u=Array.prototype;null==u[a]&&i.f(u,a,{configurable:!0,value:o(null)}),e.exports=function(e){u[a][e]=!0}},9966:(e,t,n)=>{"use strict";var r=n(3448).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},1855:e=>{e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e}},6112:(e,t,n)=>{var r=n(8759);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},1984:(e,t,n)=>{"use strict";var r=n(8062).forEach,o=n(2802),i=n(3002),a=o("forEach"),u=i("forEach");e.exports=a&&u?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},1842:(e,t,n)=>{"use strict";var r=n(8516),o=n(3060),i=n(7850),a=n(2814),u=n(4005),l=n(9720),c=n(1667);e.exports=function(e){var t,n,s,f,d,p,h=o(e),v="function"==typeof this?this:Array,m=arguments.length,g=m>1?arguments[1]:void 0,y=void 0!==g,b=c(h),w=0;if(y&&(g=r(g,m>2?arguments[2]:void 0,2)),null==b||v==Array&&a(b))for(n=new v(t=u(h.length));t>w;w++)p=y?g(h[w],w):h[w],l(n,w,p);else for(d=(f=b.call(h)).next,n=new v;!(s=d.call(f)).done;w++)p=y?i(f,g,[s.value,w],!0):s.value,l(n,w,p);return n.length=w,n}},6198:(e,t,n)=>{var r=n(4088),o=n(4005),i=n(7740),a=function(e){return function(t,n,a){var u,l=r(t),c=o(l.length),s=i(a,c);if(e&&n!=n){for(;c>s;)if((u=l[s++])!=u)return!0}else for(;c>s;s++)if((e||s in l)&&l[s]===n)return e||s||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},8062:(e,t,n)=>{var r=n(8516),o=n(5974),i=n(3060),a=n(4005),u=n(5574),l=[].push,c=function(e){var t=1==e,n=2==e,c=3==e,s=4==e,f=6==e,d=5==e||f;return function(p,h,v,m){for(var g,y,b=i(p),w=o(b),k=r(h,v,3),x=a(w.length),S=0,E=m||u,O=t?E(p,x):n?E(p,0):void 0;x>S;S++)if((d||S in w)&&(y=k(g=w[S],S,b),e))if(t)O[S]=y;else if(y)switch(e){case 3:return!0;case 5:return g;case 6:return S;case 2:l.call(O,g)}else if(s)return!1;return f?-1:c||s?s:O}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},9955:(e,t,n)=>{var r=n(3677),o=n(211),i=n(1448),a=o("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},2802:(e,t,n)=>{"use strict";var r=n(3677);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){throw 1},1)}))}},3002:(e,t,n)=>{var r=n(5283),o=n(3677),i=n(3167),a=Object.defineProperty,u={},l=function(e){throw e};e.exports=function(e,t){if(i(u,e))return u[e];t||(t={});var n=[][e],c=!!i(t,"ACCESSORS")&&t.ACCESSORS,s=i(t,0)?t[0]:l,f=i(t,1)?t[1]:void 0;return u[e]=!!n&&!o((function(){if(c&&!r)return!0;var e={length:-1};c?a(e,1,{enumerable:!0,get:l}):e[1]=1,n.call(e,s,f)}))}},8758:(e,t,n)=>{var r=n(9944),o=n(3060),i=n(5974),a=n(4005),u=function(e){return function(t,n,u,l){r(n);var c=o(t),s=i(c),f=a(c.length),d=e?f-1:0,p=e?-1:1;if(u<2)for(;;){if(d in s){l=s[d],d+=p;break}if(d+=p,e?d<0:f<=d)throw TypeError("Reduce of empty array with no initial value")}for(;e?d>=0:f>d;d+=p)d in s&&(l=n(l,s[d],d,c));return l}};e.exports={left:u(!1),right:u(!0)}},5574:(e,t,n)=>{var r=n(8759),o=n(6526),i=n(211)("species");e.exports=function(e,t){var n;return o(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},7850:(e,t,n)=>{var r=n(6112);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},8939:(e,t,n)=>{var r=n(211)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},2306:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},375:(e,t,n)=>{var r=n(2371),o=n(2306),i=n(211)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},6449:(e,t,n)=>{"use strict";var r=n(6112),o=n(9944);e.exports=function(){for(var e=r(this),t=o(e.add),n=0,i=arguments.length;n{"use strict";var r=n(6112),o=n(9944);e.exports=function(){for(var e,t=r(this),n=o(t.delete),i=!0,a=0,u=arguments.length;a{"use strict";var r=n(7826).f,o=n(4710),i=n(9431),a=n(8516),u=n(1855),l=n(4722),c=n(8432),s=n(7420),f=n(5283),d=n(2423).fastKey,p=n(3278),h=p.set,v=p.getterFor;e.exports={getConstructor:function(e,t,n,c){var s=e((function(e,r){u(e,s,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),f||(e.size=0),null!=r&&l(r,e[c],e,n)})),p=v(t),m=function(e,t,n){var r,o,i=p(e),a=g(e,t);return a?a.value=n:(i.last=a={index:o=d(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),f?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},g=function(e,t){var n,r=p(e),o=d(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return i(s.prototype,{clear:function(){for(var e=p(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,f?e.size=0:this.size=0},delete:function(e){var t=p(this),n=g(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),f?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=p(this),r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!g(this,e)}}),i(s.prototype,n?{get:function(e){var t=g(this,e);return t&&t.value},set:function(e,t){return m(this,0===e?0:e,t)}}:{add:function(e){return m(this,e=0===e?0:e,e)}}),f&&r(s.prototype,"size",{get:function(){return p(this).size}}),s},setStrong:function(e,t,n){var r=t+" Iterator",o=v(t),i=v(r);c(e,t,(function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),s(t)}}},4909:(e,t,n)=>{"use strict";var r=n(1695),o=n(2086),i=n(7189),a=n(1007),u=n(2423),l=n(4722),c=n(1855),s=n(8759),f=n(3677),d=n(8939),p=n(914),h=n(5070);e.exports=function(e,t,n){var v=-1!==e.indexOf("Map"),m=-1!==e.indexOf("Weak"),g=v?"set":"add",y=o[e],b=y&&y.prototype,w=y,k={},x=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(m&&!s(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return m&&!s(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(m&&!s(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(i(e,"function"!=typeof y||!(m||b.forEach&&!f((function(){(new y).entries().next()})))))w=n.getConstructor(t,e,v,g),u.REQUIRED=!0;else if(i(e,!0)){var S=new w,E=S[g](m?{}:-0,1)!=S,O=f((function(){S.has(1)})),T=d((function(e){new y(e)})),C=!m&&f((function(){for(var e=new y,t=5;t--;)e[g](t,t);return!e.has(-0)}));T||((w=t((function(t,n){c(t,w,e);var r=h(new y,t,w);return null!=n&&l(n,r[g],r,v),r}))).prototype=b,b.constructor=w),(O||C)&&(x("delete"),x("has"),v&&x("get")),(C||E)&&x(g),m&&b.clear&&delete b.clear}return k[e]=w,r({global:!0,forced:w!=y},k),p(w,e),m||n.setStrong(w,e,v),w}},8474:(e,t,n)=>{var r=n(3167),o=n(6095),i=n(4399),a=n(7826);e.exports=function(e,t){for(var n=o(t),u=a.f,l=i.f,c=0;c{var r=n(211)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},7209:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},1068:(e,t,n)=>{var r=n(9586),o=/"/g;e.exports=function(e,t,n,i){var a=String(r(e)),u="<"+t;return""!==n&&(u+=" "+n+'="'+String(i).replace(o,""")+'"'),u+">"+a+""}},471:(e,t,n)=>{"use strict";var r=n(3083).IteratorPrototype,o=n(4710),i=n(5736),a=n(914),u=n(7719),l=function(){return this};e.exports=function(e,t,n){var c=t+" Iterator";return e.prototype=o(r,{next:i(1,n)}),a(e,c,!1,!0),u[c]=l,e}},2585:(e,t,n)=>{var r=n(5283),o=n(7826),i=n(5736);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},5736:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9720:(e,t,n)=>{"use strict";var r=n(1288),o=n(7826),i=n(5736);e.exports=function(e,t,n){var a=r(t);a in e?o.f(e,a,i(0,n)):e[a]=n}},8432:(e,t,n)=>{"use strict";var r=n(1695),o=n(471),i=n(2130),a=n(7530),u=n(914),l=n(2585),c=n(1007),s=n(211),f=n(3296),d=n(7719),p=n(3083),h=p.IteratorPrototype,v=p.BUGGY_SAFARI_ITERATORS,m=s("iterator"),g=function(){return this};e.exports=function(e,t,n,s,p,y,b){o(n,t,s);var w,k,x,S=function(e){if(e===p&&P)return P;if(!v&&e in T)return T[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},E=t+" Iterator",O=!1,T=e.prototype,C=T[m]||T["@@iterator"]||p&&T[p],P=!v&&C||S(p),I="Array"==t&&T.entries||C;if(I&&(w=i(I.call(new e)),h!==Object.prototype&&w.next&&(f||i(w)===h||(a?a(w,h):"function"!=typeof w[m]&&l(w,m,g)),u(w,E,!0,!0),f&&(d[E]=g))),"values"==p&&C&&"values"!==C.name&&(O=!0,P=function(){return C.call(this)}),f&&!b||T[m]===P||l(T,m,P),d[t]=P,p)if(k={values:S("values"),keys:y?P:S("keys"),entries:S("entries")},b)for(x in k)(v||O||!(x in T))&&c(T,x,k[x]);else r({target:t,proto:!0,forced:v||O},k);return k}},4145:(e,t,n)=>{var r=n(9775),o=n(3167),i=n(9251),a=n(7826).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},5283:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},821:(e,t,n)=>{var r=n(2086),o=n(8759),i=r.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},933:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},4344:(e,t,n)=>{var r=n(4999);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},4999:(e,t,n)=>{var r=n(563);e.exports=r("navigator","userAgent")||""},1448:(e,t,n)=>{var r,o,i=n(2086),a=n(4999),u=i.process,l=u&&u.versions,c=l&&l.v8;c?o=(r=c.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),e.exports=o&&+o},8684:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1695:(e,t,n)=>{var r=n(2086),o=n(4399).f,i=n(2585),a=n(1007),u=n(3648),l=n(8474),c=n(7189);e.exports=function(e,t){var n,s,f,d,p,h=e.target,v=e.global,m=e.stat;if(n=v?r:m?r[h]||u(h,{}):(r[h]||{}).prototype)for(s in t){if(d=t[s],f=e.noTargetGet?(p=o(n,s))&&p.value:n[s],!c(v?s:h+(m?".":"#")+s,e.forced)&&void 0!==f){if(typeof d==typeof f)continue;l(d,f)}(e.sham||f&&f.sham)&&i(d,"sham",!0),a(n,s,d,e)}}},3677:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},2331:(e,t,n)=>{"use strict";n(2077);var r=n(1007),o=n(3677),i=n(211),a=n(4861),u=n(2585),l=i("species"),c=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})),s="$0"==="a".replace(/./,"$0"),f=i("replace"),d=!!/./[f]&&""===/./[f]("a","$0"),p=!o((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));e.exports=function(e,t,n,f){var h=i(e),v=!o((function(){var t={};return t[h]=function(){return 7},7!=""[e](t)})),m=v&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!v||!m||"replace"===e&&(!c||!s||d)||"split"===e&&!p){var g=/./[h],y=n(h,""[e],(function(e,t,n,r,o){return t.exec===a?v&&!o?{done:!0,value:g.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:s,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:d}),b=y[0],w=y[1];r(String.prototype,e,b),r(RegExp.prototype,h,2==t?function(e,t){return w.call(e,this,t)}:function(e){return w.call(e,this)})}f&&u(RegExp.prototype[h],"sham",!0)}},7561:(e,t,n)=>{"use strict";var r=n(6526),o=n(4005),i=n(8516),a=function(e,t,n,u,l,c,s,f){for(var d,p=l,h=0,v=!!s&&i(s,f,3);h0&&r(d))p=a(e,t,d,o(d.length),p,c-1)-1;else{if(p>=9007199254740991)throw TypeError("Exceed the acceptable array length");e[p]=d}p++}h++}return p};e.exports=a},6910:(e,t,n)=>{var r=n(3677);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},8516:(e,t,n)=>{var r=n(9944);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},2395:(e,t,n)=>{"use strict";var r=n(9944),o=n(8759),i=[].slice,a={},u=function(e,t,n){if(!(t in a)){for(var r=[],o=0;o{var r=n(9775),o=n(2086),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},1667:(e,t,n)=>{var r=n(375),o=n(7719),i=n(211)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},3546:(e,t,n)=>{var r=n(6112),o=n(1667);e.exports=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return r(t.call(e))}},6230:(e,t,n)=>{var r=n(3296),o=n(3546);e.exports=r?o:function(e){return Map.prototype.entries.call(e)}},5521:(e,t,n)=>{var r=n(3296),o=n(3546);e.exports=r?o:function(e){return Set.prototype.values.call(e)}},2086:(e,t,n)=>{var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||Function("return this")()},3167:e=>{var t={}.hasOwnProperty;e.exports=function(e,n){return t.call(e,n)}},7153:e=>{e.exports={}},1670:(e,t,n)=>{var r=n(2086);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},5963:(e,t,n)=>{var r=n(563);e.exports=r("document","documentElement")},6761:(e,t,n)=>{var r=n(5283),o=n(3677),i=n(821);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5974:(e,t,n)=>{var r=n(3677),o=n(2306),i="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==o(e)?i.call(e,""):Object(e)}:Object},5070:(e,t,n)=>{var r=n(8759),o=n(7530);e.exports=function(e,t,n){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(e,a),e}},9277:(e,t,n)=>{var r=n(4489),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return o.call(e)}),e.exports=r.inspectSource},2423:(e,t,n)=>{var r=n(7153),o=n(8759),i=n(3167),a=n(7826).f,u=n(5422),l=n(6910),c=u("meta"),s=0,f=Object.isExtensible||function(){return!0},d=function(e){a(e,c,{value:{objectID:"O"+ ++s,weakData:{}}})},p=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,c)){if(!f(e))return"F";if(!t)return"E";d(e)}return e[c].objectID},getWeakData:function(e,t){if(!i(e,c)){if(!f(e))return!0;if(!t)return!1;d(e)}return e[c].weakData},onFreeze:function(e){return l&&p.REQUIRED&&f(e)&&!i(e,c)&&d(e),e}};r[c]=!0},3278:(e,t,n)=>{var r,o,i,a=n(9316),u=n(2086),l=n(8759),c=n(2585),s=n(3167),f=n(8944),d=n(7153),p=u.WeakMap;if(a){var h=new p,v=h.get,m=h.has,g=h.set;r=function(e,t){return g.call(h,e,t),t},o=function(e){return v.call(h,e)||{}},i=function(e){return m.call(h,e)}}else{var y=f("state");d[y]=!0,r=function(e,t){return c(e,y,t),t},o=function(e){return s(e,y)?e[y]:{}},i=function(e){return s(e,y)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},2814:(e,t,n)=>{var r=n(211),o=n(7719),i=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},6526:(e,t,n)=>{var r=n(2306);e.exports=Array.isArray||function(e){return"Array"==r(e)}},7189:(e,t,n)=>{var r=n(3677),o=/#|\.prototype\./,i=function(e,t){var n=u[a(e)];return n==c||n!=l&&("function"==typeof t?r(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=i.data={},l=i.NATIVE="N",c=i.POLYFILL="P";e.exports=i},8759:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},3296:e=>{e.exports=!1},7994:(e,t,n)=>{var r=n(8759),o=n(2306),i=n(211)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},4722:(e,t,n)=>{var r=n(6112),o=n(2814),i=n(4005),a=n(8516),u=n(1667),l=n(7850),c=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,s,f){var d,p,h,v,m,g,y,b=a(t,n,s?2:1);if(f)d=e;else{if("function"!=typeof(p=u(e)))throw TypeError("Target is not iterable");if(o(p)){for(h=0,v=i(e.length);v>h;h++)if((m=s?b(r(y=e[h])[0],y[1]):b(e[h]))&&m instanceof c)return m;return new c(!1)}d=p.call(e)}for(g=d.next;!(y=g.call(d)).done;)if("object"==typeof(m=l(d,b,y.value,s))&&m&&m instanceof c)return m;return new c(!1)}).stop=function(e){return new c(!0,e)}},3083:(e,t,n)=>{"use strict";var r,o,i,a=n(2130),u=n(2585),l=n(3167),c=n(211),s=n(3296),f=c("iterator"),d=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):d=!0),null==r&&(r={}),s||l(r,f)||u(r,f,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},7719:e=>{e.exports={}},3173:(e,t,n)=>{var r,o,i,a,u,l,c,s,f=n(2086),d=n(4399).f,p=n(2306),h=n(4953).set,v=n(4344),m=f.MutationObserver||f.WebKitMutationObserver,g=f.process,y=f.Promise,b="process"==p(g),w=d(f,"queueMicrotask"),k=w&&w.value;k||(r=function(){var e,t;for(b&&(e=g.domain)&&e.exit();o;){t=o.fn,o=o.next;try{t()}catch(e){throw o?a():i=void 0,e}}i=void 0,e&&e.enter()},b?a=function(){g.nextTick(r)}:m&&!v?(u=!0,l=document.createTextNode(""),new m(r).observe(l,{characterData:!0}),a=function(){l.data=u=!u}):y&&y.resolve?(c=y.resolve(void 0),s=c.then,a=function(){s.call(c,r)}):a=function(){h.call(f,r)}),e.exports=k||function(e){var t={fn:e,next:void 0};i&&(i.next=t),o||(o=t,a()),i=t}},8109:(e,t,n)=>{var r=n(2086);e.exports=r.Promise},3193:(e,t,n)=>{var r=n(3677);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},4634:(e,t,n)=>{var r=n(3677),o=n(211),i=n(3296),a=o("iterator");e.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),i&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[a]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host}))},9316:(e,t,n)=>{var r=n(2086),o=n(9277),i=r.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},8722:(e,t,n)=>{"use strict";var r=n(9944),o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},7725:(e,t,n)=>{var r=n(7994);e.exports=function(e){if(r(e))throw TypeError("The method doesn't accept regular expressions");return e}},2252:(e,t,n)=>{var r=n(2086),o=n(4080).trim,i=n(9439),a=r.parseFloat,u=1/a(i+"-0")!=-1/0;e.exports=u?function(e){var t=o(String(e)),n=a(t);return 0===n&&"-"==t.charAt(0)?-0:n}:a},2194:(e,t,n)=>{var r=n(2086),o=n(4080).trim,i=n(9439),a=r.parseInt,u=/^[+-]?0[Xx]/,l=8!==a(i+"08")||22!==a(i+"0x16");e.exports=l?function(e,t){var n=o(String(e));return a(n,t>>>0||(u.test(n)?16:10))}:a},8675:(e,t,n)=>{"use strict";var r=n(5283),o=n(3677),i=n(8779),a=n(6952),u=n(7446),l=n(3060),c=n(5974),s=Object.assign,f=Object.defineProperty;e.exports=!s||o((function(){if(r&&1!==s({b:1},s(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=s({},e)[n]||"abcdefghijklmnopqrst"!=i(s({},t)).join("")}))?function(e,t){for(var n=l(e),o=arguments.length,s=1,f=a.f,d=u.f;o>s;)for(var p,h=c(arguments[s++]),v=f?i(h).concat(f(h)):i(h),m=v.length,g=0;m>g;)p=v[g++],r&&!d.call(h,p)||(n[p]=h[p]);return n}:s},4710:(e,t,n)=>{var r,o=n(6112),i=n(7711),a=n(8684),u=n(7153),l=n(5963),c=n(821),s=n(8944),f=s("IE_PROTO"),d=function(){},p=function(e){return"\n \n \n ${editor.stylesheets\n .map((s) => {\n if (s.type === StylesheetType.css) {\n return ``;\n } else {\n return ``;\n }\n })\n .join(\"\")}\n ${header || \"\"}\n ${htmlText}`,\n ],\n { type: \"text/html\" }\n );\n\n if (beforeRenderIframePreviewOpt.scheme === \"blob\") {\n setSrc(URL.createObjectURL(blob));\n } else {\n const reader = new FileReader();\n reader.readAsDataURL(blob);\n reader.onload = () => {\n setSrc(reader.result?.toString() || \"\");\n };\n }\n }, [block.compiledHtml, header, htmlText]);\n\n useEffect(() => {\n const onMessage = (ev: MessageEvent): void => {\n const containerEl = containerElRef.current;\n\n if (\n !(\n containerEl &&\n ev.source ===\n (containerEl.firstChild as HTMLIFrameElement).contentWindow &&\n ev.data &&\n ev.data.blockId === block.id\n )\n ) {\n return;\n }\n\n switch (ev.data.method) {\n case \"MTBlockEditorInitSize\":\n if (!isDefaultSize(size)) {\n break;\n }\n\n setSize({ ...size, ...ev.data.arguments });\n break;\n case \"MTBlockEditorSetSize\":\n (Object.keys(size) as Array).forEach((k) => {\n const oldValue =\n typeof size[k] === \"number\"\n ? (size[k] as number)\n : parseFloat(size[k] as string);\n const newValue =\n typeof ev.data.arguments[k] === \"number\"\n ? (ev.data.arguments[k] as number)\n : parseFloat(ev.data.arguments[k] as string);\n if (\n oldValue &&\n newValue &&\n oldValue > newValue &&\n Math.abs(oldValue - newValue) < SHRINK_THRESHOLD\n ) {\n ev.data.arguments[k] = size[k];\n }\n });\n\n if (\n size.width !== ev.data.arguments.width ||\n size.height !== ev.data.arguments.height\n ) {\n setSize(ev.data.arguments);\n }\n break;\n case \"MTBlockEditorOnClick\":\n (\n containerEl.closest(\"[data-mt-block-editor-block-id]\") ||\n (containerEl.getRootNode() as ShadowRoot)?.host\n )?.dispatchEvent(\n new MouseEvent(\"click\", {\n bubbles: true,\n cancelable: true,\n ...ev.data.arguments,\n })\n );\n break;\n case \"MTBlockEditorOnKeydown\":\n window.dispatchEvent(new KeyboardEvent(\"keydown\", ev.data.arguments));\n break;\n case \"MTBlockEditorSetCompiledHtml\":\n setCompiledHtml(\n ev.data.html,\n ev.data.html == null ? new Error(ev.data.error || \"Error\") : null,\n ev.data.arguments as SetCompiledHtmlOptions\n );\n break;\n }\n };\n\n window.addEventListener(\"message\", onMessage, {\n capture: true,\n passive: true,\n });\n return () => {\n window.removeEventListener(\"message\", onMessage, {\n capture: true,\n });\n };\n }, [size]);\n\n return (\n
\n \n
\n );\n};\n\nexport default BlockIframePreview;\n","import { t } from \"../i18n\";\nimport React, {\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n CSSProperties,\n} from \"react\";\nimport { render, unmountComponentAtNode } from \"react-dom\";\nimport {\n EditorContext,\n useEditorContext,\n BlocksContext,\n BlocksContextProps,\n} from \"../Context\";\nimport Block, {\n NewFromHtmlOptions,\n EditorOptions,\n SerializeOptions,\n CompileOptions,\n HasBlocks,\n} from \"../Block\";\nimport AddButton from \"../Component/AddButton\";\nimport BlockItem from \"../Component/BlockItem\";\nimport BlockIframePreview from \"../Component/BlockIframePreview\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport {\n parseContent,\n NO_BLOCK_TYPE_FALLBACK,\n preParseContent,\n escapeSingleQuoteAttribute,\n ParserContext,\n} from \"../util\";\n\ninterface EditorProps extends EditorOptions {\n block: Column;\n}\n\nconst COMPILE_TIMEOUT = 2000;\nconst SERIALIZATION_PARALLELISM = 4;\n\nconst STYLE_HIDDEN: CSSProperties = {\n position: \"absolute\",\n overflow: \"hidden\",\n height: \"0px\",\n border: \"none\",\n};\n\nconst Editor: React.FC = ({\n block,\n focus,\n focusBlock,\n focusDescendant,\n canRemove,\n}: EditorProps) => {\n if (\n (block.constructor as typeof Block).typeId !== \"core-column\" ||\n canRemove === undefined\n ) {\n canRemove = block.canRemoveBlock;\n }\n\n const { editor, setFocusedIds } = useEditorContext();\n\n const blocksContext = useMemo(\n () => ({\n panelBlockTypes: block.panelBlockTypes,\n shortcutBlockTypes: block.shortcutBlockTypes,\n addBlock: (b: Block, index: number | Block) => {\n if (index instanceof Block) {\n index = block.blocks.indexOf(index) + 1;\n }\n editor.addBlock(block, b, index);\n setFocusedIds([b.id]);\n },\n mergeBlock: (b: Block) => {\n const index = block.blocks.indexOf(b);\n if (editor.mergeBlock(block, b)) {\n setFocusedIds([block.blocks[index - 1].id]);\n }\n },\n removeBlock: (b: Block) => {\n const index = block.blocks.indexOf(b);\n editor.removeBlock(block, b);\n if (index > 0) {\n setFocusedIds([block.blocks[index - 1].id]);\n }\n },\n swapBlocks: (dragIndex: number, hoverIndex: number, scroll?: boolean) => {\n if (\n dragIndex === undefined ||\n hoverIndex === undefined ||\n !block.blocks[dragIndex] ||\n !block.blocks[hoverIndex]\n ) {\n return;\n }\n\n if (scroll) {\n const destEl = block.blocks[dragIndex].wrapperRef.current;\n if (!destEl) {\n return;\n }\n\n const rect = destEl.getBoundingClientRect();\n const scrollTop =\n window.pageYOffset || document.documentElement.scrollTop;\n const offsetTop = rect.height + 22;\n\n window.scrollTo({\n top: scrollTop + (dragIndex > hoverIndex ? -offsetTop : offsetTop),\n behavior: \"smooth\",\n });\n }\n\n editor.swapBlocks(block, dragIndex, hoverIndex);\n },\n }),\n []\n );\n\n const resetCompiledHtml = useCallback(() => {\n block.resetCompiledHtml();\n }, []);\n useEffect(() => {\n editor.on(\"change\", resetCompiledHtml);\n\n if (block._html !== \"\") {\n parseContent(\n preParseContent(block._html),\n editor.factory,\n new ParserContext()\n ).then((blocks) => {\n block._html = \"\";\n block.blocks = blocks;\n if (blocks[0]) {\n setFocusedIds([blocks[0].id]);\n }\n });\n }\n\n return () => {\n editor.off(\"change\", resetCompiledHtml);\n };\n }, []);\n\n useEffect(() => {\n if (focusDescendant) {\n resetCompiledHtml();\n return;\n }\n\n if (\n (block.constructor as typeof Block).shouldBeCompiled &&\n block.compiledHtml === undefined &&\n !focus &&\n !focusDescendant\n ) {\n block.compile({ editor });\n }\n }, [focus, focusDescendant]);\n\n const res = (\n \n \n {block.blocks.map((b, i) => {\n const focusFirstBlock = canRemove !== true && block.blocks.length === 1;\n const focusItem = (focus && focusFirstBlock) || undefined;\n return (\n \n );\n })}\n {canRemove && (\n
\n \n
\n )}\n
\n );\n\n if (block.rootBlock) {\n return React.createElement(\n block.rootBlock,\n {\n className: \"mt-be-column\",\n style: {\n width: \"100%\",\n },\n },\n res\n );\n } else {\n return res;\n }\n};\n\nclass Column extends Block implements HasBlocks {\n public static typeId = \"core-column\";\n public static className = \"mt-be-column\";\n public static rootBlock: string | null = \"div\";\n public static selectable = false;\n public static showPreview = true;\n public static get label(): string {\n return t(\"Column\");\n }\n\n public _html = \"\";\n public previewHeader = \"\";\n public showShortcuts = true;\n public blocks: Block[] = [];\n public cancelOngoingCompilationHandlers: (() => void)[] = [];\n\n public canRemoveBlock = true;\n public panelBlockTypes: string[] | null = null;\n public shortcutBlockTypes: string[] | null = null;\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public childBlocks(): Block[] {\n return this.blocks;\n }\n\n public get rootBlock(): string | null {\n return (this.constructor as typeof Column).rootBlock;\n }\n\n public get showPreview(): boolean {\n return (this.constructor as typeof Column).showPreview;\n }\n\n public resetCompiledHtml(): void {\n this.compiledHtml = undefined;\n\n this.cancelOngoingCompilationHandlers.map((h) => {\n h();\n });\n this.cancelOngoingCompilationHandlers = [];\n }\n\n public editor({\n focus,\n focusBlock,\n focusDescendant,\n canRemove,\n }: EditorOptions): JSX.Element {\n if (\n this.showPreview &&\n (this.constructor as typeof Column).typeId !== \"core-column\" &&\n ((this._html === \"\" &&\n this.blocks.length === 0 &&\n this.effectiveAddableBlockTypes().length === 0) ||\n (!focus && !focusDescendant && !focusBlock))\n ) {\n let preview: JSX.Element;\n\n const iframePreview = (\n \n );\n\n if (this.rootBlock) {\n preview = React.createElement(\n this.rootBlock,\n {\n key: this.id,\n className: \"mt-be-column\",\n style: {\n width: \"100%\",\n },\n },\n iframePreview\n );\n } else {\n preview = iframePreview;\n }\n\n return preview;\n }\n\n return (\n \n \n \n );\n }\n\n public isBlank(): boolean {\n return this.blocks.length === 0;\n }\n\n private async serializeChildBlocks(\n opts: SerializeOptions\n ): Promise {\n if (this.blocks.length <= SERIALIZATION_PARALLELISM) {\n return Promise.all(this.blocks.map((c) => c.serialize(opts)));\n }\n\n const res: string[] = [];\n const indexes = Object.keys(this.blocks).map((i) => Number(i));\n await Promise.all(\n [...Array(SERIALIZATION_PARALLELISM)].map(async () => {\n for (let i = indexes.shift(); i !== undefined; i = indexes.shift()) {\n res[i] = await this.blocks[i].serialize(opts);\n }\n })\n );\n return res;\n }\n\n public async serializedString(opts: SerializeOptions): Promise {\n const classNames = [\n (this.constructor as typeof Column).className,\n this.className,\n ].filter((c) => c);\n const serializedBlocks = await this.serializeChildBlocks(opts);\n\n return [\n this.rootBlock\n ? `<${this.rootBlock}${\n classNames.length\n ? ` class='${escapeSingleQuoteAttribute(classNames.join(\" \"))}'`\n : \"\"\n }>`\n : \"\",\n serializedBlocks.join(\"\"),\n this.rootBlock ? `` : \"\",\n ].join(\"\");\n }\n\n public async compile({ editor }: CompileOptions): Promise {\n let canceled = false;\n this.cancelOngoingCompilationHandlers.push(() => {\n canceled = true;\n });\n const onBeforeSetCompiledHtml = (): boolean => !canceled;\n\n const sourceHtml = await this.serializedString({ editor, external: false });\n return new Promise((resolve, reject) => {\n let timeoutId: ReturnType | null = null;\n\n const div = document.createElement(\"div\");\n Object.assign(div.style, STYLE_HIDDEN);\n document.body.appendChild(div);\n\n const onSetCompiledHtml = (error: Error | null): void => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n unmountComponentAtNode(div);\n div.remove();\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n };\n\n const editorContext = {\n editor,\n setFocusedIds: () => undefined,\n getFocusedIds: () => [],\n };\n\n render(\n \n \n ,\n div\n );\n\n const opts = editor.opts.block[\"core-column\"] || {};\n timeoutId = setTimeout(async () => {\n if (!canceled) {\n this.compiledHtml ||= sourceHtml;\n }\n onSetCompiledHtml(null);\n }, opts[\"compile-timeout\"] || COMPILE_TIMEOUT);\n });\n }\n\n public async serialize(opts: SerializeOptions): Promise {\n if (\n (this.constructor as typeof Block).shouldBeCompiled ||\n this.compiledHtml !== undefined\n ) {\n return super.serialize(opts);\n }\n\n const m = opts.editor.serializeMeta(this, opts.external);\n const typeId = (this.constructor as typeof Column).typeId;\n return [\n ``,\n await this.serializedString(opts),\n ``,\n ].join(\"\");\n }\n\n public static async newFromHtml({\n node,\n factory,\n meta,\n context,\n }: NewFromHtmlOptions): Promise {\n const html = node.hasAttribute(\"h\")\n ? preParseContent(node.getAttribute(\"h\") || \"\")\n : node.innerHTML;\n const blocks = await parseContent(\n html,\n factory,\n context,\n NO_BLOCK_TYPE_FALLBACK\n );\n const compiledHtml =\n (node.hasAttribute(\"h\") ? node.textContent : undefined) ?? undefined;\n\n return new this(\n Object.assign(\n { blocks, compiledHtml, _html: \"\" },\n meta as Partial\n )\n );\n }\n\n private effectiveAddableBlockTypes(): string[] {\n if (!this.canRemoveBlock) {\n return [];\n }\n return (this.panelBlockTypes || []).concat(this.shortcutBlockTypes || []);\n }\n}\n\nexport default Column;\n","import Editor from \"../Editor\";\nimport Block from \"../Block\";\nimport BlockFactory from \"../BlockFactory\";\nimport Text from \"../Block/Text\";\nimport Column from \"../Block/Column\";\nimport ParserContext from \"./ParserContext\";\n\nexport const preParseContent = (() => {\n const entityMap = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n } as { [key: string]: string };\n const entityReverseMap = Object.fromEntries(\n Object.entries(entityMap).map(([k, v]) => [v, k])\n );\n const entityRegExp = new RegExp(`[${Object.keys(entityMap).join(\"\")}]`, \"g\");\n const entityReverseRegExp = new RegExp(\n `(?:${Object.keys(entityReverseMap).join(\"|\")})`,\n \"g\"\n );\n\n return (value: string): string => {\n return value\n .replace(entityRegExp, (match) => entityMap[match])\n .replace(/<!--\\s+(\\/?mt-beb.*?)-->/g, (all, tag: string) => {\n return `<${tag.replace(\n entityReverseRegExp,\n (match) => entityReverseMap[match]\n )}>`;\n });\n };\n})();\n\nexport function removeControlCharacters(str: string): string {\n return str.replace(\n // eslint-disable-next-line no-control-regex,no-misleading-character-class\n /&#(?:0*?(?:[0-8]|1[124-9]|2\\d|3[01])?|x0*?(?:[0-8bcefBCEF]|1[0-9a-fA-F])?);|[^\\x09\\x0A\\x0D\\x20-\\xFF\\x85\\xA0-\\uD7FF\\uE000-\\uFDCF\\uFDE0-\\uFFFD\\uD800-\\uDBFF\\uDC00-\\uDFFF]/gm,\n \"\"\n );\n}\n\nexport const NO_BLOCK_TYPE_FALLBACK = \"\";\n\nexport async function parseContent(\n value: string,\n factory: BlockFactory,\n context: ParserContext,\n fallbackBlockType: string | typeof NO_BLOCK_TYPE_FALLBACK = \"core-html\"\n): Promise {\n if (!value) {\n return [];\n }\n\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(\n `${removeControlCharacters(value)}`,\n \"application/xml\"\n );\n\n if (!doc.children[0]) {\n return [];\n }\n\n let children = [...doc.children[0].children];\n if (children.length === 0) {\n if (fallbackBlockType !== NO_BLOCK_TYPE_FALLBACK) {\n const fallback = document.createElement(\"div\");\n fallback.setAttribute(\"t\", fallbackBlockType);\n fallback.innerHTML = value;\n children = [fallback];\n } else {\n return [];\n }\n }\n\n // TODO: verify\n const blocks = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n const typeId = node.getAttribute(\"t\") || \"core-text\";\n\n const metaRawValue = node.getAttribute(\"m\") || \"{}\";\n const metaArray = (metaRawValue.match(/\\w+|,|.+/g) || [])\n .filter((str) => str !== \",\")\n .map((str) =>\n /^[^{]/.test(str) ? context.get(str) || {} : JSON.parse(str)\n );\n const meta =\n metaArray.length === 1\n ? metaArray[0]\n : Object.assign.apply(null, [{}, ...metaArray]);\n\n if (typeId === \"core-context\") {\n for (const k in meta) {\n context.set(k, meta[k]);\n }\n continue;\n }\n\n let html = node.getAttribute(\"h\") || \"\";\n if (!html && node.textContent) {\n let c = node.textContent;\n if (meta.className) {\n c = c.replace(\n /^(<[^>]+)( class=\")([^\"]+)\"/,\n (m, tag, prefix, classNames) => {\n const filtered = classNames\n .split(/\\s+/)\n .filter((c: string) => c !== meta.className)\n .join(\" \");\n\n if (filtered) {\n return `${tag}${prefix}${filtered}\"`;\n } else {\n return tag;\n }\n }\n );\n }\n html = c;\n }\n\n const param = {\n html,\n node,\n factory,\n meta,\n context,\n };\n\n const t =\n factory.types().find((t: typeof Block) => t.typeId === typeId) || Column;\n const block = await t\n .newFromHtml(param)\n .catch(() => Text.newFromHtml(param));\n blocks.push(block);\n }\n\n return blocks;\n}\n\nconst emptyBlocks: Block[] = [];\nexport function findDescendantBlocks(\n ancestor: Block | Editor,\n ids: Readonly\n): Readonly {\n if (ids.length === 0) {\n return emptyBlocks;\n }\n\n const childBlocks =\n ancestor instanceof Editor ? ancestor.blocks : ancestor.childBlocks();\n if (childBlocks.length === 0) {\n return emptyBlocks;\n }\n\n return findDescendantBlocksInternal([...ids], childBlocks);\n}\n\nfunction findDescendantBlocksInternal(\n ids: string[],\n childBlocks: Readonly\n): Readonly {\n const result: Block[] = [];\n for (let i = 0, len = childBlocks.length; i < len; i++) {\n const b = childBlocks[i];\n const index = ids.indexOf(b.id);\n if (index !== -1) {\n result.push(b);\n ids.splice(index, 1);\n if (ids.length === 0) {\n return result;\n }\n }\n\n result.push(...findDescendantBlocksInternal(ids, b.childBlocks()));\n if (ids.length === 0) {\n return result;\n }\n }\n\n return result;\n}\n\ninterface GetBlocksByRangeState {\n ids: Readonly>;\n rootBlocks: Readonly;\n foundCount: number;\n startBlocks?: Readonly;\n endBlocks?: Readonly;\n result?: Readonly;\n}\nexport function getBlocksByRange(\n ancestor: Block | Editor,\n ids: Readonly\n): Readonly {\n const childBlocks =\n ancestor instanceof Editor ? ancestor.blocks : ancestor.childBlocks();\n const state: GetBlocksByRangeState = {\n ids: new Set(ids),\n rootBlocks: childBlocks,\n foundCount: 0,\n };\n getBlocksByRangeInternal(childBlocks, state);\n return state.result || emptyBlocks;\n}\n\nfunction getBlocksByRangeInternal(\n childBlocks: Readonly,\n state: GetBlocksByRangeState,\n parents: Readonly = []\n): Readonly | undefined {\n if (state.result && state.foundCount === state.ids.size) {\n return;\n }\n childBlocks.forEach((b) => {\n const currentBlocks = [...parents, b];\n\n getBlocksByRangeInternal(b.childBlocks(), state, currentBlocks);\n if (state.result && state.foundCount === state.ids.size) {\n return;\n }\n if (state.ids.has(b.id)) {\n state.foundCount++;\n\n if (state.ids.size === 1) {\n state.result = [b];\n } else if (state.startBlocks) {\n let range: {\n blocks: Readonly;\n start: string;\n end: string;\n };\n findRange: for (let i = state.startBlocks.length - 2; i >= 0; i--) {\n for (let j = currentBlocks.length - 2; j >= 0; j--) {\n if (state.startBlocks[i] === currentBlocks[j]) {\n range = {\n blocks: state.startBlocks[i].childBlocks(),\n start: state.startBlocks[i + 1].id,\n end: currentBlocks[j + 1].id,\n };\n break findRange;\n }\n }\n }\n\n range ||= {\n blocks: state.rootBlocks,\n start: state.startBlocks[0].id,\n end: currentBlocks[0].id,\n };\n\n const blockIds = range.blocks.map((b) => b.id);\n state.result = range.blocks.slice(\n blockIds.indexOf(range.start),\n blockIds.indexOf(range.end) + 1\n );\n } else {\n state.startBlocks = currentBlocks;\n }\n }\n });\n}\n","import platform from \"platform\";\n\nconst labels = {\n mac: {\n cmd: \"⌘\",\n alt: \"⌥\",\n ctrl: \"⌃\",\n shift: \"⇧\",\n },\n other: {\n cmd: \"Ctrl+\",\n alt: \"Alt+\",\n ctrl: \"Ctrl+\",\n shift: \"Shift+\",\n },\n};\n\nlet isMac = false;\nlet labelMap = labels.other;\n\nexport function setPlatform(_platform: typeof platform): void {\n isMac = [\"OS X\", \"iOS\"].includes(_platform.os?.family || \"\");\n labelMap = isMac ? labels.mac : labels.other;\n}\nsetPlatform(platform);\n\nexport function toKeyboardShortcutKey(ev: KeyboardEvent): string {\n return `${ev.ctrlKey && isMac ? \"ctrl+\" : \"\"}${ev.altKey ? \"alt+\" : \"\"}${\n ev.shiftKey ? \"shift+\" : \"\"\n }${ev.metaKey || (ev.ctrlKey && !isMac) ? \"cmd+\" : \"\"}${ev.key}`;\n}\n\nexport function toKeyboardShortcutLabel(key: string): string {\n return key.replace(\n /(ctrl|cmd|alt|shift)\\+/g,\n (all, key: keyof typeof labelMap) => {\n return labelMap[key] || key;\n }\n );\n}\n","class ParserContext extends Map {}\n\nexport default ParserContext;\n","export var INIT_COORDS = 'dnd-core/INIT_COORDS';\nexport var BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';\nexport var PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';\nexport var HOVER = 'dnd-core/HOVER';\nexport var DROP = 'dnd-core/DROP';\nexport var END_DRAG = 'dnd-core/END_DRAG';","import { INIT_COORDS } from '../types';\nexport function setClientOffset(clientOffset, sourceClientOffset) {\n return {\n type: INIT_COORDS,\n payload: {\n sourceClientOffset: sourceClientOffset || null,\n clientOffset: clientOffset || null\n }\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// cheap lodash replacements\n\n/**\n * drop-in replacement for _.get\n * @param obj\n * @param path\n * @param defaultValue\n */\nexport function get(obj, path, defaultValue) {\n return path.split('.').reduce(function (a, c) {\n return a && a[c] ? a[c] : defaultValue || null;\n }, obj);\n}\n/**\n * drop-in replacement for _.without\n */\n\nexport function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isString(input) {\n return typeof input === 'string';\n}\n/**\n * drop-in replacement for _.isString\n * @param input\n */\n\nexport function isObject(input) {\n return _typeof(input) === 'object';\n}\n/**\n * repalcement for _.xor\n * @param itemsA\n * @param itemsB\n */\n\nexport function xor(itemsA, itemsB) {\n var map = new Map();\n\n var insertItem = function insertItem(item) {\n map.set(item, map.has(item) ? map.get(item) + 1 : 1);\n };\n\n itemsA.forEach(insertItem);\n itemsB.forEach(insertItem);\n var result = [];\n map.forEach(function (count, key) {\n if (count === 1) {\n result.push(key);\n }\n });\n return result;\n}\n/**\n * replacement for _.intersection\n * @param itemsA\n * @param itemsB\n */\n\nexport function intersection(itemsA, itemsB) {\n return itemsA.filter(function (t) {\n return itemsB.indexOf(t) > -1;\n });\n}","import { invariant } from '@react-dnd/invariant';\nimport { setClientOffset } from './local/setClientOffset';\nimport { isObject } from '../../utils/js_utils';\nimport { BEGIN_DRAG, INIT_COORDS } from './types';\nvar ResetCoordinatesAction = {\n type: INIT_COORDS,\n payload: {\n clientOffset: null,\n sourceClientOffset: null\n }\n};\nexport function createBeginDrag(manager) {\n return function beginDrag() {\n var sourceIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n publishSource: true\n };\n var _options$publishSourc = options.publishSource,\n publishSource = _options$publishSourc === void 0 ? true : _options$publishSourc,\n clientOffset = options.clientOffset,\n getSourceClientOffset = options.getSourceClientOffset;\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry(); // Initialize the coordinates using the client offset\n\n manager.dispatch(setClientOffset(clientOffset));\n verifyInvariants(sourceIds, monitor, registry); // Get the draggable source\n\n var sourceId = getDraggableSource(sourceIds, monitor);\n\n if (sourceId === null) {\n manager.dispatch(ResetCoordinatesAction);\n return;\n } // Get the source client offset\n\n\n var sourceClientOffset = null;\n\n if (clientOffset) {\n if (!getSourceClientOffset) {\n throw new Error('getSourceClientOffset must be defined');\n }\n\n verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);\n sourceClientOffset = getSourceClientOffset(sourceId);\n } // Initialize the full coordinates\n\n\n manager.dispatch(setClientOffset(clientOffset, sourceClientOffset));\n var source = registry.getSource(sourceId);\n var item = source.beginDrag(monitor, sourceId); // If source.beginDrag returns null, this is an indicator to cancel the drag\n\n if (item == null) {\n return undefined;\n }\n\n verifyItemIsObject(item);\n registry.pinSource(sourceId);\n var itemType = registry.getSourceType(sourceId);\n return {\n type: BEGIN_DRAG,\n payload: {\n itemType: itemType,\n item: item,\n sourceId: sourceId,\n clientOffset: clientOffset || null,\n sourceClientOffset: sourceClientOffset || null,\n isSourcePublic: !!publishSource\n }\n };\n };\n}\n\nfunction verifyInvariants(sourceIds, monitor, registry) {\n invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');\n sourceIds.forEach(function (sourceId) {\n invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');\n });\n}\n\nfunction verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {\n invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');\n}\n\nfunction verifyItemIsObject(item) {\n invariant(isObject(item), 'Item must be an object.');\n}\n\nfunction getDraggableSource(sourceIds, monitor) {\n var sourceId = null;\n\n for (var i = sourceIds.length - 1; i >= 0; i--) {\n if (monitor.canDragSource(sourceIds[i])) {\n sourceId = sourceIds[i];\n break;\n }\n }\n\n return sourceId;\n}","import { PUBLISH_DRAG_SOURCE } from './types';\nexport function createPublishDragSource(manager) {\n return function publishDragSource() {\n var monitor = manager.getMonitor();\n\n if (monitor.isDragging()) {\n return {\n type: PUBLISH_DRAG_SOURCE\n };\n }\n };\n}","export function matchesType(targetType, draggedItemType) {\n if (draggedItemType === null) {\n return targetType === null;\n }\n\n return Array.isArray(targetType) ? targetType.some(function (t) {\n return t === draggedItemType;\n }) : targetType === draggedItemType;\n}","import { invariant } from '@react-dnd/invariant';\nimport { matchesType } from '../../utils/matchesType';\nimport { HOVER } from './types';\nexport function createHover(manager) {\n return function hover(targetIdsArg) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n clientOffset = _ref.clientOffset;\n\n verifyTargetIdsIsArray(targetIdsArg);\n var targetIds = targetIdsArg.slice(0);\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n checkInvariants(targetIds, monitor, registry);\n var draggedItemType = monitor.getItemType();\n removeNonMatchingTargetIds(targetIds, registry, draggedItemType);\n hoverAllTargets(targetIds, monitor, registry);\n return {\n type: HOVER,\n payload: {\n targetIds: targetIds,\n clientOffset: clientOffset || null\n }\n };\n };\n}\n\nfunction verifyTargetIdsIsArray(targetIdsArg) {\n invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');\n}\n\nfunction checkInvariants(targetIds, monitor, registry) {\n invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call hover after drop.');\n\n for (var i = 0; i < targetIds.length; i++) {\n var targetId = targetIds[i];\n invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');\n var target = registry.getTarget(targetId);\n invariant(target, 'Expected targetIds to be registered.');\n }\n}\n\nfunction removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {\n // Remove those targetIds that don't match the targetType. This\n // fixes shallow isOver which would only be non-shallow because of\n // non-matching targets.\n for (var i = targetIds.length - 1; i >= 0; i--) {\n var targetId = targetIds[i];\n var targetType = registry.getTargetType(targetId);\n\n if (!matchesType(targetType, draggedItemType)) {\n targetIds.splice(i, 1);\n }\n }\n}\n\nfunction hoverAllTargets(targetIds, monitor, registry) {\n // Finally call hover on all matching targets.\n targetIds.forEach(function (targetId) {\n var target = registry.getTarget(targetId);\n target.hover(monitor, targetId);\n });\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { DROP } from './types';\nimport { isObject } from '../../utils/js_utils';\nexport function createDrop(manager) {\n return function drop() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyInvariants(monitor);\n var targetIds = getDroppableTargets(monitor); // Multiple actions are dispatched here, which is why this doesn't return an action\n\n targetIds.forEach(function (targetId, index) {\n var dropResult = determineDropResult(targetId, index, registry, monitor);\n var action = {\n type: DROP,\n payload: {\n dropResult: _objectSpread(_objectSpread({}, options), dropResult)\n }\n };\n manager.dispatch(action);\n });\n };\n}\n\nfunction verifyInvariants(monitor) {\n invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');\n invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');\n}\n\nfunction determineDropResult(targetId, index, registry, monitor) {\n var target = registry.getTarget(targetId);\n var dropResult = target ? target.drop(monitor, targetId) : undefined;\n verifyDropResultType(dropResult);\n\n if (typeof dropResult === 'undefined') {\n dropResult = index === 0 ? {} : monitor.getDropResult();\n }\n\n return dropResult;\n}\n\nfunction verifyDropResultType(dropResult) {\n invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');\n}\n\nfunction getDroppableTargets(monitor) {\n var targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);\n targetIds.reverse();\n return targetIds;\n}","import { invariant } from '@react-dnd/invariant';\nimport { END_DRAG } from './types';\nexport function createEndDrag(manager) {\n return function endDrag() {\n var monitor = manager.getMonitor();\n var registry = manager.getRegistry();\n verifyIsDragging(monitor);\n var sourceId = monitor.getSourceId();\n\n if (sourceId != null) {\n var source = registry.getSource(sourceId, true);\n source.endDrag(monitor, sourceId);\n registry.unpinSource();\n }\n\n return {\n type: END_DRAG\n };\n };\n}\n\nfunction verifyIsDragging(monitor) {\n invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { createDragDropActions } from '../actions/dragDrop';\nexport var DragDropManagerImpl = /*#__PURE__*/function () {\n function DragDropManagerImpl(store, monitor) {\n var _this = this;\n\n _classCallCheck(this, DragDropManagerImpl);\n\n this.isSetUp = false;\n\n this.handleRefCountChange = function () {\n var shouldSetUp = _this.store.getState().refCount > 0;\n\n if (_this.backend) {\n if (shouldSetUp && !_this.isSetUp) {\n _this.backend.setup();\n\n _this.isSetUp = true;\n } else if (!shouldSetUp && _this.isSetUp) {\n _this.backend.teardown();\n\n _this.isSetUp = false;\n }\n }\n };\n\n this.store = store;\n this.monitor = monitor;\n store.subscribe(this.handleRefCountChange);\n }\n\n _createClass(DragDropManagerImpl, [{\n key: \"receiveBackend\",\n value: function receiveBackend(backend) {\n this.backend = backend;\n }\n }, {\n key: \"getMonitor\",\n value: function getMonitor() {\n return this.monitor;\n }\n }, {\n key: \"getBackend\",\n value: function getBackend() {\n return this.backend;\n }\n }, {\n key: \"getRegistry\",\n value: function getRegistry() {\n return this.monitor.registry;\n }\n }, {\n key: \"getActions\",\n value: function getActions() {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n var manager = this;\n var dispatch = this.store.dispatch;\n\n function bindActionCreator(actionCreator) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var action = actionCreator.apply(manager, args);\n\n if (typeof action !== 'undefined') {\n dispatch(action);\n }\n };\n }\n\n var actions = createDragDropActions(this);\n return Object.keys(actions).reduce(function (boundActions, key) {\n var action = actions[key];\n boundActions[key] = bindActionCreator(action);\n return boundActions;\n }, {});\n }\n }, {\n key: \"dispatch\",\n value: function dispatch(action) {\n this.store.dispatch(action);\n }\n }]);\n\n return DragDropManagerImpl;\n}();","import { createBeginDrag } from './beginDrag';\nimport { createPublishDragSource } from './publishDragSource';\nimport { createHover } from './hover';\nimport { createDrop } from './drop';\nimport { createEndDrag } from './endDrag';\nexport * from './types';\nexport function createDragDropActions(manager) {\n return {\n beginDrag: createBeginDrag(manager),\n publishDragSource: createPublishDragSource(manager),\n hover: createHover(manager),\n drop: createDrop(manager),\n endDrag: createEndDrag(manager)\n };\n}","import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\n\n/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nfunction formatProdErrorMessage(code) {\n return \"Minified Redux error #\" + code + \"; visit https://redux.js.org/Errors?code=\" + code + \" for the full message or \" + 'use the non-minified dev environment for full errors. ';\n}\n\n// Inlined version of the `symbol-observable` polyfill\nvar $$observable = (function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n})();\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nfunction miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n var constructorName = ctorName(val);\n\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n } // other\n\n\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\n\nfunction ctorName(val) {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\n\nfunction isError(val) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\n\nfunction kindOf(val) {\n var typeOfVal = typeof val;\n\n if (process.env.NODE_ENV !== 'production') {\n typeOfVal = miniKindOf(val);\n }\n\n return typeOfVal;\n}\n\n/**\n * @deprecated\n *\n * **We recommend using the `configureStore` method\n * of the `@reduxjs/toolkit` package**, which replaces `createStore`.\n *\n * Redux Toolkit is our recommended approach for writing Redux logic today,\n * including store setup, reducers, data fetching, and more.\n *\n * **For more details, please read this Redux docs page:**\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * `configureStore` from Redux Toolkit is an improved version of `createStore` that\n * simplifies setup and helps avoid common bugs.\n *\n * You should not be using the `redux` core package by itself today, except for learning purposes.\n * The `createStore` method from the core `redux` package will not be removed, but we encourage\n * all users to migrate to using Redux Toolkit for all Redux code.\n *\n * If you want to use `createStore` without this visual deprecation warning, use\n * the `legacy_createStore` import instead:\n *\n * `import { legacy_createStore as createStore} from 'redux'`\n *\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(1) : \"Expected the enhancer to be a function. Instead, received: '\" + kindOf(enhancer) + \"'\");\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(2) : \"Expected the root reducer to be a function. Instead, received: '\" + kindOf(reducer) + \"'\");\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(4) : \"Expected the listener to be a function. Instead, received: '\" + kindOf(listener) + \"'\");\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(7) : \"Actions must be plain objects. Instead, the actual type was: '\" + kindOf(action) + \"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.\");\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(8) : 'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.');\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(10) : \"Expected the nextReducer to be a function. Instead, received: '\" + kindOf(nextReducer));\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(11) : \"Expected the observer to be an object. Instead, received: '\" + kindOf(observer) + \"'\");\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n/**\n * Creates a Redux store that holds the state tree.\n *\n * **We recommend using `configureStore` from the\n * `@reduxjs/toolkit` package**, which replaces `createStore`:\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nvar legacy_createStore = createStore;\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + kindOf(inputState) + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(12) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(13) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle '\" + ActionTypes.INIT + \"' or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(14) : \"When called with an action of type \" + (actionType ? \"\\\"\" + String(actionType) + \"\\\"\" : '(unknown type)') + \", the slice reducer for key \\\"\" + _key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\");\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(16) : \"bindActionCreators expected an object or a function, but instead received: '\" + kindOf(actionCreators) + \"'. \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore };\n","export var strictEquality = function strictEquality(a, b) {\n return a === b;\n};\n/**\n * Determine if two cartesian coordinate offsets are equal\n * @param offsetA\n * @param offsetB\n */\n\nexport function areCoordsEqual(offsetA, offsetB) {\n if (!offsetA && !offsetB) {\n return true;\n } else if (!offsetA || !offsetB) {\n return false;\n } else {\n return offsetA.x === offsetB.x && offsetA.y === offsetB.y;\n }\n}\n/**\n * Determines if two arrays of items are equal\n * @param a The first array of items\n * @param b The second array of items\n */\n\nexport function areArraysEqual(a, b) {\n var isEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : strictEquality;\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (var i = 0; i < a.length; ++i) {\n if (!isEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { INIT_COORDS, BEGIN_DRAG, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { areCoordsEqual } from '../utils/equality';\nvar initialState = {\n initialSourceClientOffset: null,\n initialClientOffset: null,\n clientOffset: null\n};\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case INIT_COORDS:\n case BEGIN_DRAG:\n return {\n initialSourceClientOffset: payload.sourceClientOffset,\n initialClientOffset: payload.clientOffset,\n clientOffset: payload.clientOffset\n };\n\n case HOVER:\n if (areCoordsEqual(state.clientOffset, payload.clientOffset)) {\n return state;\n }\n\n return _objectSpread(_objectSpread({}, state), {}, {\n clientOffset: payload.clientOffset\n });\n\n case END_DRAG:\n case DROP:\n return initialState;\n\n default:\n return state;\n }\n}","export var ADD_SOURCE = 'dnd-core/ADD_SOURCE';\nexport var ADD_TARGET = 'dnd-core/ADD_TARGET';\nexport var REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';\nexport var REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';\nexport function addSource(sourceId) {\n return {\n type: ADD_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function addTarget(targetId) {\n return {\n type: ADD_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}\nexport function removeSource(sourceId) {\n return {\n type: REMOVE_SOURCE,\n payload: {\n sourceId: sourceId\n }\n };\n}\nexport function removeTarget(targetId) {\n return {\n type: REMOVE_TARGET,\n payload: {\n targetId: targetId\n }\n };\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { REMOVE_TARGET } from '../actions/registry';\nimport { without } from '../utils/js_utils';\nvar initialState = {\n itemType: null,\n item: null,\n sourceId: null,\n targetIds: [],\n dropResult: null,\n didDrop: false,\n isSourcePublic: null\n};\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n var payload = action.payload;\n\n switch (action.type) {\n case BEGIN_DRAG:\n return _objectSpread(_objectSpread({}, state), {}, {\n itemType: payload.itemType,\n item: payload.item,\n sourceId: payload.sourceId,\n isSourcePublic: payload.isSourcePublic,\n dropResult: null,\n didDrop: false\n });\n\n case PUBLISH_DRAG_SOURCE:\n return _objectSpread(_objectSpread({}, state), {}, {\n isSourcePublic: true\n });\n\n case HOVER:\n return _objectSpread(_objectSpread({}, state), {}, {\n targetIds: payload.targetIds\n });\n\n case REMOVE_TARGET:\n if (state.targetIds.indexOf(payload.targetId) === -1) {\n return state;\n }\n\n return _objectSpread(_objectSpread({}, state), {}, {\n targetIds: without(state.targetIds, payload.targetId)\n });\n\n case DROP:\n return _objectSpread(_objectSpread({}, state), {}, {\n dropResult: payload.dropResult,\n didDrop: true,\n targetIds: []\n });\n\n case END_DRAG:\n return _objectSpread(_objectSpread({}, state), {}, {\n itemType: null,\n item: null,\n sourceId: null,\n dropResult: null,\n didDrop: false,\n isSourcePublic: null,\n targetIds: []\n });\n\n default:\n return state;\n }\n}","import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case ADD_SOURCE:\n case ADD_TARGET:\n return state + 1;\n\n case REMOVE_SOURCE:\n case REMOVE_TARGET:\n return state - 1;\n\n default:\n return state;\n }\n}","import { intersection } from './js_utils';\nexport var NONE = [];\nexport var ALL = [];\nNONE.__IS_NONE__ = true;\nALL.__IS_ALL__ = true;\n/**\n * Determines if the given handler IDs are dirty or not.\n *\n * @param dirtyIds The set of dirty handler ids\n * @param handlerIds The set of handler ids to check\n */\n\nexport function areDirty(dirtyIds, handlerIds) {\n if (dirtyIds === NONE) {\n return false;\n }\n\n if (dirtyIds === ALL || typeof handlerIds === 'undefined') {\n return true;\n }\n\n var commonIds = intersection(handlerIds, dirtyIds);\n return commonIds.length > 0;\n}","import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP } from '../actions/dragDrop';\nimport { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry';\nimport { areArraysEqual } from '../utils/equality';\nimport { NONE, ALL } from '../utils/dirtiness';\nimport { xor } from '../utils/js_utils';\nexport function reduce() {\n var _state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NONE;\n\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case HOVER:\n break;\n\n case ADD_SOURCE:\n case ADD_TARGET:\n case REMOVE_TARGET:\n case REMOVE_SOURCE:\n return NONE;\n\n case BEGIN_DRAG:\n case PUBLISH_DRAG_SOURCE:\n case END_DRAG:\n case DROP:\n default:\n return ALL;\n }\n\n var _action$payload = action.payload,\n _action$payload$targe = _action$payload.targetIds,\n targetIds = _action$payload$targe === void 0 ? [] : _action$payload$targe,\n _action$payload$prevT = _action$payload.prevTargetIds,\n prevTargetIds = _action$payload$prevT === void 0 ? [] : _action$payload$prevT;\n var result = xor(targetIds, prevTargetIds);\n var didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds);\n\n if (!didChange) {\n return NONE;\n } // Check the target ids at the innermost position. If they are valid, add them\n // to the result\n\n\n var prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];\n var innermostTargetId = targetIds[targetIds.length - 1];\n\n if (prevInnermostTargetId !== innermostTargetId) {\n if (prevInnermostTargetId) {\n result.push(prevInnermostTargetId);\n }\n\n if (innermostTargetId) {\n result.push(innermostTargetId);\n }\n }\n\n return result;\n}","export function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n return state + 1;\n}","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { reduce as dragOffset } from './dragOffset';\nimport { reduce as dragOperation } from './dragOperation';\nimport { reduce as refCount } from './refCount';\nimport { reduce as dirtyHandlerIds } from './dirtyHandlerIds';\nimport { reduce as stateId } from './stateId';\nimport { get } from '../utils/js_utils';\nexport function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments.length > 1 ? arguments[1] : undefined;\n return {\n dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {\n type: action.type,\n payload: _objectSpread(_objectSpread({}, action.payload), {}, {\n prevTargetIds: get(state, 'dragOperation.targetIds', [])\n })\n }),\n dragOffset: dragOffset(state.dragOffset, action),\n refCount: refCount(state.refCount, action),\n dragOperation: dragOperation(state.dragOperation, action),\n stateId: stateId(state.stateId)\n };\n}","/**\n * Coordinate addition\n * @param a The first coordinate\n * @param b The second coordinate\n */\nexport function add(a, b) {\n return {\n x: a.x + b.x,\n y: a.y + b.y\n };\n}\n/**\n * Coordinate subtraction\n * @param a The first coordinate\n * @param b The second coordinate\n */\n\nexport function subtract(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n/**\n * Returns the cartesian distance of the drag source component's position, based on its position\n * at the time when the current drag operation has started, and the movement difference.\n *\n * Returns null if no item is being dragged.\n *\n * @param state The offset state to compute from\n */\n\nexport function getSourceClientOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset,\n initialSourceClientOffset = state.initialSourceClientOffset;\n\n if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {\n return null;\n }\n\n return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);\n}\n/**\n * Determines the x,y offset between the client offset and the initial client offset\n *\n * @param state The offset state to compute from\n */\n\nexport function getDifferenceFromInitialOffset(state) {\n var clientOffset = state.clientOffset,\n initialClientOffset = state.initialClientOffset;\n\n if (!clientOffset || !initialClientOffset) {\n return null;\n }\n\n return subtract(clientOffset, initialClientOffset);\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { matchesType } from '../utils/matchesType';\nimport { getSourceClientOffset as _getSourceClientOffset, getDifferenceFromInitialOffset as _getDifferenceFromInitialOffset } from '../utils/coords';\nimport { areDirty } from '../utils/dirtiness';\nexport var DragDropMonitorImpl = /*#__PURE__*/function () {\n function DragDropMonitorImpl(store, registry) {\n _classCallCheck(this, DragDropMonitorImpl);\n\n this.store = store;\n this.registry = registry;\n }\n\n _createClass(DragDropMonitorImpl, [{\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n handlerIds: undefined\n };\n var handlerIds = options.handlerIds;\n invariant(typeof listener === 'function', 'listener must be a function.');\n invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');\n var prevStateId = this.store.getState().stateId;\n\n var handleChange = function handleChange() {\n var state = _this.store.getState();\n\n var currentStateId = state.stateId;\n\n try {\n var canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);\n\n if (!canSkipListener) {\n listener();\n }\n } finally {\n prevStateId = currentStateId;\n }\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"subscribeToOffsetChange\",\n value: function subscribeToOffsetChange(listener) {\n var _this2 = this;\n\n invariant(typeof listener === 'function', 'listener must be a function.');\n var previousState = this.store.getState().dragOffset;\n\n var handleChange = function handleChange() {\n var nextState = _this2.store.getState().dragOffset;\n\n if (nextState === previousState) {\n return;\n }\n\n previousState = nextState;\n listener();\n };\n\n return this.store.subscribe(handleChange);\n }\n }, {\n key: \"canDragSource\",\n value: function canDragSource(sourceId) {\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId);\n invariant(source, \"Expected to find a valid source. sourceId=\".concat(sourceId));\n\n if (this.isDragging()) {\n return false;\n }\n\n return source.canDrag(this, sourceId);\n }\n }, {\n key: \"canDropOnTarget\",\n value: function canDropOnTarget(targetId) {\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var target = this.registry.getTarget(targetId);\n invariant(target, \"Expected to find a valid target. targetId=\".concat(targetId));\n\n if (!this.isDragging() || this.didDrop()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);\n }\n }, {\n key: \"isDragging\",\n value: function isDragging() {\n return Boolean(this.getItemType());\n }\n }, {\n key: \"isDraggingSource\",\n value: function isDraggingSource(sourceId) {\n // undefined on initial render\n if (!sourceId) {\n return false;\n }\n\n var source = this.registry.getSource(sourceId, true);\n invariant(source, \"Expected to find a valid source. sourceId=\".concat(sourceId));\n\n if (!this.isDragging() || !this.isSourcePublic()) {\n return false;\n }\n\n var sourceType = this.registry.getSourceType(sourceId);\n var draggedItemType = this.getItemType();\n\n if (sourceType !== draggedItemType) {\n return false;\n }\n\n return source.isDragging(this, sourceId);\n }\n }, {\n key: \"isOverTarget\",\n value: function isOverTarget(targetId) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n shallow: false\n };\n\n // undefined on initial render\n if (!targetId) {\n return false;\n }\n\n var shallow = options.shallow;\n\n if (!this.isDragging()) {\n return false;\n }\n\n var targetType = this.registry.getTargetType(targetId);\n var draggedItemType = this.getItemType();\n\n if (draggedItemType && !matchesType(targetType, draggedItemType)) {\n return false;\n }\n\n var targetIds = this.getTargetIds();\n\n if (!targetIds.length) {\n return false;\n }\n\n var index = targetIds.indexOf(targetId);\n\n if (shallow) {\n return index === targetIds.length - 1;\n } else {\n return index > -1;\n }\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.store.getState().dragOperation.itemType;\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.store.getState().dragOperation.item;\n }\n }, {\n key: \"getSourceId\",\n value: function getSourceId() {\n return this.store.getState().dragOperation.sourceId;\n }\n }, {\n key: \"getTargetIds\",\n value: function getTargetIds() {\n return this.store.getState().dragOperation.targetIds;\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.store.getState().dragOperation.dropResult;\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.store.getState().dragOperation.didDrop;\n }\n }, {\n key: \"isSourcePublic\",\n value: function isSourcePublic() {\n return Boolean(this.store.getState().dragOperation.isSourcePublic);\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.store.getState().dragOffset.initialClientOffset;\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.store.getState().dragOffset.initialSourceClientOffset;\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.store.getState().dragOffset.clientOffset;\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return _getSourceClientOffset(this.store.getState().dragOffset);\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return _getDifferenceFromInitialOffset(this.store.getState().dragOffset);\n }\n }]);\n\n return DragDropMonitorImpl;\n}();","export var HandlerRole;\n\n(function (HandlerRole) {\n HandlerRole[\"SOURCE\"] = \"SOURCE\";\n HandlerRole[\"TARGET\"] = \"TARGET\";\n})(HandlerRole || (HandlerRole = {}));","var nextUniqueId = 0;\nexport function getNextUniqueId() {\n return nextUniqueId++;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { invariant } from '@react-dnd/invariant';\nexport function validateSourceContract(source) {\n invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');\n invariant(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');\n invariant(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');\n}\nexport function validateTargetContract(target) {\n invariant(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');\n invariant(typeof target.hover === 'function', 'Expected hover to be a function.');\n invariant(typeof target.drop === 'function', 'Expected beginDrag to be a function.');\n}\nexport function validateType(type, allowArray) {\n if (allowArray && Array.isArray(type)) {\n type.forEach(function (t) {\n return validateType(t, false);\n });\n return;\n }\n\n invariant(typeof type === 'string' || _typeof(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.');\n}","// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n/* globals self */ const scope = typeof global !== 'undefined' ? global : self;\nconst BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\nexport function makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n const timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n const intervalHandle = setInterval(handleTimer, 50);\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nexport function makeRequestCallFromMutationObserver(callback) {\n let toggle = 1;\n const observer = new BrowserMutationObserver(callback);\n const node = document.createTextNode('');\n observer.observe(node, {\n characterData: true\n });\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\nexport const makeRequestCall = typeof BrowserMutationObserver === 'function' ? // reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nmakeRequestCallFromMutationObserver : // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\nmakeRequestCallFromTimer;\n\n//# sourceMappingURL=makeRequestCall.mjs.map","// `call`, just like a function.\nexport class RawTask {\n call() {\n try {\n this.task && this.task();\n } catch (error) {\n this.onError(error);\n } finally{\n this.task = null;\n this.release(this);\n }\n }\n constructor(onError, release){\n this.onError = onError;\n this.release = release;\n this.task = null;\n }\n}\n\n//# sourceMappingURL=RawTask.mjs.map","import { AsapQueue } from './AsapQueue.mjs';\nimport { TaskFactory } from './TaskFactory.mjs';\nconst asapQueue = new AsapQueue();\nconst taskFactory = new TaskFactory(asapQueue.registerPendingError);\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */ export function asap(task) {\n asapQueue.enqueueTask(taskFactory.create(task));\n}\n\n//# sourceMappingURL=asap.mjs.map","import { makeRequestCall, makeRequestCallFromTimer } from './makeRequestCall.mjs';\nexport class AsapQueue {\n // Use the fastest means possible to execute a task in its own turn, with\n // priority over other events including IO, animation, reflow, and redraw\n // events in browsers.\n //\n // An exception thrown by a task will permanently interrupt the processing of\n // subsequent tasks. The higher level `asap` function ensures that if an\n // exception is thrown by a task, that the task queue will continue flushing as\n // soon as possible, but if you use `rawAsap` directly, you are responsible to\n // either ensure that no exceptions are thrown from your task, or to manually\n // call `rawAsap.requestFlush` if an exception is thrown.\n enqueueTask(task) {\n const { queue: q , requestFlush } = this;\n if (!q.length) {\n requestFlush();\n this.flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n q[q.length] = task;\n }\n constructor(){\n this.queue = [];\n // We queue errors to ensure they are thrown in right order (FIFO).\n // Array-as-queue is good enough here, since we are just dealing with exceptions.\n this.pendingErrors = [];\n // Once a flush has been requested, no further calls to `requestFlush` are\n // necessary until the next `flush` completes.\n // @ts-ignore\n this.flushing = false;\n // The position of the next task to execute in the task queue. This is\n // preserved between calls to `flush` so that it can be resumed if\n // a task throws an exception.\n this.index = 0;\n // If a task schedules additional tasks recursively, the task queue can grow\n // unbounded. To prevent memory exhaustion, the task queue will periodically\n // truncate already-completed tasks.\n this.capacity = 1024;\n // The flush function processes all tasks that have been scheduled with\n // `rawAsap` unless and until one of those tasks throws an exception.\n // If a task throws an exception, `flush` ensures that its state will remain\n // consistent and will resume where it left off when called again.\n // However, `flush` does not make any arrangements to be called again if an\n // exception is thrown.\n this.flush = ()=>{\n const { queue: q } = this;\n while(this.index < q.length){\n const currentIndex = this.index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n this.index++;\n q[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (this.index > this.capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for(let scan = 0, newLength = q.length - this.index; scan < newLength; scan++){\n q[scan] = q[scan + this.index];\n }\n q.length -= this.index;\n this.index = 0;\n }\n }\n q.length = 0;\n this.index = 0;\n this.flushing = false;\n };\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n this.registerPendingError = (err)=>{\n this.pendingErrors.push(err);\n this.requestErrorThrow();\n };\n // `requestFlush` requests that the high priority event queue be flushed as\n // soon as possible.\n // This is useful to prevent an error thrown in a task from stalling the event\n // queue if the exception handled by Node.js’s\n // `process.on(\"uncaughtException\")` or by a domain.\n // `requestFlush` is implemented using a strategy based on data collected from\n // every available SauceLabs Selenium web driver worker at time of writing.\n // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n this.requestFlush = makeRequestCall(this.flush);\n this.requestErrorThrow = makeRequestCallFromTimer(()=>{\n // Throw first error\n if (this.pendingErrors.length) {\n throw this.pendingErrors.shift();\n }\n });\n }\n} // The message channel technique was discovered by Malte Ubl and was the\n // original foundation for this library.\n // http://www.nonblocking.io/2011/06/windownexttick.html\n // Safari 6.0.5 (at least) intermittently fails to create message ports on a\n // page's first load. Thankfully, this version of Safari supports\n // MutationObservers, so we don't need to fall back in that case.\n // function makeRequestCallFromMessageChannel(callback) {\n // var channel = new MessageChannel();\n // channel.port1.onmessage = callback;\n // return function requestCall() {\n // channel.port2.postMessage(0);\n // };\n // }\n // For reasons explained above, we are also unable to use `setImmediate`\n // under any circumstances.\n // Even if we were, there is another bug in Internet Explorer 10.\n // It is not sufficient to assign `setImmediate` to `requestFlush` because\n // `setImmediate` must be called *by name* and therefore must be wrapped in a\n // closure.\n // Never forget.\n // function makeRequestCallFromSetImmediate(callback) {\n // return function requestCall() {\n // setImmediate(callback);\n // };\n // }\n // Safari 6.0 has a problem where timers will get lost while the user is\n // scrolling. This problem does not impact ASAP because Safari 6.0 supports\n // mutation observers, so that implementation is used instead.\n // However, if we ever elect to use timers in Safari, the prevalent work-around\n // is to add a scroll event listener that calls for a flush.\n // `setTimeout` does not call the passed callback if the delay is less than\n // approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n // even then.\n // This is for `asap.js` only.\n // Its name will be periodically randomized to break any code that depends on\n // // its existence.\n // rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer\n // ASAP was originally a nextTick shim included in Q. This was factored out\n // into this ASAP package. It was later adapted to RSVP which made further\n // amendments. These decisions, particularly to marginalize MessageChannel and\n // to capture the MutationObserver implementation in a closure, were integrated\n // back into ASAP proper.\n // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n//# sourceMappingURL=AsapQueue.mjs.map","import { RawTask } from './RawTask.mjs';\nexport class TaskFactory {\n create(task) {\n const tasks = this.freeTasks;\n const t1 = tasks.length ? tasks.pop() : new RawTask(this.onError, (t)=>tasks[tasks.length] = t\n );\n t1.task = task;\n return t1;\n }\n constructor(onError){\n this.onError = onError;\n this.freeTasks = [];\n }\n}\n\n//# sourceMappingURL=TaskFactory.mjs.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { addSource as _addSource, addTarget as _addTarget, removeSource as _removeSource, removeTarget as _removeTarget } from '../actions/registry';\nimport { getNextUniqueId } from '../utils/getNextUniqueId';\nimport { HandlerRole } from '../interfaces';\nimport { validateSourceContract, validateTargetContract, validateType } from '../contracts';\nimport { asap } from '@react-dnd/asap';\n\nfunction getNextHandlerId(role) {\n var id = getNextUniqueId().toString();\n\n switch (role) {\n case HandlerRole.SOURCE:\n return \"S\".concat(id);\n\n case HandlerRole.TARGET:\n return \"T\".concat(id);\n\n default:\n throw new Error(\"Unknown Handler Role: \".concat(role));\n }\n}\n\nfunction parseRoleFromHandlerId(handlerId) {\n switch (handlerId[0]) {\n case 'S':\n return HandlerRole.SOURCE;\n\n case 'T':\n return HandlerRole.TARGET;\n\n default:\n invariant(false, \"Cannot parse handler ID: \".concat(handlerId));\n }\n}\n\nfunction mapContainsValue(map, searchValue) {\n var entries = map.entries();\n var isDone = false;\n\n do {\n var _entries$next = entries.next(),\n done = _entries$next.done,\n _entries$next$value = _slicedToArray(_entries$next.value, 2),\n value = _entries$next$value[1];\n\n if (value === searchValue) {\n return true;\n }\n\n isDone = !!done;\n } while (!isDone);\n\n return false;\n}\n\nexport var HandlerRegistryImpl = /*#__PURE__*/function () {\n function HandlerRegistryImpl(store) {\n _classCallCheck(this, HandlerRegistryImpl);\n\n this.types = new Map();\n this.dragSources = new Map();\n this.dropTargets = new Map();\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n this.store = store;\n }\n\n _createClass(HandlerRegistryImpl, [{\n key: \"addSource\",\n value: function addSource(type, source) {\n validateType(type);\n validateSourceContract(source);\n var sourceId = this.addHandler(HandlerRole.SOURCE, type, source);\n this.store.dispatch(_addSource(sourceId));\n return sourceId;\n }\n }, {\n key: \"addTarget\",\n value: function addTarget(type, target) {\n validateType(type, true);\n validateTargetContract(target);\n var targetId = this.addHandler(HandlerRole.TARGET, type, target);\n this.store.dispatch(_addTarget(targetId));\n return targetId;\n }\n }, {\n key: \"containsHandler\",\n value: function containsHandler(handler) {\n return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler);\n }\n }, {\n key: \"getSource\",\n value: function getSource(sourceId) {\n var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n var isPinned = includePinned && sourceId === this.pinnedSourceId;\n var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);\n return source;\n }\n }, {\n key: \"getTarget\",\n value: function getTarget(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.dropTargets.get(targetId);\n }\n }, {\n key: \"getSourceType\",\n value: function getSourceType(sourceId) {\n invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');\n return this.types.get(sourceId);\n }\n }, {\n key: \"getTargetType\",\n value: function getTargetType(targetId) {\n invariant(this.isTargetId(targetId), 'Expected a valid target ID.');\n return this.types.get(targetId);\n }\n }, {\n key: \"isSourceId\",\n value: function isSourceId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.SOURCE;\n }\n }, {\n key: \"isTargetId\",\n value: function isTargetId(handlerId) {\n var role = parseRoleFromHandlerId(handlerId);\n return role === HandlerRole.TARGET;\n }\n }, {\n key: \"removeSource\",\n value: function removeSource(sourceId) {\n var _this = this;\n\n invariant(this.getSource(sourceId), 'Expected an existing source.');\n this.store.dispatch(_removeSource(sourceId));\n asap(function () {\n _this.dragSources.delete(sourceId);\n\n _this.types.delete(sourceId);\n });\n }\n }, {\n key: \"removeTarget\",\n value: function removeTarget(targetId) {\n invariant(this.getTarget(targetId), 'Expected an existing target.');\n this.store.dispatch(_removeTarget(targetId));\n this.dropTargets.delete(targetId);\n this.types.delete(targetId);\n }\n }, {\n key: \"pinSource\",\n value: function pinSource(sourceId) {\n var source = this.getSource(sourceId);\n invariant(source, 'Expected an existing source.');\n this.pinnedSourceId = sourceId;\n this.pinnedSource = source;\n }\n }, {\n key: \"unpinSource\",\n value: function unpinSource() {\n invariant(this.pinnedSource, 'No source is pinned at the time.');\n this.pinnedSourceId = null;\n this.pinnedSource = null;\n }\n }, {\n key: \"addHandler\",\n value: function addHandler(role, type, handler) {\n var id = getNextHandlerId(role);\n this.types.set(id, type);\n\n if (role === HandlerRole.SOURCE) {\n this.dragSources.set(id, handler);\n } else if (role === HandlerRole.TARGET) {\n this.dropTargets.set(id, handler);\n }\n\n return id;\n }\n }]);\n\n return HandlerRegistryImpl;\n}();","import { DragDropManagerImpl } from './classes/DragDropManagerImpl';\nimport { createStore } from 'redux';\nimport { reduce } from './reducers';\nimport { DragDropMonitorImpl } from './classes/DragDropMonitorImpl';\nimport { HandlerRegistryImpl } from './classes/HandlerRegistryImpl';\nexport function createDragDropManager(backendFactory) {\n var globalContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n var backendOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var debugMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var store = makeStoreInstance(debugMode);\n var monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store));\n var manager = new DragDropManagerImpl(store, monitor);\n var backend = backendFactory(manager, globalContext, backendOptions);\n manager.receiveBackend(backend);\n return manager;\n}\n\nfunction makeStoreInstance(debugMode) {\n // TODO: if we ever make a react-native version of this,\n // we'll need to consider how to pull off dev-tooling\n var reduxDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;\n return createStore(reduce, debugMode && reduxDevTools && reduxDevTools({\n name: 'dnd-core',\n instanceId: 'dnd-core'\n }));\n}","var _excluded = [\"children\"];\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, memo } from 'react';\nimport { createDragDropManager } from 'dnd-core';\nimport { DndContext } from './DndContext';\nvar refCount = 0;\nvar INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');\n/**\n * A React component that provides the React-DnD context\n */\n\nexport var DndProvider = memo(function DndProvider(_ref) {\n var children = _ref.children,\n props = _objectWithoutProperties(_ref, _excluded);\n\n var _getDndContextValue = getDndContextValue(props),\n _getDndContextValue2 = _slicedToArray(_getDndContextValue, 2),\n manager = _getDndContextValue2[0],\n isGlobalInstance = _getDndContextValue2[1]; // memoized from props\n\n /**\n * If the global context was used to store the DND context\n * then where theres no more references to it we should\n * clean it up to avoid memory leaks\n */\n\n\n useEffect(function () {\n if (isGlobalInstance) {\n var context = getGlobalContext();\n ++refCount;\n return function () {\n if (--refCount === 0) {\n context[INSTANCE_SYM] = null;\n }\n };\n }\n }, []);\n return _jsx(DndContext.Provider, Object.assign({\n value: manager\n }, {\n children: children\n }), void 0);\n});\n\nfunction getDndContextValue(props) {\n if ('manager' in props) {\n var _manager = {\n dragDropManager: props.manager\n };\n return [_manager, false];\n }\n\n var manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);\n var isGlobalInstance = !props.context;\n return [manager, isGlobalInstance];\n}\n\nfunction createSingletonDndContext(backend) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getGlobalContext();\n var options = arguments.length > 2 ? arguments[2] : undefined;\n var debugMode = arguments.length > 3 ? arguments[3] : undefined;\n var ctx = context;\n\n if (!ctx[INSTANCE_SYM]) {\n ctx[INSTANCE_SYM] = {\n dragDropManager: createDragDropManager(backend, context, options, debugMode)\n };\n }\n\n return ctx[INSTANCE_SYM];\n}\n\nfunction getGlobalContext() {\n return typeof global !== 'undefined' ? global : window;\n}","import { t } from \"../i18n\";\nimport React, { useState, useEffect, useRef, useMemo } from \"react\";\nimport { DndProvider } from \"react-dnd\";\nimport { DndBackend } from \"./DndBackend\";\n\nimport Editor from \"../Editor\";\nimport Block from \"../Block\";\nimport BlockItem from \"./BlockItem\";\nimport {\n EditorContext,\n BlocksContext,\n EditorContextProps,\n BlocksContextProps,\n} from \"../Context\";\nimport AddButton from \"./AddButton\";\nimport { getBlocksByRange, isPassThroughNativeEvent } from \"../util\";\nimport { BlockEditorCommandEvent } from \"../CommandManager\";\n\ndeclare global {\n interface WindowEventMap {\n \"mt-block-editor-command\": BlockEditorCommandEvent;\n \"mt-block-editor-click-block\": CustomEvent;\n }\n}\n\ninterface AppProps {\n editor: Editor;\n}\n\nfunction arrayEquals(a: T[], b: T[]): boolean {\n if (a === b) {\n return true;\n }\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0, len = a.length; i < len; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nconst App: React.FC = ({ editor }: AppProps) => {\n const [_focusedIds, _setFocusedIds] = useState([]);\n const focusedIdsRef = useRef(_focusedIds);\n\n const editorContext = useMemo(\n () => ({\n editor: editor,\n setFocusedIds: (ids, opts?) => {\n const focusedIds = focusedIdsRef.current;\n if (\n focusedIds.length >= 2 &&\n ids.length === 1 &&\n focusedIds.includes(ids[0])\n ) {\n // do nothing\n return;\n }\n\n if (!opts?.forceUpdate && arrayEquals(focusedIds, ids)) {\n return;\n }\n\n focusedIdsRef.current = ids;\n _setFocusedIds(ids);\n },\n getFocusedIds: () => focusedIdsRef.current,\n }),\n []\n );\n const setFocusedIds = editorContext.setFocusedIds;\n\n const blocksContext = useMemo(\n () => ({\n panelBlockTypes: null,\n shortcutBlockTypes: null,\n addBlock: (b: Block, index: number | Block) => {\n if (index instanceof Block) {\n index = editor.blocks.indexOf(index) + 1;\n }\n editor.addBlock(editor, b, index);\n setFocusedIds([b.id]);\n },\n mergeBlock: (b: Block) => {\n const index = editor.blocks.indexOf(b);\n if (editor.mergeBlock(editor, b)) {\n setFocusedIds([editor.blocks[index - 1].id]);\n }\n },\n removeBlock: (b: Block) => {\n const index = editor.blocks.indexOf(b);\n editor.removeBlock(editor, b);\n if (index > 0) {\n setFocusedIds([editor.blocks[index - 1].id]);\n }\n },\n swapBlocks: (dragIndex: number, hoverIndex: number, scroll?: boolean) => {\n if (\n dragIndex === undefined ||\n hoverIndex === undefined ||\n !editor.blocks[dragIndex] ||\n !editor.blocks[hoverIndex]\n ) {\n return;\n }\n\n if (scroll) {\n const destEl = editor.blocks[hoverIndex].wrapperRef.current;\n if (!destEl) {\n return;\n }\n\n const rect = destEl.getBoundingClientRect();\n const scrollTop =\n window.pageYOffset || document.documentElement.scrollTop;\n const offsetTop = rect.height;\n\n window.scrollTo({\n top: scrollTop + (dragIndex > hoverIndex ? -offsetTop : offsetTop),\n behavior: \"smooth\",\n });\n }\n\n editor.swapBlocks(editor, dragIndex, hoverIndex);\n },\n }),\n []\n );\n\n useEffect(() => {\n const onWindowClick = (ev: Event): void => {\n if (document.querySelector(\".mt-be-overlay\")) {\n return;\n }\n\n const editorEl = editor.editorElement;\n\n if (editorEl.querySelector(`[data-mt-block-editor-keep-focus=\"1\"]`)) {\n return;\n }\n\n let target = ev.target as HTMLElement;\n\n while (target.parentNode && target.parentNode !== target) {\n if (target.classList.contains(\"mce-container\")) {\n return;\n }\n if (target === editorEl) {\n if (focusedIdsRef.current.length === 0) {\n setFocusedIds([\"editor\"]);\n }\n return;\n }\n target = target.parentNode as HTMLElement;\n }\n\n setFocusedIds([]);\n };\n\n const onWindowKeydown = (ev: KeyboardEvent): void => {\n const editorEl = editor.editorElement;\n const focusedIds = focusedIdsRef.current;\n\n if (focusedIds.length === 0) {\n return;\n }\n\n if (!(ev.ctrlKey || ev.metaKey || ev.altKey || ev.shiftKey)) {\n return;\n }\n\n // stay focused but not edit\n if (\n isPassThroughNativeEvent(ev) ||\n editorEl.querySelector(`[data-mt-block-editor-keep-focus=\"1\"]`)\n ) {\n return;\n }\n\n const key = ev.key;\n\n if (key === \"z\" && (ev.ctrlKey || ev.metaKey) && !ev.shiftKey) {\n ev.preventDefault();\n ev.stopPropagation();\n ev.stopImmediatePropagation();\n editor.editManager.undo({\n editor,\n getFocusedIds: () => focusedIds,\n setFocusedIds,\n });\n } else if (\n (key === \"z\" && (ev.ctrlKey || ev.metaKey) && ev.shiftKey) ||\n (key === \"y\" && (ev.ctrlKey || ev.metaKey))\n ) {\n ev.preventDefault();\n ev.stopPropagation();\n ev.stopImmediatePropagation();\n editor.editManager.redo({\n editor,\n getFocusedIds: () => focusedIds,\n setFocusedIds,\n });\n }\n };\n\n let startId = \"\";\n const onEditorMousedown = (ev: MouseEvent): void => {\n if (ev.target instanceof HTMLElement) {\n startId =\n ev.target.closest(\"[data-mt-block-editor-block-id]\")\n ?.dataset.mtBlockEditorBlockId || \"\";\n }\n };\n\n const onEditorMouseup = (ev: MouseEvent): void => {\n if (ev.target instanceof HTMLElement) {\n const endId =\n ev.target.closest(\"[data-mt-block-editor-block-id]\")\n ?.dataset.mtBlockEditorBlockId || \"\";\n if (startId && endId && startId !== endId) {\n setFocusedIds(\n getBlocksByRange(editor, [startId, endId]).map((b) => b.id)\n );\n\n ev.preventDefault();\n ev.stopPropagation();\n }\n }\n\n startId = \"\";\n };\n\n const onBlockEditorCommand = (ev: BlockEditorCommandEvent): void => {\n editor.commandManager.execute({\n ...ev.detail,\n event: ev,\n });\n };\n\n editor.editorElement.addEventListener(\"mousedown\", onEditorMousedown);\n editor.editorElement.addEventListener(\"mouseup\", onEditorMouseup);\n\n window.addEventListener(\"click\", onWindowClick, {\n capture: true,\n passive: true,\n });\n\n window.addEventListener(\"keydown\", onWindowKeydown);\n window.addEventListener(\"mt-block-editor-command\", onBlockEditorCommand);\n\n return () => {\n editor.editorElement.removeEventListener(\"mousedown\", onEditorMousedown);\n editor.editorElement.removeEventListener(\"mouseup\", onEditorMouseup);\n window.removeEventListener(\"click\", onWindowClick, {\n capture: true,\n });\n window.removeEventListener(\"keydown\", onWindowKeydown);\n window.removeEventListener(\n \"mt-block-editor-command\",\n onBlockEditorCommand\n );\n };\n }, []);\n\n return (\n \n \n \n
\n {editor.blocks.map((b, i) => {\n return (\n \n );\n })}\n {editor.opts.addButtons[\"bottom\"] && (\n
\n \n
\n )}\n
\n
\n
\n
\n );\n};\n\nexport default App;\n","import Block from \"./Block\";\n\nclass BlockFactory {\n public static allTypes: Array = [];\n\n public static registerType(t: typeof Block): void {\n this.allTypes.push(t);\n }\n\n public static deregisterType(t: typeof Block | string): void {\n this.allTypes = this.allTypes.filter((registered) =>\n typeof t === \"string\" ? registered.typeId === t : registered !== t\n );\n }\n\n public types(): Array {\n return BlockFactory.allTypes;\n }\n\n public selectableTypes(): Array {\n return BlockFactory.allTypes.filter((t) => t.selectable);\n }\n\n public lookupType(typeId: string): typeof Block {\n const t = BlockFactory.allTypes.find((t) => t.typeId === typeId);\n\n if (!t) {\n throw `Unknown typeId: ${typeId}`;\n }\n\n return t;\n }\n}\n\nexport default BlockFactory;\n","import Editor from \"./Editor\";\nimport Block from \"./Block\";\nimport { EditorContextProps } from \"./Context\";\n\nconst DEFAULT_LIMIT = 100;\nconst NO_GROUP = undefined;\n\nexport interface EditHistoryHandlers {\n id: symbol;\n merge?: (a: EditHistory, b: EditHistory) => EditHistory | undefined | null;\n undo: (history: EditHistory, props: EditorContextProps) => void;\n redo: (history: EditHistory, props: EditorContextProps) => void;\n}\n\nexport interface EditHistory {\n block: Block;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n group?: number | undefined;\n handlers: EditHistoryHandlers;\n}\n\nclass EditManager {\n private editor: Editor | null = null;\n private limit = DEFAULT_LIMIT;\n private index = 0;\n private ignore = false;\n private histories: EditHistory[] = [];\n private group: number | undefined = NO_GROUP;\n\n public constructor(init: {\n editor: EditManager[\"editor\"];\n limit?: EditManager[\"limit\"];\n }) {\n Object.assign(this, init);\n }\n\n public unload(): void {\n this.editor = null;\n this.histories = [];\n }\n\n public canUndo(): boolean {\n return this.histories.length !== 0 && this.histories.length > this.index;\n }\n\n public canRedo(): boolean {\n return this.index !== 0;\n }\n\n public add(history: EditHistory): void {\n if (this.ignore) {\n return;\n }\n\n this._add(history);\n\n if (this.group === NO_GROUP) {\n this.emitChange();\n }\n }\n\n private _add(history: EditHistory): void {\n if (this.index !== 0) {\n this.histories.splice(-this.index, this.index);\n }\n this.index = 0;\n\n if (this.group !== NO_GROUP && !history.group) {\n history.group = this.group;\n }\n\n if (history.handlers.merge) {\n const last = this.histories[this.histories.length - 1];\n if (\n last &&\n last.group === history.group &&\n last.handlers.id === history.handlers.id\n ) {\n const merged = history.handlers.merge.call(undefined, last, history);\n if (merged) {\n this.histories[this.histories.length - 1] = merged;\n return;\n }\n }\n }\n\n this.histories.push(history);\n\n if (this.histories.length > this.limit) {\n const count = this.histories.length - this.limit;\n this.histories.splice(0, count);\n }\n }\n\n public undo(props: EditorContextProps, group?: number): void {\n const history = this.histories[this.histories.length - this.index - 1];\n if (!history || (group !== undefined && group !== history.group)) {\n if (group !== undefined) {\n this.emitChange();\n }\n return;\n }\n\n this.index++;\n\n this.ignore = true;\n history.handlers.undo.call(undefined, history, props);\n this.ignore = false;\n\n if (history.group === NO_GROUP) {\n this.emitChange();\n } else {\n this.undo(props, history.group);\n }\n }\n\n public redo(props: EditorContextProps, group?: number): void {\n const history = this.histories[this.histories.length - this.index];\n if (!history || (group !== undefined && group !== history.group)) {\n if (group !== undefined) {\n this.emitChange();\n }\n return;\n }\n\n this.index--;\n this.ignore = true;\n history.handlers.redo.call(undefined, history, props);\n this.ignore = false;\n\n if (history.group === NO_GROUP) {\n this.emitChange();\n } else {\n this.redo(props, history.group);\n }\n }\n\n public generateGroup(): number {\n return Math.round(Math.random() * 100000);\n }\n\n public beginGrouping(): void {\n this.group = this.generateGroup();\n }\n\n public endGrouping(): void {\n if (this.group === NO_GROUP) {\n return;\n }\n\n const last = this.histories[this.histories.length - 1];\n if (last && last.group === this.group) {\n this.emitChange();\n }\n\n this.group = NO_GROUP;\n }\n\n private emitChange(): void {\n if (this.editor) {\n this.editor.emit(\"change\", { editor: this.editor });\n }\n }\n}\n\nexport default EditManager;\n","import { EditHistoryHandlers } from \"../EditManager\";\nimport Block from \"../Block\";\n\nexport const add: EditHistoryHandlers = {\n id: Symbol(\"add\"),\n undo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n const index = parent.blocks.indexOf(hist.block);\n editor.removeBlock(parent, hist.block);\n\n const nextFocusBlock =\n parent.blocks[Math.max(0, index - 1)] ||\n (parent instanceof Block ? parent : null);\n\n setFocusedIds([nextFocusBlock?.id ?? \"editor\"]);\n },\n redo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n editor.addBlock(parent, hist.block, hist.data.index);\n setFocusedIds([hist.block.id]);\n\n // You need to force a re-render to see the block\n if (parent.blocks.length === 1) {\n editor.render();\n }\n },\n};\n\nexport const remove: EditHistoryHandlers = {\n id: Symbol(\"remove\"),\n undo(hist, { editor, setFocusedIds }) {\n editor.addBlock(hist.data.parent || editor, hist.block, hist.data.index);\n setFocusedIds([hist.block.id], { forceUpdate: true });\n },\n redo(hist, { editor, setFocusedIds }) {\n const parent = hist.data.parent || editor;\n const index = parent.blocks.indexOf(hist.block);\n editor.removeBlock(parent, hist.block);\n if (index > 0) {\n setFocusedIds([parent.blocks[index - 1].id]);\n }\n },\n};\n\nexport const swap: EditHistoryHandlers = {\n id: Symbol(\"swap\"),\n undo(hist, { editor }) {\n editor.swapBlocks(hist.data.parent || editor, hist.data.a, hist.data.b);\n },\n redo(hist, { editor }) {\n editor.swapBlocks(hist.data.parent || editor, hist.data.a, hist.data.b);\n },\n};\n","import React, { ReactNode, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { CSSTransition } from \"react-transition-group\";\n\nconst OVERLAY_CLASS_NAME = \"mt-be-overlay\";\nconst PORTAL_STYLE = { position: \"relative\", zIndex: 1000 };\nexport const TRANSITION_TIMEOUT = 300;\n\ninterface OverlayProps {\n open: boolean;\n onClose?: () => void;\n children?: ReactNode;\n}\n\nconst Overlay: React.FC = ({\n open,\n onClose = () => null,\n children,\n}: OverlayProps) => {\n const [portal] = useState(() =>\n document.createElement(\"div\")\n );\n\n useEffect(() => {\n Object.assign(portal.style, PORTAL_STYLE);\n portal.classList.add(\"mt-block-editor\");\n document.body.appendChild(portal);\n return () => portal.remove();\n }, []);\n\n useEffect(() => {\n if (!open) {\n return;\n }\n\n function onKeydown(ev: KeyboardEvent): void {\n if (ev.key === \"Escape\") {\n onClose();\n }\n }\n\n document.addEventListener(\"keydown\", onKeydown);\n return () => document.removeEventListener(\"keydown\", onKeydown);\n }, [open]);\n\n return createPortal(\n \n document.body.classList.add(\"mt-block-editor-overlay-open\")\n }\n onExit={() =>\n document.body.classList.remove(\"mt-block-editor-overlay-open\")\n }\n classNames={OVERLAY_CLASS_NAME}\n unmountOnExit\n timeout={TRANSITION_TIMEOUT}\n >\n
{children}
\n ,\n portal\n );\n};\n\nexport default Overlay;\n","import { t } from \"../i18n\";\nimport React, {\n ReactNode,\n useRef,\n useEffect,\n createContext,\n useContext,\n} from \"react\";\nimport Overlay, { TRANSITION_TIMEOUT } from \"./Overlay\";\n\nexport interface DialogProps {\n children?: ReactNode;\n open: boolean;\n onClose?: () => void;\n id?: string;\n className?: string;\n}\ntype DialogContextProps = Pick;\n\nconst DialogContext = createContext({});\nexport const Dialog: React.FC = (props: DialogProps) => {\n const modalRef = useRef(null);\n const className = `mt-be-dialog ${props.className || \"\"}`;\n\n useEffect(() => {\n if (!props.open) {\n return;\n }\n\n const modalEl = modalRef.current;\n if (!modalEl) {\n return;\n }\n\n const focusEl = modalEl.querySelector(\n `[data-mt-block-editor-focus-default]`\n );\n if (!focusEl) {\n return;\n }\n\n setTimeout(() => {\n focusEl.focus();\n }, TRANSITION_TIMEOUT);\n }, [props.open]);\n\n return (\n \n \n
\n
{props.children}
\n
\n
\n
\n );\n};\n\nexport const DialogHeader: React.FC = (props: { children?: ReactNode }) => {\n const { onClose = () => null } = useContext(DialogContext);\n return (\n
\n {props.children}\n \n ×\n \n
\n );\n};\n\nexport const DialogBody: React.FC = (props: { children?: ReactNode }) => (\n
{props.children}
\n);\n\nexport const DialogFooter: React.FC = (props: { children?: ReactNode }) => (\n
{props.children}
\n);\n\nexport default Dialog;\n","import { t } from \"../i18n\";\nimport React, { useState, useRef } from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { nl2br } from \"../util\";\nimport { blockProperty } from \"../decorator\";\nimport icon from \"../img/icon/image.svg\";\nimport iconLink from \"../img/icon/link.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\nimport BlockToolbar from \"../Component/BlockToolbar\";\nimport BlockToolbarButton from \"../Component/BlockToolbarButton\";\nimport {\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n} from \"../Component/Dialog\";\nimport { useCommands } from \"../CommandManager\";\n\ninterface EditorProps {\n block: Image;\n}\n\nconst Html: React.FC = ({ block }: EditorProps) => {\n let img = {block.alt};\n if (block.linkUrl) {\n img = (\n \n {img}\n
\n );\n }\n\n return block.caption ? (\n
\n {img}\n
{nl2br(block.caption)}
\n
\n ) : (\n

{img}

\n );\n};\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => {\n const [isLinkDialogOpen, setLinkDialogOpen] = useState(false);\n const formRef = useRef(null);\n\n useCommands(\n {\n block,\n commands: [\n {\n command: \"core-insertLink\",\n callback: () => {\n setLinkDialogOpen(true);\n },\n },\n ],\n },\n []\n );\n\n return (\n <>\n \n setLinkDialogOpen(true)}\n />\n \n setLinkDialogOpen(false)}\n >\n \n

{t(\"Insert Link\")}

\n
\n
\n \n \n \n \n \n\n \n {\n setLinkDialogOpen(false);\n }}\n >\n {t(\"Close\")}\n \n {\n const form = formRef.current;\n if (!form) {\n return;\n }\n\n const keys = [\"linkUrl\", \"linkTitle\", \"linkTarget\"] as const;\n keys.forEach((name) => {\n block[name] =\n form.querySelector(\n `[data-property-name=\"${name}\"]`\n )?.value || \"\";\n });\n\n setLinkDialogOpen(false);\n }}\n >\n {t(\"Save\")}\n \n \n \n \n \n \n \n \n \n \n \n \n );\n }\n);\n\nclass Image extends Block {\n public static typeId = \"core-image\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Image\");\n }\n\n public url = \"\";\n public alt = \"\";\n public caption = \"\";\n public linkUrl = \"\";\n public linkTarget = \"_self\";\n public linkTitle = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n return focus || focusBlock ? (\n \n ) : (\n this.html()\n );\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public static canNewFromFile(): boolean {\n return true;\n }\n\n public static async newFromFile({ file }: { file: File }): Promise {\n return new Image({\n url: URL.createObjectURL(file),\n });\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(html, \"text/html\");\n\n return new Image(\n Object.assign(\n {\n url: (doc.querySelector(\"IMG\") as HTMLImageElement).src || \"\",\n className:\n (doc.querySelector(\"IMG\") as HTMLImageElement).className || \"\",\n alt: (doc.querySelector(\"IMG\") as HTMLImageElement).alt || \"\",\n caption:\n (doc.querySelector(\"FIGCAPTION\") &&\n (\n doc.querySelector(\"FIGCAPTION\") as HTMLElement\n ).innerHTML.replace(/]*>/g, \"\\n\")) ||\n \"\",\n },\n meta\n )\n );\n }\n}\n\nexport default Image;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { sanitize } from \"../util\";\nimport { blockProperty } from \"../decorator\";\nimport icon from \"../img/icon/file.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\n\ninterface HtmlProps {\n block: File;\n}\ninterface EditorProps extends EditorOptions {\n block: File;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n \n
\n )\n);\n\nconst Html: React.FC = ({ block }: HtmlProps) => (\n <>\n {block.text}\n \n);\n\nclass File extends Block {\n public static typeId = \"core-file\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"File\");\n }\n\n public text = \"\";\n public url = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus }: EditorOptions): JSX.Element {\n return focus ? (\n \n ) : (\n \n );\n }\n\n public html(): JSX.Element {\n return ;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n const domparser = new DOMParser();\n const doc = domparser.parseFromString(html, \"text/html\");\n\n return new File(\n Object.assign(\n {\n url: (doc.querySelector(\"A\") as HTMLAnchorElement).href || \"\",\n text: (doc.querySelector(\"A\") as HTMLAnchorElement).textContent || \"\",\n },\n meta\n )\n );\n }\n}\n\nexport default File;\n","import { t } from \"../i18n\";\nimport React, { useEffect, CSSProperties } from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport {\n sanitize,\n getShadowDomSelectorSet,\n isPassThroughNativeEvent,\n} from \"../util\";\nimport type {\n Editor as TinyMCEEditor,\n TinyMCE,\n RawEditorOptions as TinyMCESettings,\n} from \"tinymce\";\nimport { useBlocksContext, useEditorContext } from \"../Context\";\nimport icon from \"../img/icon/table.svg\";\nimport EditorMode from \"../Component/EditorMode\";\nimport BlockToolbar from \"../Component/BlockToolbar\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\nimport BlockContentEditablePreview, {\n HasEditorStyle,\n} from \"../Component/BlockContentEditablePreview\";\nimport { editHandlers } from \"./Text/edit\";\nimport {\n installPlugins as installTinyMCEPlugins,\n commonSettings,\n getTinymceMajorVersion,\n} from \"./Text/tinymce\";\n\nimport {\n HasTinyMCE,\n tinymceFocus,\n removeTinyMCEFromBlock,\n adjustToolbar,\n} from \"./Text/util\";\n\ndeclare const tinymce: TinyMCE;\n\ninterface EditorProps extends Omit {\n block: Table;\n}\n\nconst Editor: React.FC = ({ block }: EditorProps) => {\n const blocksContext = useBlocksContext();\n const editorContext = useEditorContext();\n const { editor } = editorContext;\n const { addBlock } = useBlocksContext();\n\n const selectorSet = getShadowDomSelectorSet(block.id);\n\n useEffect(() => {\n installTinyMCEPlugins();\n\n const pluginsSettings: TinyMCESettings =\n getTinymceMajorVersion() >= 6\n ? {\n plugins: [\"table\", \"code\", \"media\", \"link\", \"MTBlockEditor\"],\n }\n : {\n plugins: \"table code paste media textcolor link MTBlockEditor\",\n };\n\n const settings: TinyMCESettings = {\n ...commonSettings(editor, block, editorContext, blocksContext),\n ...pluginsSettings,\n toolbar:\n \"table | bold italic underline strikethrough forecolor backcolor removeformat | alignleft aligncenter alignright | link unlink | code\",\n init_instance_callback: (ed: TinyMCEEditor) => {\n block.tinymce = ed;\n\n ed.setContent(block.text);\n tinymceFocus(ed, selectorSet);\n\n const root = ed.dom.getRoot();\n\n // XXX: disable undo feature focefully\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ed.undoManager.add = (): any => {\n // XXX: improve performance\n if (getTinymceMajorVersion() >= 6) {\n ed.dispatch(\"Change\");\n } else {\n ed.fire(\"Change\");\n }\n return null;\n };\n\n let last = block.text;\n ed.on(\"MTBlockEditorEdit\", (ev) => {\n ed.dom.setHTML(ed.getBody(), ev.html);\n last = ev.html;\n });\n\n const addEdit = (): void => {\n const cur = ed.getContent();\n if (last === cur) {\n return;\n }\n\n editor.editManager.add({\n block,\n data: {\n last,\n },\n handlers: editHandlers,\n });\n\n last = cur;\n };\n\n ed.on(\"NodeChange Change\", (ev) => {\n if (root.childNodes.length <= 1) {\n addEdit();\n return;\n }\n\n if (ev.type === \"change\") {\n return;\n }\n\n let children = [...root.childNodes] as HTMLElement[];\n\n children = children\n .filter((c) => !c.classList.contains(\"mce-pastebin\"))\n .map((c) => {\n if (c.tagName === \"TABLE\") {\n return c;\n } else {\n const grandChildren: HTMLElement[] = [];\n\n [...c.querySelectorAll(\"TABLE\")].forEach((t) => {\n if ((t.parentElement as HTMLElement).closest(\"TABLE\")) {\n // nest\n return;\n }\n\n root.insertBefore(t, c);\n grandChildren.push(t as HTMLElement);\n });\n ed.dom.remove(c);\n\n return grandChildren;\n }\n })\n .flat() as HTMLElement[];\n\n if (children.length === 1) {\n addEdit();\n return;\n }\n\n children.shift();\n children.reverse();\n children.forEach((c) => {\n ed.dom.remove(c);\n });\n\n editor.editManager.beginGrouping();\n\n addEdit();\n\n children.forEach((c) => {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n addBlock(new Table({ text: c.outerHTML }), block);\n });\n\n editor.editManager.endGrouping();\n });\n\n adjustToolbar(ed, block, editor.editorElement);\n },\n };\n\n editor.emit(\"buildTinyMCESettings\", {\n editor,\n block,\n settings,\n });\n tinymce.init(settings);\n\n return () => {\n removeTinyMCEFromBlock(block);\n };\n }, []);\n\n const isInSetupMode = editor.opts.mode === \"setup\";\n\n return (\n
\n \n \n
\n \n {\n if (isPassThroughNativeEvent(ev.nativeEvent)) {\n return;\n }\n\n ev.preventDefault();\n }}\n >\n \n );\n};\n\nclass Table extends Block implements HasTinyMCE, HasEditorStyle {\n public static typeId = \"core-table\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Table\");\n }\n\n public text = \"\";\n public tinymce: TinyMCEEditor | null = null;\n public editorStyle: CSSProperties = {};\n\n public constructor(init?: Partial
) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public focusEditor(): void {\n if (this.tinymce) {\n this.tinymce.focus(false);\n }\n }\n\n public tinymceId(): string {\n return `textarea-${this.id}`;\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n if (focus) {\n return ;\n }\n\n if (focusBlock || this.htmlString()) {\n const preview = (\n \n );\n return (\n <>\n \n {preview}\n \n {preview}\n \n );\n } else {\n return this.placeholder();\n }\n }\n\n public html(): string {\n if (this.tinymce) {\n try {\n return this.tinymce.getContent();\n } catch (e) {\n console.log(e);\n }\n }\n return this.text;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Table(Object.assign({ text: html }, meta));\n }\n}\n\nexport default Table;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block from \"../Block\";\nimport icon from \"../img/icon/horizontalrule.svg\";\n\nconst Editor: React.FC = () => {\n return
;\n};\n\nclass Horizontalrule extends Block {\n public static typeId = \"core-horizontalrule\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"Horizontal Rule\");\n }\n\n public editor(): JSX.Element {\n return ;\n }\n\n public html(): JSX.Element {\n return
;\n }\n\n public static async newFromHtml(): Promise {\n return new Horizontalrule();\n }\n}\n\nexport default Horizontalrule;\n","import { t } from \"../i18n\";\nimport React from \"react\";\nimport Block, { NewFromHtmlOptions, EditorOptions } from \"../Block\";\nimport { blockProperty } from \"../decorator\";\nimport BlockIframePreview from \"../Component/BlockIframePreview\";\nimport icon from \"../img/icon/html.svg\";\nimport BlockSetupCommon from \"../Component/BlockSetupCommon\";\nimport BlockLabel from \"../Component/BlockLabel\";\n\ninterface EditorProps {\n block: Html;\n}\n\nconst Editor: React.FC = blockProperty(\n ({ block }: EditorProps) => (\n
\n \n \n \n \n
\n )\n);\n\nclass Html extends Block {\n public static typeId = \"core-html\";\n public static selectable = true;\n public static icon = icon;\n public static get label(): string {\n return t(\"HTML\");\n }\n\n public text = \"\";\n\n public constructor(init?: Partial) {\n super();\n if (init) {\n Object.assign(this, init);\n }\n }\n\n public editor({ focus, focusBlock }: EditorOptions): JSX.Element {\n return focus || focusBlock ? (\n \n ) : (\n \n );\n }\n\n public html(): string {\n return this.text;\n }\n\n public static async newFromHtml({\n html,\n meta,\n }: NewFromHtmlOptions): Promise {\n return new Html(\n Object.assign(\n {\n text: html,\n },\n meta\n )\n );\n }\n}\n\nexport default Html;\n","import BlockFactory from \"./BlockFactory\";\n\nimport Text from \"./Block/Text\";\nimport Image from \"./Block/Image\";\nimport File from \"./Block/File\";\nimport Table from \"./Block/Table\";\nimport Horizontalrule from \"./Block/Horizontalrule\";\nimport Html from \"./Block/Html\";\nimport Columns from \"./Block/Columns\";\nimport Column from \"./Block/Column\";\n\nBlockFactory.registerType(Text);\nBlockFactory.registerType(Image);\nBlockFactory.registerType(File);\nBlockFactory.registerType(Table);\nBlockFactory.registerType(Horizontalrule);\nBlockFactory.registerType(Html);\nBlockFactory.registerType(Columns);\nBlockFactory.registerType(Column);\n","import { t } from \"../i18n\";\nimport icon from \"../img/copy.svg\";\nimport type { Command } from \"../CommandManager\";\nimport { tinymceFocus } from \"../Block/Text/util\";\nimport Text from \"../Block/Text\";\nimport Table from \"../Block/Table\";\n\nconst isTextSelected = (): boolean => {\n // Some content is selected in the HTMLElement or Text.\n // In Firefox, even if text in HTMLInputElement is selected, the value cannot be retrieved.\n const selection = window.getSelection();\n if (selection && (!selection.isCollapsed || selection.toString() !== \"\")) {\n return true;\n }\n\n // In Firefox, look for the selected text in document.activeElement.\n const element = document.activeElement;\n if (\n (element instanceof HTMLInputElement ||\n element instanceof HTMLTextAreaElement) &&\n element.selectionStart !== element.selectionEnd\n ) {\n return true;\n }\n\n return false;\n};\n\nconst isClipboardAPIAvailable: () => boolean = () =>\n typeof navigator.clipboard?.write === \"function\" ||\n typeof navigator.clipboard?.writeText === \"function\";\n\nconst command: Command = {\n get label() {\n return t(\"Copy\");\n },\n icon,\n shortcut: \"cmd+c\",\n command: \"core-copyBlock\",\n condition: isClipboardAPIAvailable,\n callback: async ({ blocks, editorContext: { editor }, event }) => {\n if (!isClipboardAPIAvailable()) {\n return;\n }\n\n if (isTextSelected()) {\n // Prefer browser default behavior\n return;\n }\n\n if (blocks.length === 0) {\n return;\n }\n\n event.preventDefault();\n\n if (blocks.length === 1) {\n const block = blocks[0];\n block.wrapperRef.current?.classList.add(\"mt-be-focus\");\n setTimeout(() => {\n block.wrapperRef.current?.classList.remove(\"mt-be-focus\");\n }, 100);\n if ((block instanceof Text || block instanceof Table) && block.tinymce) {\n tinymceFocus(block.tinymce, null);\n }\n }\n\n let data = (\n await Promise.all(\n blocks.map((block) => block.toClipboardItem({ editor }))\n )\n ).reduce((acc, item) => {\n if (item instanceof Array) {\n acc ||= [];\n } else {\n acc ||= \"\";\n }\n\n if (acc instanceof Array && item instanceof Array) {\n return acc.concat(item);\n } else if (typeof acc === \"string\" && typeof item === \"string\") {\n return acc + item;\n }\n }, undefined);\n\n if (typeof data === \"string\" && typeof ClipboardItem === \"function\") {\n const htmlBlob = new Blob([data], { type: \"text/html\" });\n const plainBlob = new Blob([data], { type: \"text/plain\" });\n data = [\n new ClipboardItem({\n \"text/html\": htmlBlob,\n \"text/plain\": plainBlob,\n }),\n ];\n }\n\n if (data instanceof Array) {\n navigator.clipboard.write(data);\n } else if (typeof data === \"string\") {\n navigator.clipboard.writeText(data);\n }\n },\n};\n\nexport default command;\n","import { t } from \"../i18n\";\nimport icon from \"../img/duplicate.svg\";\nimport type { Command } from \"../CommandManager\";\nimport { parseContent, preParseContent, ParserContext } from \"../util\";\n\nconst command: Command = {\n get label() {\n return t(\"Duplicate\");\n },\n icon,\n shortcut: \"cmd+d\",\n command: \"core-duplicateBlock\",\n callback: async ({\n blocks,\n editorContext: { editor, setFocusedIds },\n blocksContext: { addBlock },\n event,\n }) => {\n if (blocks.length === 0) {\n return;\n }\n\n event?.preventDefault();\n\n const html = (\n await Promise.all(\n blocks.map((block) => block.serialize({ editor, external: true }))\n )\n ).join(\"\");\n\n const newBlocks = await parseContent(\n preParseContent(html),\n editor.factory,\n new ParserContext()\n );\n\n editor.editManager.beginGrouping();\n for (const newBlock of newBlocks.reverse()) {\n addBlock(newBlock, blocks[blocks.length - 1]);\n }\n editor.editManager.endGrouping();\n setFocusedIds([newBlocks[0].id]);\n\n editor.render();\n },\n};\n\nexport default command;\n","import { t } from \"../i18n\";\nimport { isTouchDevice } from \"../util\";\nimport icon from \"../img/remove.svg\";\nimport type { Command } from \"../CommandManager\";\n\nconst command: Command = {\n get label() {\n return t(\"Delete\");\n },\n icon,\n command: \"core-deleteBlock\",\n callback: ({ blocks, editorContext: { editor }, event }) => {\n event.preventDefault();\n\n if (isTouchDevice()) {\n if (!window.confirm(t(\"Are you sure you want to remove the block?\"))) {\n return;\n }\n }\n\n editor.editManager.beginGrouping();\n blocks.forEach((block) => editor.removeBlock(editor, block));\n editor.editManager.endGrouping();\n\n editor.render();\n },\n};\n\nexport default command;\n","import type { Command } from \"../CommandManager\";\n\nconst command: Command = {\n shortcut: \"cmd+k\",\n command: \"core-insertLink\",\n callback: ({\n blocks,\n editorContext: {\n editor: { commandManager },\n },\n event,\n }) => {\n event?.preventDefault();\n\n commandManager.emit(blocks, \"core-insertLink\");\n },\n};\n\nexport default command;\n","import EventEmitter from \"eventemitter3\";\nimport React from \"react\";\nimport { render } from \"react-dom\";\nimport { InitOptions as InitOptionsI18n } from \"i18next\";\n\nimport resetCss from \"./reset.css?raw\";\nimport editorContentCss from \"./editor-content.css?raw\";\nimport {\n getElementById,\n preParseContent,\n parseContent,\n escapeSingleQuoteAttribute,\n ParserContext,\n} from \"./util\";\nimport Block, { HasBlocks, DEFAULT_KEYS_FOR_SETUP } from \"./Block\";\nimport App from \"./Component/App\";\nimport BlockFactory from \"./BlockFactory\";\nimport EditManager from \"./EditManager\";\nimport CommandManager, { Command } from \"./CommandManager\";\nimport {\n add as editHandlersAdd,\n remove as editHandlersRemove,\n swap as editHandlersSwap,\n} from \"./Editor/edit\";\n\nimport \"./import-default-blocks\";\nimport \"./import-default-commands\";\n\nexport enum StylesheetType {\n url,\n css,\n}\n\ninterface Stylesheet {\n type: StylesheetType;\n data: string;\n}\n\ninterface Metadata {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport interface EditorOptions {\n id: string;\n mode: string;\n stylesheets: Array;\n rootClassName?: string;\n rootAttributes?: Record;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n addButtons: Metadata;\n editManager?: Partial;\n block: Metadata;\n i18n: InitOptionsI18n;\n}\n\ninterface MetadataMapData {\n id: string;\n blockIds: Set;\n}\n\nclass Editor extends EventEmitter implements HasBlocks {\n public id: string;\n public opts: EditorOptions;\n public factory: BlockFactory;\n public editManager: EditManager;\n public commandManager: CommandManager;\n public blocks: Block[] = [];\n public stylesheets: Stylesheet[] = [];\n public editorElement: HTMLElement;\n\n private inputElement: HTMLInputElement;\n private metadataMap: Map = new Map<\n string,\n MetadataMapData\n >();\n private metadataMapSequence = 1;\n private keyboardShortcutCache: Record = {};\n\n public constructor(opts: EditorOptions) {\n super();\n\n this.id = opts.id;\n this.opts = opts;\n opts.block = opts.block || {};\n opts.i18n = opts.i18n || {};\n opts.addButtons = opts.addButtons || { bottom: true };\n opts.rootClassName = opts.rootClassName || \"\";\n opts.rootAttributes = opts.rootAttributes || {};\n\n this.factory = new BlockFactory();\n this.editManager = new EditManager(\n Object.assign({ editor: this }, opts.editManager || {})\n );\n this.commandManager = new CommandManager({ editor: this });\n\n this.inputElement = getElementById(this.id) as HTMLInputElement;\n this.inputElement.style.display = \"none\";\n if (!this.inputElement.parentNode) {\n throw \"error\";\n }\n\n this.editorElement = document.createElement(\"div\");\n this.editorElement.setAttribute(\"data-mt-be-id\", this.id);\n this.editorElement.classList.add(\"mt-block-editor\");\n\n this.inputElement.parentNode.insertBefore(\n this.editorElement,\n this.inputElement\n );\n\n setTimeout(async () => {\n this.keyboardShortcutCache = await this.buildKeyboardShortcutCache();\n this.stylesheets = await Promise.all(this.buildStylesheets());\n const blocks = await parseContent(\n preParseContent(this.inputElement.value),\n this.factory,\n new ParserContext()\n );\n this.blocks = blocks;\n this.emit(\"initializeBlocks\", { editor: this, blocks });\n\n this.render();\n }, 0);\n }\n\n public selectableTypes(typeIds: string[]): Array {\n const types = this.factory.selectableTypes();\n return typeIds\n .map((typeId) => types.find((t) => t.typeId === typeId))\n .filter((t) => t) as Array;\n }\n\n public panelTypes(): Array {\n return this.opts.panelBlockTypes\n ? this.selectableTypes(this.opts.panelBlockTypes)\n : this.factory.selectableTypes();\n }\n\n public shortcutTypes(): Array {\n return this.opts.shortcutBlockTypes\n ? this.selectableTypes(this.opts.shortcutBlockTypes)\n : [];\n }\n\n public async buildKeyboardShortcutCache(): Promise> {\n const cache: Record = {};\n for (const command of await this.commandManager.commands()) {\n if (command.shortcut) {\n cache[command.shortcut] = command;\n }\n }\n return cache;\n }\n\n public keyboardShortcutMap(): Record {\n return this.keyboardShortcutCache;\n }\n\n public addBlock(parent: HasBlocks, block: Block, index: number): void {\n const blocks = parent.blocks;\n\n blocks.splice(index, 0, block);\n\n // XXX: Skip render by default\n // this.render();\n\n this.editManager.add({\n block: block,\n data: {\n parent: parent instanceof Editor ? null : parent,\n index,\n },\n handlers: editHandlersAdd,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks: blocks,\n });\n }\n\n public mergeBlock(parent: HasBlocks, block: Block): boolean {\n const blocks = parent.blocks;\n\n const index = blocks.indexOf(block);\n if (index === -1) {\n return false;\n }\n const before = blocks[index - 1];\n if (!before) {\n return false;\n }\n if (!before.canMerge(block)) {\n return false;\n }\n\n this.editManager.beginGrouping();\n\n this.editManager.add(before.merge(block));\n this.removeBlock(parent, block);\n\n this.editManager.endGrouping();\n\n return true;\n }\n\n public removeBlock(parent: HasBlocks, block: Block): void {\n const blocks = parent.blocks;\n\n this.emit(\"removeBlock\", {\n editor: this,\n blocks,\n block,\n });\n\n const index = blocks.indexOf(block);\n if (index === -1) {\n return;\n }\n\n blocks.splice(index, 1);\n this.render();\n\n this.editManager.add({\n block: block,\n data: {\n parent: parent instanceof Editor ? null : parent,\n index,\n },\n handlers: editHandlersRemove,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks,\n });\n }\n\n public swapBlocks(parent: HasBlocks, a: number, b: number): void {\n const blocks = parent.blocks;\n\n [blocks[a], blocks[b]] = [blocks[b], blocks[a]];\n this.render();\n\n this.editManager.add({\n block: blocks[a],\n data: {\n parent: parent instanceof Editor ? null : parent,\n a,\n b,\n },\n handlers: editHandlersSwap,\n });\n\n this.emit(\"changeBlocks\", {\n editor: this,\n blocks,\n });\n }\n\n public async serialize(): Promise {\n const blocks = this.blocks.concat();\n this.emit(\"serialize\", {\n editor: this,\n blocks,\n });\n\n const values = await Promise.all(\n blocks.map((b) => b.serialize({ editor: this, external: false }))\n );\n\n const metadataReverseMap: Metadata = {};\n this.metadataMap.forEach(({ id }, v) => {\n metadataReverseMap[id] = JSON.parse(v);\n });\n\n this.inputElement.value =\n (this.metadataMap.size > 0\n ? ``\n : \"\") + values.join(\"\");\n }\n\n private getMetadataMapIndexes(\n blockId: string,\n stringArray: string[]\n ): string[] {\n const targetMap: Record = {};\n stringArray.forEach((str) => {\n targetMap[str] = this.metadataMap.get(str);\n });\n\n const reusableIds = [];\n for (const [k, data] of this.metadataMap) {\n if (targetMap[k]) {\n continue;\n }\n\n if (data.blockIds.has(blockId)) {\n if (data.blockIds.size === 1) {\n this.metadataMap.delete(k);\n reusableIds.push(data.id);\n } else {\n data.blockIds.delete(blockId);\n }\n }\n }\n\n for (const str of Object.keys(targetMap)) {\n const data = (targetMap[str] ||= {\n id: reusableIds.shift() || (this.metadataMapSequence++).toString(36),\n blockIds: new Set(),\n });\n\n data.blockIds.add(blockId);\n if (!this.metadataMap.has(str)) {\n this.metadataMap.set(str, data);\n }\n }\n\n return Object.values(targetMap)\n .filter((td): td is MetadataMapData => !!td)\n .map((td) => td.id);\n }\n\n public serializeMeta(block: Block, external: boolean): string | null {\n const meta = block.metadata();\n if (!meta) {\n return null;\n }\n\n if (external) {\n return JSON.stringify(meta);\n }\n\n const metaSetup: Metadata = {};\n DEFAULT_KEYS_FOR_SETUP.concat(block.keysForSetup()).forEach((k) => {\n if (k in meta) {\n metaSetup[k] = meta[k];\n Reflect.deleteProperty(meta, k);\n }\n });\n\n const metaStrings = [metaSetup, meta]\n .map((m) => (Object.keys(m).length > 0 ? JSON.stringify(m) : null))\n .filter((s): s is string => !!s);\n\n return this.getMetadataMapIndexes(block.id, metaStrings).join(\",\");\n }\n\n public unload(): void {\n this.emit(\"beforeUnload\", {\n editor: this,\n });\n this.editManager.unload();\n this.editorElement.remove();\n this.inputElement.style.display = \"\";\n this.emit(\"unload\", {\n editor: this,\n });\n }\n\n public render(): void {\n render(React.createElement(App, { editor: this }), this.editorElement);\n }\n\n private buildStylesheets(): Array> {\n return [\n {\n type: StylesheetType.css,\n data: resetCss + editorContentCss,\n },\n ...this.opts.stylesheets\n .filter((s) => s)\n .map(async (s) => {\n if (/^blob:/.test(s)) {\n const res = await fetch(s);\n return {\n type: StylesheetType.css,\n data: await res.text(),\n };\n } else if (/^https?:/.test(s)) {\n return {\n type: StylesheetType.url,\n data: s,\n };\n } else {\n return {\n type: StylesheetType.css,\n data: s,\n };\n }\n }),\n ];\n }\n}\n\nexport default Editor;\n","import CommandManager from \"./CommandManager\";\n\nimport copyBlock from \"./commands/copyBlock\";\nimport pasteBlock from \"./commands/pasteBlock\";\nimport duplicateBlock from \"./commands/duplicateBlock\";\nimport deleteBlock from \"./commands/deleteBlock\";\nimport insertLink from \"./commands/insertLink\";\n\nCommandManager.registerCommand(copyBlock);\nCommandManager.registerCommand(pasteBlock);\nCommandManager.registerCommand(duplicateBlock);\nCommandManager.registerCommand(deleteBlock);\nCommandManager.registerCommand(insertLink);\n","import Editor from \"./Editor\";\n\nclass EditorManager {\n private static _instance: EditorManager;\n public editors: Editor[];\n\n public static instance(): EditorManager {\n this._instance = this._instance || new EditorManager();\n return this._instance;\n }\n\n public constructor() {\n this.editors = [];\n }\n\n public add(e: Editor): void {\n this.editors.push(e);\n }\n\n public get(id: string): Editor | undefined {\n return this.editors.find((e: Editor) => e.id === id);\n }\n\n public async remove(id: string): Promise {\n const e = this.get(id);\n if (!e) {\n return;\n }\n await e.serialize();\n e.unload();\n\n const index = this.editors.indexOf(e);\n if (index === -1) {\n return;\n }\n this.editors.splice(index, 1);\n }\n}\n\nexport default EditorManager;\n","/** @license\n# Movable Type Block Editor (C) 2020 Six Apart Ltd. All Rights Reserved.\n# This code cannot be redistributed without permission from www.sixapart.com.\n*/\n\nimport packageInfo from \"../package.json\";\nimport i18n, { init as initI18n } from \"./i18n\";\nimport { InitOptions as InitOptionsI18n } from \"i18next\";\nimport \"./mt-block-editor.scss\";\nimport Editor, { EditorOptions } from \"./Editor\";\nimport EditorManager from \"./EditorManager\";\n\nimport React from \"react\";\nimport Block from \"./Block\";\nimport Column from \"./Block/Column\";\nimport BlockFactory from \"./BlockFactory\";\n\nimport BlockIframePreview from \"./Component/BlockIframePreview\";\nimport BlockToolbar from \"./Component/BlockToolbar\";\nimport BlockToolbarButton from \"./Component/BlockToolbarButton\";\nimport BlockConfigPanel from \"./Component/BlockConfigPanel\";\nimport BlockSetup from \"./Component/BlockSetup\";\nimport BlockSetupCommon from \"./Component/BlockSetupCommon\";\nimport BlockLabel from \"./Component/BlockLabel\";\nimport EditorMode from \"./Component/EditorMode\";\nimport {\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n} from \"./Component/Dialog\";\n\nimport * as Context from \"./Context\";\nimport * as Hook from \"./Hook\";\nimport * as icon from \"./icon\";\nimport * as util from \"./util\";\nimport * as decorator from \"./decorator\";\n\nexport interface BoilerplateBlockOptions {\n typeId: string;\n className: string;\n rootBlock?: string | null;\n label: string;\n icon: string;\n iconString: string;\n html: string;\n canRemoveBlock: boolean;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n shouldBeCompiled: boolean;\n showPreview: boolean;\n previewHeader: string;\n}\n\ninterface BoilerplateBlockOverwrites {\n _html: string;\n canRemoveBlock?: boolean;\n panelBlockTypes?: string[];\n shortcutBlockTypes?: string[];\n previewHeader?: string;\n}\n\ninterface BoilerplateBlockInitOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport class EditorUtil {\n public static version = packageInfo.version;\n public static i18n = i18n;\n public static Component = {\n BlockIframePreview,\n BlockToolbar,\n BlockToolbarButton,\n BlockConfigPanel,\n BlockSetup,\n BlockSetupCommon,\n BlockLabel,\n EditorMode,\n Dialog,\n DialogHeader,\n DialogBody,\n DialogFooter,\n };\n public static decorator = decorator;\n public static React = React;\n public static Block = Block;\n public static Context = Context;\n public static Hook = Hook;\n public static icon = icon;\n public static util = util;\n\n public static async apply(opts: EditorOptions): Promise {\n const optsI18n: InitOptionsI18n = opts.i18n || {};\n await initI18n(optsI18n);\n\n const m = EditorManager.instance();\n const e = new Editor(opts as EditorOptions);\n m.add(e);\n\n return e;\n }\n\n public static get({ id }: { id: string }): Editor | undefined {\n const m = EditorManager.instance();\n return m.get(id);\n }\n\n public static async unload({ id }: { id: string }): Promise {\n const m = EditorManager.instance();\n await m.remove(id);\n }\n\n public static async serialize(): Promise {\n const m = EditorManager.instance();\n await Promise.all(m.editors.map((e) => e.serialize()));\n }\n\n public static registerBlockType(block: typeof Block): void {\n BlockFactory.registerType(block);\n }\n\n public static deregisterBlockType(block: typeof Block | string): void {\n BlockFactory.deregisterType(block);\n }\n\n public static createBoilerplateBlock({\n typeId,\n className,\n rootBlock,\n label,\n icon,\n iconString,\n html,\n canRemoveBlock,\n panelBlockTypes,\n shortcutBlockTypes,\n shouldBeCompiled,\n showPreview,\n previewHeader,\n }: BoilerplateBlockOptions): typeof Block {\n const BoilerplateBlock = function (\n this: Column,\n init: BoilerplateBlockInitOptions\n ): void {\n const overwrite: BoilerplateBlockOverwrites = {\n _html: html,\n };\n if (canRemoveBlock !== undefined) {\n overwrite.canRemoveBlock = !!canRemoveBlock;\n }\n if (panelBlockTypes) {\n overwrite.panelBlockTypes = panelBlockTypes;\n }\n if (shortcutBlockTypes) {\n overwrite.shortcutBlockTypes = shortcutBlockTypes;\n }\n if (previewHeader !== undefined) {\n overwrite.previewHeader = previewHeader;\n }\n\n return Reflect.construct(\n Column,\n [Object.assign(overwrite, init || {})],\n BoilerplateBlock\n );\n };\n\n BoilerplateBlock.prototype = Object.create(Column.prototype);\n BoilerplateBlock.prototype.constructor = BoilerplateBlock;\n BoilerplateBlock.typeId = typeId;\n BoilerplateBlock.className = className;\n BoilerplateBlock.label = label;\n if (rootBlock !== undefined) {\n BoilerplateBlock.rootBlock = rootBlock;\n }\n if (icon) {\n BoilerplateBlock.icon = icon;\n }\n if (iconString) {\n BoilerplateBlock.iconString = iconString;\n }\n BoilerplateBlock.selectable = true;\n if (shouldBeCompiled !== undefined) {\n BoilerplateBlock.shouldBeCompiled = shouldBeCompiled;\n }\n if (showPreview !== undefined) {\n BoilerplateBlock.showPreview = showPreview;\n }\n\n Object.setPrototypeOf(BoilerplateBlock, Column);\n\n return BoilerplateBlock as unknown as typeof Block;\n }\n\n public static isSupportedEnvironment(): boolean {\n if (/Trident|MSIE|Edge/.test(window.navigator.userAgent)) {\n return false;\n }\n\n return true;\n }\n}\n\ndeclare global {\n interface Window {\n MTBlockEditor: typeof EditorUtil;\n }\n}\n\nwindow.MTBlockEditor = EditorUtil;\n"],"sourceRoot":""} \ No newline at end of file diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/register-boilerplate-blocks.js b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/register-boilerplate-blocks.js similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/register-boilerplate-blocks.js rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/register-boilerplate-blocks.js diff --git a/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/register-boilerplate-blocks.js.map b/mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/register-boilerplate-blocks.js.map similarity index 100% rename from mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/register-boilerplate-blocks.js.map rename to mt-static/plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/register-boilerplate-blocks.js.map diff --git a/plugins/MTBlockEditor/config.yaml b/plugins/MTBlockEditor/config.yaml index 8885b5e..8252450 100644 --- a/plugins/MTBlockEditor/config.yaml +++ b/plugins/MTBlockEditor/config.yaml @@ -1,6 +1,6 @@ id: MTBlockEditor name: MTBlockEditor -version: 1.2.0 +version: 1.2.1 author_link: http://www.movabletype.org/ author_name: Six Apart Ltd. description: diff --git a/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/App/CMS.pm b/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/App/CMS.pm index f249855..5392a83 100644 --- a/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/App/CMS.pm +++ b/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/App/CMS.pm @@ -12,9 +12,13 @@ use MT::Util qw(encode_html); use Class::Method::Modifiers qw(install_modifier); use MT::Plugin::MTBlockEditor qw(plugin blocks to_custom_block_types_json tmpl_param); +my $Initialized; + sub init_app { my ($cb, $app) = @_; + return if $Initialized; + require MT::ContentFieldType::Common; install_modifier( 'MT::ContentFieldType::Common', @@ -56,6 +60,8 @@ sub init_app { $html; }); + + $Initialized = 1; } sub insert_after { diff --git a/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/L10N/en_us.pm b/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/L10N/en_us.pm index 7e1665f..44d32c6 100644 --- a/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/L10N/en_us.pm +++ b/plugins/MTBlockEditor/lib/MT/Plugin/MTBlockEditor/L10N/en_us.pm @@ -12,10 +12,37 @@ use warnings; use base 'MT::Plugin::MTBlockEditor::L10N'; use vars qw( %Lexicon ); +my $block_editor_plugin = eval { MT->component('BlockEditor') }; + %Lexicon = ( + "BLOCK_LABEL_CORE_TEXT" => "Text Block", + "BLOCK_LABEL_CORE_TABLE" => "Table", + "BLOCK_LABEL_CORE_HORIZONTALRULE" => "Horizontal Rule", + "BLOCK_LABEL_CORE_HTML" => "HTML", + "BLOCK_LABEL_CORE_COLUMNS" => "Columns", + "BLOCK_LABEL_MT_IMAGE" => "Image", + "BLOCK_LABEL_MT_FILE" => "File", + "BLOCK_LABEL_SIXAPART_OEMBED" => "oEmbed", + "BLOCK_LABEL_SIXAPART_INPUT" => "Text", + "BLOCK_LABEL_SIXAPART_TEXTAREA" => "Textarea", + "BLOCK_LABEL_SIXAPART_SELECT" => "Select", - '__TEXT_BLOCK__' => 'Text', + "Manage Custom Block Preset" => 'Manage Preset', + ( + $block_editor_plugin + ? ( + 'Movable Type Block Editor' => 'MT Block Editor', + 'Movable Type Block Editor Settings' => 'MT Block Editor Settings', + 'Preset For Movable Type Block Editor' => 'Preset For MT Block Editor', + ) + : ( + 'Movable Type Block Editor' => 'Block Editor', + 'Movable Type Block Editor Settings' => 'Block Editor Settings', + 'Preset For Movable Type Block Editor' => 'Preset For Block Editor', + 'MT Block Editor Setting' => 'Block Editor Setting', + ) + ), ); 1; diff --git a/plugins/MTBlockEditor/php/block.mtblockeditorblockasset.php b/plugins/MTBlockEditor/php/block.mtblockeditorblockasset.php new file mode 100644 index 0000000..42f0227 --- /dev/null +++ b/plugins/MTBlockEditor/php/block.mtblockeditorblockasset.php @@ -0,0 +1,16 @@ +stash('block_editor_block'); + if (!$block || !in_array($block['type'], ['mt-image', 'mt-file']) || !$block['meta']['assetId']) { + return ''; + } + return smarty_block_mtasset(['id' => $block['meta']['assetId']], $content, $ctx, $repeat); + } + + return $content; +} diff --git a/plugins/MTBlockEditor/php/block.mtblockeditorblocks.php b/plugins/MTBlockEditor/php/block.mtblockeditorblocks.php new file mode 100644 index 0000000..cc4bbbb --- /dev/null +++ b/plugins/MTBlockEditor/php/block.mtblockeditorblocks.php @@ -0,0 +1,164 @@ +localize($localvars); + + $load_blocks_from_stash = false; + $name = isset($args['name']) + ? $args['name'] : (isset($args['var']) ? $args['var'] : null); + if (isset($name)) { + unset($ctx->__stash['__cond_tag__']); + + # pick off any {...} or [...] from the name. + if (preg_match('/^(.+)([\[\{])(.+)[\]\}]$/', $name, $matches)) { + $name = $matches[1]; + $br = $matches[2]; + $ref = $matches[3]; + if (preg_match('/^\\\\\$(.+)/', $ref, $ref_matches)) { + $ref = $vars[$ref_matches[1]]; + if (!isset($ref)) + $ref = chr(0); + } + $br == '[' ? $index = $ref : $key = $ref; + } else { + if (array_key_exists('index', $args)) + $index = $args['index']; + else if (array_key_exists('key', $args)) + $key = $args['key']; + } + if (preg_match('/^$/', $name)) { + $name = $vars[$name]; + if (!isset($name)) + return $ctx->error($ctx->mt->translate( + "You used an [_1] tag without a valid name attribute.", + "" + )); + } + if (isset($name)) { + $value = isset($ctx->__stash['vars'][$name]) ? $ctx->__stash['vars'][$name] : null; + require_once("MTUtil.php"); + if (is_hash($value)) { + if (isset($key)) { + if ($key != chr(0)) { + $val = isset($value[$key]) ? $value[$key] : null; + } else { + unset($value); + } + } else { + $val = $value; + } + } elseif (is_array($value)) { + if (isset($index)) { + if (is_numeric($index)) { + $val = isset($value[$index]) ? $value[$index] : null; + } else { + unset($value); # fall through to any 'default' + } + } else { + $val = $value; + } + } else { + $val = $value; + } + } + } elseif (isset($args['tag'])) { + $tag = $args['tag']; + $tag = preg_replace('/^mt:?/i', '', $tag); + $largs = $args; // local arguments without 'tag' element + unset($largs['tag']); + + // Disable error handler temporarily + // for disabling trigger_error function. + set_error_handler('_dummy_error_handler'); + + try { + $val = $ctx->tag($tag, $largs); + } catch (exception $e) { + $val = ''; + } + + restore_error_handler(); + } else { + $load_blocks_from_stash = true; + } + + $blocks = []; + if (!$load_blocks_from_stash) { + if (!empty($value) && !is_array($value) && preg_match('/^smarty_fun_[a-f0-9]+$/', $value)) { + if (function_exists($val)) { + ob_start(); + $val($ctx, array()); + $val = ob_get_contents(); + ob_end_clean(); + } else { + $val = ''; + } + } + + if ($val) { + $parser = new MT\Plugin\MTBlockEditor\Parser(); + $blocks = $parser->parse(['content' => $val]); + } + } else if ($ctx->stash('block_editor_block')) { + $blocks = $ctx->stash('block_editor_block')['blocks']; + } + + $ctx->__stash['block_editor_blocks'] = $blocks; + $counter = 0; + } else { + $counter = $ctx->stash('block_editor_blocks_counter'); + } + + $blocks = $ctx->stash('block_editor_blocks'); + if (empty($blocks)) { + $ret = $ctx->_hdlr_if($args, $content, $ctx, $repeat, 0); + if (!$repeat) + $ctx->restore($localvars); + return $ret; + } + + if ($counter < count($blocks)) { + $block = $blocks[$counter]; + if (!empty($block)) { + $value = $block['content'] ? join('', $block['content']) : ''; + + $count = $counter + 1; + $ctx->__stash['vars']['__counter__'] = $count; + $ctx->__stash['vars']['__odd__'] = ($count % 2) == 1; + $ctx->__stash['vars']['__even__'] = ($count % 2) == 0; + $ctx->__stash['vars']['__first__'] = $count == 1; + $ctx->__stash['vars']['__last__'] = ($count == count($blocks)); + $ctx->__stash['vars']['__value__'] = $value; + + $ctx->__stash['vars']['type'] = $block['type']; + + $br_to_newline = fn ($str) => preg_replace('//i', "\n", $str); + if ($block['type'] == 'mt-image' && !isset($block['meta']['alt'])) { + preg_match('/alt=(["\'])(.*?)\1/i', $value, $matches); + $block['meta']['alt'] = isset($matches[2]) ? $matches[2] : ""; + preg_match('/
(.*?)<\/figcaption>/i', $value, $matches); + $block['meta']['caption'] = isset($matches[1]) ? $br_to_newline($matches[1]) : ""; + } elseif ($block['type'] == 'mt-file' && !isset($block['meta']['text'])) { + preg_match('/]*>(.*?)<\/a>/i', $value, $matches); + $block['meta']['text'] = isset($matches[1]) ? $br_to_newline($matches[1]) : ""; + } + $ctx->__stash['vars']['meta'] = $block['meta']; + + $ctx->stash('block_editor_block', $block); + $ctx->stash('block_editor_blocks_counter', $count); + $repeat = true; + } + } else { + $ctx->restore($localvars); + $repeat = false; + } + + return $content; +} diff --git a/plugins/MTBlockEditor/php/init.MTBlockEditor.php b/plugins/MTBlockEditor/php/init.MTBlockEditor.php new file mode 100644 index 0000000..2a29ab5 --- /dev/null +++ b/plugins/MTBlockEditor/php/init.MTBlockEditor.php @@ -0,0 +1,185 @@ +meta = $param['meta']; + } + + public function start_document(): void + { + $this->top_blocks = []; + $this->cur_blocks = []; + } + + public function start_element($parser, string $name, array $attrs): void + { + if (!preg_match('/mt-beb$/i', $name)) { + return; + } + + $type = $attrs["T"] ?? "core-text"; + $meta = $this->decode_meta($attrs["M"] ?? ""); + + if ($type == 'core-context') { + foreach ($meta as $key => $value) { + $this->meta[$key] = $value; + } + + array_push($this->cur_blocks, null); + return; + } + + $block = [ + 'type' => $type, + 'meta' => $meta, + 'html' => $attrs["H"] ?? null, + 'blocks' => [], + 'content' => [''] + ]; + array_push($this->cur_blocks, $block); + } + + public function characters($parser, string $data): void + { + if (empty($this->cur_blocks)) { + return; + } + + $lastBlockIndex = count($this->cur_blocks) - 1; + $lastContentIndex = count($this->cur_blocks[$lastBlockIndex]['content']) - 1; + $this->cur_blocks[$lastBlockIndex]['content'][$lastContentIndex] .= $data; + } + + public function end_element($parser, string $name): void + { + if (!preg_match('/mt-beb$/i', $name)) { + return; + } + + $block = array_pop($this->cur_blocks); + + if (!$block) { + return; + } + + if ($block['content'][count($block['content']) - 1] == '') { + array_pop($block['content']); + } + + if (empty($this->cur_blocks)) { + array_push($this->top_blocks, $block); + } else { + $lastBlockIndex = count($this->cur_blocks) - 1; + $lastContentIndex = count($this->cur_blocks[$lastBlockIndex]['content']) - 1; + + if ($this->cur_blocks[$lastBlockIndex]['content'][$lastContentIndex] == '') { + array_pop($this->cur_blocks[$lastBlockIndex]['content']); + } + + array_push($this->cur_blocks[$lastBlockIndex]['content'], ...$block['content']); + array_push($this->cur_blocks[$lastBlockIndex]['content'], ''); + array_push($this->cur_blocks[$lastBlockIndex]['blocks'], $block); + } + } + + public function blocks(): array + { + return $this->top_blocks; + } + + private function decode_meta(string $meta_string): array + { + preg_match_all('/(\w+)(?:,|$)|(.+)/s', $meta_string, $matches, PREG_SET_ORDER); + $metas = array_map(fn ($value) => !preg_match('/^{/', $value) ? $this->meta[$value] ?? [] : json_decode($value, true), array_map(fn ($m) => $m[2] ?? $m[1], $matches)); + + $result = []; + foreach ($metas as $meta) { + foreach ($meta as $key => $value) { + $result[$key] = $value; + } + } + + return $result; + } +} + +class Parser +{ + private string $NO_FALLBACK = ""; + + private array $entity_map = [ + "&" => "&", + "<" => "<", + ">" => ">" + ]; + + private function _preprocess_content(string $content): string + { + $map_reverse = array_flip($this->entity_map); + $map_reverse_key = array_keys($map_reverse); + + $content = str_replace(array_keys($this->entity_map), $this->entity_map, $content); + $content = preg_replace_callback('/<!--\\s+(\\/?mt-beb.*?)-->/', fn ($matches) => "<" . preg_replace_callback( + '/(' . join('|', $map_reverse_key) . ')/', + fn ($m) => $map_reverse[$m[1]], + $matches[1] + ) . ">", $content); + return $content; + } + + private function _parse_recursive(array &$blocks, array $meta): void + { + foreach ($blocks as &$b) { + if (isset($b['html'])) { + $html = $b['html']; + unset($b['html']); + $b['blocks'] = $this->parse([ + 'content' => $html, + 'fallback_type' => $this->NO_FALLBACK, + 'meta' => $meta + ]); + } + $this->_parse_recursive($b['blocks'], $meta); + } + } + + public function parse(array $args): array + { + $fallback_type = $args['fallback_type'] ?? "core-html"; + $content = $args['content']; + $meta = $args['meta'] ?? []; + + if ($fallback_type && !preg_match('/\A\s*

test

left

right

+ DATA, [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

test

'], + ], + [ + 'type' => 'core-columns', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-column', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

left

'], + ], + ], + 'content' => ['
', '

left

', '
'], + ], + [ + 'type' => 'core-column', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

right

'], + ], + ], + 'content' => ['
', '

right

', '
'], + ], + ], + 'content' => ['
', '
', '

left

', '
', '
', '

right

', '
', '
'], + ], + ] + ], + 'mt-image' => [ + <<<'DATA' +

test

+ DATA, [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

test

'], + ], + [ + 'type' => 'mt-image', + 'meta' => [ + 'assetId' => 1, + 'assetUrl' => 'https://blog-taaas-jp.movabletype.io/.assets/form-with-multipart.png', + 'alignment' => 'none', + 'width' => '640', + ], + 'html' => null, + 'blocks' => [], + 'content' => ['

'], + ], + ] + ], + 'meta : simple' => [ + <<<'DATA' + test1test2 + DATA, [ + [ + 'type' => 'core-text', + 'meta' => ['label' => 'Test Label'], + 'html' => null, + 'blocks' => [], + 'content' => ['test1'], + ], + [ + 'type' => 'core-text', + 'meta' => ['label' => 'Test Label'], + 'html' => null, + 'blocks' => [], + 'content' => ['test2'], + ], + ] + ], + 'meta : broken - 1' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'meta : broken - 2' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'core-text', + 'meta' => [ + 'label' => 'Test Label', + ], + 'html' => null, + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'meta : blank' => [ + <<<'DATA' + test` + DATA, [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'meta : multiple' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'core-text', + 'meta' => [ + 'label' => 'Test Label', + 'helpText' => 'Test Help', + ], + 'html' => null, + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'meta : multiple with object' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'core-text', + 'meta' => [ + 'label' => 'Test Label', + 'helpText' => 'Test Help', + 'className' => 'Test Class', + ], + 'html' => null, + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'custom block - without wrapper' => [ + <<<'DATA' +

paragraph1

paragraph2

+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['

paragraph1

', '

paragraph2

'], + ], + ] + ], + 'custom block - with wrapper' => [ + <<<'DATA' +

paragraph1

paragraph2

+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => [ + '
', + '

paragraph1

', + '

paragraph2

', + '
', + ], + ], + ] + ], + 'custom block - with custom-element wrapper' => [ + <<<'DATA' +

paragraph1

paragraph2

+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => [ + '', + '

paragraph1

', + '

paragraph2

', + '
', + ], + ], + ] + ], + 'custom block - with class name' => [ + <<<'DATA' +

paragraph1

paragraph2

+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => [ + '
', + '

paragraph1

', + '

paragraph2

', + '
', + ], + ], + ] + ], + 'blank - without wrapper' => [ + <<<'DATA' + + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => [], + ], + ] + ], + 'blank - with wrapper' => [ + <<<'DATA' +
+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => [ + '
' + ], + ], + ] + ], + 'blank - with class name' => [ + <<<'DATA' +
+ DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => [ + '
' + ], + ], + ] + ], + 'compiled - without wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['test'], + ], + ] + ], + 'compiled - with wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['test'], + ], + ] + ], + 'compiled - with custom element wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['test'], + ], + ] + ], + 'compiled - with class name' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['test'], + ], + ] + ], + 'compiled - with class name - with wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [ + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph1

'], + ], + [ + 'type' => 'core-text', + 'meta' => [], + 'html' => null, + 'blocks' => [], + 'content' => ['

paragraph2

'], + ], + ], + 'content' => ['test'], + ], + ] + ], + 'compiled - blank - without wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'compiled - blank - with wrapper' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + 'compiled - blank - with class name' => [ + <<<'DATA' + test + DATA, [ + [ + 'type' => 'custom-test', + 'meta' => [], + 'blocks' => [], + 'content' => ['test'], + ], + ] + ], + ]; + } +} diff --git a/plugins/MTBlockEditor/t/04-tag.t b/plugins/MTBlockEditor/t/04-tag.t index f53bd80..91812d0 100644 --- a/plugins/MTBlockEditor/t/04-tag.t +++ b/plugins/MTBlockEditor/t/04-tag.t @@ -2,6 +2,7 @@ use strict; use warnings; use utf8; +use Encode; use FindBin; use lib "$FindBin::Bin/../../../t/lib"; @@ -15,11 +16,12 @@ BEGIN { use MT; use MT::Test; +use MT::Test::PHP; use MT::Test::Fixture; use MT::Test::Image; use MT::Test::Tag; -plan tests => 1 * blocks; +plan tests => (1 + 2) * blocks; filters { template => [qw( chomp )], @@ -86,6 +88,31 @@ MT::Test::Tag->run_perl_tests( $ctx->stash('entry' => $entry); }); +if (MT::Test::PHP->php_version >= 7.4) { + MT::Test::Tag->run_php_tests( + $blog->id, + sub { + my ($block) = @_; + + return <<"PHP"; +\$ctx->__stash['vars']['content'] = <<<'HTML' +@{[$block->content ? Encode::encode('utf-8', $block->content) : '']} +HTML; +require_once('class.mt_entry.php'); +\$entry = new Entry; +\$entry->Load(@{[$entry->id]}); +\$ctx->stash('entry', \$entry); +PHP + }); +} +else { + SKIP: { + skip 'PHP 7.4 or later is required', 2 * blocks; + } +} + +done_testing; + __END__ === Load blocks via MT tag @@ -112,11 +139,11 @@ __END__
-
+
- + -
+
diff --git a/plugins/MTBlockEditor/t/05-app-cms.t b/plugins/MTBlockEditor/t/05-app-cms.t index 890cfc6..475a0ac 100644 --- a/plugins/MTBlockEditor/t/05-app-cms.t +++ b/plugins/MTBlockEditor/t/05-app-cms.t @@ -86,7 +86,7 @@ subtest 'entry' => sub { # loaded like $out, qr{mt-block-editor\.js}; - like $out, qr{}; + like $out, qr{}; }; subtest 'content_data' => sub { @@ -105,7 +105,7 @@ subtest 'content_data' => sub { # loaded like $out, qr{mt-block-editor\.js}; - like $out, qr{}; + like $out, qr{}; }; subtest 'cfg_entry' => sub { diff --git a/plugins/MTBlockEditor/tmpl/admin2023/edit_block.tmpl b/plugins/MTBlockEditor/tmpl/admin2023/edit_block.tmpl index f2ddf1b..6062e46 100644 --- a/plugins/MTBlockEditor/tmpl/admin2023/edit_block.tmpl +++ b/plugins/MTBlockEditor/tmpl/admin2023/edit_block.tmpl @@ -145,9 +145,9 @@ id="wrap_root_block" label="<__trans phrase="Wrap in root element">">
-
- checked="checked" data-bs-toggle="collapse" data-bs-target="#wrap-root-block-option" aria-expanded="truefalse" aria-controls="wrap-root-block-option" /> - +
+ checked="checked" data-bs-toggle="collapse" data-bs-target="#wrap-root-block-option" aria-expanded="truefalse" aria-controls="wrap-root-block-option" /> +
@@ -168,9 +168,9 @@ id="can_remove_block" label="<__trans phrase="Can add and remove block">">
-
- checked="checked" data-bs-toggle="collapse" data-bs-target="#can-remove-block-option" aria-expanded="truefalse" aria-controls="can-remove-block-option" /> - +
+ checked="checked" data-bs-toggle="collapse" data-bs-target="#can-remove-block-option" aria-expanded="truefalse" aria-controls="can-remove-block-option" /> +
@@ -203,10 +203,10 @@
- checked="checked"/> + checked="checked"/> - checked="checked" /> + checked="checked" />
@@ -223,9 +223,9 @@ label="<__trans phrase="Preview settings">" hint='<__trans phrase="You can keep the editing status even when not in focus by unchecking this check box.">' show_hint="1"> -
- checked="checked"/> - +
+ checked="checked"/> +
diff --git a/plugins/MTBlockEditor/tmpl/script.tmpl b/plugins/MTBlockEditor/tmpl/script.tmpl index 99552e1..db0ab91 100644 --- a/plugins/MTBlockEditor/tmpl/script.tmpl +++ b/plugins/MTBlockEditor/tmpl/script.tmpl @@ -5,16 +5,16 @@ - -plugins/MTBlockEditor/dist/mt-block-editor/1.1.45/mt-block-editor.css?v=" /> + +plugins/MTBlockEditor/dist/mt-block-editor/1.1.50/mt-block-editor.css?v=" /> - -plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.4/mt-block-editor-block-oembed.css?v=" /> + +plugins/MTBlockEditor/dist/mt-block-editor-block-oembed/1.0.5/mt-block-editor-block-oembed.css?v=" /> - +