{"version":3,"sources":["jsdelivr-header.js","/npm/@contentful/f36-copybutton@5.8.0/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA;AACA;AACA","file":"/npm/@contentful/f36-copybutton@5.8.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@contentful/f36-copybutton@5.8.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";var d=require(\"react\"),V=require(\"@contentful/f36-tokens\"),f36Icons=require(\"@contentful/f36-icons\"),f36Tooltip=require(\"@contentful/f36-tooltip\"),f36Button=require(\"@contentful/f36-button\"),emotion=require(\"emotion\");function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=_interopDefault(d),V__default=_interopDefault(V),L=Object.defineProperty,F=Object.defineProperties,N=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,x=(e,t,o)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,f=(e,t)=>{for(var o in t||(t={}))v.call(t,o)&&x(e,o,t[o]);if(m)for(var o of m(t))E.call(t,o)&&x(e,o,t[o]);return e},C=(e,t)=>F(e,N(t)),w=(e,t)=>{var o={};for(var l in e)v.call(e,l)&&t.indexOf(l)<0&&(o[l]=e[l]);if(null!=e&&m)for(var l of m(e))t.indexOf(l)<0&&E.call(e,l)&&(o[l]=e[l]);return o},T=(e,t,o)=>new Promise(((l,r)=>{var a=e=>{try{i(o.next(e))}catch(e){r(e)}},n=e=>{try{i(o.throw(e))}catch(e){r(e)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(a,n);i((o=o.apply(e,t)).next())})),H=({size:e})=>{let t=\"small\"===e?\"32px\":\"40px\";return{button:emotion.css({height:t,minWidth:\"auto\",width:t,\"span:first-child\":{marginRight:0}})}};function k(e,t){var o=e,{className:l,isDisabled:r=!1,isLoading:a=!1,label:n,onBlur:i,onCopy:u,size:s=\"medium\",testId:c=\"cf-ui-copy-button\",tooltipCopiedText:p=\"Value copied to clipboard\",tooltipProps:m,tooltipText:y=\"Copy to clipboard\",value:b}=o,v=w(o,[\"className\",\"isDisabled\",\"isLoading\",\"label\",\"onBlur\",\"onCopy\",\"size\",\"testId\",\"tooltipCopiedText\",\"tooltipProps\",\"tooltipText\",\"value\"]);let _=H({size:s}),[x,h]=d.useState(!1),g=d.useCallback((()=>T(this,null,(function*(){try{yield window.navigator.clipboard.writeText(b)}catch(e){let t=document.createElement(\"input\");t.style.display=\"none\",document.body.appendChild(t),t.value=b,t.focus(),t.select();let o=document.execCommand(\"copy\");if(\"unsuccessful\"===o)throw new Error(\"Unable to copy value\",{cause:o});return void t.remove()}null==u||u(b),h(!0)}))),[u,b]);return d__default.default.createElement(f36Tooltip.Tooltip,C(f({content:x?p:y},m),{isDisabled:r}),d__default.default.createElement(f36Button.Button,C(f({\"aria-label\":x?p:null!=n?n:y,\"aria-live\":\"assertive\",className:emotion.cx(_.button,l),isDisabled:a||r,isLoading:a,onBlur:e=>{x&&h(!1),null==i||i(e)},testId:c,startIcon:d__default.default.createElement(f36Icons.CopySimpleIcon,{color:V__default.default.gray600,size:\"small\"===s?\"tiny\":\"small\"}),variant:\"secondary\"},v),{onClick:g,ref:t})))}k.displayName=\"CopyButton\";var A=d__default.default.forwardRef(k);exports.CopyButton=A;\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOltdLCJtYXBwaW5ncyI6IiIsImlnbm9yZUxpc3QiOltdfQ=="]}