diff --git a/.eslintignore b/.eslintignore index 8cfe15d9..fe24ce3b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -30,3 +30,7 @@ src/editor/jspdf/underscore-min.js src/editor/extensions/ext-mathjax/mathjax +# jquery files +src/editor/svgicons/jQuery.svgIcons.js +src/editor/jgraduate/jQuery.jPicker.js + diff --git a/README.md b/README.md index 85078746..4dbf4e73 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,6 @@ to join the project. ### [Try SVG-edit here](https://svg-edit.github.io/svgedit/dist/editor/index.html) - -See a working editor on [`master`](https://svg-edit.github.io/svgedit/src/editor/index.html) -version, which requires a modern browser). - We also build a systemJS version at [`master`](https://svg-edit.github.io/svgedit/dist/editor/system/index.html) You may also obtain URLs for specific [releases](https://github.com/SVG-Edit/svgedit/releases). diff --git a/badges/tests-badge.svg b/badges/tests-badge.svg index ecc8fc46..61b3e08c 100644 --- a/badges/tests-badge.svg +++ b/badges/tests-badge.svg @@ -1 +1 @@ -TestsTests139/139139/139 \ No newline at end of file +TestsTests141/141141/141 \ No newline at end of file diff --git a/cypress/integration/ui/__snapshots__/scenario.js.snap b/cypress/integration/ui/__snapshots__/scenario.js.snap index 21aa0bf8..3636cb70 100644 --- a/cypress/integration/ui/__snapshots__/scenario.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario.js.snap @@ -221,6 +221,7 @@ exports[`use various parts of svg-edit > check tool_italic #0`] = ` fill-opacity="1" stroke-opacity="1" id="svg_2" + transform="matrix(1 0 0 1 0 0)" > B @@ -285,6 +286,7 @@ exports[`use various parts of svg-edit > check tool_bold #0`] = ` fill-opacity="1" stroke-opacity="1" id="svg_2" + transform="matrix(1 0 0 1 0 0)" > B @@ -349,9 +351,301 @@ exports[`use various parts of svg-edit > check change color #0`] = ` fill-opacity="1" stroke-opacity="1" id="svg_2" + transform="matrix(1 0 0 1 0 0)" > B `; + +exports[`use various parts of svg-edit > check tool_start #0`] = ` + + + Layer 1 + + + B + + + B + + + + + + +`; + +exports[`use various parts of svg-edit > check tool_star #0`] = ` + + + Layer 1 + + + B + + + B + + + + + + +`; + +exports[`use various parts of svg-edit > check tool_polygon #0`] = ` + + + Layer 1 + + + B + + + B + + + + + + + +`; diff --git a/cypress/integration/ui/clipboard.js b/cypress/integration/ui/clipboard.js index a9ba05e9..d9bbb944 100644 --- a/cypress/integration/ui/clipboard.js +++ b/cypress/integration/ui/clipboard.js @@ -11,13 +11,13 @@ describe('UI - Clipboard', function () { cy.get('#tool_source').click(); cy.get('#svg_source_textarea') - .type('{selectall}') + .type('{selectall}', {force: true}) .type(` Layer 1 - `, {parseSpecialCharSequences: false}); + `, {force: true, parseSpecialCharSequences: false}); cy.get('#tool_source_save').click(); cy.get('#testCircle').should('exist'); cy.get('#svg_1').should('not.exist'); @@ -25,20 +25,20 @@ describe('UI - Clipboard', function () { // Copy. cy.get('#testCircle').click().rightclick(); - cy.get('#cmenu_canvas a[href="#copy"]').click(); + cy.get('#cmenu_canvas a[href="#copy"]').click({force: true}); // Paste. // Scrollbars fail to recenter in Cypress test. Works fine in reality. // Thus forcing click is needed since workspace is mostly offscreen. cy.get('#svgroot').rightclick({force: true}); - cy.get('#cmenu_canvas a[href="#paste"]').click(); + cy.get('#cmenu_canvas a[href="#paste"]').click({force: true}); cy.get('#testCircle').should('exist'); cy.get('#svg_1').should('exist'); cy.get('#svg_2').should('not.exist'); // Cut. cy.get('#testCircle').click().rightclick(); - cy.get('#cmenu_canvas a[href="#cut"]').click(); + cy.get('#cmenu_canvas a[href="#cut"]').click({force: true}); cy.get('#testCircle').should('not.exist'); cy.get('#svg_1').should('exist'); cy.get('#svg_2').should('not.exist'); @@ -47,16 +47,16 @@ describe('UI - Clipboard', function () { // Scrollbars fail to recenter in Cypress test. Works fine in reality. // Thus forcing click is needed since workspace is mostly offscreen. cy.get('#svgroot').rightclick({force: true}); - cy.get('#cmenu_canvas a[href="#paste"]').click(); + cy.get('#cmenu_canvas a[href="#paste"]').click({force: true}); cy.get('#testCircle').should('not.exist'); cy.get('#svg_1').should('exist'); cy.get('#svg_2').should('exist'); // Delete. cy.get('#svg_2').click().rightclick(); - cy.get('#cmenu_canvas a[href="#delete"]').click(); + cy.get('#cmenu_canvas a[href="#delete"]').click({force: true}); cy.get('#svg_1').click().rightclick(); - cy.get('#cmenu_canvas a[href="#delete"]').click(); + cy.get('#cmenu_canvas a[href="#delete"]').click({force: true}); cy.get('#svg_1').should('not.exist'); cy.get('#svg_2').should('not.exist'); }); diff --git a/cypress/integration/ui/control-points.js b/cypress/integration/ui/control-points.js index 593f2f26..993e57f0 100644 --- a/cypress/integration/ui/control-points.js +++ b/cypress/integration/ui/control-points.js @@ -12,11 +12,11 @@ describe('UI - Control Points', function () { cy.get('#tool_source').click(); cy.get('#svg_source_textarea') - .type('{selectall}') + .type('{selectall}', {force: true}) .type(` Layer 1 - + `, {force: true, parseSpecialCharSequences: false}); cy.get('#tool_source_save').click(); diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js index 66dd222c..47f9a874 100644 --- a/cypress/integration/ui/issues/issue-408.js +++ b/cypress/integration/ui/issues/issue-408.js @@ -11,7 +11,7 @@ describe('Fix issue 408', function () { it('should not throw when showing/saving svg content', function () { cy.get('#tool_source').click(); cy.get('#svg_source_textarea') - .type('{selectall}') + .type('{selectall}', {force: true}) .type(` Layer 1 diff --git a/cypress/integration/ui/scenario.js b/cypress/integration/ui/scenario.js index 47bd5f2a..1d31b3b6 100644 --- a/cypress/integration/ui/scenario.js +++ b/cypress/integration/ui/scenario.js @@ -20,7 +20,7 @@ describe('use various parts of svg-edit', function () { Layer 1 - `, {parseSpecialCharSequences: false}); + `, {force: true, parseSpecialCharSequences: false}); cy.get('#tool_source_save').click({force: true}); testSnapshot(); }); @@ -70,4 +70,22 @@ describe('use various parts of svg-edit', function () { .click({force: true}); testSnapshot(); }); + it('check tool_star', function () { + cy.get('#tool_star') + .click({force: true}); + cy.get('#svgcontent') + .trigger('mousedown', {which: 1, pageX: 600, pageY: 150, force: true}) + .trigger('mousemove', {which: 1, pageX: 600, pageY: 170, force: true}) + .trigger('mouseup', {force: true}); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_polygon', function () { + cy.get('#tool_polygon') + .click({force: true}); + cy.get('#svgcontent') + .trigger('mousedown', {which: 1, pageX: 650, pageY: 200, force: true}) + .trigger('mousemove', {which: 1, pageX: 650, pageY: 210, force: true}) + .trigger('mouseup', {force: true}); + cy.get('#svgcontent').toMatchSnapshot(); + }); }); diff --git a/cypress/integration/unit/path.js b/cypress/integration/unit/path.js index e6124129..ae823cc4 100644 --- a/cypress/integration/unit/path.js +++ b/cypress/integration/unit/path.js @@ -6,6 +6,7 @@ import '../../../instrumented/editor/jquery.min.js'; import {NS} from '../../../instrumented/common/namespaces.js'; import * as utilities from '../../../instrumented/common/utilities.js'; import * as pathModule from '../../../instrumented/svgcanvas/path.js'; +import {Path, Segment} from '../../../instrumented/svgcanvas/path-method.js'; import {init as unitsInit} from '../../../instrumented/common/units.js'; describe('path', function () { @@ -50,7 +51,7 @@ describe('path', function () { const [mockPathContext, mockUtilitiesContext] = getMockContexts(); pathModule.init(mockPathContext); utilities.init(mockUtilitiesContext); - new pathModule.Path(path); // eslint-disable-line no-new + new Path(path); // eslint-disable-line no-new assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'L'); assert.equal(path.pathSegList.getItem(1).x, 10); @@ -70,13 +71,13 @@ describe('path', function () { const [mockPathContext, mockUtilitiesContext] = getMockContexts(); pathModule.init(mockPathContext); utilities.init(mockUtilitiesContext); - new pathModule.Path(path); // eslint-disable-line no-new + new Path(path); // eslint-disable-line no-new assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'L'); assert.equal(path.pathSegList.getItem(1).x, 10); assert.equal(path.pathSegList.getItem(1).y, 11); - const segment = new pathModule.Segment(1, path.pathSegList.getItem(1)); + const segment = new Segment(1, path.pathSegList.getItem(1)); segment.setType(SVGPathSeg.PATHSEG_LINETO_REL, [30, 31]); assert.equal(segment.item.pathSegTypeAsLetter, 'l'); assert.equal(segment.item.x, 30); @@ -98,8 +99,8 @@ describe('path', function () { const [mockPathContext, mockUtilitiesContext] = getMockContexts(svg); pathModule.init(mockPathContext); utilities.init(mockUtilitiesContext); - const segment = new pathModule.Segment(1, path.pathSegList.getItem(1)); - segment.path = new pathModule.Path(path); + const segment = new Segment(1, path.pathSegList.getItem(1)); + segment.path = new Path(path); assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'C'); assert.equal(path.pathSegList.getItem(1).x1, 11); @@ -126,13 +127,13 @@ describe('path', function () { const [mockPathContext, mockUtilitiesContext] = getMockContexts(); pathModule.init(mockPathContext); utilities.init(mockUtilitiesContext); - new pathModule.Path(path); // eslint-disable-line no-new + new Path(path); // eslint-disable-line no-new assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'L'); assert.equal(path.pathSegList.getItem(1).x, 10); assert.equal(path.pathSegList.getItem(1).y, 11); - const segment = new pathModule.Segment(1, path.pathSegList.getItem(1)); + const segment = new Segment(1, path.pathSegList.getItem(1)); segment.move(-3, 4); assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'L'); assert.equal(path.pathSegList.getItem(1).x, 7); @@ -146,7 +147,7 @@ describe('path', function () { const [mockPathContext, mockUtilitiesContext] = getMockContexts(); pathModule.init(mockPathContext); utilities.init(mockUtilitiesContext); - new pathModule.Path(path); // eslint-disable-line no-new + new Path(path); // eslint-disable-line no-new assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'C'); assert.equal(path.pathSegList.getItem(1).x1, 11); @@ -156,7 +157,7 @@ describe('path', function () { assert.equal(path.pathSegList.getItem(1).x, 15); assert.equal(path.pathSegList.getItem(1).y, 16); - const segment = new pathModule.Segment(1, path.pathSegList.getItem(1)); + const segment = new Segment(1, path.pathSegList.getItem(1)); segment.moveCtrl(1, 100, -200); assert.equal(path.pathSegList.getItem(1).pathSegTypeAsLetter, 'C'); assert.equal(path.pathSegList.getItem(1).x1, 111); diff --git a/dist/editor/embedapi.js b/dist/editor/embedapi.js index 4e4af622..4e018cca 100644 --- a/dist/editor/embedapi.js +++ b/dist/editor/embedapi.js @@ -102,7 +102,7 @@ function getMessageListener (t) { * - Have an iframe somewhere pointing to a version of svg-edit > r1000. * @example // Initialize the magic with: -const svgCanvas = new EmbeddedSVGEdit(window.frames.svgedit); +svgCanvas = new EmbeddedSVGEdit(window.frames.svgedit); // Pass functions in this format: svgCanvas.setSvgString('string'); @@ -130,7 +130,7 @@ svgCanvas.setSvgString('string')(function (data, error) { // The only other difference is when handling returns: // the callback notation is used instead. -const blah = new EmbeddedSVGEdit(window.frames.svgedit); +blah = new EmbeddedSVGEdit(window.frames.svgedit); blah.clearSelection('woot', 'blah', 1337, [1, 2, 3, 4, 5, 'moo'], -42, { a: 'tree', b: 6, c: 9 })(function () { console.log('GET DATA', args); }); diff --git a/dist/editor/extensions/ext-closepath/ext-closepath.js b/dist/editor/extensions/ext-closepath/ext-closepath.js index 8c1e269e..7b992d0c 100644 --- a/dist/editor/extensions/ext-closepath/ext-closepath.js +++ b/dist/editor/extensions/ext-closepath/ext-closepath.js @@ -1,4 +1,4 @@ -var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:n},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?c.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},f={}.hasOwnProperty,has=function(t,e){return f.call(t,e)},s=e.document,l=isObject(s)&&isObject(s.createElement),documentCreateElement=function(t){return l?s.createElement(t):{}},p=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),h=Object.getOwnPropertyDescriptor,y={f:r?h:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),p)try{return h(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!i.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},v=Object.defineProperty,d={f:r?v:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),p)try{return v(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}},g=r?function(t,e,r){return d.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,r){try{g(e,t,r)}catch(n){e[t]=r}return r},m=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof m.inspectSource&&(m.inspectSource=function(t){return b.call(t)});var w,S,O,j=m.inspectSource,x=e.WeakMap,E="function"==typeof x&&/native code/.test(j(x)),P=createCommonjsModule((function(t){(t.exports=function(t,e){return m[t]||(m[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),_=0,T=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++_+T).toString(36)},A=P("keys"),sharedKey=function(t){return A[t]||(A[t]=uid(t))},L={},k=e.WeakMap;if(E){var I=new k,C=I.get,M=I.has,G=I.set;w=function(t,e){return G.call(I,t,e),e},S=function(t){return C.call(I,t)||{}},O=function(t){return M.call(I,t)}}else{var R=sharedKey("state");L[R]=!0,w=function(t,e){return g(t,R,e),e},S=function(t){return has(t,R)?t[R]:{}},O=function(t){return has(t,R)}}var N,D,W={set:w,get:S,has:O,enforce:function(t){return O(t)?S(t):w(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=S(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},V=createCommonjsModule((function(t){var r=W.get,n=W.enforce,o=String(String).split("String");(t.exports=function(t,r,i,a){var c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,f=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof r||has(i,"name")||g(i,"name",r),n(i).source=o.join("string"==typeof r?r:"")),t!==e?(c?!f&&t[r]&&(u=!0):delete t[r],u?t[r]=i:g(t,r,i)):u?t[r]=i:setGlobal(r,i)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&r(this).source||j(this)}))})),q=e,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,r){return arguments.length<2?aFunction(q[t])||aFunction(e[t]):q[t]&&q[t][r]||e[t]&&e[t][r]},z=Math.ceil,B=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?B:z)(t)},U=Math.min,toLength=function(t){return t>0?U(toInteger(t),9007199254740991):0},Y=Math.max,H=Math.min,toAbsoluteIndex=function(t,e){var r=toInteger(t);return r<0?Y(r+e,0):H(r,e)},createMethod=function(t){return function(e,r,n){var o,i=toIndexedObject(e),a=toLength(i.length),c=toAbsoluteIndex(n,a);if(t&&r!=r){for(;a>c;)if((o=i[c++])!=o)return!0}else for(;a>c;c++)if((t||c in i)&&i[c]===r)return t||c||0;return!t&&-1}},$={includes:createMethod(!0),indexOf:createMethod(!1)}.indexOf,objectKeysInternal=function(t,e){var r,n=toIndexedObject(t),o=0,i=[];for(r in n)!has(L,r)&&has(n,r)&&i.push(r);for(;e.length>o;)has(n,r=e[o++])&&(~$(i,r)||i.push(r));return i},J=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],K=J.concat("length","prototype"),Q={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,K)}},X={f:Object.getOwnPropertySymbols},Z=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var e=Q.f(anObject(t)),r=X.f;return r?e.concat(r(t)):e},copyConstructorProperties=function(t,e){for(var r=Z(e),n=d.f,o=y.f,i=0;im;m++)if((a||m in v)&&(h=d(p=v[m],m,y),t))if(e)w[m]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:yt.call(w,p)}else if(o)return!1;return i?-1:n||o?o:w}},vt={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},dt=getBuiltIn("navigator","userAgent")||"",gt=e.process,mt=gt&>.versions,bt=mt&&mt.v8;bt?D=(N=bt.split("."))[0]+N[1]:dt&&(!(N=dt.match(/Edge\/(\d+)/))||N[1]>=74)&&(N=dt.match(/Chrome\/(\d+)/))&&(D=N[1]);var wt=D&&+D,St=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return wt>=51||!fails((function(){var e=[];return(e.constructor={})[St]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ot=Object.defineProperty,jt={},thrower=function(t){throw t},arrayMethodUsesToLength=function(t,e){if(has(jt,t))return jt[t];e||(e={});var n=[][t],o=!!has(e,"ACCESSORS")&&e.ACCESSORS,i=has(e,0)?e[0]:thrower,a=has(e,1)?e[1]:void 0;return jt[t]=!!n&&!fails((function(){if(o&&!r)return!0;var t={length:-1};o?Ot(t,1,{enumerable:!0,get:thrower}):t[1]=1,n.call(t,i,a)}))},xt=vt.map,Et=arrayMethodHasSpeciesSupport("map"),Pt=arrayMethodUsesToLength("map");_export({target:"Array",proto:!0,forced:!Et||!Pt},{map:function map(t){return xt(this,t,arguments.length>1?arguments[1]:void 0)}});var _t=d.f,Tt=Function.prototype,At=Tt.toString,Lt=/^\s*function ([^ (]*)/;r&&!("name"in Tt)&&_t(Tt,"name",{configurable:!0,get:function(){try{return At.call(this).match(Lt)[1]}catch(t){return""}}});var kt=Object.keys||function keys(t){return objectKeysInternal(t,J)},It=Object.assign,Ct=Object.defineProperty,Mt=!It||fails((function(){if(r&&1!==It({b:1},It(Ct({},"a",{enumerable:!0,get:function(){Ct(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),o="abcdefghijklmnopqrst";return t[n]=7,o.split("").forEach((function(t){e[t]=t})),7!=It({},t)[n]||kt(It({},e)).join("")!=o}))?function assign(t,e){for(var n=toObject(t),o=arguments.length,a=1,c=X.f,f=i.f;o>a;)for(var s,l=u(arguments[a++]),p=c?kt(l).concat(c(l)):kt(l),h=p.length,y=0;h>y;)s=p[y++],r&&!f.call(l,s)||(n[s]=l[s]);return n}:It;_export({target:"Object",stat:!0,forced:Object.assign!==Mt},{assign:Mt});var Gt={};Gt[wellKnownSymbol("toStringTag")]="z";var Ft="[object z]"===String(Gt),Rt=wellKnownSymbol("toStringTag"),Nt="Arguments"==classofRaw(function(){return arguments}()),Dt=Ft?classofRaw:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Rt))?r:Nt?classofRaw(e):"Object"==(n=classofRaw(e))&&"function"==typeof e.callee?"Arguments":n},Wt=Ft?{}.toString:function toString(){return"[object "+Dt(this)+"]"};Ft||V(Object.prototype,"toString",Wt,{unsafe:!0});var Vt=e.Promise,qt=d.f,zt=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,r){t&&!has(t=r?t:t.prototype,zt)&&qt(t,zt,{configurable:!0,value:e})},Bt=wellKnownSymbol("species"),Ut={},Yt=wellKnownSymbol("iterator"),Ht=Array.prototype,$t=wellKnownSymbol("iterator"),callWithSafeIterationClosing=function(t,e,r,n){try{return n?e(anObject(r)[0],r[1]):e(r)}catch(e){var o=t.return;throw void 0!==o&&anObject(o.call(t)),e}},Jt=createCommonjsModule((function(t){var Result=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,r,n,o){var i,a,c,u,f,s,l,p,h=functionBindContext(e,r,n?2:1);if(o)i=t;else{if("function"!=typeof(a=function(t){if(null!=t)return t[$t]||t["@@iterator"]||Ut[Dt(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(p=a)&&(Ut.Array===p||Ht[Yt]===p)){for(c=0,u=toLength(t.length);u>c;c++)if((f=n?h(anObject(l=t[c])[0],l[1]):h(t[c]))&&f instanceof Result)return f;return new Result(!1)}i=a.call(t)}for(s=i.next;!(l=s.call(i)).done;)if("object"==typeof(f=callWithSafeIterationClosing(i,h,l.value,n))&&f&&f instanceof Result)return f;return new Result(!1)}).stop=function(t){return new Result(!0,t)}})),Kt=wellKnownSymbol("iterator"),Qt=!1;try{var Xt=0,Zt={next:function(){return{done:!!Xt++}},return:function(){Qt=!0}};Zt[Kt]=function(){return this},Array.from(Zt,(function(){throw 2}))}catch(t){}var te,ee,re,ne=wellKnownSymbol("species"),oe=getBuiltIn("document","documentElement"),ie=/(iphone|ipod|ipad).*applewebkit/i.test(dt),ae=e.location,ce=e.setImmediate,ue=e.clearImmediate,fe=e.process,se=e.MessageChannel,le=e.Dispatch,pe=0,he={},run=function(t){if(he.hasOwnProperty(t)){var e=he[t];delete he[t],e()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){e.postMessage(t+"",ae.protocol+"//"+ae.host)};ce&&ue||(ce=function setImmediate(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return he[++pe]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},te(pe),pe},ue=function clearImmediate(t){delete he[t]},"process"==classofRaw(fe)?te=function(t){fe.nextTick(runner(t))}:le&&le.now?te=function(t){le.now(runner(t))}:se&&!ie?(re=(ee=new se).port2,ee.port1.onmessage=listener,te=functionBindContext(re.postMessage,re,1)):!e.addEventListener||"function"!=typeof postMessage||e.importScripts||fails(post)||"file:"===ae.protocol?te="onreadystatechange"in documentCreateElement("script")?function(t){oe.appendChild(documentCreateElement("script")).onreadystatechange=function(){oe.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}:(te=post,e.addEventListener("message",listener,!1)));var ye,ve,de,ge,me,be,we,Se,Oe={set:ce,clear:ue},je=y.f,xe=Oe.set,Ee=e.MutationObserver||e.WebKitMutationObserver,Pe=e.process,_e=e.Promise,Te="process"==classofRaw(Pe),Ae=je(e,"queueMicrotask"),Le=Ae&&Ae.value;Le||(ye=function(){var t,e;for(Te&&(t=Pe.domain)&&t.exit();ve;){e=ve.fn,ve=ve.next;try{e()}catch(t){throw ve?ge():de=void 0,t}}de=void 0,t&&t.enter()},Te?ge=function(){Pe.nextTick(ye)}:Ee&&!ie?(me=!0,be=document.createTextNode(""),new Ee(ye).observe(be,{characterData:!0}),ge=function(){be.data=me=!me}):_e&&_e.resolve?(we=_e.resolve(void 0),Se=we.then,ge=function(){Se.call(we,ye)}):ge=function(){xe.call(e,ye)});var ke,Ie,Ce,Me,Ge=Le||function(t){var e={fn:t,next:void 0};de&&(de.next=e),ve||(ve=e,ge()),de=e},PromiseCapability=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=aFunction$1(e),this.reject=aFunction$1(r)},Fe={f:function(t){return new PromiseCapability(t)}},promiseResolve=function(t,e){if(anObject(t),isObject(e)&&e.constructor===t)return e;var r=Fe.f(t);return(0,r.resolve)(e),r.promise},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Re=Oe.set,Ne=wellKnownSymbol("species"),De="Promise",We=W.get,Ve=W.set,qe=W.getterFor(De),ze=Vt,Be=e.TypeError,Ue=e.document,Ye=e.process,He=getBuiltIn("fetch"),$e=Fe.f,Je=$e,Ke="process"==classofRaw(Ye),Qe=!!(Ue&&Ue.createEvent&&e.dispatchEvent),Xe=it(De,(function(){if(!(j(ze)!==String(ze))){if(66===wt)return!0;if(!Ke&&"function"!=typeof PromiseRejectionEvent)return!0}if(wt>=51&&/native code/.test(ze))return!1;var t=ze.resolve(1),FakePromise=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Ne]=FakePromise,!(t.then((function(){}))instanceof FakePromise)})),Ze=Xe||!function(t,e){if(!e&&!Qt)return!1;var r=!1;try{var n={};n[Kt]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(t){}return r}((function(t){ze.all(t).catch((function(){}))})),isThenable=function(t){var e;return!(!isObject(t)||"function"!=typeof(e=t.then))&&e},notify$1=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;Ge((function(){for(var o=e.value,i=1==e.state,a=0;n.length>a;){var c,u,f,s=n[a++],l=i?s.ok:s.fail,p=s.resolve,h=s.reject,y=s.domain;try{l?(i||(2===e.rejection&&onHandleUnhandled(t,e),e.rejection=1),!0===l?c=o:(y&&y.enter(),c=l(o),y&&(y.exit(),f=!0)),c===s.promise?h(Be("Promise-chain cycle")):(u=isThenable(c))?u.call(c,p,h):p(c)):h(o)}catch(t){y&&!f&&y.exit(),h(t)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&onUnhandled(t,e)}))}},dispatchEvent=function(t,r,n){var o,i;Qe?((o=Ue.createEvent("Event")).promise=r,o.reason=n,o.initEvent(t,!1,!0),e.dispatchEvent(o)):o={promise:r,reason:n},(i=e["on"+t])?i(o):"unhandledrejection"===t&&function(t,r){var n=e.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,r))}("Unhandled promise rejection",n)},onUnhandled=function(t,r){Re.call(e,(function(){var e,n=r.value;if(isUnhandled(r)&&(e=perform((function(){Ke?Ye.emit("unhandledRejection",n,t):dispatchEvent("unhandledrejection",t,n)})),r.rejection=Ke||isUnhandled(r)?2:1,e.error))throw e.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t,r){Re.call(e,(function(){Ke?Ye.emit("rejectionHandled",t):dispatchEvent("rejectionhandled",t,r.value)}))},bind=function(t,e,r,n){return function(o){t(e,r,o,n)}},internalReject=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=2,notify$1(t,e,!0))},internalResolve=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw Be("Promise can't be resolved itself");var o=isThenable(r);o?Ge((function(){var n={done:!1};try{o.call(r,bind(internalResolve,t,n,e),bind(internalReject,t,n,e))}catch(r){internalReject(t,n,r,e)}})):(e.value=r,e.state=1,notify$1(t,e,!1))}catch(r){internalReject(t,{done:!1},r,e)}}};Xe&&(ze=function Promise(t){!function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation")}(this,ze,De),aFunction$1(t),ke.call(this);var e=We(this);try{t(bind(internalResolve,this,e),bind(internalReject,this,e))}catch(t){internalReject(this,e,t)}},(ke=function Promise(t){Ve(this,{type:De,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(t,e,r){for(var n in e)V(t,n,e[n],r);return t}(ze.prototype,{then:function then(t,e){var r,n,o,i=qe(this),a=$e((r=ze,void 0===(o=anObject(this).constructor)||null==(n=anObject(o)[ne])?r:aFunction$1(n)));return a.ok="function"!=typeof t||t,a.fail="function"==typeof e&&e,a.domain=Ke?Ye.domain:void 0,i.parent=!0,i.reactions.push(a),0!=i.state&¬ify$1(this,i,!1),a.promise},catch:function(t){return this.then(void 0,t)}}),Ie=function(){var t=new ke,e=We(t);this.promise=t,this.resolve=bind(internalResolve,t,e),this.reject=bind(internalReject,t,e)},Fe.f=$e=function(t){return t===ze||t===Ce?new Ie(t):Je(t)},"function"==typeof Vt&&(Me=Vt.prototype.then,V(Vt.prototype,"then",(function then(t,e){var r=this;return new ze((function(t,e){Me.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof He&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function fetch(t){return promiseResolve(ze,He.apply(e,arguments))}}))),_export({global:!0,wrap:!0,forced:Xe},{Promise:ze}),setToStringTag(ze,De,!1),function(t){var e=getBuiltIn(t),n=d.f;r&&e&&!e[Bt]&&n(e,Bt,{configurable:!0,get:function(){return this}})}(De),Ce=getBuiltIn(De),_export({target:De,stat:!0,forced:Xe},{reject:function reject(t){var e=$e(this);return e.reject.call(void 0,t),e.promise}}),_export({target:De,stat:!0,forced:Xe},{resolve:function resolve(t){return promiseResolve(this,t)}}),_export({target:De,stat:!0,forced:Ze},{all:function all(t){var e=this,r=$e(e),n=r.resolve,o=r.reject,i=perform((function(){var r=aFunction$1(e.resolve),i=[],a=0,c=1;Jt(t,(function(t){var u=a++,f=!1;i.push(void 0),c++,r.call(e,t).then((function(t){f||(f=!0,i[u]=t,--c||n(i))}),o)})),--c||n(i)}));return i.error&&o(i.value),r.promise},race:function race(t){var e=this,r=$e(e),n=r.reject,o=perform((function(){var o=aFunction$1(e.resolve);Jt(t,(function(t){o.call(e,t).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}});var tr,er=r?Object.defineProperties:function defineProperties(t,e){anObject(t);for(var r,n=kt(e),o=n.length,i=0;o>i;)d.f(t,r=n[i++],e[r]);return t},rr=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"`, */\n // mathjaxSrc = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',\n // Had been on https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG.js\n // Obtained Text-AMS-MML_SVG.js from https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/config/TeX-AMS-MML_SVG.js\n {uiStrings} = svgEditor;\n let\n math,\n locationX,\n locationY,\n mathjaxLoaded = false;\n\n // TODO: Implement language support. Move these uiStrings to the locale files and\n // the code to the langReady callback. Also i18nize alert and HTML below\n $.extend(uiStrings, {\n mathjax: {\n embed_svg: 'Save as mathematics',\n embed_mathml: 'Save as figure',\n svg_save_warning: 'The math will be transformed into a figure is ' +\n 'manipulatable like everything else. You will not be able to ' +\n 'manipulate the TeX-code anymore.',\n mathml_save_warning: 'Advised. The math will be saved as a figure.',\n title: 'Mathematics code editor'\n }\n });\n\n /**\n *\n * @returns {void}\n */\n function saveMath () {\n const code = $('#mathjax_code_textarea').val();\n // displaystyle to force MathJax NOT to use the inline style. Because it is\n // less fancy!\n MathJax.Hub.queue.Push(['Text', math, '\\\\displaystyle{' + code + '}']);\n\n /*\n * The MathJax library doesn't want to bloat your webpage so it creates\n * every symbol (glymph) you need only once. These are saved in a `` on\n * the top of your html document, just under the body tag. Each glymph has\n * its unique id and is saved as a `` in the `` tag of the ``\n *\n * Then when the symbols are needed in the rest of your html document they\n * are refferd to by a `` tag.\n * Because of bug 1076 we can't just grab the defs tag on the top and add it\n * to your formula's `` and copy the lot. So we have to replace each\n * `` tag by its ``.\n */\n MathJax.Hub.queue.Push(\n function () {\n const mathjaxMath = $('.MathJax_SVG');\n const svg = $(mathjaxMath.html());\n svg.find('use').each(function () {\n // TODO: find a less pragmatic and more elegant solution to this.\n const id = $(this).attr('href')\n ? $(this).attr('href').slice(1) // Works in Chrome.\n : $(this).attr('xlink:href').slice(1); // Works in Firefox.\n const glymph = $('#' + id).clone().removeAttr('id');\n const x = $(this).attr('x');\n const y = $(this).attr('y');\n const transform = $(this).attr('transform');\n if (transform && (x || y)) {\n glymph.attr('transform', transform + ' translate(' + x + ',' + y + ')');\n } else if (transform) {\n glymph.attr('transform', transform);\n } else if (x || y) {\n glymph.attr('transform', 'translate(' + x + ',' + y + ')');\n }\n $(this).replaceWith(glymph);\n });\n // Remove the style tag because it interferes with SVG-Edit.\n svg.removeAttr('style');\n svg.attr('xmlns', 'http://www.w3.org/2000/svg');\n svgCanvas.importSvgString($('
').append(svg.clone()).html(), true);\n svgCanvas.ungroupSelectedElement();\n // TODO: To undo the adding of the Formula you now have to undo twice.\n // This should only be once!\n svgCanvas.moveSelectedElements(locationX, locationY, true);\n }\n );\n }\n\n const buttons = [{\n id: 'tool_mathjax',\n type: 'mode',\n icon: 'mathjax.png',\n events: {\n async click () {\n // Set the mode.\n svgCanvas.setMode('mathjax');\n\n // Only load Mathjax when needed, we don't want to strain Svg-Edit any more.\n // From this point on it is very probable that it will be needed, so load it.\n if (mathjaxLoaded === false) {\n $(\n '
' +\n '' +\n '
' +\n '$${}$$' +\n '
' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '
' +\n '
' +\n 'Mathematics Editor' +\n '' +\n '' +\n '
' +\n '
' +\n '
'\n ).insertAfter('#svg_prefs').hide();\n\n // Make the MathEditor draggable.\n $('#mathjax_container').draggable({\n cancel: 'button,fieldset',\n containment: 'window'\n });\n\n // Add functionality and picture to cancel button.\n $('#tool_mathjax_cancel').prepend($.getSvgIcon('cancel', true))\n .on('click touched', function () {\n $('#mathjax').hide();\n });\n\n // Add functionality and picture to the save button.\n $('#tool_mathjax_save').prepend($.getSvgIcon('ok', true))\n .on('click touched', function () {\n saveMath();\n $('#mathjax').hide();\n });\n\n // MathJax preprocessing has to ignore most of the page.\n $('body').addClass('tex2jax_ignore');\n\n try {\n await import('./mathjax/MathJax.min.js'); // ?config=TeX-AMS-MML_SVG.js');\n // When MathJax is loaded get the div where the math will be rendered.\n MathJax.Hub.queue.Push(function () {\n math = MathJax.Hub.getAllJax('#mathjax_creator')[0];\n console.log(math); // eslint-disable-line no-console\n mathjaxLoaded = true;\n console.log('MathJax Loaded'); // eslint-disable-line no-console\n });\n } catch (e) {\n console.log('Failed loading MathJax.'); // eslint-disable-line no-console\n $.alert('Failed loading MathJax. You will not be able to change the mathematics.');\n }\n }\n }\n }\n }];\n\n return {\n name: strings.name,\n svgicons: 'mathjax-icons.xml',\n buttons: strings.buttons.map((button, i) => {\n return Object.assign(buttons[i], button);\n }),\n\n mouseDown () {\n if (svgCanvas.getMode() === 'mathjax') {\n return {started: true};\n }\n return undefined;\n },\n mouseUp (opts) {\n if (svgCanvas.getMode() === 'mathjax') {\n // Get the coordinates from your mouse.\n const zoom = svgCanvas.getZoom();\n // Get the actual coordinate by dividing by the zoom value\n locationX = opts.mouse_x / zoom;\n locationY = opts.mouse_y / zoom;\n\n $('#mathjax').show();\n return {started: false}; // Otherwise the last selected object dissapears.\n }\n return undefined;\n },\n callback () {\n $('').appendTo("head")),e.text(t?" #tool_topath { display: none !important; }":""),r("#foreignObject_panel").toggle(t)},n=e,r=t.$,o=t.text2xml,i=t.NS,c=n.canvas,a=t.svgroot.parentNode.ownerDocument,S.next=11,co(n.curPrefs.lang);case 11:return u=S.sent,f=function properlySourceSizeTextArea(){var t=r("#svg_source_container").height()-80;r("#svg_source_textarea").css("height",t)},y=!1,b=[{id:"tool_foreign",icon:"foreignobject-tool.png",type:"mode",events:{click:function click(){c.setMode("foreign")}}},{id:"edit_foreign",icon:"foreignobject-edit.png",type:"context",panel:"foreignObject_panel",events:{click:function click(){g()}}}],w=[{type:"input",panel:"foreignObject_panel",id:"foreign_width",size:3,events:{change:function change(){m("width",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_height",events:{change:function change(){m("height",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_font_size",size:2,defval:16,events:{change:function change(){m("font-size",this.value)}}}],S.abrupt("return",{name:u.name,svgicons:"foreignobject-icons.xml",buttons:u.buttons.map((function(t,e){return Object.assign(b[e],t)})),context_tools:u.contextTools.map((function(t,e){return Object.assign(w[e],t)})),callback:function callback(){r("#foreignObject_panel").hide();var t=function endChanges(){r("#svg_source_editor").hide(),y=!1,r("#svg_source_textarea").blur(),l(!1)};setTimeout((function(){r("#tool_source_save").clone().hide().attr("id","foreign_save").unbind().appendTo("#tool_source_back").click(_asyncToGenerator(regeneratorRuntime.mark((function _callee2(){return regeneratorRuntime.wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(y){e.next=2;break}return e.abrupt("return");case 2:if(d(r("#svg_source_textarea").val())){e.next=11;break}return e.next=5,r.confirm("Errors found. Revert to original?");case 5:if(e.sent){e.next=8;break}return e.abrupt("return");case 8:t(),e.next=12;break;case 11:t();case 12:case"end":return e.stop()}}),_callee2)})))),r("#tool_source_cancel").clone().hide().attr("id","foreign_cancel").unbind().appendTo("#tool_source_back").click((function(){t()}))}),3e3)},mouseDown:function mouseDown(t){if("foreign"===c.getMode()){h=!0,v=c.addSVGElementFromJson({element:"foreignObject",attr:{x:t.start_x,y:t.start_y,id:c.getNextId(),"font-size":16,width:"48",height:"20",style:"pointer-events:inherit"}});var e=a.createElementNS(i.MATH,"math");e.setAttributeNS(i.XMLNS,"xmlns",i.MATH),e.setAttribute("display","inline");var n=a.createElementNS(i.MATH,"mi");n.setAttribute("mathvariant","normal"),n.textContent="Φ";var r=a.createElementNS(i.MATH,"mo");r.textContent="∪";var o=a.createElementNS(i.MATH,"mi");return o.textContent="ℳ",e.append(n,r,o),v.append(e),{started:!0}}},mouseUp:function mouseUp(t){if("foreign"===c.getMode()&&h){var e=r(v).attr(["width","height"]),n="0"!==e.width||"0"!==e.height;return c.addToSelection([v],!0),{keep:n,element:v}}},selectedChanged:function selectedChanged(t){for(var e=(p=t.elems).length;e--;){var n=p[e];n&&"foreignObject"===n.tagName&&t.selectedElement&&!t.multiselected?(r("#foreign_font_size").val(n.getAttribute("font-size")),r("#foreign_width").val(n.getAttribute("width")),r("#foreign_height").val(n.getAttribute("height")),s(!0)):s(!1)}},elementChanged:function elementChanged(t){}});case 17:case"end":return S.stop()}}),_callee3)})))()}}),Object.freeze({__proto__:null,default:{name:"foreignObject",buttons:[{title:"Foreign Object Tool"},{title:"Edit ForeignObject Content"}],contextTools:[{title:"Change foreignObject's width",label:"w"},{title:"Change foreignObject's height",label:"h"},{title:"Change foreignObject's font size",label:"font-size"}]}})),uo=Object.freeze({__proto__:null,default:{name:"外部对象",buttons:[{title:"外部对象工具"},{title:"编辑外部对象内容"}],contextTools:[{title:"改变外部对象宽度",label:"w"},{title:"改变外部对象高度",label:"h"},{title:"改变外部对象文字大小",label:"文字大小"}]}})}}})); + */var ao=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,__variableDynamicImportRuntime0__("./locale/".concat(encodeURIComponent(t),".js"));case 3:e=n.sent,n.next=12;break;case 6:return n.prev=6,n.t0=n.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),n.next=11,Promise.resolve().then((function(){return co}));case 11:e=n.sent;case 12:return n.abrupt("return",e.default);case 13:case"end":return n.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),co=(t("default",{name:"foreignobject",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee3(){var n,r,o,i,a,c,u,f,s,l,p,h,v,y,d,g,m,b,w;return regeneratorRuntime.wrap((function _callee3$(S){for(;;)switch(S.prev=S.next){case 0:return m=function _setAttr(t,e){a.changeSelectedAttribute(t,e),a.call("changed",p)},g=function _showForeignEditor(){var t=p[0];if(t&&!y){y=!0,l(!0),t.removeAttribute("fill");var e=a.svgToString(t,0);r("#svg_source_textarea").val(e),r("#svg_source_editor").fadeIn(),f(),r("#svg_source_textarea").focus()}},d=function _setForeignString(t){var e=p[0];try{var n=o(''+t+"");a.sanitizeSvg(n.documentElement),e.replaceWith(c.importNode(n.documentElement.firstChild,!0)),a.call("changed",[e]),a.clearSelection()}catch(t){return console.log(t),!1}return!0},l=function _toggleSourceButtons(t){r("#tool_source_save, #tool_source_cancel").toggle(!t),r("#foreign_save, #foreign_cancel").toggle(t)},s=function _showPanel(t){var e=r("#fc_rules");e.length||(e=r('').appendTo("head")),e.text(t?" #tool_topath { display: none !important; }":""),r("#foreignObject_panel").toggle(t)},n=e,r=t.$,o=t.text2xml,i=t.NS,a=n.canvas,c=t.svgroot.parentNode.ownerDocument,S.next=11,ao(n.curPrefs.lang);case 11:return u=S.sent,f=function properlySourceSizeTextArea(){var t=r("#svg_source_container").height()-80;r("#svg_source_textarea").css("height",t)},y=!1,b=[{id:"tool_foreign",icon:"foreignobject-tool.png",type:"mode",events:{click:function click(){a.setMode("foreign")}}},{id:"edit_foreign",icon:"foreignobject-edit.png",type:"context",panel:"foreignObject_panel",events:{click:function click(){g()}}}],w=[{type:"input",panel:"foreignObject_panel",id:"foreign_width",size:3,events:{change:function change(){m("width",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_height",events:{change:function change(){m("height",this.value)}}},{type:"input",panel:"foreignObject_panel",id:"foreign_font_size",size:2,defval:16,events:{change:function change(){m("font-size",this.value)}}}],S.abrupt("return",{name:u.name,svgicons:"foreignobject-icons.xml",buttons:u.buttons.map((function(t,e){return Object.assign(b[e],t)})),context_tools:u.contextTools.map((function(t,e){return Object.assign(w[e],t)})),callback:function callback(){r("#foreignObject_panel").hide();var t=function endChanges(){r("#svg_source_editor").hide(),y=!1,r("#svg_source_textarea").blur(),l(!1)};setTimeout((function(){r("#tool_source_save").clone().hide().attr("id","foreign_save").unbind().appendTo("#tool_source_back").click(_asyncToGenerator(regeneratorRuntime.mark((function _callee2(){return regeneratorRuntime.wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(y){e.next=2;break}return e.abrupt("return");case 2:if(d(r("#svg_source_textarea").val())){e.next=11;break}return e.next=5,r.confirm("Errors found. Revert to original?");case 5:if(e.sent){e.next=8;break}return e.abrupt("return");case 8:t(),e.next=12;break;case 11:t();case 12:case"end":return e.stop()}}),_callee2)})))),r("#tool_source_cancel").clone().hide().attr("id","foreign_cancel").unbind().appendTo("#tool_source_back").click((function(){t()}))}),3e3)},mouseDown:function mouseDown(t){if("foreign"===a.getMode()){h=!0,v=a.addSVGElementFromJson({element:"foreignObject",attr:{x:t.start_x,y:t.start_y,id:a.getNextId(),"font-size":16,width:"48",height:"20",style:"pointer-events:inherit"}});var e=c.createElementNS(i.MATH,"math");e.setAttributeNS(i.XMLNS,"xmlns",i.MATH),e.setAttribute("display","inline");var n=c.createElementNS(i.MATH,"mi");n.setAttribute("mathvariant","normal"),n.textContent="Φ";var r=c.createElementNS(i.MATH,"mo");r.textContent="∪";var o=c.createElementNS(i.MATH,"mi");return o.textContent="ℳ",e.append(n,r,o),v.append(e),{started:!0}}},mouseUp:function mouseUp(t){if("foreign"===a.getMode()&&h){var e=r(v).attr(["width","height"]),n="0"!==e.width||"0"!==e.height;return a.addToSelection([v],!0),{keep:n,element:v}}},selectedChanged:function selectedChanged(t){for(var e=(p=t.elems).length;e--;){var n=p[e];n&&"foreignObject"===n.tagName&&t.selectedElement&&!t.multiselected?(r("#foreign_font_size").val(n.getAttribute("font-size")),r("#foreign_width").val(n.getAttribute("width")),r("#foreign_height").val(n.getAttribute("height")),s(!0)):s(!1)}},elementChanged:function elementChanged(t){}});case 17:case"end":return S.stop()}}),_callee3)})))()}}),Object.freeze({__proto__:null,default:{name:"foreignObject",buttons:[{title:"Foreign Object Tool"},{title:"Edit ForeignObject Content"}],contextTools:[{title:"Change foreignObject's width",label:"w"},{title:"Change foreignObject's height",label:"h"},{title:"Change foreignObject's font size",label:"font-size"}]}})),uo=Object.freeze({__proto__:null,default:{name:"外部对象",buttons:[{title:"外部对象工具"},{title:"编辑外部对象内容"}],contextTools:[{title:"改变外部对象宽度",label:"w"},{title:"改变外部对象高度",label:"h"},{title:"改变外部对象文字大小",label:"文字大小"}]}})}}})); diff --git a/dist/editor/system/extensions/ext-grid/ext-grid.js b/dist/editor/system/extensions/ext-grid/ext-grid.js index 1933987c..140fc78e 100644 --- a/dist/editor/system/extensions/ext-grid/ext-grid.js +++ b/dist/editor/system/extensions/ext-grid/ext-grid.js @@ -1,4 +1,4 @@ -System.register([],(function(t){"use strict";return{execute:function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},r=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof e&&e)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},n=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a={f:i&&!o.call({1:2},1)?function propertyIsEnumerable(t){var e=i(this,t);return!!e&&e.enumerable}:o},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},c={}.toString,classofRaw=function(t){return c.call(t).slice(8,-1)},u="".split,f=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?u.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return f(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},s={}.hasOwnProperty,has=function(t,e){return s.call(t,e)},l=r.document,p=isObject(l)&&isObject(l.createElement),documentCreateElement=function(t){return p?l.createElement(t):{}},h=!n&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),y=Object.getOwnPropertyDescriptor,v={f:n?y:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),h)try{return y(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!a.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},d=Object.defineProperty,g={f:n?d:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),h)try{return d(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}},m=n?function(t,e,r){return g.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,e){try{m(r,t,e)}catch(n){r[t]=e}return e},b="__core-js_shared__",w=r[b]||setGlobal(b,{}),S=Function.toString;"function"!=typeof w.inspectSource&&(w.inspectSource=function(t){return S.call(t)});var O,j,x,E=w.inspectSource,P=r.WeakMap,_="function"==typeof P&&/native code/.test(E(P)),T=createCommonjsModule((function(t){(t.exports=function(t,e){return w[t]||(w[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),A=0,k=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++A+k).toString(36)},L=T("keys"),sharedKey=function(t){return L[t]||(L[t]=uid(t))},G={},I=r.WeakMap;if(_){var C=new I,M=C.get,N=C.has,R=C.set;O=function(t,e){return R.call(C,t,e),e},j=function(t){return M.call(C,t)||{}},x=function(t){return N.call(C,t)}}else{var D=sharedKey("state");G[D]=!0,O=function(t,e){return m(t,D,e),e},j=function(t){return has(t,D)?t[D]:{}},x=function(t){return has(t,D)}}var V,U,z={set:O,get:j,has:x,enforce:function(t){return x(t)?j(t):O(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=j(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},W=createCommonjsModule((function(t){var e=z.get,n=z.enforce,o=String(String).split("String");(t.exports=function(t,e,i,a){var c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,f=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||has(i,"name")||m(i,"name",e),n(i).source=o.join("string"==typeof e?e:"")),t!==r?(c?!f&&t[e]&&(u=!0):delete t[e],u?t[e]=i:m(t,e,i)):u?t[e]=i:setGlobal(e,i)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&e(this).source||E(this)}))})),q=r,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,e){return arguments.length<2?aFunction(q[t])||aFunction(r[t]):q[t]&&q[t][e]||r[t]&&r[t][e]},B=Math.ceil,H=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?H:B)(t)},Y=Math.min,toLength=function(t){return t>0?Y(toInteger(t),9007199254740991):0},$=Math.max,J=Math.min,toAbsoluteIndex=function(t,e){var r=toInteger(t);return r<0?$(r+e,0):J(r,e)},createMethod=function(t){return function(e,r,n){var o,i=toIndexedObject(e),a=toLength(i.length),c=toAbsoluteIndex(n,a);if(t&&r!=r){for(;a>c;)if((o=i[c++])!=o)return!0}else for(;a>c;c++)if((t||c in i)&&i[c]===r)return t||c||0;return!t&&-1}},K={includes:createMethod(!0),indexOf:createMethod(!1)}.indexOf,objectKeysInternal=function(t,e){var r,n=toIndexedObject(t),o=0,i=[];for(r in n)!has(G,r)&&has(n,r)&&i.push(r);for(;e.length>o;)has(n,r=e[o++])&&(~K(i,r)||i.push(r));return i},Q=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],X=Q.concat("length","prototype"),Z={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,X)}},tt={f:Object.getOwnPropertySymbols},et=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var e=Z.f(anObject(t)),r=tt.f;return r?e.concat(r(t)):e},copyConstructorProperties=function(t,e){for(var r=et(e),n=g.f,o=v.f,i=0;im;m++)if((a||m in v)&&(h=d(p=v[m],m,y),t))if(e)w[m]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:dt.call(w,p)}else if(o)return!1;return i?-1:n||o?o:w}},gt={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},mt=getBuiltIn("navigator","userAgent")||"",bt=r.process,wt=bt&&bt.versions,St=wt&&wt.v8;St?U=(V=St.split("."))[0]+V[1]:mt&&(!(V=mt.match(/Edge\/(\d+)/))||V[1]>=74)&&(V=mt.match(/Chrome\/(\d+)/))&&(U=V[1]);var Ot=U&&+U,jt=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return Ot>=51||!fails((function(){var e=[];return(e.constructor={})[jt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},xt=Object.defineProperty,Et={},thrower=function(t){throw t},arrayMethodUsesToLength=function(t,e){if(has(Et,t))return Et[t];e||(e={});var r=[][t],o=!!has(e,"ACCESSORS")&&e.ACCESSORS,i=has(e,0)?e[0]:thrower,a=has(e,1)?e[1]:void 0;return Et[t]=!!r&&!fails((function(){if(o&&!n)return!0;var t={length:-1};o?xt(t,1,{enumerable:!0,get:thrower}):t[1]=1,r.call(t,i,a)}))},Pt=gt.map,_t=arrayMethodHasSpeciesSupport("map"),Tt=arrayMethodUsesToLength("map");_export({target:"Array",proto:!0,forced:!_t||!Tt},{map:function map(t){return Pt(this,t,arguments.length>1?arguments[1]:void 0)}});var arrayMethodIsStrict=function(t,e){var r=[][t];return!!r&&fails((function(){r.call(null,e||function(){throw 1},1)}))},At=gt.some,kt=arrayMethodIsStrict("some"),Lt=arrayMethodUsesToLength("some");_export({target:"Array",proto:!0,forced:!kt||!Lt},{some:function some(t){return At(this,t,arguments.length>1?arguments[1]:void 0)}});var Gt=g.f,It=Function.prototype,Ct=It.toString,Mt=/^\s*function ([^ (]*)/,Ft="name";n&&!(Ft in It)&&Gt(It,Ft,{configurable:!0,get:function(){try{return Ct.call(this).match(Mt)[1]}catch(t){return""}}});var Nt=Object.keys||function keys(t){return objectKeysInternal(t,Q)},Rt=Object.assign,Dt=Object.defineProperty,Vt=!Rt||fails((function(){if(n&&1!==Rt({b:1},Rt(Dt({},"a",{enumerable:!0,get:function(){Dt(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol(),o="abcdefghijklmnopqrst";return t[r]=7,o.split("").forEach((function(t){e[t]=t})),7!=Rt({},t)[r]||Nt(Rt({},e)).join("")!=o}))?function assign(t,e){for(var r=toObject(t),o=arguments.length,i=1,c=tt.f,u=a.f;o>i;)for(var s,l=f(arguments[i++]),p=c?Nt(l).concat(c(l)):Nt(l),h=p.length,y=0;h>y;)s=p[y++],n&&!u.call(l,s)||(r[s]=l[s]);return r}:Rt;_export({target:"Object",stat:!0,forced:Object.assign!==Vt},{assign:Vt});var Ut={};Ut[wellKnownSymbol("toStringTag")]="z";var zt="[object z]"===String(Ut),Wt=wellKnownSymbol("toStringTag"),qt="Arguments"==classofRaw(function(){return arguments}()),Bt=zt?classofRaw:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),Wt))?r:qt?classofRaw(e):"Object"==(n=classofRaw(e))&&"function"==typeof e.callee?"Arguments":n},Ht=zt?{}.toString:function toString(){return"[object "+Bt(this)+"]"};zt||W(Object.prototype,"toString",Ht,{unsafe:!0});var Yt=r.Promise,$t=g.f,Jt=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,r){t&&!has(t=r?t:t.prototype,Jt)&&$t(t,Jt,{configurable:!0,value:e})},Kt=wellKnownSymbol("species"),Qt={},Xt=wellKnownSymbol("iterator"),Zt=Array.prototype,te=wellKnownSymbol("iterator"),callWithSafeIterationClosing=function(t,e,r,n){try{return n?e(anObject(r)[0],r[1]):e(r)}catch(e){var o=t.return;throw void 0!==o&&anObject(o.call(t)),e}},ee=createCommonjsModule((function(t){var Result=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,r,n,o){var i,a,c,u,f,s,l,p,h=functionBindContext(e,r,n?2:1);if(o)i=t;else{if("function"!=typeof(a=function(t){if(null!=t)return t[te]||t["@@iterator"]||Qt[Bt(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(p=a)&&(Qt.Array===p||Zt[Xt]===p)){for(c=0,u=toLength(t.length);u>c;c++)if((f=n?h(anObject(l=t[c])[0],l[1]):h(t[c]))&&f instanceof Result)return f;return new Result(!1)}i=a.call(t)}for(s=i.next;!(l=s.call(i)).done;)if("object"==typeof(f=callWithSafeIterationClosing(i,h,l.value,n))&&f&&f instanceof Result)return f;return new Result(!1)}).stop=function(t){return new Result(!0,t)}})),re=wellKnownSymbol("iterator"),ne=!1;try{var oe=0,ie={next:function(){return{done:!!oe++}},return:function(){ne=!0}};ie[re]=function(){return this},Array.from(ie,(function(){throw 2}))}catch(t){}var ae,ce,ue,fe=wellKnownSymbol("species"),se=getBuiltIn("document","documentElement"),le=/(iphone|ipod|ipad).*applewebkit/i.test(mt),pe=r.location,he=r.setImmediate,ye=r.clearImmediate,ve=r.process,de=r.MessageChannel,ge=r.Dispatch,me=0,be={},we="onreadystatechange",run=function(t){if(be.hasOwnProperty(t)){var e=be[t];delete be[t],e()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){r.postMessage(t+"",pe.protocol+"//"+pe.host)};he&&ye||(he=function setImmediate(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return be[++me]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},ae(me),me},ye=function clearImmediate(t){delete be[t]},"process"==classofRaw(ve)?ae=function(t){ve.nextTick(runner(t))}:ge&&ge.now?ae=function(t){ge.now(runner(t))}:de&&!le?(ue=(ce=new de).port2,ce.port1.onmessage=listener,ae=functionBindContext(ue.postMessage,ue,1)):!r.addEventListener||"function"!=typeof postMessage||r.importScripts||fails(post)||"file:"===pe.protocol?ae=we in documentCreateElement("script")?function(t){se.appendChild(documentCreateElement("script")).onreadystatechange=function(){se.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}:(ae=post,r.addEventListener("message",listener,!1)));var Se,Oe,je,xe,Ee,Pe,_e,Te,Ae={set:he,clear:ye},ke=v.f,Le=Ae.set,Ge=r.MutationObserver||r.WebKitMutationObserver,Ie=r.process,Ce=r.Promise,Me="process"==classofRaw(Ie),Fe=ke(r,"queueMicrotask"),Ne=Fe&&Fe.value;Ne||(Se=function(){var t,e;for(Me&&(t=Ie.domain)&&t.exit();Oe;){e=Oe.fn,Oe=Oe.next;try{e()}catch(t){throw Oe?xe():je=void 0,t}}je=void 0,t&&t.enter()},Me?xe=function(){Ie.nextTick(Se)}:Ge&&!le?(Ee=!0,Pe=document.createTextNode(""),new Ge(Se).observe(Pe,{characterData:!0}),xe=function(){Pe.data=Ee=!Ee}):Ce&&Ce.resolve?(_e=Ce.resolve(void 0),Te=_e.then,xe=function(){Te.call(_e,Se)}):xe=function(){Le.call(r,Se)});var Re,De,Ve,Ue,ze=Ne||function(t){var e={fn:t,next:void 0};je&&(je.next=e),Oe||(Oe=e,xe()),je=e},PromiseCapability=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=aFunction$1(e),this.reject=aFunction$1(r)},We={f:function(t){return new PromiseCapability(t)}},promiseResolve=function(t,e){if(anObject(t),isObject(e)&&e.constructor===t)return e;var r=We.f(t);return(0,r.resolve)(e),r.promise},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},qe=Ae.set,Be=wellKnownSymbol("species"),He="Promise",Ye=z.get,$e=z.set,Je=z.getterFor(He),Ke=Yt,Qe=r.TypeError,Xe=r.document,Ze=r.process,tr=getBuiltIn("fetch"),er=We.f,rr=er,nr="process"==classofRaw(Ze),or=!!(Xe&&Xe.createEvent&&r.dispatchEvent),ir="unhandledrejection",ar=ct(He,(function(){if(!(E(Ke)!==String(Ke))){if(66===Ot)return!0;if(!nr&&"function"!=typeof PromiseRejectionEvent)return!0}if(Ot>=51&&/native code/.test(Ke))return!1;var t=Ke.resolve(1),FakePromise=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Be]=FakePromise,!(t.then((function(){}))instanceof FakePromise)})),cr=ar||!function(t,e){if(!e&&!ne)return!1;var r=!1;try{var n={};n[re]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(t){}return r}((function(t){Ke.all(t).catch((function(){}))})),isThenable=function(t){var e;return!(!isObject(t)||"function"!=typeof(e=t.then))&&e},notify$1=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;ze((function(){for(var o=e.value,i=1==e.state,a=0;n.length>a;){var c,u,f,s=n[a++],l=i?s.ok:s.fail,p=s.resolve,h=s.reject,y=s.domain;try{l?(i||(2===e.rejection&&onHandleUnhandled(t,e),e.rejection=1),!0===l?c=o:(y&&y.enter(),c=l(o),y&&(y.exit(),f=!0)),c===s.promise?h(Qe("Promise-chain cycle")):(u=isThenable(c))?u.call(c,p,h):p(c)):h(o)}catch(t){y&&!f&&y.exit(),h(t)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&onUnhandled(t,e)}))}},dispatchEvent=function(t,e,n){var o,i;or?((o=Xe.createEvent("Event")).promise=e,o.reason=n,o.initEvent(t,!1,!0),r.dispatchEvent(o)):o={promise:e,reason:n},(i=r["on"+t])?i(o):t===ir&&function(t,e){var n=r.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)},onUnhandled=function(t,e){qe.call(r,(function(){var r,n=e.value;if(isUnhandled(e)&&(r=perform((function(){nr?Ze.emit("unhandledRejection",n,t):dispatchEvent(ir,t,n)})),e.rejection=nr||isUnhandled(e)?2:1,r.error))throw r.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t,e){qe.call(r,(function(){nr?Ze.emit("rejectionHandled",t):dispatchEvent("rejectionhandled",t,e.value)}))},bind=function(t,e,r,n){return function(o){t(e,r,o,n)}},internalReject=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=2,notify$1(t,e,!0))},internalResolve=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw Qe("Promise can't be resolved itself");var o=isThenable(r);o?ze((function(){var n={done:!1};try{o.call(r,bind(internalResolve,t,n,e),bind(internalReject,t,n,e))}catch(r){internalReject(t,n,r,e)}})):(e.value=r,e.state=1,notify$1(t,e,!1))}catch(r){internalReject(t,{done:!1},r,e)}}};ar&&(Ke=function Promise(t){!function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation")}(this,Ke,He),aFunction$1(t),Re.call(this);var e=Ye(this);try{t(bind(internalResolve,this,e),bind(internalReject,this,e))}catch(t){internalReject(this,e,t)}},(Re=function Promise(t){$e(this,{type:He,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(t,e,r){for(var n in e)W(t,n,e[n],r);return t}(Ke.prototype,{then:function then(t,e){var r,n,o,i=Je(this),a=er((r=Ke,void 0===(o=anObject(this).constructor)||null==(n=anObject(o)[fe])?r:aFunction$1(n)));return a.ok="function"!=typeof t||t,a.fail="function"==typeof e&&e,a.domain=nr?Ze.domain:void 0,i.parent=!0,i.reactions.push(a),0!=i.state&¬ify$1(this,i,!1),a.promise},catch:function(t){return this.then(void 0,t)}}),De=function(){var t=new Re,e=Ye(t);this.promise=t,this.resolve=bind(internalResolve,t,e),this.reject=bind(internalReject,t,e)},We.f=er=function(t){return t===Ke||t===Ve?new De(t):rr(t)},"function"==typeof Yt&&(Ue=Yt.prototype.then,W(Yt.prototype,"then",(function then(t,e){var r=this;return new Ke((function(t,e){Ue.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof tr&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function fetch(t){return promiseResolve(Ke,tr.apply(r,arguments))}}))),_export({global:!0,wrap:!0,forced:ar},{Promise:Ke}),setToStringTag(Ke,He,!1),function(t){var e=getBuiltIn(t),r=g.f;n&&e&&!e[Kt]&&r(e,Kt,{configurable:!0,get:function(){return this}})}(He),Ve=getBuiltIn(He),_export({target:He,stat:!0,forced:ar},{reject:function reject(t){var e=er(this);return e.reject.call(void 0,t),e.promise}}),_export({target:He,stat:!0,forced:ar},{resolve:function resolve(t){return promiseResolve(this,t)}}),_export({target:He,stat:!0,forced:cr},{all:function all(t){var e=this,r=er(e),n=r.resolve,o=r.reject,i=perform((function(){var r=aFunction$1(e.resolve),i=[],a=0,c=1;ee(t,(function(t){var u=a++,f=!1;i.push(void 0),c++,r.call(e,t).then((function(t){f||(f=!0,i[u]=t,--c||n(i))}),o)})),--c||n(i)}));return i.error&&o(i.value),r.promise},race:function race(t){var e=this,r=er(e),n=r.reject,o=perform((function(){var o=aFunction$1(e.resolve);ee(t,(function(t){o.call(e,t).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}});var ur,fr=n?Object.defineProperties:function defineProperties(t,e){anObject(t);for(var r,n=Nt(e),o=n.length,i=0;o>i;)g.f(t,r=n[i++],e[r]);return t},sr=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"