react-svg 14.0.16 → 14.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/ReactSVG.d.ts +2 -0
- package/dist/react-svg.cjs.development.js +8 -3
- package/dist/react-svg.cjs.development.js.map +1 -1
- package/dist/react-svg.cjs.production.js +1 -1
- package/dist/react-svg.cjs.production.js.map +1 -1
- package/dist/react-svg.esm.js +8 -3
- package/dist/react-svg.esm.js.map +1 -1
- package/dist/react-svg.umd.development.js +8 -3
- package/dist/react-svg.umd.development.js.map +1 -1
- package/dist/react-svg.umd.production.js +1 -1
- package/dist/react-svg.umd.production.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ render(<ReactSVG src="svg.svg" />, document.getElementById('root'))
|
|
|
51
51
|
- `beforeInjection(svg)` - _Optional_ Function to call just before the SVG is injected. `svg` is the SVG DOM element which is about to be injected. Defaults to `() => {}`.
|
|
52
52
|
- `evalScripts` - _Optional_ Run any script blocks found in the SVG. One of `'always'`, `'once'`, or `'never'`. Defaults to `'never'`.
|
|
53
53
|
- `fallback` - _Optional_ Fallback to use if an injection error occurs. Can be a string, class component, or function component. Defaults to `null`.
|
|
54
|
+
- `httpRequestWithCredentials` - _Optional_ Boolean indicating if cross-site Access-Control requests for the SVG should be made using credentials. Defaults to `false`.
|
|
54
55
|
- `loading` - _Optional_ Component to use during loading. Can be a string, class component, or function component. Defaults to `null`.
|
|
55
56
|
- `renumerateIRIElements` - _Optional_ Boolean indicating if SVG IRI addressable elements should be renumerated. Defaults to `true`.
|
|
56
57
|
- `useRequestCache` - _Optional_ Use SVG request cache. Defaults to `true`.
|
|
@@ -76,6 +77,7 @@ Other non-documented properties are applied to the outermost wrapper element.
|
|
|
76
77
|
className="wrapper-class-name"
|
|
77
78
|
evalScripts="always"
|
|
78
79
|
fallback={() => <span>Error!</span>}
|
|
80
|
+
httpRequestWithCredentials={true}
|
|
79
81
|
loading={() => <span>Loading</span>}
|
|
80
82
|
onClick={() => {
|
|
81
83
|
console.log('wrapper onClick')
|
package/dist/ReactSVG.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class ReactSVG extends React.Component<Props, State> {
|
|
|
7
7
|
beforeInjection: () => undefined;
|
|
8
8
|
evalScripts: string;
|
|
9
9
|
fallback: null;
|
|
10
|
+
httpRequestWithCredentials: boolean;
|
|
10
11
|
loading: null;
|
|
11
12
|
renumerateIRIElements: boolean;
|
|
12
13
|
useRequestCache: boolean;
|
|
@@ -17,6 +18,7 @@ export declare class ReactSVG extends React.Component<Props, State> {
|
|
|
17
18
|
beforeInjection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
19
|
evalScripts: PropTypes.Requireable<string>;
|
|
19
20
|
fallback: PropTypes.Requireable<string | object>;
|
|
21
|
+
httpRequestWithCredentials: PropTypes.Requireable<boolean>;
|
|
20
22
|
loading: PropTypes.Requireable<string | object>;
|
|
21
23
|
renumerateIRIElements: PropTypes.Requireable<boolean>;
|
|
22
24
|
src: PropTypes.Validator<string>;
|
|
@@ -52,7 +52,7 @@ var shallowDiffers = function shallowDiffers(a, b) {
|
|
|
52
52
|
return false;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
55
|
+
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
56
56
|
var svgNamespace = 'http://www.w3.org/2000/svg';
|
|
57
57
|
var xlinkNamespace = 'http://www.w3.org/1999/xlink';
|
|
58
58
|
var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
@@ -92,6 +92,7 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
92
92
|
var _this$props = this.props,
|
|
93
93
|
beforeInjection = _this$props.beforeInjection,
|
|
94
94
|
evalScripts = _this$props.evalScripts,
|
|
95
|
+
httpRequestWithCredentials = _this$props.httpRequestWithCredentials,
|
|
95
96
|
renumerateIRIElements = _this$props.renumerateIRIElements,
|
|
96
97
|
src = _this$props.src,
|
|
97
98
|
useRequestCache = _this$props.useRequestCache;
|
|
@@ -147,6 +148,7 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
147
148
|
beforeEach: beforeInjection,
|
|
148
149
|
cacheRequests: useRequestCache,
|
|
149
150
|
evalScripts: evalScripts,
|
|
151
|
+
httpRequestWithCredentials: httpRequestWithCredentials,
|
|
150
152
|
renumerateIRIElements: renumerateIRIElements
|
|
151
153
|
});
|
|
152
154
|
}
|
|
@@ -191,8 +193,9 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
191
193
|
_this$props2.afterInjection;
|
|
192
194
|
_this$props2.beforeInjection;
|
|
193
195
|
_this$props2.evalScripts;
|
|
194
|
-
var Fallback = _this$props2.fallback
|
|
195
|
-
|
|
196
|
+
var Fallback = _this$props2.fallback;
|
|
197
|
+
_this$props2.httpRequestWithCredentials;
|
|
198
|
+
var Loading = _this$props2.loading;
|
|
196
199
|
_this$props2.renumerateIRIElements;
|
|
197
200
|
_this$props2.src;
|
|
198
201
|
_this$props2.useRequestCache;
|
|
@@ -222,6 +225,7 @@ ReactSVG.defaultProps = {
|
|
|
222
225
|
},
|
|
223
226
|
evalScripts: 'never',
|
|
224
227
|
fallback: null,
|
|
228
|
+
httpRequestWithCredentials: false,
|
|
225
229
|
loading: null,
|
|
226
230
|
renumerateIRIElements: true,
|
|
227
231
|
useRequestCache: true,
|
|
@@ -232,6 +236,7 @@ ReactSVG.propTypes = {
|
|
|
232
236
|
beforeInjection: PropTypes__namespace.func,
|
|
233
237
|
evalScripts: PropTypes__namespace.oneOf(['always', 'once', 'never']),
|
|
234
238
|
fallback: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
239
|
+
httpRequestWithCredentials: PropTypes__namespace.bool,
|
|
235
240
|
loading: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
236
241
|
renumerateIRIElements: PropTypes__namespace.bool,
|
|
237
242
|
src: PropTypes__namespace.string.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-svg.cjs.development.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAC7B,OAAK,IAAMC,CAAX,IAAgBF,CAAhB,EAAmB;AACf,QAAI,EAAEE,CAAC,IAAID,CAAP,CAAJ,EAAe;AACX,aAAO,IAAP;AACH;AACJ;;AACD,OAAK,IAAMC,EAAX,IAAgBD,CAAhB,EAAmB;AACf,QAAID,CAAC,CAACE,EAAD,CAAD,KAASD,CAAC,CAACC,EAAD,CAAd,EAAmB;AACf,aAAO,IAAP;AACH;AACJ;;AACD,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,oBAAS,CAACI,MAFe,EAGzBJ,oBAAS,CAACK,MAHe,CAApB,CATM;AAcf9C,EAAAA,qBAAqB,EAAEyC,oBAAS,CAACM,IAdlB;AAef9C,EAAAA,GAAG,EAAEwC,oBAAS,CAACK,MAAV,CAAiBE,UAfP;AAgBf9C,EAAAA,eAAe,EAAEuC,oBAAS,CAACM,IAhBZ;AAiBf3C,EAAAA,OAAO,EAAEqC,oBAAS,CAACE,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAhB;AAjBM;;;;"}
|
|
1
|
+
{"version":3,"file":"react-svg.cjs.development.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAC7B,OAAK,IAAMC,CAAX,IAAgBF,CAAhB,EAAmB;AACf,QAAI,EAAEE,CAAC,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Z;AAGf5C,EAAAA,WAAW,EAAE2C,oBAAS,CAACE,KAAV,CAAgB,CAAC,QAAD,EAAW,MAAX,EAAmB,OAAnB,CAAhB,CAHE;AAIff,EAAAA,QAAQ,EAAEa,oBAAS,CAACG,SAAV,CAAoB,CAC1BH,oBAAS,CAACC,IADgB,EAE1BD,oBAAS,CAACI,MAFgB,EAG1BJ,oBAAS,CAACK,MAHgB,CAApB,CAJK;AASf/C,EAAAA,0BAA0B,EAAE0C,oBAAS,CAACM,IATvB;AAUfjB,EAAAA,OAAO,EAAEW,oBAAS,CAACG,SAAV,CAAoB,CACzBH,oBAAS,CAACC,IADe,EAEzBD,oBAAS,CAACI,MAFe,EAGzBJ,oBAAS,CAACK,MAHe,CAApB,CAVM;AAef9C,EAAAA,qBAAqB,EAAEyC,oBAAS,CAACM,IAflB;AAgBf9C,EAAAA,GAAG,EAAEwC,oBAAS,CAACK,MAAV,CAAiBE,UAhBP;AAiBf9C,EAAAA,eAAe,EAAEuC,oBAAS,CAACM,IAjBZ;AAkBf3C,EAAAA,OAAO,EAAEqC,oBAAS,CAACE,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAhB;AAlBM;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),svgInjector=require("@tanem/svg-injector"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__namespace=_interopNamespace(React),shallowDiffers=function(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1},_excluded=["afterInjection","beforeInjection","evalScripts","fallback","loading","renumerateIRIElements","src","useRequestCache","wrapper"],svgNamespace="http://www.w3.org/2000/svg",xlinkNamespace="http://www.w3.org/1999/xlink",ReactSVG=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))||this).initialState={hasError:!1,isLoading:!0},t.state=t.initialState,t._isMounted=!1,t.reactWrapper=void 0,t.nonReactWrapper=void 0,t.refCallback=function(e){t.reactWrapper=e},t}_inheritsLoose__default.default(t,e);var r=t.prototype;return r.renderSVG=function(){var e=this;if(this.reactWrapper instanceof Node){var t,r,n=this.props,a=n.beforeInjection,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),svgInjector=require("@tanem/svg-injector"),React=require("react");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var _extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__namespace=_interopNamespace(React),shallowDiffers=function(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1},_excluded=["afterInjection","beforeInjection","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","useRequestCache","wrapper"],svgNamespace="http://www.w3.org/2000/svg",xlinkNamespace="http://www.w3.org/1999/xlink",ReactSVG=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))||this).initialState={hasError:!1,isLoading:!0},t.state=t.initialState,t._isMounted=!1,t.reactWrapper=void 0,t.nonReactWrapper=void 0,t.refCallback=function(e){t.reactWrapper=e},t}_inheritsLoose__default.default(t,e);var r=t.prototype;return r.renderSVG=function(){var e=this;if(this.reactWrapper instanceof Node){var t,r,n=this.props,a=n.beforeInjection,i=n.evalScripts,o=n.httpRequestWithCredentials,s=n.renumerateIRIElements,c=n.src,u=n.useRequestCache,l=this.props.afterInjection,p=this.props.wrapper;"svg"===p?((t=document.createElementNS(svgNamespace,p)).setAttribute("xmlns",svgNamespace),t.setAttribute("xmlns:xlink",xlinkNamespace),r=document.createElementNS(svgNamespace,p)):(t=document.createElement(p),r=document.createElement(p)),t.appendChild(r),r.dataset.src=c,this.nonReactWrapper=this.reactWrapper.appendChild(t);svgInjector.SVGInjector(r,{afterEach:function(t,r){!t||(e.removeSVG(),e._isMounted)?e._isMounted&&e.setState((function(){return{hasError:!!t,isLoading:!1}}),(function(){l(t,r)})):l(t)},beforeEach:a,cacheRequests:u,evalScripts:i,httpRequestWithCredentials:o,renumerateIRIElements:s})}},r.removeSVG=function(){var e;null!=(e=this.nonReactWrapper)&&e.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},r.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},r.componentDidUpdate=function(e){var t=this;shallowDiffers(e,this.props)&&this.setState((function(){return t.initialState}),(function(){t.removeSVG(),t.renderSVG()}))},r.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},r.render=function(){var e=this.props,t=e.fallback,r=e.loading,n=e.wrapper,a=_objectWithoutPropertiesLoose__default.default(e,_excluded);return React__namespace.createElement(n,_extends__default.default({},a,{ref:this.refCallback},"svg"===n?{xmlns:svgNamespace,xmlnsXlink:xlinkNamespace}:{}),this.state.isLoading&&r&&React__namespace.createElement(r,null),this.state.hasError&&t&&React__namespace.createElement(t,null))},t}(React__namespace.Component);ReactSVG.defaultProps={afterInjection:function(){},beforeInjection:function(){},evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,renumerateIRIElements:!0,useRequestCache:!0,wrapper:"div"},exports.ReactSVG=ReactSVG;
|
|
2
2
|
//# sourceMappingURL=react-svg.cjs.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-svg.cjs.production.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_this","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","this","Node","nonReactTarget","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","document","createElementNS","setAttribute","createElement","appendChild","dataset","SVGInjector","afterEach","error","svg","_this2","removeSVG","setState","beforeEach","cacheRequests","_this$nonReactWrapper","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","_this3","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"89BACMA,eAAiB,SAACC,EAAGC,OAClB,IAAMC,KAAKF,OACNE,KAAKD,UACA,MAGV,IAAMC,KAAKD,KACRD,EAAEE,KAAOD,EAAEC,UACJ,SAGR
|
|
1
|
+
{"version":3,"file":"react-svg.cjs.production.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_this","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","this","Node","nonReactTarget","props","beforeInjection","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","document","createElementNS","setAttribute","createElement","appendChild","dataset","SVGInjector","afterEach","error","svg","_this2","removeSVG","setState","beforeEach","cacheRequests","_this$nonReactWrapper","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","_this3","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"89BACMA,eAAiB,SAACC,EAAGC,OAClB,IAAMC,KAAKF,OACNE,KAAKD,UACA,MAGV,IAAMC,KAAKD,KACRD,EAAEE,KAAOD,EAAEC,UACJ,SAGR,4KCRLC,aAAe,6BACfC,eAAiB,+BACVC,6JAgCTC,aAAe,CACXC,UAAU,EACVC,WAAW,KAEfC,MAAQC,EAAKJ,eACbK,YAAa,IACbC,sBACAC,yBACAC,YAAc,SAACF,KACNA,aAAeA,qEAExBG,UAAA,yBAEQC,KAAKJ,wBAAwBK,KAAM,KAM/BJ,EACAK,IAN+GF,KAAKG,MAAhHC,IAAAA,gBAAiBC,IAAAA,YAAaC,IAAAA,2BAA4BC,IAAAA,sBAAuBC,IAAAA,IAAKC,IAAAA,gBAExFC,EAAiBV,KAAKG,MAAMO,eAC5BC,EAAUX,KAAKG,MAAMQ,QAIX,QAAZA,IACAd,EAAkBe,SAASC,gBAAgB1B,aAAcwB,IACzCG,aAAa,QAAS3B,cACtCU,EAAgBiB,aAAa,cAAe1B,gBAC5Cc,EAAiBU,SAASC,gBAAgB1B,a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EACvBE,iBAAiB,EACjBE,QAAS"}
|
package/dist/react-svg.esm.js
CHANGED
|
@@ -22,7 +22,7 @@ var shallowDiffers = function shallowDiffers(a, b) {
|
|
|
22
22
|
return false;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
25
|
+
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
26
26
|
var svgNamespace = 'http://www.w3.org/2000/svg';
|
|
27
27
|
var xlinkNamespace = 'http://www.w3.org/1999/xlink';
|
|
28
28
|
var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
@@ -62,6 +62,7 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
62
62
|
var _this$props = this.props,
|
|
63
63
|
beforeInjection = _this$props.beforeInjection,
|
|
64
64
|
evalScripts = _this$props.evalScripts,
|
|
65
|
+
httpRequestWithCredentials = _this$props.httpRequestWithCredentials,
|
|
65
66
|
renumerateIRIElements = _this$props.renumerateIRIElements,
|
|
66
67
|
src = _this$props.src,
|
|
67
68
|
useRequestCache = _this$props.useRequestCache;
|
|
@@ -117,6 +118,7 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
117
118
|
beforeEach: beforeInjection,
|
|
118
119
|
cacheRequests: useRequestCache,
|
|
119
120
|
evalScripts: evalScripts,
|
|
121
|
+
httpRequestWithCredentials: httpRequestWithCredentials,
|
|
120
122
|
renumerateIRIElements: renumerateIRIElements
|
|
121
123
|
});
|
|
122
124
|
}
|
|
@@ -161,8 +163,9 @@ var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
|
161
163
|
_this$props2.afterInjection;
|
|
162
164
|
_this$props2.beforeInjection;
|
|
163
165
|
_this$props2.evalScripts;
|
|
164
|
-
var Fallback = _this$props2.fallback
|
|
165
|
-
|
|
166
|
+
var Fallback = _this$props2.fallback;
|
|
167
|
+
_this$props2.httpRequestWithCredentials;
|
|
168
|
+
var Loading = _this$props2.loading;
|
|
166
169
|
_this$props2.renumerateIRIElements;
|
|
167
170
|
_this$props2.src;
|
|
168
171
|
_this$props2.useRequestCache;
|
|
@@ -192,6 +195,7 @@ ReactSVG.defaultProps = {
|
|
|
192
195
|
},
|
|
193
196
|
evalScripts: 'never',
|
|
194
197
|
fallback: null,
|
|
198
|
+
httpRequestWithCredentials: false,
|
|
195
199
|
loading: null,
|
|
196
200
|
renumerateIRIElements: true,
|
|
197
201
|
useRequestCache: true,
|
|
@@ -202,6 +206,7 @@ ReactSVG.propTypes = {
|
|
|
202
206
|
beforeInjection: PropTypes.func,
|
|
203
207
|
evalScripts: PropTypes.oneOf(['always', 'once', 'never']),
|
|
204
208
|
fallback: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
|
|
209
|
+
httpRequestWithCredentials: PropTypes.bool,
|
|
205
210
|
loading: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
|
|
206
211
|
renumerateIRIElements: PropTypes.bool,
|
|
207
212
|
src: PropTypes.string.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-svg.esm.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;AAAA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAC7B,OAAK,IAAMC,CAAX,IAAgBF,CAAhB,EAAmB;AACf,QAAI,EAAEE,CAAC,IAAID,CAAP,CAAJ,EAAe;AACX,aAAO,IAAP;AACH;AACJ;;AACD,OAAK,IAAMC,EAAX,IAAgBD,CAAhB,EAAmB;AACf,QAAID,CAAC,CAACE,EAAD,CAAD,KAASD,CAAC,CAACC,EAAD,CAAd,EAAmB;AACf,aAAO,IAAP;AACH;AACJ;;AACD,SAAO,KAAP;AACH,CAZD;;;ACGA,IAAMC,YAAY,GAAG,4BAArB;AACA,IAAMC,cAAc,GAAG,8BAAvB;IACaC,QAAb;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,UA8BIC,YA9BJ,GA8BmB;AACXC,MAAAA,QAAQ,EAAE,KADC;AAEXC,MAAAA,SAAS,EAAE;AAFA,KA9BnB;AAAA,UAkCIC,KAlCJ,GAkCY,MAAKH,YAlCjB;AAAA,UAmCII,UAnCJ,GAmCiB,KAnCjB;AAAA,UAoCIC,YApCJ;AAAA,UAqCIC,eArCJ;;AAAA,UAsCIC,WAtCJ,GAsCkB,UAACF,YAAD,EAAkB;AAC5B,YAAKA,YAAL,GAAoBA,YAApB;AACH,KAxCL;;AAAA;AAAA;;AAAA;;AAAA,SAyCIG,SAzCJ,GAyCI,qBAAY;AAAA;;AACR;AACA,QAAI,KAAKH,YAAL,YAA6BI,IAAjC,EAAuC;AACnC,wBAAuF,KAAKC,KAA5F;AAAA,UAAQC,eAAR,eAAQA,eAAR;AAAA,UAAyBC,WAAzB,eAAyBA,WAAzB;AAAA,UAAsCC,qBAAtC,eAAsCA,qBAAtC;AAAA,UAA6DC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,EAAE;AARS;AADblB,SAWFsD,YAAY;AACfrC,EAAAA,cAAc,EAAEsC,SAAS,CAACC,IADX;AAEf5C,EAAAA,eAAe,EAAE2C,SAAS,CAACC,IAFZ;AAGf3C,EAAAA,WAAW,EAAE0C,SAAS,CAACE,KAAV,CAAgB,CAAC,QAAD,EAAW,MAAX,EAAmB,OAAnB,CAAhB,CAHE;AAIff,EAAAA,QAAQ,EAAEa,SAAS,CAACG,SAAV,CAAoB,CAC1BH,SAAS,CAACC,IADgB,EAE1BD,SAAS,CAACI,MAFgB,EAG1BJ,SAAS,CAACK,MAHgB,CAApB,CAJK;AASfhB,EAAAA,OAAO,EAAEW,SAAS,CAACG,SAAV,CAAoB,CACzBH,SAAS,CAACC,IADe,EAEzBD,SAAS,CAACI,MAFe,EAGzBJ,SAAS,CAACK,MAHe,CAApB,CATM;AAcf9C,EAAAA,qBAAqB,EAAEyC,SAAS,CAACM,IAdlB;AAef9C,EAAAA,GAAG,EAAEwC,SAAS,CAACK,MAAV,CAAiBE,UAfP;AAgBf9C,EAAAA,eAAe,EAAEuC,SAAS,CAACM,IAhBZ;AAiBf3C,EAAAA,OAAO,EAAEqC,SAAS,CAACE,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAhB;AAjBM;;;;"}
|
|
1
|
+
{"version":3,"file":"react-svg.esm.js","sources":["../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;AAAA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAC7B,OAAK,IAAMC,CAAX,IAAgBF,CAAhB,EAAmB;AACf,QAAI,EAAEE,CAAC,IAAID,CAAP,CAAJ,EAAe;AACX,aAAO,IAAP;AACH;AACJ;;AACD,OAAK,IAAMC,EAAX,IAAgBD,CAAhB,EAAmB;AACf,QAAID,CAAC,CAACE,EAAD,CAAD,KAASD,CAAC,CAACC,EAAD,CAAd,EAAmB;AACf,aAAO,IAAP;AACH;AACJ;;AACD,SAAO,KAAP;AACH,CAZD;;;ACGA,IAAMC,YAAY,GAAG,4BAArB;AACA,IAAMC,cAAc,GAAG,8BAAvB;IACaC,QAAb;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,UAgCIC,YAhCJ,GAgCmB;AACXC,MAAAA,QAAQ,EAAE,KADC;AAEXC,MAAAA,SAAS,EAAE;AAFA,KAhCnB;AAAA,UAoCIC,KApCJ,GAoCY,MAAKH,YApCjB;AAAA,UAqCII,UArCJ,GAqCiB,KArCjB;AAAA,UAsCIC,YAtCJ;AAAA,UAuCIC,eAvCJ;;AAAA,UAwCIC,WAxCJ,GAwCkB,UAACF,YAAD,EAAkB;AAC5B,YAAKA,YAAL,GAAoBA,YAApB;AACH,KA1CL;;AAAA;AAAA;;AAAA;;AAAA,SA2CIG,SA3CJ,GA2CI,qBAAY;AAAA;;AACR;AACA,QAAI,KAAKH,YAAL,YAA6BI,IAAjC,EAAuC;AACnC,wBAAm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luded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
668
|
+
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
669
669
|
var svgNamespace = 'http://www.w3.org/2000/svg';
|
|
670
670
|
var xlinkNamespace = 'http://www.w3.org/1999/xlink';
|
|
671
671
|
var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
@@ -705,6 +705,7 @@
|
|
|
705
705
|
var _this$props = this.props,
|
|
706
706
|
beforeInjection = _this$props.beforeInjection,
|
|
707
707
|
evalScripts = _this$props.evalScripts,
|
|
708
|
+
httpRequestWithCredentials = _this$props.httpRequestWithCredentials,
|
|
708
709
|
renumerateIRIElements = _this$props.renumerateIRIElements,
|
|
709
710
|
src = _this$props.src,
|
|
710
711
|
useRequestCache = _this$props.useRequestCache;
|
|
@@ -760,6 +761,7 @@
|
|
|
760
761
|
beforeEach: beforeInjection,
|
|
761
762
|
cacheRequests: useRequestCache,
|
|
762
763
|
evalScripts: evalScripts,
|
|
764
|
+
httpRequestWithCredentials: httpRequestWithCredentials,
|
|
763
765
|
renumerateIRIElements: renumerateIRIElements
|
|
764
766
|
});
|
|
765
767
|
}
|
|
@@ -804,8 +806,9 @@
|
|
|
804
806
|
_this$props2.afterInjection;
|
|
805
807
|
_this$props2.beforeInjection;
|
|
806
808
|
_this$props2.evalScripts;
|
|
807
|
-
var Fallback = _this$props2.fallback
|
|
808
|
-
|
|
809
|
+
var Fallback = _this$props2.fallback;
|
|
810
|
+
_this$props2.httpRequestWithCredentials;
|
|
811
|
+
var Loading = _this$props2.loading;
|
|
809
812
|
_this$props2.renumerateIRIElements;
|
|
810
813
|
_this$props2.src;
|
|
811
814
|
_this$props2.useRequestCache;
|
|
@@ -835,6 +838,7 @@
|
|
|
835
838
|
},
|
|
836
839
|
evalScripts: 'never',
|
|
837
840
|
fallback: null,
|
|
841
|
+
httpRequestWithCredentials: false,
|
|
838
842
|
loading: null,
|
|
839
843
|
renumerateIRIElements: true,
|
|
840
844
|
useRequestCache: true,
|
|
@@ -845,6 +849,7 @@
|
|
|
845
849
|
beforeInjection: PropTypes__namespace.func,
|
|
846
850
|
evalScripts: PropTypes__namespace.oneOf(['always', 'once', 'never']),
|
|
847
851
|
fallback: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
852
|
+
httpRequestWithCredentials: PropTypes__namespace.bool,
|
|
848
853
|
loading: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
849
854
|
renumerateIRIElements: PropTypes__namespace.bool,
|
|
850
855
|
src: PropTypes__namespace.string.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-svg.umd.development.js","sources":["../node_modules/@babel/runtime/helpers/extends.js","../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inheritsLoose.js","../node_modules/@tanem/svg-injector/node_modules/tslib/tslib.es6.js","../node_modules/content-type/index.js","../node_modules/@tanem/svg-injector/src/cache.ts","../node_modules/@tanem/svg-injector/src/clone-svg.ts","../node_modules/@tanem/svg-injector/src/is-local.ts","../node_modules/@tanem/svg-injector/src/make-ajax-request.ts","../node_modules/@tanem/svg-injector/src/request-queue.ts","../node_modules/@tanem/svg-injector/src/load-svg-cached.ts","../node_modules/@tanem/svg-injector/src/load-svg-uncached.ts","../node_modules/@tanem/svg-injector/src/unique-id.ts","../node_modules/@tanem/svg-injector/src/inject-element.ts","../node_modules/@tanem/svg-injector/src/svg-injector.ts","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inheritsLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/*!\n * content-type\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nvar PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *(\"(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*\"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g\nvar TEXT_REGEXP = /^[\\u000b\\u0020-\\u007e\\u0080-\\u00ff]+$/\nvar TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nvar QESC_REGEXP = /\\\\([\\u000b\\u0020-\\u00ff])/g\n\n/**\n * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6\n */\nvar QUOTE_REGEXP = /([\\\\\"])/g\n\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nvar TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * Module exports.\n * @public\n */\n\nexports.format = format\nexports.parse = parse\n\n/**\n * Format object to media type.\n *\n * @param {object} obj\n * @return {string}\n * @public\n */\n\nfunction format (obj) {\n if (!obj || typeof obj !== 'object') {\n throw new TypeError('argument obj is required')\n }\n\n var parameters = obj.parameters\n var type = obj.type\n\n if (!type || !TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid type')\n }\n\n var string = type\n\n // append parameters\n if (parameters && typeof parameters === 'object') {\n var param\n var params = Object.keys(parameters).sort()\n\n for (var i = 0; i < params.length; i++) {\n param = params[i]\n\n if (!TOKEN_REGEXP.test(param)) {\n throw new TypeError('invalid parameter name')\n }\n\n string += '; ' + param + '=' + qstring(parameters[param])\n }\n }\n\n return string\n}\n\n/**\n * Parse media type to object.\n *\n * @param {string|object} string\n * @return {Object}\n * @public\n */\n\nfunction parse (string) {\n if (!string) {\n throw new TypeError('argument string is required')\n }\n\n // support req/res-like objects as argument\n var header = typeof string === 'object'\n ? getcontenttype(string)\n : string\n\n if (typeof header !== 'string') {\n throw new TypeError('argument string is required to be a string')\n }\n\n var index = header.indexOf(';')\n var type = index !== -1\n ? header.substr(0, index).trim()\n : header.trim()\n\n if (!TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid media type')\n }\n\n var obj = new ContentType(type.toLowerCase())\n\n // parse parameters\n if (index !== -1) {\n var key\n var match\n var value\n\n PARAM_REGEXP.lastIndex = index\n\n while ((match = PARAM_REGEXP.exec(header))) {\n if (match.index !== index) {\n throw new TypeError('invalid parameter format')\n }\n\n index += match[0].length\n key = match[1].toLowerCase()\n value = match[2]\n\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value\n .substr(1, value.length - 2)\n .replace(QESC_REGEXP, '$1')\n }\n\n obj.parameters[key] = value\n }\n\n if (index !== header.length) {\n throw new TypeError('invalid parameter format')\n }\n }\n\n return obj\n}\n\n/**\n * Get content-type from req/res objects.\n *\n * @param {object}\n * @return {Object}\n * @private\n */\n\nfunction getcontenttype (obj) {\n var header\n\n if (typeof obj.getHeader === 'function') {\n // res-like\n header = obj.getHeader('content-type')\n } else if (typeof obj.headers === 'object') {\n // req-like\n header = obj.headers && obj.headers['content-type']\n }\n\n if (typeof header !== 'string') {\n throw new TypeError('content-type header is missing from object')\n }\n\n return header\n}\n\n/**\n * Quote a string if necessary.\n *\n * @param {string} val\n * @return {string}\n * @private\n */\n\nfunction qstring (val) {\n var str = String(val)\n\n // no need to quote tokens\n if (TOKEN_REGEXP.test(str)) {\n return str\n }\n\n if (str.length > 0 && !TEXT_REGEXP.test(str)) {\n throw new TypeError('invalid parameter value')\n }\n\n return '\"' + str.replace(QUOTE_REGEXP, '\\\\$1') + '\"'\n}\n\n/**\n * Class to represent a content type.\n * @private\n */\nfunction ContentType (type) {\n this.parameters = Object.create(null)\n this.type = type\n}\n","const cache = new Map<string, SVGSVGElement | Error | undefined>()\n\nexport default cache\n","const cloneSvg = (sourceSvg: SVGSVGElement) =>\n sourceSvg.cloneNode(true) as SVGSVGElement\n\nexport default cloneSvg\n","const isLocal = () => window.location.protocol === 'file:'\n\nexport default isLocal\n","import { parse as parseContentType } from 'content-type'\nimport isLocal from './is-local'\n\nconst makeAjaxRequest = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: (error: Error | null, httpRequest: XMLHttpRequest) => void\n) => {\n const httpRequest = new XMLHttpRequest()\n\n httpRequest.onreadystatechange = () => {\n try {\n if (!/\\.svg/i.test(url) && httpRequest.readyState === 2) {\n const contentType = httpRequest.getResponseHeader('Content-Type')\n if (!contentType) {\n throw new Error('Content type not found')\n }\n\n const { type } = parseContentType(contentType)\n if (!(type === 'image/svg+xml' || type === 'text/plain')) {\n throw new Error(`Invalid content type: ${type}`)\n }\n }\n\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 404 || httpRequest.responseXML === null) {\n throw new Error(\n isLocal()\n ? 'Note: SVG injection ajax calls do not work locally without ' +\n 'adjusting security settings in your browser. Or consider ' +\n 'using a local webserver.'\n : 'Unable to load SVG file: ' + url\n )\n }\n\n if (\n httpRequest.status === 200 ||\n (isLocal() && httpRequest.status === 0)\n ) {\n callback(null, httpRequest)\n } else {\n throw new Error(\n 'There was a problem injecting the SVG: ' +\n httpRequest.status +\n ' ' +\n httpRequest.statusText\n )\n }\n }\n } catch (error) {\n httpRequest.abort()\n if (error instanceof Error) {\n callback(error, httpRequest)\n } else {\n throw error\n }\n }\n }\n\n httpRequest.open('GET', url)\n\n httpRequest.withCredentials = httpRequestWithCredentials\n\n /* istanbul ignore else */\n if (httpRequest.overrideMimeType) {\n httpRequest.overrideMimeType('text/xml')\n }\n\n httpRequest.send()\n}\n\nexport default makeAjaxRequest\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport { Errback } from './types'\n\nlet requestQueue: { [key: string]: Errback[] } = {}\n\nexport const clear = () => {\n requestQueue = {}\n}\n\nexport const queueRequest = (url: string, callback: Errback) => {\n requestQueue[url] = requestQueue[url] || []\n requestQueue[url].push(callback)\n}\n\nexport const processRequestQueue = (url: string) => {\n for (let i = 0, len = requestQueue[url].length; i < len; i++) {\n // Make these calls async so we avoid blocking the page/renderer.\n setTimeout(() => {\n /* istanbul ignore else */\n if (Array.isArray(requestQueue[url])) {\n const cacheValue = cache.get(url)\n const callback = requestQueue[url][i]\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof Error) {\n callback(cacheValue)\n }\n\n /* istanbul ignore else */\n if (i === requestQueue[url].length - 1) {\n delete requestQueue[url]\n }\n }\n }, 0)\n }\n}\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport makeAjaxRequest from './make-ajax-request'\nimport { processRequestQueue, queueRequest } from './request-queue'\nimport { Errback } from './types'\n\nconst loadSvgCached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n if (cache.has(url)) {\n const cacheValue = cache.get(url)\n\n if (cacheValue === undefined) {\n queueRequest(url, callback)\n return\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n return\n }\n\n // Errors are always refetched.\n }\n\n // Seed the cache to indicate we are loading this URL.\n cache.set(url, undefined)\n queueRequest(url, callback)\n\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n cache.set(url, error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n cache.set(url, httpRequest.responseXML.documentElement)\n }\n processRequestQueue(url)\n })\n}\n\nexport default loadSvgCached\n","import makeAjaxRequest from './make-ajax-request'\nimport { Errback } from './types'\n\nconst loadSvgUncached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n callback(error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n callback(null, httpRequest.responseXML.documentElement)\n }\n })\n}\n\nexport default loadSvgUncached\n","let idCounter = 0\nconst uniqueId = () => ++idCounter\nexport default uniqueId\n","import loadSvgCached from './load-svg-cached'\nimport loadSvgUncached from './load-svg-uncached'\nimport { BeforeEach, Errback, EvalScripts } from './types'\nimport uniqueId from './unique-id'\n\ntype ElementType = Element | HTMLElement | null\n\nconst injectedElements: ElementType[] = []\nconst ranScripts: { [key: string]: boolean } = {}\nconst svgNamespace = 'http://www.w3.org/2000/svg'\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink'\n\nconst injectElement = (\n el: NonNullable<ElementType>,\n evalScripts: EvalScripts,\n renumerateIRIElements: boolean,\n cacheRequests: boolean,\n httpRequestWithCredentials: boolean,\n beforeEach: BeforeEach,\n callback: Errback\n) => {\n const elUrl = el.getAttribute('data-src') || el.getAttribute('src')\n\n /* istanbul ignore else */\n if (!elUrl) {\n callback(new Error('Invalid data-src or src attribute'))\n return\n }\n\n // Make sure we aren't already in the process of injecting this element to\n // avoid a race condition if multiple injections for the same element are run.\n // :NOTE: Using indexOf() only _after_ we check for SVG support and bail, so\n // no need for IE8 indexOf() polyfill.\n /* istanbul ignore else */\n if (injectedElements.indexOf(el) !== -1) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n return\n }\n\n // Remember the request to inject this element, in case other injection calls\n // are also trying to replace this element before we finish.\n injectedElements.push(el)\n\n // Try to avoid loading the orginal image src if possible.\n el.setAttribute('src', '')\n\n const loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached\n\n loadSvg(elUrl, httpRequestWithCredentials, (error, svg) => {\n /* istanbul ignore else */\n if (!svg) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(error)\n return\n }\n\n const elId = el.getAttribute('id')\n /* istanbul ignore else */\n if (elId) {\n svg.setAttribute('id', elId)\n }\n\n const elTitle = el.getAttribute('title')\n /* istanbul ignore else */\n if (elTitle) {\n svg.setAttribute('title', elTitle)\n }\n\n const elWidth = el.getAttribute('width')\n /* istanbul ignore else */\n if (elWidth) {\n svg.setAttribute('width', elWidth)\n }\n\n const elHeight = el.getAttribute('height')\n /* istanbul ignore else */\n if (elHeight) {\n svg.setAttribute('height', elHeight)\n }\n\n const mergedClasses = Array.from(\n new Set([\n ...(svg.getAttribute('class') || '').split(' '),\n 'injected-svg',\n ...(el.getAttribute('class') || '').split(' '),\n ])\n )\n .join(' ')\n .trim()\n svg.setAttribute('class', mergedClasses)\n\n const elStyle = el.getAttribute('style')\n /* istanbul ignore else */\n if (elStyle) {\n svg.setAttribute('style', elStyle)\n }\n\n svg.setAttribute('data-src', elUrl)\n\n // Copy all the data elements to the svg.\n const elData = [].filter.call(el.attributes, (at: Attr) => {\n return /^data-\\w[\\w-]*$/.test(at.name)\n })\n\n Array.prototype.forEach.call(elData, (dataAttr: Attr) => {\n /* istanbul ignore else */\n if (dataAttr.name && dataAttr.value) {\n svg.setAttribute(dataAttr.name, dataAttr.value)\n }\n })\n\n /* istanbul ignore else */\n if (renumerateIRIElements) {\n // Make sure any internally referenced clipPath ids and their clip-path\n // references are unique.\n //\n // This addresses the issue of having multiple instances of the same SVG\n // on a page and only the first clipPath id is referenced.\n //\n // Browsers often shortcut the SVG Spec and don't use clipPaths contained\n // in parent elements that are hidden, so if you hide the first SVG\n // instance on the page, then all other instances lose their clipping.\n // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n\n // Handle all defs elements that have iri capable attributes as defined by\n // w3c: http://www.w3.org/TR/SVG/linking.html#processingIRI. Mapping IRI\n // addressable elements to the properties that can reference them.\n const iriElementsAndProperties: { [key: string]: string[] } = {\n clipPath: ['clip-path'],\n 'color-profile': ['color-profile'],\n cursor: ['cursor'],\n filter: ['filter'],\n linearGradient: ['fill', 'stroke'],\n marker: ['marker', 'marker-start', 'marker-mid', 'marker-end'],\n mask: ['mask'],\n path: [],\n pattern: ['fill', 'stroke'],\n radialGradient: ['fill', 'stroke'],\n }\n\n let element\n let elements\n let properties\n let currentId: string\n let newId: string\n\n Object.keys(iriElementsAndProperties).forEach((key) => {\n element = key\n properties = iriElementsAndProperties[key]\n\n elements = svg.querySelectorAll(element + '[id]')\n for (let a = 0, elementsLen = elements.length; a < elementsLen; a++) {\n currentId = elements[a].id\n newId = currentId + '-' + uniqueId()\n\n // All of the properties that can reference this element type.\n let referencingElements\n Array.prototype.forEach.call(properties, (property: string) => {\n // :NOTE: using a substring match attr selector here to deal with IE\n // \"adding extra quotes in url() attrs\".\n referencingElements = svg.querySelectorAll(\n '[' + property + '*=\"' + currentId + '\"]'\n )\n for (\n let b = 0, referencingElementLen = referencingElements.length;\n b < referencingElementLen;\n b++\n ) {\n const attrValue: string | null =\n referencingElements[b].getAttribute(property)\n if (\n attrValue &&\n !attrValue.match(new RegExp('url\\\\(\"?#' + currentId + '\"?\\\\)'))\n ) {\n continue\n }\n referencingElements[b].setAttribute(\n property,\n 'url(#' + newId + ')'\n )\n }\n })\n\n const allLinks = svg.querySelectorAll('[*|href]')\n const links = []\n for (let c = 0, allLinksLen = allLinks.length; c < allLinksLen; c++) {\n const href = allLinks[c].getAttributeNS(xlinkNamespace, 'href')\n /* istanbul ignore else */\n if (href && href.toString() === '#' + elements[a].id) {\n links.push(allLinks[c])\n }\n }\n for (let d = 0, linksLen = links.length; d < linksLen; d++) {\n links[d].setAttributeNS(xlinkNamespace, 'href', '#' + newId)\n }\n\n elements[a].id = newId\n }\n })\n }\n\n // Remove any unwanted/invalid namespaces that might have been added by SVG\n // editing tools.\n svg.removeAttribute('xmlns:a')\n\n // Post page load injected SVGs don't automatically have their script\n // elements run, so we'll need to make that happen, if requested.\n\n // Find then prune the scripts.\n const scripts = svg.querySelectorAll('script')\n const scriptsToEval: string[] = []\n let script\n let scriptType\n\n for (let i = 0, scriptsLen = scripts.length; i < scriptsLen; i++) {\n scriptType = scripts[i].getAttribute('type')\n\n // Only process javascript types. SVG defaults to 'application/ecmascript'\n // for unset types.\n /* istanbul ignore else */\n if (\n !scriptType ||\n scriptType === 'application/ecmascript' ||\n scriptType === 'application/javascript' ||\n scriptType === 'text/javascript'\n ) {\n // innerText for IE, textContent for other browsers.\n script = scripts[i].innerText || scripts[i].textContent\n\n // Stash.\n /* istanbul ignore else */\n if (script) {\n scriptsToEval.push(script)\n }\n\n // Tidy up and remove the script element since we don't need it anymore.\n svg.removeChild(scripts[i])\n }\n }\n\n // Run/Eval the scripts if needed.\n /* istanbul ignore else */\n if (\n scriptsToEval.length > 0 &&\n (evalScripts === 'always' ||\n (evalScripts === 'once' && !ranScripts[elUrl]))\n ) {\n for (\n let l = 0, scriptsToEvalLen = scriptsToEval.length;\n l < scriptsToEvalLen;\n l++\n ) {\n // :NOTE: Yup, this is a form of eval, but it is being used to eval code\n // the caller has explictely asked to be loaded, and the code is in a\n // caller defined SVG file... not raw user input.\n //\n // Also, the code is evaluated in a closure and not in the global scope.\n // If you need to put something in global scope, use 'window'.\n new Function(scriptsToEval[l])(window)\n }\n\n // Remember we already ran scripts for this svg.\n ranScripts[elUrl] = true\n }\n\n // :WORKAROUND: IE doesn't evaluate <style> tags in SVGs that are\n // dynamically added to the page. This trick will trigger IE to read and use\n // any existing SVG <style> tags.\n //\n // Reference: https://github.com/iconic/SVGInjector/issues/23.\n const styleTags = svg.querySelectorAll('style')\n Array.prototype.forEach.call(styleTags, (styleTag: HTMLStyleElement) => {\n styleTag.textContent += ''\n })\n\n svg.setAttribute('xmlns', svgNamespace)\n svg.setAttribute('xmlns:xlink', xlinkNamespace)\n\n beforeEach(svg)\n\n if (!el.parentNode) {\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(new Error('Parent node is null'))\n return\n }\n\n // Replace the image with the svg.\n el.parentNode.replaceChild(svg, el)\n\n // Now that we no longer need it, drop references to the original element so\n // it can be GC'd.\n // TODO: Extract\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n\n callback(null, svg)\n })\n}\n\nexport default injectElement\n","import injectElement from './inject-element'\nimport { AfterAll, BeforeEach, Errback, EvalScripts } from './types'\n\ntype Elements = HTMLCollectionOf<Element> | NodeListOf<Element> | Element | null\n\ninterface OptionalArgs {\n afterAll?: AfterAll\n afterEach?: Errback\n beforeEach?: BeforeEach\n cacheRequests?: boolean\n evalScripts?: EvalScripts\n httpRequestWithCredentials?: boolean\n renumerateIRIElements?: boolean\n}\n\nconst SVGInjector = (\n elements: Elements,\n {\n afterAll = () => undefined,\n afterEach = () => undefined,\n beforeEach = () => undefined,\n cacheRequests = true,\n evalScripts = 'never',\n httpRequestWithCredentials = false,\n renumerateIRIElements = true,\n }: OptionalArgs = {}\n) => {\n if (elements && 'length' in elements) {\n let elementsLoaded = 0\n for (let i = 0, j = elements.length; i < j; i++) {\n injectElement(\n elements[i],\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n if (\n elements &&\n 'length' in elements &&\n elements.length === ++elementsLoaded\n ) {\n afterAll(elementsLoaded)\n }\n }\n )\n }\n } else if (elements) {\n injectElement(\n elements,\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n afterAll(1)\n elements = null\n }\n )\n } else {\n afterAll(0)\n }\n}\n\nexport default SVGInjector\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,IAJQ;CAKlBE,EAAAA,OAAO,EAAE,IALS;CAMlB9B,EAAAA,qBAAqB,EAAE,IANL;CAOlBE,EAAAA,eAAe,EAAE,IAPC;CAQlBE,EAAAA,OAAO,EAAE;CARS;CADblB,SAWFsD,YAAY;CACfrC,EAAAA,cAAc,EAAEsC,oBAAS,CAACC,IADX;CAEf5C,EAAAA,eAAe,EAAE2C,oBAAS,CAACC,IAFZ;CAGf3C,EAAAA,WAAW,EAAE0C,oBAAS,CAACE,KAAV,CAAgB,CAAC,QAAD,EAAW,MAAX,EAAmB,OAAnB,CAAhB,CAHE;CAIff,EAAAA,QAAQ,EAAEa,oBAAS,CAACG,SAAV,CAAoB,CAC1BH,oBAAS,CAACC,IADgB,EAE1BD,oBAAS,CAACI,MAFgB,EAG1BJ,oBAAS,CAACK,MAHgB,CAApB,CAJK;CASfhB,EAAAA,OAAO,EAAEW,oBAAS,CAACG,SAAV,CAAoB,CACzBH,oBAAS,CAACC,IADe,EAEzBD,oBAAS,CAACI,MAFe,EAGzBJ,oBAAS,CAACK,MAHe,CAApB,CATM;CAcf9C,EAAAA,qBAAqB,EAAEyC,oBAAS,CAACM,IAdlB;CAef9C,EAAAA,GAAG,EAAEwC,oBAAS,CAACK,MAAV,CAAiBE,UAfP;CAgBf9C,EAAAA,eAAe,EAAEuC,oBAAS,CAACM,IAhBZ;CAiBf3C,EAAAA,OAAO,EAAEqC,oBAAS,CAACE,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAhB;CAjBM;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"react-svg.umd.development.js","sources":["../node_modules/@babel/runtime/helpers/extends.js","../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inheritsLoose.js","../node_modules/@tanem/svg-injector/node_modules/tslib/tslib.es6.js","../node_modules/content-type/index.js","../node_modules/@tanem/svg-injector/src/cache.ts","../node_modules/@tanem/svg-injector/src/clone-svg.ts","../node_modules/@tanem/svg-injector/src/is-local.ts","../node_modules/@tanem/svg-injector/src/make-ajax-request.ts","../node_modules/@tanem/svg-injector/src/request-queue.ts","../node_modules/@tanem/svg-injector/src/load-svg-cached.ts","../node_modules/@tanem/svg-injector/src/load-svg-uncached.ts","../node_modules/@tanem/svg-injector/src/unique-id.ts","../node_modules/@tanem/svg-injector/src/inject-element.ts","../node_modules/@tanem/svg-injector/src/svg-injector.ts","../compiled/shallow-differs.js","../compiled/ReactSVG.js"],"sourcesContent":["function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inheritsLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/*!\n * content-type\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nvar PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *(\"(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*\"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g\nvar TEXT_REGEXP = /^[\\u000b\\u0020-\\u007e\\u0080-\\u00ff]+$/\nvar TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nvar QESC_REGEXP = /\\\\([\\u000b\\u0020-\\u00ff])/g\n\n/**\n * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6\n */\nvar QUOTE_REGEXP = /([\\\\\"])/g\n\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nvar TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * Module exports.\n * @public\n */\n\nexports.format = format\nexports.parse = parse\n\n/**\n * Format object to media type.\n *\n * @param {object} obj\n * @return {string}\n * @public\n */\n\nfunction format (obj) {\n if (!obj || typeof obj !== 'object') {\n throw new TypeError('argument obj is required')\n }\n\n var parameters = obj.parameters\n var type = obj.type\n\n if (!type || !TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid type')\n }\n\n var string = type\n\n // append parameters\n if (parameters && typeof parameters === 'object') {\n var param\n var params = Object.keys(parameters).sort()\n\n for (var i = 0; i < params.length; i++) {\n param = params[i]\n\n if (!TOKEN_REGEXP.test(param)) {\n throw new TypeError('invalid parameter name')\n }\n\n string += '; ' + param + '=' + qstring(parameters[param])\n }\n }\n\n return string\n}\n\n/**\n * Parse media type to object.\n *\n * @param {string|object} string\n * @return {Object}\n * @public\n */\n\nfunction parse (string) {\n if (!string) {\n throw new TypeError('argument string is required')\n }\n\n // support req/res-like objects as argument\n var header = typeof string === 'object'\n ? getcontenttype(string)\n : string\n\n if (typeof header !== 'string') {\n throw new TypeError('argument string is required to be a string')\n }\n\n var index = header.indexOf(';')\n var type = index !== -1\n ? header.substr(0, index).trim()\n : header.trim()\n\n if (!TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid media type')\n }\n\n var obj = new ContentType(type.toLowerCase())\n\n // parse parameters\n if (index !== -1) {\n var key\n var match\n var value\n\n PARAM_REGEXP.lastIndex = index\n\n while ((match = PARAM_REGEXP.exec(header))) {\n if (match.index !== index) {\n throw new TypeError('invalid parameter format')\n }\n\n index += match[0].length\n key = match[1].toLowerCase()\n value = match[2]\n\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value\n .substr(1, value.length - 2)\n .replace(QESC_REGEXP, '$1')\n }\n\n obj.parameters[key] = value\n }\n\n if (index !== header.length) {\n throw new TypeError('invalid parameter format')\n }\n }\n\n return obj\n}\n\n/**\n * Get content-type from req/res objects.\n *\n * @param {object}\n * @return {Object}\n * @private\n */\n\nfunction getcontenttype (obj) {\n var header\n\n if (typeof obj.getHeader === 'function') {\n // res-like\n header = obj.getHeader('content-type')\n } else if (typeof obj.headers === 'object') {\n // req-like\n header = obj.headers && obj.headers['content-type']\n }\n\n if (typeof header !== 'string') {\n throw new TypeError('content-type header is missing from object')\n }\n\n return header\n}\n\n/**\n * Quote a string if necessary.\n *\n * @param {string} val\n * @return {string}\n * @private\n */\n\nfunction qstring (val) {\n var str = String(val)\n\n // no need to quote tokens\n if (TOKEN_REGEXP.test(str)) {\n return str\n }\n\n if (str.length > 0 && !TEXT_REGEXP.test(str)) {\n throw new TypeError('invalid parameter value')\n }\n\n return '\"' + str.replace(QUOTE_REGEXP, '\\\\$1') + '\"'\n}\n\n/**\n * Class to represent a content type.\n * @private\n */\nfunction ContentType (type) {\n this.parameters = Object.create(null)\n this.type = type\n}\n","const cache = new Map<string, SVGSVGElement | Error | undefined>()\n\nexport default cache\n","const cloneSvg = (sourceSvg: SVGSVGElement) =>\n sourceSvg.cloneNode(true) as SVGSVGElement\n\nexport default cloneSvg\n","const isLocal = () => window.location.protocol === 'file:'\n\nexport default isLocal\n","import { parse as parseContentType } from 'content-type'\nimport isLocal from './is-local'\n\nconst makeAjaxRequest = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: (error: Error | null, httpRequest: XMLHttpRequest) => void\n) => {\n const httpRequest = new XMLHttpRequest()\n\n httpRequest.onreadystatechange = () => {\n try {\n if (!/\\.svg/i.test(url) && httpRequest.readyState === 2) {\n const contentType = httpRequest.getResponseHeader('Content-Type')\n if (!contentType) {\n throw new Error('Content type not found')\n }\n\n const { type } = parseContentType(contentType)\n if (!(type === 'image/svg+xml' || type === 'text/plain')) {\n throw new Error(`Invalid content type: ${type}`)\n }\n }\n\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 404 || httpRequest.responseXML === null) {\n throw new Error(\n isLocal()\n ? 'Note: SVG injection ajax calls do not work locally without ' +\n 'adjusting security settings in your browser. Or consider ' +\n 'using a local webserver.'\n : 'Unable to load SVG file: ' + url\n )\n }\n\n if (\n httpRequest.status === 200 ||\n (isLocal() && httpRequest.status === 0)\n ) {\n callback(null, httpRequest)\n } else {\n throw new Error(\n 'There was a problem injecting the SVG: ' +\n httpRequest.status +\n ' ' +\n httpRequest.statusText\n )\n }\n }\n } catch (error) {\n httpRequest.abort()\n if (error instanceof Error) {\n callback(error, httpRequest)\n } else {\n throw error\n }\n }\n }\n\n httpRequest.open('GET', url)\n\n httpRequest.withCredentials = httpRequestWithCredentials\n\n /* istanbul ignore else */\n if (httpRequest.overrideMimeType) {\n httpRequest.overrideMimeType('text/xml')\n }\n\n httpRequest.send()\n}\n\nexport default makeAjaxRequest\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport { Errback } from './types'\n\nlet requestQueue: { [key: string]: Errback[] } = {}\n\nexport const clear = () => {\n requestQueue = {}\n}\n\nexport const queueRequest = (url: string, callback: Errback) => {\n requestQueue[url] = requestQueue[url] || []\n requestQueue[url].push(callback)\n}\n\nexport const processRequestQueue = (url: string) => {\n for (let i = 0, len = requestQueue[url].length; i < len; i++) {\n // Make these calls async so we avoid blocking the page/renderer.\n setTimeout(() => {\n /* istanbul ignore else */\n if (Array.isArray(requestQueue[url])) {\n const cacheValue = cache.get(url)\n const callback = requestQueue[url][i]\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof Error) {\n callback(cacheValue)\n }\n\n /* istanbul ignore else */\n if (i === requestQueue[url].length - 1) {\n delete requestQueue[url]\n }\n }\n }, 0)\n }\n}\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport makeAjaxRequest from './make-ajax-request'\nimport { processRequestQueue, queueRequest } from './request-queue'\nimport { Errback } from './types'\n\nconst loadSvgCached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n if (cache.has(url)) {\n const cacheValue = cache.get(url)\n\n if (cacheValue === undefined) {\n queueRequest(url, callback)\n return\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n return\n }\n\n // Errors are always refetched.\n }\n\n // Seed the cache to indicate we are loading this URL.\n cache.set(url, undefined)\n queueRequest(url, callback)\n\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n cache.set(url, error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n cache.set(url, httpRequest.responseXML.documentElement)\n }\n processRequestQueue(url)\n })\n}\n\nexport default loadSvgCached\n","import makeAjaxRequest from './make-ajax-request'\nimport { Errback } from './types'\n\nconst loadSvgUncached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n callback(error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n callback(null, httpRequest.responseXML.documentElement)\n }\n })\n}\n\nexport default loadSvgUncached\n","let idCounter = 0\nconst uniqueId = () => ++idCounter\nexport default uniqueId\n","import loadSvgCached from './load-svg-cached'\nimport loadSvgUncached from './load-svg-uncached'\nimport { BeforeEach, Errback, EvalScripts } from './types'\nimport uniqueId from './unique-id'\n\ntype ElementType = Element | HTMLElement | null\n\nconst injectedElements: ElementType[] = []\nconst ranScripts: { [key: string]: boolean } = {}\nconst svgNamespace = 'http://www.w3.org/2000/svg'\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink'\n\nconst injectElement = (\n el: NonNullable<ElementType>,\n evalScripts: EvalScripts,\n renumerateIRIElements: boolean,\n cacheRequests: boolean,\n httpRequestWithCredentials: boolean,\n beforeEach: BeforeEach,\n callback: Errback\n) => {\n const elUrl = el.getAttribute('data-src') || el.getAttribute('src')\n\n /* istanbul ignore else */\n if (!elUrl) {\n callback(new Error('Invalid data-src or src attribute'))\n return\n }\n\n // Make sure we aren't already in the process of injecting this element to\n // avoid a race condition if multiple injections for the same element are run.\n // :NOTE: Using indexOf() only _after_ we check for SVG support and bail, so\n // no need for IE8 indexOf() polyfill.\n /* istanbul ignore else */\n if (injectedElements.indexOf(el) !== -1) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n return\n }\n\n // Remember the request to inject this element, in case other injection calls\n // are also trying to replace this element before we finish.\n injectedElements.push(el)\n\n // Try to avoid loading the orginal image src if possible.\n el.setAttribute('src', '')\n\n const loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached\n\n loadSvg(elUrl, httpRequestWithCredentials, (error, svg) => {\n /* istanbul ignore else */\n if (!svg) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(error)\n return\n }\n\n const elId = el.getAttribute('id')\n /* istanbul ignore else */\n if (elId) {\n svg.setAttribute('id', elId)\n }\n\n const elTitle = el.getAttribute('title')\n /* istanbul ignore else */\n if (elTitle) {\n svg.setAttribute('title', elTitle)\n }\n\n const elWidth = el.getAttribute('width')\n /* istanbul ignore else */\n if (elWidth) {\n svg.setAttribute('width', elWidth)\n }\n\n const elHeight = el.getAttribute('height')\n /* istanbul ignore else */\n if (elHeight) {\n svg.setAttribute('height', elHeight)\n }\n\n const mergedClasses = Array.from(\n new Set([\n ...(svg.getAttribute('class') || '').split(' '),\n 'injected-svg',\n ...(el.getAttribute('class') || '').split(' '),\n ])\n )\n .join(' ')\n .trim()\n svg.setAttribute('class', mergedClasses)\n\n const elStyle = el.getAttribute('style')\n /* istanbul ignore else */\n if (elStyle) {\n svg.setAttribute('style', elStyle)\n }\n\n svg.setAttribute('data-src', elUrl)\n\n // Copy all the data elements to the svg.\n const elData = [].filter.call(el.attributes, (at: Attr) => {\n return /^data-\\w[\\w-]*$/.test(at.name)\n })\n\n Array.prototype.forEach.call(elData, (dataAttr: Attr) => {\n /* istanbul ignore else */\n if (dataAttr.name && dataAttr.value) {\n svg.setAttribute(dataAttr.name, dataAttr.value)\n }\n })\n\n /* istanbul ignore else */\n if (renumerateIRIElements) {\n // Make sure any internally referenced clipPath ids and their clip-path\n // references are unique.\n //\n // This addresses the issue of having multiple instances of the same SVG\n // on a page and only the first clipPath id is referenced.\n //\n // Browsers often shortcut the SVG Spec and don't use clipPaths contained\n // in parent elements that are hidden, so if you hide the first SVG\n // instance on the page, then all other instances lose their clipping.\n // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n\n // Handle all defs elements that have iri capable attributes as defined by\n // w3c: http://www.w3.org/TR/SVG/linking.html#processingIRI. Mapping IRI\n // addressable elements to the properties that can reference them.\n const iriElementsAndProperties: { [key: string]: string[] } = {\n clipPath: ['clip-path'],\n 'color-profile': ['color-profile'],\n cursor: ['cursor'],\n filter: ['filter'],\n linearGradient: ['fill', 'stroke'],\n marker: ['marker', 'marker-start', 'marker-mid', 'marker-end'],\n mask: ['mask'],\n path: [],\n pattern: ['fill', 'stroke'],\n radialGradient: ['fill', 'stroke'],\n }\n\n let element\n let elements\n let properties\n let currentId: string\n let newId: string\n\n Object.keys(iriElementsAndProperties).forEach((key) => {\n element = key\n properties = iriElementsAndProperties[key]\n\n elements = svg.querySelectorAll(element + '[id]')\n for (let a = 0, elementsLen = elements.length; a < elementsLen; a++) {\n currentId = elements[a].id\n newId = currentId + '-' + uniqueId()\n\n // All of the properties that can reference this element type.\n let referencingElements\n Array.prototype.forEach.call(properties, (property: string) => {\n // :NOTE: using a substring match attr selector here to deal with IE\n // \"adding extra quotes in url() attrs\".\n referencingElements = svg.querySelectorAll(\n '[' + property + '*=\"' + currentId + '\"]'\n )\n for (\n let b = 0, referencingElementLen = referencingElements.length;\n b < referencingElementLen;\n b++\n ) {\n const attrValue: string | null =\n referencingElements[b].getAttribute(property)\n if (\n attrValue &&\n !attrValue.match(new RegExp('url\\\\(\"?#' + currentId + '\"?\\\\)'))\n ) {\n continue\n }\n referencingElements[b].setAttribute(\n property,\n 'url(#' + newId + ')'\n )\n }\n })\n\n const allLinks = svg.querySelectorAll('[*|href]')\n const links = []\n for (let c = 0, allLinksLen = allLinks.length; c < allLinksLen; c++) {\n const href = allLinks[c].getAttributeNS(xlinkNamespace, 'href')\n /* istanbul ignore else */\n if (href && href.toString() === '#' + elements[a].id) {\n links.push(allLinks[c])\n }\n }\n for (let d = 0, linksLen = links.length; d < linksLen; d++) {\n links[d].setAttributeNS(xlinkNamespace, 'href', '#' + newId)\n }\n\n elements[a].id = newId\n }\n })\n }\n\n // Remove any unwanted/invalid namespaces that might have been added by SVG\n // editing tools.\n svg.removeAttribute('xmlns:a')\n\n // Post page load injected SVGs don't automatically have their script\n // elements run, so we'll need to make that happen, if requested.\n\n // Find then prune the scripts.\n const scripts = svg.querySelectorAll('script')\n const scriptsToEval: string[] = []\n let script\n let scriptType\n\n for (let i = 0, scriptsLen = scripts.length; i < scriptsLen; i++) {\n scriptType = scripts[i].getAttribute('type')\n\n // Only process javascript types. SVG defaults to 'application/ecmascript'\n // for unset types.\n /* istanbul ignore else */\n if (\n !scriptType ||\n scriptType === 'application/ecmascript' ||\n scriptType === 'application/javascript' ||\n scriptType === 'text/javascript'\n ) {\n // innerText for IE, textContent for other browsers.\n script = scripts[i].innerText || scripts[i].textContent\n\n // Stash.\n /* istanbul ignore else */\n if (script) {\n scriptsToEval.push(script)\n }\n\n // Tidy up and remove the script element since we don't need it anymore.\n svg.removeChild(scripts[i])\n }\n }\n\n // Run/Eval the scripts if needed.\n /* istanbul ignore else */\n if (\n scriptsToEval.length > 0 &&\n (evalScripts === 'always' ||\n (evalScripts === 'once' && !ranScripts[elUrl]))\n ) {\n for (\n let l = 0, scriptsToEvalLen = scriptsToEval.length;\n l < scriptsToEvalLen;\n l++\n ) {\n // :NOTE: Yup, this is a form of eval, but it is being used to eval code\n // the caller has explictely asked to be loaded, and the code is in a\n // caller defined SVG file... not raw user input.\n //\n // Also, the code is evaluated in a closure and not in the global scope.\n // If you need to put something in global scope, use 'window'.\n new Function(scriptsToEval[l])(window)\n }\n\n // Remember we already ran scripts for this svg.\n ranScripts[elUrl] = true\n }\n\n // :WORKAROUND: IE doesn't evaluate <style> tags in SVGs that are\n // dynamically added to the page. This trick will trigger IE to read and use\n // any existing SVG <style> tags.\n //\n // Reference: https://github.com/iconic/SVGInjector/issues/23.\n const styleTags = svg.querySelectorAll('style')\n Array.prototype.forEach.call(styleTags, (styleTag: HTMLStyleElement) => {\n styleTag.textContent += ''\n })\n\n svg.setAttribute('xmlns', svgNamespace)\n svg.setAttribute('xmlns:xlink', xlinkNamespace)\n\n beforeEach(svg)\n\n if (!el.parentNode) {\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(new Error('Parent node is null'))\n return\n }\n\n // Replace the image with the svg.\n el.parentNode.replaceChild(svg, el)\n\n // Now that we no longer need it, drop references to the original element so\n // it can be GC'd.\n // TODO: Extract\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n\n callback(null, svg)\n })\n}\n\nexport default injectElement\n","import injectElement from './inject-element'\nimport { AfterAll, BeforeEach, Errback, EvalScripts } from './types'\n\ntype Elements = HTMLCollectionOf<Element> | NodeListOf<Element> | Element | null\n\ninterface OptionalArgs {\n afterAll?: AfterAll\n afterEach?: Errback\n beforeEach?: BeforeEach\n cacheRequests?: boolean\n evalScripts?: EvalScripts\n httpRequestWithCredentials?: boolean\n renumerateIRIElements?: boolean\n}\n\nconst SVGInjector = (\n elements: Elements,\n {\n afterAll = () => undefined,\n afterEach = () => undefined,\n beforeEach = () => undefined,\n cacheRequests = true,\n evalScripts = 'never',\n httpRequestWithCredentials = false,\n renumerateIRIElements = true,\n }: OptionalArgs = {}\n) => {\n if (elements && 'length' in elements) {\n let elementsLoaded = 0\n for (let i = 0, j = elements.length; i < j; i++) {\n injectElement(\n elements[i],\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n if (\n elements &&\n 'length' in elements &&\n elements.length === ++elementsLoaded\n ) {\n afterAll(elementsLoaded)\n }\n }\n )\n }\n } else if (elements) {\n injectElement(\n elements,\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n afterAll(1)\n elements = null\n }\n )\n } else {\n afterAll(0)\n }\n}\n\nexport default SVGInjector\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n"],"names":["shallowDiffers","a","b","i","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","props","beforeInjection","evalScripts","httpRequestWithCredentials","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","nonReactTarget","document","createElementNS","setAttribute","createElement","appendChild","dataset","afterEach","error","svg","removeSVG","setState","SVGInjector","beforeEach","cacheRequests","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","Wrapper","React","ref","xmlns","xmlnsXlink","Component","defaultProps","undefined","propTypes","PropTypes","func","oneOf","oneOfType","object","string","bool","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA,SAAS,QAAQ,GAAG;CACpB,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,UAAU,MAAM,EAAE;CACjE,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;CAC/C,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAChC;CACA,MAAM,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;CAC9B,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;CAC/D,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;CACpC,SAAS;CACT,OAAO;CACP,KAAK;AACL;CACA,IAAI,OAAO,MAAM,CAAC;CAClB,GAAG,CAAC;AACJ;CACA,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,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AAAA,0BAA0B,EAAE0C,oBAAS,CAACM,IATvB;CAUfjB,EAAAA,OAAO,EAAEW,oBAAS,CAACG,SAAV,CAAoB,CACzBH,oBAAS,CAACC,IADe,EAEzBD,oBAAS,CAACI,MAFe,EAGzBJ,oBAAS,CAACK,MAHe,CAApB,CAVM;CAef9C,EAAAA,qBAAqB,EAAEyC,oBAAS,CAACM,IAflB;CAgBf9C,EAAAA,GAAG,EAAEwC,oBAAS,CAACK,MAAV,CAAiBE,UAhBP;CAiBf9C,EAAAA,eAAe,EAAEuC,oBAAS,CAACM,IAjBZ;CAkBf3C,EAAAA,OAAO,EAAEqC,oBAAS,CAACE,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAhB;CAlBM;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactSVG={},e.React)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e,t){return e(t={exports:{}},t.exports),t.exports}var a=o(i((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,t.apply(this,arguments)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0}))),s=o(i((function(e){e.exports=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o},e.exports.default=e.exports,e.exports.__esModule=!0}))),l=i((function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(r,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0}));o(l);var u=o(i((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,l(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})));function c(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var f=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,p=/\\([\u000b\u0020-\u00ff])/g,d=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,h=function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!d.test(n))throw new TypeError("invalid media type");var o=new v(n.toLowerCase());if(-1!==r){var i,a,s;for(f.lastIndex=r;a=f.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(p,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};function v(e){this.parameters=Object.create(null),this.type=e}var m=new Map,g=function(e){return e.cloneNode(!0)},y=function(){return"file:"===window.location.protocol},b=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&2===n.readyState){var t=n.getResponseHeader("Content-Type");if(!t)throw new Error("Content type not found");var o=h(t).type;if("image/svg+xml"!==o&&"text/plain"!==o)throw new Error("Invalid content type: "+o)}if(4===n.readyState){if(404===n.status||null===n.responseXML)throw new Error(y()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(!(200===n.status||y()&&0===n.status))throw new Error("There was a problem injecting the SVG: "+n.status+" "+n.statusText);r(null,n)}}catch(e){if(n.abort(),!(e instanceof Error))throw e;r(e,n)}},n.open("GET",e),n.withCredentials=t,n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()},w={},x=function(e,t){w[e]=w[e]||[],w[e].push(t)},E=function(e,t,r){if(m.has(e)){var n=m.get(e);if(void 0===n)return void x(e,r);if(n instanceof SVGSVGElement)return void r(null,g(n))}m.set(e,void 0),x(e,r),b(e,t,(function(t,r){t?m.set(e,t):r.responseXML instanceof Document&&r.responseXML.documentElement&&r.responseXML.documentElement instanceof SVGSVGElement&&m.set(e,r.responseXML.documentElement),function(e){for(var t=function(t,r){setTimeout((function(){if(Array.isArray(w[e])){var r=m.get(e),n=w[e][t];r instanceof SVGSVGElement&&n(null,g(r)),r instanceof Error&&n(r),t===w[e].length-1&&delete w[e]}}),0)},r=0,n=w[e].length;r<n;r++)t(r)}(e)}))},A=function(e,t,r){b(e,t,(function(e,t){e?r(e):t.responseXML instanceof Document&&t.responseXML.documentElement&&t.responseXML.documentElement instanceof SVGSVGElement&&r(null,t.responseXML.documentElement)}))},S=0,j=[],_={},M="http://www.w3.org/1999/xlink",O=function(e,t,r,n,o,i,a){var s=e.getAttribute("data-src")||e.getAttribute("src");if(s){if(-1!==j.indexOf(e))return j.splice(j.indexOf(e),1),void(e=null);j.push(e),e.setAttribute("src",""),(n?E:A)(s,o,(function(n,o){if(!o)return j.splice(j.indexOf(e),1),e=null,void a(n);var l=e.getAttribute("id");l&&o.setAttribute("id",l);var u=e.getAttribute("title");u&&o.setAttribute("title",u);var f=e.getAttribute("width");f&&o.setAttribute("width",f);var p=e.getAttribute("height");p&&o.setAttribute("height",p);var d=Array.from(new Set(c(c(c([],(o.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();o.setAttribute("class",d);var h=e.getAttribute("style");h&&o.setAttribute("style",h),o.setAttribute("data-src",s);var v=[].filter.call(e.attributes,(function(e){return/^data-\w[\w-]*$/.test(e.name)}));if(Array.prototype.forEach.call(v,(function(e){e.name&&e.value&&o.setAttribute(e.name,e.value)})),r){var m,g,y,b,w={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(w).forEach((function(e){g=w[e];for(var t=function(e,t){var r;b=(y=m[e].id)+"-"+ ++S,Array.prototype.forEach.call(g,(function(e){for(var t=0,n=(r=o.querySelectorAll("["+e+'*="'+y+'"]')).length;t<n;t++){var i=r[t].getAttribute(e);i&&!i.match(new RegExp('url\\("?#'+y+'"?\\)'))||r[t].setAttribute(e,"url(#"+b+")")}}));for(var n=o.querySelectorAll("[*|href]"),i=[],a=0,s=n.length;a<s;a++){var l=n[a].getAttributeNS(M,"href");l&&l.toString()==="#"+m[e].id&&i.push(n[a])}for(var u=0,c=i.length;u<c;u++)i[u].setAttributeNS(M,"href","#"+b);m[e].id=b},r=0,n=(m=o.querySelectorAll(e+"[id]")).length;r<n;r++)t(r)}))}o.removeAttribute("xmlns:a");for(var x,E,A=o.querySelectorAll("script"),O=[],k=0,G=A.length;k<G;k++)(E=A[k].getAttribute("type"))&&"application/ecmascript"!==E&&"application/javascript"!==E&&"text/javascript"!==E||((x=A[k].innerText||A[k].textContent)&&O.push(x),o.removeChild(A[k]));if(O.length>0&&("always"===t||"once"===t&&!_[s])){for(var R=0,V=O.length;R<V;R++)new Function(O[R])(window);_[s]=!0}var C=o.querySelectorAll("style");if(Array.prototype.forEach.call(C,(function(e){e.textContent+=""})),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("xmlns:xlink",M),i(o),!e.parentNode)return j.splice(j.indexOf(e),1),e=null,void a(new Error("Parent node is null"));e.parentNode.replaceChild(o,e),j.splice(j.indexOf(e),1),e=null,a(null,o)}))}else a(new Error("Invalid data-src or src attribute"))},k=["afterInjection","beforeInjection","evalScripts","fallback","loading","renumerateIRIElements","src","useRequestCache","wrapper"],G="http://www.w3.org/2000/svg",R="http://www.w3.org/1999/xlink",V=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).initialState={hasError:!1,isLoading:!0},t.state=t.initialState,t._isMounted=!1,t.reactWrapper=void 0,t.nonReactWrapper=void 0,t.refCallback=function(e){t.reactWrapper=e},t}u(t,e);var r=t.prototype;return r.renderSVG=function(){var e=this;if(this.reactWrapper instanceof Node){var t,r,n=this.props,o=n.beforeInjection,i=n.evalScripts,a=n.renumerateIRIElements,s=n.src,l=n.useRequestCache,u=this.props.afterInjection,c=this.props.wrapper;"svg"===c?((t=document.createElementNS(G,c)).setAttribute("xmlns",G),t.setAttribute("xmlns:xlink",R),r=document.createElementNS(G,c)):(t=document.createElement(c),r=document.createElement(c)),t.appendChild(r),r.dataset.src=s,this.nonReactWrapper=this.reactWrapper.appendChild(t);!function(e,t){var r=void 0===t?{}:t,n=r.afterAll,o=void 0===n?function(){}:n,i=r.afterEach,a=void 0===i?function(){}:i,s=r.beforeEach,l=void 0===s?function(){}:s,u=r.cacheRequests,c=void 0===u||u,f=r.evalScripts,p=void 0===f?"never":f,d=r.httpRequestWithCredentials,h=void 0!==d&&d,v=r.renumerateIRIElements,m=void 0===v||v;if(e&&"length"in e)for(var g=0,y=0,b=e.length;y<b;y++)O(e[y],p,m,c,h,l,(function(t,r){a(t,r),e&&"length"in e&&e.length===++g&&o(g)}));else e?O(e,p,m,c,h,l,(function(t,r){a(t,r),o(1),e=null})):o(0)}(r,{afterEach:function(t,r){!t||(e.removeSVG(),e._isMounted)?e._isMounted&&e.setState((function(){return{hasError:!!t,isLoading:!1}}),(function(){u(t,r)})):u(t)},beforeEach:o,cacheRequests:l,evalScripts:i,renumerateIRIElements:a})}},r.removeSVG=function(){var e;null!=(e=this.nonReactWrapper)&&e.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},r.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},r.componentDidUpdate=function(e){var t=this;(function(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1})(e,this.props)&&this.setState((function(){return t.initialState}),(function(){t.removeSVG(),t.renderSVG()}))},r.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},r.render=function(){var e=this.props,t=e.fallback,r=e.loading,o=e.wrapper,i=s(e,k);return n.createElement(o,a({},i,{ref:this.refCallback},"svg"===o?{xmlns:G,xmlnsXlink:R}:{}),this.state.isLoading&&r&&n.createElement(r,null),this.state.hasError&&t&&n.createElement(t,null))},t}(n.Component);V.defaultProps={afterInjection:function(){},beforeInjection:function(){},evalScripts:"never",fallback:null,loading:null,renumerateIRIElements:!0,useRequestCache:!0,wrapper:"div"},e.ReactSVG=V,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactSVG={},e.React)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e,t){return e(t={exports:{}},t.exports),t.exports}var a=o(i((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,t.apply(this,arguments)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0}))),s=o(i((function(e){e.exports=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o},e.exports.default=e.exports,e.exports.__esModule=!0}))),l=i((function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(r,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0}));o(l);var u=o(i((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,l(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})));function c(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var f=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,p=/\\([\u000b\u0020-\u00ff])/g,d=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,h=function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!d.test(n))throw new TypeError("invalid media type");var o=new v(n.toLowerCase());if(-1!==r){var i,a,s;for(f.lastIndex=r;a=f.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(p,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};function v(e){this.parameters=Object.create(null),this.type=e}var m=new Map,g=function(e){return e.cloneNode(!0)},y=function(){return"file:"===window.location.protocol},b=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){try{if(!/\.svg/i.test(e)&&2===n.readyState){var t=n.getResponseHeader("Content-Type");if(!t)throw new Error("Content type not found");var o=h(t).type;if("image/svg+xml"!==o&&"text/plain"!==o)throw new Error("Invalid content type: "+o)}if(4===n.readyState){if(404===n.status||null===n.responseXML)throw new Error(y()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+e);if(!(200===n.status||y()&&0===n.status))throw new Error("There was a problem injecting the SVG: "+n.status+" "+n.statusText);r(null,n)}}catch(e){if(n.abort(),!(e instanceof Error))throw e;r(e,n)}},n.open("GET",e),n.withCredentials=t,n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()},w={},x=function(e,t){w[e]=w[e]||[],w[e].push(t)},E=function(e,t,r){if(m.has(e)){var n=m.get(e);if(void 0===n)return void x(e,r);if(n instanceof SVGSVGElement)return void r(null,g(n))}m.set(e,void 0),x(e,r),b(e,t,(function(t,r){t?m.set(e,t):r.responseXML instanceof Document&&r.responseXML.documentElement&&r.responseXML.documentElement instanceof SVGSVGElement&&m.set(e,r.responseXML.documentElement),function(e){for(var t=function(t,r){setTimeout((function(){if(Array.isArray(w[e])){var r=m.get(e),n=w[e][t];r instanceof SVGSVGElement&&n(null,g(r)),r instanceof Error&&n(r),t===w[e].length-1&&delete w[e]}}),0)},r=0,n=w[e].length;r<n;r++)t(r)}(e)}))},A=function(e,t,r){b(e,t,(function(e,t){e?r(e):t.responseXML instanceof Document&&t.responseXML.documentElement&&t.responseXML.documentElement instanceof SVGSVGElement&&r(null,t.responseXML.documentElement)}))},S=0,j=[],_={},M="http://www.w3.org/1999/xlink",R=function(e,t,r,n,o,i,a){var s=e.getAttribute("data-src")||e.getAttribute("src");if(s){if(-1!==j.indexOf(e))return j.splice(j.indexOf(e),1),void(e=null);j.push(e),e.setAttribute("src",""),(n?E:A)(s,o,(function(n,o){if(!o)return j.splice(j.indexOf(e),1),e=null,void a(n);var l=e.getAttribute("id");l&&o.setAttribute("id",l);var u=e.getAttribute("title");u&&o.setAttribute("title",u);var f=e.getAttribute("width");f&&o.setAttribute("width",f);var p=e.getAttribute("height");p&&o.setAttribute("height",p);var d=Array.from(new Set(c(c(c([],(o.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(e.getAttribute("class")||"").split(" "),!0))).join(" ").trim();o.setAttribute("class",d);var h=e.getAttribute("style");h&&o.setAttribute("style",h),o.setAttribute("data-src",s);var v=[].filter.call(e.attributes,(function(e){return/^data-\w[\w-]*$/.test(e.name)}));if(Array.prototype.forEach.call(v,(function(e){e.name&&e.value&&o.setAttribute(e.name,e.value)})),r){var m,g,y,b,w={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(w).forEach((function(e){g=w[e];for(var t=function(e,t){var r;b=(y=m[e].id)+"-"+ ++S,Array.prototype.forEach.call(g,(function(e){for(var t=0,n=(r=o.querySelectorAll("["+e+'*="'+y+'"]')).length;t<n;t++){var i=r[t].getAttribute(e);i&&!i.match(new RegExp('url\\("?#'+y+'"?\\)'))||r[t].setAttribute(e,"url(#"+b+")")}}));for(var n=o.querySelectorAll("[*|href]"),i=[],a=0,s=n.length;a<s;a++){var l=n[a].getAttributeNS(M,"href");l&&l.toString()==="#"+m[e].id&&i.push(n[a])}for(var u=0,c=i.length;u<c;u++)i[u].setAttributeNS(M,"href","#"+b);m[e].id=b},r=0,n=(m=o.querySelectorAll(e+"[id]")).length;r<n;r++)t(r)}))}o.removeAttribute("xmlns:a");for(var x,E,A=o.querySelectorAll("script"),R=[],O=0,k=A.length;O<k;O++)(E=A[O].getAttribute("type"))&&"application/ecmascript"!==E&&"application/javascript"!==E&&"text/javascript"!==E||((x=A[O].innerText||A[O].textContent)&&R.push(x),o.removeChild(A[O]));if(R.length>0&&("always"===t||"once"===t&&!_[s])){for(var C=0,G=R.length;C<G;C++)new Function(R[C])(window);_[s]=!0}var V=o.querySelectorAll("style");if(Array.prototype.forEach.call(V,(function(e){e.textContent+=""})),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("xmlns:xlink",M),i(o),!e.parentNode)return j.splice(j.indexOf(e),1),e=null,void a(new Error("Parent node is null"));e.parentNode.replaceChild(o,e),j.splice(j.indexOf(e),1),e=null,a(null,o)}))}else a(new Error("Invalid data-src or src attribute"))},O=["afterInjection","beforeInjection","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","useRequestCache","wrapper"],k="http://www.w3.org/2000/svg",C="http://www.w3.org/1999/xlink",G=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).initialState={hasError:!1,isLoading:!0},t.state=t.initialState,t._isMounted=!1,t.reactWrapper=void 0,t.nonReactWrapper=void 0,t.refCallback=function(e){t.reactWrapper=e},t}u(t,e);var r=t.prototype;return r.renderSVG=function(){var e=this;if(this.reactWrapper instanceof Node){var t,r,n=this.props,o=n.beforeInjection,i=n.evalScripts,a=n.httpRequestWithCredentials,s=n.renumerateIRIElements,l=n.src,u=n.useRequestCache,c=this.props.afterInjection,f=this.props.wrapper;"svg"===f?((t=document.createElementNS(k,f)).setAttribute("xmlns",k),t.setAttribute("xmlns:xlink",C),r=document.createElementNS(k,f)):(t=document.createElement(f),r=document.createElement(f)),t.appendChild(r),r.dataset.src=l,this.nonReactWrapper=this.reactWrapper.appendChild(t);!function(e,t){var r=void 0===t?{}:t,n=r.afterAll,o=void 0===n?function(){}:n,i=r.afterEach,a=void 0===i?function(){}:i,s=r.beforeEach,l=void 0===s?function(){}:s,u=r.cacheRequests,c=void 0===u||u,f=r.evalScripts,p=void 0===f?"never":f,d=r.httpRequestWithCredentials,h=void 0!==d&&d,v=r.renumerateIRIElements,m=void 0===v||v;if(e&&"length"in e)for(var g=0,y=0,b=e.length;y<b;y++)R(e[y],p,m,c,h,l,(function(t,r){a(t,r),e&&"length"in e&&e.length===++g&&o(g)}));else e?R(e,p,m,c,h,l,(function(t,r){a(t,r),o(1),e=null})):o(0)}(r,{afterEach:function(t,r){!t||(e.removeSVG(),e._isMounted)?e._isMounted&&e.setState((function(){return{hasError:!!t,isLoading:!1}}),(function(){c(t,r)})):c(t)},beforeEach:o,cacheRequests:u,evalScripts:i,httpRequestWithCredentials:a,renumerateIRIElements:s})}},r.removeSVG=function(){var e;null!=(e=this.nonReactWrapper)&&e.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},r.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},r.componentDidUpdate=function(e){var t=this;(function(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1})(e,this.props)&&this.setState((function(){return t.initialState}),(function(){t.removeSVG(),t.renderSVG()}))},r.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},r.render=function(){var e=this.props,t=e.fallback,r=e.loading,o=e.wrapper,i=s(e,O);return n.createElement(o,a({},i,{ref:this.refCallback},"svg"===o?{xmlns:k,xmlnsXlink:C}:{}),this.state.isLoading&&r&&n.createElement(r,null),this.state.hasError&&t&&n.createElement(t,null))},t}(n.Component);G.defaultProps={afterInjection:function(){},beforeInjection:function(){},evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,renumerateIRIElements:!0,useRequestCache:!0,wrapper:"div"},e.ReactSVG=G,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=react-svg.umd.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-svg.umd.production.js","sources":["../node_modules/@babel/runtime/helpers/extends.js","../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inheritsLoose.js","../node_modules/@tanem/svg-injector/node_modules/tslib/tslib.es6.js","../node_modules/content-type/index.js","../node_modules/@tanem/svg-injector/src/cache.ts","../node_modules/@tanem/svg-injector/src/make-ajax-request.ts","../node_modules/@tanem/svg-injector/src/request-queue.ts","../node_modules/@tanem/svg-injector/src/load-svg-cached.ts","../node_modules/@tanem/svg-injector/src/load-svg-uncached.ts","../node_modules/@tanem/svg-injector/src/unique-id.ts","../node_modules/@tanem/svg-injector/src/inject-element.ts","../compiled/ReactSVG.js","../node_modules/@tanem/svg-injector/src/svg-injector.ts","../compiled/shallow-differs.js"],"sourcesContent":["function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inheritsLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/*!\n * content-type\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nvar PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *(\"(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*\"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g\nvar TEXT_REGEXP = /^[\\u000b\\u0020-\\u007e\\u0080-\\u00ff]+$/\nvar TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nvar QESC_REGEXP = /\\\\([\\u000b\\u0020-\\u00ff])/g\n\n/**\n * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6\n */\nvar QUOTE_REGEXP = /([\\\\\"])/g\n\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nvar TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * Module exports.\n * @public\n */\n\nexports.format = format\nexports.parse = parse\n\n/**\n * Format object to media type.\n *\n * @param {object} obj\n * @return {string}\n * @public\n */\n\nfunction format (obj) {\n if (!obj || typeof obj !== 'object') {\n throw new TypeError('argument obj is required')\n }\n\n var parameters = obj.parameters\n var type = obj.type\n\n if (!type || !TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid type')\n }\n\n var string = type\n\n // append parameters\n if (parameters && typeof parameters === 'object') {\n var param\n var params = Object.keys(parameters).sort()\n\n for (var i = 0; i < params.length; i++) {\n param = params[i]\n\n if (!TOKEN_REGEXP.test(param)) {\n throw new TypeError('invalid parameter name')\n }\n\n string += '; ' + param + '=' + qstring(parameters[param])\n }\n }\n\n return string\n}\n\n/**\n * Parse media type to object.\n *\n * @param {string|object} string\n * @return {Object}\n * @public\n */\n\nfunction parse (string) {\n if (!string) {\n throw new TypeError('argument string is required')\n }\n\n // support req/res-like objects as argument\n var header = typeof string === 'object'\n ? getcontenttype(string)\n : string\n\n if (typeof header !== 'string') {\n throw new TypeError('argument string is required to be a string')\n }\n\n var index = header.indexOf(';')\n var type = index !== -1\n ? header.substr(0, index).trim()\n : header.trim()\n\n if (!TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid media type')\n }\n\n var obj = new ContentType(type.toLowerCase())\n\n // parse parameters\n if (index !== -1) {\n var key\n var match\n var value\n\n PARAM_REGEXP.lastIndex = index\n\n while ((match = PARAM_REGEXP.exec(header))) {\n if (match.index !== index) {\n throw new TypeError('invalid parameter format')\n }\n\n index += match[0].length\n key = match[1].toLowerCase()\n value = match[2]\n\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value\n .substr(1, value.length - 2)\n .replace(QESC_REGEXP, '$1')\n }\n\n obj.parameters[key] = value\n }\n\n if (index !== header.length) {\n throw new TypeError('invalid parameter format')\n }\n }\n\n return obj\n}\n\n/**\n * Get content-type from req/res objects.\n *\n * @param {object}\n * @return {Object}\n * @private\n */\n\nfunction getcontenttype (obj) {\n var header\n\n if (typeof obj.getHeader === 'function') {\n // res-like\n header = obj.getHeader('content-type')\n } else if (typeof obj.headers === 'object') {\n // req-like\n header = obj.headers && obj.headers['content-type']\n }\n\n if (typeof header !== 'string') {\n throw new TypeError('content-type header is missing from object')\n }\n\n return header\n}\n\n/**\n * Quote a string if necessary.\n *\n * @param {string} val\n * @return {string}\n * @private\n */\n\nfunction qstring (val) {\n var str = String(val)\n\n // no need to quote tokens\n if (TOKEN_REGEXP.test(str)) {\n return str\n }\n\n if (str.length > 0 && !TEXT_REGEXP.test(str)) {\n throw new TypeError('invalid parameter value')\n }\n\n return '\"' + str.replace(QUOTE_REGEXP, '\\\\$1') + '\"'\n}\n\n/**\n * Class to represent a content type.\n * @private\n */\nfunction ContentType (type) {\n this.parameters = Object.create(null)\n this.type = type\n}\n","const cache = new Map<string, SVGSVGElement | Error | undefined>()\n\nexport default cache\n","import { parse as parseContentType } from 'content-type'\nimport isLocal from './is-local'\n\nconst makeAjaxRequest = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: (error: Error | null, httpRequest: XMLHttpRequest) => void\n) => {\n const httpRequest = new XMLHttpRequest()\n\n httpRequest.onreadystatechange = () => {\n try {\n if (!/\\.svg/i.test(url) && httpRequest.readyState === 2) {\n const contentType = httpRequest.getResponseHeader('Content-Type')\n if (!contentType) {\n throw new Error('Content type not found')\n }\n\n const { type } = parseContentType(contentType)\n if (!(type === 'image/svg+xml' || type === 'text/plain')) {\n throw new Error(`Invalid content type: ${type}`)\n }\n }\n\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 404 || httpRequest.responseXML === null) {\n throw new Error(\n isLocal()\n ? 'Note: SVG injection ajax calls do not work locally without ' +\n 'adjusting security settings in your browser. Or consider ' +\n 'using a local webserver.'\n : 'Unable to load SVG file: ' + url\n )\n }\n\n if (\n httpRequest.status === 200 ||\n (isLocal() && httpRequest.status === 0)\n ) {\n callback(null, httpRequest)\n } else {\n throw new Error(\n 'There was a problem injecting the SVG: ' +\n httpRequest.status +\n ' ' +\n httpRequest.statusText\n )\n }\n }\n } catch (error) {\n httpRequest.abort()\n if (error instanceof Error) {\n callback(error, httpRequest)\n } else {\n throw error\n }\n }\n }\n\n httpRequest.open('GET', url)\n\n httpRequest.withCredentials = httpRequestWithCredentials\n\n /* istanbul ignore else */\n if (httpRequest.overrideMimeType) {\n httpRequest.overrideMimeType('text/xml')\n }\n\n httpRequest.send()\n}\n\nexport default makeAjaxRequest\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport { Errback } from './types'\n\nlet requestQueue: { [key: string]: Errback[] } = {}\n\nexport const clear = () => {\n requestQueue = {}\n}\n\nexport const queueRequest = (url: string, callback: Errback) => {\n requestQueue[url] = requestQueue[url] || []\n requestQueue[url].push(callback)\n}\n\nexport const processRequestQueue = (url: string) => {\n for (let i = 0, len = requestQueue[url].length; i < len; i++) {\n // Make these calls async so we avoid blocking the page/renderer.\n setTimeout(() => {\n /* istanbul ignore else */\n if (Array.isArray(requestQueue[url])) {\n const cacheValue = cache.get(url)\n const callback = requestQueue[url][i]\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof Error) {\n callback(cacheValue)\n }\n\n /* istanbul ignore else */\n if (i === requestQueue[url].length - 1) {\n delete requestQueue[url]\n }\n }\n }, 0)\n }\n}\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport makeAjaxRequest from './make-ajax-request'\nimport { processRequestQueue, queueRequest } from './request-queue'\nimport { Errback } from './types'\n\nconst loadSvgCached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n if (cache.has(url)) {\n const cacheValue = cache.get(url)\n\n if (cacheValue === undefined) {\n queueRequest(url, callback)\n return\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n return\n }\n\n // Errors are always refetched.\n }\n\n // Seed the cache to indicate we are loading this URL.\n cache.set(url, undefined)\n queueRequest(url, callback)\n\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n cache.set(url, error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n cache.set(url, httpRequest.responseXML.documentElement)\n }\n processRequestQueue(url)\n })\n}\n\nexport default loadSvgCached\n","import makeAjaxRequest from './make-ajax-request'\nimport { Errback } from './types'\n\nconst loadSvgUncached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n callback(error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n callback(null, httpRequest.responseXML.documentElement)\n }\n })\n}\n\nexport default loadSvgUncached\n","let idCounter = 0\nconst uniqueId = () => ++idCounter\nexport default uniqueId\n","import loadSvgCached from './load-svg-cached'\nimport loadSvgUncached from './load-svg-uncached'\nimport { BeforeEach, Errback, EvalScripts } from './types'\nimport uniqueId from './unique-id'\n\ntype ElementType = Element | HTMLElement | null\n\nconst injectedElements: ElementType[] = []\nconst ranScripts: { [key: string]: boolean } = {}\nconst svgNamespace = 'http://www.w3.org/2000/svg'\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink'\n\nconst injectElement = (\n el: NonNullable<ElementType>,\n evalScripts: EvalScripts,\n renumerateIRIElements: boolean,\n cacheRequests: boolean,\n httpRequestWithCredentials: boolean,\n beforeEach: BeforeEach,\n callback: Errback\n) => {\n const elUrl = el.getAttribute('data-src') || el.getAttribute('src')\n\n /* istanbul ignore else */\n if (!elUrl) {\n callback(new Error('Invalid data-src or src attribute'))\n return\n }\n\n // Make sure we aren't already in the process of injecting this element to\n // avoid a race condition if multiple injections for the same element are run.\n // :NOTE: Using indexOf() only _after_ we check for SVG support and bail, so\n // no need for IE8 indexOf() polyfill.\n /* istanbul ignore else */\n if (injectedElements.indexOf(el) !== -1) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n return\n }\n\n // Remember the request to inject this element, in case other injection calls\n // are also trying to replace this element before we finish.\n injectedElements.push(el)\n\n // Try to avoid loading the orginal image src if possible.\n el.setAttribute('src', '')\n\n const loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached\n\n loadSvg(elUrl, httpRequestWithCredentials, (error, svg) => {\n /* istanbul ignore else */\n if (!svg) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(error)\n return\n }\n\n const elId = el.getAttribute('id')\n /* istanbul ignore else */\n if (elId) {\n svg.setAttribute('id', elId)\n }\n\n const elTitle = el.getAttribute('title')\n /* istanbul ignore else */\n if (elTitle) {\n svg.setAttribute('title', elTitle)\n }\n\n const elWidth = el.getAttribute('width')\n /* istanbul ignore else */\n if (elWidth) {\n svg.setAttribute('width', elWidth)\n }\n\n const elHeight = el.getAttribute('height')\n /* istanbul ignore else */\n if (elHeight) {\n svg.setAttribute('height', elHeight)\n }\n\n const mergedClasses = Array.from(\n new Set([\n ...(svg.getAttribute('class') || '').split(' '),\n 'injected-svg',\n ...(el.getAttribute('class') || '').split(' '),\n ])\n )\n .join(' ')\n .trim()\n svg.setAttribute('class', mergedClasses)\n\n const elStyle = el.getAttribute('style')\n /* istanbul ignore else */\n if (elStyle) {\n svg.setAttribute('style', elStyle)\n }\n\n svg.setAttribute('data-src', elUrl)\n\n // Copy all the data elements to the svg.\n const elData = [].filter.call(el.attributes, (at: Attr) => {\n return /^data-\\w[\\w-]*$/.test(at.name)\n })\n\n Array.prototype.forEach.call(elData, (dataAttr: Attr) => {\n /* istanbul ignore else */\n if (dataAttr.name && dataAttr.value) {\n svg.setAttribute(dataAttr.name, dataAttr.value)\n }\n })\n\n /* istanbul ignore else */\n if (renumerateIRIElements) {\n // Make sure any internally referenced clipPath ids and their clip-path\n // references are unique.\n //\n // This addresses the issue of having multiple instances of the same SVG\n // on a page and only the first clipPath id is referenced.\n //\n // Browsers often shortcut the SVG Spec and don't use clipPaths contained\n // in parent elements that are hidden, so if you hide the first SVG\n // instance on the page, then all other instances lose their clipping.\n // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n\n // Handle all defs elements that have iri capable attributes as defined by\n // w3c: http://www.w3.org/TR/SVG/linking.html#processingIRI. Mapping IRI\n // addressable elements to the properties that can reference them.\n const iriElementsAndProperties: { [key: string]: string[] } = {\n clipPath: ['clip-path'],\n 'color-profile': ['color-profile'],\n cursor: ['cursor'],\n filter: ['filter'],\n linearGradient: ['fill', 'stroke'],\n marker: ['marker', 'marker-start', 'marker-mid', 'marker-end'],\n mask: ['mask'],\n path: [],\n pattern: ['fill', 'stroke'],\n radialGradient: ['fill', 'stroke'],\n }\n\n let element\n let elements\n let properties\n let currentId: string\n let newId: string\n\n Object.keys(iriElementsAndProperties).forEach((key) => {\n element = key\n properties = iriElementsAndProperties[key]\n\n elements = svg.querySelectorAll(element + '[id]')\n for (let a = 0, elementsLen = elements.length; a < elementsLen; a++) {\n currentId = elements[a].id\n newId = currentId + '-' + uniqueId()\n\n // All of the properties that can reference this element type.\n let referencingElements\n Array.prototype.forEach.call(properties, (property: string) => {\n // :NOTE: using a substring match attr selector here to deal with IE\n // \"adding extra quotes in url() attrs\".\n referencingElements = svg.querySelectorAll(\n '[' + property + '*=\"' + currentId + '\"]'\n )\n for (\n let b = 0, referencingElementLen = referencingElements.length;\n b < referencingElementLen;\n b++\n ) {\n const attrValue: string | null =\n referencingElements[b].getAttribute(property)\n if (\n attrValue &&\n !attrValue.match(new RegExp('url\\\\(\"?#' + currentId + '\"?\\\\)'))\n ) {\n continue\n }\n referencingElements[b].setAttribute(\n property,\n 'url(#' + newId + ')'\n )\n }\n })\n\n const allLinks = svg.querySelectorAll('[*|href]')\n const links = []\n for (let c = 0, allLinksLen = allLinks.length; c < allLinksLen; c++) {\n const href = allLinks[c].getAttributeNS(xlinkNamespace, 'href')\n /* istanbul ignore else */\n if (href && href.toString() === '#' + elements[a].id) {\n links.push(allLinks[c])\n }\n }\n for (let d = 0, linksLen = links.length; d < linksLen; d++) {\n links[d].setAttributeNS(xlinkNamespace, 'href', '#' + newId)\n }\n\n elements[a].id = newId\n }\n })\n }\n\n // Remove any unwanted/invalid namespaces that might have been added by SVG\n // editing tools.\n svg.removeAttribute('xmlns:a')\n\n // Post page load injected SVGs don't automatically have their script\n // elements run, so we'll need to make that happen, if requested.\n\n // Find then prune the scripts.\n const scripts = svg.querySelectorAll('script')\n const scriptsToEval: string[] = []\n let script\n let scriptType\n\n for (let i = 0, scriptsLen = scripts.length; i < scriptsLen; i++) {\n scriptType = scripts[i].getAttribute('type')\n\n // Only process javascript types. SVG defaults to 'application/ecmascript'\n // for unset types.\n /* istanbul ignore else */\n if (\n !scriptType ||\n scriptType === 'application/ecmascript' ||\n scriptType === 'application/javascript' ||\n scriptType === 'text/javascript'\n ) {\n // innerText for IE, textContent for other browsers.\n script = scripts[i].innerText || scripts[i].textContent\n\n // Stash.\n /* istanbul ignore else */\n if (script) {\n scriptsToEval.push(script)\n }\n\n // Tidy up and remove the script element since we don't need it anymore.\n svg.removeChild(scripts[i])\n }\n }\n\n // Run/Eval the scripts if needed.\n /* istanbul ignore else */\n if (\n scriptsToEval.length > 0 &&\n (evalScripts === 'always' ||\n (evalScripts === 'once' && !ranScripts[elUrl]))\n ) {\n for (\n let l = 0, scriptsToEvalLen = scriptsToEval.length;\n l < scriptsToEvalLen;\n l++\n ) {\n // :NOTE: Yup, this is a form of eval, but it is being used to eval code\n // the caller has explictely asked to be loaded, and the code is in a\n // caller defined SVG file... not raw user input.\n //\n // Also, the code is evaluated in a closure and not in the global scope.\n // If you need to put something in global scope, use 'window'.\n new Function(scriptsToEval[l])(window)\n }\n\n // Remember we already ran scripts for this svg.\n ranScripts[elUrl] = true\n }\n\n // :WORKAROUND: IE doesn't evaluate <style> tags in SVGs that are\n // dynamically added to the page. This trick will trigger IE to read and use\n // any existing SVG <style> tags.\n //\n // Reference: https://github.com/iconic/SVGInjector/issues/23.\n const styleTags = svg.querySelectorAll('style')\n Array.prototype.forEach.call(styleTags, (styleTag: HTMLStyleElement) => {\n styleTag.textContent += ''\n })\n\n svg.setAttribute('xmlns', svgNamespace)\n svg.setAttribute('xmlns:xlink', xlinkNamespace)\n\n beforeEach(svg)\n\n if (!el.parentNode) {\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(new Error('Parent node is null'))\n return\n }\n\n // Replace the image with the svg.\n el.parentNode.replaceChild(svg, el)\n\n // Now that we no longer need it, drop references to the original element so\n // it can be GC'd.\n // TODO: Extract\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n\n callback(null, svg)\n })\n}\n\nexport default injectElement\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n","import injectElement from './inject-element'\nimport { AfterAll, BeforeEach, Errback, EvalScripts } from './types'\n\ntype Elements = HTMLCollectionOf<Element> | NodeListOf<Element> | Element | null\n\ninterface OptionalArgs {\n afterAll?: AfterAll\n afterEach?: Errback\n beforeEach?: BeforeEach\n cacheRequests?: boolean\n evalScripts?: EvalScripts\n httpRequestWithCredentials?: boolean\n renumerateIRIElements?: boolean\n}\n\nconst SVGInjector = (\n elements: Elements,\n {\n afterAll = () => undefined,\n afterEach = () => undefined,\n beforeEach = () => undefined,\n cacheRequests = true,\n evalScripts = 'never',\n httpRequestWithCredentials = false,\n renumerateIRIElements = true,\n }: OptionalArgs = {}\n) => {\n if (elements && 'length' in elements) {\n let elementsLoaded = 0\n for (let i = 0, j = elements.length; i < j; i++) {\n injectElement(\n elements[i],\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n if (\n elements &&\n 'length' in elements &&\n elements.length === ++elementsLoaded\n ) {\n afterAll(elementsLoaded)\n }\n }\n )\n }\n } else if (elements) {\n injectElement(\n elements,\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n afterAll(1)\n elements = null\n }\n )\n } else {\n afterAll(0)\n }\n}\n\nexport default SVGInjector\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n"],"names":["_extends","module","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","exports","apply","this","excluded","sourceKeys","keys","indexOf","_setPrototypeOf","o","p","setPrototypeOf","__proto__","subClass","superClass","create","constructor","__spreadArray","to","from","pack","ar","l","Array","slice","concat","PARAM_REGEXP","QESC_REGEXP","TYPE_REGEXP","string","TypeError","header","obj","getHeader","headers","getcontenttype","index","type","substr","trim","test","ContentType","toLowerCase","match","value","lastIndex","exec","replace","parameters","Error","status","httpRequest","requestQueue","has","cache","url","httpRequestWithCredentials","callback","idCounter","elUrl","el","getAttribute","cacheRequests","setAttribute","elWidth","split","at","newId_1","marker","properties_1","forEach","a","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_this","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","nonReactTarget","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","document","createElementNS","createElement","appendChild","dataset","_c","SVGInjector","afterEach","error","svg","_this2","removeSVG","setState","beforeEach","_this$nonReactWrapper","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","b","shallowDiffers","_this3","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"qvBAA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B,aAChBL,gBAAiB,aACjBC,YAAa,QACbgC,SAAU,KACVE,QAAS,KACTjC,uBAAuB,EACvBE,iBAAiB,EACjBE,QAAS"}
|
|
1
|
+
{"version":3,"file":"react-svg.umd.production.js","sources":["../node_modules/@babel/runtime/helpers/extends.js","../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/inheritsLoose.js","../node_modules/@tanem/svg-injector/node_modules/tslib/tslib.es6.js","../node_modules/content-type/index.js","../node_modules/@tanem/svg-injector/src/cache.ts","../node_modules/@tanem/svg-injector/src/make-ajax-request.ts","../node_modules/@tanem/svg-injector/src/request-queue.ts","../node_modules/@tanem/svg-injector/src/load-svg-cached.ts","../node_modules/@tanem/svg-injector/src/load-svg-uncached.ts","../node_modules/@tanem/svg-injector/src/unique-id.ts","../node_modules/@tanem/svg-injector/src/inject-element.ts","../compiled/ReactSVG.js","../node_modules/@tanem/svg-injector/src/svg-injector.ts","../compiled/shallow-differs.js"],"sourcesContent":["function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inheritsLoose;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/*!\n * content-type\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nvar PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *(\"(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*\"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g\nvar TEXT_REGEXP = /^[\\u000b\\u0020-\\u007e\\u0080-\\u00ff]+$/\nvar TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nvar QESC_REGEXP = /\\\\([\\u000b\\u0020-\\u00ff])/g\n\n/**\n * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6\n */\nvar QUOTE_REGEXP = /([\\\\\"])/g\n\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nvar TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/\n\n/**\n * Module exports.\n * @public\n */\n\nexports.format = format\nexports.parse = parse\n\n/**\n * Format object to media type.\n *\n * @param {object} obj\n * @return {string}\n * @public\n */\n\nfunction format (obj) {\n if (!obj || typeof obj !== 'object') {\n throw new TypeError('argument obj is required')\n }\n\n var parameters = obj.parameters\n var type = obj.type\n\n if (!type || !TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid type')\n }\n\n var string = type\n\n // append parameters\n if (parameters && typeof parameters === 'object') {\n var param\n var params = Object.keys(parameters).sort()\n\n for (var i = 0; i < params.length; i++) {\n param = params[i]\n\n if (!TOKEN_REGEXP.test(param)) {\n throw new TypeError('invalid parameter name')\n }\n\n string += '; ' + param + '=' + qstring(parameters[param])\n }\n }\n\n return string\n}\n\n/**\n * Parse media type to object.\n *\n * @param {string|object} string\n * @return {Object}\n * @public\n */\n\nfunction parse (string) {\n if (!string) {\n throw new TypeError('argument string is required')\n }\n\n // support req/res-like objects as argument\n var header = typeof string === 'object'\n ? getcontenttype(string)\n : string\n\n if (typeof header !== 'string') {\n throw new TypeError('argument string is required to be a string')\n }\n\n var index = header.indexOf(';')\n var type = index !== -1\n ? header.substr(0, index).trim()\n : header.trim()\n\n if (!TYPE_REGEXP.test(type)) {\n throw new TypeError('invalid media type')\n }\n\n var obj = new ContentType(type.toLowerCase())\n\n // parse parameters\n if (index !== -1) {\n var key\n var match\n var value\n\n PARAM_REGEXP.lastIndex = index\n\n while ((match = PARAM_REGEXP.exec(header))) {\n if (match.index !== index) {\n throw new TypeError('invalid parameter format')\n }\n\n index += match[0].length\n key = match[1].toLowerCase()\n value = match[2]\n\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value\n .substr(1, value.length - 2)\n .replace(QESC_REGEXP, '$1')\n }\n\n obj.parameters[key] = value\n }\n\n if (index !== header.length) {\n throw new TypeError('invalid parameter format')\n }\n }\n\n return obj\n}\n\n/**\n * Get content-type from req/res objects.\n *\n * @param {object}\n * @return {Object}\n * @private\n */\n\nfunction getcontenttype (obj) {\n var header\n\n if (typeof obj.getHeader === 'function') {\n // res-like\n header = obj.getHeader('content-type')\n } else if (typeof obj.headers === 'object') {\n // req-like\n header = obj.headers && obj.headers['content-type']\n }\n\n if (typeof header !== 'string') {\n throw new TypeError('content-type header is missing from object')\n }\n\n return header\n}\n\n/**\n * Quote a string if necessary.\n *\n * @param {string} val\n * @return {string}\n * @private\n */\n\nfunction qstring (val) {\n var str = String(val)\n\n // no need to quote tokens\n if (TOKEN_REGEXP.test(str)) {\n return str\n }\n\n if (str.length > 0 && !TEXT_REGEXP.test(str)) {\n throw new TypeError('invalid parameter value')\n }\n\n return '\"' + str.replace(QUOTE_REGEXP, '\\\\$1') + '\"'\n}\n\n/**\n * Class to represent a content type.\n * @private\n */\nfunction ContentType (type) {\n this.parameters = Object.create(null)\n this.type = type\n}\n","const cache = new Map<string, SVGSVGElement | Error | undefined>()\n\nexport default cache\n","import { parse as parseContentType } from 'content-type'\nimport isLocal from './is-local'\n\nconst makeAjaxRequest = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: (error: Error | null, httpRequest: XMLHttpRequest) => void\n) => {\n const httpRequest = new XMLHttpRequest()\n\n httpRequest.onreadystatechange = () => {\n try {\n if (!/\\.svg/i.test(url) && httpRequest.readyState === 2) {\n const contentType = httpRequest.getResponseHeader('Content-Type')\n if (!contentType) {\n throw new Error('Content type not found')\n }\n\n const { type } = parseContentType(contentType)\n if (!(type === 'image/svg+xml' || type === 'text/plain')) {\n throw new Error(`Invalid content type: ${type}`)\n }\n }\n\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 404 || httpRequest.responseXML === null) {\n throw new Error(\n isLocal()\n ? 'Note: SVG injection ajax calls do not work locally without ' +\n 'adjusting security settings in your browser. Or consider ' +\n 'using a local webserver.'\n : 'Unable to load SVG file: ' + url\n )\n }\n\n if (\n httpRequest.status === 200 ||\n (isLocal() && httpRequest.status === 0)\n ) {\n callback(null, httpRequest)\n } else {\n throw new Error(\n 'There was a problem injecting the SVG: ' +\n httpRequest.status +\n ' ' +\n httpRequest.statusText\n )\n }\n }\n } catch (error) {\n httpRequest.abort()\n if (error instanceof Error) {\n callback(error, httpRequest)\n } else {\n throw error\n }\n }\n }\n\n httpRequest.open('GET', url)\n\n httpRequest.withCredentials = httpRequestWithCredentials\n\n /* istanbul ignore else */\n if (httpRequest.overrideMimeType) {\n httpRequest.overrideMimeType('text/xml')\n }\n\n httpRequest.send()\n}\n\nexport default makeAjaxRequest\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport { Errback } from './types'\n\nlet requestQueue: { [key: string]: Errback[] } = {}\n\nexport const clear = () => {\n requestQueue = {}\n}\n\nexport const queueRequest = (url: string, callback: Errback) => {\n requestQueue[url] = requestQueue[url] || []\n requestQueue[url].push(callback)\n}\n\nexport const processRequestQueue = (url: string) => {\n for (let i = 0, len = requestQueue[url].length; i < len; i++) {\n // Make these calls async so we avoid blocking the page/renderer.\n setTimeout(() => {\n /* istanbul ignore else */\n if (Array.isArray(requestQueue[url])) {\n const cacheValue = cache.get(url)\n const callback = requestQueue[url][i]\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof Error) {\n callback(cacheValue)\n }\n\n /* istanbul ignore else */\n if (i === requestQueue[url].length - 1) {\n delete requestQueue[url]\n }\n }\n }, 0)\n }\n}\n","import cache from './cache'\nimport cloneSvg from './clone-svg'\nimport makeAjaxRequest from './make-ajax-request'\nimport { processRequestQueue, queueRequest } from './request-queue'\nimport { Errback } from './types'\n\nconst loadSvgCached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n if (cache.has(url)) {\n const cacheValue = cache.get(url)\n\n if (cacheValue === undefined) {\n queueRequest(url, callback)\n return\n }\n\n /* istanbul ignore else */\n if (cacheValue instanceof SVGSVGElement) {\n callback(null, cloneSvg(cacheValue))\n return\n }\n\n // Errors are always refetched.\n }\n\n // Seed the cache to indicate we are loading this URL.\n cache.set(url, undefined)\n queueRequest(url, callback)\n\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n cache.set(url, error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n cache.set(url, httpRequest.responseXML.documentElement)\n }\n processRequestQueue(url)\n })\n}\n\nexport default loadSvgCached\n","import makeAjaxRequest from './make-ajax-request'\nimport { Errback } from './types'\n\nconst loadSvgUncached = (\n url: string,\n httpRequestWithCredentials: boolean,\n callback: Errback\n) => {\n makeAjaxRequest(url, httpRequestWithCredentials, (error, httpRequest) => {\n /* istanbul ignore else */\n if (error) {\n callback(error)\n } else if (\n httpRequest.responseXML instanceof Document &&\n httpRequest.responseXML.documentElement &&\n httpRequest.responseXML.documentElement instanceof SVGSVGElement\n ) {\n callback(null, httpRequest.responseXML.documentElement)\n }\n })\n}\n\nexport default loadSvgUncached\n","let idCounter = 0\nconst uniqueId = () => ++idCounter\nexport default uniqueId\n","import loadSvgCached from './load-svg-cached'\nimport loadSvgUncached from './load-svg-uncached'\nimport { BeforeEach, Errback, EvalScripts } from './types'\nimport uniqueId from './unique-id'\n\ntype ElementType = Element | HTMLElement | null\n\nconst injectedElements: ElementType[] = []\nconst ranScripts: { [key: string]: boolean } = {}\nconst svgNamespace = 'http://www.w3.org/2000/svg'\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink'\n\nconst injectElement = (\n el: NonNullable<ElementType>,\n evalScripts: EvalScripts,\n renumerateIRIElements: boolean,\n cacheRequests: boolean,\n httpRequestWithCredentials: boolean,\n beforeEach: BeforeEach,\n callback: Errback\n) => {\n const elUrl = el.getAttribute('data-src') || el.getAttribute('src')\n\n /* istanbul ignore else */\n if (!elUrl) {\n callback(new Error('Invalid data-src or src attribute'))\n return\n }\n\n // Make sure we aren't already in the process of injecting this element to\n // avoid a race condition if multiple injections for the same element are run.\n // :NOTE: Using indexOf() only _after_ we check for SVG support and bail, so\n // no need for IE8 indexOf() polyfill.\n /* istanbul ignore else */\n if (injectedElements.indexOf(el) !== -1) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n return\n }\n\n // Remember the request to inject this element, in case other injection calls\n // are also trying to replace this element before we finish.\n injectedElements.push(el)\n\n // Try to avoid loading the orginal image src if possible.\n el.setAttribute('src', '')\n\n const loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached\n\n loadSvg(elUrl, httpRequestWithCredentials, (error, svg) => {\n /* istanbul ignore else */\n if (!svg) {\n // TODO: Extract.\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(error)\n return\n }\n\n const elId = el.getAttribute('id')\n /* istanbul ignore else */\n if (elId) {\n svg.setAttribute('id', elId)\n }\n\n const elTitle = el.getAttribute('title')\n /* istanbul ignore else */\n if (elTitle) {\n svg.setAttribute('title', elTitle)\n }\n\n const elWidth = el.getAttribute('width')\n /* istanbul ignore else */\n if (elWidth) {\n svg.setAttribute('width', elWidth)\n }\n\n const elHeight = el.getAttribute('height')\n /* istanbul ignore else */\n if (elHeight) {\n svg.setAttribute('height', elHeight)\n }\n\n const mergedClasses = Array.from(\n new Set([\n ...(svg.getAttribute('class') || '').split(' '),\n 'injected-svg',\n ...(el.getAttribute('class') || '').split(' '),\n ])\n )\n .join(' ')\n .trim()\n svg.setAttribute('class', mergedClasses)\n\n const elStyle = el.getAttribute('style')\n /* istanbul ignore else */\n if (elStyle) {\n svg.setAttribute('style', elStyle)\n }\n\n svg.setAttribute('data-src', elUrl)\n\n // Copy all the data elements to the svg.\n const elData = [].filter.call(el.attributes, (at: Attr) => {\n return /^data-\\w[\\w-]*$/.test(at.name)\n })\n\n Array.prototype.forEach.call(elData, (dataAttr: Attr) => {\n /* istanbul ignore else */\n if (dataAttr.name && dataAttr.value) {\n svg.setAttribute(dataAttr.name, dataAttr.value)\n }\n })\n\n /* istanbul ignore else */\n if (renumerateIRIElements) {\n // Make sure any internally referenced clipPath ids and their clip-path\n // references are unique.\n //\n // This addresses the issue of having multiple instances of the same SVG\n // on a page and only the first clipPath id is referenced.\n //\n // Browsers often shortcut the SVG Spec and don't use clipPaths contained\n // in parent elements that are hidden, so if you hide the first SVG\n // instance on the page, then all other instances lose their clipping.\n // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n\n // Handle all defs elements that have iri capable attributes as defined by\n // w3c: http://www.w3.org/TR/SVG/linking.html#processingIRI. Mapping IRI\n // addressable elements to the properties that can reference them.\n const iriElementsAndProperties: { [key: string]: string[] } = {\n clipPath: ['clip-path'],\n 'color-profile': ['color-profile'],\n cursor: ['cursor'],\n filter: ['filter'],\n linearGradient: ['fill', 'stroke'],\n marker: ['marker', 'marker-start', 'marker-mid', 'marker-end'],\n mask: ['mask'],\n path: [],\n pattern: ['fill', 'stroke'],\n radialGradient: ['fill', 'stroke'],\n }\n\n let element\n let elements\n let properties\n let currentId: string\n let newId: string\n\n Object.keys(iriElementsAndProperties).forEach((key) => {\n element = key\n properties = iriElementsAndProperties[key]\n\n elements = svg.querySelectorAll(element + '[id]')\n for (let a = 0, elementsLen = elements.length; a < elementsLen; a++) {\n currentId = elements[a].id\n newId = currentId + '-' + uniqueId()\n\n // All of the properties that can reference this element type.\n let referencingElements\n Array.prototype.forEach.call(properties, (property: string) => {\n // :NOTE: using a substring match attr selector here to deal with IE\n // \"adding extra quotes in url() attrs\".\n referencingElements = svg.querySelectorAll(\n '[' + property + '*=\"' + currentId + '\"]'\n )\n for (\n let b = 0, referencingElementLen = referencingElements.length;\n b < referencingElementLen;\n b++\n ) {\n const attrValue: string | null =\n referencingElements[b].getAttribute(property)\n if (\n attrValue &&\n !attrValue.match(new RegExp('url\\\\(\"?#' + currentId + '\"?\\\\)'))\n ) {\n continue\n }\n referencingElements[b].setAttribute(\n property,\n 'url(#' + newId + ')'\n )\n }\n })\n\n const allLinks = svg.querySelectorAll('[*|href]')\n const links = []\n for (let c = 0, allLinksLen = allLinks.length; c < allLinksLen; c++) {\n const href = allLinks[c].getAttributeNS(xlinkNamespace, 'href')\n /* istanbul ignore else */\n if (href && href.toString() === '#' + elements[a].id) {\n links.push(allLinks[c])\n }\n }\n for (let d = 0, linksLen = links.length; d < linksLen; d++) {\n links[d].setAttributeNS(xlinkNamespace, 'href', '#' + newId)\n }\n\n elements[a].id = newId\n }\n })\n }\n\n // Remove any unwanted/invalid namespaces that might have been added by SVG\n // editing tools.\n svg.removeAttribute('xmlns:a')\n\n // Post page load injected SVGs don't automatically have their script\n // elements run, so we'll need to make that happen, if requested.\n\n // Find then prune the scripts.\n const scripts = svg.querySelectorAll('script')\n const scriptsToEval: string[] = []\n let script\n let scriptType\n\n for (let i = 0, scriptsLen = scripts.length; i < scriptsLen; i++) {\n scriptType = scripts[i].getAttribute('type')\n\n // Only process javascript types. SVG defaults to 'application/ecmascript'\n // for unset types.\n /* istanbul ignore else */\n if (\n !scriptType ||\n scriptType === 'application/ecmascript' ||\n scriptType === 'application/javascript' ||\n scriptType === 'text/javascript'\n ) {\n // innerText for IE, textContent for other browsers.\n script = scripts[i].innerText || scripts[i].textContent\n\n // Stash.\n /* istanbul ignore else */\n if (script) {\n scriptsToEval.push(script)\n }\n\n // Tidy up and remove the script element since we don't need it anymore.\n svg.removeChild(scripts[i])\n }\n }\n\n // Run/Eval the scripts if needed.\n /* istanbul ignore else */\n if (\n scriptsToEval.length > 0 &&\n (evalScripts === 'always' ||\n (evalScripts === 'once' && !ranScripts[elUrl]))\n ) {\n for (\n let l = 0, scriptsToEvalLen = scriptsToEval.length;\n l < scriptsToEvalLen;\n l++\n ) {\n // :NOTE: Yup, this is a form of eval, but it is being used to eval code\n // the caller has explictely asked to be loaded, and the code is in a\n // caller defined SVG file... not raw user input.\n //\n // Also, the code is evaluated in a closure and not in the global scope.\n // If you need to put something in global scope, use 'window'.\n new Function(scriptsToEval[l])(window)\n }\n\n // Remember we already ran scripts for this svg.\n ranScripts[elUrl] = true\n }\n\n // :WORKAROUND: IE doesn't evaluate <style> tags in SVGs that are\n // dynamically added to the page. This trick will trigger IE to read and use\n // any existing SVG <style> tags.\n //\n // Reference: https://github.com/iconic/SVGInjector/issues/23.\n const styleTags = svg.querySelectorAll('style')\n Array.prototype.forEach.call(styleTags, (styleTag: HTMLStyleElement) => {\n styleTag.textContent += ''\n })\n\n svg.setAttribute('xmlns', svgNamespace)\n svg.setAttribute('xmlns:xlink', xlinkNamespace)\n\n beforeEach(svg)\n\n if (!el.parentNode) {\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n callback(new Error('Parent node is null'))\n return\n }\n\n // Replace the image with the svg.\n el.parentNode.replaceChild(svg, el)\n\n // Now that we no longer need it, drop references to the original element so\n // it can be GC'd.\n // TODO: Extract\n injectedElements.splice(injectedElements.indexOf(el), 1)\n ;(el as ElementType) = null\n\n callback(null, svg)\n })\n}\n\nexport default injectElement\n","import { SVGInjector } from '@tanem/svg-injector';\nimport * as PropTypes from 'prop-types';\nimport * as React from 'react';\nimport shallowDiffers from './shallow-differs';\nconst svgNamespace = 'http://www.w3.org/2000/svg';\nconst xlinkNamespace = 'http://www.w3.org/1999/xlink';\nexport class ReactSVG extends React.Component {\n static defaultProps = {\n afterInjection: () => undefined,\n beforeInjection: () => undefined,\n evalScripts: 'never',\n fallback: null,\n httpRequestWithCredentials: false,\n loading: null,\n renumerateIRIElements: true,\n useRequestCache: true,\n wrapper: 'div',\n };\n static propTypes = {\n afterInjection: PropTypes.func,\n beforeInjection: PropTypes.func,\n evalScripts: PropTypes.oneOf(['always', 'once', 'never']),\n fallback: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n httpRequestWithCredentials: PropTypes.bool,\n loading: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]),\n renumerateIRIElements: PropTypes.bool,\n src: PropTypes.string.isRequired,\n useRequestCache: PropTypes.bool,\n wrapper: PropTypes.oneOf(['div', 'span', 'svg']),\n };\n initialState = {\n hasError: false,\n isLoading: true,\n };\n state = this.initialState;\n _isMounted = false;\n reactWrapper;\n nonReactWrapper;\n refCallback = (reactWrapper) => {\n this.reactWrapper = reactWrapper;\n };\n renderSVG() {\n /* istanbul ignore else */\n if (this.reactWrapper instanceof Node) {\n const { beforeInjection, evalScripts, httpRequestWithCredentials, renumerateIRIElements, src, useRequestCache, } = this.props;\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const afterInjection = this.props.afterInjection;\n const wrapper = this.props.wrapper;\n /* eslint-enable @typescript-eslint/no-non-null-assertion */\n let nonReactWrapper;\n let nonReactTarget;\n if (wrapper === 'svg') {\n nonReactWrapper = document.createElementNS(svgNamespace, wrapper);\n nonReactWrapper.setAttribute('xmlns', svgNamespace);\n nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);\n nonReactTarget = document.createElementNS(svgNamespace, wrapper);\n }\n else {\n nonReactWrapper = document.createElement(wrapper);\n nonReactTarget = document.createElement(wrapper);\n }\n nonReactWrapper.appendChild(nonReactTarget);\n nonReactTarget.dataset.src = src;\n this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);\n const afterEach = (error, svg) => {\n if (error) {\n this.removeSVG();\n if (!this._isMounted) {\n afterInjection(error);\n return;\n }\n }\n // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector\n // callbacks instead of tracking a property like this.\n if (this._isMounted) {\n this.setState(() => ({\n hasError: !!error,\n isLoading: false,\n }), () => {\n afterInjection(error, svg);\n });\n }\n };\n SVGInjector(nonReactTarget, {\n afterEach,\n beforeEach: beforeInjection,\n cacheRequests: useRequestCache,\n evalScripts,\n httpRequestWithCredentials,\n renumerateIRIElements,\n });\n }\n }\n removeSVG() {\n if (this.nonReactWrapper?.parentNode) {\n this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);\n this.nonReactWrapper = null;\n }\n }\n componentDidMount() {\n this._isMounted = true;\n this.renderSVG();\n }\n componentDidUpdate(prevProps) {\n if (shallowDiffers(prevProps, this.props)) {\n this.setState(() => this.initialState, () => {\n this.removeSVG();\n this.renderSVG();\n });\n }\n }\n componentWillUnmount() {\n this._isMounted = false;\n this.removeSVG();\n }\n render() {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { afterInjection, beforeInjection, evalScripts, fallback: Fallback, httpRequestWithCredentials, loading: Loading, renumerateIRIElements, src, useRequestCache, wrapper, ...rest } = this.props;\n /* eslint-enable @typescript-eslint/no-unused-vars */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const Wrapper = wrapper;\n return (React.createElement(Wrapper, { ...rest, ref: this.refCallback, ...(wrapper === 'svg'\n ? {\n xmlns: svgNamespace,\n xmlnsXlink: xlinkNamespace,\n }\n : {}) },\n this.state.isLoading && Loading && React.createElement(Loading, null),\n this.state.hasError && Fallback && React.createElement(Fallback, null)));\n }\n}\n","import injectElement from './inject-element'\nimport { AfterAll, BeforeEach, Errback, EvalScripts } from './types'\n\ntype Elements = HTMLCollectionOf<Element> | NodeListOf<Element> | Element | null\n\ninterface OptionalArgs {\n afterAll?: AfterAll\n afterEach?: Errback\n beforeEach?: BeforeEach\n cacheRequests?: boolean\n evalScripts?: EvalScripts\n httpRequestWithCredentials?: boolean\n renumerateIRIElements?: boolean\n}\n\nconst SVGInjector = (\n elements: Elements,\n {\n afterAll = () => undefined,\n afterEach = () => undefined,\n beforeEach = () => undefined,\n cacheRequests = true,\n evalScripts = 'never',\n httpRequestWithCredentials = false,\n renumerateIRIElements = true,\n }: OptionalArgs = {}\n) => {\n if (elements && 'length' in elements) {\n let elementsLoaded = 0\n for (let i = 0, j = elements.length; i < j; i++) {\n injectElement(\n elements[i],\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n if (\n elements &&\n 'length' in elements &&\n elements.length === ++elementsLoaded\n ) {\n afterAll(elementsLoaded)\n }\n }\n )\n }\n } else if (elements) {\n injectElement(\n elements,\n evalScripts,\n renumerateIRIElements,\n cacheRequests,\n httpRequestWithCredentials,\n beforeEach,\n (error, svg) => {\n afterEach(error, svg)\n afterAll(1)\n elements = null\n }\n )\n } else {\n afterAll(0)\n }\n}\n\nexport default SVGInjector\n","// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.\nconst shallowDiffers = (a, b) => {\n for (const i in a) {\n if (!(i in b)) {\n return true;\n }\n }\n for (const i in b) {\n if (a[i] !== b[i]) {\n return true;\n }\n }\n return false;\n};\nexport default shallowDiffers;\n"],"names":["_extends","module","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","exports","apply","this","excluded","sourceKeys","keys","indexOf","_setPrototypeOf","o","p","setPrototypeOf","__proto__","subClass","superClass","create","constructor","__spreadArray","to","from","pack","ar","l","Array","slice","concat","PARAM_REGEXP","QESC_REGEXP","TYPE_REGEXP","string","TypeError","header","obj","getHeader","headers","getcontenttype","index","type","substr","trim","test","ContentType","toLowerCase","match","value","lastIndex","exec","replace","parameters","Error","status","httpRequest","requestQueue","has","cache","url","httpRequestWithCredentials","callback","idCounter","elUrl","el","getAttribute","cacheRequests","setAttribute","elWidth","split","at","newId_1","marker","properties_1","forEach","a","svgNamespace","xlinkNamespace","ReactSVG","initialState","hasError","isLoading","state","_this","_isMounted","reactWrapper","nonReactWrapper","refCallback","renderSVG","Node","nonReactTarget","props","beforeInjection","evalScripts","renumerateIRIElements","src","useRequestCache","afterInjection","wrapper","document","createElementNS","createElement","appendChild","dataset","_c","SVGInjector","afterEach","error","svg","_this2","removeSVG","setState","beforeEach","_this$nonReactWrapper","parentNode","removeChild","componentDidMount","componentDidUpdate","prevProps","b","shallowDiffers","_this3","componentWillUnmount","render","Fallback","fallback","Loading","loading","rest","React","ref","xmlns","xmlnsXlink","Component","defaultProps"],"mappings":"qvBAAA,SAASA,IAgBP,OAfAC,UAAiBD,EAAWE,OAAOC,QAAU,SAAUC,GACrD,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CACzC,IAAIG,EAASF,UAAUD,GAEvB,IAAK,IAAII,KAAOD,EACVN,OAAOQ,UAAUC,e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ED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-svg",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.2",
|
|
4
4
|
"description": "A React component that injects SVG into the DOM.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/react-svg.esm.js",
|
|
@@ -53,41 +53,41 @@
|
|
|
53
53
|
"react-dom": "^15.5.4 || ^16.0.0 || ^17.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@babel/runtime": "^7.
|
|
57
|
-
"@tanem/svg-injector": "^10.1.
|
|
56
|
+
"@babel/runtime": "^7.16.0",
|
|
57
|
+
"@tanem/svg-injector": "^10.1.9",
|
|
58
58
|
"@types/prop-types": "^15.7.4",
|
|
59
59
|
"prop-types": "^15.7.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/core": "7.
|
|
63
|
-
"@babel/plugin-transform-runtime": "7.
|
|
64
|
-
"@babel/preset-env": "7.
|
|
65
|
-
"@babel/preset-react": "7.
|
|
62
|
+
"@babel/core": "7.16.0",
|
|
63
|
+
"@babel/plugin-transform-runtime": "7.16.0",
|
|
64
|
+
"@babel/preset-env": "7.16.0",
|
|
65
|
+
"@babel/preset-react": "7.16.0",
|
|
66
66
|
"@testing-library/react": "12.1.2",
|
|
67
|
-
"@types/faker": "5.5.
|
|
67
|
+
"@types/faker": "5.5.9",
|
|
68
68
|
"@types/jest": "27.0.2",
|
|
69
69
|
"@types/jsdom": "16.2.13",
|
|
70
|
-
"@types/react": "17.0.
|
|
71
|
-
"@types/react-dom": "17.0.
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
73
|
-
"@typescript-eslint/parser": "5.
|
|
70
|
+
"@types/react": "17.0.34",
|
|
71
|
+
"@types/react-dom": "17.0.11",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "5.3.1",
|
|
73
|
+
"@typescript-eslint/parser": "5.3.1",
|
|
74
74
|
"babel-core": "6.26.3",
|
|
75
75
|
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
|
|
76
76
|
"cross-env": "7.0.3",
|
|
77
|
-
"eslint": "
|
|
77
|
+
"eslint": "8.1.0",
|
|
78
78
|
"eslint-config-prettier": "8.3.0",
|
|
79
79
|
"eslint-plugin-react": "7.26.1",
|
|
80
|
-
"eslint-plugin-react-hooks": "4.
|
|
80
|
+
"eslint-plugin-react-hooks": "4.3.0",
|
|
81
81
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
|
82
82
|
"faker": "5.5.3",
|
|
83
|
-
"jest": "27.
|
|
84
|
-
"jest-prettyhtml-matchers": "1.
|
|
85
|
-
"nock": "13.
|
|
83
|
+
"jest": "27.3.1",
|
|
84
|
+
"jest-prettyhtml-matchers": "1.8.1",
|
|
85
|
+
"nock": "13.2.0",
|
|
86
86
|
"npm-run-all": "4.1.5",
|
|
87
87
|
"prettier": "2.4.1",
|
|
88
88
|
"react": "17.0.2",
|
|
89
89
|
"react-dom": "17.0.2",
|
|
90
|
-
"rollup": "2.
|
|
90
|
+
"rollup": "2.59.0",
|
|
91
91
|
"rollup-plugin-babel": "4.4.0",
|
|
92
92
|
"rollup-plugin-commonjs": "10.1.0",
|
|
93
93
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"rollup-plugin-terser": "7.0.2",
|
|
97
97
|
"shx": "0.3.3",
|
|
98
98
|
"tanem-scripts": "6.0.35",
|
|
99
|
-
"ts-jest": "27.0.
|
|
100
|
-
"typescript": "4.4.
|
|
99
|
+
"ts-jest": "27.0.7",
|
|
100
|
+
"typescript": "4.4.4"
|
|
101
101
|
}
|
|
102
102
|
}
|