UNPKG

@storybook/addon-controls

Version:

Interact with component inputs dynamically in the Storybook UI

166 lines (92 loc) • 215 kB
import { __commonJS, __toESM, __require, pickBy, getControlSetterButtonId, getControlId, cloneDeep2, uniq } from './chunk-UW5BWBZO.js'; import * as React15__default from 'react'; import React15__default__default, { createContext, lazy, useState, useCallback, Component, cloneElement, useEffect, useMemo, Children, useContext, useRef, Suspense } from 'react'; import { withReset, SyntaxHighlighter, FlexBar, Form, IconButton, codeCommon, components, Bar as Bar$1, AddonPanel, Zoom, ActionBar, nameSpaceClassNames, H2, Spaced, Badge, Link, ResetWrapper, WithTooltip, TooltipNote, Modal, Button, EmptyTabContent, WithTooltipPure } from 'storybook/internal/components'; import { SAVE_STORY_RESPONSE, SAVE_STORY_REQUEST, NAVIGATE_URL } from 'storybook/internal/core-events'; import { addons, types, useArgs, useGlobals, useArgTypes, useParameter, useStorybookState, experimental_requestResponse } from 'storybook/internal/manager-api'; import { styled, ignoreSsrWarning, keyframes, useTheme, themes, ThemeProvider, convert, color } from 'storybook/internal/theming'; import { dequal } from 'dequal'; import { AddIcon, SubtractIcon, ChevronSmallUpIcon, ChevronSmallDownIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronRightIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, DocumentIcon, UndoIcon, LinkIcon, CheckIcon, VideoIcon, EyeCloseIcon, EyeIcon } from '@storybook/icons'; import { once, logger } from 'storybook/internal/client-logger'; import { includeConditionalArg } from 'storybook/internal/csf'; import 'storybook/internal/preview-api'; import 'storybook/internal/docs-tools'; import 'ts-dedent'; import 'storybook/internal/channels'; import { global as global$1 } from '@storybook/global'; var require_memoizerific=__commonJS({"../../node_modules/memoizerific/memoizerific.js"(exports,module){(function(f3){if(typeof exports=="object"&&typeof module<"u")module.exports=f3();else if(typeof define=="function"&&define.amd)define([],f3);else {var g2;typeof window<"u"?g2=window:typeof global<"u"?g2=global:typeof self<"u"?g2=self:g2=this,g2.memoizerific=f3();}})(function(){return function e2(t2,n2,r2){function s2(o3,u2){if(!n2[o3]){if(!t2[o3]){var a2=typeof __require=="function"&&__require;if(!u2&&a2)return a2(o3,!0);if(i2)return i2(o3,!0);var f3=new Error("Cannot find module '"+o3+"'");throw f3.code="MODULE_NOT_FOUND",f3}var l2=n2[o3]={exports:{}};t2[o3][0].call(l2.exports,function(e3){var n3=t2[o3][1][e3];return s2(n3||e3)},l2,l2.exports,e2,t2,n2,r2);}return n2[o3].exports}for(var i2=typeof __require=="function"&&__require,o2=0;o2<r2.length;o2++)s2(r2[o2]);return s2}({1:[function(_dereq_,module3,exports3){module3.exports=function(forceSimilar){if(typeof Map!="function"||forceSimilar){var Similar=_dereq_("./similar");return new Similar}else return new Map};},{"./similar":2}],2:[function(_dereq_,module3,exports3){function Similar(){return this.list=[],this.lastItem=void 0,this.size=0,this}Similar.prototype.get=function(key2){var index;if(this.lastItem&&this.isEqual(this.lastItem.key,key2))return this.lastItem.val;if(index=this.indexOf(key2),index>=0)return this.lastItem=this.list[index],this.list[index].val},Similar.prototype.set=function(key2,val){var index;return this.lastItem&&this.isEqual(this.lastItem.key,key2)?(this.lastItem.val=val,this):(index=this.indexOf(key2),index>=0?(this.lastItem=this.list[index],this.list[index].val=val,this):(this.lastItem={key:key2,val},this.list.push(this.lastItem),this.size++,this))},Similar.prototype.delete=function(key2){var index;if(this.lastItem&&this.isEqual(this.lastItem.key,key2)&&(this.lastItem=void 0),index=this.indexOf(key2),index>=0)return this.size--,this.list.splice(index,1)[0]},Similar.prototype.has=function(key2){var index;return this.lastItem&&this.isEqual(this.lastItem.key,key2)?!0:(index=this.indexOf(key2),index>=0?(this.lastItem=this.list[index],!0):!1)},Similar.prototype.forEach=function(callback,thisArg){var i2;for(i2=0;i2<this.size;i2++)callback.call(thisArg||this,this.list[i2].val,this.list[i2].key,this);},Similar.prototype.indexOf=function(key2){var i2;for(i2=0;i2<this.size;i2++)if(this.isEqual(this.list[i2].key,key2))return i2;return -1},Similar.prototype.isEqual=function(val1,val2){return val1===val2||val1!==val1&&val2!==val2},module3.exports=Similar;},{}],3:[function(_dereq_,module3,exports3){var MapOrSimilar=_dereq_("map-or-similar");module3.exports=function(limit){var cache=new MapOrSimilar(!1),lru=[];return function(fn){var memoizerific=function(){var currentCache=cache,newMap,fnResult,argsLengthMinusOne=arguments.length-1,lruPath=Array(argsLengthMinusOne+1),isMemoized=!0,i2;if((memoizerific.numArgs||memoizerific.numArgs===0)&&memoizerific.numArgs!==argsLengthMinusOne+1)throw new Error("Memoizerific functions should always be called with the same number of arguments");for(i2=0;i2<argsLengthMinusOne;i2++){if(lruPath[i2]={cacheItem:currentCache,arg:arguments[i2]},currentCache.has(arguments[i2])){currentCache=currentCache.get(arguments[i2]);continue}isMemoized=!1,newMap=new MapOrSimilar(!1),currentCache.set(arguments[i2],newMap),currentCache=newMap;}return isMemoized&&(currentCache.has(arguments[argsLengthMinusOne])?fnResult=currentCache.get(arguments[argsLengthMinusOne]):isMemoized=!1),isMemoized||(fnResult=fn.apply(null,arguments),currentCache.set(arguments[argsLengthMinusOne],fnResult)),limit>0&&(lruPath[argsLengthMinusOne]={cacheItem:currentCache,arg:arguments[argsLengthMinusOne]},isMemoized?moveToMostRecentLru(lru,lruPath):lru.push(lruPath),lru.length>limit&&removeCachedResult(lru.shift())),memoizerific.wasMemoized=isMemoized,memoizerific.numArgs=argsLengthMinusOne+1,fnResult};return memoizerific.limit=limit,memoizerific.wasMemoized=!1,memoizerific.cache=cache,memoizerific.lru=lru,memoizerific}};function moveToMostRecentLru(lru,lruPath){var lruLen=lru.length,lruPathLen=lruPath.length,isMatch,i2,ii;for(i2=0;i2<lruLen;i2++){for(isMatch=!0,ii=0;ii<lruPathLen;ii++)if(!isEqual(lru[i2][ii].arg,lruPath[ii].arg)){isMatch=!1;break}if(isMatch)break}lru.push(lru.splice(i2,1)[0]);}function removeCachedResult(removedLru){var removedLruLen=removedLru.length,currentLru=removedLru[removedLruLen-1],tmp,i2;for(currentLru.cacheItem.delete(currentLru.arg),i2=removedLruLen-2;i2>=0&&(currentLru=removedLru[i2],tmp=currentLru.cacheItem.get(currentLru.arg),!tmp||!tmp.size);i2--)currentLru.cacheItem.delete(currentLru.arg);}function isEqual(val1,val2){return val1===val2||val1!==val1&&val2!==val2}},{"map-or-similar":1}]},{},[3])(3)});}}),require_default_options=__commonJS({"../../node_modules/tocbot/src/js/default-options.js"(exports,module){module.exports={tocSelector:".js-toc",contentSelector:".js-toc-content",headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",hasInnerContainers:!1,linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",activeListItemClass:"is-active-li",collapseDepth:0,scrollSmooth:!0,scrollSmoothDuration:420,scrollSmoothOffset:0,scrollEndCallback:function(e2){},headingsOffset:1,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1,includeTitleTags:!1,onClick:function(e2){},orderedList:!0,scrollContainer:null,skipRendering:!1,headingLabelCallback:!1,ignoreHiddenElements:!1,headingObjectCallback:null,basePath:"",disableTocScrollSync:!1,tocScrollOffset:0};}}),require_build_html=__commonJS({"../../node_modules/tocbot/src/js/build-html.js"(exports,module){module.exports=function(options2){var forEach=[].forEach,some=[].some,body=document.body,tocElement,currentlyHighlighting=!0,SPACE_CHAR=" ";function createEl(d2,container){var link=container.appendChild(createLink(d2));if(d2.children.length){var list=createList(d2.isCollapsed);d2.children.forEach(function(child){createEl(child,list);}),link.appendChild(list);}}function render(parent,data){var collapsed=!1,container=createList(collapsed);if(data.forEach(function(d2){createEl(d2,container);}),tocElement=parent||tocElement,tocElement!==null)return tocElement.firstChild&&tocElement.removeChild(tocElement.firstChild),data.length===0?tocElement:tocElement.appendChild(container)}function createLink(data){var item=document.createElement("li"),a2=document.createElement("a");return options2.listItemClass&&item.setAttribute("class",options2.listItemClass),options2.onClick&&(a2.onclick=options2.onClick),options2.includeTitleTags&&a2.setAttribute("title",data.textContent),options2.includeHtml&&data.childNodes.length?forEach.call(data.childNodes,function(node){a2.appendChild(node.cloneNode(!0));}):a2.textContent=data.textContent,a2.setAttribute("href",options2.basePath+"#"+data.id),a2.setAttribute("class",options2.linkClass+SPACE_CHAR+"node-name--"+data.nodeName+SPACE_CHAR+options2.extraLinkClasses),item.appendChild(a2),item}function createList(isCollapsed){var listElement=options2.orderedList?"ol":"ul",list=document.createElement(listElement),classes=options2.listClass+SPACE_CHAR+options2.extraListClasses;return isCollapsed&&(classes=classes+SPACE_CHAR+options2.collapsibleClass,classes=classes+SPACE_CHAR+options2.isCollapsedClass),list.setAttribute("class",classes),list}function updateFixedSidebarClass(){if(options2.scrollContainer&&document.querySelector(options2.scrollContainer)){var top;top=document.querySelector(options2.scrollContainer).scrollTop;}else top=document.documentElement.scrollTop||body.scrollTop;var posFixedEl=document.querySelector(options2.positionFixedSelector);options2.fixedSidebarOffset==="auto"&&(options2.fixedSidebarOffset=tocElement.offsetTop),top>options2.fixedSidebarOffset?posFixedEl.className.indexOf(options2.positionFixedClass)===-1&&(posFixedEl.className+=SPACE_CHAR+options2.positionFixedClass):posFixedEl.className=posFixedEl.className.replace(SPACE_CHAR+options2.positionFixedClass,"");}function getHeadingTopPos(obj){var position=0;return obj!==null&&(position=obj.offsetTop,options2.hasInnerContainers&&(position+=getHeadingTopPos(obj.offsetParent))),position}function updateClassname(obj,className){return obj&&obj.className!==className&&(obj.className=className),obj}function updateToc(headingsArray){if(options2.scrollContainer&&document.querySelector(options2.scrollContainer)){var top;top=document.querySelector(options2.scrollContainer).scrollTop;}else top=document.documentElement.scrollTop||body.scrollTop;options2.positionFixedSelector&&updateFixedSidebarClass();var headings=headingsArray,topHeader;if(currentlyHighlighting&&tocElement!==null&&headings.length>0){some.call(headings,function(heading,i2){if(getHeadingTopPos(heading)>top+options2.headingsOffset+10){var index=i2===0?i2:i2-1;return topHeader=headings[index],!0}else if(i2===headings.length-1)return topHeader=headings[headings.length-1],!0});var oldActiveTocLink=tocElement.querySelector("."+options2.activeLinkClass),activeTocLink=tocElement.querySelector("."+options2.linkClass+".node-name--"+topHeader.nodeName+'[href="'+options2.basePath+"#"+topHeader.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g,"\\$1")+'"]');if(oldActiveTocLink===activeTocLink)return;var tocLinks=tocElement.querySelectorAll("."+options2.linkClass);forEach.call(tocLinks,function(tocLink){updateClassname(tocLink,tocLink.className.replace(SPACE_CHAR+options2.activeLinkClass,""));});var tocLis=tocElement.querySelectorAll("."+options2.listItemClass);forEach.call(tocLis,function(tocLi){updateClassname(tocLi,tocLi.className.replace(SPACE_CHAR+options2.activeListItemClass,""));}),activeTocLink&&activeTocLink.className.indexOf(options2.activeLinkClass)===-1&&(activeTocLink.className+=SPACE_CHAR+options2.activeLinkClass);var li=activeTocLink&&activeTocLink.parentNode;li&&li.className.indexOf(options2.activeListItemClass)===-1&&(li.className+=SPACE_CHAR+options2.activeListItemClass);var tocLists=tocElement.querySelectorAll("."+options2.listClass+"."+options2.collapsibleClass);forEach.call(tocLists,function(list){list.className.indexOf(options2.isCollapsedClass)===-1&&(list.className+=SPACE_CHAR+options2.isCollapsedClass);}),activeTocLink&&activeTocLink.nextSibling&&activeTocLink.nextSibling.className.indexOf(options2.isCollapsedClass)!==-1&&updateClassname(activeTocLink.nextSibling,activeTocLink.nextSibling.className.replace(SPACE_CHAR+options2.isCollapsedClass,"")),removeCollapsedFromParents(activeTocLink&&activeTocLink.parentNode.parentNode);}}function removeCollapsedFromParents(element){return element&&element.className.indexOf(options2.collapsibleClass)!==-1&&element.className.indexOf(options2.isCollapsedClass)!==-1?(updateClassname(element,element.className.replace(SPACE_CHAR+options2.isCollapsedClass,"")),removeCollapsedFromParents(element.parentNode.parentNode)):element}function disableTocAnimation(event){var target=event.target||event.srcElement;typeof target.className!="string"||target.className.indexOf(options2.linkClass)===-1||(currentlyHighlighting=!1);}function enableTocAnimation(){currentlyHighlighting=!0;}return {enableTocAnimation,disableTocAnimation,render,updateToc}};}}),require_parse_content=__commonJS({"../../node_modules/tocbot/src/js/parse-content.js"(exports,module){module.exports=function(options2){var reduce=[].reduce;function getLastItem(array2){return array2[array2.length-1]}function getHeadingLevel(heading){return +heading.nodeName.toUpperCase().replace("H","")}function isHTMLElement(maybeElement){try{return maybeElement instanceof window.HTMLElement||maybeElement instanceof window.parent.HTMLElement}catch{return maybeElement instanceof window.HTMLElement}}function getHeadingObject(heading){if(!isHTMLElement(heading))return heading;if(options2.ignoreHiddenElements&&(!heading.offsetHeight||!heading.offsetParent))return null;let headingLabel=heading.getAttribute("data-heading-label")||(options2.headingLabelCallback?String(options2.headingLabelCallback(heading.innerText)):(heading.innerText||heading.textContent).trim());var obj={id:heading.id,children:[],nodeName:heading.nodeName,headingLevel:getHeadingLevel(heading),textContent:headingLabel};return options2.includeHtml&&(obj.childNodes=heading.childNodes),options2.headingObjectCallback?options2.headingObjectCallback(obj,heading):obj}function addNode(node,nest){for(var obj=getHeadingObject(node),level=obj.headingLevel,array2=nest,lastItem=getLastItem(array2),lastItemLevel=lastItem?lastItem.headingLevel:0,counter=level-lastItemLevel;counter>0&&(lastItem=getLastItem(array2),!(lastItem&&level===lastItem.headingLevel));)lastItem&&lastItem.children!==void 0&&(array2=lastItem.children),counter--;return level>=options2.collapseDepth&&(obj.isCollapsed=!0),array2.push(obj),array2}function selectHeadings(contentElement,headingSelector){var selectors=headingSelector;options2.ignoreSelector&&(selectors=headingSelector.split(",").map(function(selector){return selector.trim()+":not("+options2.ignoreSelector+")"}));try{return contentElement.querySelectorAll(selectors)}catch{return console.warn("Headers not found with selector: "+selectors),null}}function nestHeadingsArray(headingsArray){return reduce.call(headingsArray,function(prev,curr){var currentHeading=getHeadingObject(curr);return currentHeading&&addNode(currentHeading,prev.nest),prev},{nest:[]})}return {nestHeadingsArray,selectHeadings}};}}),require_update_toc_scroll=__commonJS({"../../node_modules/tocbot/src/js/update-toc-scroll.js"(exports,module){module.exports=function(options2){var toc=options2.tocElement||document.querySelector(options2.tocSelector);if(toc&&toc.scrollHeight>toc.clientHeight){var activeItem=toc.querySelector("."+options2.activeListItemClass);activeItem&&(toc.scrollTop=activeItem.offsetTop-options2.tocScrollOffset);}};}}),require_scroll_smooth=__commonJS({"../../node_modules/tocbot/src/js/scroll-smooth/index.js"(exports){exports.initSmoothScrolling=initSmoothScrolling;function initSmoothScrolling(options2){var duration=options2.duration,offset=options2.offset,pageUrl=location.hash?stripHash(location.href):location.href;delegatedLinkHijacking();function delegatedLinkHijacking(){document.body.addEventListener("click",onClick,!1);function onClick(e2){!isInPageLink(e2.target)||e2.target.className.indexOf("no-smooth-scroll")>-1||e2.target.href.charAt(e2.target.href.length-2)==="#"&&e2.target.href.charAt(e2.target.href.length-1)==="!"||e2.target.className.indexOf(options2.linkClass)===-1||jump(e2.target.hash,{duration,offset,callback:function(){setFocus(e2.target.hash);}});}}function isInPageLink(n2){return n2.tagName.toLowerCase()==="a"&&(n2.hash.length>0||n2.href.charAt(n2.href.length-1)==="#")&&(stripHash(n2.href)===pageUrl||stripHash(n2.href)+"#"===pageUrl)}function stripHash(url){return url.slice(0,url.lastIndexOf("#"))}function setFocus(hash){var element=document.getElementById(hash.substring(1));element&&(/^(?:a|select|input|button|textarea)$/i.test(element.tagName)||(element.tabIndex=-1),element.focus());}}function jump(target,options2){var start=window.pageYOffset,opt={duration:options2.duration,offset:options2.offset||0,callback:options2.callback,easing:options2.easing||easeInOutQuad},tgt=document.querySelector('[id="'+decodeURI(target).split("#").join("")+'"]')||document.querySelector('[id="'+target.split("#").join("")+'"]'),distance=typeof target=="string"?opt.offset+(target?tgt&&tgt.getBoundingClientRect().top||0:-(document.documentElement.scrollTop||document.body.scrollTop)):target,duration=typeof opt.duration=="function"?opt.duration(distance):opt.duration,timeStart,timeElapsed;requestAnimationFrame(function(time){timeStart=time,loop(time);});function loop(time){timeElapsed=time-timeStart,window.scrollTo(0,opt.easing(timeElapsed,start,distance,duration)),timeElapsed<duration?requestAnimationFrame(loop):end();}function end(){window.scrollTo(0,start+distance),typeof opt.callback=="function"&&opt.callback();}function easeInOutQuad(t2,b2,c2,d2){return t2/=d2/2,t2<1?c2/2*t2*t2+b2:(t2--,-c2/2*(t2*(t2-2)-1)+b2)}}}}),require_js=__commonJS({"../../node_modules/tocbot/src/js/index.js"(exports,module){(function(root3,factory){typeof define=="function"&&define.amd?define([],factory(root3)):typeof exports=="object"?module.exports=factory(root3):root3.tocbot=factory(root3);})(typeof global<"u"?global:window||global,function(root3){var defaultOptions2=require_default_options(),options2={},tocbot2={},BuildHtml=require_build_html(),ParseContent=require_parse_content(),updateTocScroll=require_update_toc_scroll(),buildHtml,parseContent,supports=!!root3&&!!root3.document&&!!root3.document.querySelector&&!!root3.addEventListener;if(typeof window>"u"&&!supports)return;var headingsArray,hasOwnProperty5=Object.prototype.hasOwnProperty;function extend(){for(var target={},i2=0;i2<arguments.length;i2++){var source2=arguments[i2];for(var key2 in source2)hasOwnProperty5.call(source2,key2)&&(target[key2]=source2[key2]);}return target}function throttle(fn,threshold,scope){threshold||(threshold=250);var last,deferTimer;return function(){var context=scope||this,now=+new Date,args2=arguments;last&&now<last+threshold?(clearTimeout(deferTimer),deferTimer=setTimeout(function(){last=now,fn.apply(context,args2);},threshold)):(last=now,fn.apply(context,args2));}}function getContentElement(options3){try{return options3.contentElement||document.querySelector(options3.contentSelector)}catch{return console.warn("Contents element not found: "+options3.contentSelector),null}}function getTocElement(options3){try{return options3.tocElement||document.querySelector(options3.tocSelector)}catch{return console.warn("TOC element not found: "+options3.tocSelector),null}}return tocbot2.destroy=function(){var tocElement=getTocElement(options2);tocElement!==null&&(options2.skipRendering||tocElement&&(tocElement.innerHTML=""),options2.scrollContainer&&document.querySelector(options2.scrollContainer)?(document.querySelector(options2.scrollContainer).removeEventListener("scroll",this._scrollListener,!1),document.querySelector(options2.scrollContainer).removeEventListener("resize",this._scrollListener,!1),buildHtml&&document.querySelector(options2.scrollContainer).removeEventListener("click",this._clickListener,!1)):(document.removeEventListener("scroll",this._scrollListener,!1),document.removeEventListener("resize",this._scrollListener,!1),buildHtml&&document.removeEventListener("click",this._clickListener,!1)));},tocbot2.init=function(customOptions){if(supports){options2=extend(defaultOptions2,customOptions||{}),this.options=options2,this.state={},options2.scrollSmooth&&(options2.duration=options2.scrollSmoothDuration,options2.offset=options2.scrollSmoothOffset,tocbot2.scrollSmooth=require_scroll_smooth().initSmoothScrolling(options2)),buildHtml=BuildHtml(options2),parseContent=ParseContent(options2),this._buildHtml=buildHtml,this._parseContent=parseContent,this._headingsArray=headingsArray,tocbot2.destroy();var contentElement=getContentElement(options2);if(contentElement!==null){var tocElement=getTocElement(options2);if(tocElement!==null&&(headingsArray=parseContent.selectHeadings(contentElement,options2.headingSelector),headingsArray!==null)){var nestedHeadingsObj=parseContent.nestHeadingsArray(headingsArray),nestedHeadings=nestedHeadingsObj.nest;if(!options2.skipRendering)buildHtml.render(tocElement,nestedHeadings);else return this;this._scrollListener=throttle(function(e2){buildHtml.updateToc(headingsArray),!options2.disableTocScrollSync&&updateTocScroll(options2);var isTop=e2&&e2.target&&e2.target.scrollingElement&&e2.target.scrollingElement.scrollTop===0;(e2&&(e2.eventPhase===0||e2.currentTarget===null)||isTop)&&(buildHtml.updateToc(headingsArray),options2.scrollEndCallback&&options2.scrollEndCallback(e2));},options2.throttleTimeout),this._scrollListener(),options2.scrollContainer&&document.querySelector(options2.scrollContainer)?(document.querySelector(options2.scrollContainer).addEventListener("scroll",this._scrollListener,!1),document.querySelector(options2.scrollContainer).addEventListener("resize",this._scrollListener,!1)):(document.addEventListener("scroll",this._scrollListener,!1),document.addEventListener("resize",this._scrollListener,!1));var timeout=null;return this._clickListener=throttle(function(event){options2.scrollSmooth&&buildHtml.disableTocAnimation(event),buildHtml.updateToc(headingsArray),timeout&&clearTimeout(timeout),timeout=setTimeout(function(){buildHtml.enableTocAnimation();},options2.scrollSmoothDuration);},options2.throttleTimeout),options2.scrollContainer&&document.querySelector(options2.scrollContainer)?document.querySelector(options2.scrollContainer).addEventListener("click",this._clickListener,!1):document.addEventListener("click",this._clickListener,!1),this}}}},tocbot2.refresh=function(customOptions){tocbot2.destroy(),tocbot2.init(customOptions||this.options);},root3.tocbot=tocbot2,tocbot2});}});function _extends(){return _extends=Object.assign?Object.assign.bind():function(n2){for(var e2=1;e2<arguments.length;e2++){var t2=arguments[e2];for(var r2 in t2)({}).hasOwnProperty.call(t2,r2)&&(n2[r2]=t2[r2]);}return n2},_extends.apply(null,arguments)}function _assertThisInitialized(e2){if(e2===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e2}function _setPrototypeOf(t2,e2){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t3,e3){return t3.__proto__=e3,t3},_setPrototypeOf(t2,e2)}function _inheritsLoose(t2,o2){t2.prototype=Object.create(o2.prototype),t2.prototype.constructor=t2,_setPrototypeOf(t2,o2);}function _getPrototypeOf(t2){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t3){return t3.__proto__||Object.getPrototypeOf(t3)},_getPrototypeOf(t2)}function _isNativeFunction(t2){try{return Function.toString.call(t2).indexOf("[native code]")!==-1}catch{return typeof t2=="function"}}function _isNativeReflectConstruct(){try{var t2=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (_isNativeReflectConstruct=function(){return !!t2})()}function _construct(t2,e2,r2){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o2=[null];o2.push.apply(o2,e2);var p2=new(t2.bind.apply(t2,o2));return r2&&_setPrototypeOf(p2,r2.prototype),p2}function _wrapNativeSuper(t2){var r2=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(t3){if(t3===null||!_isNativeFunction(t3))return t3;if(typeof t3!="function")throw new TypeError("Super expression must either be null or a function");if(r2!==void 0){if(r2.has(t3))return r2.get(t3);r2.set(t3,Wrapper12);}function Wrapper12(){return _construct(t3,arguments,_getPrototypeOf(this).constructor)}return Wrapper12.prototype=Object.create(t3.prototype,{constructor:{value:Wrapper12,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper12,t3)},_wrapNativeSuper(t2)}var ERRORS={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }). `,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }). `,3:`Passed an incorrect argument to a color function, please pass a string representation of a color. `,4:`Couldn't generate valid rgb string from %s, it returned %s. `,5:`Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation. `,6:`Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }). `,7:`Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }). `,8:`Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object. `,9:`Please provide a number of steps to the modularScale helper. `,10:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio. `,11:`Invalid value passed as base to modularScale, expected number or em string but got "%s" `,12:`Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead. `,13:`Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead. `,14:`Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12. `,15:`Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12. `,16:`You must provide a template to this method. `,17:`You passed an unsupported selector state to this method. `,18:`minScreen and maxScreen must be provided as stringified numbers with the same units. `,19:`fromSize and toSize must be provided as stringified numbers with the same units. `,20:`expects either an array of objects or a single object with the properties prop, fromSize, and toSize. `,21:"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",22:"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",23:`fontFace expects a name of a font-family. `,24:`fontFace expects either the path to the font file(s) or a name of a local copy. `,25:`fontFace expects localFonts to be an array. `,26:`fontFace expects fileFormats to be an array. `,27:`radialGradient requries at least 2 color-stops to properly render. `,28:`Please supply a filename to retinaImage() as the first argument. `,29:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'. `,30:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",31:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation `,32:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s']) To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s') `,33:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation `,34:`borderRadius expects a radius value as a string or number as the second argument. `,35:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument. `,36:`Property must be a string value. `,37:`Syntax Error at %s. `,38:`Formula contains a function that needs parentheses at %s. `,39:`Formula is missing closing parenthesis at %s. `,40:`Formula has too many closing parentheses at %s. `,41:`All values in a formula must have the same unit or be unitless. `,42:`Please provide a number of steps to the modularScale helper. `,43:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio. `,44:`Invalid value passed as base to modularScale, expected number or em/rem string but got %s. `,45:`Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object. `,46:`Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object. `,47:`minScreen and maxScreen must be provided as stringified numbers with the same units. `,48:`fromSize and toSize must be provided as stringified numbers with the same units. `,49:`Expects either an array of objects or a single object with the properties prop, fromSize, and toSize. `,50:`Expects the objects in the first argument array to have the properties prop, fromSize, and toSize. `,51:`Expects the first argument object to have the properties prop, fromSize, and toSize. `,52:`fontFace expects either the path to the font file(s) or a name of a local copy. `,53:`fontFace expects localFonts to be an array. `,54:`fontFace expects fileFormats to be an array. `,55:`fontFace expects a name of a font-family. `,56:`linearGradient requries at least 2 color-stops to properly render. `,57:`radialGradient requries at least 2 color-stops to properly render. `,58:`Please supply a filename to retinaImage() as the first argument. `,59:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'. `,60:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",61:`Property must be a string value. `,62:`borderRadius expects a radius value as a string or number as the second argument. `,63:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument. `,64:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation. `,65:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s'). `,66:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation. `,67:`You must provide a template to this method. `,68:`You passed an unsupported selector state to this method. `,69:`Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead. `,70:`Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead. `,71:`Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12. `,72:`Passed invalid base value %s to %s(), please pass a value like "12px" or 12. `,73:`Please provide a valid CSS variable. `,74:`CSS variable not found and no default was provided. `,75:`important requires a valid style object, got a %s instead. `,76:`fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen. `,77:`remToPx expects a value in "rem" but you provided it in "%s". `,78:`base must be set in "px" or "%" but you set it in "%s". `};function format(){for(var _len=arguments.length,args2=new Array(_len),_key=0;_key<_len;_key++)args2[_key]=arguments[_key];var a2=args2[0],b2=[],c2;for(c2=1;c2<args2.length;c2+=1)b2.push(args2[c2]);return b2.forEach(function(d2){a2=a2.replace(/%[a-z]/,d2);}),a2}var PolishedError=function(_Error){_inheritsLoose(PolishedError2,_Error);function PolishedError2(code){for(var _this,_len2=arguments.length,args2=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args2[_key2-1]=arguments[_key2];return _this=_Error.call(this,format.apply(void 0,[ERRORS[code]].concat(args2)))||this,_assertThisInitialized(_this)}return PolishedError2}(_wrapNativeSuper(Error));function colorToInt(color2){return Math.round(color2*255)}function convertToInt(red,green,blue){return colorToInt(red)+","+colorToInt(green)+","+colorToInt(blue)}function hslToRgb(hue,saturation,lightness,convert2){if(convert2===void 0&&(convert2=convertToInt),saturation===0)return convert2(lightness,lightness,lightness);var huePrime=(hue%360+360)%360/60,chroma=(1-Math.abs(2*lightness-1))*saturation,secondComponent=chroma*(1-Math.abs(huePrime%2-1)),red=0,green=0,blue=0;huePrime>=0&&huePrime<1?(red=chroma,green=secondComponent):huePrime>=1&&huePrime<2?(red=secondComponent,green=chroma):huePrime>=2&&huePrime<3?(green=chroma,blue=secondComponent):huePrime>=3&&huePrime<4?(green=secondComponent,blue=chroma):huePrime>=4&&huePrime<5?(red=secondComponent,blue=chroma):huePrime>=5&&huePrime<6&&(red=chroma,blue=secondComponent);var lightnessModification=lightness-chroma/2,finalRed=red+lightnessModification,finalGreen=green+lightnessModification,finalBlue=blue+lightnessModification;return convert2(finalRed,finalGreen,finalBlue)}var namedColorMap={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function nameToHex(color2){if(typeof color2!="string")return color2;var normalizedColorName=color2.toLowerCase();return namedColorMap[normalizedColorName]?"#"+namedColorMap[normalizedColorName]:color2}var hexRegex=/^#[a-fA-F0-9]{6}$/,hexRgbaRegex=/^#[a-fA-F0-9]{8}$/,reducedHexRegex=/^#[a-fA-F0-9]{3}$/,reducedRgbaHexRegex=/^#[a-fA-F0-9]{4}$/,rgbRegex=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,rgbaRegex=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,hslRegex=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,hslaRegex=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function parseToRgb(color2){if(typeof color2!="string")throw new PolishedError(3);var normalizedColor=nameToHex(color2);if(normalizedColor.match(hexRegex))return {red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16)};if(normalizedColor.match(hexRgbaRegex)){var alpha=parseFloat((parseInt(""+normalizedColor[7]+normalizedColor[8],16)/255).toFixed(2));return {red:parseInt(""+normalizedColor[1]+normalizedColor[2],16),green:parseInt(""+normalizedColor[3]+normalizedColor[4],16),blue:parseInt(""+normalizedColor[5]+normalizedColor[6],16),alpha}}if(normalizedColor.match(reducedHexRegex))return {red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16)};if(normalizedColor.match(reducedRgbaHexRegex)){var _alpha=parseFloat((parseInt(""+normalizedColor[4]+normalizedColor[4],16)/255).toFixed(2));return {red:parseInt(""+normalizedColor[1]+normalizedColor[1],16),green:parseInt(""+normalizedColor[2]+normalizedColor[2],16),blue:parseInt(""+normalizedColor[3]+normalizedColor[3],16),alpha:_alpha}}var rgbMatched=rgbRegex.exec(normalizedColor);if(rgbMatched)return {red:parseInt(""+rgbMatched[1],10),green:parseInt(""+rgbMatched[2],10),blue:parseInt(""+rgbMatched[3],10)};var rgbaMatched=rgbaRegex.exec(normalizedColor.substring(0,50));if(rgbaMatched)return {red:parseInt(""+rgbaMatched[1],10),green:parseInt(""+rgbaMatched[2],10),blue:parseInt(""+rgbaMatched[3],10),alpha:parseFloat(""+rgbaMatched[4])>1?parseFloat(""+rgbaMatched[4])/100:parseFloat(""+rgbaMatched[4])};var hslMatched=hslRegex.exec(normalizedColor);if(hslMatched){var hue=parseInt(""+hslMatched[1],10),saturation=parseInt(""+hslMatched[2],10)/100,lightness=parseInt(""+hslMatched[3],10)/100,rgbColorString="rgb("+hslToRgb(hue,saturation,lightness)+")",hslRgbMatched=rgbRegex.exec(rgbColorString);if(!hslRgbMatched)throw new PolishedError(4,normalizedColor,rgbColorString);return {red:parseInt(""+hslRgbMatched[1],10),green:parseInt(""+hslRgbMatched[2],10),blue:parseInt(""+hslRgbMatched[3],10)}}var hslaMatched=hslaRegex.exec(normalizedColor.substring(0,50));if(hslaMatched){var _hue=parseInt(""+hslaMatched[1],10),_saturation=parseInt(""+hslaMatched[2],10)/100,_lightness=parseInt(""+hslaMatched[3],10)/100,_rgbColorString="rgb("+hslToRgb(_hue,_saturation,_lightness)+")",_hslRgbMatched=rgbRegex.exec(_rgbColorString);if(!_hslRgbMatched)throw new PolishedError(4,normalizedColor,_rgbColorString);return {red:parseInt(""+_hslRgbMatched[1],10),green:parseInt(""+_hslRgbMatched[2],10),blue:parseInt(""+_hslRgbMatched[3],10),alpha:parseFloat(""+hslaMatched[4])>1?parseFloat(""+hslaMatched[4])/100:parseFloat(""+hslaMatched[4])}}throw new PolishedError(5)}function rgbToHsl(color2){var red=color2.red/255,green=color2.green/255,blue=color2.blue/255,max=Math.max(red,green,blue),min=Math.min(red,green,blue),lightness=(max+min)/2;if(max===min)return color2.alpha!==void 0?{hue:0,saturation:0,lightness,alpha:color2.alpha}:{hue:0,saturation:0,lightness};var hue,delta=max-min,saturation=lightness>.5?delta/(2-max-min):delta/(max+min);switch(max){case red:hue=(green-blue)/delta+(green<blue?6:0);break;case green:hue=(blue-red)/delta+2;break;default:hue=(red-green)/delta+4;break}return hue*=60,color2.alpha!==void 0?{hue,saturation,lightness,alpha:color2.alpha}:{hue,saturation,lightness}}function parseToHsl(color2){return rgbToHsl(parseToRgb(color2))}var reduceHexValue=function(value3){return value3.length===7&&value3[1]===value3[2]&&value3[3]===value3[4]&&value3[5]===value3[6]?"#"+value3[1]+value3[3]+value3[5]:value3},reduceHexValue$1=reduceHexValue;function numberToHex(value3){var hex=value3.toString(16);return hex.length===1?"0"+hex:hex}function colorToHex(color2){return numberToHex(Math.round(color2*255))}function convertToHex(red,green,blue){return reduceHexValue$1("#"+colorToHex(red)+colorToHex(green)+colorToHex(blue))}function hslToHex(hue,saturation,lightness){return hslToRgb(hue,saturation,lightness,convertToHex)}function hsl(value3,saturation,lightness){if(typeof value3=="number"&&typeof saturation=="number"&&typeof lightness=="number")return hslToHex(value3,saturation,lightness);if(typeof value3=="object"&&saturation===void 0&&lightness===void 0)return hslToHex(value3.hue,value3.saturation,value3.lightness);throw new PolishedError(1)}function hsla(value3,saturation,lightness,alpha){if(typeof value3=="number"&&typeof saturation=="number"&&typeof lightness=="number"&&typeof alpha=="number")return alpha>=1?hslToHex(value3,saturation,lightness):"rgba("+hslToRgb(value3,saturation,lightness)+","+alpha+")";if(typeof value3=="object"&&saturation===void 0&&lightness===void 0&&alpha===void 0)return value3.alpha>=1?hslToHex(value3.hue,value3.saturation,value3.lightness):"rgba("+hslToRgb(value3.hue,value3.saturation,value3.lightness)+","+value3.alpha+")";throw new PolishedError(2)}function rgb(value3,green,blue){if(typeof value3=="number"&&typeof green=="number"&&typeof blue=="number")return reduceHexValue$1("#"+numberToHex(value3)+numberToHex(green)+numberToHex(blue));if(typeof value3=="object"&&green===void 0&&blue===void 0)return reduceHexValue$1("#"+numberToHex(value3.red)+numberToHex(value3.green)+numberToHex(value3.blue));throw new PolishedError(6)}function rgba(firstValue,secondValue,thirdValue,fourthValue){if(typeof firstValue=="string"&&typeof secondValue=="number"){var rgbValue=parseToRgb(firstValue);return "rgba("+rgbValue.red+","+rgbValue.green+","+rgbValue.blue+","+secondValue+")"}else {if(typeof firstValue=="number"&&typeof secondValue=="number"&&typeof thirdValue=="number"&&typeof fourthValue=="number")return fourthValue>=1?rgb(firstValue,secondValue,thirdValue):"rgba("+firstValue+","+secondValue+","+thirdValue+","+fourthValue+")";if(typeof firstValue=="object"&&secondValue===void 0&&thirdValue===void 0&&fourthValue===void 0)return firstValue.alpha>=1?rgb(firstValue.red,firstValue.green,firstValue.blue):"rgba("+firstValue.red+","+firstValue.green+","+firstValue.blue+","+firstValue.alpha+")"}throw new PolishedError(7)}var isRgb=function(color2){return typeof color2.red=="number"&&typeof color2.green=="number"&&typeof color2.blue=="number"&&(typeof color2.alpha!="number"||typeof color2.alpha>"u")},isRgba=function(color2){return typeof color2.red=="number"&&typeof color2.green=="number"&&typeof color2.blue=="number"&&typeof color2.alpha=="number"},isHsl=function(color2){return typeof color2.hue=="number"&&typeof color2.saturation=="number"&&typeof color2.lightness=="number"&&(typeof color2.alpha!="number"||typeof color2.alpha>"u")},isHsla=function(color2){return typeof color2.hue=="number"&&typeof color2.saturation=="number"&&typeof color2.lightness=="number"&&typeof color2.alpha=="number"};function toColorString(color2){if(typeof color2!="object")throw new PolishedError(8);if(isRgba(color2))return rgba(color2);if(isRgb(color2))return rgb(color2);if(isHsla(color2))return hsla(color2);if(isHsl(color2))return hsl(color2);throw new PolishedError(8)}function curried(f3,length,acc){return function(){var combined=acc.concat(Array.prototype.slice.call(arguments));return combined.length>=length?f3.apply(this,combined):curried(f3,length,combined)}}function curry(f3){return curried(f3,f3.length,[])}function guard(lowerBoundary,upperBoundary,value3){return Math.max(lowerBoundary,Math.min(upperBoundary,value3))}function darken(amount,color2){if(color2==="transparent")return color2;var hslColor=parseToHsl(color2);return toColorString(_extends({},hslColor,{lightness:guard(0,1,hslColor.lightness-parseFloat(amount))}))}var curriedDarken=curry(darken),curriedDarken$1=curriedDarken;function lighten(amount,color2){if(color2==="transparent")return color2;var hslColor=parseToHsl(color2);return toColorString(_extends({},hslColor,{lightness:guard(0,1,hslColor.lightness+parseFloat(amount))}))}var curriedLighten=curry(lighten),curriedLighten$1=curriedLighten;function opacify(amount,color2){if(color2==="transparent")return color2;var parsedColor=parseToRgb(color2),alpha=typeof parsedColor.alpha=="number"?parsedColor.alpha:1,colorWithAlpha=_extends({},parsedColor,{alpha:guard(0,1,(alpha*100+parseFloat(amount)*100)/100)});return rgba(colorWithAlpha)}var curriedOpacify=curry(opacify),curriedOpacify$1=curriedOpacify;function transparentize(amount,color2){if(color2==="transparent")return color2;var parsedColor=parseToRgb(color2),alpha=typeof parsedColor.alpha=="number"?parsedColor.alpha:1,colorWithAlpha=_extends({},parsedColor,{alpha:guard(0,1,+(alpha*100-parseFloat(amount)*100).toFixed(2)/100)});return rgba(colorWithAlpha)}var curriedTransparentize=curry(transparentize),curriedTransparentize$1=curriedTransparentize,Wrapper=styled.div(withReset,({theme})=>({backgroundColor:theme.base==="light"?"rgba(0,0,0,.01)":"rgba(255,255,255,.01)",borderRadius:theme.appBorderRadius,border:`1px dashed ${theme.appBorderColor}`,display:"flex",alignItems:"center",justifyContent:"center",padding:20,margin:"25px 0 40px",color:curriedTransparentize$1(.3,theme.color.defaultText),fontSize:theme.typography.size.s2})),EmptyBlock=props=>React15__default__default.createElement(Wrapper,{...props,className:"docblock-emptyblock sb-unstyled"}),StyledSyntaxHighlighter=styled(SyntaxHighlighter)(({theme})=>({fontSize:`${theme.typography.size.s2-1}px`,lineHeight:"19px",margin:"25px 0 40px",borderRadius:theme.appBorderRadius,boxShadow:theme.base==="light"?"rgba(0, 0, 0, 0.10) 0 1px 3px 0":"rgba(0, 0, 0, 0.20) 0 2px 5px 0","pre.prismjs":{padding:20,background:"inherit"}})),SourceSkeletonWrapper=styled.div(({theme})=>({background:theme.background.content,borderRadius:theme.appBorderRadius,border:`1px solid ${theme.appBorderColor}`,boxShadow:theme.base==="light"?"rgba(0, 0, 0, 0.10) 0 1px 3px 0":"rgba(0, 0, 0, 0.20) 0 2px 5px 0",margin:"25px 0 40px",padding:"20px 20px 20px 22px"})),SourceSkeletonPlaceholder=styled.div(({theme})=>({animation:`${theme.animation.glow} 1.5s ease-in-out infinite`,background:theme.appBorderColor,height:17,marginTop:1,width:"60%",[`&:first-child${ignoreSsrWarning}`]:{margin:0}})),SourceSkeleton=()=>React15__default__default.createElement(SourceSkeletonWrapper,null,React15__default__default.createElement(SourceSkeletonPlaceholder,null),React15__default__default.createElement(SourceSkeletonPlaceholder,{style:{width:"80%"}}),React15__default__default.createElement(SourceSkeletonPlaceholder,{style:{width:"30%"}}),React15__default__default.createElement(SourceSkeletonPlaceholder,{style:{width:"80%"}})),Source=({isLoading,error,language,code,dark,format:format3=!1,...rest})=>{let{typography}=useTheme();if(isLoading)return React15__default__default.createElement(SourceSkeleton,null);if(error)return React15__default__default.createElement(EmptyBlock,null,error);let syntaxHighlighter=React15__default__default.createElement(StyledSyntaxHighlighter,{bordered:!0,copyable:!0,format:format3,language,className:"docblock-source sb-unstyled",...rest},code);if(typeof dark>"u")return syntaxHighlighter;let overrideTheme=dark?themes.dark:themes.light;return React15__default__default.createElement(ThemeProvider,{theme:convert({...overrideTheme,fontCode:typography.fonts.mono,fontBase:typography.fonts.base})},syntaxHighlighter)},toGlobalSelector=element=>`& :where(${element}:not(.sb-anchor, .sb-unstyled, .sb-unstyled ${element}))`,breakpoint=600;styled.h1(withReset,({theme})=>({color:theme.color.defaultText,fontSize:theme.typography.size.m3,fontWeight:theme.typography.weight.bold,lineHeight:"32px",[`@media (min-width: ${breakpoint}px)`]:{fontSize:theme.typography.size.l1,lineHeight:"36px",marginBottom:"16px"}}));styled.h2(withReset,({theme})=>({fontWeight:theme.typography.weight.regular,fontSize:theme.typography.size.s3,lineHeight:"20px",borderBottom:"none",marginBottom:15,[`@media (min-width: ${breakpoint}px)`]:{fontSize:theme.typography.size.m1,lineHeight:"28px",marginBottom:24},color:curriedTransparentize$1(.25,theme.color.defaultText)}));styled.div(({theme})=>{let reset={fontFamily:theme.typography.fonts.base,fontSize:theme.typography.size.s3,margin:0,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",WebkitOverflowScrolling:"touch"},headers={margin:"20px 0 8px",padding:0,cursor:"text",position:"relative",color:theme.color.defaultText,"&:first-of-type":{marginTop:0,paddingTop:0},"&:hover a.anchor":{textDecoration:"none"},"& code":{fontSize:"inherit"}},code={lineHeight:1,margin:"0 2px",padding:"3px 5px",whiteSpace:"nowrap",borderRadius:3,fontSize:theme.typography.size.s2-1,border:theme.base==="light"?`1px solid ${theme.color.mediumlight}`:`1px solid ${theme.color.darker}`,color:theme.base==="l