@codegouvfr/react-dsfr
Version:
French State Design System React integration library
4 lines (3 loc) • 12.9 kB
JavaScript
/*! DSFR v1.8.5 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
!function(){"use strict";!function(e,t){function n(e,t){var n=arguments.length>2?arguments[2]:[];if(!1===r(e))throw new TypeError(Object.prototype.toString.call(e)+"is not a function.");return e.apply(t,n)}function o(e,t){return e[t]}function r(e){return"function"==typeof e}function i(e){if(null===e||e===t)throw TypeError();return Object(e)}function a(e,n){var o=function(e,t){return i(e)[t]}(e,n);if(null===o||o===t)return t;if(!1===r(o))throw new TypeError("Method not callable: "+n);return o}function c(t){switch(typeof t){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";default:return null===t?"null":"Symbol"in e&&(t instanceof e.Symbol||t.constructor===e.Symbol)?"symbol":"object"}}function s(e,t){if("string"===t)var i=["toString","valueOf"];else i=["valueOf","toString"];for(var a=0;a<i.length;++a){var s=o(e,i[a]);if(r(s)){var l=n(s,e);if("object"!==c(l))return l}}throw new TypeError("Cannot convert to primitive.")}function l(e,t){return c(e)===c(t)&&("number"===c(e)?!(!isNaN(e)||!isNaN(t))||1/e==1/0&&1/t==-1/0||1/e==-1/0&&1/t==1/0||e===t:function(e,t){return e===t}(e,t))}function u(e){if("symbol"===c(e))throw new TypeError("Cannot convert a Symbol value to a number");var t=Number(e);return isNaN(t)?0:1/t==1/0||1/t==-1/0||t===1/0||t===-1/0?t:(t<0?-1:1)*Math.floor(Math.abs(t))}function f(e){var t=u(e);return t<=0?0:Math.min(t,Math.pow(2,53)-1)}function p(o){switch(c(o)){case"symbol":throw new TypeError("Cannot convert a Symbol value to a string");case"object":return p(function(o){var r=arguments.length>1?arguments[1]:t;if("object"===c(o)){if(arguments.length<2)var i="default";else r===String?i="string":r===Number&&(i="number");var l="function"==typeof e.Symbol&&"symbol"==typeof e.Symbol.toPrimitive?a(o,e.Symbol.toPrimitive):t;if(l!==t){var u=n(l,o,[i]);if("object"!==c(u))return u;throw new TypeError("Cannot convert exotic object to primitive.")}return"default"===i&&(i="number"),s(o,i)}return o}(o,String));default:return String(o)}}var d,v,m,b;d=Array.prototype,v="includes",m=function(e){var t=i(this),n=f(o(t,"length"));if(0===n)return!1;var r=u(arguments[1]);if(r>=0)var a=r;else(a=n+r)<0&&(a=0);for(;a<n;){var c=o(t,p(a));if(l(e,c))return!0;a+=1}return!1},b={value:m,writable:!0,enumerable:!1,configurable:!0},Object.defineProperty(d,v,b),function(){function e(e,n){if(!e)throw new Error("Not enough arguments");var o;if("createEvent"in document){o=document.createEvent("Event");var r=!(!n||n.bubbles===t)&&n.bubbles,i=!(!n||n.cancelable===t)&&n.cancelable;return o.initEvent(e,r,i),o}return(o=document.createEventObject()).type=e,o.bubbles=!(!n||n.bubbles===t)&&n.bubbles,o.cancelable=!(!n||n.cancelable===t)&&n.cancelable,o}var n={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if("undefined"!=typeof document&&"undefined"!=typeof window){var o=window.Event&&window.Event.prototype||null;e.NONE=0,e.CAPTURING_PHASE=1,e.AT_TARGET=2,e.BUBBLING_PHASE=3,window.Event=Window.prototype.Event=e,o&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:o}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var e=this,t=arguments[0],o=arguments[1];if(e===window&&t in n)throw new Error("In IE8 the event: "+t+" is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");e._events||(e._events={}),e._events[t]||(e._events[t]=function(t){var n,o=e._events[t.type].list,r=o.slice(),i=-1,a=r.length;for(t.preventDefault=function(){!1!==t.cancelable&&(t.returnValue=!1)},t.stopPropagation=function(){t.cancelBubble=!0},t.stopImmediatePropagation=function(){t.cancelBubble=!0,t.cancelImmediate=!0},t.currentTarget=e,t.relatedTarget=t.fromElement||null,t.target=t.target||t.srcElement||e,t.timeStamp=(new Date).getTime(),t.clientX&&(t.pageX=t.clientX+document.documentElement.scrollLeft,t.pageY=t.clientY+document.documentElement.scrollTop);++i<a&&!t.cancelImmediate;)i in r&&(n=r[i],o.includes(n)&&"function"==typeof n&&n.call(e,t))},e._events[t].list=[],e.attachEvent&&e.attachEvent("on"+t,e._events[t])),e._events[t].list.push(o)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var e,t=this,n=arguments[0],o=arguments[1];t._events&&t._events[n]&&t._events[n].list&&-1!==(e=t._events[n].list.indexOf(o))&&(t._events[n].list.splice(e,1),t._events[n].list.length||(t.detachEvent&&t.detachEvent("on"+n,t._events[n]),delete t._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(e){if(!arguments.length)throw new Error("Not enough arguments");if(!e||"string"!=typeof e.type)throw new Error("DOM Events Exception 0");var t=this,n=e.type;try{if(!e.bubbles){e.cancelBubble=!0;var o=function(e){e.cancelBubble=!0,(t||window).detachEvent("on"+n,o)};this.attachEvent("on"+n,o)}this.fireEvent("on"+n,e)}catch(o){e.target=t;do{e.currentTarget=t,"_events"in t&&"function"==typeof t._events[n]&&t._events[n].call(t,e),"function"==typeof t["on"+n]&&t["on"+n].call(t,e),t=9===t.nodeType?t.parentWindow:t.parentNode}while(t&&!e.cancelBubble)}return!0},document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&document.dispatchEvent(new e("DOMContentLoaded",{bubbles:!0}))})))}}(),e.CustomEvent=function(e,t){if(!e)throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.');var n;if(t=t||{bubbles:!1,cancelable:!1,detail:null},"createEvent"in document)try{(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail)}catch(o){(n=document.createEvent("Event")).initEvent(e,t.bubbles,t.cancelable),n.detail=t.detail}else(n=new Event(e,t)).detail=t&&t.detail||null;return n},CustomEvent.prototype=Event.prototype}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(e,t){!function(t){function n(e,t){if("change"===e&&this.addListener(t),arguments[2]&&arguments[2].once){var n=this,o=function(){n.removeListener(o),n.removeListener(t)};this.addListener(o)}}function o(e,t){"change"===e&&this.removeListener(t)}var r=function(){try{var e={};return t.Object.defineProperty(e,"t",{configurable:!0,enumerable:!1,get:function(){return this._v},set:function(e){this._v=e+e}}),e.t=1,2===e.t}catch(e){return!1}}(),i={enumerable:!0,configurable:!0,get:function(){return this._onchangeHandler||null},set:function(e){var t=this;t._onchangeListener||(t._onchangeListener=function(){"function"==typeof t._onchangeHandler&&t._onchangeHandler.call(t,arguments[0])},t.addEventListener("change",t._onchangeListener)),t._onchangeHandler=e}};if("MediaQueryList"in t){var a=t.MediaQueryList.prototype.addListener,c=t.MediaQueryList.prototype.removeListener;t.MediaQueryList.prototype.addListener=function(e){var t=e;t.handleEvent&&(t=t.handleEvent),a.call(this,t)},t.MediaQueryList.prototype.removeListener=function(e){var t=e;t.handleEvent&&(t=t.handleEvent),c.call(this,t)},t.MediaQueryList.prototype.addEventListener=n,t.MediaQueryList.prototype.removeEventListener=o,r&&t.Object.defineProperty(t.MediaQueryList.prototype,"onchange",i)}else{var s=e.matchMedia;e.matchMedia=function(e){var a=s(e),c=a.addListener,l=a.removeListener;return a.addListener=function(e){var t=e;t.handleEvent&&(t=t.handleEvent),c.call(this,t)},a.removeListener=function(e){var t=e;t.handleEvent&&(t=t.handleEvent),l.call(this,t)},a.addEventListener=n,a.removeEventListener=o,r&&t.Object.defineProperty(a,"onchange",i),a}}}(e)}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(e,t){var n,o=function(){var e=!0,n=function(t,n,o,r){Object.defineProperty?Object.defineProperty(t,n,{configurable:!1===e||!!r,get:o}):t.__defineGetter__(n,o)};try{n({},"support")}catch(t){e=!1}return function(e,o){var r=this,i=[],a={},c=0,s=0,l=function(e){n(r,e,(function(){return f(),i[e]}),!1)},u=function(){if(c>=s)for(;s<c;++s)l(s)},f=function(){var t,n,r=arguments,s=/\s+/;if(r.length)for(n=0;n<r.length;++n)if(s.test(r[n]))throw(t=new SyntaxError('String "'+r[n]+'" contains an invalid character')).code=5,t.name="InvalidCharacterError",t;for(""===(i="object"==typeof e[o]?(""+e[o].baseVal).replace(/^\s+|\s+$/g,"").split(s):(""+e[o]).replace(/^\s+|\s+$/g,"").split(s))[0]&&(i=[]),a={},n=0;n<i.length;++n)a[i[n]]=!0;c=i.length,u()};return f(),n(r,"length",(function(){return f(),c})),r.toLocaleString=r.toString=function(){return f(),i.join(" ")},r.item=function(e){return f(),i[e]},r.contains=function(e){return f(),!!a[e]},r.add=function(){f.apply(r,t=arguments);for(var t,n,s=0,l=t.length;s<l;++s)n=t[s],a[n]||(i.push(n),a[n]=!0);c!==i.length&&(c=i.length>>>0,"object"==typeof e[o]?e[o].baseVal=i.join(" "):e[o]=i.join(" "),u())},r.remove=function(){f.apply(r,t=arguments);for(var t,n={},s=0,l=[];s<t.length;++s)n[t[s]]=!0,delete a[t[s]];for(s=0;s<i.length;++s)n[i[s]]||l.push(i[s]);i=l,c=l.length>>>0,"object"==typeof e[o]?e[o].baseVal=i.join(" "):e[o]=i.join(" "),u()},r.toggle=function(e,n){return f.apply(r,[e]),t!==n?n?(r.add(e),!0):(r.remove(e),!1):a[e]?(r.remove(e),!1):(r.add(e),!0)},r.forEach=Array.prototype.forEach,r}}();"DOMTokenList"in(n=e)&&n.DOMTokenList&&(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg")||document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList)||(n.DOMTokenList=o),function(){var e=document.createElement("span");"classList"in e&&(e.classList.toggle("x",!1),e.classList.contains("x")&&(e.classList.constructor.prototype.toggle=function(e){var n=arguments[1];if(n===t){var o=!this.contains(e);return this[o?"add":"remove"](e),o}return n=!!n,this[n?"add":"remove"](e),n}))}(),function(){var e=document.createElement("span");if("classList"in e&&(e.classList.add("a","b"),!e.classList.contains("b"))){var t=e.classList.constructor.prototype.add;e.classList.constructor.prototype.add=function(){for(var e=arguments,n=arguments.length,o=0;o<n;o++)t.call(this,e[o])}}}(),function(){var e=document.createElement("span");if("classList"in e&&(e.classList.add("a"),e.classList.add("b"),e.classList.remove("a","b"),e.classList.contains("b"))){var t=e.classList.constructor.prototype.remove;e.classList.constructor.prototype.remove=function(){for(var e=arguments,n=arguments.length,o=0;o<n;o++)t.call(this,e[o])}}}(),function(e){var t=!0,n=function(e,n,o,r){Object.defineProperty?Object.defineProperty(e,n,{configurable:!1===t||!!r,get:o}):e.__defineGetter__(n,o)};try{n({},"support")}catch(e){t=!1}var r=function(e,i,a){n(e.prototype,i,(function(){var e,c=this,s="__defineGetter__DEFINE_PROPERTY"+i;if(c[s])return e;if(c[s]=!0,!1===t){for(var l,u=r.mirror||document.createElement("div"),f=u.childNodes,p=f.length,d=0;d<p;++d)if(f[d]._R===c){l=f[d];break}l||(l=u.appendChild(document.createElement("div"))),e=DOMTokenList.call(l,c,a)}else e=new o(c,a);return n(c,i,(function(){return e})),delete c[s],e}),!0)};r(e.Element,"classList","className"),r(e.HTMLElement,"classList","className"),r(e.HTMLLinkElement,"relList","rel"),r(e.HTMLAnchorElement,"relList","rel"),r(e.HTMLAreaElement,"relList","rel")}(e),function(e){e.DOMTokenList.prototype.forEach=e.Array.prototype.forEach;var t=document.createElement("span");t.classList&&t.classList.constructor&&t.classList.constructor.prototype&&!t.classList.constructor.prototype.forEach&&(t.classList.constructor.prototype.forEach=e.Array.prototype.forEach)}(e),NodeList.prototype.forEach=Array.prototype.forEach}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(e,t){!function(){function t(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1}if("HTMLElement"in e&&"contains"in HTMLElement.prototype)try{delete HTMLElement.prototype.contains}catch(e){}"Node"in e?Node.prototype.contains=t:document.contains=Element.prototype.contains=t}()}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),Element.prototype.matches=Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||function(e){for(var t=this,n=(t.document||t.ownerDocument).querySelectorAll(e),o=0;n[o]&&n[o]!==t;)++o;return!!n[o]}}();
//# sourceMappingURL=legacy.nomodule.min.js.map