import{c as t,a as n}from"./p-7d5dbd9a.js";const e=(t,n,e,c)=>{if(e==="length"||e==="prototype"){return}if(e==="arguments"||e==="caller"){return}const r=Object.getOwnPropertyDescriptor(t,e);const i=Object.getOwnPropertyDescriptor(n,e);if(!o(r,i)&&c){return}Object.defineProperty(t,e,i)};const o=function(t,n){return t===undefined||t.configurable||t.writable===n.writable&&t.enumerable===n.enumerable&&t.configurable===n.configurable&&(t.writable||t.value===n.value)};const c=(t,n)=>{const e=Object.getPrototypeOf(n);if(e===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,e)};const r=(t,n)=>`/* Wrapped ${t}*/\n${n}`;const i=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const u=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const s=(t,n,e)=>{const o=e===""?"":`with ${e.trim()}() `;const c=r.bind(null,o,n.toString());Object.defineProperty(c,"name",u);Object.defineProperty(t,"toString",{...i,value:c})};const a=(t,n,{ignoreNonConfigurable:o=false}={})=>{const{name:r}=t;for(const c of Reflect.ownKeys(n)){e(t,n,c,o)}c(t,n);s(t,n,r);return t};var f=a;var d=()=>{const t={};t.promise=new Promise(((n,e)=>{t.resolve=n;t.reject=e}));return t};var l=t((function(t,e){var o=n&&n.__awaiter||function(t,n,e,o){return new(e||(e=Promise))((function(c,r){function i(t){try{s(o.next(t))}catch(n){r(n)}}function u(t){try{s(o["throw"](t))}catch(n){r(n)}}function s(t){t.done?c(t.value):new e((function(n){n(t.value)})).then(i,u)}s((o=o.apply(t,n||[])).next())}))};var c=n&&n.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});const r=c(d);function i(t,n="maxAge"){let e;let c;let i;const u=()=>o(this,void 0,void 0,(function*(){if(e!==undefined){return}const u=u=>o(this,void 0,void 0,(function*(){i=r.default();const o=u[1][n]-Date.now();if(o<=0){t.delete(u[0]);i.resolve();return}e=u[0];c=setTimeout((()=>{t.delete(u[0]);if(i){i.resolve()}}),o);if(typeof c.unref==="function"){c.unref()}return i.promise}));try{for(const n of t){yield u(n)}}catch(s){}e=undefined}));const s=()=>{e=undefined;if(c!==undefined){clearTimeout(c);c=undefined}if(i!==undefined){i.reject(undefined);i=undefined}};const a=t.set.bind(t);t.set=(n,o)=>{if(t.has(n)){t.delete(n)}const c=a(n,o);if(e&&e===n){s()}u();return c};u();return t}e.default=i;t.exports=i;t.exports.default=i}));const m=new WeakMap;const p=new WeakMap;const b=(t,{cacheKey:n,cache:e=new Map,maxAge:o}={})=>{if(typeof o==="number"){l(e)}const c=function(...c){const r=n?n(c):c[0];const i=e.get(r);if(i){return i.data}const u=t.apply(this,c);e.set(r,{data:u,maxAge:o?Date.now()+o:Number.POSITIVE_INFINITY});return u};f(c,t,{ignoreNonConfigurable:true});p.set(c,e);return c};b.decorator=(t={})=>(n,e,o)=>{const c=n[e];if(typeof c!=="function"){throw new TypeError("The decorated value must be a function")}delete o.value;delete o.writable;o.get=function(){if(!m.has(this)){const n=b(c,t);m.set(this,n);return n}return m.get(this)}};b.clear=t=>{const n=p.get(t);if(!n){throw new TypeError("Can't clear a function that was not memoized!")}if(typeof n.clear!=="function"){throw new TypeError("The cache Map can't be cleared!")}n.clear()};var v=b;var h;(function(t){t["neutral"]="neutral";t["success"]="success";t["warn"]="warn";t["danger"]="danger"})(h||(h={}));var g;(function(t){t["topStart"]="topStart";t["topCenter"]="topCenter";t["topEnd"]="topEnd";t["bottomStart"]="bottomStart";t["bottomCenter"]="bottomCenter";t["bottomEnd"]="bottomEnd"})(g||(g={}));const w=t=>{const n=document.querySelector("stencila-toast-container");if(n){return n}const e=document.createElement("stencila-toast-container");if(t.position!==undefined){e.position=t.position}document.body.append(e);return e};const y=(t={})=>{const n=(n,e={})=>{var o,c,r,i,u,s;const a=document.createElement("stencila-toast");a.type=(c=(o=e.type)!==null&&o!==void 0?o:t.type)!==null&&c!==void 0?c:h.neutral;a.position=(i=(r=e.position)!==null&&r!==void 0?r:t.position)!==null&&i!==void 0?i:g.topCenter;a.dismissable=(u=e.dismissable)!==null&&u!==void 0?u:t.dismissable;a.duration=(s=e.duration)!==null&&s!==void 0?s:t.duration;a.innerText=n;w(t).append(a)};const e=v(n,{cacheKey:JSON.stringify,maxAge:150});return{present:e}};const j=Object.freeze({__proto__:null,get ToastTypes(){return h},get ToastPositions(){return g},toastController:y});export{g as T,y as a,h as b,j as t};
//# sourceMappingURL=p-3c47a75d.js.map