/**
 * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
 * Original file: /npm/@metapages/hash-query@0.10.0/dist/core/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
function a(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}const e=a((function(a,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var t="boolean"==typeof e.cycles&&e.cycles,n=e.cmp&&function(a){return function(e){return function(t,n){var r={key:t,value:e[t]},s={key:n,value:e[n]};return a(r,s)}}}(e.cmp),r=[];return function a(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var s,o;if(Array.isArray(e)){for(o="[",s=0;s<e.length;s++)s&&(o+=","),o+=a(e[s])||"null";return o+"]"}if(null===e)return"null";if(-1!==r.indexOf(e)){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var i=r.push(e)-1,l=Object.keys(e).sort(n&&n(e));for(o="",s=0;s<l.length;s++){var h=l[s],u=a(e[h]);u&&(o&&(o+=","),o+=JSON.stringify(h)+":"+u)}return r.splice(i,1),"{"+o+"}"}}(a)})),t=a=>r(e(a)),n=a=>{if(a&&a.length>0)try{return JSON.parse(s(a))}catch{return JSON.parse(decodeURIComponent(atob(decodeURIComponent(a))))}},r=a=>btoa(encodeURIComponent(a)),s=a=>{try{return decodeURIComponent(atob(a))}catch{return decodeURIComponent(atob(decodeURIComponent(a)))}},o=a=>{const e=a instanceof URL?a:new URL(a);return i(e.hash)},i=a=>{let e=a;for(;e.startsWith("#");)e=e.substring(1);const t=e.indexOf("?");if(-1===t)return[e,{}];const n=e.substring(0,t);e=e.substring(t+1);const r={};return e.split("&").filter((a=>a.length>0)).map((a=>{const e=a.indexOf("=");if(-1===e)return[a,""];return[a.substring(0,e),a.substring(e+1)]})).forEach((([a,e])=>{r[a]=e})),Object.keys(r).forEach((a=>{r[a]=r[a]})),[n,r]},l=(a,e)=>{const[t,n]=o(a);return n[e]},h=()=>typeof window<"u"&&typeof globalThis.location<"u",u=a=>{if(h())return c()[1][a]},c=()=>h()?o(globalThis.location.href):["",{}],d=(a,e,t)=>{if(!h())return;const n=globalThis.location.hash.startsWith("#")?globalThis.location.hash.substring(1):globalThis.location.hash,r=m(n,a,e);r!==n&&(null!=t&&t.modifyHistory?globalThis.location.hash=r:(globalThis.history.replaceState(null,typeof document<"u"?document.title:"",`${globalThis.location.pathname}${globalThis.location.search}${r.startsWith("#")?"":"#"}${r}`),globalThis.dispatchEvent(new HashChangeEvent("hashchange"))))},m=(a,e,t)=>{const[n,r]=i(a);let s=!1;if(r.hasOwnProperty(e)&&null===t||void 0===t?(delete r[e],s=!0):r[e]!==t&&(r[e]=t,s=!0),!s)return a;const o=Object.keys(r);o.sort();const l=o.map(((a,e)=>{const t=r[a];return/^[A-Za-z0-9+/]+={0,2}$/.test(t)&&t.length,`${a}=${t}`})).join("&");return n||l?`${n||""}${l?"?"+l:""}`:""},g=(a,e)=>{let t=a;for(;t.startsWith("#");)t=t.substring(1);const n=t.indexOf("?"),r=-1===n?t:t.substring(0,n),s={};if(-1!==n){const a=t.substring(n+1);a.length>0&&a.split("&").forEach((a=>{if(a.length>0){const e=a.indexOf("=");if(-1===e)s[a]="";else{const t=a.substring(0,e),n=a.substring(e+1);s[t]=n}}}))}let o=!1;for(const[a,t]of Object.entries(e))null==t?s.hasOwnProperty(a)&&(delete s[a],o=!0):s[a]!==t&&(s[a]=t,o=!0);if(!o)return a;const i=Object.keys(s);i.sort();const l=i.map((a=>{const e=s[a];return/^[A-Za-z0-9+/]+={0,2}$/.test(e)&&e.length,`${a}=${e}`})).join("&");return r||l?`${r||""}${l?"?"+l:""}`:""},f=(a,e,t)=>{const n=a instanceof URL?a:new URL(a),r=m(n.hash,e,t);return n.hash=r,n},H=(a,e)=>{const t=a instanceof URL?a:new URL(a);let n=g(t.hash,e);return t.hash=n,t},P=(a,e,t)=>{const n=a instanceof URL?a:new URL(a);return n.hash=I(n.hash,e,t),n},b=(a,e)=>{const t=l(a,e);if(t&&""!==t)return n(t)},p=(a,e)=>{const[t,r]=i(a),s=r[e];if(s&&""!==s)return n(s)},U=(a,e,n)=>{const r=e?t(e):void 0;d(a,r,n)},v=a=>{if(h())return b(globalThis.location.href,a)},I=(a,e,n)=>{const r=n?t(n):void 0;return m(a,e,r)},y=(a,e,t)=>f(a,e,t?t.toString():void 0),V=(a,e)=>{const t=l(a,e);return t?parseFloat(t):void 0},w=(a,e,t)=>{d(a,null!=e?e.toString():void 0,t)},F=a=>{if(h())return V(globalThis.location.href,a)},O=(a,e,t)=>f(a,e,null!=t?t.toString():void 0),S=(a,e)=>{const t=l(a,e);return t?parseInt(t):void 0},T=(a,e,t)=>{w(a,e,t)},W=a=>{if(h())return S(globalThis.location.href,a)},E=(a,e,t)=>f(a,e,t?"true":void 0),R=(a,e)=>"true"===l(a,e),J=(a,e,t)=>{d(a,e?"true":void 0,t)},L=a=>{if(h())return R(globalThis.location.href,a)},B=(a,e,t)=>f(a,e,null==t?void 0:r(t)),$=(a,e)=>{const t=l(a,e);return t&&""!==t?s(t):void 0},C=(a,e,t)=>{const n=null==e?void 0:r(e);d(a,n,t)},j=a=>{if(h())return $(globalThis.location.href,a)},N=(a,e,t)=>f(a,e,null==t?void 0:encodeURIComponent(t)),x=(a,e)=>{const t=l(a,e);return t&&""!==t?decodeURIComponent(t):void 0},k=(a,e,t)=>{const n=null==e?void 0:encodeURIComponent(e);d(a,n,t)},_=a=>{if(h())return x(globalThis.location.href,a)},A=(a,e,t)=>{if(!h())return()=>{};let n=!1;const r=r=>{n||t(e(a))};return globalThis.addEventListener("hashchange",r),setTimeout((()=>{n||t(e(a))}),0),()=>{n||(n=!0,globalThis.removeEventListener("hashchange",r))}},D=(a,e)=>A(a,j,e),z=(a,e)=>A(a,L,e),Z=(a,e)=>A(a,F,e),M=(a,e)=>A(a,W,e),q=(a,e)=>A(a,v,e),G=(a,e)=>A(a,_,e),K=(a,e)=>{d(a,void 0,e)},Q=(a,e)=>f(a,e,void 0);export{D as addEventListenerHashParamBase64,z as addEventListenerHashParamBoolean,Z as addEventListenerHashParamFloat,M as addEventListenerHashParamInt,q as addEventListenerHashParamJson,G as addEventListenerHashParamUriEncoded,n as blobFromBase64String,t as blobToBase64String,g as createHashParamValuesInHashString,Q as deleteHashParamFromUrl,K as deleteHashParamFromWindow,u as getHashParamFromWindow,l as getHashParamValue,$ as getHashParamValueBase64DecodedFromUrl,j as getHashParamValueBase64DecodedFromWindow,R as getHashParamValueBooleanFromUrl,L as getHashParamValueBooleanFromWindow,V as getHashParamValueFloatFromUrl,F as getHashParamValueFloatFromWindow,S as getHashParamValueIntFromUrl,W as getHashParamValueIntFromWindow,p as getHashParamValueJsonFromHashString,b as getHashParamValueJsonFromUrl,v as getHashParamValueJsonFromWindow,x as getHashParamValueUriDecodedFromUrl,_ as getHashParamValueUriDecodedFromWindow,c as getHashParamsFromWindow,o as getUrlHashParams,i as getUrlHashParamsFromHashString,d as setHashParamInWindow,B as setHashParamValueBase64EncodedInUrl,C as setHashParamValueBase64EncodedInWindow,E as setHashParamValueBooleanInUrl,J as setHashParamValueBooleanInWindow,y as setHashParamValueFloatInUrl,w as setHashParamValueFloatInWindow,m as setHashParamValueInHashString,f as setHashParamValueInUrl,O as setHashParamValueIntInUrl,T as setHashParamValueIntInWindow,I as setHashParamValueJsonInHashString,P as setHashParamValueJsonInUrl,U as setHashParamValueJsonInWindow,N as setHashParamValueUriEncodedInUrl,k as setHashParamValueUriEncodedInWindow,H as setHashParamsInUrl,s as stringFromBase64String,r as stringToBase64String};export default null;
//# sourceMappingURL=/sm/def826a0346bcd32ba5d37c2cba6ed63134d28ed857cb20e6ac4e127400faa05.map