/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@descope/sdk-helpers@0.7.0/dist/cjs/index.cjs.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var e=require("tslib");const t=(e,t)=>e.length===t.length&&e.every(((e,s)=>e===t[s]));var s,r,i,n;function a(e,t){const s=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(s.length!==r.length)return!1;for(let r=0;r<s.length;r+=1){const i=s[r],n=e[i],c=t[i];if(null===n||null===c){if(n!==c)return!1}else if("object"==typeof n&&"object"==typeof c){if(!a(n,c))return!1}else if(n!==c)return!1}return!0}s=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap;const c=["=","+","-","@","\t","\r"],l=e=>{const t=(e=>e.length>0&&c.includes(e[0])?`'${e}`:e)(Array.isArray(e)?e.join("; "):String(null!=e?e:""));return t.includes(",")||t.includes('"')||t.includes("\n")||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t};exports.State=class{constructor(t={},{forceUpdate:c=!1}={}){s.set(this,void 0),r.set(this,{}),i.set(this,0),n.set(this,!0),this.update=t=>{const i="function"==typeof t?t(e.__classPrivateFieldGet(this,s,"f")):t,c=Object.assign(Object.assign({},e.__classPrivateFieldGet(this,s,"f")),i);if(e.__classPrivateFieldGet(this,n,"f")||!a(e.__classPrivateFieldGet(this,s,"f"),c)){const t=e.__classPrivateFieldGet(this,s,"f");e.__classPrivateFieldSet(this,s,c,"f"),Object.freeze(e.__classPrivateFieldGet(this,s,"f")),setTimeout((()=>{Object.values(e.__classPrivateFieldGet(this,r,"f")).forEach((e=>e(c,t,((e,t)=>s=>e[s]!==t[s])(c,t))))}),0)}},e.__classPrivateFieldSet(this,s,t,"f"),e.__classPrivateFieldSet(this,n,c,"f")}get current(){return Object.assign({},e.__classPrivateFieldGet(this,s,"f"))}subscribe(t){return e.__classPrivateFieldSet(this,i,e.__classPrivateFieldGet(this,i,"f")+1,"f"),e.__classPrivateFieldGet(this,r,"f")[e.__classPrivateFieldGet(this,i,"f")]=t,e.__classPrivateFieldGet(this,i,"f").toString()}unsubscribe(t){const s=!!e.__classPrivateFieldGet(this,r,"f")[t];return s&&delete e.__classPrivateFieldGet(this,r,"f")[t],s}unsubscribeAll(){return e.__classPrivateFieldSet(this,r,{},"f"),!0}},exports.compareArrays=t,exports.compose=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)},exports.createSingletonMixin=e=>{const t=Symbol((e=>{const t=e.toString();let s=0;for(let e=0;e<t.length;e++)s=(s<<5)-s+t.charCodeAt(e),s&=s;return s.toString(16)})(e));return s=>{if(s[t])return s;const r=e(s);return r[t]=!0,r}},exports.createTemplate=e=>{const t=document.createElement("template");return t.innerHTML=e,t},exports.debounce=(e,t=500)=>{let s;return function(...r){clearTimeout(s),s=setTimeout((()=>e.apply(this,r)),t)}},exports.decodeJWT=e=>{try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(s)}catch(e){return null}},exports.downloadCsv=(e,t)=>{const s=new Blob(["\ufeff"+e],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(s),i=document.createElement("a");i.href=r,i.setAttribute("download",t),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},exports.escapeCsvValue=l,exports.generateCsv=(e,t)=>[t.map((e=>l(e.header))).join(","),...e.map((e=>t.map((t=>l(e[t.path]))).join(",")))].join("\n"),exports.isObjEmpty=e=>0===Object.keys(e).length&&e.constructor===Object,exports.isPlainObject=e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype,exports.kebabCase=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),exports.pathJoin=(...e)=>e.join("/").replace(/\/+/g,"/"),exports.pluralize=e=>(t,...s)=>t.reduce(((t,r,i)=>{var n;return`${t}${r}${(null===(n=null==s?void 0:s[i])||void 0===n?void 0:n[e>1?1:0])||""}`}),""),exports.withMemCache=e=>{let s,r;return(...i)=>(s&&t(s,i)||(s=i,r=e(...i)),r)};
//# sourceMappingURL=index.cjs.js.map
