Humuhumu33 commited on
Commit
e0b05e3
·
verified ·
1 Parent(s): 061f124

κ-store: 30 shell blobs (aggregate 4e665b0092a3)

Browse files
b/11247d28c5c2fb3d976002c2b55fecb6ba19fd88153e11d2c7af5832fd6ff331 ADDED
@@ -0,0 +1 @@
 
 
1
+ var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>{try{return a||b((a={exports:{}}).exports,a),a.exports}catch(c){throw a=0,c}};var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
b/23ad078d7c8a8e5c306772fbd0f70c81df62c2d37532b7a93c17a3f67c0428f3 ADDED
@@ -0,0 +1 @@
 
 
1
+ function s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(t)));return JSON.parse(n)}var c=["v","kind","amount","asset","fiat","to","toName","from","fromName","memo","created","expires","claimSecret","kappa","hashlock","pub","sig"];function l(e){let t=s(e);if(!Array.isArray(t))return t;let n={};return c.forEach((o,a)=>{t[a]!=null&&(n[o]=t[a])}),n.memo==null&&(n.memo=""),n}async function u(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return[...new Uint8Array(n)].map(o=>o.toString(16).padStart(2,"0")).join("")}var y=u;function r(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}async function i(e,t,n){try{let o=await crypto.subtle.importKey("raw",r(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},o,r(t),new TextEncoder().encode(n))}catch{return!1}}async function m(e){return!e||!e.pub||!e.sig?!1:i(e.pub,e.sig,p(e))}function p(e){let t=[e.v,e.kind,e.amount,e.asset,e.fiat||"",e.to||"",e.toName||"",e.from||"",e.fromName||"",e.memo||"",e.created||"",e.expires||""];return(e.hashlock||e.pub)&&t.push(e.hashlock||"",e.pub||""),t.join("|")}var d={USD:"$",EUR:"\u20AC",GBP:"\xA3"};function w(e){let t=Number(e.amount);return e.fiat?`${d[e.fiat]||""}${t.toFixed(2)}`:`${t%1===0?t:t.toFixed(4).replace(/0+$/,"")} ${e.asset}`}var f=/(https?:\/\/\S*pay-claim\.html#([A-Za-z0-9_-]+))|(holo:\/\/pay\/\S*#([A-Za-z0-9_-]+))/;function h(e){let t=String(e||"").match(f);if(!t)return null;let n=t[2]||t[4],o=t[0];try{let a=l(n);if(a&&a.v===1&&Number(a.amount)>0)return{intent:a,url:o,payload:n}}catch{}return null}export{y as a,m as b,w as c,h as d};
b/2aa7375ed161dd5b85b93ee612036d9f8f163af65fe6558b8dce8b0984467ea8 ADDED
@@ -0,0 +1 @@
 
 
1
+ function l(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(t)));return JSON.parse(n)}var i=["v","kind","amount","asset","fiat","to","toName","from","fromName","memo","created","expires","claimSecret","pub","sig"];function u(e){let t=l(e);if(!Array.isArray(t))return t;let n={};return i.forEach((o,a)=>{t[a]!=null&&(n[o]=t[a])}),n.memo==null&&(n.memo=""),n}async function p(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return[...new Uint8Array(n)].map(o=>o.toString(16).padStart(2,"0")).join("")}var y=p;function r(e){let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function s(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}async function w(){let e=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),t=new Uint8Array(await crypto.subtle.exportKey("raw",e.publicKey));return{pub:r(t),sign:async n=>r(new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e.privateKey,new TextEncoder().encode(n))))}}async function c(e,t,n){try{let o=await crypto.subtle.importKey("raw",s(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},o,s(t),new TextEncoder().encode(n))}catch{return!1}}var h=c;async function b(e){return!e||!e.pub||!e.sig?!1:c(e.pub,e.sig,d(e))}function d(e){let t=[e.v,e.kind,e.amount,e.asset,e.fiat||"",e.to||"",e.toName||"",e.from||"",e.fromName||"",e.memo||"",e.created||"",e.expires||""];return(e.hashlock||e.pub)&&t.push(e.hashlock||"",e.pub||""),t.join("|")}var f={USD:"$",EUR:"\u20AC",GBP:"\xA3"};function g(e){let t=Number(e.amount);return e.fiat?`${f[e.fiat]||""}${t.toFixed(2)}`:`${t%1===0?t:t.toFixed(4).replace(/0+$/,"")} ${e.asset}`}var m=/(https?:\/\/\S*pay-claim\.html#([A-Za-z0-9_-]+))|(holo:\/\/pay\/\S*#([A-Za-z0-9_-]+))/;function S(e){let t=String(e||"").match(m);if(!t)return null;let n=t[2]||t[4],o=t[0];try{let a=u(n);if(a&&a.v===1&&Number(a.amount)>0)return{intent:a,url:o,payload:n}}catch{}return null}export{y as a,w as b,h as c,b as d,g as e,S as f};
b/42ac444800c708852b2004131d274632edaf9a45c578309451e04fd27d67cbc3 ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as w}from"./chunk-SQE76S5B.js";var q=w(r=>{"use strict";var y=Symbol.for("react.element"),T=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),L=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),B=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),R=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=R&&e[R]||e["@@iterator"],typeof e=="function"?e:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,O={};function p(e,t,n){this.props=e,this.context=t,this.refs=O,this.updater=n||C}p.prototype.isReactComponent={};p.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function x(){}x.prototype=p.prototype;function m(e,t,n){this.props=e,this.context=t,this.refs=O,this.updater=n||C}var S=m.prototype=new x;S.constructor=m;j(S,p.prototype);S.isPureReactComponent=!0;var $=Array.isArray,g=Object.prototype.hasOwnProperty,E={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function I(e,t,n){var u,o={},c=null,f=null;if(t!=null)for(u in t.ref!==void 0&&(f=t.ref),t.key!==void 0&&(c=""+t.key),t)g.call(t,u)&&!P.hasOwnProperty(u)&&(o[u]=t[u]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var i=Array(s),a=0;a<s;a++)i[a]=arguments[a+2];o.children=i}if(e&&e.defaultProps)for(u in s=e.defaultProps,s)o[u]===void 0&&(o[u]=s[u]);return{$$typeof:y,type:e,key:c,ref:f,props:o,_owner:E.current}}function G(e,t){return{$$typeof:y,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function k(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}function J(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var b=/\/+/g;function v(e,t){return typeof e=="object"&&e!==null&&e.key!=null?J(""+e.key):t.toString(36)}function _(e,t,n,u,o){var c=typeof e;(c==="undefined"||c==="boolean")&&(e=null);var f=!1;if(e===null)f=!0;else switch(c){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case y:case T:f=!0}}if(f)return f=e,o=o(f),e=u===""?"."+v(f,0):u,$(o)?(n="",e!=null&&(n=e.replace(b,"$&/")+"/"),_(o,t,n,"",function(a){return a})):o!=null&&(k(o)&&(o=G(o,n+(!o.key||f&&f.key===o.key?"":(""+o.key).replace(b,"$&/")+"/")+e)),t.push(o)),1;if(f=0,u=u===""?".":u+":",$(e))for(var s=0;s<e.length;s++){c=e[s];var i=u+v(c,s);f+=_(c,t,n,i,o)}else if(i=W(e),typeof i=="function")for(e=i.call(e),s=0;!(c=e.next()).done;)c=c.value,i=u+v(c,s++),f+=_(c,t,n,i,o);else if(c==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return f}function d(e,t,n){if(e==null)return e;var u=[],o=0;return _(e,u,"","",function(c){return t.call(n,c,o++)}),u}function K(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var l={current:null},h={transition:null},Q={ReactCurrentDispatcher:l,ReactCurrentBatchConfig:h,ReactCurrentOwner:E};function V(){throw Error("act(...) is not supported in production builds of React.")}r.Children={map:d,forEach:function(e,t,n){d(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return d(e,function(){t++}),t},toArray:function(e){return d(e,function(t){return t})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};r.Component=p;r.Fragment=A;r.Profiler=U;r.PureComponent=m;r.StrictMode=N;r.Suspense=z;r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q;r.act=V;r.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var u=j({},e.props),o=e.key,c=e.ref,f=e._owner;if(t!=null){if(t.ref!==void 0&&(c=t.ref,f=E.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(i in t)g.call(t,i)&&!P.hasOwnProperty(i)&&(u[i]=t[i]===void 0&&s!==void 0?s[i]:t[i])}var i=arguments.length-2;if(i===1)u.children=n;else if(1<i){s=Array(i);for(var a=0;a<i;a++)s[a]=arguments[a+2];u.children=s}return{$$typeof:y,type:e.type,key:o,ref:c,props:u,_owner:f}};r.createContext=function(e){return e={$$typeof:L,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:F,_context:e},e.Consumer=e};r.createElement=I;r.createFactory=function(e){var t=I.bind(null,e);return t.type=e,t};r.createRef=function(){return{current:null}};r.forwardRef=function(e){return{$$typeof:M,render:e}};r.isValidElement=k;r.lazy=function(e){return{$$typeof:H,_payload:{_status:-1,_result:e},_init:K}};r.memo=function(e,t){return{$$typeof:B,type:e,compare:t===void 0?null:t}};r.startTransition=function(e){var t=h.transition;h.transition={};try{e()}finally{h.transition=t}};r.unstable_act=V;r.useCallback=function(e,t){return l.current.useCallback(e,t)};r.useContext=function(e){return l.current.useContext(e)};r.useDebugValue=function(){};r.useDeferredValue=function(e){return l.current.useDeferredValue(e)};r.useEffect=function(e,t){return l.current.useEffect(e,t)};r.useId=function(){return l.current.useId()};r.useImperativeHandle=function(e,t,n){return l.current.useImperativeHandle(e,t,n)};r.useInsertionEffect=function(e,t){return l.current.useInsertionEffect(e,t)};r.useLayoutEffect=function(e,t){return l.current.useLayoutEffect(e,t)};r.useMemo=function(e,t){return l.current.useMemo(e,t)};r.useReducer=function(e,t,n){return l.current.useReducer(e,t,n)};r.useRef=function(e){return l.current.useRef(e)};r.useState=function(e){return l.current.useState(e)};r.useSyncExternalStore=function(e,t,n){return l.current.useSyncExternalStore(e,t,n)};r.useTransition=function(){return l.current.useTransition()};r.version="18.3.1"});var X=w((Z,D)=>{"use strict";D.exports=q()});export{X as a};
b/56958e3b499497fa8a7281c8c1893637c89cbe3b7867aea276b07b34fca109ef ADDED
The diff for this file is too large to render. See raw diff
 
b/5bd28415d024f24012e1b03fe0e2659516a73159e7eafbcd9faa682114f3c9ac ADDED
@@ -0,0 +1 @@
 
 
1
+ import"./chunk-SQE76S5B.js";function s(r){let e=r||{},t=e.name||"Someone";switch(e.t){case"call":return{title:t+(e.video?" \u2014 video call":" \u2014 calling"),body:"Tap to answer",tag:"call:"+(e.room||e.chat||""),requireInteraction:!0,renotify:!0,data:{route:e}};case"meet":return{title:(e.name||"A room")+" \u2014 meeting",body:"Tap to join",tag:"meet:"+(e.room||e.chat||""),requireInteraction:!0,data:{route:e}};case"pay":return{title:t+(e.kind==="request"?" requests ":" sent you ")+(e.amount||"money"),body:"Tap to open",tag:"pay:"+(e.kappa||e.chat||""),data:{route:e}};case"dm":return{title:t,body:e.sealed?"\u{1F512} New sealed message":e.preview||"New message",tag:"dm:"+(e.chat||""),data:{route:e}};case"bridge":return{title:t,body:e.preview||"New message",tag:"chat:"+(e.chat||""),data:{route:e}};case"together":return{title:t+" invited you",body:e.kind==="listen"?"Listen together":"Watch together",tag:"tog:"+(e.chat||""),data:{route:e}};default:return null}}async function d(r="/apps/holo-messenger/holo-sw.js",e=null){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;let t=e?{type:"module",scope:e}:{type:"module"};try{return await navigator.serviceWorker.register(r,t)}catch{try{return await navigator.serviceWorker.register(r,e?{scope:e}:void 0)}catch{return null}}}async function f(r,{vapidPublicKey:e,relayBase:t=null,tag:a}={}){if(!r||!r.pushManager)return{ok:!1,error:"no pushManager"};let n=typeof Notification<"u"?Notification.permission:"denied";if(n==="default")try{n=await Notification.requestPermission()}catch{}if(n!=="granted")return{ok:!1,error:"permission "+n};let i;try{i=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:u(e)})}catch(o){return{ok:!1,error:String(o&&o.message||o)}}let c=t||(typeof location<"u"?location.origin:"");try{await fetch(c+"/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:a,sub:i})})}catch{}return{ok:!0,sub:i}}async function h(r,{relayBase:e=null,tag:t}={}){try{let a=r&&await r.pushManager.getSubscription();if(a){await a.unsubscribe();let n=e||location.origin;await fetch(n+"/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:t,endpoint:a.endpoint})})}}catch{}return{ok:!0}}async function g(r,e){let t=s(e);if(!t||!r)return!1;try{return await r.showNotification(t.title,{body:t.body,tag:t.tag,data:t.data,requireInteraction:!!t.requireInteraction,renotify:!!t.renotify}),!0}catch{return!1}}function y(r){typeof navigator>"u"||!navigator.serviceWorker||navigator.serviceWorker.addEventListener("message",e=>{if(e.data&&e.data.type==="holo-notif-route")try{r(e.data.route)}catch{}})}function u(r){if(!r)return new Uint8Array;let e="=".repeat((4-r.length%4)%4),t=(r+e).replace(/-/g,"+").replace(/_/g,"/"),a=atob(t),n=new Uint8Array(a.length);for(let i=0;i<a.length;i++)n[i]=a.charCodeAt(i);return n}export{y as onRoute,d as registerSW,g as showLocal,f as subscribePush,h as unsubscribePush};
b/601e33fbd2611b55a3bc492b26ee19608103750f3ecdccd6762f51d7aa5895b9 ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import"./chunk-SQE76S5B.js";function x(h,t,e,i){return new(e||(e=Promise))((function(n,s){function r(o){try{a(i.next(o))}catch(c){s(c)}}function l(o){try{a(i.throw(o))}catch(c){s(c)}}function a(o){var c;o.done?n(o.value):(c=o.value,c instanceof e?c:new e((function(p){p(c)}))).then(r,l)}a((i=i.apply(h,t||[])).next())}))}var N=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),i?.once){let n=(...s)=>{this.un(t,n),e(...s)};return this.listeners[t].add(n),()=>this.un(t,n)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach((i=>i(...e)))}},B={decode:function(h,t){return x(this,void 0,void 0,(function*(){let e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(h)}finally{e.close()}}))},createBuffer:function(h,t){if(!h||h.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof h[0]=="number"&&(h=[h]),!h[0]||h[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(i){let n=i[0];if(n.some((s=>s>1||s<-1))){let s=n.length,r=0;for(let l=0;l<s;l++){let a=Math.abs(n[l]);a>r&&(r=a)}for(let l of i)for(let a=0;a<s;a++)l[a]/=r}})(h);let e=h.map((i=>i instanceof Float32Array?i:Float32Array.from(i)));return{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:i=>{let n=e[i];if(!n)throw new Error(`Channel ${i} not found`);return n},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Z(h,t){let e=t.xmlns?document.createElementNS(t.xmlns,h):document.createElement(h);for(let[i,n]of Object.entries(t))if(i==="children"&&n)for(let[s,r]of Object.entries(n))r instanceof Node?e.appendChild(r):typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(Z(s,r));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function U(h,t,e){let i=Z(h,t||{});return e?.appendChild(i),i}function J(h){return h instanceof HTMLElement||typeof h=="object"&&h!==null&&h.nodeType===Node.ELEMENT_NODE&&typeof h.style=="object"}var it=Object.freeze({__proto__:null,createElement:U,default:U,isHTMLElement:J}),nt={fetchBlob:function(h,t,e){return x(this,void 0,void 0,(function*(){var i;let n=yield fetch(h,e);if(n.status>=400)throw new Error(`Failed to fetch ${h}: ${n.status} (${n.statusText})`);return(function(s,r,l){x(this,void 0,void 0,(function*(){var a;if(!s.body||!s.headers)return;let o=s.body.getReader(),c=Number(s.headers.get("Content-Length"))||0,p=0,d=()=>{o.cancel()};if(l){if(l.aborted)return void o.cancel();l.addEventListener("abort",d,{once:!0})}try{for(;;){let m=yield o.read();if(m.done)break;if(p+=((a=m.value)===null||a===void 0?void 0:a.length)||0,c>0){let u=Math.round(p/c*100);r(u)}}}catch(m){if(m instanceof DOMException&&m.name==="AbortError")return;console.warn("Progress tracking error:",m)}finally{l&&l.removeEventListener("abort",d)}}))})(n.clone(),t,(i=e?.signal)!==null&&i!==void 0?i:void 0),n.blob()}))}};function y(h){let t=h,e=new Set;return{get value(){return t},set(i){Object.is(t,i)||(t=i,e.forEach((n=>n(t))))},update(i){this.set(i(t))},subscribe:i=>(e.add(i),()=>e.delete(i))}}function A(h,t){let e=y(h());return t.forEach((i=>i.subscribe((()=>{let n=h();Object.is(e.value,n)||e.set(n)})))),{get value(){return e.value},subscribe:i=>e.subscribe(i)}}function L(h,t){let e,i=()=>{e&&(e(),e=void 0),e=h()},n=t.map((s=>s.subscribe(i)));return i(),()=>{e&&(e(),e=void 0),n.forEach((s=>s()))}}var z=class extends N{get isPlayingSignal(){return this._isPlaying}get currentTimeSignal(){return this._currentTime}get durationSignal(){return this._duration}get volumeSignal(){return this._volume}get mutedSignal(){return this._muted}get playbackRateSignal(){return this._playbackRate}get seekingSignal(){return this._seeking}constructor(t){super(),this.isExternalMedia=!1,this._ownBlobUrl=null,this.reactiveMediaEventCleanups=[],t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),this._isPlaying=y(!1),this._currentTime=y(0),this._duration=y(0),this._volume=y(this.media.volume),this._muted=y(this.media.muted),this._playbackRate=y(this.media.playbackRate||1),this._seeking=y(!1),this.setupReactiveMediaEvents(),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",(()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)}),{once:!0})}setupReactiveMediaEvents(){this.reactiveMediaEventCleanups.push(this.onMediaEvent("play",(()=>{this._isPlaying.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("pause",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ended",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("timeupdate",(()=>{this._currentTime.set(this.media.currentTime)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("durationchange",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("loadedmetadata",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeking",(()=>{this._seeking.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeked",(()=>{this._seeking.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("volumechange",(()=>{this._volume.set(this.media.volume),this._muted.set(this.media.muted)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ratechange",(()=>{this._playbackRate.set(this.media.playbackRate)})))}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){this._ownBlobUrl&&(URL.revokeObjectURL(this._ownBlobUrl),this._ownBlobUrl=null)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){let i=this.getSrc();if(t&&i===t)return;this.revokeSrc();let n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(n!==t&&(this._ownBlobUrl=n),i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch{this.media.src=t}}destroy(){this.reactiveMediaEventCleanups.forEach((t=>t())),this.reactiveMediaEventCleanups=[],this.revokeSrc(),this.unAll(),this.isExternalMedia||(this.media.pause(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.reactiveMediaEventCleanups.forEach((e=>e())),this.reactiveMediaEventCleanups=[],this.media=t,this.setupReactiveMediaEvents()}play(){return x(this,void 0,void 0,(function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}};function st({maxTop:h,maxBottom:t,halfHeight:e,vScale:i,barMinHeight:n=0,barAlign:s}){let r=Math.round(h*e*i),l=r+Math.round(t*e*i)||1;return l<n&&(l=n,s||(r=l/2)),{topHeight:r,totalHeight:l}}function rt({barAlign:h,halfHeight:t,topHeight:e,totalHeight:i,canvasHeight:n}){return h==="top"?0:h==="bottom"?n-i:t-e}function q(h,t,e){let i=t-h.left,n=e-h.top;return[i/h.width,n/h.height]}function K(h){return!!(h.barWidth||h.barGap||h.barAlign)}function G(h,t){if(!K(t))return h;let e=t.barWidth||.5,i=e+(t.barGap||e/2);return i===0?h:Math.floor(h/i)*i}function Y({scrollLeft:h,totalWidth:t,numCanvases:e}){if(t===0)return[0];let i=h/t,n=Math.floor(i*e);return[n-1,n,n+1]}function Q(h){let t=h._cleanup;typeof t=="function"&&t()}function ot(h){let t=y({scrollLeft:h.scrollLeft,scrollWidth:h.scrollWidth,clientWidth:h.clientWidth}),e=A((()=>(function(s){let{scrollLeft:r,scrollWidth:l,clientWidth:a}=s;if(l===0)return{startX:0,endX:1};let o=r/l,c=(r+a)/l;return{startX:Math.max(0,Math.min(1,o)),endX:Math.max(0,Math.min(1,c))}})(t.value)),[t]),i=A((()=>(function(s){return{left:s.scrollLeft,right:s.scrollLeft+s.clientWidth}})(t.value)),[t]),n=()=>{t.set({scrollLeft:h.scrollLeft,scrollWidth:h.scrollWidth,clientWidth:h.clientWidth})};return h.addEventListener("scroll",n,{passive:!0}),{scrollData:t,percentages:e,bounds:i,cleanup:()=>{h.removeEventListener("scroll",n),Q(t)}}}var $=class extends N{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragStream=null,this.scrollStream=null,this.containerInlinePadding=0,this.onClickWrapper=r=>{let l=this.wrapper.getBoundingClientRect(),[a,o]=q(l,r.clientX,r.clientY);this.emit("click",a,o)},this.onDblClickWrapper=r=>{let l=this.wrapper.getBoundingClientRect(),[a,o]=q(l,r.clientX,r.clientY);this.emit("dblclick",a,o)},this.subscriptions=[],this.options=t;let i=this.parentFromOptionsContainer(t.container);this.parent=i;let[n,s]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=s.querySelector(".scroll"),this.wrapper=s.querySelector(".wrapper"),this.canvasWrapper=s.querySelector(".canvases"),this.progressWrapper=s.querySelector(".progress"),this.cursor=s.querySelector(".cursor"),this.calculateInlinePadding(),e&&s.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):J(t)&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){this.wrapper.addEventListener("click",this.onClickWrapper),this.wrapper.addEventListener("dblclick",this.onDblClickWrapper),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollStream=ot(this.scrollContainer);let t=L((()=>{let{startX:e,endX:i}=this.scrollStream.percentages.value,{left:n,right:s}=this.scrollStream.bounds.value;this.emit("scroll",e,i,n,s)}),[this.scrollStream.percentages,this.scrollStream.bounds]);if(this.subscriptions.push(t),typeof ResizeObserver=="function"){let e=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{e().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){let t=this.parent.clientWidth;this.calculateInlinePadding(),t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){if(this.dragStream)return;this.dragStream=(function(e,i={}){let{threshold:n=3,mouseButton:s=0,touchDelay:r=100}=i,l=y(null),a=new Map,o=matchMedia("(pointer: coarse)").matches,c=()=>{},p=d=>{if(d.button!==s||a.has(d.pointerId)||(a.set(d.pointerId,d),a.size>1))return;let m=d.pointerId,u=d.clientX,g=d.clientY,f=!1,E=Date.now(),k=e.getBoundingClientRect(),{left:M,top:C}=k,P=b=>{if(b.pointerId!==m||b.defaultPrevented||a.size>1||o&&Date.now()-E<r)return;let T=b.clientX,D=b.clientY,_=T-u,v=D-g;(f||Math.abs(_)>n||Math.abs(v)>n)&&(b.preventDefault(),b.stopPropagation(),f||(l.set({type:"start",x:u-M,y:g-C}),f=!0),l.set({type:"move",x:T-M,y:D-C,deltaX:_,deltaY:v}),u=T,g=D)},S=b=>{if(a.delete(b.pointerId)){if(b.pointerId===m&&f){let T=b.clientX,D=b.clientY;l.set({type:"end",x:T-M,y:D-C})}a.size===0&&c()}},w=b=>{b.relatedTarget&&b.relatedTarget!==document.documentElement||S(b)},R=b=>{f&&(b.stopPropagation(),b.preventDefault())},W=b=>{b.defaultPrevented||a.size>1||f&&b.preventDefault()};document.addEventListener("pointermove",P),document.addEventListener("pointerup",S),document.addEventListener("pointerout",w),document.addEventListener("pointercancel",w),document.addEventListener("touchmove",W,{passive:!1}),document.addEventListener("click",R,{capture:!0}),c=()=>{document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",w),document.removeEventListener("pointercancel",w),document.removeEventListener("touchmove",W),setTimeout((()=>{document.removeEventListener("click",R,{capture:!0})}),10)}};return e.addEventListener("pointerdown",p),{signal:l,cleanup:()=>{c(),e.removeEventListener("pointerdown",p),a.clear(),Q(l)}}})(this.wrapper);let t=L((()=>{let e=this.dragStream.signal.value;if(!e)return;let i=this.wrapper.getBoundingClientRect().width,n=(s=e.x/i)<0?0:s>1?1:s;var s;e.type==="start"?(this.isDragging=!0,this.emit("dragstart",n)):e.type==="move"?this.emit("drag",n):e.type==="end"&&(this.isDragging=!1,this.emit("dragend",n))}),[this.dragStream.signal]);this.subscriptions.push(t)}calculateInlinePadding(){let{paddingLeft:t,paddingRight:e}=getComputedStyle(this.scrollContainer),i=parseFloat(t)+parseFloat(e);this.containerInlinePadding=Number.isNaN(i)?0:i}initHtml(){let t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
2
+ <style${i?` nonce="${i}"`:""}>
3
+ :host {
4
+ user-select: none;
5
+ min-width: 1px;
6
+ }
7
+ :host audio {
8
+ display: block;
9
+ width: 100%;
10
+ }
11
+ :host .scroll {
12
+ overflow-x: auto;
13
+ overflow-y: hidden;
14
+ width: 100%;
15
+ position: relative;
16
+ }
17
+ :host .noScrollbar {
18
+ scrollbar-color: transparent;
19
+ scrollbar-width: none;
20
+ }
21
+ :host .noScrollbar::-webkit-scrollbar {
22
+ display: none;
23
+ -webkit-appearance: none;
24
+ }
25
+ :host .wrapper {
26
+ position: relative;
27
+ overflow: visible;
28
+ z-index: 2;
29
+ }
30
+ :host .canvases {
31
+ min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;
32
+ pointer-events: none;
33
+ }
34
+ :host .canvases > div {
35
+ position: relative;
36
+ }
37
+ :host canvas {
38
+ display: block;
39
+ position: absolute;
40
+ top: 0;
41
+ image-rendering: pixelated;
42
+ }
43
+ :host .progress {
44
+ pointer-events: none;
45
+ position: absolute;
46
+ z-index: 2;
47
+ top: 0;
48
+ left: 0;
49
+ width: 0;
50
+ height: 100%;
51
+ overflow: hidden;
52
+ }
53
+ :host .progress > div {
54
+ position: relative;
55
+ }
56
+ :host .cursor {
57
+ pointer-events: none;
58
+ position: absolute;
59
+ z-index: 5;
60
+ top: 0;
61
+ left: 0;
62
+ height: 100%;
63
+ border-radius: 2px;
64
+ }
65
+ </style>
66
+
67
+ <div class="scroll" part="scroll">
68
+ <div class="wrapper" part="wrapper">
69
+ <div class="canvases" part="canvases"></div>
70
+ <div class="progress" part="progress"></div>
71
+ <div class="cursor" part="cursor"></div>
72
+ </div>
73
+ </div>
74
+ `,[t,e]}setOptions(t){var e;if(this.options.container!==t.container){let i=this.parentFromOptionsContainer(t.container);i.appendChild(this.container),this.parent=i}t.dragToSeek===!0||typeof this.options.dragToSeek=="object"?this.initDrag():((e=this.dragStream)===null||e===void 0||e.cleanup(),this.dragStream=null),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth-this.containerInlinePadding}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){let{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t;this.wrapper.removeEventListener("click",this.onClickWrapper),this.wrapper.removeEventListener("dblclick",this.onDblClickWrapper),this.timeouts.forEach((e=>e())),this.timeouts=[],this.subscriptions.forEach((e=>e())),this.container.remove(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),(t=this.unsubscribeOnScroll)===null||t===void 0||t.forEach((e=>e())),this.unsubscribeOnScroll=[],this.dragStream&&(this.dragStream.cleanup(),this.dragStream=null),this.scrollStream&&(this.scrollStream.cleanup(),this.scrollStream=null)}createDelay(t=10){let e,i,n=()=>{e&&(clearTimeout(e),e=void 0),i&&(i(),i=void 0)};return this.timeouts.push(n),()=>new Promise(((s,r)=>{n(),i=r,e=setTimeout((()=>{e=void 0,i=void 0,s()}),t)}))}getHeight(t,e){var i;let n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;return(function({optionsHeight:s,optionsSplitChannels:r,parentHeight:l,numberOfChannels:a,defaultHeight:o=128}){if(s==null)return o;let c=Number(s);if(!isNaN(c))return c;if(s==="auto"){let p=l||o;return r?.every((d=>!d.overlay))?p/a:p}return o})({optionsHeight:t,optionsSplitChannels:e,parentHeight:this.parent.clientHeight,numberOfChannels:n,defaultHeight:128})}convertColorValues(t,e){return(function(i,n,s){if(!Array.isArray(i))return i||"";if(i.length===0)return"#999";if(i.length<2)return i[0]||"";let r=document.createElement("canvas"),l=r.getContext("2d");if(!l)return i[0]||"";let a=s||r.height*n,o=l.createLinearGradient(0,0,0,a),c=1/(i.length-1);return i.forEach(((p,d)=>{o.addColorStop(d*c,p)})),o})(t,this.getPixelRatio(),e?.canvas.height)}getPixelRatio(){return t=window.devicePixelRatio,Math.max(1,t||1);var t}renderBarWaveform(t,e,i,n){let{width:s,height:r}=i.canvas,{halfHeight:l,barWidth:a,barRadius:o,barIndexScale:c,barSpacing:p,barMinHeight:d}=(function({width:u,height:g,length:f,options:E,pixelRatio:k}){let M=g/2,C=E.barWidth?E.barWidth*k:1,P=E.barGap?E.barGap*k:E.barWidth?C/2:0,S=C+P||1;return{halfHeight:M,barWidth:C,barGap:P,barRadius:E.barRadius||0,barMinHeight:E.barMinHeight?E.barMinHeight*k:0,barIndexScale:f>0?u/S/f:0,barSpacing:S}})({width:s,height:r,length:(t[0]||[]).length,options:e,pixelRatio:this.getPixelRatio()}),m=(function({channelData:u,barIndexScale:g,barSpacing:f,barWidth:E,halfHeight:k,vScale:M,canvasHeight:C,barAlign:P,barMinHeight:S}){let w=u[0]||[],R=u[1]||w,W=w.length,b=[],T=0,D=0,_=0;for(let v=0;v<=W;v++){let O=Math.round(v*g);if(O>T){let{topHeight:tt,totalHeight:X}=st({maxTop:D,maxBottom:_,halfHeight:k,vScale:M,barMinHeight:S,barAlign:P}),et=rt({barAlign:P,halfHeight:k,topHeight:tt,totalHeight:X,canvasHeight:C});b.push({x:T*f,y:et,width:E,height:X}),T=O,D=0,_=0}let F=Math.abs(w[v]||0),V=Math.abs(R[v]||0);F>D&&(D=F),V>_&&(_=V)}return b})({channelData:t,barIndexScale:c,barSpacing:p,barWidth:a,halfHeight:l,vScale:n,canvasHeight:r,barAlign:e.barAlign,barMinHeight:d});i.beginPath();for(let u of m)o&&"roundRect"in i?i.roundRect(u.x,u.y,u.width,u.height,o):i.rect(u.x,u.y,u.width,u.height);i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){let{width:s,height:r}=i.canvas,l=(function({channelData:a,width:o,height:c,vScale:p}){let d=c/2,m=a[0]||[];return[m,a[1]||m].map(((u,g)=>{let f=u.length,E=f?o/f:0,k=d,M=g===0?-1:1,C=[{x:0,y:k}],P=0,S=0;for(let w=0;w<=f;w++){let R=Math.round(w*E);if(R>P){let b=k+(Math.round(S*d*p)||1)*M;C.push({x:P,y:b}),P=R,S=0}let W=Math.abs(u[w]||0);W>S&&(S=W)}return C.push({x:P,y:k}),C}))})({channelData:t,width:s,height:r,vScale:n});i.beginPath();for(let a of l)if(a.length){i.moveTo(a[0].x,a[0].y);for(let o=1;o<a.length;o++){let c=a[o];i.lineTo(c.x,c.y)}}i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor,i),e.renderFunction)return void e.renderFunction(t,i);let n=(function({channelData:s,barHeight:r,normalize:l,maxPeak:a}){var o;let c=r||1;if(!l)return c;let p=s[0];if(!p||p.length===0)return c;let d=a??0;if(!a)for(let m=0;m<p.length;m++){let u=(o=p[m])!==null&&o!==void 0?o:0,g=Math.abs(u);g>d&&(d=g)}return d?c/d:c})({channelData:t,barHeight:e.barHeight,normalize:e.normalize,maxPeak:e.maxPeak});K(e)?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,s,r,l){let a=this.getPixelRatio(),o=document.createElement("canvas");o.width=Math.round(i*a),o.height=Math.round(n*a),o.style.width=`${i}px`,o.style.height=`${n}px`,o.style.left=`${Math.round(s)}px`,r.appendChild(o);let c=o.getContext("2d");if(e.renderFunction?(c.fillStyle=this.convertColorValues(e.waveColor,c),e.renderFunction(t,c)):this.renderWaveform(t,e,c),o.width>0&&o.height>0){let p=o.cloneNode(),d=p.getContext("2d");d.drawImage(o,0,0),d.globalCompositeOperation="source-in",d.fillStyle=this.convertColorValues(e.progressColor,d),d.fillRect(0,0,o.width,o.height),l.appendChild(p)}}renderMultiCanvas(t,e,i,n,s,r){let l=this.getPixelRatio(),{clientWidth:a}=this.scrollContainer,o=i/l,c=(function({clientWidth:u,totalWidth:g,options:f}){return G(Math.min(8e3,u,g),f)})({clientWidth:a,totalWidth:o,options:e}),p={};if(c===0)return;let d=u=>{if(u<0||u>=m||p[u])return;p[u]=!0;let g=u*c,f=Math.min(o-g,c);if(f=G(f,e),f<=0)return;let E=(function({channelData:k,offset:M,clampedWidth:C,totalWidth:P}){return k.map((S=>{let w=Math.floor(M/P*S.length),R=Math.floor((M+C)/P*S.length);return S.slice(w,R)}))})({channelData:t,offset:g,clampedWidth:f,totalWidth:o});this.renderSingleCanvas(E,e,f,n,g,s,r)},m=Math.ceil(o/c);if(!this.isScrollable){for(let u=0;u<m;u++)d(u);return}if(Y({scrollLeft:this.scrollContainer.scrollLeft,totalWidth:o,numCanvases:m}).forEach((u=>d(u))),m>1){let u=this.on("scroll",(()=>{let{scrollLeft:g}=this.scrollContainer;Object.keys(p).length>10&&(s.innerHTML="",r.innerHTML="",p={}),Y({scrollLeft:g,totalWidth:o,numCanvases:m}).forEach((f=>d(f)))}));this.unsubscribeOnScroll.push(u)}}renderChannel(t,e,i,n){var{overlay:s}=e,r=(function(c,p){var d={};for(var m in c)Object.prototype.hasOwnProperty.call(c,m)&&p.indexOf(m)<0&&(d[m]=c[m]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function"){var u=0;for(m=Object.getOwnPropertySymbols(c);u<m.length;u++)p.indexOf(m[u])<0&&Object.prototype.propertyIsEnumerable.call(c,m[u])&&(d[m[u]]=c[m[u]])}return d})(e,["overlay"]);let l=document.createElement("div"),a=this.getHeight(r.height,r.splitChannels);l.style.height=`${a}px`,s&&n>0&&(l.style.marginTop=`-${a}px`),this.canvasWrapper.style.minHeight=`${a}px`,this.canvasWrapper.appendChild(l);let o=l.cloneNode();this.progressWrapper.appendChild(o),this.renderMultiCanvas(t,r,i,a,l,o)}render(t){return x(this,void 0,void 0,(function*(){var e;this.timeouts.forEach((o=>o())),this.timeouts=[],this.unsubscribeOnScroll.forEach((o=>o())),this.unsubscribeOnScroll=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);let i=this.getPixelRatio(),n=this.scrollContainer.clientWidth-this.containerInlinePadding,{scrollWidth:s,isScrollable:r,useParentWidth:l,width:a}=(function({duration:o,minPxPerSec:c=0,parentWidth:p,fillParent:d,pixelRatio:m}){let u=Math.ceil(o*c),g=u>p,f=!!(d&&!g);return{scrollWidth:u,isScrollable:g,useParentWidth:f,width:(f?p:u)*m}})({duration:t.duration,minPxPerSec:this.options.minPxPerSec||0,parentWidth:n,fillParent:this.options.fillParent,pixelRatio:i});if(this.isScrollable=r,this.wrapper.style.width=l?"100%":`${s}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let o=0;o<t.numberOfChannels;o++){let c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[o]);this.renderChannel([t.getChannelData(o)],c,a,o)}else{let o=[t.getChannelData(0)];t.numberOfChannels>1&&o.push(t.getChannelData(1)),this.renderChannel(o,this.options,a,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){if(this.unsubscribeOnScroll.forEach((i=>i())),this.unsubscribeOnScroll=[],!this.audioData)return;let{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),!this.isScrollable&&this.scrollContainer.scrollLeft)this.scrollContainer.scrollLeft=0;else if(this.isScrollable&&t!==this.scrollContainer.scrollWidth){let{right:i}=this.progressWrapper.getBoundingClientRect(),n=(function(s){let r=2*s;return(r<0?Math.floor(r):Math.ceil(r))/2})(i-e);this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){var i;let{scrollLeft:n,scrollWidth:s,clientWidth:r}=this.scrollContainer,l=t*s,a=n,o=n+r,c=r/2;if(this.isDragging)l+30>o?this.scrollContainer.scrollLeft+=30:l-30<a&&(this.scrollContainer.scrollLeft-=30);else{(l<a||l>o)&&(this.scrollContainer.scrollLeft=l-(this.options.autoCenter?c:0));let p=l-n-c;if(e&&this.options.autoCenter&&p>0){let d=(i=this.audioData)===null||i===void 0?void 0:i.duration;if(d===void 0||d<=0)return void(this.scrollContainer.scrollLeft+=p);let m=s/d;this.scrollContainer.scrollLeft+=m<=600?Math.min(p,10):p}}}renderProgress(t,e){if(isNaN(t))return;let i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.audioData&&this.audioData.duration>0&&this.scrollIntoView(t,e)}exportImage(t,e,i){return x(this,void 0,void 0,(function*(){let n=this.canvasWrapper.querySelectorAll("canvas");if(!n.length)throw new Error("No waveform data");if(i==="dataURL"){let s=Array.from(n).map((r=>r.toDataURL(t,e)));return Promise.resolve(s)}return Promise.all(Array.from(n).map((s=>new Promise(((r,l)=>{s.toBlob((a=>{a?r(a):l(new Error("Could not export image"))}),t,e)})))))}))}},j=class extends N{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;let t=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(t))};t()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop(),this.unAll()}},H=class extends N{constructor(t){super(),this.bufferNode=null,this.playStartTime=0,this.playbackPosition=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this._destroyed=!1,(function(){let e=globalThis.navigator;if(e?.audioSession)try{e.audioSession.type="playback"}catch(i){console.warn("Setting navigator.audioSession.type failed:",i)}})(),this.audioContext=t||new AudioContext,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return x(this,void 0,void 0,(function*(){}))}remove(){this.destroy()}destroy(){if(!this._destroyed){if(this._destroyed=!0,this.currentSrc="",this.bufferNode){this.bufferNode.onended=null;try{this.bufferNode.stop()}catch{}this.bufferNode.disconnect(),this.bufferNode=null}this.gainNode.disconnect(),typeof this.audioContext.close=="function"&&Promise.resolve(this.audioContext.close.call(this.audioContext)).catch((()=>{})),this.buffer=null,this.unAll()}}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then((e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()})).then((e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e))).then((e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})).catch((e=>{console.error("WebAudioPlayer load error:",e)}))}_play(){if(!this.paused)return;this.paused=!1,this.bufferNode&&(this.bufferNode.onended=null,this.bufferNode.disconnect()),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playbackPosition;(t>=this.duration||t<0)&&(t=0,this.playbackPosition=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{!this.paused&&this.duration-this.currentTime<.01&&(this.pause(),this.emit("ended"))}}_pause(){if(this.paused=!0,this.bufferNode){this.bufferNode.onended=null;try{this.bufferNode.stop()}catch{}}this.playbackPosition+=(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}play(){return x(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){let e=(t-this.currentTime)/this._playbackRate,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",(()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause(),this.playbackPosition=Math.min(t,this.duration),this.emit("timeupdate"))}),{once:!0})}setSinkId(t){return x(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){let e=!this.paused;e&&this._pause(),this._playbackRate=t,e&&this._play(),this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return this.paused?this.playbackPosition:this.playbackPosition+(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}set currentTime(t){let e=!this.paused;e&&this._pause(),this.playbackPosition=t,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){let t=[];if(!this.buffer)return t;let e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}removeAttribute(t){switch(t){case"src":this.src="";break;case"playbackRate":this.playbackRate=0;break;case"currentTime":this.currentTime=0;break;case"duration":this.duration=0;break;case"volume":this.volume=0;break;case"muted":this.muted=!1}}},at={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3},I=class h extends z{static create(t){return new h(t)}getState(){return this.wavesurferState}getRenderer(){return this.renderer}constructor(t){let e=t.media||(t.backend==="WebAudio"?new H:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this._isDestroyed=!1,this._loadVersion=0,this.reactiveCleanups=[],this.options=Object.assign({},at,t);let{state:i,actions:n}=(function(l){var a,o,c,p,d,m;let u=(a=l?.currentTime)!==null&&a!==void 0?a:y(0),g=(o=l?.duration)!==null&&o!==void 0?o:y(0),f=(c=l?.isPlaying)!==null&&c!==void 0?c:y(!1),E=(p=l?.isSeeking)!==null&&p!==void 0?p:y(!1),k=(d=l?.volume)!==null&&d!==void 0?d:y(1),M=(m=l?.playbackRate)!==null&&m!==void 0?m:y(1),C=y(null),P=y(null),S=y(""),w=y(0),R=y(0),W=A((()=>!f.value),[f]),b=A((()=>C.value!==null),[C]),T=A((()=>b.value&&g.value>0),[b,g]),D=A((()=>u.value),[u]),_=A((()=>g.value>0?u.value/g.value:0),[u,g]);return{state:{currentTime:u,duration:g,isPlaying:f,isPaused:W,isSeeking:E,volume:k,playbackRate:M,audioBuffer:C,peaks:P,url:S,zoom:w,scrollPosition:R,canPlay:b,isReady:T,progress:D,progressPercent:_},actions:{setCurrentTime:v=>{let O=Math.max(0,Math.min(g.value||1/0,v));u.set(O)},setDuration:v=>{g.set(Math.max(0,v))},setPlaying:v=>{f.set(v)},setSeeking:v=>{E.set(v)},setVolume:v=>{let O=Math.max(0,Math.min(1,v));k.set(O)},setPlaybackRate:v=>{let O=Math.max(.1,Math.min(16,v));M.set(O)},setAudioBuffer:v=>{C.set(v),v&&g.set(v.duration)},setPeaks:v=>{P.set(v)},setUrl:v=>{S.set(v)},setZoom:v=>{w.set(Math.max(0,v))},setScrollPosition:v=>{R.set(Math.max(0,v))}}}})({isPlaying:this.isPlayingSignal,currentTime:this.currentTimeSignal,duration:this.durationSignal,volume:this.volumeSignal,playbackRate:this.playbackRateSignal,isSeeking:this.seekingSignal});this.wavesurferState=i,this.wavesurferActions=n,this.timer=new j;let s=e?void 0:this.getMediaElement();this.renderer=new $(this.options,s),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initReactiveState(),this.initPlugins();let r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");let{peaks:l,duration:a}=this.options;(r||l&&a)&&this.load(r,l,a).catch((()=>{}))}))}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){let t=this.updateProgress();if(this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition){let e=this.stopAtPosition;this.pause(),this.setTime(e)}}})))}initReactiveState(){this.reactiveCleanups.push((function(t,e){let i=[];i.push(L((()=>{let r=t.isPlaying.value;e.emit(r?"play":"pause")}),[t.isPlaying])),i.push(L((()=>{let r=t.currentTime.value;e.emit("timeupdate",r),t.isPlaying.value&&e.emit("audioprocess",r)}),[t.currentTime,t.isPlaying])),i.push(L((()=>{t.isSeeking.value&&e.emit("seeking",t.currentTime.value)}),[t.isSeeking,t.currentTime]));let n=!1;i.push(L((()=>{t.isReady.value&&!n&&(n=!0,e.emit("ready",t.duration.value))}),[t.isReady,t.duration])),i.push(L((()=>{t.audioBuffer.value===null&&(n=!1)}),[t.audioBuffer]));let s=!1;return i.push(L((()=>{let r=t.isPlaying.value,l=t.currentTime.value,a=t.duration.value,o=a>0&&l>=a;s&&!r&&o&&e.emit("finish"),s=r&&o}),[t.isPlaying,t.currentTime,t.duration])),i.push(L((()=>{let r=t.zoom.value;r>0&&e.emit("zoom",r)}),[t.zoom])),()=>{i.forEach((r=>r()))}})(this.wavesurferState,{emit:this.emit.bind(this)}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{let t=this.updateProgress();this.emit("timeupdate",t)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("emptied",(()=>{this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("ended",(()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})),this.onMediaEvent("error",(()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))})),this.renderer.on("dblclick",((t,e)=>{this.emit("dblclick",t,e)})),this.renderer.on("scroll",((t,e,i,n)=>{let s=this.getDuration();this.emit("scroll",t*s,e*s,i,n)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(t=>{this.emit("dragstart",t)})),this.renderer.on("dragend",(t=>{this.emit("dragend",t)})),this.renderer.on("resize",(()=>{this.emit("resize")})));{let t,e=this.renderer.on("drag",(i=>{var n;if(!this.options.interact)return;this.renderer.renderProgress(i),clearTimeout(t);let s=0,r=this.options.dragToSeek;this.isPlaying()?s=0:r===!0?s=200:r&&typeof r=="object"&&(s=(n=r.debounceTime)!==null&&n!==void 0?n:200),t=setTimeout((()=>{this.seekTo(i)}),s),this.emit("interaction",i*this.getDuration()),this.emit("drag",i)}));this.subscriptions.push((()=>{clearTimeout(t),e()}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((t=>t())),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=B.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=B.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);let e=t.once("destroy",(()=>{this.plugins=this.plugins.filter((i=>i!==t)),this.subscriptions=this.subscriptions.filter((i=>i!==e))}));return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter((e=>e!==t)),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){let e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return x(this,void 0,void 0,(function*(){var s;let r=++this._loadVersion;if(this._isDestroyed=!1,this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,(s=this.abortController)===null||s===void 0||s.abort(),this.abortController=null,!e&&!i){let a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=this.abortController.signal);let o=p=>this.emit("loading",p);if(e=yield nt.fetchBlob(t,o,a),this._isDestroyed||r!==this._loadVersion)return;let c=this.options.blobMimeType;c&&(e=new Blob([e],{type:c}))}if(this._isDestroyed||r!==this._loadVersion)return;this.setSrc(t,e);let l=yield new Promise((a=>{let o=n||this.getDuration();o?a(o):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>a(this.getDuration())),{once:!0}))}));if(!this._isDestroyed&&r===this._loadVersion){if(!t&&!e){let a=this.getMediaElement();a instanceof H&&(a.duration=l)}if(i)this.decodedData=B.createBuffer(i,l||0);else if(e){let a=yield e.arrayBuffer();if(this._isDestroyed||r!==this._loadVersion)return;this.decodedData=yield B.decode(a,this.options.sampleRate)}this._isDestroyed||r!==this._loadVersion||(this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration()))}}))}load(t,e,i){return x(this,void 0,void 0,(function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(n){throw this.emit("error",n),n}}))}loadBlob(t,e,i){return x(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",t,e,i)}catch(n){throw this.emit("error",n),n}}))}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");let n=Math.min(t,this.decodedData.numberOfChannels),s=[];for(let r=0;r<n;r++){let l=this.decodedData.getChannelData(r),a=[],o=l.length/e;for(let c=0;c<e;c++){let p=l.slice(Math.floor(c*o),Math.ceil((c+1)*o)),d=0;for(let m=0;m<p.length;m++){let u=p[m];Math.abs(u)>Math.abs(d)&&(d=u)}a.push(Math.round(d*i)/i)}s.push(a)}return s}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){let e=this.getDuration()*t;this.setTime(e)}play(t,e){let i=Object.create(null,{play:{get:()=>super.play}});return x(this,void 0,void 0,(function*(){t!=null&&this.setTime(t);let n=yield i.play.call(this);return e!=null&&(this.media instanceof H?this.media.stopAt(e):this.stopAtPosition=e),n}))}playPause(){return x(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return x(this,arguments,void 0,(function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)}))}destroy(){var t;this._isDestroyed=!0,this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.reactiveCleanups.forEach((e=>e())),this.reactiveCleanups=[],this.timer.destroy(),this.renderer.destroy(),super.destroy()}};I.BasePlugin=class extends N{constructor(h){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=h}onInit(){}_init(h){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=h,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((h=>h())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},I.dom=it;export{I as default};
b/63cc9ffcf54592d675a61d973c4a9bcc787f14437c43cd9438e26c89f5120465 ADDED
@@ -0,0 +1 @@
 
 
1
+ function s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(t)));return JSON.parse(n)}var c=["v","kind","amount","asset","fiat","to","toName","from","fromName","memo","created","expires","claimSecret","pub","sig"];function l(e){let t=s(e);if(!Array.isArray(t))return t;let n={};return c.forEach((o,a)=>{t[a]!=null&&(n[o]=t[a])}),n.memo==null&&(n.memo=""),n}async function i(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return[...new Uint8Array(n)].map(o=>o.toString(16).padStart(2,"0")).join("")}var m=i;function r(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}async function u(e,t,n){try{let o=await crypto.subtle.importKey("raw",r(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},o,r(t),new TextEncoder().encode(n))}catch{return!1}}async function y(e){return!e||!e.pub||!e.sig?!1:u(e.pub,e.sig,p(e))}function p(e){let t=[e.v,e.kind,e.amount,e.asset,e.fiat||"",e.to||"",e.toName||"",e.from||"",e.fromName||"",e.memo||"",e.created||"",e.expires||""];return(e.hashlock||e.pub)&&t.push(e.hashlock||"",e.pub||""),t.join("|")}var d={USD:"$",EUR:"\u20AC",GBP:"\xA3"};function w(e){let t=Number(e.amount);return e.fiat?`${d[e.fiat]||""}${t.toFixed(2)}`:`${t%1===0?t:t.toFixed(4).replace(/0+$/,"")} ${e.asset}`}var f=/(https?:\/\/\S*pay-claim\.html#([A-Za-z0-9_-]+))|(holo:\/\/pay\/\S*#([A-Za-z0-9_-]+))/;function h(e){let t=String(e||"").match(f);if(!t)return null;let n=t[2]||t[4],o=t[0];try{let a=l(n);if(a&&a.v===1&&Number(a.amount)>0)return{intent:a,url:o,payload:n}}catch{}return null}export{m as a,y as b,w as c,h as d};
b/65bb37e3cc8e59697064f670603cb7f6363044e0d87a02fe1f6606bbf95ee9d1 ADDED
@@ -0,0 +1 @@
 
 
1
+ function s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(t)));return JSON.parse(n)}var c=["v","kind","amount","asset","fiat","to","toName","from","fromName","memo","created","expires","claimSecret","kappa","hashlock","pub","sig"];function l(e){let t=s(e);if(!Array.isArray(t))return t;let n={};return c.forEach((o,a)=>{t[a]!=null&&(n[o]=t[a])}),n.memo==null&&(n.memo=""),n}async function u(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return[...new Uint8Array(n)].map(o=>o.toString(16).padStart(2,"0")).join("")}var y=u;function r(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}async function i(e,t,n){try{let o=await crypto.subtle.importKey("spki",r(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]);return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},o,r(t),new TextEncoder().encode(n))}catch{return!1}}async function m(e){return!e||!e.pub||!e.sig?!1:i(e.pub,e.sig,p(e))}function p(e){let t=[e.v,e.kind,e.amount,e.asset,e.fiat||"",e.to||"",e.toName||"",e.from||"",e.fromName||"",e.memo||"",e.created||"",e.expires||""];return(e.hashlock||e.pub)&&t.push(e.hashlock||"",e.pub||""),t.join("|")}var d={USD:"$",EUR:"\u20AC",GBP:"\xA3"};function w(e){let t=Number(e.amount);return e.fiat?`${d[e.fiat]||""}${t.toFixed(2)}`:`${t%1===0?t:t.toFixed(4).replace(/0+$/,"")} ${e.asset}`}var f=/(https?:\/\/\S*pay-claim\.html#([A-Za-z0-9_-]+))|(holo:\/\/pay\/\S*#([A-Za-z0-9_-]+))/;function h(e){let t=String(e||"").match(f);if(!t)return null;let n=t[2]||t[4],o=t[0];try{let a=l(n);if(a&&a.v===1&&Number(a.amount)>0)return{intent:a,url:o,payload:n}}catch{}return null}export{y as a,m as b,w as c,h as d};
b/70bf5bace3fe694e3140893ee8fc3f9a6f28f4645f52bc517ec7299c7a8d3fe3 ADDED
@@ -0,0 +1 @@
 
 
1
+ import"./chunk-SQE76S5B.js";function s(r){let e=r||{},t=e.name||"Someone";switch(e.t){case"call":return{title:t+(e.video?" \xB7 video call":" \xB7 calling"),body:"Tap to answer",tag:"call:"+(e.room||e.chat||""),requireInteraction:!0,renotify:!0,data:{route:e}};case"meet":return{title:(e.name||"A room")+" \xB7 meeting",body:"Tap to join",tag:"meet:"+(e.room||e.chat||""),requireInteraction:!0,data:{route:e}};case"pay":return{title:t+(e.kind==="request"?" requests ":" sent you ")+(e.amount||"money"),body:"Tap to open",tag:"pay:"+(e.kappa||e.chat||""),data:{route:e}};case"dm":return{title:t,body:e.sealed?"\u{1F512} New sealed message":e.preview||"New message",tag:"dm:"+(e.chat||""),data:{route:e}};case"bridge":return{title:t,body:e.preview||"New message",tag:"chat:"+(e.chat||""),data:{route:e}};case"together":return{title:t+" invited you",body:e.kind==="listen"?"Listen together":"Watch together",tag:"tog:"+(e.chat||""),data:{route:e}};default:return null}}async function d(r="/apps/holo-messenger/holo-sw.js",e=null){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;let t=e?{type:"module",scope:e}:{type:"module"};try{return await navigator.serviceWorker.register(r,t)}catch{try{return await navigator.serviceWorker.register(r,e?{scope:e}:void 0)}catch{return null}}}async function f(r,{vapidPublicKey:e,relayBase:t=null,tag:a}={}){if(!r||!r.pushManager)return{ok:!1,error:"no pushManager"};let n=typeof Notification<"u"?Notification.permission:"denied";if(n==="default")try{n=await Notification.requestPermission()}catch{}if(n!=="granted")return{ok:!1,error:"permission "+n};let i;try{i=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:u(e)})}catch(o){return{ok:!1,error:String(o&&o.message||o)}}let c=t||(typeof location<"u"?location.origin:"");try{await fetch(c+"/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:a,sub:i})})}catch{}return{ok:!0,sub:i}}async function h(r,{relayBase:e=null,tag:t}={}){try{let a=r&&await r.pushManager.getSubscription();if(a){await a.unsubscribe();let n=e||location.origin;await fetch(n+"/push/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:t,endpoint:a.endpoint})})}}catch{}return{ok:!0}}async function g(r,e){let t=s(e);if(!t||!r)return!1;try{return await r.showNotification(t.title,{body:t.body,tag:t.tag,data:t.data,requireInteraction:!!t.requireInteraction,renotify:!!t.renotify}),!0}catch{return!1}}function y(r){typeof navigator>"u"||!navigator.serviceWorker||navigator.serviceWorker.addEventListener("message",e=>{if(e.data&&e.data.type==="holo-notif-route")try{r(e.data.route)}catch{}})}function u(r){if(!r)return new Uint8Array;let e="=".repeat((4-r.length%4)%4),t=(r+e).replace(/-/g,"+").replace(/_/g,"/"),a=atob(t),n=new Uint8Array(a.length);for(let i=0;i<a.length;i++)n[i]=a.charCodeAt(i);return n}export{y as onRoute,d as registerSW,g as showLocal,f as subscribePush,h as unsubscribePush};
b/8bcad5a3693aeb54491e67e4ff38cd21cde0ae8b8b28bf3baeb4e8299c4909d3 ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as m,b as p}from"./chunk-M7R7W5KI.js";import"./chunk-SQE76S5B.js";var d=new Map;function n(){return{get:e=>d.get(e)||null,set:(e,t)=>d.set(e,t),has:e=>d.has(e)}}function h(e="holo-escrow"){if(typeof localStorage>"u")return n();let t=r=>e+":"+r;return{get:r=>{try{let s=localStorage.getItem(t(r));return s?JSON.parse(s):null}catch{return null}},set:(r,s)=>{try{localStorage.setItem(t(r),JSON.stringify(s))}catch{}},has:r=>{try{return localStorage.getItem(t(r))!=null}catch{return!1}}}}async function y(e,{store:t=null,wallet:r=null,chain:s="base",nowMs:u=null}={}){let o=t||n();if(!e||!e.kappa)return{ok:!1,error:"no payment to fund"};if(!await p(e))return{ok:!1,error:"this payment isn't authentically signed \u2014 refusing to fund"};if(!e.hashlock)return{ok:!1,error:"this payment has no escrow lock"};let c=u||Date.now();if(e.expires&&c>e.expires)return{ok:!1,error:"already expired"};let l=o.get(e.kappa);if(l)return{ok:!0,kappa:e.kappa,mode:l.mode,live:l.mode==="live",tx:l.tx,already:!0};let a=r&&typeof r.htlcFund=="function"?"live":"custodial",f=null;if(a==="live")try{f=await r.htlcFund({chain:s,amount:e.amount,token:e.asset,hashlock:e.hashlock,timeout:e.expires})}catch(i){return{ok:!1,error:String(i&&i.message||i)}}return o.set(e.kappa,{state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,fundedAt:c,mode:a,tx:f,claim:null,refund:null}),{ok:!0,kappa:e.kappa,mode:a,live:a==="live",tx:f}}async function x(e,{claimSecret:t=null,claimerPub:r=null,store:s=null,nowMs:u=null}={}){let o=s||n(),c=u||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};if(!await p(e))return{ok:!1,error:"this link isn't authentically signed"};if(e.expires&&c>e.expires)return{ok:!1,error:"this payment has expired"};let l=t||e.claimSecret;if(!l)return{ok:!1,error:"this link has no claim key"};if(await m(l)!==e.hashlock)return{ok:!1,error:"this claim key doesn't match the payment"};let a=o.get(e.kappa);return a&&a.state!=="open"?{ok:!1,error:a.state==="claimed"?"already claimed":"this payment was returned to the sender"}:(a||(a={state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,mode:"custodial",offDevice:!0,claim:null,refund:null}),a.state!=="open"?{ok:!1,error:"already claimed"}:(a.state="claimed",a.claim={claimerPub:r||null,at:c},o.set(e.kappa,a),{ok:!0,amount:a.amount,asset:a.asset,fiat:a.fiat,mode:a.mode,live:a.mode==="live",offDevice:!!a.offDevice,custodialWallet:"\u03BA:"+e.kappa.slice(0,16)}))}async function g(e,{store:t=null,nowMs:r=null}={}){let s=t||n(),u=r||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};let o=s.get(e.kappa);return o?o.state!=="open"?{ok:!1,error:o.state==="claimed"?"already claimed \u2014 can't refund":"already refunded"}:o.expires&&u>o.expires?(o.state="refunded",o.refund={at:u},s.set(e.kappa,o),{ok:!0,amount:o.amount,asset:o.asset,mode:o.mode}):{ok:!1,error:"not yet expired \u2014 can't refund"}:{ok:!1,error:"no escrow to refund"}}function w(e,{store:t=null}={}){let r=t||n(),s=typeof e=="string"?e:e&&e.kappa;return s?r.get(s)||{state:"none"}:{state:"none"}}export{x as claimEscrow,y as fund,h as localStore,g as refund,w as status};
b/a652a5f1c53016ed312a4ecb6303f4c9f476d4818e0b8493506126564641ced0 ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as d,b as y,c as w,d as k}from"./chunk-3SOENKZH.js";import"./chunk-SQE76S5B.js";function m(e){return["L1",e.type,e.kappa,e.hashlock||"",e.preimage||"",String(e.amount??""),e.asset||"",e.fiat||"",String(e.expires||""),e.by||"",String(e.at||"")].join("|")}async function v(e,{claimSecret:s,signer:a,at:t}){let i={type:"claim",kappa:e.kappa,hashlock:e.hashlock,preimage:s,amount:e.amount,asset:e.asset,fiat:e.fiat||null,expires:e.expires,by:a.pub,at:t};return i.sig=await a.sign(m(i)),i.tid=await d(m(i)),i}async function S(e,{signer:s,at:a}){let t={type:"refund",kappa:e.kappa,expires:e.expires,by:s.pub,at:a};return t.sig=await s.sign(m(t)),t.tid=await d(m(t)),t}async function b(e,s){return!e||!e.type||!e.kappa||!e.by||!e.sig||!await w(e.by,e.sig,m(e))?!1:e.type==="claim"?!(!e.preimage||await d(e.preimage)!==e.hashlock||e.expires&&e.at>e.expires):e.type==="refund"?!!(e.expires&&s>e.expires):!1}async function g(e,s=Date.now()){let a=[];for(let o of e)await b(o,s)&&a.push(o);let t=a.filter(o=>o.type==="claim");if(t.length){t.sort((r,n)=>r.at-n.at||(r.tid<n.tid?-1:r.tid>n.tid?1:0));let o=t[0];return{state:"claimed",winner:o.tid,by:o.by,amount:o.amount,asset:o.asset,fiat:o.fiat}}let i=a.filter(o=>o.type==="refund");return i.length?(i.sort((o,r)=>o.at-r.at||(o.tid<r.tid?-1:1)),{state:"refunded",winner:i[0].tid}):{state:"open"}}function D(e){return e&&e.transitions?Object.values(e.transitions):[]}async function j(e,s,a=Date.now()){e.transitions=e.transitions||{};for(let t of s||[])e.transitions[t.tid]||await b(t,a)&&(e.transitions[t.tid]=t);return e}var x=()=>({funded:!1,mode:"custodial",committed:null,transitions:{}}),h=new Map;function p(){return{get:e=>h.get(e)||null,set:(e,s)=>h.set(e,s),has:e=>h.has(e)}}function C(e="holo-escrow"){if(typeof localStorage>"u")return p();let s=a=>e+":"+a;return{get:a=>{try{let t=localStorage.getItem(s(a));return t?JSON.parse(t):null}catch{return null}},set:(a,t)=>{try{localStorage.setItem(s(a),JSON.stringify(t))}catch{}},has:a=>{try{return localStorage.getItem(s(a))!=null}catch{return!1}}}}async function E(e,{store:s=null,wallet:a=null,chain:t="base",nowMs:i=null}={}){let o=s||p();if(!e||!e.kappa)return{ok:!1,error:"no payment to fund"};if(!await k(e))return{ok:!1,error:"this payment isn't authentically signed, refusing to fund"};if(!e.hashlock)return{ok:!1,error:"this payment has no escrow lock"};let r=i||Date.now();if(e.expires&&r>e.expires)return{ok:!1,error:"already expired"};let n=o.get(e.kappa);if(n&&n.funded)return{ok:!0,kappa:e.kappa,mode:n.mode,live:n.mode==="live",tx:n.tx,already:!0};let c=a&&typeof a.htlcFund=="function"?"live":"custodial",f=null;if(c==="live")try{f=await a.htlcFund({chain:t,amount:e.amount,token:e.asset,hashlock:e.hashlock,timeout:e.expires})}catch(l){return{ok:!1,error:String(l&&l.message||l)}}let u=n||x();return u.funded=!0,u.mode=c,u.tx=f,u.amount=e.amount,u.asset=e.asset,u.fiat=e.fiat||null,u.expires=e.expires,o.set(e.kappa,u),{ok:!0,kappa:e.kappa,mode:c,live:c==="live",tx:f}}async function F(e,{claimSecret:s=null,claimerPub:a=null,claimerSigner:t=null,store:i=null,nowMs:o=null}={}){let r=i||p(),n=o||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};if(!await k(e))return{ok:!1,error:"this link isn't authentically signed"};if(e.expires&&n>e.expires)return{ok:!1,error:"this payment has expired"};let c=s||e.claimSecret;if(!c)return{ok:!1,error:"this link has no claim key"};if(await d(c)!==e.hashlock)return{ok:!1,error:"this claim key doesn't match the payment"};let f=t||await y(),u=await v(e,{claimSecret:c,signer:f,at:n}),l=r.get(e.kappa)||x();l.funded||(l.offDevice=!0);let M=l.committed&&l.committed!==u.tid;return l.transitions[u.tid]=u,l.committed||(l.committed=u.tid),r.set(e.kappa,l),M?{ok:!1,error:"already claimed"}:{ok:!0,amount:e.amount,asset:e.asset,fiat:e.fiat||null,mode:l.mode,live:l.mode==="live",offDevice:!!l.offDevice,tid:u.tid,claimerPub:a||f.pub,custodialWallet:"\u03BA:"+e.kappa.slice(0,16)}}async function J(e,{store:s=null,signer:a=null,nowMs:t=null}={}){let i=s||p(),o=t||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};let r=i.get(e.kappa);if(!r)return{ok:!1,error:"no escrow to refund"};let n=await g(Object.values(r.transitions),o);if(n.state==="claimed")return{ok:!1,error:"already claimed, can't refund"};if(n.state==="refunded")return{ok:!1,error:"already refunded"};if(!(r.expires&&o>r.expires))return{ok:!1,error:"not yet expired, can't refund"};let c=a||await y(),f=await S(e,{signer:c,at:o});return r.transitions[f.tid]=f,i.set(e.kappa,r),{ok:!0,amount:r.amount,asset:r.asset,mode:r.mode}}async function _(e,{store:s=null,nowMs:a=null}={}){let t=s||p(),i=a||Date.now(),o=typeof e=="string"?e:e&&e.kappa;if(!o)return{state:"none"};let r=t.get(o);if(!r)return{state:"none"};let n=await g(Object.values(r.transitions),i);return n.state==="open"?{state:r.funded?"open":"none",committed:r.committed||null,canonicalWinner:null,reconciled:!1}:{state:n.state,canonicalWinner:n.winner,committed:r.committed||null,reconciled:!!(r.committed&&n.state==="claimed"&&r.committed!==n.winner),by:n.by,amount:n.amount,asset:n.asset}}function N(e,{store:s=null}={}){let a=s||p(),t=typeof e=="string"?e:e&&e.kappa,i=a.get(t);return i?D(i):[]}async function L(e,s,{store:a=null,nowMs:t=null}={}){let i=a||p(),o=t||Date.now(),r=typeof e=="string"?e:e&&e.kappa,n=i.get(r)||x();return await j(n,s||[],o),i.set(r,n),_(r,{store:i,nowMs:o})}export{F as claimEscrow,N as exportPeer,E as fund,C as localStore,L as mergePeer,J as refund,_ as status};
b/b2006f3cc081ecc4e0c68571106338d21f40f0fb7449dd549e3a37d74fd3f404 ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as m,b as p}from"./chunk-NX5ZZPMH.js";import"./chunk-SQE76S5B.js";var d=new Map;function n(){return{get:e=>d.get(e)||null,set:(e,t)=>d.set(e,t),has:e=>d.has(e)}}function h(e="holo-escrow"){if(typeof localStorage>"u")return n();let t=r=>e+":"+r;return{get:r=>{try{let s=localStorage.getItem(t(r));return s?JSON.parse(s):null}catch{return null}},set:(r,s)=>{try{localStorage.setItem(t(r),JSON.stringify(s))}catch{}},has:r=>{try{return localStorage.getItem(t(r))!=null}catch{return!1}}}}async function y(e,{store:t=null,wallet:r=null,chain:s="base",nowMs:u=null}={}){let o=t||n();if(!e||!e.kappa)return{ok:!1,error:"no payment to fund"};if(!await p(e))return{ok:!1,error:"this payment isn't authentically signed \u2014 refusing to fund"};if(!e.hashlock)return{ok:!1,error:"this payment has no escrow lock"};let c=u||Date.now();if(e.expires&&c>e.expires)return{ok:!1,error:"already expired"};let l=o.get(e.kappa);if(l)return{ok:!0,kappa:e.kappa,mode:l.mode,live:l.mode==="live",tx:l.tx,already:!0};let a=r&&typeof r.htlcFund=="function"?"live":"custodial",f=null;if(a==="live")try{f=await r.htlcFund({chain:s,amount:e.amount,token:e.asset,hashlock:e.hashlock,timeout:e.expires})}catch(i){return{ok:!1,error:String(i&&i.message||i)}}return o.set(e.kappa,{state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,fundedAt:c,mode:a,tx:f,claim:null,refund:null}),{ok:!0,kappa:e.kappa,mode:a,live:a==="live",tx:f}}async function x(e,{claimSecret:t=null,claimerPub:r=null,store:s=null,nowMs:u=null}={}){let o=s||n(),c=u||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};if(!await p(e))return{ok:!1,error:"this link isn't authentically signed"};if(e.expires&&c>e.expires)return{ok:!1,error:"this payment has expired"};let l=t||e.claimSecret;if(!l)return{ok:!1,error:"this link has no claim key"};if(await m(l)!==e.hashlock)return{ok:!1,error:"this claim key doesn't match the payment"};let a=o.get(e.kappa);return a&&a.state!=="open"?{ok:!1,error:a.state==="claimed"?"already claimed":"this payment was returned to the sender"}:(a||(a={state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,mode:"custodial",offDevice:!0,claim:null,refund:null}),a.state!=="open"?{ok:!1,error:"already claimed"}:(a.state="claimed",a.claim={claimerPub:r||null,at:c},o.set(e.kappa,a),{ok:!0,amount:a.amount,asset:a.asset,fiat:a.fiat,mode:a.mode,live:a.mode==="live",offDevice:!!a.offDevice,custodialWallet:"\u03BA:"+e.kappa.slice(0,16)}))}async function g(e,{store:t=null,nowMs:r=null}={}){let s=t||n(),u=r||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};let o=s.get(e.kappa);return o?o.state!=="open"?{ok:!1,error:o.state==="claimed"?"already claimed \u2014 can't refund":"already refunded"}:o.expires&&u>o.expires?(o.state="refunded",o.refund={at:u},s.set(e.kappa,o),{ok:!0,amount:o.amount,asset:o.asset,mode:o.mode}):{ok:!1,error:"not yet expired \u2014 can't refund"}:{ok:!1,error:"no escrow to refund"}}function w(e,{store:t=null}={}){let r=t||n(),s=typeof e=="string"?e:e&&e.kappa;return s?r.get(s)||{state:"none"}:{state:"none"}}export{x as claimEscrow,y as fund,h as localStore,g as refund,w as status};
b/c4da89c19ffab9307dc7cb0d5f16a07f9f552a0d8c8c6b4b8485ed1e2cf7ad94 ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // holo-messenger-login.mjs — the TEE biometric sign-in gate that fronts the messenger boot.
2
+ //
3
+ // IDENTICAL to the OS native CEF greeter (holo-sddm.js), by construction — it reuses the SAME two
4
+ // modules, not a copy:
5
+ // • holo-webauthn.mjs — the TEE ceremony: native Windows Hello / Touch ID DIRECTLY via
6
+ // window.cefQuery("holo:hello:…") on the native host, auto-falling back to the localhost broker
7
+ // (holo://) then to a direct WebAuthn PLATFORM assertion. The enclave PRF (hmac-secret) derives a
8
+ // high-entropy secret INSIDE the secure element; the private key never leaves it, the secret never
9
+ // leaves the page. (Law L1 · Law L4.)
10
+ // • holo-login.mjs — the sovereign identity: a BIP-39 seed vault whose κ is did:holo:sha256(pubkey)
11
+ // — the SAME store (IndexedDB "holo-login" + OPFS mirror) and SAME κ the OS greeter mints. So a
12
+ // person who signed into the OS and one who opens the messenger share ONE identity, byte-for-byte.
13
+ //
14
+ // Same-page (NO navigation, minimal latency): it paints a full-bleed lock overlay above #root, runs the
15
+ // ceremony, dissolves the glass (unfog), and RESOLVES { principal, operator, secret } — which boot()
16
+ // adopts as its sovereign identity, replacing the old silent device-stable secret. Fail-CLOSED: the
17
+ // messenger never mounts until a principal is established. Guest is an explicit tap (or ?guest=1 for
18
+ // agents / headless), exactly as the OS greeter's guest door.
19
+ //
20
+ // The heavy identity graph (WDK seed vault) and holo-login are lazily imported — during the human's
21
+ // look-and-tap (prewarm) — so the lock paints instantly and the enclave dialog overlaps the vault load.
22
+
23
+ import { teeReason, teeName, teeAssert, teeEnroll, teeError } from "/usr/lib/holo/holo-webauthn.mjs";
24
+
25
+ const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[c]));
26
+ const initials = (n) => (String(n || "").trim().split(/\s+/).map((w) => w[0]).filter(Boolean).slice(0, 2).join("") || "·").toUpperCase();
27
+ const hueOf = (u) => (u && u.avatar && u.avatar.hue != null ? u.avatar.hue : (u && u.hue != null ? u.hue : 210)) | 0;
28
+
29
+ const I = {
30
+ fp: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M5.5 11a6.5 6.5 0 0 1 13 0"/><path d="M8.5 11a3.5 3.5 0 0 1 7 0v2.6"/><path d="M12 11v4.4"/><path d="M8.6 14.2V16"/><path d="M15.4 15.4V18"/></svg>',
31
+ person: '<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="8.4" r="4.1"/><path d="M3.8 20.4a8.2 8.2 0 0 1 16.4 0z"/></svg>',
32
+ ghost: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="3.4"/><path d="M5.5 19a6.5 6.5 0 0 1 13 0"/></svg>',
33
+ arrow: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h13M12 6l6 6-6 6"/></svg>',
34
+ };
35
+
36
+ // avatar HTML — the operator's hue + initials, or a neutral silhouette (first run / guest).
37
+ function avatarHtml(u) {
38
+ if (u && u.label) { const h = hueOf(u); return `<div class="hl-avatar" style="background:linear-gradient(140deg,hsl(${h} 52% 46%),hsl(${h + 26} 52% 46%))">${esc(initials(u.label))}</div>`; }
39
+ return `<div class="hl-avatar" style="background:linear-gradient(140deg,#5b6b86,#3a455c)">${I.person}</div>`;
40
+ }
41
+ const optionsHtml = () => `<button class="hl-alt" id="hl-opts" aria-expanded="false">Sign-in options</button>
42
+ <div class="hl-opts" id="hl-optsrow" hidden><button class="hl-alt" id="hl-optguest">${I.ghost}Guest</button></div>`;
43
+
44
+ // cache a tiny NON-secret greeting hint under the SAME key the OS greeter uses (holo.lastOperator), so a
45
+ // returning operator's name + "It's me" paint at first frame on the next cold open — zero identity load.
46
+ function cacheOperator(u) {
47
+ try { if (u && u.label) localStorage.setItem("holo.lastOperator", JSON.stringify({ label: u.label, hue: hueOf(u), cred: (u.cred != null ? (typeof u.cred === "string" ? true : !!u.cred) : true) })); } catch {}
48
+ }
49
+
50
+ // LATENCY: warm the heavy identity graph (holo-login → WDK seed vault) and the shell bytes DURING the
51
+ // human's look-and-tap, so the enclave dialog overlaps the vault import and post-auth boot is cache-hot.
52
+ // Idempotent + best-effort; touches nothing secret and can't fail the sign-in.
53
+ let _warm = false;
54
+ function prewarm() {
55
+ if (_warm) return; _warm = true;
56
+ try { import("/usr/lib/holo/holo-login.mjs"); } catch {}
57
+ try {
58
+ import("/apps/holo-messenger/holo-m1-boot.mjs")
59
+ .then((m) => { for (const p of (m.SHELL_MANIFEST || [])) { try { fetch(p, { cache: "force-cache" }).catch(() => {}); } catch {} } })
60
+ .catch(() => {});
61
+ } catch {}
62
+ }
63
+
64
+ // ── the overlay: a full-bleed lock above #root (created here if app.html's baseline didn't) ──
65
+ function ensureOverlay() {
66
+ let ov = document.getElementById("holo-login");
67
+ if (ov) return ov;
68
+ ov = document.createElement("div");
69
+ ov.id = "holo-login";
70
+ ov.innerHTML = `<div class="hl-wall"></div><div class="hl-frost"></div><main class="hl-lock"><div class="hl-panel" id="holo-login-panel"></div></main>`;
71
+ document.body.appendChild(ov);
72
+ return ov;
73
+ }
74
+
75
+ // ── panel renderers (pure HTML; wiring is attached by mountLogin) ──
76
+ function renderBusy(panel, msg) {
77
+ panel.innerHTML = `${avatarHtml(null)}<h1 class="hl-name">Welcome</h1><div class="hl-auth"><div class="status"><span class="spin"></span><span>${esc(msg || "")}</span></div></div>`;
78
+ }
79
+ function renderReturning(panel, u) {
80
+ panel.innerHTML = `${avatarHtml(u)}<h1 class="hl-name">${esc(u.label || "You")}</h1>
81
+ <div class="hl-auth"><button class="hl-bio" id="hl-bio">${I.fp}It’s me</button>${optionsHtml()}<div class="status"></div></div>`;
82
+ }
83
+ function renderFirstRun(panel) {
84
+ panel.innerHTML = `${avatarHtml(null)}<h1 class="hl-name">Welcome</h1>
85
+ <div class="hl-auth"><button class="hl-bio" id="hl-signin" title="Sign in — one tap, nothing to set up">${I.fp}Sign in</button>${optionsHtml()}<div class="status"></div></div>`;
86
+ }
87
+ function renderNoBio(panel, u, reason) {
88
+ panel.innerHTML = `${avatarHtml(u)}<h1 class="hl-name">${esc((u && u.label) || "Welcome")}</h1>
89
+ <div class="hl-auth"><button class="hl-bio" id="hl-guest">${I.ghost}Continue as Guest</button>
90
+ <div class="status">${esc(reason || "No device biometric here")}</div></div>`;
91
+ }
92
+
93
+ // mountLogin({ root, params }) → Promise<{ principal, operator, secret }>. Resolves ONLY once a principal
94
+ // is established (TEE unlock/enrol, or an explicit Guest). boot() adopts the result as its identity.
95
+ export async function mountLogin({ root, params } = {}) {
96
+ params = params || new URLSearchParams(location.search);
97
+ const overlay = ensureOverlay();
98
+ const panel = document.getElementById("holo-login-panel");
99
+ const statusEl = () => panel.querySelector(".status");
100
+ const setStatus = (t, err) => { const el = statusEl(); if (el) { el.className = "status" + (err ? " err" : ""); el.textContent = t || ""; } };
101
+ const setBusy = (m) => { const el = statusEl(); if (el) { el.className = "status"; el.innerHTML = `<span class="spin"></span><span>${esc(m || "")}</span>`; } };
102
+
103
+ return new Promise(async (resolve) => {
104
+ const done = (auth) => {
105
+ // AUTH ⊗ REVEAL, one motion: dissolve the frost + lift the panel (unfog), then resolve so boot()
106
+ // paints the messenger under the clearing glass — no seam, no second screen.
107
+ overlay.classList.add("unfog");
108
+ setTimeout(() => { try { overlay.remove(); } catch {} }, 720);
109
+ resolve(auth);
110
+ };
111
+
112
+ // establish (same-page): sign a session token, publish the app-visible presentation (so
113
+ // signedInOperator() and the OS's unified DID see this operator), and — for a real operator — bridge
114
+ // the session-at-rest vault key so the messenger's realm IS the operator's (no second biometric). The
115
+ // PRF secret and the sovereign key never cross to any app-readable store. Then hand boot() the principal.
116
+ const establish = async (principal, secret, guest) => {
117
+ try {
118
+ const id = await import("/usr/lib/holo/holo-identity.mjs");
119
+ const token = await id.openSession(principal, { session: "messenger", next: "/apps/holo-messenger/app.html", host: "", guest: guest || undefined });
120
+ await id.persistSession(token, null); // display-split: presentation only (no secret in app-readable storage)
121
+ } catch {}
122
+ if (secret && !guest) {
123
+ try { const s = await import("/usr/lib/holo/holo-session.mjs"); await s.unlockOperatorKey({ operator: principal.kappa, secret }); } catch {}
124
+ }
125
+ cacheOperator({ label: principal.label, hue: principal.avatar && principal.avatar.hue, cred: true });
126
+ setStatus("Opening your messages…");
127
+ done({ principal, operator: principal.kappa, secret: guest ? null : secret });
128
+ };
129
+
130
+ const guestEnter = async () => {
131
+ renderBusy(panel, "Entering as guest…");
132
+ try { const id = await import("/usr/lib/holo/holo-identity.mjs"); const principal = await id.ephemeral({ label: "Guest" }); await establish(principal, null, true); }
133
+ catch (e) { renderNoBio(panel, null, ""); setStatus("Guest sign-in failed: " + (e && e.message || e), true); const g = panel.querySelector("#hl-guest"); if (g) g.onclick = guestEnter; }
134
+ };
135
+
136
+ // ?guest=1 / ?as=guest — agents + headless verification take the instant ephemeral door (parity with
137
+ // the OS greeter's login.html?guest=1). No biometric, no human, nothing persists.
138
+ if (params.get("guest") === "1" || params.get("as") === "guest") { return guestEnter(); }
139
+
140
+ // discover the enrolment state from holo-login's roster — the SAME store the OS greeter reads/writes.
141
+ let roster = [];
142
+ try { const L = await import("/usr/lib/holo/holo-login.mjs"); roster = await L.roster(); } catch {}
143
+ let reason = ""; try { reason = await teeReason(); } catch (e) { reason = teeError(e); }
144
+ const hasBio = !reason;
145
+ const known = roster.filter((u) => u && u.cred);
146
+ const selected = known[0] || roster[0] || null;
147
+ if (selected) cacheOperator(selected);
148
+
149
+ const wireOptions = () => {
150
+ const opts = panel.querySelector("#hl-opts"), row = panel.querySelector("#hl-optsrow");
151
+ if (opts && row) opts.onclick = () => { row.hidden = !row.hidden; opts.setAttribute("aria-expanded", String(!row.hidden)); };
152
+ const g = panel.querySelector("#hl-optguest"); if (g) g.onclick = guestEnter;
153
+ };
154
+
155
+ // No enclave here (headless / no biometric enrolled): the standalone messenger's way in is Guest —
156
+ // honest about the missing hardware (phone-pairing is an OS-shell affordance, out of scope here).
157
+ if (!hasBio) { renderNoBio(panel, selected, reason); const g = panel.querySelector("#hl-guest"); if (g) g.onclick = guestEnter; return; }
158
+
159
+ // FIRST RUN — no sovereign identity with a biometric on this device yet: one tap enrols a κ bound to
160
+ // this device's enclave (default label "You"), then straight in. Identical to the OS greeter's firstRun.
161
+ if (!selected || !selected.cred) {
162
+ renderFirstRun(panel);
163
+ prewarm();
164
+ const si = panel.querySelector("#hl-signin");
165
+ if (si) si.onclick = async () => {
166
+ si.disabled = true;
167
+ try {
168
+ setBusy("Setting up " + teeName() + "…");
169
+ const { credentialId, secret, credPub } = await teeEnroll({ name: "Holo Messenger" });
170
+ const L = await import("/usr/lib/holo/holo-login.mjs");
171
+ const { principal } = await L.enroll({ label: "You", secret, cred: credentialId, credPub }); // TEE-wrapped seed vault → sovereign κ
172
+ await establish(principal, secret, false);
173
+ } catch (e) { si.disabled = false; setStatus(teeError(e), true); }
174
+ };
175
+ wireOptions();
176
+ setTimeout(() => { try { panel.querySelector("#hl-signin").focus(); } catch {} }, 40);
177
+ return;
178
+ }
179
+
180
+ // RETURNING OPERATOR — their name above one biometric tap. teeAssert offers the enrolled credentials
181
+ // (usernameless), the verified passkey maps to its κ, and unlock() RE-DERIVES that κ from the vault
182
+ // (Law L5) — the identical path holo-sddm.unlockDevice() runs.
183
+ renderReturning(panel, selected);
184
+ prewarm();
185
+ const bio = panel.querySelector("#hl-bio");
186
+ if (bio) bio.onclick = async () => {
187
+ bio.disabled = true;
188
+ try {
189
+ setBusy("Verifying with " + teeName() + "…");
190
+ const { secret, credentialId } = await teeAssert({ allowCredentials: known.map((k) => k.cred) });
191
+ const op = known.find((k) => k.cred === credentialId) || selected;
192
+ const L = await import("/usr/lib/holo/holo-login.mjs");
193
+ const principal = await L.unlock(op.kappa, secret); // re-derives κ (Law L5); throws on the wrong secret
194
+ await establish(principal, secret, false);
195
+ } catch (e) { bio.disabled = false; setStatus(teeError(e), true); }
196
+ };
197
+ wireOptions();
198
+ setTimeout(() => { try { bio.focus(); } catch {} }, 40);
199
+ });
200
+ }
201
+
202
+ export default mountLogin;
b/d090908e06e8d0a2d3fcc01ce1f608eef8ef2e8ec2038c732a84cbe239d32ab1 ADDED
The diff for this file is too large to render. See raw diff
 
b/e698288da085c0de450f757d77c0d9603716d5f86fd8c3a5d8cb3762e8c8c918 ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as m,b as p}from"./chunk-KA5S6IAE.js";import"./chunk-SQE76S5B.js";var d=new Map;function n(){return{get:e=>d.get(e)||null,set:(e,t)=>d.set(e,t),has:e=>d.has(e)}}function h(e="holo-escrow"){if(typeof localStorage>"u")return n();let t=r=>e+":"+r;return{get:r=>{try{let s=localStorage.getItem(t(r));return s?JSON.parse(s):null}catch{return null}},set:(r,s)=>{try{localStorage.setItem(t(r),JSON.stringify(s))}catch{}},has:r=>{try{return localStorage.getItem(t(r))!=null}catch{return!1}}}}async function y(e,{store:t=null,wallet:r=null,chain:s="base",nowMs:u=null}={}){let o=t||n();if(!e||!e.kappa)return{ok:!1,error:"no payment to fund"};if(!await p(e))return{ok:!1,error:"this payment isn't authentically signed \u2014 refusing to fund"};if(!e.hashlock)return{ok:!1,error:"this payment has no escrow lock"};let c=u||Date.now();if(e.expires&&c>e.expires)return{ok:!1,error:"already expired"};let l=o.get(e.kappa);if(l)return{ok:!0,kappa:e.kappa,mode:l.mode,live:l.mode==="live",tx:l.tx,already:!0};let a=r&&typeof r.htlcFund=="function"?"live":"custodial",f=null;if(a==="live")try{f=await r.htlcFund({chain:s,amount:e.amount,token:e.asset,hashlock:e.hashlock,timeout:e.expires})}catch(i){return{ok:!1,error:String(i&&i.message||i)}}return o.set(e.kappa,{state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,fundedAt:c,mode:a,tx:f,claim:null,refund:null}),{ok:!0,kappa:e.kappa,mode:a,live:a==="live",tx:f}}async function x(e,{claimSecret:t=null,claimerPub:r=null,store:s=null,nowMs:u=null}={}){let o=s||n(),c=u||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};if(!await p(e))return{ok:!1,error:"this link isn't authentically signed"};if(e.expires&&c>e.expires)return{ok:!1,error:"this payment has expired"};let l=t||e.claimSecret;if(!l)return{ok:!1,error:"this link has no claim key"};if(await m(l)!==e.hashlock)return{ok:!1,error:"this claim key doesn't match the payment"};let a=o.get(e.kappa);return a&&a.state!=="open"?{ok:!1,error:a.state==="claimed"?"already claimed":"this payment was returned to the sender"}:(a||(a={state:"open",amount:e.amount,asset:e.asset,fiat:e.fiat||null,hashlock:e.hashlock,pub:e.pub,expires:e.expires,mode:"custodial",offDevice:!0,claim:null,refund:null}),a.state!=="open"?{ok:!1,error:"already claimed"}:(a.state="claimed",a.claim={claimerPub:r||null,at:c},o.set(e.kappa,a),{ok:!0,amount:a.amount,asset:a.asset,fiat:a.fiat,mode:a.mode,live:a.mode==="live",offDevice:!!a.offDevice,custodialWallet:"\u03BA:"+e.kappa.slice(0,16)}))}async function g(e,{store:t=null,nowMs:r=null}={}){let s=t||n(),u=r||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};let o=s.get(e.kappa);return o?o.state!=="open"?{ok:!1,error:o.state==="claimed"?"already claimed \u2014 can't refund":"already refunded"}:o.expires&&u>o.expires?(o.state="refunded",o.refund={at:u},s.set(e.kappa,o),{ok:!0,amount:o.amount,asset:o.asset,mode:o.mode}):{ok:!1,error:"not yet expired \u2014 can't refund"}:{ok:!1,error:"no escrow to refund"}}function w(e,{store:t=null}={}){let r=t||n(),s=typeof e=="string"?e:e&&e.kappa;return s?r.get(s)||{state:"none"}:{state:"none"}}export{x as claimEscrow,y as fund,h as localStore,g as refund,w as status};
b/e865a215c8d5324a99af23da898bacc45766106e7e6a14e7c4aa28727262e5bc ADDED
@@ -0,0 +1 @@
 
 
1
+ import{a as d,b as y,c as w,d as k}from"./chunk-3SOENKZH.js";import"./chunk-SQE76S5B.js";function m(e){return["L1",e.type,e.kappa,e.hashlock||"",e.preimage||"",String(e.amount??""),e.asset||"",e.fiat||"",String(e.expires||""),e.by||"",String(e.at||"")].join("|")}async function v(e,{claimSecret:s,signer:a,at:t}){let i={type:"claim",kappa:e.kappa,hashlock:e.hashlock,preimage:s,amount:e.amount,asset:e.asset,fiat:e.fiat||null,expires:e.expires,by:a.pub,at:t};return i.sig=await a.sign(m(i)),i.tid=await d(m(i)),i}async function S(e,{signer:s,at:a}){let t={type:"refund",kappa:e.kappa,expires:e.expires,by:s.pub,at:a};return t.sig=await s.sign(m(t)),t.tid=await d(m(t)),t}async function b(e,s){return!e||!e.type||!e.kappa||!e.by||!e.sig||!await w(e.by,e.sig,m(e))?!1:e.type==="claim"?!(!e.preimage||await d(e.preimage)!==e.hashlock||e.expires&&e.at>e.expires):e.type==="refund"?!!(e.expires&&s>e.expires):!1}async function g(e,s=Date.now()){let a=[];for(let o of e)await b(o,s)&&a.push(o);let t=a.filter(o=>o.type==="claim");if(t.length){t.sort((r,n)=>r.at-n.at||(r.tid<n.tid?-1:r.tid>n.tid?1:0));let o=t[0];return{state:"claimed",winner:o.tid,by:o.by,amount:o.amount,asset:o.asset,fiat:o.fiat}}let i=a.filter(o=>o.type==="refund");return i.length?(i.sort((o,r)=>o.at-r.at||(o.tid<r.tid?-1:1)),{state:"refunded",winner:i[0].tid}):{state:"open"}}function D(e){return e&&e.transitions?Object.values(e.transitions):[]}async function j(e,s,a=Date.now()){e.transitions=e.transitions||{};for(let t of s||[])e.transitions[t.tid]||await b(t,a)&&(e.transitions[t.tid]=t);return e}var x=()=>({funded:!1,mode:"custodial",committed:null,transitions:{}}),h=new Map;function p(){return{get:e=>h.get(e)||null,set:(e,s)=>h.set(e,s),has:e=>h.has(e)}}function C(e="holo-escrow"){if(typeof localStorage>"u")return p();let s=a=>e+":"+a;return{get:a=>{try{let t=localStorage.getItem(s(a));return t?JSON.parse(t):null}catch{return null}},set:(a,t)=>{try{localStorage.setItem(s(a),JSON.stringify(t))}catch{}},has:a=>{try{return localStorage.getItem(s(a))!=null}catch{return!1}}}}async function E(e,{store:s=null,wallet:a=null,chain:t="base",nowMs:i=null}={}){let o=s||p();if(!e||!e.kappa)return{ok:!1,error:"no payment to fund"};if(!await k(e))return{ok:!1,error:"this payment isn't authentically signed \u2014 refusing to fund"};if(!e.hashlock)return{ok:!1,error:"this payment has no escrow lock"};let r=i||Date.now();if(e.expires&&r>e.expires)return{ok:!1,error:"already expired"};let n=o.get(e.kappa);if(n&&n.funded)return{ok:!0,kappa:e.kappa,mode:n.mode,live:n.mode==="live",tx:n.tx,already:!0};let c=a&&typeof a.htlcFund=="function"?"live":"custodial",f=null;if(c==="live")try{f=await a.htlcFund({chain:t,amount:e.amount,token:e.asset,hashlock:e.hashlock,timeout:e.expires})}catch(l){return{ok:!1,error:String(l&&l.message||l)}}let u=n||x();return u.funded=!0,u.mode=c,u.tx=f,u.amount=e.amount,u.asset=e.asset,u.fiat=e.fiat||null,u.expires=e.expires,o.set(e.kappa,u),{ok:!0,kappa:e.kappa,mode:c,live:c==="live",tx:f}}async function F(e,{claimSecret:s=null,claimerPub:a=null,claimerSigner:t=null,store:i=null,nowMs:o=null}={}){let r=i||p(),n=o||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};if(!await k(e))return{ok:!1,error:"this link isn't authentically signed"};if(e.expires&&n>e.expires)return{ok:!1,error:"this payment has expired"};let c=s||e.claimSecret;if(!c)return{ok:!1,error:"this link has no claim key"};if(await d(c)!==e.hashlock)return{ok:!1,error:"this claim key doesn't match the payment"};let f=t||await y(),u=await v(e,{claimSecret:c,signer:f,at:n}),l=r.get(e.kappa)||x();l.funded||(l.offDevice=!0);let M=l.committed&&l.committed!==u.tid;return l.transitions[u.tid]=u,l.committed||(l.committed=u.tid),r.set(e.kappa,l),M?{ok:!1,error:"already claimed"}:{ok:!0,amount:e.amount,asset:e.asset,fiat:e.fiat||null,mode:l.mode,live:l.mode==="live",offDevice:!!l.offDevice,tid:u.tid,claimerPub:a||f.pub,custodialWallet:"\u03BA:"+e.kappa.slice(0,16)}}async function J(e,{store:s=null,signer:a=null,nowMs:t=null}={}){let i=s||p(),o=t||Date.now();if(!e||!e.kappa)return{ok:!1,error:"not a payment"};let r=i.get(e.kappa);if(!r)return{ok:!1,error:"no escrow to refund"};let n=await g(Object.values(r.transitions),o);if(n.state==="claimed")return{ok:!1,error:"already claimed \u2014 can't refund"};if(n.state==="refunded")return{ok:!1,error:"already refunded"};if(!(r.expires&&o>r.expires))return{ok:!1,error:"not yet expired \u2014 can't refund"};let c=a||await y(),f=await S(e,{signer:c,at:o});return r.transitions[f.tid]=f,i.set(e.kappa,r),{ok:!0,amount:r.amount,asset:r.asset,mode:r.mode}}async function _(e,{store:s=null,nowMs:a=null}={}){let t=s||p(),i=a||Date.now(),o=typeof e=="string"?e:e&&e.kappa;if(!o)return{state:"none"};let r=t.get(o);if(!r)return{state:"none"};let n=await g(Object.values(r.transitions),i);return n.state==="open"?{state:r.funded?"open":"none",committed:r.committed||null,canonicalWinner:null,reconciled:!1}:{state:n.state,canonicalWinner:n.winner,committed:r.committed||null,reconciled:!!(r.committed&&n.state==="claimed"&&r.committed!==n.winner),by:n.by,amount:n.amount,asset:n.asset}}function N(e,{store:s=null}={}){let a=s||p(),t=typeof e=="string"?e:e&&e.kappa,i=a.get(t);return i?D(i):[]}async function L(e,s,{store:a=null,nowMs:t=null}={}){let i=a||p(),o=t||Date.now(),r=typeof e=="string"?e:e&&e.kappa,n=i.get(r)||x();return await j(n,s||[],o),i.set(r,n),_(r,{store:i,nowMs:o})}export{F as claimEscrow,N as exportPeer,E as fund,C as localStore,L as mergePeer,J as refund,_ as status};
b/fbc584dcd47de30a73780e59c463dc05a822590b8e0dd367311149edd46673a8 ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{a as at}from"./chunk-EJ2FITLI.js";import{b as st}from"./chunk-SQE76S5B.js";var R=st(at());function Te(t){return t&&t.__esModule?t.default:t}function x(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Z,_,Ie,ct,T,Ae,_e,lt,N={},Oe=[],dt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function M(t,e){for(var n in e)t[n]=e[n];return t}function Ve(t){var e=t.parentNode;e&&e.removeChild(t)}function oe(t,e,n){var r,i,o,s={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Z.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return F(t,s,r,i,null)}function F(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i??++Ie};return i==null&&_.vnode!=null&&_.vnode(o),o}function j(){return{current:null}}function P(t){return t.children}function S(t,e){this.props=t,this.context=e}function B(t,e){if(e==null)return t.__?B(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?B(t):null}function Fe(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Fe(t)}}function ve(t){(!t.__d&&(t.__d=!0)&&T.push(t)&&!W.__r++||_e!==_.debounceRendering)&&((_e=_.debounceRendering)||Ae)(W)}function W(){for(var t;W.__r=T.length;)t=T.sort(function(e,n){return e.__v.__b-n.__v.__b}),T=[],t.some(function(e){var n,r,i,o,s,l;e.__d&&(s=(o=(n=e).__v).__e,(l=n.__P)&&(r=[],(i=M({},o)).__v=o.__v+1,pe(l,o,i,n.__n,l.ownerSVGElement!==void 0,o.__h!=null?[s]:null,r,s??B(o),o.__h),qe(r,o),o.__e!=s&&Fe(o)))})}function Ue(t,e,n,r,i,o,s,l,c,u){var a,p,h,f,v,b,m,$=r&&r.__k||Oe,y=$.length;for(n.__k=[],a=0;a<e.length;a++)if((f=n.__k[a]=(f=e[a])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?F(null,f,null,null,f):Array.isArray(f)?F(P,{children:f},null,null,null):f.__b>0?F(f.type,f.props,f.key,null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(h=$[a])===null||h&&f.key==h.key&&f.type===h.type)$[a]=void 0;else for(p=0;p<y;p++){if((h=$[p])&&f.key==h.key&&f.type===h.type){$[p]=void 0;break}h=null}pe(t,f,h=h||N,i,o,s,l,c,u),v=f.__e,(p=f.ref)&&h.ref!=p&&(m||(m=[]),h.ref&&m.push(h.ref,null,f),m.push(p,f.__c||v,f)),v!=null?(b==null&&(b=v),typeof f.type=="function"&&f.__k===h.__k?f.__d=c=Ne(f,c,t):c=We(t,f,h,$,v,c),typeof n.type=="function"&&(n.__d=c)):c&&h.__e==c&&c.parentNode!=t&&(c=B(h))}for(n.__e=b,a=y;a--;)$[a]!=null&&(typeof n.type=="function"&&$[a].__e!=null&&$[a].__e==n.__d&&(n.__d=B(r,a+1)),Ge($[a],$[a]));if(m)for(a=0;a<m.length;a++)Ke(m[a],m[++a],m[++a])}function Ne(t,e,n){for(var r,i=t.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=t,e=typeof r.type=="function"?Ne(r,e,n):We(n,r,r,i,r.__e,e));return e}function q(t,e){return e=e||[],t==null||typeof t=="boolean"||(Array.isArray(t)?t.some(function(n){q(n,e)}):e.push(t)),e}function We(t,e,n,r,i,o){var s,l,c;if(e.__d!==void 0)s=e.__d,e.__d=void 0;else if(n==null||i!=o||i.parentNode==null)e:if(o==null||o.parentNode!==t)t.appendChild(i),s=null;else{for(l=o,c=0;(l=l.nextSibling)&&c<r.length;c+=2)if(l==i)break e;t.insertBefore(i,o),s=o}return s!==void 0?s:i.nextSibling}function ut(t,e,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in e||K(t,o,null,n[o],r);for(o in e)i&&typeof e[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===e[o]||K(t,o,e[o],n[o],r)}function ge(t,e,n){e[0]==="-"?t.setProperty(e,n):t[e]=n==null?"":typeof n!="number"||dt.test(e)?n:n+"px"}function K(t,e,n,r,i){var o;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||ge(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||ge(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r||t.addEventListener(e,o?be:me,o):t.removeEventListener(e,o?be:me,o);else if(e!=="dangerouslySetInnerHTML"){if(i)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n!=null&&(n!==!1||e[0]==="a"&&e[1]==="r")?t.setAttribute(e,n):t.removeAttribute(e))}}function me(t){this.l[t.type+!1](_.event?_.event(t):t)}function be(t){this.l[t.type+!0](_.event?_.event(t):t)}function pe(t,e,n,r,i,o,s,l,c){var u,a,p,h,f,v,b,m,$,y,I,C=e.type;if(e.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,l=e.__e=n.__e,e.__h=null,o=[l]),(u=_.__b)&&u(e);try{e:if(typeof C=="function"){if(m=e.props,$=(u=C.contextType)&&r[u.__c],y=u?$?$.props.value:u.__:r,n.__c?b=(a=e.__c=n.__c).__=a.__E:("prototype"in C&&C.prototype.render?e.__c=a=new C(m,y):(e.__c=a=new S(m,y),a.constructor=C,a.render=ft),$&&$.sub(a),a.props=m,a.state||(a.state={}),a.context=y,a.__n=r,p=a.__d=!0,a.__h=[]),a.__s==null&&(a.__s=a.state),C.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=M({},a.__s)),M(a.__s,C.getDerivedStateFromProps(m,a.__s))),h=a.props,f=a.state,p)C.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==h&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(m,y),!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(m,a.__s,y)===!1||e.__v===n.__v){a.props=m,a.state=a.__s,e.__v!==n.__v&&(a.__d=!1),a.__v=e,e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(A){A&&(A.__=e)}),a.__h.length&&s.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(m,a.__s,y),a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(h,f,v)})}a.context=y,a.props=m,a.state=a.__s,(u=_.__r)&&u(e),a.__d=!1,a.__v=e,a.__P=t,u=a.render(a.props,a.state,a.context),a.state=a.__s,a.getChildContext!=null&&(r=M(M({},r),a.getChildContext())),p||a.getSnapshotBeforeUpdate==null||(v=a.getSnapshotBeforeUpdate(h,f)),I=u!=null&&u.type===P&&u.key==null?u.props.children:u,Ue(t,Array.isArray(I)?I:[I],e,n,r,i,o,s,l,c),a.base=e.__e,e.__h=null,a.__h.length&&s.push(a),b&&(a.__E=a.__=null),a.__e=!1}else o==null&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=ht(n.__e,e,n,r,i,o,s,c);(u=_.diffed)&&u(e)}catch(A){e.__v=null,(c||o!=null)&&(e.__e=l,e.__h=!!c,o[o.indexOf(l)]=null),_.__e(A,e,n)}}function qe(t,e){_.__c&&_.__c(e,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(r){r.call(n)})}catch(r){_.__e(r,n.__v)}})}function ht(t,e,n,r,i,o,s,l){var c,u,a,p=n.props,h=e.props,f=e.type,v=0;if(f==="svg"&&(i=!0),o!=null){for(;v<o.length;v++)if((c=o[v])&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){t=c,o[v]=null;break}}if(t==null){if(f===null)return document.createTextNode(h);t=i?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,h.is&&h),o=null,l=!1}if(f===null)p===h||l&&t.data===h||(t.data=h);else{if(o=o&&Z.call(t.childNodes),u=(p=n.props||N).dangerouslySetInnerHTML,a=h.dangerouslySetInnerHTML,!l){if(o!=null)for(p={},v=0;v<t.attributes.length;v++)p[t.attributes[v].name]=t.attributes[v].value;(a||u)&&(a&&(u&&a.__html==u.__html||a.__html===t.innerHTML)||(t.innerHTML=a&&a.__html||""))}if(ut(t,h,p,i,l),a)e.__k=[];else if(v=e.props.children,Ue(t,Array.isArray(v)?v:[v],e,n,r,i&&f!=="foreignObject",o,s,o?o[0]:n.__k&&B(n,0),l),o!=null)for(v=o.length;v--;)o[v]!=null&&Ve(o[v]);l||("value"in h&&(v=h.value)!==void 0&&(v!==p.value||v!==t.value||f==="progress"&&!v)&&K(t,"value",v,p.value,!1),"checked"in h&&(v=h.checked)!==void 0&&v!==t.checked&&K(t,"checked",v,p.checked,!1))}return t}function Ke(t,e,n){try{typeof t=="function"?t(e):t.current=e}catch(r){_.__e(r,n)}}function Ge(t,e,n){var r,i;if(_.unmount&&_.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||Ke(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){_.__e(o,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Ge(r[i],e,typeof t.type!="function");n||t.__e==null||Ve(t.__e),t.__e=t.__d=void 0}function ft(t,e,n){return this.constructor(t,n)}function Xe(t,e,n){var r,i,o;_.__&&_.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],pe(e,t=(!r&&n||e).__k=oe(P,null,[t]),i||N,N,e.ownerSVGElement!==void 0,!r&&n?[n]:i?null:e.firstChild?Z.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r),qe(o,t)}Z=Oe.slice,_={__e:function(t,e){for(var n,r,i;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(t)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(t),i=n.__d),i)return n.__E=n}catch(o){t=o}throw t}},Ie=0,ct=function(t){return t!=null&&t.constructor===void 0},S.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=M({},this.state),typeof t=="function"&&(t=t(M({},n),this.props)),t&&M(n,t),t!=null&&this.__v&&(e&&this.__h.push(e),ve(this))},S.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ve(this))},S.prototype.render=P,T=[],Ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,W.__r=0,lt=0;var pt=0;function d(t,e,n,r,i){var o,s,l={};for(s in e)s=="ref"?o=e[s]:l[s]=e[s];var c={type:t,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--pt,__source:r,__self:i};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return _.vnode&&_.vnode(c),c}function _t(t,e){try{window.localStorage[`emoji-mart.${t}`]=JSON.stringify(e)}catch{}}function vt(t){try{let e=window.localStorage[`emoji-mart.${t}`];if(e)return JSON.parse(e)}catch{}}var E={set:_t,get:vt},ee=new Map,gt=[{v:15,emoji:"\u{1FAE8}"},{v:14,emoji:"\u{1FAE0}"},{v:13.1,emoji:"\u{1F636}\u200D\u{1F32B}\uFE0F"},{v:13,emoji:"\u{1F978}"},{v:12.1,emoji:"\u{1F9D1}\u200D\u{1F9B0}"},{v:12,emoji:"\u{1F971}"},{v:11,emoji:"\u{1F970}"},{v:5,emoji:"\u{1F929}"},{v:4,emoji:"\u{1F471}\u200D\u2640\uFE0F"},{v:3,emoji:"\u{1F923}"},{v:2,emoji:"\u{1F44B}\u{1F3FB}"},{v:1,emoji:"\u{1F643}"}];function mt(){for(let{v:t,emoji:e}of gt)if(Je(e))return t}function bt(){return!Je("\u{1F1E8}\u{1F1E6}")}function Je(t){if(ee.has(t))return ee.get(t);let e=$t(t);return ee.set(t,e),e}var $t=(()=>{let t=null;try{navigator.userAgent.includes("jsdom")||(t=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}))}catch{}if(!t)return()=>!1;let e=25,n=20,r=Math.floor(e/2);return t.font=r+"px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=n*2,t.canvas.height=e,i=>{t.clearRect(0,0,n*2,e),t.fillStyle="#FF0000",t.fillText(i,0,22),t.fillStyle="#0000FF",t.fillText(i,n,22);let o=t.getImageData(0,0,n,e).data,s=o.length,l=0;for(;l<s&&!o[l+3];l+=4);if(l>=s)return!1;let c=n+l/4%n,u=Math.floor(l/4/n),a=t.getImageData(c,u,1,1).data;return!(o[l]!==a[0]||o[l+2]!==a[2]||t.measureText(i).width>=n)}})(),$e={latestVersion:mt,noCountryFlags:bt},ie=["+1","grinning","kissing_heart","heart_eyes","laughing","stuck_out_tongue_winking_eye","sweat_smile","joy","scream","disappointed","unamused","weary","sob","sunglasses","heart"],k=null;function kt(t){k||(k=E.get("frequently")||{});let e=t.id||t;e&&(k[e]||(k[e]=0),k[e]+=1,E.set("last",e),E.set("frequently",k))}function wt({maxFrequentRows:t,perLine:e}){if(!t)return[];k||(k=E.get("frequently"));let n=[];if(!k){k={};for(let o in ie.slice(0,e)){let s=ie[o];k[s]=e-o,n.push(s)}return n}let r=t*e,i=E.get("last");for(let o in k)n.push(o);if(n.sort((o,s)=>{let l=k[s],c=k[o];return l==c?o.localeCompare(s):l-c}),n.length>r){let o=n.slice(r);n=n.slice(0,r);for(let s of o)s!=i&&delete k[s];i&&n.indexOf(i)==-1&&(delete k[n[n.length-1]],n.splice(-1,1,i)),E.set("frequently",k)}return n}var Ye={add:kt,get:wt,DEFAULTS:ie},Ze={};Ze=JSON.parse('{"search":"Search","search_no_results_1":"Oh no!","search_no_results_2":"That emoji couldn\u2019t be found","pick":"Pick an emoji\u2026","add_custom":"Add custom emoji","categories":{"activity":"Activity","custom":"Custom","flags":"Flags","foods":"Food & Drink","frequent":"Frequently used","nature":"Animals & Nature","objects":"Objects","people":"Smileys & People","places":"Travel & Places","search":"Search Results","symbols":"Symbols"},"skins":{"1":"Default","2":"Light","3":"Medium-Light","4":"Medium","5":"Medium-Dark","6":"Dark","choose":"Choose default skin tone"}}');var z={autoFocus:{value:!1},dynamicWidth:{value:!1},emojiButtonColors:{value:null},emojiButtonRadius:{value:"100%"},emojiButtonSize:{value:36},emojiSize:{value:24},emojiVersion:{value:15,choices:[1,2,3,4,5,11,12,12.1,13,13.1,14,15]},exceptEmojis:{value:[]},icons:{value:"auto",choices:["auto","outline","solid"]},locale:{value:"en",choices:["en","ar","be","cs","de","es","fa","fi","fr","hi","it","ja","ko","nl","pl","pt","ru","sa","tr","uk","vi","zh"]},maxFrequentRows:{value:4},navPosition:{value:"top",choices:["top","bottom","none"]},noCountryFlags:{value:!1},noResultsEmoji:{value:null},perLine:{value:9},previewEmoji:{value:null},previewPosition:{value:"bottom",choices:["top","bottom","none"]},searchPosition:{value:"sticky",choices:["sticky","static","none"]},set:{value:"native",choices:["native","apple","facebook","google","twitter"]},skin:{value:1,choices:[1,2,3,4,5,6]},skinTonePosition:{value:"preview",choices:["preview","search","none"]},theme:{value:"auto",choices:["auto","light","dark"]},categories:null,categoryIcons:null,custom:null,data:null,i18n:null,getImageURL:null,getSpritesheetURL:null,onAddCustomEmoji:null,onClickOutside:null,onEmojiSelect:null,stickySearch:{deprecated:!0,value:!0}},w=null,g=null,te={};async function ke(t){if(te[t])return te[t];let n=await(await fetch(t)).json();return te[t]=n,n}var ne=null;var Qe=null,et=!1;function Q(t,{caller:e}={}){return ne||(ne=new Promise(n=>{Qe=n})),t?yt(t):e&&!et&&console.warn(`\`${e}\` requires data to be initialized first. Promise will be pending until \`init\` is called.`),ne}async function yt(t){et=!0;let{emojiVersion:e,set:n,locale:r}=t;if(e||(e=z.emojiVersion.value),n||(n=z.set.value),r||(r=z.locale.value),g)g.categories=g.categories.filter(c=>!c.name);else{g=(typeof t.data=="function"?await t.data():t.data)||await ke(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/sets/${e}/${n}.json`),g.emoticons={},g.natives={},g.categories.unshift({id:"frequent",emojis:[]});for(let c in g.aliases){let u=g.aliases[c],a=g.emojis[u];a&&(a.aliases||(a.aliases=[]),a.aliases.push(c))}g.originalCategories=g.categories}if(w=(typeof t.i18n=="function"?await t.i18n():t.i18n)||(r=="en"?Te(Ze):await ke(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/i18n/${r}.json`)),t.custom)for(let c in t.custom){c=parseInt(c);let u=t.custom[c],a=t.custom[c-1];if(!(!u.emojis||!u.emojis.length)){u.id||(u.id=`custom_${c+1}`),u.name||(u.name=w.categories.custom),a&&!u.icon&&(u.target=a.target||a),g.categories.push(u);for(let p of u.emojis)g.emojis[p.id]=p}}t.categories&&(g.categories=g.originalCategories.filter(c=>t.categories.indexOf(c.id)!=-1).sort((c,u)=>{let a=t.categories.indexOf(c.id),p=t.categories.indexOf(u.id);return a-p}));let i=null,o=null;n=="native"&&(i=$e.latestVersion(),o=t.noCountryFlags||$e.noCountryFlags());let s=g.categories.length,l=!1;for(;s--;){let c=g.categories[s];if(c.id=="frequent"){let{maxFrequentRows:p,perLine:h}=t;p=p>=0?p:z.maxFrequentRows.value,h||(h=z.perLine.value),c.emojis=Ye.get({maxFrequentRows:p,perLine:h})}if(!c.emojis||!c.emojis.length){g.categories.splice(s,1);continue}let{categoryIcons:u}=t;if(u){let p=u[c.id];p&&!c.icon&&(c.icon=p)}let a=c.emojis.length;for(;a--;){let p=c.emojis[a],h=p.id?p:g.emojis[p],f=()=>{c.emojis.splice(a,1)};if(!h||t.exceptEmojis&&t.exceptEmojis.includes(h.id)){f();continue}if(i&&h.version>i){f();continue}if(o&&c.id=="flags"&&!zt.includes(h.id)){f();continue}if(!h.search){if(l=!0,h.search=","+[[h.id,!1],[h.name,!0],[h.keywords,!1],[h.emoticons,!1]].map(([b,m])=>{if(b)return(Array.isArray(b)?b:[b]).map($=>(m?$.split(/[-|_|\s]+/):[$]).map(y=>y.toLowerCase())).flat()}).flat().filter(b=>b&&b.trim()).join(","),h.emoticons)for(let b of h.emoticons)g.emoticons[b]||(g.emoticons[b]=h.id);let v=0;for(let b of h.skins){if(!b)continue;v++;let{native:m}=b;m&&(g.natives[m]=h.id,h.search+=`,${m}`);let $=v==1?"":`:skin-tone-${v}:`;b.shortcodes=`:${h.id}:${$}`}}}}l&&D.reset(),Qe()}function tt(t,e,n){t||(t={});let r={};for(let i in e)r[i]=nt(i,t,e,n);return r}function nt(t,e,n,r){let i=n[t],o=r&&r.getAttribute(t)||(e[t]!=null&&e[t]!=null?e[t]:null);return i&&(o!=null&&i.value&&typeof i.value!=typeof o&&(typeof i.value=="boolean"?o=o!="false":o=i.value.constructor(o)),i.transform&&o&&(o=i.transform(o)),(o==null||i.choices&&i.choices.indexOf(o)==-1)&&(o=i.value)),o}var xt=/^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/,se=null;function Ct(t){return t.id?t:g.emojis[t]||g.emojis[g.aliases[t]]||g.emojis[g.natives[t]]}function St(){se=null}async function jt(t,{maxResults:e,caller:n}={}){if(!t||!t.trim().length)return null;e||(e=90),await Q(null,{caller:n||"SearchIndex.search"});let r=t.toLowerCase().replace(/(\w)-/,"$1 ").split(/[\s|,]+/).filter((l,c,u)=>l.trim()&&u.indexOf(l)==c);if(!r.length)return;let i=se||(se=Object.values(g.emojis)),o,s;for(let l of r){if(!i.length)break;o=[],s={};for(let c of i){if(!c.search)continue;let u=c.search.indexOf(`,${l}`);u!=-1&&(o.push(c),s[c.id]||(s[c.id]=0),s[c.id]+=c.id==l?0:u+1)}i=o}return o.length<2||(o.sort((l,c)=>{let u=s[l.id],a=s[c.id];return u==a?l.id.localeCompare(c.id):u-a}),o.length>e&&(o=o.slice(0,e))),o}var D={search:jt,get:Ct,reset:St,SHORTCODES_REGEX:xt},zt=["checkered_flag","crossed_flags","pirate_flag","rainbow-flag","transgender_flag","triangular_flag_on_post","waving_black_flag","waving_white_flag"];function Mt(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,r)=>n==e[r])}async function Et(t=1){for(let e in[...Array(t).keys()])await new Promise(requestAnimationFrame)}function Lt(t,{skinIndex:e=0}={}){let n=t.skins[e]||(e=0,t.skins[e]),r={id:t.id,name:t.name,native:n.native,unified:n.unified,keywords:t.keywords,shortcodes:n.shortcodes||t.shortcodes};return t.skins.length>1&&(r.skin=e+1),n.src&&(r.src=n.src),t.aliases&&t.aliases.length&&(r.aliases=t.aliases),t.emoticons&&t.emoticons.length&&(r.emoticons=t.emoticons),r}var Rt={activity:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113"})}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M16.17 337.5c0 44.98 7.565 83.54 13.98 107.9C35.22 464.3 50.46 496 174.9 496c9.566 0 19.59-.4707 29.84-1.271L17.33 307.3C16.53 317.6 16.17 327.7 16.17 337.5zM495.8 174.5c0-44.98-7.565-83.53-13.98-107.9c-4.688-17.54-18.34-31.23-36.04-35.95C435.5 27.91 392.9 16 337 16c-9.564 0-19.59 .4707-29.84 1.271l187.5 187.5C495.5 194.4 495.8 184.3 495.8 174.5zM26.77 248.8l236.3 236.3c142-36.1 203.9-150.4 222.2-221.1L248.9 26.87C106.9 62.96 45.07 177.2 26.77 248.8zM256 335.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L164.7 283.3C161.6 280.2 160 276.1 160 271.1c0-8.529 6.865-16 16-16c4.095 0 8.189 1.562 11.31 4.688l64.01 64C254.4 327.8 256 331.9 256 335.1zM304 287.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L212.7 235.3C209.6 232.2 208 228.1 208 223.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01C302.5 279.8 304 283.9 304 287.1zM256 175.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01c3.125 3.125 4.688 7.219 4.688 11.31c0 9.133-7.468 16-16 16c-4.094 0-8.189-1.562-11.31-4.688l-64.01-64.01C257.6 184.2 256 180.1 256 175.1z"})})},custom:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:d("path",{d:"M417.1 368c-5.937 10.27-16.69 16-27.75 16c-5.422 0-10.92-1.375-15.97-4.281L256 311.4V448c0 17.67-14.33 32-31.1 32S192 465.7 192 448V311.4l-118.3 68.29C68.67 382.6 63.17 384 57.75 384c-11.06 0-21.81-5.734-27.75-16c-8.828-15.31-3.594-34.88 11.72-43.72L159.1 256L41.72 187.7C26.41 178.9 21.17 159.3 29.1 144C36.63 132.5 49.26 126.7 61.65 128.2C65.78 128.7 69.88 130.1 73.72 132.3L192 200.6V64c0-17.67 14.33-32 32-32S256 46.33 256 64v136.6l118.3-68.29c3.838-2.213 7.939-3.539 12.07-4.051C398.7 126.7 411.4 132.5 417.1 144c8.828 15.31 3.594 34.88-11.72 43.72L288 256l118.3 68.28C421.6 333.1 426.8 352.7 417.1 368z"})}),flags:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d("path",{d:"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z"})}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M64 496C64 504.8 56.75 512 48 512h-32C7.25 512 0 504.8 0 496V32c0-17.75 14.25-32 32-32s32 14.25 32 32V496zM476.3 0c-6.365 0-13.01 1.35-19.34 4.233c-45.69 20.86-79.56 27.94-107.8 27.94c-59.96 0-94.81-31.86-163.9-31.87C160.9 .3055 131.6 4.867 96 15.75v350.5c32-9.984 59.87-14.1 84.85-14.1c73.63 0 124.9 31.78 198.6 31.78c31.91 0 68.02-5.971 111.1-23.09C504.1 355.9 512 344.4 512 332.1V30.73C512 11.1 495.3 0 476.3 0z"})})},foods:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d("path",{d:"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9"})}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M481.9 270.1C490.9 279.1 496 291.3 496 304C496 316.7 490.9 328.9 481.9 337.9C472.9 346.9 460.7 352 448 352H64C51.27 352 39.06 346.9 30.06 337.9C21.06 328.9 16 316.7 16 304C16 291.3 21.06 279.1 30.06 270.1C39.06 261.1 51.27 256 64 256H448C460.7 256 472.9 261.1 481.9 270.1zM475.3 388.7C478.3 391.7 480 395.8 480 400V416C480 432.1 473.3 449.3 461.3 461.3C449.3 473.3 432.1 480 416 480H96C79.03 480 62.75 473.3 50.75 461.3C38.74 449.3 32 432.1 32 416V400C32 395.8 33.69 391.7 36.69 388.7C39.69 385.7 43.76 384 48 384H464C468.2 384 472.3 385.7 475.3 388.7zM50.39 220.8C45.93 218.6 42.03 215.5 38.97 211.6C35.91 207.7 33.79 203.2 32.75 198.4C31.71 193.5 31.8 188.5 32.99 183.7C54.98 97.02 146.5 32 256 32C365.5 32 457 97.02 479 183.7C480.2 188.5 480.3 193.5 479.2 198.4C478.2 203.2 476.1 207.7 473 211.6C469.1 215.5 466.1 218.6 461.6 220.8C457.2 222.9 452.3 224 447.3 224H64.67C59.73 224 54.84 222.9 50.39 220.8zM372.7 116.7C369.7 119.7 368 123.8 368 128C368 131.2 368.9 134.3 370.7 136.9C372.5 139.5 374.1 141.6 377.9 142.8C380.8 143.1 384 144.3 387.1 143.7C390.2 143.1 393.1 141.6 395.3 139.3C397.6 137.1 399.1 134.2 399.7 131.1C400.3 128 399.1 124.8 398.8 121.9C397.6 118.1 395.5 116.5 392.9 114.7C390.3 112.9 387.2 111.1 384 111.1C379.8 111.1 375.7 113.7 372.7 116.7V116.7zM244.7 84.69C241.7 87.69 240 91.76 240 96C240 99.16 240.9 102.3 242.7 104.9C244.5 107.5 246.1 109.6 249.9 110.8C252.8 111.1 256 112.3 259.1 111.7C262.2 111.1 265.1 109.6 267.3 107.3C269.6 105.1 271.1 102.2 271.7 99.12C272.3 96.02 271.1 92.8 270.8 89.88C269.6 86.95 267.5 84.45 264.9 82.7C262.3 80.94 259.2 79.1 256 79.1C251.8 79.1 247.7 81.69 244.7 84.69V84.69zM116.7 116.7C113.7 119.7 112 123.8 112 128C112 131.2 112.9 134.3 114.7 136.9C116.5 139.5 118.1 141.6 121.9 142.8C124.8 143.1 128 144.3 131.1 143.7C134.2 143.1 137.1 141.6 139.3 139.3C141.6 137.1 143.1 134.2 143.7 131.1C144.3 128 143.1 124.8 142.8 121.9C141.6 118.1 139.5 116.5 136.9 114.7C134.3 112.9 131.2 111.1 128 111.1C123.8 111.1 119.7 113.7 116.7 116.7L116.7 116.7z"})})},frequent:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[d("path",{d:"M13 4h-2l-.001 7H9v2h2v2h2v-2h4v-2h-4z"}),d("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"})]}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512zM232 256C232 264 236 271.5 242.7 275.1L338.7 339.1C349.7 347.3 364.6 344.3 371.1 333.3C379.3 322.3 376.3 307.4 365.3 300L280 243.2V120C280 106.7 269.3 96 255.1 96C242.7 96 231.1 106.7 231.1 120L232 256z"})})},nature:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[d("path",{d:"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8"}),d("path",{d:"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.877 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235"})]}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:d("path",{d:"M332.7 19.85C334.6 8.395 344.5 0 356.1 0C363.6 0 370.6 3.52 375.1 9.502L392 32H444.1C456.8 32 469.1 37.06 478.1 46.06L496 64H552C565.3 64 576 74.75 576 88V112C576 156.2 540.2 192 496 192H426.7L421.6 222.5L309.6 158.5L332.7 19.85zM448 64C439.2 64 432 71.16 432 80C432 88.84 439.2 96 448 96C456.8 96 464 88.84 464 80C464 71.16 456.8 64 448 64zM416 256.1V480C416 497.7 401.7 512 384 512H352C334.3 512 320 497.7 320 480V364.8C295.1 377.1 268.8 384 240 384C211.2 384 184 377.1 160 364.8V480C160 497.7 145.7 512 128 512H96C78.33 512 64 497.7 64 480V249.8C35.23 238.9 12.64 214.5 4.836 183.3L.9558 167.8C-3.331 150.6 7.094 133.2 24.24 128.1C41.38 124.7 58.76 135.1 63.05 152.2L66.93 167.8C70.49 182 83.29 191.1 97.97 191.1H303.8L416 256.1z"})})},objects:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[d("path",{d:"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z"}),d("path",{d:"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789"})]}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:d("path",{d:"M112.1 454.3c0 6.297 1.816 12.44 5.284 17.69l17.14 25.69c5.25 7.875 17.17 14.28 26.64 14.28h61.67c9.438 0 21.36-6.401 26.61-14.28l17.08-25.68c2.938-4.438 5.348-12.37 5.348-17.7L272 415.1h-160L112.1 454.3zM191.4 .0132C89.44 .3257 16 82.97 16 175.1c0 44.38 16.44 84.84 43.56 115.8c16.53 18.84 42.34 58.23 52.22 91.45c.0313 .25 .0938 .5166 .125 .7823h160.2c.0313-.2656 .0938-.5166 .125-.7823c9.875-33.22 35.69-72.61 52.22-91.45C351.6 260.8 368 220.4 368 175.1C368 78.61 288.9-.2837 191.4 .0132zM192 96.01c-44.13 0-80 35.89-80 79.1C112 184.8 104.8 192 96 192S80 184.8 80 176c0-61.76 50.25-111.1 112-111.1c8.844 0 16 7.159 16 16S200.8 96.01 192 96.01z"})})},people:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[d("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"}),d("path",{d:"M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0"})]}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256zM256 432C332.1 432 396.2 382 415.2 314.1C419.1 300.4 407.8 288 393.6 288H118.4C104.2 288 92.92 300.4 96.76 314.1C115.8 382 179.9 432 256 432V432zM176.4 160C158.7 160 144.4 174.3 144.4 192C144.4 209.7 158.7 224 176.4 224C194 224 208.4 209.7 208.4 192C208.4 174.3 194 160 176.4 160zM336.4 224C354 224 368.4 209.7 368.4 192C368.4 174.3 354 160 336.4 160C318.7 160 304.4 174.3 304.4 192C304.4 209.7 318.7 224 336.4 224z"})})},places:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[d("path",{d:"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5"}),d("path",{d:"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z"})]}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M39.61 196.8L74.8 96.29C88.27 57.78 124.6 32 165.4 32H346.6C387.4 32 423.7 57.78 437.2 96.29L472.4 196.8C495.6 206.4 512 229.3 512 256V448C512 465.7 497.7 480 480 480H448C430.3 480 416 465.7 416 448V400H96V448C96 465.7 81.67 480 64 480H32C14.33 480 0 465.7 0 448V256C0 229.3 16.36 206.4 39.61 196.8V196.8zM109.1 192H402.9L376.8 117.4C372.3 104.6 360.2 96 346.6 96H165.4C151.8 96 139.7 104.6 135.2 117.4L109.1 192zM96 256C78.33 256 64 270.3 64 288C64 305.7 78.33 320 96 320C113.7 320 128 305.7 128 288C128 270.3 113.7 256 96 256zM416 320C433.7 320 448 305.7 448 288C448 270.3 433.7 256 416 256C398.3 256 384 270.3 384 288C384 305.7 398.3 320 416 320z"})})},symbols:{outline:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d("path",{d:"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76"})}),solid:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:d("path",{d:"M500.3 7.251C507.7 13.33 512 22.41 512 31.1V175.1C512 202.5 483.3 223.1 447.1 223.1C412.7 223.1 383.1 202.5 383.1 175.1C383.1 149.5 412.7 127.1 447.1 127.1V71.03L351.1 90.23V207.1C351.1 234.5 323.3 255.1 287.1 255.1C252.7 255.1 223.1 234.5 223.1 207.1C223.1 181.5 252.7 159.1 287.1 159.1V63.1C287.1 48.74 298.8 35.61 313.7 32.62L473.7 .6198C483.1-1.261 492.9 1.173 500.3 7.251H500.3zM74.66 303.1L86.5 286.2C92.43 277.3 102.4 271.1 113.1 271.1H174.9C185.6 271.1 195.6 277.3 201.5 286.2L213.3 303.1H239.1C266.5 303.1 287.1 325.5 287.1 351.1V463.1C287.1 490.5 266.5 511.1 239.1 511.1H47.1C21.49 511.1-.0019 490.5-.0019 463.1V351.1C-.0019 325.5 21.49 303.1 47.1 303.1H74.66zM143.1 359.1C117.5 359.1 95.1 381.5 95.1 407.1C95.1 434.5 117.5 455.1 143.1 455.1C170.5 455.1 191.1 434.5 191.1 407.1C191.1 381.5 170.5 359.1 143.1 359.1zM440.3 367.1H496C502.7 367.1 508.6 372.1 510.1 378.4C513.3 384.6 511.6 391.7 506.5 396L378.5 508C372.9 512.1 364.6 513.3 358.6 508.9C352.6 504.6 350.3 496.6 353.3 489.7L391.7 399.1H336C329.3 399.1 323.4 395.9 321 389.6C318.7 383.4 320.4 376.3 325.5 371.1L453.5 259.1C459.1 255 467.4 254.7 473.4 259.1C479.4 263.4 481.6 271.4 478.7 278.3L440.3 367.1zM116.7 219.1L19.85 119.2C-8.112 90.26-6.614 42.31 24.85 15.34C51.82-8.137 93.26-3.642 118.2 21.83L128.2 32.32L137.7 21.83C162.7-3.642 203.6-8.137 231.6 15.34C262.6 42.31 264.1 90.26 236.1 119.2L139.7 219.1C133.2 225.6 122.7 225.6 116.7 219.1H116.7z"})})}},Dt={loupe:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:d("path",{d:"M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"})}),delete:d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:d("path",{d:"M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z"})})},G={categories:Rt,search:Dt};function ae(t){let{id:e,skin:n,emoji:r}=t;if(t.shortcodes){let l=t.shortcodes.match(D.SHORTCODES_REGEX);l&&(e=l[1],l[2]&&(n=l[2]))}if(r||(r=D.get(e||t.native)),!r)return t.fallback;let i=r.skins[n-1]||r.skins[0],o=i.src||(t.set!="native"&&!t.spritesheet?typeof t.getImageURL=="function"?t.getImageURL(t.set,i.unified):`https://cdn.jsdelivr.net/npm/emoji-datasource-${t.set}@15.0.1/img/${t.set}/64/${i.unified}.png`:void 0),s=typeof t.getSpritesheetURL=="function"?t.getSpritesheetURL(t.set):`https://cdn.jsdelivr.net/npm/emoji-datasource-${t.set}@15.0.1/img/${t.set}/sheets-256/64.png`;return d("span",{class:"emoji-mart-emoji","data-emoji-set":t.set,children:o?d("img",{style:{maxWidth:t.size||"1em",maxHeight:t.size||"1em",display:"inline-block"},alt:i.native||i.shortcodes,src:o}):t.set=="native"?d("span",{style:{fontSize:t.size,fontFamily:'"EmojiMart", "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"'},children:i.native}):d("span",{style:{display:"block",width:t.size,height:t.size,backgroundImage:`url(${s})`,backgroundSize:`${100*g.sheet.cols}% ${100*g.sheet.rows}%`,backgroundPosition:`${100/(g.sheet.cols-1)*i.x}% ${100/(g.sheet.rows-1)*i.y}%`}})})}var Pt=typeof window<"u"&&window.HTMLElement?window.HTMLElement:Object,X=class extends Pt{static get observedAttributes(){return Object.keys(this.Props)}update(e={}){for(let n in e)this.attributeChangedCallback(n,null,e[n])}attributeChangedCallback(e,n,r){if(!this.component)return;let i=nt(e,{[e]:r},this.constructor.Props,this);this.component.componentWillReceiveProps?this.component.componentWillReceiveProps({[e]:i}):(this.component.props[e]=i,this.component.forceUpdate())}disconnectedCallback(){this.disconnected=!0,this.component&&this.component.unregister&&this.component.unregister()}constructor(e={}){if(super(),this.props=e,e.parent||e.ref){let n=null,r=e.parent||(n=e.ref&&e.ref.current);n&&(n.innerHTML=""),r&&r.appendChild(this)}}},ce=class extends X{setShadow(){this.attachShadow({mode:"open"})}injectStyles(e){if(!e)return;let n=document.createElement("style");n.textContent=e,this.shadowRoot.insertBefore(n,this.shadowRoot.firstChild)}constructor(e,{styles:n}={}){super(e),this.setShadow(),this.injectStyles(n)}},rt={fallback:"",id:"",native:"",shortcodes:"",size:{value:"",transform:t=>/\D/.test(t)?t:`${t}px`},set:z.set,skin:z.skin},J=class extends X{async connectedCallback(){let e=tt(this.props,rt,this);e.element=this,e.ref=n=>{this.component=n},await Q(),!this.disconnected&&Xe(d(ae,{...e}),this)}constructor(e){super(e)}};x(J,"Props",rt);typeof customElements<"u"&&!customElements.get("em-emoji")&&customElements.define("em-emoji",J);var Bt,L,we;var le=[],ye=_.__b,xe=_.__r,Ce=_.diffed,Se=_.__c,je=_.unmount;function Ht(){var t;for(le.sort(function(e,n){return e.__v.__b-n.__v.__b});t=le.pop();)if(t.__P)try{t.__H.__h.forEach(U),t.__H.__h.forEach(de),t.__H.__h=[]}catch(e){t.__H.__h=[],_.__e(e,t.__v)}}_.__b=function(t){L=null,ye&&ye(t)},_.__r=function(t){xe&&xe(t),Bt=0;var e=(L=t.__c).__H;e&&(e.__h.forEach(U),e.__h.forEach(de),e.__h=[])},_.diffed=function(t){Ce&&Ce(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(le.push(e)!==1&&we===_.requestAnimationFrame||((we=_.requestAnimationFrame)||function(n){var r,i=function(){clearTimeout(o),ze&&cancelAnimationFrame(r),setTimeout(n)},o=setTimeout(i,100);ze&&(r=requestAnimationFrame(i))})(Ht)),L=null},_.__c=function(t,e){e.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(r){return!r.__||de(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],_.__e(r,n.__v)}}),Se&&Se(t,e)},_.unmount=function(t){je&&je(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{U(r)}catch(i){e=i}}),e&&_.__e(e,n.__v))};var ze=typeof requestAnimationFrame=="function";function U(t){var e=L,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),L=e}function de(t){var e=L;t.__c=t.__(),L=e}function Tt(t,e){for(var n in e)t[n]=e[n];return t}function Me(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function Y(t){this.props=t}(Y.prototype=new S).isPureReactComponent=!0,Y.prototype.shouldComponentUpdate=function(t,e){return Me(this.props,t)||Me(this.state,e)};var Ee=_.__b;_.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ee&&Ee(t)};var Gt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var It=_.__e;_.__e=function(t,e,n){if(t.then){for(var r,i=e;i=i.__;)if((r=i.__c)&&r.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),r.__c(t,e)}It(t,e,n)};var Le=_.unmount;function re(){this.__u=0,this.t=null,this.__b=null}function ot(t){var e=t.__.__c;return e&&e.__e&&e.__e(t)}function O(){this.u=null,this.o=null}_.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),Le&&Le(t)},(re.prototype=new S).__c=function(t,e){var n=e.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=ot(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(l):l())};n.__R=s;var l=function(){if(!--r.__u){if(r.state.__e){var u=r.state.__e;r.__v.__k[0]=(function p(h,f,v){return h&&(h.__v=null,h.__k=h.__k&&h.__k.map(function(b){return p(b,f,v)}),h.__c&&h.__c.__P===f&&(h.__e&&v.insertBefore(h.__e,h.__d),h.__c.__e=!0,h.__c.__P=v)),h})(u,u.__c.__P,u.__c.__O)}var a;for(r.setState({__e:r.__b=null});a=r.t.pop();)a.forceUpdate()}},c=e.__h===!0;r.__u++||c||r.setState({__e:r.__b=r.__v.__k[0]}),t.then(s,s)},re.prototype.componentWillUnmount=function(){this.t=[]},re.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=(function o(s,l,c){return s&&(s.__c&&s.__c.__H&&(s.__c.__H.__.forEach(function(u){typeof u.__c=="function"&&u.__c()}),s.__c.__H=null),(s=Tt({},s)).__c!=null&&(s.__c.__P===c&&(s.__c.__P=l),s.__c=null),s.__k=s.__k&&s.__k.map(function(u){return o(u,l,c)})),s})(this.__b,n,r.__O=r.__P)}this.__b=null}var i=e.__e&&oe(P,null,t.fallback);return i&&(i.__h=null),[oe(P,null,e.__e?null:t.children),i]};var Re=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};(O.prototype=new S).__e=function(t){var e=this,n=ot(e.__v),r=e.o.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),Re(e,t,r)):i()};n?n(o):o()}},O.prototype.render=function(t){this.u=null,this.o=new Map;var e=q(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},O.prototype.componentDidUpdate=O.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,n){Re(t,n,e)})};var At=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ot=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Vt=typeof document<"u",Ft=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};S.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(S.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var De=_.event;function Ut(){}function Nt(){return this.cancelBubble}function Wt(){return this.defaultPrevented}_.event=function(t){return De&&(t=De(t)),t.persist=Ut,t.isPropagationStopped=Nt,t.isDefaultPrevented=Wt,t.nativeEvent=t};var qt,Pe={configurable:!0,get:function(){return this.class}},Be=_.vnode;_.vnode=function(t){var e=t.type,n=t.props,r=n;if(typeof e=="string"){var i=e.indexOf("-")===-1;for(var o in r={},n){var s=n[o];Vt&&o==="children"&&e==="noscript"||o==="value"&&"defaultValue"in n&&s==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&s===!0?s="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+e)&&!Ft(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp)/.test(o)?o=o.toLowerCase():i&&Ot.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():s===null&&(s=void 0),r[o]=s)}e=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=q(n.children).forEach(function(l){l.props.selected=r.value.indexOf(l.props.value)!=-1})),e=="select"&&r.defaultValue!=null&&(r.value=q(n.children).forEach(function(l){l.props.selected=r.multiple?r.defaultValue.indexOf(l.props.value)!=-1:r.defaultValue==l.props.value})),t.props=r,n.class!=n.className&&(Pe.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",Pe))}t.$$typeof=At,Be&&Be(t)};var He=_.__r;_.__r=function(t){He&&He(t),qt=t.__c};var Kt={light:"outline",dark:"solid"},ue=class extends Y{renderIcon(e){let{icon:n}=e;if(n){if(n.svg)return d("span",{class:"flex",dangerouslySetInnerHTML:{__html:n.svg}});if(n.src)return d("img",{src:n.src})}let r=G.categories[e.id]||G.categories.custom,i=this.props.icons=="auto"?Kt[this.props.theme]:this.props.icons;return r[i]||r}render(){let e=null;return d("nav",{id:"nav",class:"padding","data-position":this.props.position,dir:this.props.dir,children:d("div",{class:"flex relative",children:[this.categories.map((n,r)=>{let i=n.name||w.categories[n.id],o=!this.props.unfocused&&n.id==this.state.categoryId;return o&&(e=r),d("button",{"aria-label":i,"aria-selected":o||void 0,title:i,type:"button",class:"flex flex-grow flex-center",onMouseDown:s=>s.preventDefault(),onClick:()=>{this.props.onClick({category:n,i:r})},children:this.renderIcon(n)})}),d("div",{class:"bar",style:{width:`${100/this.categories.length}%`,opacity:e==null?0:1,transform:this.props.dir==="rtl"?`scaleX(-1) translateX(${e*100}%)`:`translateX(${e*100}%)`}})]})})}constructor(){super(),this.categories=g.categories.filter(e=>!e.target),this.state={categoryId:this.categories[0].id}}},he=class extends Y{shouldComponentUpdate(e){for(let n in e)if(n!="children"&&e[n]!=this.props[n])return!0;return!1}render(){return this.props.children}},V={rowsPerRender:10},fe=class extends S{getInitialState(e=this.props){return{skin:E.get("skin")||e.skin,theme:this.initTheme(e.theme)}}componentWillMount(){this.dir=w.rtl?"rtl":"ltr",this.refs={menu:j(),navigation:j(),scroll:j(),search:j(),searchInput:j(),skinToneButton:j(),skinToneRadio:j()},this.initGrid(),this.props.stickySearch==!1&&this.props.searchPosition=="sticky"&&(console.warn("[EmojiMart] Deprecation warning: `stickySearch` has been renamed `searchPosition`."),this.props.searchPosition="static")}componentDidMount(){if(this.register(),this.shadowRoot=this.base.parentNode,this.props.autoFocus){let{searchInput:e}=this.refs;e.current&&e.current.focus()}}componentWillReceiveProps(e){this.nextState||(this.nextState={});for(let n in e)this.nextState[n]=e[n];clearTimeout(this.nextStateTimer),this.nextStateTimer=setTimeout(()=>{let n=!1;for(let i in this.nextState)this.props[i]=this.nextState[i],(i==="custom"||i==="categories")&&(n=!0);delete this.nextState;let r=this.getInitialState();if(n)return this.reset(r);this.setState(r)})}componentWillUnmount(){this.unregister()}async reset(e={}){await Q(this.props),this.initGrid(),this.unobserve(),this.setState(e,()=>{this.observeCategories(),this.observeRows()})}register(){document.addEventListener("click",this.handleClickOutside),this.observe()}unregister(){document.removeEventListener("click",this.handleClickOutside),this.darkMedia?.removeEventListener("change",this.darkMediaCallback),this.unobserve()}observe(){this.observeCategories(),this.observeRows()}unobserve({except:e=[]}={}){Array.isArray(e)||(e=[e]);for(let n of this.observers)e.includes(n)||n.disconnect();this.observers=[].concat(e)}initGrid(){let{categories:e}=g;this.refs.categories=new Map;let n=g.categories.map(i=>i.id).join(",");this.navKey&&this.navKey!=n&&this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0),this.navKey=n,this.grid=[],this.grid.setsize=0;let r=(i,o)=>{let s=[];s.__categoryId=o.id,s.__index=i.length,this.grid.push(s);let l=this.grid.length-1,c=l%V.rowsPerRender?{}:j();return c.index=l,c.posinset=this.grid.setsize+1,i.push(c),s};for(let i of e){let o=[],s=r(o,i);for(let l of i.emojis)s.length==this.getPerLine()&&(s=r(o,i)),this.grid.setsize+=1,s.push(l);this.refs.categories.set(i.id,{root:j(),rows:o})}}initTheme(e){if(e!="auto")return e;if(!this.darkMedia){if(this.darkMedia=matchMedia("(prefers-color-scheme: dark)"),this.darkMedia.media.match(/^not/))return"light";this.darkMedia.addEventListener("change",this.darkMediaCallback)}return this.darkMedia.matches?"dark":"light"}initDynamicPerLine(e=this.props){if(!e.dynamicWidth)return;let{element:n,emojiButtonSize:r}=e,i=()=>{let{width:s}=n.getBoundingClientRect();return Math.floor(s/r)},o=new ResizeObserver(()=>{this.unobserve({except:o}),this.setState({perLine:i()},()=>{this.initGrid(),this.forceUpdate(()=>{this.observeCategories(),this.observeRows()})})});return o.observe(n),this.observers.push(o),i()}getPerLine(){return this.state.perLine||this.props.perLine}getEmojiByPos([e,n]){let r=this.state.searchResults||this.grid,i=r[e]&&r[e][n];if(i)return D.get(i)}observeCategories(){let e=this.refs.navigation.current;if(!e)return;let n=new Map,r=s=>{s!=e.state.categoryId&&e.setState({categoryId:s})},i={root:this.refs.scroll.current,threshold:[0,1]},o=new IntersectionObserver(s=>{for(let c of s){let u=c.target.dataset.id;n.set(u,c.intersectionRatio)}let l=[...n];for(let[c,u]of l)if(u){r(c);break}},i);for(let{root:s}of this.refs.categories.values())o.observe(s.current);this.observers.push(o)}observeRows(){let e={...this.state.visibleRows},n=new IntersectionObserver(r=>{for(let i of r){let o=parseInt(i.target.dataset.index);i.isIntersecting?e[o]=!0:delete e[o]}this.setState({visibleRows:e})},{root:this.refs.scroll.current,rootMargin:`${this.props.emojiButtonSize*(V.rowsPerRender+5)}px 0px ${this.props.emojiButtonSize*V.rowsPerRender}px`});for(let{rows:r}of this.refs.categories.values())for(let i of r)i.current&&n.observe(i.current);this.observers.push(n)}preventDefault(e){e.preventDefault()}unfocusSearch(){let e=this.refs.searchInput.current;e&&e.blur()}navigate({e,input:n,left:r,right:i,up:o,down:s}){let l=this.state.searchResults||this.grid;if(!l.length)return;let[c,u]=this.state.pos,a=(()=>{if(c==0&&u==0&&!e.repeat&&(r||o))return null;if(c==-1)return!e.repeat&&(i||s)&&n.selectionStart==n.value.length?[0,0]:null;if(r||i){let p=l[c],h=r?-1:1;if(u+=h,!p[u]){if(c+=h,p=l[c],!p)return c=r?0:l.length-1,u=r?0:l[c].length-1,[c,u];u=r?p.length-1:0}return[c,u]}if(o||s){c+=o?-1:1;let p=l[c];return p?(p[u]||(u=p.length-1),[c,u]):(c=o?0:l.length-1,u=o?0:l[c].length-1,[c,u])}})();if(a)e.preventDefault();else{this.state.pos[0]>-1&&this.setState({pos:[-1,-1]});return}this.setState({pos:a,keyboard:!0},()=>{this.scrollTo({row:a[0]})})}scrollTo({categoryId:e,row:n}){let r=this.state.searchResults||this.grid;if(!r.length)return;let i=this.refs.scroll.current,o=i.getBoundingClientRect(),s=0;if(n>=0&&(e=r[n].__categoryId),e&&(s=(this.refs[e]||this.refs.categories.get(e).root).current.getBoundingClientRect().top-(o.top-i.scrollTop)+1),n>=0)if(!n)s=0;else{let l=r[n].__index,c=s+l*this.props.emojiButtonSize,u=c+this.props.emojiButtonSize+this.props.emojiButtonSize*.88;if(c<i.scrollTop)s=c;else if(u>i.scrollTop+o.height)s=u-o.height;else return}this.ignoreMouse(),i.scrollTop=s}ignoreMouse(){this.mouseIsIgnored=!0,clearTimeout(this.ignoreMouseTimer),this.ignoreMouseTimer=setTimeout(()=>{delete this.mouseIsIgnored},100)}handleEmojiOver(e){this.mouseIsIgnored||this.state.showSkins||this.setState({pos:e||[-1,-1],keyboard:!1})}handleEmojiClick({e,emoji:n,pos:r}){if(this.props.onEmojiSelect&&(!n&&r&&(n=this.getEmojiByPos(r)),n)){let i=Lt(n,{skinIndex:this.state.skin-1});this.props.maxFrequentRows&&Ye.add(i,this.props),this.props.onEmojiSelect(i,e)}}closeSkins(){this.state.showSkins&&(this.setState({showSkins:null,tempSkin:null}),this.base.removeEventListener("click",this.handleBaseClick),this.base.removeEventListener("keydown",this.handleBaseKeydown))}handleSkinMouseOver(e){this.setState({tempSkin:e})}handleSkinClick(e){this.ignoreMouse(),this.closeSkins(),this.setState({skin:e,tempSkin:null}),E.set("skin",e)}renderNav(){return d(ue,{ref:this.refs.navigation,icons:this.props.icons,theme:this.state.theme,dir:this.dir,unfocused:!!this.state.searchResults,position:this.props.navPosition,onClick:this.handleCategoryClick},this.navKey)}renderPreview(){let e=this.getEmojiByPos(this.state.pos),n=this.state.searchResults&&!this.state.searchResults.length;return d("div",{id:"preview",class:"flex flex-middle",dir:this.dir,"data-position":this.props.previewPosition,children:[d("div",{class:"flex flex-middle flex-grow",children:[d("div",{class:"flex flex-auto flex-middle flex-center",style:{height:this.props.emojiButtonSize,fontSize:this.props.emojiButtonSize},children:d(ae,{emoji:e,id:n?this.props.noResultsEmoji||"cry":this.props.previewEmoji||(this.props.previewPosition=="top"?"point_down":"point_up"),set:this.props.set,size:this.props.emojiButtonSize,skin:this.state.tempSkin||this.state.skin,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})}),d("div",{class:`margin-${this.dir[0]}`,children:e||n?d("div",{class:`padding-${this.dir[2]} align-${this.dir[0]}`,children:[d("div",{class:"preview-title ellipsis",children:e?e.name:w.search_no_results_1}),d("div",{class:"preview-subtitle ellipsis color-c",children:e?e.skins[0].shortcodes:w.search_no_results_2})]}):d("div",{class:"preview-placeholder color-c",children:w.pick})})]}),!e&&this.props.skinTonePosition=="preview"&&this.renderSkinToneButton()]})}renderEmojiButton(e,{pos:n,posinset:r,grid:i}){let o=this.props.emojiButtonSize,s=this.state.tempSkin||this.state.skin,c=(e.skins[s-1]||e.skins[0]).native,u=Mt(this.state.pos,n),a=n.concat(e.id).join("");return d(he,{selected:u,skin:s,size:o,children:d("button",{"aria-label":c,"aria-selected":u||void 0,"aria-posinset":r,"aria-setsize":i.setsize,"data-keyboard":this.state.keyboard,title:this.props.previewPosition=="none"?e.name:void 0,type:"button",class:"flex flex-center flex-middle",tabindex:"-1",onClick:p=>this.handleEmojiClick({e:p,emoji:e}),onMouseEnter:()=>this.handleEmojiOver(n),onMouseLeave:()=>this.handleEmojiOver(),style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize,fontSize:this.props.emojiSize,lineHeight:0},children:[d("div",{"aria-hidden":"true",class:"background",style:{borderRadius:this.props.emojiButtonRadius,backgroundColor:this.props.emojiButtonColors?this.props.emojiButtonColors[(r-1)%this.props.emojiButtonColors.length]:void 0}}),d(ae,{emoji:e,set:this.props.set,size:this.props.emojiSize,skin:s,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})]})},a)}renderSearch(){let e=this.props.previewPosition=="none"||this.props.skinTonePosition=="search";return d("div",{children:[d("div",{class:"spacer"}),d("div",{class:"flex flex-middle",children:[d("div",{class:"search relative flex-grow",children:[d("input",{type:"search",ref:this.refs.searchInput,placeholder:w.search,onClick:this.handleSearchClick,onInput:this.handleSearchInput,onKeyDown:this.handleSearchKeyDown,autoComplete:"off"}),d("span",{class:"icon loupe flex",children:G.search.loupe}),this.state.searchResults&&d("button",{title:"Clear","aria-label":"Clear",type:"button",class:"icon delete flex",onClick:this.clearSearch,onMouseDown:this.preventDefault,children:G.search.delete})]}),e&&this.renderSkinToneButton()]})]})}renderSearchResults(){let{searchResults:e}=this.state;return e?d("div",{class:"category",ref:this.refs.search,children:[d("div",{class:`sticky padding-small align-${this.dir[0]}`,children:w.categories.search}),d("div",{children:e.length?e.map((n,r)=>d("div",{class:"flex",children:n.map((i,o)=>this.renderEmojiButton(i,{pos:[r,o],posinset:r*this.props.perLine+o+1,grid:e}))})):d("div",{class:`padding-small align-${this.dir[0]}`,children:this.props.onAddCustomEmoji&&d("a",{onClick:this.props.onAddCustomEmoji,children:w.add_custom})})})]}):null}renderCategories(){let{categories:e}=g,n=!!this.state.searchResults,r=this.getPerLine();return d("div",{style:{visibility:n?"hidden":void 0,display:n?"none":void 0,height:"100%"},children:e.map(i=>{let{root:o,rows:s}=this.refs.categories.get(i.id);return d("div",{"data-id":i.target?i.target.id:i.id,class:"category",ref:o,children:[d("div",{class:`sticky padding-small align-${this.dir[0]}`,children:i.name||w.categories[i.id]}),d("div",{class:"relative",style:{height:s.length*this.props.emojiButtonSize},children:s.map((l,c)=>{let u=l.index-l.index%V.rowsPerRender,a=this.state.visibleRows[u],p="current"in l?l:void 0;if(!a&&!p)return null;let h=c*r,f=h+r,v=i.emojis.slice(h,f);return v.length<r&&v.push(...new Array(r-v.length)),d("div",{"data-index":l.index,ref:p,class:"flex row",style:{top:c*this.props.emojiButtonSize},children:a&&v.map((b,m)=>{if(!b)return d("div",{style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize}});let $=D.get(b);return this.renderEmojiButton($,{pos:[l.index,m],posinset:l.posinset+m,grid:this.grid})})},l.index)})})]})})})}renderSkinToneButton(){return this.props.skinTonePosition=="none"?null:d("div",{class:"flex flex-auto flex-center flex-middle",style:{position:"relative",width:this.props.emojiButtonSize,height:this.props.emojiButtonSize},children:d("button",{type:"button",ref:this.refs.skinToneButton,class:"skin-tone-button flex flex-auto flex-center flex-middle","aria-selected":this.state.showSkins?"":void 0,"aria-label":w.skins.choose,title:w.skins.choose,onClick:this.openSkins,style:{width:this.props.emojiSize,height:this.props.emojiSize},children:d("span",{class:`skin-tone skin-tone-${this.state.skin}`})})})}renderLiveRegion(){let e=this.getEmojiByPos(this.state.pos),n=e?e.name:"";return d("div",{"aria-live":"polite",class:"sr-only",children:n})}renderSkins(){let n=this.refs.skinToneButton.current.getBoundingClientRect(),r=this.base.getBoundingClientRect(),i={};return this.dir=="ltr"?i.right=r.right-n.right-3:i.left=n.left-r.left-3,this.props.previewPosition=="bottom"&&this.props.skinTonePosition=="preview"?i.bottom=r.bottom-n.top+6:(i.top=n.bottom-r.top+3,i.bottom="auto"),d("div",{ref:this.refs.menu,role:"radiogroup",dir:this.dir,"aria-label":w.skins.choose,class:"menu hidden","data-position":i.top?"top":"bottom",style:i,children:[...Array(6).keys()].map(o=>{let s=o+1,l=this.state.skin==s;return d("div",{children:[d("input",{type:"radio",name:"skin-tone",value:s,"aria-label":w.skins[s],ref:l?this.refs.skinToneRadio:null,defaultChecked:l,onChange:()=>this.handleSkinMouseOver(s),onKeyDown:c=>{(c.code=="Enter"||c.code=="Space"||c.code=="Tab")&&(c.preventDefault(),this.handleSkinClick(s))}}),d("button",{"aria-hidden":"true",tabindex:"-1",onClick:()=>this.handleSkinClick(s),onMouseEnter:()=>this.handleSkinMouseOver(s),onMouseLeave:()=>this.handleSkinMouseOver(),class:"option flex flex-grow flex-middle",children:[d("span",{class:`skin-tone skin-tone-${s}`}),d("span",{class:"margin-small-lr",children:w.skins[s]})]})]})})})}render(){let e=this.props.perLine*this.props.emojiButtonSize;return d("section",{id:"root",class:"flex flex-column",dir:this.dir,style:{width:this.props.dynamicWidth?"100%":`calc(${e}px + (var(--padding) + var(--sidebar-width)))`},"data-emoji-set":this.props.set,"data-theme":this.state.theme,"data-menu":this.state.showSkins?"":void 0,children:[this.props.previewPosition=="top"&&this.renderPreview(),this.props.navPosition=="top"&&this.renderNav(),this.props.searchPosition=="sticky"&&d("div",{class:"padding-lr",children:this.renderSearch()}),d("div",{ref:this.refs.scroll,class:"scroll flex-grow padding-lr",children:d("div",{style:{width:this.props.dynamicWidth?"100%":e,height:"100%"},children:[this.props.searchPosition=="static"&&this.renderSearch(),this.renderSearchResults(),this.renderCategories()]})}),this.props.navPosition=="bottom"&&this.renderNav(),this.props.previewPosition=="bottom"&&this.renderPreview(),this.state.showSkins&&this.renderSkins(),this.renderLiveRegion()]})}constructor(e){super(),x(this,"darkMediaCallback",()=>{this.props.theme=="auto"&&this.setState({theme:this.darkMedia.matches?"dark":"light"})}),x(this,"handleClickOutside",n=>{let{element:r}=this.props;n.target!=r&&(this.state.showSkins&&this.closeSkins(),this.props.onClickOutside&&this.props.onClickOutside(n))}),x(this,"handleBaseClick",n=>{this.state.showSkins&&(n.target.closest(".menu")||(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins()))}),x(this,"handleBaseKeydown",n=>{this.state.showSkins&&n.key=="Escape"&&(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins())}),x(this,"handleSearchClick",()=>{this.getEmojiByPos(this.state.pos)&&this.setState({pos:[-1,-1]})}),x(this,"handleSearchInput",async()=>{let n=this.refs.searchInput.current;if(!n)return;let{value:r}=n,i=await D.search(r),o=()=>{this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0)};if(!i)return this.setState({searchResults:i,pos:[-1,-1]},o);let s=n.selectionStart==n.value.length?[0,0]:[-1,-1],l=[];l.setsize=i.length;let c=null;for(let u of i)(!l.length||c.length==this.getPerLine())&&(c=[],c.__categoryId="search",c.__index=l.length,l.push(c)),c.push(u);this.ignoreMouse(),this.setState({searchResults:l,pos:s},o)}),x(this,"handleSearchKeyDown",n=>{let r=n.currentTarget;switch(n.stopImmediatePropagation(),n.key){case"ArrowLeft":this.navigate({e:n,input:r,left:!0});break;case"ArrowRight":this.navigate({e:n,input:r,right:!0});break;case"ArrowUp":this.navigate({e:n,input:r,up:!0});break;case"ArrowDown":this.navigate({e:n,input:r,down:!0});break;case"Enter":n.preventDefault(),this.handleEmojiClick({e:n,pos:this.state.pos});break;case"Escape":n.preventDefault(),this.state.searchResults?this.clearSearch():this.unfocusSearch();break;default:break}}),x(this,"clearSearch",()=>{let n=this.refs.searchInput.current;n&&(n.value="",n.focus(),this.handleSearchInput())}),x(this,"handleCategoryClick",({category:n,i:r})=>{this.scrollTo(r==0?{row:-1}:{categoryId:n.id})}),x(this,"openSkins",n=>{let{currentTarget:r}=n,i=r.getBoundingClientRect();this.setState({showSkins:i},async()=>{await Et(2);let o=this.refs.menu.current;o&&(o.classList.remove("hidden"),this.refs.skinToneRadio.current.focus(),this.base.addEventListener("click",this.handleBaseClick,!0),this.base.addEventListener("keydown",this.handleBaseKeydown,!0))})}),this.observers=[],this.state={pos:[-1,-1],perLine:this.initDynamicPerLine(e),visibleRows:{0:!0},...this.getInitialState(e)}}},H=class extends ce{async connectedCallback(){let e=tt(this.props,z,this);e.element=this,e.ref=n=>{this.component=n},await Q(e),!this.disconnected&&Xe(d(fe,{...e}),this.shadowRoot)}constructor(e){super(e,{styles:Te(it)})}};x(H,"Props",z);typeof customElements<"u"&&!customElements.get("em-emoji-picker")&&customElements.define("em-emoji-picker",H);var it={};it=`:host {
2
+ width: min-content;
3
+ height: 435px;
4
+ min-height: 230px;
5
+ border-radius: var(--border-radius);
6
+ box-shadow: var(--shadow);
7
+ --border-radius: 10px;
8
+ --category-icon-size: 18px;
9
+ --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
10
+ --font-size: 15px;
11
+ --preview-placeholder-size: 21px;
12
+ --preview-title-size: 1.1em;
13
+ --preview-subtitle-size: .9em;
14
+ --shadow-color: 0deg 0% 0%;
15
+ --shadow: .3px .5px 2.7px hsl(var(--shadow-color) / .14), .4px .8px 1px -3.2px hsl(var(--shadow-color) / .14), 1px 2px 2.5px -4.5px hsl(var(--shadow-color) / .14);
16
+ display: flex;
17
+ }
18
+
19
+ [data-theme="light"] {
20
+ --em-rgb-color: var(--rgb-color, 34, 36, 39);
21
+ --em-rgb-accent: var(--rgb-accent, 34, 102, 237);
22
+ --em-rgb-background: var(--rgb-background, 255, 255, 255);
23
+ --em-rgb-input: var(--rgb-input, 255, 255, 255);
24
+ --em-color-border: var(--color-border, rgba(0, 0, 0, .05));
25
+ --em-color-border-over: var(--color-border-over, rgba(0, 0, 0, .1));
26
+ }
27
+
28
+ [data-theme="dark"] {
29
+ --em-rgb-color: var(--rgb-color, 222, 222, 221);
30
+ --em-rgb-accent: var(--rgb-accent, 58, 130, 247);
31
+ --em-rgb-background: var(--rgb-background, 21, 22, 23);
32
+ --em-rgb-input: var(--rgb-input, 0, 0, 0);
33
+ --em-color-border: var(--color-border, rgba(255, 255, 255, .1));
34
+ --em-color-border-over: var(--color-border-over, rgba(255, 255, 255, .2));
35
+ }
36
+
37
+ #root {
38
+ --color-a: rgb(var(--em-rgb-color));
39
+ --color-b: rgba(var(--em-rgb-color), .65);
40
+ --color-c: rgba(var(--em-rgb-color), .45);
41
+ --padding: 12px;
42
+ --padding-small: calc(var(--padding) / 2);
43
+ --sidebar-width: 16px;
44
+ --duration: 225ms;
45
+ --duration-fast: 125ms;
46
+ --duration-instant: 50ms;
47
+ --easing: cubic-bezier(.4, 0, .2, 1);
48
+ width: 100%;
49
+ text-align: left;
50
+ border-radius: var(--border-radius);
51
+ background-color: rgb(var(--em-rgb-background));
52
+ position: relative;
53
+ }
54
+
55
+ @media (prefers-reduced-motion) {
56
+ #root {
57
+ --duration: 0;
58
+ --duration-fast: 0;
59
+ --duration-instant: 0;
60
+ }
61
+ }
62
+
63
+ #root[data-menu] button {
64
+ cursor: auto;
65
+ }
66
+
67
+ #root[data-menu] .menu button {
68
+ cursor: pointer;
69
+ }
70
+
71
+ :host, #root, input, button {
72
+ color: rgb(var(--em-rgb-color));
73
+ font-family: var(--font-family);
74
+ font-size: var(--font-size);
75
+ -webkit-font-smoothing: antialiased;
76
+ -moz-osx-font-smoothing: grayscale;
77
+ line-height: normal;
78
+ }
79
+
80
+ *, :before, :after {
81
+ box-sizing: border-box;
82
+ min-width: 0;
83
+ margin: 0;
84
+ padding: 0;
85
+ }
86
+
87
+ .relative {
88
+ position: relative;
89
+ }
90
+
91
+ .flex {
92
+ display: flex;
93
+ }
94
+
95
+ .flex-auto {
96
+ flex: none;
97
+ }
98
+
99
+ .flex-center {
100
+ justify-content: center;
101
+ }
102
+
103
+ .flex-column {
104
+ flex-direction: column;
105
+ }
106
+
107
+ .flex-grow {
108
+ flex: auto;
109
+ }
110
+
111
+ .flex-middle {
112
+ align-items: center;
113
+ }
114
+
115
+ .flex-wrap {
116
+ flex-wrap: wrap;
117
+ }
118
+
119
+ .padding {
120
+ padding: var(--padding);
121
+ }
122
+
123
+ .padding-t {
124
+ padding-top: var(--padding);
125
+ }
126
+
127
+ .padding-lr {
128
+ padding-left: var(--padding);
129
+ padding-right: var(--padding);
130
+ }
131
+
132
+ .padding-r {
133
+ padding-right: var(--padding);
134
+ }
135
+
136
+ .padding-small {
137
+ padding: var(--padding-small);
138
+ }
139
+
140
+ .padding-small-b {
141
+ padding-bottom: var(--padding-small);
142
+ }
143
+
144
+ .padding-small-lr {
145
+ padding-left: var(--padding-small);
146
+ padding-right: var(--padding-small);
147
+ }
148
+
149
+ .margin {
150
+ margin: var(--padding);
151
+ }
152
+
153
+ .margin-r {
154
+ margin-right: var(--padding);
155
+ }
156
+
157
+ .margin-l {
158
+ margin-left: var(--padding);
159
+ }
160
+
161
+ .margin-small-l {
162
+ margin-left: var(--padding-small);
163
+ }
164
+
165
+ .margin-small-lr {
166
+ margin-left: var(--padding-small);
167
+ margin-right: var(--padding-small);
168
+ }
169
+
170
+ .align-l {
171
+ text-align: left;
172
+ }
173
+
174
+ .align-r {
175
+ text-align: right;
176
+ }
177
+
178
+ .color-a {
179
+ color: var(--color-a);
180
+ }
181
+
182
+ .color-b {
183
+ color: var(--color-b);
184
+ }
185
+
186
+ .color-c {
187
+ color: var(--color-c);
188
+ }
189
+
190
+ .ellipsis {
191
+ white-space: nowrap;
192
+ max-width: 100%;
193
+ width: auto;
194
+ text-overflow: ellipsis;
195
+ overflow: hidden;
196
+ }
197
+
198
+ .sr-only {
199
+ width: 1px;
200
+ height: 1px;
201
+ position: absolute;
202
+ top: auto;
203
+ left: -10000px;
204
+ overflow: hidden;
205
+ }
206
+
207
+ a {
208
+ cursor: pointer;
209
+ color: rgb(var(--em-rgb-accent));
210
+ }
211
+
212
+ a:hover {
213
+ text-decoration: underline;
214
+ }
215
+
216
+ .spacer {
217
+ height: 10px;
218
+ }
219
+
220
+ [dir="rtl"] .scroll {
221
+ padding-left: 0;
222
+ padding-right: var(--padding);
223
+ }
224
+
225
+ .scroll {
226
+ padding-right: 0;
227
+ overflow-x: hidden;
228
+ overflow-y: auto;
229
+ }
230
+
231
+ .scroll::-webkit-scrollbar {
232
+ width: var(--sidebar-width);
233
+ height: var(--sidebar-width);
234
+ }
235
+
236
+ .scroll::-webkit-scrollbar-track {
237
+ border: 0;
238
+ }
239
+
240
+ .scroll::-webkit-scrollbar-button {
241
+ width: 0;
242
+ height: 0;
243
+ display: none;
244
+ }
245
+
246
+ .scroll::-webkit-scrollbar-corner {
247
+ background-color: rgba(0, 0, 0, 0);
248
+ }
249
+
250
+ .scroll::-webkit-scrollbar-thumb {
251
+ min-height: 20%;
252
+ min-height: 65px;
253
+ border: 4px solid rgb(var(--em-rgb-background));
254
+ border-radius: 8px;
255
+ }
256
+
257
+ .scroll::-webkit-scrollbar-thumb:hover {
258
+ background-color: var(--em-color-border-over) !important;
259
+ }
260
+
261
+ .scroll:hover::-webkit-scrollbar-thumb {
262
+ background-color: var(--em-color-border);
263
+ }
264
+
265
+ .sticky {
266
+ z-index: 1;
267
+ background-color: rgba(var(--em-rgb-background), .9);
268
+ -webkit-backdrop-filter: blur(4px);
269
+ backdrop-filter: blur(4px);
270
+ font-weight: 500;
271
+ position: sticky;
272
+ top: -1px;
273
+ }
274
+
275
+ [dir="rtl"] .search input[type="search"] {
276
+ padding: 10px 2.2em 10px 2em;
277
+ }
278
+
279
+ [dir="rtl"] .search .loupe {
280
+ left: auto;
281
+ right: .7em;
282
+ }
283
+
284
+ [dir="rtl"] .search .delete {
285
+ left: .7em;
286
+ right: auto;
287
+ }
288
+
289
+ .search {
290
+ z-index: 2;
291
+ position: relative;
292
+ }
293
+
294
+ .search input, .search button {
295
+ font-size: calc(var(--font-size) - 1px);
296
+ }
297
+
298
+ .search input[type="search"] {
299
+ width: 100%;
300
+ background-color: var(--em-color-border);
301
+ transition-duration: var(--duration);
302
+ transition-property: background-color, box-shadow;
303
+ transition-timing-function: var(--easing);
304
+ border: 0;
305
+ border-radius: 10px;
306
+ outline: 0;
307
+ padding: 10px 2em 10px 2.2em;
308
+ display: block;
309
+ }
310
+
311
+ .search input[type="search"]::-ms-input-placeholder {
312
+ color: inherit;
313
+ opacity: .6;
314
+ }
315
+
316
+ .search input[type="search"]::placeholder {
317
+ color: inherit;
318
+ opacity: .6;
319
+ }
320
+
321
+ .search input[type="search"], .search input[type="search"]::-webkit-search-decoration, .search input[type="search"]::-webkit-search-cancel-button, .search input[type="search"]::-webkit-search-results-button, .search input[type="search"]::-webkit-search-results-decoration {
322
+ -webkit-appearance: none;
323
+ -ms-appearance: none;
324
+ appearance: none;
325
+ }
326
+
327
+ .search input[type="search"]:focus {
328
+ background-color: rgb(var(--em-rgb-input));
329
+ box-shadow: inset 0 0 0 1px rgb(var(--em-rgb-accent)), 0 1px 3px rgba(65, 69, 73, .2);
330
+ }
331
+
332
+ .search .icon {
333
+ z-index: 1;
334
+ color: rgba(var(--em-rgb-color), .7);
335
+ position: absolute;
336
+ top: 50%;
337
+ transform: translateY(-50%);
338
+ }
339
+
340
+ .search .loupe {
341
+ pointer-events: none;
342
+ left: .7em;
343
+ }
344
+
345
+ .search .delete {
346
+ right: .7em;
347
+ }
348
+
349
+ svg {
350
+ fill: currentColor;
351
+ width: 1em;
352
+ height: 1em;
353
+ }
354
+
355
+ button {
356
+ -webkit-appearance: none;
357
+ -ms-appearance: none;
358
+ appearance: none;
359
+ cursor: pointer;
360
+ color: currentColor;
361
+ background-color: rgba(0, 0, 0, 0);
362
+ border: 0;
363
+ }
364
+
365
+ #nav {
366
+ z-index: 2;
367
+ padding-top: 12px;
368
+ padding-bottom: 12px;
369
+ padding-right: var(--sidebar-width);
370
+ position: relative;
371
+ }
372
+
373
+ #nav button {
374
+ color: var(--color-b);
375
+ transition: color var(--duration) var(--easing);
376
+ }
377
+
378
+ #nav button:hover {
379
+ color: var(--color-a);
380
+ }
381
+
382
+ #nav svg, #nav img {
383
+ width: var(--category-icon-size);
384
+ height: var(--category-icon-size);
385
+ }
386
+
387
+ #nav[dir="rtl"] .bar {
388
+ left: auto;
389
+ right: 0;
390
+ }
391
+
392
+ #nav .bar {
393
+ width: 100%;
394
+ height: 3px;
395
+ background-color: rgb(var(--em-rgb-accent));
396
+ transition: transform var(--duration) var(--easing);
397
+ border-radius: 3px 3px 0 0;
398
+ position: absolute;
399
+ bottom: -12px;
400
+ left: 0;
401
+ }
402
+
403
+ #nav button[aria-selected] {
404
+ color: rgb(var(--em-rgb-accent));
405
+ }
406
+
407
+ #preview {
408
+ z-index: 2;
409
+ padding: calc(var(--padding) + 4px) var(--padding);
410
+ padding-right: var(--sidebar-width);
411
+ position: relative;
412
+ }
413
+
414
+ #preview .preview-placeholder {
415
+ font-size: var(--preview-placeholder-size);
416
+ }
417
+
418
+ #preview .preview-title {
419
+ font-size: var(--preview-title-size);
420
+ }
421
+
422
+ #preview .preview-subtitle {
423
+ font-size: var(--preview-subtitle-size);
424
+ }
425
+
426
+ #nav:before, #preview:before {
427
+ content: "";
428
+ height: 2px;
429
+ position: absolute;
430
+ left: 0;
431
+ right: 0;
432
+ }
433
+
434
+ #nav[data-position="top"]:before, #preview[data-position="top"]:before {
435
+ background: linear-gradient(to bottom, var(--em-color-border), transparent);
436
+ top: 100%;
437
+ }
438
+
439
+ #nav[data-position="bottom"]:before, #preview[data-position="bottom"]:before {
440
+ background: linear-gradient(to top, var(--em-color-border), transparent);
441
+ bottom: 100%;
442
+ }
443
+
444
+ .category:last-child {
445
+ min-height: calc(100% + 1px);
446
+ }
447
+
448
+ .category button {
449
+ font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif;
450
+ position: relative;
451
+ }
452
+
453
+ .category button > * {
454
+ position: relative;
455
+ }
456
+
457
+ .category button .background {
458
+ opacity: 0;
459
+ background-color: var(--em-color-border);
460
+ transition: opacity var(--duration-fast) var(--easing) var(--duration-instant);
461
+ position: absolute;
462
+ top: 0;
463
+ bottom: 0;
464
+ left: 0;
465
+ right: 0;
466
+ }
467
+
468
+ .category button:hover .background {
469
+ transition-duration: var(--duration-instant);
470
+ transition-delay: 0s;
471
+ }
472
+
473
+ .category button[aria-selected] .background {
474
+ opacity: 1;
475
+ }
476
+
477
+ .category button[data-keyboard] .background {
478
+ transition: none;
479
+ }
480
+
481
+ .row {
482
+ width: 100%;
483
+ position: absolute;
484
+ top: 0;
485
+ left: 0;
486
+ }
487
+
488
+ .skin-tone-button {
489
+ border: 1px solid rgba(0, 0, 0, 0);
490
+ border-radius: 100%;
491
+ }
492
+
493
+ .skin-tone-button:hover {
494
+ border-color: var(--em-color-border);
495
+ }
496
+
497
+ .skin-tone-button:active .skin-tone {
498
+ transform: scale(.85) !important;
499
+ }
500
+
501
+ .skin-tone-button .skin-tone {
502
+ transition: transform var(--duration) var(--easing);
503
+ }
504
+
505
+ .skin-tone-button[aria-selected] {
506
+ background-color: var(--em-color-border);
507
+ border-top-color: rgba(0, 0, 0, .05);
508
+ border-bottom-color: rgba(0, 0, 0, 0);
509
+ border-left-width: 0;
510
+ border-right-width: 0;
511
+ }
512
+
513
+ .skin-tone-button[aria-selected] .skin-tone {
514
+ transform: scale(.9);
515
+ }
516
+
517
+ .menu {
518
+ z-index: 2;
519
+ white-space: nowrap;
520
+ border: 1px solid var(--em-color-border);
521
+ background-color: rgba(var(--em-rgb-background), .9);
522
+ -webkit-backdrop-filter: blur(4px);
523
+ backdrop-filter: blur(4px);
524
+ transition-property: opacity, transform;
525
+ transition-duration: var(--duration);
526
+ transition-timing-function: var(--easing);
527
+ border-radius: 10px;
528
+ padding: 4px;
529
+ position: absolute;
530
+ box-shadow: 1px 1px 5px rgba(0, 0, 0, .05);
531
+ }
532
+
533
+ .menu.hidden {
534
+ opacity: 0;
535
+ }
536
+
537
+ .menu[data-position="bottom"] {
538
+ transform-origin: 100% 100%;
539
+ }
540
+
541
+ .menu[data-position="bottom"].hidden {
542
+ transform: scale(.9)rotate(-3deg)translateY(5%);
543
+ }
544
+
545
+ .menu[data-position="top"] {
546
+ transform-origin: 100% 0;
547
+ }
548
+
549
+ .menu[data-position="top"].hidden {
550
+ transform: scale(.9)rotate(3deg)translateY(-5%);
551
+ }
552
+
553
+ .menu input[type="radio"] {
554
+ clip: rect(0 0 0 0);
555
+ width: 1px;
556
+ height: 1px;
557
+ border: 0;
558
+ margin: 0;
559
+ padding: 0;
560
+ position: absolute;
561
+ overflow: hidden;
562
+ }
563
+
564
+ .menu input[type="radio"]:checked + .option {
565
+ box-shadow: 0 0 0 2px rgb(var(--em-rgb-accent));
566
+ }
567
+
568
+ .option {
569
+ width: 100%;
570
+ border-radius: 6px;
571
+ padding: 4px 6px;
572
+ }
573
+
574
+ .option:hover {
575
+ color: #fff;
576
+ background-color: rgb(var(--em-rgb-accent));
577
+ }
578
+
579
+ .skin-tone {
580
+ width: 16px;
581
+ height: 16px;
582
+ border-radius: 100%;
583
+ display: inline-block;
584
+ position: relative;
585
+ overflow: hidden;
586
+ }
587
+
588
+ .skin-tone:after {
589
+ content: "";
590
+ mix-blend-mode: overlay;
591
+ background: linear-gradient(rgba(255, 255, 255, .2), rgba(0, 0, 0, 0));
592
+ border: 1px solid rgba(0, 0, 0, .8);
593
+ border-radius: 100%;
594
+ position: absolute;
595
+ top: 0;
596
+ bottom: 0;
597
+ left: 0;
598
+ right: 0;
599
+ box-shadow: inset 0 -2px 3px #000, inset 0 1px 2px #fff;
600
+ }
601
+
602
+ .skin-tone-1 {
603
+ background-color: #ffc93a;
604
+ }
605
+
606
+ .skin-tone-2 {
607
+ background-color: #ffdab7;
608
+ }
609
+
610
+ .skin-tone-3 {
611
+ background-color: #e7b98f;
612
+ }
613
+
614
+ .skin-tone-4 {
615
+ background-color: #c88c61;
616
+ }
617
+
618
+ .skin-tone-5 {
619
+ background-color: #a46134;
620
+ }
621
+
622
+ .skin-tone-6 {
623
+ background-color: #5d4437;
624
+ }
625
+
626
+ [data-index] {
627
+ justify-content: space-between;
628
+ }
629
+
630
+ [data-emoji-set="twitter"] .skin-tone:after {
631
+ box-shadow: none;
632
+ border-color: rgba(0, 0, 0, .5);
633
+ }
634
+
635
+ [data-emoji-set="twitter"] .skin-tone-1 {
636
+ background-color: #fade72;
637
+ }
638
+
639
+ [data-emoji-set="twitter"] .skin-tone-2 {
640
+ background-color: #f3dfd0;
641
+ }
642
+
643
+ [data-emoji-set="twitter"] .skin-tone-3 {
644
+ background-color: #eed3a8;
645
+ }
646
+
647
+ [data-emoji-set="twitter"] .skin-tone-4 {
648
+ background-color: #cfad8d;
649
+ }
650
+
651
+ [data-emoji-set="twitter"] .skin-tone-5 {
652
+ background-color: #a8805d;
653
+ }
654
+
655
+ [data-emoji-set="twitter"] .skin-tone-6 {
656
+ background-color: #765542;
657
+ }
658
+
659
+ [data-emoji-set="google"] .skin-tone:after {
660
+ box-shadow: inset 0 0 2px 2px rgba(0, 0, 0, .4);
661
+ }
662
+
663
+ [data-emoji-set="google"] .skin-tone-1 {
664
+ background-color: #f5c748;
665
+ }
666
+
667
+ [data-emoji-set="google"] .skin-tone-2 {
668
+ background-color: #f1d5aa;
669
+ }
670
+
671
+ [data-emoji-set="google"] .skin-tone-3 {
672
+ background-color: #d4b48d;
673
+ }
674
+
675
+ [data-emoji-set="google"] .skin-tone-4 {
676
+ background-color: #aa876b;
677
+ }
678
+
679
+ [data-emoji-set="google"] .skin-tone-5 {
680
+ background-color: #916544;
681
+ }
682
+
683
+ [data-emoji-set="google"] .skin-tone-6 {
684
+ background-color: #61493f;
685
+ }
686
+
687
+ [data-emoji-set="facebook"] .skin-tone:after {
688
+ border-color: rgba(0, 0, 0, .4);
689
+ box-shadow: inset 0 -2px 3px #000, inset 0 1px 4px #fff;
690
+ }
691
+
692
+ [data-emoji-set="facebook"] .skin-tone-1 {
693
+ background-color: #f5c748;
694
+ }
695
+
696
+ [data-emoji-set="facebook"] .skin-tone-2 {
697
+ background-color: #f1d5aa;
698
+ }
699
+
700
+ [data-emoji-set="facebook"] .skin-tone-3 {
701
+ background-color: #d4b48d;
702
+ }
703
+
704
+ [data-emoji-set="facebook"] .skin-tone-4 {
705
+ background-color: #aa876b;
706
+ }
707
+
708
+ [data-emoji-set="facebook"] .skin-tone-5 {
709
+ background-color: #916544;
710
+ }
711
+
712
+ [data-emoji-set="facebook"] .skin-tone-6 {
713
+ background-color: #61493f;
714
+ }
715
+
716
+ `;function Yt(t){let e=(0,R.useRef)(null),n=(0,R.useRef)(null);return n.current&&n.current.update(t),(0,R.useEffect)(()=>(n.current=new H({...t,ref:e}),()=>{n.current=null}),[]),R.default.createElement("div",{ref:e})}export{Yt as default};