var app=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function i(e){e.forEach(t)}function r(e){return"function"==typeof e}function s(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let o;function l(e,t){return o||(o=document.createElement("a")),o.href=t,e===o.href}const a="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function c(e,t){e.appendChild(t)}function u(e,t,n){e.insertBefore(t,n||null)}function d(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t){for(let n=0;n No banned pubkeys configured.1024)throw new Error(`expected ${s}-1024 bytes of input, got ${i}`);const o=et(n?Re(e):Te(e),t-Ve)+Ve;return n?_e(o,r):Ue(o,r)}(t.randomBytes(e),t.n)},precompute:(e=8,t=a.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function y(e){const t=e instanceof Uint8Array,n="string"==typeof e,i=(t||n)&&e.length;return t?i===r||i===s:n?i===2*r||i===2*s:e instanceof a}const v=t.bits2int||function(e){const n=Re(e),i=8*e.length-t.nBitLength;return i>0?n>>BigInt(i):n},w=t.bits2int_modN||function(e){return o(v(e))},A=Oe(t.nBitLength);function b(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(gt<=e&&ee in r))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:u}=t;let{lowS:f,prehash:h,extraEntropy:m}=r;null==f&&(f=!0),e=Ne("msgHash",e),h&&(e=Ne("prehashed msgHash",s(e)));const y=w(e),A=c(i),k=[b(A),b(y)];if(null!=m){const e=!0===m?u(n.BYTES):m;k.push(Ne("extraEntropy",e))}const C=Le(...k),E=y;return{seed:C,k2sig:function(e){const t=v(e);if(!d(t))return;const n=l(t),i=a.BASE.multiply(t).toAffine(),r=o(i.x);if(r===gt)return;const s=o(n*o(E+r*A));if(s===gt)return;let c=(i.x===r?0:2)|Number(i.y&mt),u=s;return f&&p(s)&&(u=function(e){return p(e)?o(-e):e}(s),c^=1),new g(r,u,c)}}}const I={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};return a.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return a.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(y(e))throw new Error("first arg must be private key");if(!y(t))throw new Error("second arg must be public key");return a.fromHex(t).multiply(c(e)).toRawBytes(n)},sign:function(e,n,i=I){const{seed:r,k2sig:s}=k(e,n,i),o=t;return je(o.hash.outputLen,o.nByteLength,o.hmac)(r,s)},verify:function(e,n,i,r=C){const s=e;if(n=Ne("msgHash",n),i=Ne("publicKey",i),"strict"in r)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=r;let d,f;try{if("string"==typeof s||s instanceof Uint8Array)try{d=g.fromDER(s)}catch(e){if(!(e instanceof ht.Err))throw e;d=g.fromCompact(s)}else{if("object"!=typeof s||"bigint"!=typeof s.r||"bigint"!=typeof s.s)throw new Error("PARSE");{const{r:e,s:t}=s;d=new g(e,t)}}f=a.fromHex(i)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&d.hasHighS())return!1;u&&(n=t.hash(n));const{r:p,s:h}=d,m=w(n),y=l(h),v=o(m*y),A=o(p*y),b=a.BASE.multiplyAndAddUnsafe(f,v,A)?.toAffine();return!!b&&o(b.x)===p},ProjectivePoint:a,Signature:g,utils:m}}BigInt(4);let At=class extends he{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");oe(e.outputLen),oe(e.blockLen)}(e);const n=pe(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,r=new Uint8Array(i);r.set(n.length>i?e.create().update(n).digest():n);for(let e=0;ei?e.create().update(n).digest():n);for(let e=0;e1||l(e,t)})},t&&(i[e]=t(i[e])))}function l(e,t){try{(n=r[e](t)).value instanceof na?Promise.resolve(n.value.v).then(a,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function a(e){l("next",e)}function c(e){l("throw",e)}function u(e,t){e(t),s.shift(),s.length&&l(s[0][0],s[0][1])}}function ra(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Xl(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise(function(i,r){(function(e,t,n,i){Promise.resolve(i).then(function(t){e({value:t,done:n})},t)})(i,r,(t=e[n](t)).done,t.value)})}}}function sa(e){return"function"==typeof e}function oa(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var la=oa(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function aa(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ca=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,i,r;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=Xl(s),l=o.next();!l.done;l=o.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else s.remove(this);var a=this.initialTeardown;if(sa(a))try{a()}catch(e){r=e instanceof la?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=Xl(c),d=u.next();!d.done;d=u.next()){var f=d.value;try{fa(f)}catch(e){r=null!=r?r:[],e instanceof la?r=ta(ta([],ea(r)),ea(e.errors)):r.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}if(r)throw new la(r)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)fa(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&aa(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&aa(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),ua=ca.EMPTY;function da(e){return e instanceof ca||e&&"closed"in e&&sa(e.remove)&&sa(e.add)&&sa(e.unsubscribe)}function fa(e){sa(e)?e():e.unsubscribe()}var pa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ha={setTimeout:function(e,t){for(var n=[],i=2;i>18&63)+Jp.charAt(n>>12&63)+Jp.charAt(n>>6&63)+Jp.charAt(63&n);r.push(i)}if(1===i){const i=e[n-1],s=Jp.charAt(i>>2),o=Jp.charAt(i<<4&63);r.push(`${s}${o}`),t&&r.push("==")}else if(2===i){const i=(e[n-2]<<8)+e[n-1],s=Jp.charAt(i>>10),o=Jp.charAt(i>>4&63),l=Jp.charAt(i<<2&63);r.push(`${s}${o}${l}`),t&&r.push("=")}return r.join("")}function qp(e){const t=function(e){let t=Math.floor(.75*e.length);const n=e.length;return"="===e[n-1]&&(t-=1,"="===e[n-2]&&(t-=1)),t}(e),n=e.length,i=new Uint8Array(t);let r=0;for(let t=0;t
No banned events configured.
",A(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function eg(e){let t,n=e[11],i=[];for(let t=0;tNo blocked IPs configured.
",A(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ag(e){let t,n=e[16],i=[];for(let t=0;tNo allowed kinds configured. All kinds are\n allowed by default.
",A(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function pg(e){let t,n=e[19],i=[];for(let t=0;tNo events need moderation at this time.
",A(n,"class","no-items svelte-1y8wjwc")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function yg(e){let t,n=e[21],i=[];for(let t=0;tConfigure access control using NIP-86 management API
\nAdmin or owner permission required for import functionality.
',A(n,"class","permission-denied svelte-nonyqh")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Yg(e){let t,n,r,s,o,l,a,f,h,y,w,b,k,I,C=e[2]&&Wg(e);return{c(){t=p("h3"),t.textContent="Import Events",n=m(),r=p("p"),r.textContent="Upload a JSONL file to import events into the database.",s=m(),o=p("div"),l=p("input"),a=m(),f=p("div"),h=p("button"),y=g("Import Events"),b=m(),C&&C.c(),A(t,"class","svelte-nonyqh"),A(r,"class","svelte-nonyqh"),A(l,"type","file"),A(l,"id","import-file"),A(l,"accept",".jsonl,.txt"),A(l,"class","svelte-nonyqh"),A(h,"class","import-btn svelte-nonyqh"),h.disabled=w=!e[1]||"Uploading..."===e[2],A(f,"class","import-row svelte-nonyqh"),A(o,"class","recovery-controls-card svelte-nonyqh")},m(i,d){u(i,t,d),u(i,n,d),u(i,r,d),u(i,s,d),u(i,o,d),c(o,l),c(o,a),c(o,f),c(f,h),c(h,y),c(f,b),C&&C.m(f,null),k||(I=[v(l,"change",e[4]),v(h,"click",e[5])],k=!0)},p(e,t){6&t&&w!==(w=!e[1]||"Uploading..."===e[2])&&(h.disabled=w),e[2]?C?C.p(e,t):(C=Wg(e),C.c(),C.m(f,null)):C&&(C.d(1),C=null)},d(e){e&&d(t),e&&d(n),e&&d(r),e&&d(s),e&&d(o),C&&C.d(),k=!1,i(I)}}}function Wg(e){let t,n;return{c(){t=p("span"),n=g(e[2]),A(t,"class","import-message svelte-nonyqh"),S(t,"uploading","Uploading..."===e[2]),S(t,"success","Upload complete"===e[2]),S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},m(e,i){u(e,t,i),c(t,n)},p(e,i){4&i&&k(n,e[2]),4&i&&S(t,"uploading","Uploading..."===e[2]),4&i&&S(t,"success","Upload complete"===e[2]),4&i&&S(t,"error",e[2].startsWith("Import failed")||e[2].startsWith("Admin")||e[2].startsWith("Please"))},d(e){e&&d(t)}}}function Zg(t){let n;function i(e,t){return e[3]?Yg:e[0]?qg:Vg}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),A(n,"class","import-section svelte-nonyqh")},m(e,t){u(e,n,t),s.m(n,null)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function Xg(e,t,n){let i,{isLoggedIn:r=!1}=t,{currentEffectiveRole:s=""}=t,{selectedFile:o=null}=t,{aclMode:l=""}=t,{importMessage:a=""}=t;const c=P();return e.$$set=e=>{"isLoggedIn"in e&&n(0,r=e.isLoggedIn),"currentEffectiveRole"in e&&n(7,s=e.currentEffectiveRole),"selectedFile"in e&&n(1,o=e.selectedFile),"aclMode"in e&&n(8,l=e.aclMode),"importMessage"in e&&n(2,a=e.importMessage)},e.$$.update=()=>{385&e.$$.dirty&&n(3,i="none"===l||r&&("admin"===s||"owner"===s))},[r,o,a,i,function(e){c("fileSelect",e)},function(){c("importEvents")},function(){c("openLoginModal")},s,l]}class em extends se{constructor(e){super(),re(this,e,Xg,Zg,s,{isLoggedIn:0,currentEffectiveRole:7,selectedFile:1,aclMode:8,importMessage:2})}}const tm={0:"Profile Metadata",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete Request",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1063:"File Metadata",1311:"Live Chat Message",1984:"Reporting",1985:"Label",9734:"Zap Request",9735:"Zap Receipt",1e4:"Mute List",10001:"Pin List",10002:"Relay List Metadata",10003:"Bookmark List",10004:"Communities List",10005:"Public Chats List",10006:"Blocked Relays List",10007:"Search Relays List",10009:"User Groups",10015:"Interests List",10030:"User Emoji List",13194:"Wallet Info",22242:"Client Auth",23194:"Wallet Request",23195:"Wallet Response",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People List",30001:"Categorized Bookmarks",30002:"Categorized Relay List",30003:"Bookmark Sets",30004:"Curation Sets",30005:"Video Sets",30008:"Profile Badges",30009:"Badge Definition",30015:"Interest Sets",30017:"Create/Update Stall",30018:"Create/Update Product",30019:"Marketplace UI/UX",30020:"Product Sold As Auction",30023:"Long-form Content",30024:"Draft Long-form Content",30030:"Emoji Sets",30063:"Release Artifact Sets",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30388:"Slide Set",30402:"Classified Listing",30403:"Draft Classified Listing",30617:"Repository Announcement",30618:"Repository State Announcement",30818:"Wiki Article",30819:"Redirects",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler Recommendation",31990:"Handler Information",34550:"Community Definition",34551:"Community Post Approval"};function nm(e,t=null){if(!e||"string"!=typeof e)return!1;return!!/^[0-9a-fA-F]+$/.test(e)&&(!t||e.length===t)}function im(e){const t=new Date(1e3*e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function rm(e){return Math.floor(new Date(e).getTime()/1e3)}function sm(e,t,n){const i=e.slice();return i[62]=t[n],i[64]=n,i}function om(e,t,n){const i=e.slice();return i[65]=t[n],i}function lm(e,t,n){const i=e.slice();return i[68]=t[n],i}function am(e,t,n){const i=e.slice();return i[71]=t[n],i}function cm(e,t,n){const i=e.slice();return i[71]=t[n].kind,i[74]=t[n].name,i}function um(e){let t,n,i,r,s,o,l=e[20],a=[];for(let t=0;t❌ Read, write, admin, or owner permission required to view all\n events.
",A(n,"class","permission-denied svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Pm(e){let t,n,i,r;function s(e,t){return e[4].length>0?Tm:e[6]?void 0:Rm}let o=s(e),l=o&&o(e),a=e[6]&&jm();return{c(){t=p("div"),l&&l.c(),n=m(),a&&a.c(),A(t,"class","events-view-content svelte-5kb1ec")},m(s,o){u(s,t,o),l&&l.m(t,null),c(t,n),a&&a.m(t,null),i||(r=v(t,"scroll",e[9]),i=!0)},p(e,i){o===(o=s(e))&&l?l.p(e,i):(l&&l.d(1),l=o&&o(e),l&&(l.c(),l.m(t,n))),e[6]?a||(a=jm(),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},d(e){e&&d(t),l&&l.d(),a&&a.d(),i=!1,r()}}}function Rm(t){let n;return{c(){n=p("div"),n.innerHTML="No events found.
",A(n,"class","no-events svelte-5kb1ec")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Tm(e){let t,n=e[4],i=[];for(let t=0;tLoading events...
',A(t,"class","loading-events svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Hm(e){let t,n,r,s,o,l,a,f,h,y,w,b,k,I,C,E,x,B,Q,F,D,$,P,R;function T(e,t){return e[6]?Jm:Gm}r=new Qm({props:{showJsonEditor:e[8]}}),r.$on("apply",e[17]),r.$on("clear",e[18]),r.$on("toggleJson",e[16]);let U=T(e),_=U(e);return{c(){t=p("div"),n=p("div"),ee(r.$$.fragment),s=m(),o=p("div"),l=p("div"),a=p("button"),a.innerHTML='',f=m(),h=p("div"),y=p("label"),w=p("input"),b=m(),k=p("span"),I=m(),C=p("span"),C.textContent="Only show my events",E=m(),x=p("div"),B=p("button"),Q=g("🔄 Load More"),F=m(),D=p("button"),_.c(),A(n,"class","filter-panel svelte-5kb1ec"),S(n,"open",e[7]),A(a,"class","filter-btn svelte-5kb1ec"),A(a,"title","Filter events"),S(a,"active",e[7]),A(w,"type","checkbox"),A(w,"class","svelte-5kb1ec"),A(k,"class","toggle-slider svelte-5kb1ec"),A(C,"class","toggle-label svelte-5kb1ec"),A(y,"class","toggle-container svelte-5kb1ec"),A(h,"class","events-view-toggle svelte-5kb1ec"),A(l,"class","events-view-left svelte-5kb1ec"),A(B,"class","refresh-btn svelte-5kb1ec"),B.disabled=e[6],A(D,"class","reload-btn svelte-5kb1ec"),D.disabled=e[6],A(x,"class","events-view-buttons svelte-5kb1ec"),A(o,"class","events-view-header svelte-5kb1ec"),A(t,"class","events-view-footer svelte-5kb1ec")},m(i,d){u(i,t,d),c(t,n),te(r,n,null),c(t,s),c(t,o),c(o,l),c(l,a),c(l,f),c(l,h),c(h,y),c(y,w),w.checked=e[0],c(y,b),c(y,k),c(y,I),c(y,C),c(o,E),c(o,x),c(x,B),c(B,Q),c(x,F),c(x,D),_.m(D,null),$=!0,P||(R=[v(a,"click",e[15]),v(w,"change",e[23]),v(w,"change",e[24]),v(B,"click",e[25]),v(D,"click",e[26])],P=!0)},p(e,t){const i={};256&t[0]&&(i.showJsonEditor=e[8]),r.$set(i),(!$||128&t[0])&&S(n,"open",e[7]),(!$||128&t[0])&&S(a,"active",e[7]),1&t[0]&&(w.checked=e[0]),(!$||64&t[0])&&(B.disabled=e[6]),U!==(U=T(e))&&(_.d(1),_=U(e),_&&(_.c(),_.m(D,null))),(!$||64&t[0])&&(D.disabled=e[6])},i(e){$||(W(r.$$.fragment,e),$=!0)},o(e){Z(r.$$.fragment,e),$=!1},d(e){e&&d(t),ne(r),_.d(),P=!1,i(R)}}}function Gm(e){let t;return{c(){t=g("🔄")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Jm(e){let t;return{c(){t=p("div"),A(t,"class","spinner svelte-5kb1ec")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Km(e){let t,n,i;function r(e,t){return!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?$m:Pm}let s=r(e),o=s(e),l=e[1]&&("read"===e[2]||"write"===e[2]||"admin"===e[2]||"owner"===e[2])&&Hm(e);return{c(){t=p("div"),o.c(),n=m(),l&&l.c(),A(t,"class","events-view-container svelte-5kb1ec")},m(e,r){u(e,t,r),o.m(t,null),c(t,n),l&&l.m(t,null),i=!0},p(e,i){s===(s=r(e))&&o?o.p(e,i):(o.d(1),o=s(e),o&&(o.c(),o.m(t,n))),!e[1]||"read"!==e[2]&&"write"!==e[2]&&"admin"!==e[2]&&"owner"!==e[2]?l&&(q(),Z(l,1,1,()=>{l=null}),Y()):l?(l.p(e,i),6&i[0]&&W(l,1)):(l=Hm(e),l.c(),W(l,1),l.m(t,null))},i(e){i||(W(l),i=!0)},o(e){Z(l),i=!1},d(e){e&&d(t),o.d(),l&&l.d()}}}function Vm(e){return e?e.slice(0,8)+"..."+e.slice(-8):""}function qm(e){return{0:"Profile",1:"Text Note",2:"Recommend Relay",3:"Contacts",4:"Encrypted DM",5:"Delete",6:"Repost",7:"Reaction",8:"Badge Award",16:"Generic Repost",40:"Channel Creation",41:"Channel Metadata",42:"Channel Message",43:"Channel Hide Message",44:"Channel Mute User",1984:"Reporting",9734:"Zap Request",9735:"Zap",1e4:"Mute List",10001:"Pin List",10002:"Relay List",22242:"Client Auth",24133:"Nostr Connect",27235:"HTTP Auth",3e4:"Categorized People",30001:"Categorized Bookmarks",30008:"Profile Badges",30009:"Badge Definition",30017:"Create or update a stall",30018:"Create or update a product",30023:"Long-form Content",30024:"Draft Long-form Content",30078:"Application-specific Data",30311:"Live Event",30315:"User Statuses",30402:"Classified Listing",30403:"Draft Classified Listing",31922:"Date-Based Calendar Event",31923:"Time-Based Calendar Event",31924:"Calendar",31925:"Calendar Event RSVP",31989:"Handler recommendation",31990:"Handler information",34550:"Community Definition"}[e]||`Kind ${e}`}function Ym(e){return new Date(1e3*e).toLocaleString()}function Wm(e){return e?e.length>100?e.slice(0,100)+"...":e:""}const Zm=e=>"e"===e[0];function Xm(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userPubkey:s=""}=t,{filteredEvents:o=[]}=t,{expandedEvents:l=new Set}=t,{isLoadingEvents:a=!1}=t,{showOnlyMyEvents:c=!1}=t,{showFilterBuilder:u=!1}=t;const d=P();let f=!1;function p(e){d("toggleEventExpansion",e)}function h(e){d("deleteEvent",e)}function g(e,t){d("copyEventToClipboard",{event:e,e:t})}function m(){d("toggleChange")}function y(e,t){d("loadAllEvents",{refresh:e,authors:t})}return e.$$set=e=>{"isLoggedIn"in e&&n(1,i=e.isLoggedIn),"userRole"in e&&n(2,r=e.userRole),"userPubkey"in e&&n(3,s=e.userPubkey),"filteredEvents"in e&&n(4,o=e.filteredEvents),"expandedEvents"in e&&n(5,l=e.expandedEvents),"isLoadingEvents"in e&&n(6,a=e.isLoadingEvents),"showOnlyMyEvents"in e&&n(0,c=e.showOnlyMyEvents),"showFilterBuilder"in e&&n(7,u=e.showFilterBuilder)},[c,i,r,s,o,l,a,u,f,function(e){d("scroll",e)},p,h,g,m,y,function(){d("toggleFilterBuilder")},function(){n(8,f=!f)},function(e){d("filterApply",e.detail)},function(){d("filterClear")},e=>h(e.id),e=>p(e.id),(e,t)=>"Enter"===t.key&&p(e.id),(e,t)=>g(e,t),function(){c=this.checked,n(0,c)},()=>m(),()=>{y(!1,c&&s?[s]:null)},()=>{y(!0,c&&s?[s]:null)}]}class ey extends se{constructor(e){super(),re(this,e,Xm,Km,s,{isLoggedIn:1,userRole:2,userPubkey:3,filteredEvents:4,expandedEvents:5,isLoadingEvents:6,showOnlyMyEvents:0,showFilterBuilder:7},null,[-1,-1])}}const ty=[{kind:0,name:"Metadata",description:"User profile information (name, about, picture, nip05, etc.)",nip:"01",isReplaceable:!0,template:{kind:0,content:"",tags:[]}},{kind:1,name:"Short Text Note",description:"Short-form text post (like a tweet)",nip:"01",template:{kind:1,content:"",tags:[]}},{kind:2,name:"Recommend Relay",description:"Relay recommendation",nip:"01",deprecated:!0,template:{kind:2,content:"",tags:[]}},{kind:3,name:"Follows",description:"Following list with optional relay hints",nip:"02",isReplaceable:!0,template:{kind:3,content:"",tags:[]}},{kind:4,name:"Encrypted Direct Message",description:"Private message using NIP-04 encryption",nip:"04",deprecated:!0,template:{kind:4,content:"",tags:[]}},{kind:5,name:"Event Deletion Request",description:"Request to delete events",nip:"09",template:{kind:5,content:"",tags:[]}},{kind:6,name:"Repost",description:"Share/repost another text note",nip:"18",template:{kind:6,content:"",tags:[]}},{kind:7,name:"Reaction",description:"Like, emoji reaction to an event",nip:"25",template:{kind:7,content:"",tags:[]}},{kind:8,name:"Badge Award",description:"Award a badge to someone",nip:"58",template:{kind:8,content:"",tags:[]}},{kind:9,name:"Chat Message",description:"Chat message",nip:"C7",template:{kind:9,content:"",tags:[]}},{kind:10,name:"Group Chat Threaded Reply",description:"Threaded reply in group chat",nip:"29",deprecated:!0,template:{kind:10,content:"",tags:[]}},{kind:11,name:"Thread",description:"Thread event",nip:"7D",template:{kind:11,content:"",tags:[]}},{kind:12,name:"Group Thread Reply",description:"Reply in group thread",nip:"29",deprecated:!0,template:{kind:12,content:"",tags:[]}},{kind:13,name:"Seal",description:"Sealed/encrypted event wrapper",nip:"59",template:{kind:13,content:"",tags:[]}},{kind:14,name:"Direct Message",description:"Private direct message using NIP-17",nip:"17",template:{kind:14,content:"",tags:[]}},{kind:15,name:"File Message",description:"File message in DMs",nip:"17",template:{kind:15,content:"",tags:[]}},{kind:16,name:"Generic Repost",description:"Repost any event kind",nip:"18",template:{kind:16,content:"",tags:[]}},{kind:17,name:"Reaction to Website",description:"Reaction to a website URL",nip:"25",template:{kind:17,content:"",tags:[]}},{kind:20,name:"Picture",description:"Picture-first feed post",nip:"68",template:{kind:20,content:"",tags:[]}},{kind:21,name:"Video Event",description:"Horizontal video event",nip:"71",template:{kind:21,content:"",tags:[]}},{kind:22,name:"Short-form Video",description:"Short-form portrait video (like TikTok)",nip:"71",template:{kind:22,content:"",tags:[]}},{kind:40,name:"Channel Creation",description:"Create a public chat channel",nip:"28",template:{kind:40,content:"",tags:[]}},{kind:41,name:"Channel Metadata",description:"Set channel name, about, picture",nip:"28",template:{kind:41,content:"",tags:[]}},{kind:42,name:"Channel Message",description:"Post message in channel",nip:"28",template:{kind:42,content:"",tags:[]}},{kind:43,name:"Channel Hide Message",description:"Hide a message in channel",nip:"28",template:{kind:43,content:"",tags:[]}},{kind:44,name:"Channel Mute User",description:"Mute a user in channel",nip:"28",template:{kind:44,content:"",tags:[]}},{kind:62,name:"Request to Vanish",description:"Request permanent deletion of all user data",nip:"62",template:{kind:62,content:"",tags:[]}},{kind:64,name:"Chess (PGN)",description:"Chess game in PGN format",nip:"64",template:{kind:64,content:"",tags:[]}},{kind:443,name:"KeyPackage",description:"Marmot protocol key package",nip:null,spec:"Marmot",template:{kind:443,content:"",tags:[]}},{kind:444,name:"Welcome Message",description:"Marmot protocol welcome message",nip:null,spec:"Marmot",template:{kind:444,content:"",tags:[]}},{kind:445,name:"Group Event",description:"Marmot protocol group event",nip:null,spec:"Marmot",template:{kind:445,content:"",tags:[]}},{kind:818,name:"Merge Requests",description:"Git merge request",nip:"54",template:{kind:818,content:"",tags:[]}},{kind:1018,name:"Poll Response",description:"Response to a poll",nip:"88",template:{kind:1018,content:"",tags:[]}},{kind:1021,name:"Bid",description:"Auction bid",nip:"15",template:{kind:1021,content:"",tags:[]}},{kind:1022,name:"Bid Confirmation",description:"Confirmation of auction bid",nip:"15",template:{kind:1022,content:"",tags:[]}},{kind:1040,name:"OpenTimestamps",description:"OpenTimestamps attestation",nip:"03",template:{kind:1040,content:"",tags:[]}},{kind:1059,name:"Gift Wrap",description:"Encrypted gift-wrapped event",nip:"59",template:{kind:1059,content:"",tags:[]}},{kind:1060,name:"Gift Wrap (Kind 4)",description:"Gift wrap variant for NIP-04 compatibility",nip:"59",template:{kind:1060,content:"",tags:[]}},{kind:1063,name:"File Metadata",description:"Metadata for shared files",nip:"94",template:{kind:1063,content:"",tags:[]}},{kind:1068,name:"Poll",description:"Create a poll",nip:"88",template:{kind:1068,content:"",tags:[]}},{kind:1111,name:"Comment",description:"Comment on events or external content",nip:"22",template:{kind:1111,content:"",tags:[]}},{kind:1222,name:"Voice Message",description:"Voice message",nip:"A0",template:{kind:1222,content:"",tags:[]}},{kind:1244,name:"Voice Message Comment",description:"Comment on voice message",nip:"A0",template:{kind:1244,content:"",tags:[]}},{kind:1311,name:"Live Chat Message",description:"Message in live stream chat",nip:"53",template:{kind:1311,content:"",tags:[]}},{kind:1337,name:"Code Snippet",description:"Code snippet post",nip:"C0",template:{kind:1337,content:"",tags:[]}},{kind:1517,name:"Bitcoin Block",description:"Bitcoin block data",nip:null,spec:"Nostrocket",template:{kind:1517,content:"",tags:[]}},{kind:1617,name:"Patches",description:"Git patches",nip:"34",template:{kind:1617,content:"",tags:[]}},{kind:1618,name:"Pull Requests",description:"Git pull request",nip:"34",template:{kind:1618,content:"",tags:[]}},{kind:1619,name:"Pull Request Updates",description:"Updates to git pull request",nip:"34",template:{kind:1619,content:"",tags:[]}},{kind:1621,name:"Issues",description:"Git issues",nip:"34",template:{kind:1621,content:"",tags:[]}},{kind:1622,name:"Git Replies",description:"Replies on git objects",nip:"34",deprecated:!0,template:{kind:1622,content:"",tags:[]}},{kind:1630,name:"Status",description:"Git status",nip:"34",template:{kind:1630,content:"",tags:[]}},{kind:1631,name:"Status",description:"Git status",nip:"34",template:{kind:1631,content:"",tags:[]}},{kind:1632,name:"Status",description:"Git status",nip:"34",template:{kind:1632,content:"",tags:[]}},{kind:1633,name:"Status",description:"Git status",nip:"34",template:{kind:1633,content:"",tags:[]}},{kind:1808,name:"Live Stream",description:"Live streaming event",nip:null,spec:"zap.stream",template:{kind:1808,content:"",tags:[]}},{kind:1971,name:"Problem Tracker",description:"Problem tracking",nip:null,spec:"Nostrocket",template:{kind:1971,content:"",tags:[]}},{kind:1984,name:"Reporting",description:"Report content or users",nip:"56",template:{kind:1984,content:"",tags:[]}},{kind:1985,name:"Label",description:"Label/tag content with namespace",nip:"32",template:{kind:1985,content:"",tags:[]}},{kind:1986,name:"Relay Reviews",description:"Reviews of relays",nip:null,template:{kind:1986,content:"",tags:[]}},{kind:1987,name:"AI Embeddings",description:"AI embeddings/vector lists",nip:null,spec:"NKBIP-02",template:{kind:1987,content:"",tags:[]}},{kind:2003,name:"Torrent",description:"Torrent magnet link",nip:"35",template:{kind:2003,content:"",tags:[]}},{kind:2004,name:"Torrent Comment",description:"Comment on torrent",nip:"35",template:{kind:2004,content:"",tags:[]}},{kind:2022,name:"Coinjoin Pool",description:"Coinjoin coordination",nip:null,spec:"joinstr",template:{kind:2022,content:"",tags:[]}},{kind:4550,name:"Community Post Approval",description:"Approve post in community",nip:"72",template:{kind:4550,content:"",tags:[]}},{kind:5e3,name:"Job Request",description:"Data vending machine job request (start of range)",nip:"90",template:{kind:5e3,content:"",tags:[]}},{kind:6e3,name:"Job Result",description:"Data vending machine job result (start of range)",nip:"90",template:{kind:6e3,content:"",tags:[]}},{kind:7e3,name:"Job Feedback",description:"Feedback on job request/result",nip:"90",template:{kind:7e3,content:"",tags:[]}},{kind:7374,name:"Reserved Cashu Wallet Tokens",description:"Reserved Cashu wallet tokens",nip:"60",template:{kind:7374,content:"",tags:[]}},{kind:7375,name:"Cashu Wallet Tokens",description:"Cashu wallet tokens",nip:"60",template:{kind:7375,content:"",tags:[]}},{kind:7376,name:"Cashu Wallet History",description:"Cashu wallet transaction history",nip:"60",template:{kind:7376,content:"",tags:[]}},{kind:7516,name:"Geocache Log",description:"Geocaching log entry",nip:null,spec:"geocaching",template:{kind:7516,content:"",tags:[]}},{kind:7517,name:"Geocache Proof of Find",description:"Proof of geocache find",nip:null,spec:"geocaching",template:{kind:7517,content:"",tags:[]}},{kind:8e3,name:"Add User",description:"Add user to group",nip:"43",template:{kind:8e3,content:"",tags:[]}},{kind:8001,name:"Remove User",description:"Remove user from group",nip:"43",template:{kind:8001,content:"",tags:[]}},{kind:9e3,name:"Group Control Events",description:"Group control events (start of range)",nip:"29",template:{kind:9e3,content:"",tags:[]}},{kind:9041,name:"Zap Goal",description:"Fundraising goal for zaps",nip:"75",template:{kind:9041,content:"",tags:[]}},{kind:9321,name:"Nutzap",description:"Cashu nutzap",nip:"61",template:{kind:9321,content:"",tags:[]}},{kind:9467,name:"Tidal Login",description:"Tidal streaming login",nip:null,spec:"Tidal-nostr",template:{kind:9467,content:"",tags:[]}},{kind:9734,name:"Zap Request",description:"Request Lightning payment",nip:"57",template:{kind:9734,content:"",tags:[]}},{kind:9735,name:"Zap",description:"Lightning payment receipt",nip:"57",template:{kind:9735,content:"",tags:[]}},{kind:9802,name:"Highlights",description:"Highlighted text selection",nip:"84",template:{kind:9802,content:"",tags:[]}},{kind:1e4,name:"Mute List",description:"List of muted users/content",nip:"51",isReplaceable:!0,template:{kind:1e4,content:"",tags:[]}},{kind:10001,name:"Pin List",description:"Pinned events",nip:"51",isReplaceable:!0,template:{kind:10001,content:"",tags:[]}},{kind:10002,name:"Relay List Metadata",description:"User's preferred relays for read/write",nip:"65",isReplaceable:!0,template:{kind:10002,content:"",tags:[]}},{kind:10003,name:"Bookmark List",description:"Bookmarked events",nip:"51",isReplaceable:!0,template:{kind:10003,content:"",tags:[]}},{kind:10004,name:"Communities List",description:"Communities user belongs to",nip:"51",isReplaceable:!0,template:{kind:10004,content:"",tags:[]}},{kind:10005,name:"Public Chats List",description:"Public chats user is in",nip:"51",isReplaceable:!0,template:{kind:10005,content:"",tags:[]}},{kind:10006,name:"Blocked Relays List",description:"Relays user has blocked",nip:"51",isReplaceable:!0,template:{kind:10006,content:"",tags:[]}},{kind:10007,name:"Search Relays List",description:"Preferred search relays",nip:"51",isReplaceable:!0,template:{kind:10007,content:"",tags:[]}},{kind:10008,name:"Relay Group Configuration",description:"Relay group configuration",nip:null,isReplaceable:!0,template:{kind:10008,content:"",tags:[]}},{kind:10009,name:"User Groups",description:"Groups user belongs to",nip:"29",isReplaceable:!0,template:{kind:10009,content:"",tags:[]}},{kind:10012,name:"Favorite Relays List",description:"User's favorite relays",nip:"51",isReplaceable:!0,template:{kind:10012,content:"",tags:[]}},{kind:10013,name:"Private Event Relay List",description:"Relays for private events",nip:"37",isReplaceable:!0,template:{kind:10013,content:"",tags:[]}},{kind:10015,name:"Interests List",description:"User interests/topics",nip:"51",isReplaceable:!0,template:{kind:10015,content:"",tags:[]}},{kind:10019,name:"Nutzap Mint Recommendation",description:"Recommended Cashu mints for nutzaps",nip:"61",isReplaceable:!0,template:{kind:10019,content:"",tags:[]}},{kind:10020,name:"Media Follows",description:"Followed media accounts",nip:"51",isReplaceable:!0,template:{kind:10020,content:"",tags:[]}},{kind:10030,name:"User Emoji List",description:"Custom emoji list",nip:"51",isReplaceable:!0,template:{kind:10030,content:"",tags:[]}},{kind:10050,name:"DM Relays List",description:"Relays to receive DMs on",nip:"17",isReplaceable:!0,template:{kind:10050,content:"",tags:[]}},{kind:10051,name:"KeyPackage Relays List",description:"Marmot key package relays",nip:null,isReplaceable:!0,spec:"Marmot",template:{kind:10051,content:"",tags:[]}},{kind:10063,name:"User Server List",description:"Blossom server list",nip:null,isReplaceable:!0,spec:"Blossom",template:{kind:10063,content:"",tags:[]}},{kind:10096,name:"File Storage Server List",description:"File storage servers",nip:"96",isReplaceable:!0,deprecated:!0,template:{kind:10096,content:"",tags:[]}},{kind:10166,name:"Relay Monitor Announcement",description:"Relay monitoring announcement",nip:"66",isReplaceable:!0,template:{kind:10166,content:"",tags:[]}},{kind:10312,name:"Room Presence",description:"Presence in live room",nip:"53",isReplaceable:!0,template:{kind:10312,content:"",tags:[]}},{kind:10377,name:"Proxy Announcement",description:"Nostr proxy announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:10377,content:"",tags:[]}},{kind:11111,name:"Transport Method Announcement",description:"Transport method announcement",nip:null,isReplaceable:!0,spec:"Nostr Epoxy",template:{kind:11111,content:"",tags:[]}},{kind:12345,name:"Relay Policy Configuration",description:"Relay-internal policy configuration (admin only)",nip:null,isReplaceable:!0,spec:"orly",template:{kind:12345,content:"",tags:[]}},{kind:13004,name:"JWT Binding",description:"Link between JWT certificate and pubkey",nip:null,isReplaceable:!0,template:{kind:13004,content:"",tags:[]}},{kind:13194,name:"Wallet Service Info",description:"NWC wallet service information",nip:"47",isReplaceable:!0,template:{kind:13194,content:"",tags:[]}},{kind:13534,name:"Membership Lists",description:"Group membership lists",nip:"43",isReplaceable:!0,template:{kind:13534,content:"",tags:[]}},{kind:14388,name:"User Sound Effect Lists",description:"Sound effect lists",nip:null,isReplaceable:!0,spec:"Corny Chat",template:{kind:14388,content:"",tags:[]}},{kind:17375,name:"Cashu Wallet Event",description:"Cashu wallet event",nip:"60",isReplaceable:!0,template:{kind:17375,content:"",tags:[]}},{kind:21e3,name:"Lightning Pub RPC",description:"Lightning.Pub RPC",nip:null,isEphemeral:!0,spec:"Lightning.Pub",template:{kind:21e3,content:"",tags:[]}},{kind:22242,name:"Client Authentication",description:"Authenticate to relay",nip:"42",isEphemeral:!0,template:{kind:22242,content:"",tags:[]}},{kind:23194,name:"Wallet Request",description:"NWC wallet request",nip:"47",isEphemeral:!0,template:{kind:23194,content:"",tags:[]}},{kind:23195,name:"Wallet Response",description:"NWC wallet response",nip:"47",isEphemeral:!0,template:{kind:23195,content:"",tags:[]}},{kind:23196,name:"Wallet Notification (NIP-04)",description:"NWC wallet notification (NIP-04 encrypted)",nip:"47",isEphemeral:!0,template:{kind:23196,content:"",tags:[]}},{kind:23197,name:"Wallet Notification",description:"NWC wallet notification",nip:"47",isEphemeral:!0,template:{kind:23197,content:"",tags:[]}},{kind:24133,name:"Nostr Connect",description:"Remote signer connection",nip:"46",isEphemeral:!0,template:{kind:24133,content:"",tags:[]}},{kind:24242,name:"Blobs Stored on Mediaservers",description:"Blossom blob storage",nip:null,isEphemeral:!0,spec:"Blossom",template:{kind:24242,content:"",tags:[]}},{kind:27235,name:"HTTP Auth",description:"Authenticate HTTP requests",nip:"98",isEphemeral:!0,template:{kind:27235,content:"",tags:[]}},{kind:28934,name:"Join Request",description:"Request to join group",nip:"43",isEphemeral:!0,template:{kind:28934,content:"",tags:[]}},{kind:28935,name:"Invite Request",description:"Invite to group",nip:"43",isEphemeral:!0,template:{kind:28935,content:"",tags:[]}},{kind:28936,name:"Leave Request",description:"Leave group request",nip:"43",isEphemeral:!0,template:{kind:28936,content:"",tags:[]}},{kind:3e4,name:"Follow Sets",description:"Categorized people lists",nip:"51",isAddressable:!0,template:{kind:3e4,content:"",tags:[["d","identifier"]]}},{kind:30001,name:"Generic Lists",description:"Generic categorized lists",nip:"51",isAddressable:!0,deprecated:!0,template:{kind:30001,content:"",tags:[["d","identifier"]]}},{kind:30002,name:"Relay Sets",description:"Categorized relay lists",nip:"51",isAddressable:!0,template:{kind:30002,content:"",tags:[["d","identifier"]]}},{kind:30003,name:"Bookmark Sets",description:"Categorized bookmark lists",nip:"51",isAddressable:!0,template:{kind:30003,content:"",tags:[["d","identifier"]]}},{kind:30004,name:"Curation Sets",description:"Curated content sets",nip:"51",isAddressable:!0,template:{kind:30004,content:"",tags:[["d","identifier"]]}},{kind:30005,name:"Video Sets",description:"Video playlists",nip:"51",isAddressable:!0,template:{kind:30005,content:"",tags:[["d","identifier"]]}},{kind:30007,name:"Kind Mute Sets",description:"Muted event kinds",nip:"51",isAddressable:!0,template:{kind:30007,content:"",tags:[["d","identifier"]]}},{kind:30008,name:"Profile Badges",description:"Badges displayed on profile",nip:"58",isAddressable:!0,template:{kind:30008,content:"",tags:[["d","identifier"]]}},{kind:30009,name:"Badge Definition",description:"Define a badge/achievement",nip:"58",isAddressable:!0,template:{kind:30009,content:"",tags:[["d","identifier"]]}},{kind:30015,name:"Interest Sets",description:"Interest/topic sets",nip:"51",isAddressable:!0,template:{kind:30015,content:"",tags:[["d","identifier"]]}},{kind:30017,name:"Stall",description:"Marketplace stall definition",nip:"15",isAddressable:!0,template:{kind:30017,content:"",tags:[["d","identifier"]]}},{kind:30018,name:"Product",description:"Marketplace product listing",nip:"15",isAddressable:!0,template:{kind:30018,content:"",tags:[["d","identifier"]]}},{kind:30019,name:"Marketplace UI/UX",description:"Marketplace interface settings",nip:"15",isAddressable:!0,template:{kind:30019,content:"",tags:[["d","identifier"]]}},{kind:30020,name:"Product Sold as Auction",description:"Auction product listing",nip:"15",isAddressable:!0,template:{kind:30020,content:"",tags:[["d","identifier"]]}},{kind:30023,name:"Long-form Content",description:"Blog post, article in markdown",nip:"23",isAddressable:!0,template:{kind:30023,content:"",tags:[["d","identifier"]]}},{kind:30024,name:"Draft Long-form Content",description:"Draft article",nip:"23",isAddressable:!0,template:{kind:30024,content:"",tags:[["d","identifier"]]}},{kind:30030,name:"Emoji Sets",description:"Custom emoji sets",nip:"51",isAddressable:!0,template:{kind:30030,content:"",tags:[["d","identifier"]]}},{kind:30040,name:"Curated Publication Index",description:"Publication index",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30040,content:"",tags:[["d","identifier"]]}},{kind:30041,name:"Curated Publication Content",description:"Publication content",nip:null,isAddressable:!0,spec:"NKBIP-01",template:{kind:30041,content:"",tags:[["d","identifier"]]}},{kind:30063,name:"Release Artifact Sets",description:"Software release artifacts",nip:"51",isAddressable:!0,template:{kind:30063,content:"",tags:[["d","identifier"]]}},{kind:30078,name:"Application-specific Data",description:"App-specific key-value storage",nip:"78",isAddressable:!0,template:{kind:30078,content:"",tags:[["d","identifier"]]}},{kind:30166,name:"Relay Discovery",description:"Relay discovery/monitoring",nip:"66",isAddressable:!0,template:{kind:30166,content:"",tags:[["d","identifier"]]}},{kind:30267,name:"App Curation Sets",description:"Curated app sets",nip:"51",isAddressable:!0,template:{kind:30267,content:"",tags:[["d","identifier"]]}},{kind:30311,name:"Live Event",description:"Live streaming event",nip:"53",isAddressable:!0,template:{kind:30311,content:"",tags:[["d","identifier"]]}},{kind:30312,name:"Interactive Room",description:"Interactive live room",nip:"53",isAddressable:!0,template:{kind:30312,content:"",tags:[["d","identifier"]]}},{kind:30313,name:"Conference Event",description:"Conference/meetup event",nip:"53",isAddressable:!0,template:{kind:30313,content:"",tags:[["d","identifier"]]}},{kind:30315,name:"User Statuses",description:"User status updates",nip:"38",isAddressable:!0,template:{kind:30315,content:"",tags:[["d","identifier"]]}},{kind:30388,name:"Slide Set",description:"Presentation slides",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:30388,content:"",tags:[["d","identifier"]]}},{kind:30402,name:"Classified Listing",description:"Classified ad listing",nip:"99",isAddressable:!0,template:{kind:30402,content:"",tags:[["d","identifier"]]}},{kind:30403,name:"Draft Classified Listing",description:"Draft classified ad",nip:"99",isAddressable:!0,template:{kind:30403,content:"",tags:[["d","identifier"]]}},{kind:30617,name:"Repository Announcements",description:"Git repository announcement",nip:"34",isAddressable:!0,template:{kind:30617,content:"",tags:[["d","identifier"]]}},{kind:30618,name:"Repository State Announcements",description:"Git repository state",nip:"34",isAddressable:!0,template:{kind:30618,content:"",tags:[["d","identifier"]]}},{kind:30818,name:"Wiki Article",description:"Wiki article",nip:"54",isAddressable:!0,template:{kind:30818,content:"",tags:[["d","identifier"]]}},{kind:30819,name:"Redirects",description:"URL redirects",nip:"54",isAddressable:!0,template:{kind:30819,content:"",tags:[["d","identifier"]]}},{kind:31234,name:"Draft Event",description:"Draft of any event",nip:"37",isAddressable:!0,template:{kind:31234,content:"",tags:[["d","identifier"]]}},{kind:31388,name:"Link Set",description:"Link collection",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:31388,content:"",tags:[["d","identifier"]]}},{kind:31890,name:"Feed",description:"Custom feed definition",nip:null,isAddressable:!0,spec:"NUD: Custom Feeds",template:{kind:31890,content:"",tags:[["d","identifier"]]}},{kind:31922,name:"Date-Based Calendar Event",description:"All-day calendar event",nip:"52",isAddressable:!0,template:{kind:31922,content:"",tags:[["d","identifier"]]}},{kind:31923,name:"Time-Based Calendar Event",description:"Calendar event with time",nip:"52",isAddressable:!0,template:{kind:31923,content:"",tags:[["d","identifier"]]}},{kind:31924,name:"Calendar",description:"Calendar definition",nip:"52",isAddressable:!0,template:{kind:31924,content:"",tags:[["d","identifier"]]}},{kind:31925,name:"Calendar Event RSVP",description:"RSVP to calendar event",nip:"52",isAddressable:!0,template:{kind:31925,content:"",tags:[["d","identifier"]]}},{kind:31989,name:"Handler Recommendation",description:"Recommended app for event kind",nip:"89",isAddressable:!0,template:{kind:31989,content:"",tags:[["d","identifier"]]}},{kind:31990,name:"Handler Information",description:"App handler declaration",nip:"89",isAddressable:!0,template:{kind:31990,content:"",tags:[["d","identifier"]]}},{kind:32123,name:"WaveLake Track",description:"WaveLake music track",nip:null,isAddressable:!0,spec:"WaveLake",template:{kind:32123,content:"",tags:[["d","identifier"]]}},{kind:32267,name:"Software Application",description:"Software application listing",nip:null,isAddressable:!0,template:{kind:32267,content:"",tags:[["d","identifier"]]}},{kind:32388,name:"User Room Favorites",description:"Favorite rooms",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:32388,content:"",tags:[["d","identifier"]]}},{kind:33388,name:"High Scores",description:"Game high scores",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:33388,content:"",tags:[["d","identifier"]]}},{kind:34235,name:"Video Event Horizontal",description:"Horizontal video event",nip:"71",isAddressable:!0,template:{kind:34235,content:"",tags:[["d","identifier"]]}},{kind:34236,name:"Video Event Vertical",description:"Vertical video event",nip:"71",isAddressable:!0,template:{kind:34236,content:"",tags:[["d","identifier"]]}},{kind:34388,name:"Sound Effects",description:"Sound effect definitions",nip:null,isAddressable:!0,spec:"Corny Chat",template:{kind:34388,content:"",tags:[["d","identifier"]]}},{kind:34550,name:"Community Definition",description:"Define a community",nip:"72",isAddressable:!0,template:{kind:34550,content:"",tags:[["d","identifier"]]}},{kind:37516,name:"Geocache Listing",description:"Geocache location listing",nip:null,isAddressable:!0,spec:"geocaching",template:{kind:37516,content:"",tags:[["d","identifier"]]}},{kind:38172,name:"Cashu Mint Announcement",description:"Cashu mint announcement",nip:"87",isAddressable:!0,template:{kind:38172,content:"",tags:[["d","identifier"]]}},{kind:38173,name:"Fedimint Announcement",description:"Fedimint announcement",nip:"87",isAddressable:!0,template:{kind:38173,content:"",tags:[["d","identifier"]]}},{kind:38383,name:"Peer-to-peer Order Events",description:"P2P trading orders",nip:"69",isAddressable:!0,template:{kind:38383,content:"",tags:[["d","identifier"]]}},{kind:39e3,name:"Group Metadata Events",description:"Group metadata (start of range)",nip:"29",isAddressable:!0,template:{kind:39e3,content:"",tags:[["d","identifier"]]}},{kind:39089,name:"Starter Packs",description:"Starter pack lists",nip:"51",isAddressable:!0,template:{kind:39089,content:"",tags:[["d","identifier"]]}},{kind:39092,name:"Media Starter Packs",description:"Media starter packs",nip:"51",isAddressable:!0,template:{kind:39092,content:"",tags:[["d","identifier"]]}},{kind:39701,name:"Web Bookmarks",description:"Web URL bookmarks",nip:"B0",isAddressable:!0,template:{kind:39701,content:"",tags:[["d","identifier"]]}},{kind:39998,name:"ACL Event",description:"Access control list event",nip:null,isAddressable:!0,template:{kind:39998,content:"",tags:[["d","identifier"]]}}];function ny(e,t=null){const n=function(e){return ty.find(t=>t.kind===e)}(e);return n?{...n.template,created_at:Math.floor(Date.now()/1e3),pubkey:t||"ORLY_OWNERS environment variable with your npub when starting the relay.',s=m(),o=p("p"),l=g("Current user role: "),a=p("strong"),f=g(h),A(n,"class","svelte-fiaj1r"),A(r,"class","svelte-fiaj1r"),A(o,"class","svelte-fiaj1r"),A(t,"class","permission-denied svelte-fiaj1r")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,l),c(o,a),c(a,f)},p(e,t){4&t&&h!==(h=(e[2]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Cy(e){let t,n,r,s,o,l,a,h,y,w,b,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,z,j,H,G,J,K,V,q,Y,W,Z,X,ee,te,ne,ie,re,se,oe,le,ae,ce,ue,de,fe,pe,he,ge,me=e[3]?.is_running?"🟢 Running":"🔴 Stopped",ye=e[3]?.script_exists?"✅ Exists":"❌ Not found",ve=e[3]?.pid&&Ey(e),we=e[6]&&xy(e),Ae=e[8],be=[];for(let t=0;tpolicy_admins list.',s=m(),o=p("p"),l=g("Current user role: "),a=p("strong"),f=g(h),A(n,"class","svelte-gkxvxc"),A(r,"class","svelte-gkxvxc"),A(o,"class","svelte-gkxvxc"),A(t,"class","permission-denied svelte-gkxvxc")},m(e,d){u(e,t,d),c(t,n),c(t,i),c(t,r),c(t,s),c(t,o),c(o,l),c(o,a),c(a,f)},p(e,t){8&t[0]&&h!==(h=(e[3]||"none")+"")&&k(f,h)},d(e){e&&d(t)}}}function Ny(e){let t,n,r,s,o,l,a,f,h,y,w,b,C,E,x,B,Q,F,D,$,P,R,T,U,_,N,L,O,M,z,j,H,G,J,K,V,q,Y,W,Z,X,ee,te,ne,ie,re,se,oe,le,ae,ce,ue,de,fe,pe,he,ge,me,ye,ve,we,Ae,be,ke,Ie,Ce,Ee,xe,Se,Be,Qe,Fe,De,$e,Pe,Re=e[5]?"Policy Enabled":"Policy Disabled",Te=e[10].length+"",Ue=e[4]&&Ly(),_e=e[9].length>0&&Oy(e),Ne=e[7]&&zy(e);function Le(e,t){return 0===e[1].length?Hy:jy}let Oe=Le(e),Me=Oe(e);function ze(e,t){return 0===e[10].length?Ky:Jy}let je=ze(e),He=je(e);return{c(){t=p("div"),n=p("div"),r=p("h3"),r.textContent="Policy Editor",s=m(),o=p("div"),l=p("span"),a=g(Re),f=m(),Ue&&Ue.c(),h=m(),y=p("div"),y.innerHTML='Edit the policy JSON below and click "Save & Publish" to update the relay's policy configuration.\n Changes are applied immediately after validation.
\nPolicy updates are published as kind 12345 events and require policy admin permissions.
',w=m(),b=p("div"),C=p("textarea"),E=m(),_e&&_e.c(),x=m(),B=p("div"),Q=p("button"),F=g("Load Current"),D=m(),$=p("button"),P=g("Format JSON"),R=m(),T=p("button"),U=g("Validate"),_=m(),N=p("button"),L=g("Save & Publish"),O=m(),Ne&&Ne.c(),M=m(),z=p("div"),j=p("h3"),j.textContent="Policy Administrators",H=m(),G=p("div"),G.innerHTML='Policy admins can update the relay's policy configuration via kind 12345 events.\n Their follows get whitelisted if policy_follow_whitelist_enabled is true in the policy.
Note: Policy admins are separate from relay admins (ORLY_ADMINS).\n Changes here update the JSON editor - click "Save & Publish" to apply.
',J=m(),K=p("div"),Me.c(),V=m(),q=p("div"),Y=p("input"),W=m(),Z=p("button"),X=g("+ Add Admin"),te=m(),ne=p("div"),ie=p("h3"),ie.textContent="Policy Follow Whitelist",re=m(),se=p("div"),se.innerHTML='Pubkeys followed by policy admins (kind 3 events).\n These get automatic read+write access when rules have write_allow_follows: true.
kind.whitelist - Only allow these event kinds (takes precedence)kind.blacklist - Deny these event kinds (if no whitelist)global - Rules applied to all eventsrules - Per-kind rules (keyed by kind number as string)default_policy - "allow" or "deny" when no rules matchpolicy_admins - Hex pubkeys that can update policypolicy_follow_whitelist_enabled - Enable follow-based accessdescription - Human-readable rule descriptionwrite_allow / write_deny - Pubkey lists for write accessread_allow / read_deny - Pubkey lists for read accesswrite_allow_follows - Grant access to policy admin followssize_limit - Max total event size in bytescontent_limit - Max content field size in bytesmax_expiry - Max expiry offset in secondsmax_age_of_event - Max age of created_at in secondsmax_age_event_in_future - Max future offset in secondsmust_have_tags - Required tag letters (e.g., ["d", "t"])tag_validation - Regex patterns for tag valuesscript - Path to external validation scriptConfigure curating mode before the relay will accept events. Select which event kinds to allow and set rate limiting parameters.
',r=m(),s=p("div"),o=p("h4"),o.textContent="Allowed Event Kinds",l=m(),a=p("p"),a.textContent="Select categories of events to allow. At least one must be selected.",h=m(),g=p("div");for(let e=0;eORLY_NRC_RENDEZVOUS_URL to enable.',A(t,"class","svelte-gwb5vv"),A(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function BA(e){let t,n,i;return{c(){t=p("p"),t.textContent="NRC requires the Badger database backend.",n=m(),i=p("p"),i.innerHTML='Set ORLY_DB_TYPE=badger to enable NRC functionality.',A(t,"class","svelte-gwb5vv"),A(i,"class","svelte-gwb5vv")},m(e,r){u(e,t,r),u(e,n,r),u(e,i,r)},d(e){e&&d(t),e&&d(n),e&&d(i)}}}function QA(e){let t,n,r,s,o,l,a,f,h,y,b,I,C,E,x,S,B,Q;return{c(){t=p("div"),n=p("div"),r=p("h3"),s=g('Connection URI for "'),o=g(e[13]),l=g('"'),a=m(),f=p("p"),f.textContent="Copy this URI to your Nostr client to connect to this relay remotely.\n Keep it secret - anyone with this URI can access your relay.",h=m(),y=p("div"),b=p("textarea"),I=m(),C=p("div"),E=p("button"),E.textContent="Copy to Clipboard",x=m(),S=p("button"),S.textContent="Close",A(r,"class","svelte-gwb5vv"),A(f,"class","modal-description svelte-gwb5vv"),b.readOnly=!0,b.value=e[12],A(b,"class","svelte-gwb5vv"),A(y,"class","uri-display svelte-gwb5vv"),A(E,"class","copy-btn svelte-gwb5vv"),A(S,"class","close-btn svelte-gwb5vv"),A(C,"class","modal-actions svelte-gwb5vv"),A(n,"class","modal svelte-gwb5vv"),A(t,"class","modal-overlay svelte-gwb5vv")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,l),c(n,a),c(n,f),c(n,h),c(n,y),c(y,b),c(n,I),c(n,C),c(C,E),c(C,x),c(C,S),B||(Q=[v(E,"click",e[18]),v(S,"click",e[19]),v(n,"click",w(e[23])),v(t,"click",e[19])],B=!0)},p(e,t){8192&t[0]&&k(o,e[13]),4096&t[0]&&(b.value=e[12])},d(e){e&&d(t),B=!1,i(Q)}}}function FA(t){let n,i,r,s,o,l,a;function f(e,t){return e[2]?e[0]?"owner"!==e[1]?mA:gA:yA:vA}let h=f(t),g=h(t),v=t[11]&&QA(t);return{c(){n=p("div"),i=p("h2"),i.textContent="Relay Connect",r=m(),s=p("p"),s.textContent="Nostr Relay Connect (NRC) allows remote access to this relay through a public relay tunnel.\n Create connection strings for your devices to sync securely.",o=m(),g.c(),l=m(),v&&v.c(),a=y(),A(i,"class","svelte-gwb5vv"),A(s,"class","description svelte-gwb5vv"),A(n,"class","relay-connect-view svelte-gwb5vv")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),g.m(n,null),u(e,l,t),v&&v.m(e,t),u(e,a,t)},p(e,t){h===(h=f(e))&&g?g.p(e,t):(g.d(1),g=h(e),g&&(g.c(),g.m(n,null))),e[11]?v?v.p(e,t):(v=QA(e),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null)},i:e,o:e,d(e){e&&d(n),g.d(),e&&d(l),v&&v.d(e),e&&d(a)}}}function DA(e){return e?new Date(1e3*e).toLocaleString():"Never"}function $A(e,t,n){let{isLoggedIn:i=!1}=t,{userRole:r=""}=t,{userSigner:s=null}=t,{userPubkey:o=""}=t;const l=P();let a=!1,c=!1,u=[],d={},f=!1,p="",h="info",g="",m=!1,y=!1,v="",w="";async function A(){if(i&&s&&o){n(6,f=!0);try{const e=await async function(e,t){const n=`${window.location.origin}/api/nrc/connections`,i=await oA(e,t,"GET",n),r=await fetch(n,{headers:i?{Authorization:`Nostr ${i}`}:{}});if(!r.ok){const e=await r.text();throw new Error(e||`Failed to get NRC connections: ${r.statusText}`)}return await r.json()}(s,o);n(4,u=e.connections||[]),n(5,d=e.config||{})}catch(e){I(`Failed to load connections: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function b(e,t){if(confirm(`Are you sure you want to delete the connection "${t}"? This will revoke access for any device using this connection.`)){n(6,f=!0);try{await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}`,r=await oA(e,t,"DELETE",i),s=await fetch(i,{method:"DELETE",headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to delete NRC connection: ${s.statusText}`)}return await s.json()}(s,o,e),await A(),I(`Connection "${t}" deleted`,"success")}catch(e){I(`Failed to delete connection: ${e.message}`,"error")}finally{n(6,f=!1)}}}async function k(e,t){n(6,f=!0);try{const i=await async function(e,t,n){const i=`${window.location.origin}/api/nrc/connections/${n}/uri`,r=await oA(e,t,"GET",i),s=await fetch(i,{headers:r?{Authorization:`Nostr ${r}`}:{}});if(!s.ok){const e=await s.text();throw new Error(e||`Failed to get NRC URI: ${s.statusText}`)}return await s.json()}(s,o,e);n(12,v=i.uri),n(13,w=t),n(11,y=!0)}catch(e){I(`Failed to get URI: ${e.message}`,"error")}finally{n(6,f=!1)}}function I(e,t="info"){n(7,p=e),n(8,h=t),setTimeout(()=>{p===e&&n(7,p="")},5e3)}D(async()=>{await async function(){try{const e=await lA();n(2,a=e.enabled),n(3,c=e.badger_required),a&&i&&"owner"===r&&await A()}catch(e){console.error("Failed to load NRC config:",e)}}()});return e.$$set=e=>{"isLoggedIn"in e&&n(0,i=e.isLoggedIn),"userRole"in e&&n(1,r=e.userRole),"userSigner"in e&&n(21,s=e.userSigner),"userPubkey"in e&&n(22,o=e.userPubkey)},e.$$.update=()=>{7&e.$$.dirty[0]&&i&&"owner"===r&&a&&A()},[i,r,a,c,u,d,f,p,h,g,m,y,v,w,A,async function(){if(g.trim()){n(6,f=!0);try{const e=await async function(e,t,n,i=!1){const r=`${window.location.origin}/api/nrc/connections`,s=await oA(e,t,"POST",r),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:`Nostr ${s}`}:{}},body:JSON.stringify({label:n,use_cashu:i})});if(!o.ok){const e=await o.text();throw new Error(e||`Failed to create NRC connection: ${o.statusText}`)}return await o.json()}(s,o,g.trim(),m);n(12,v=e.uri),n(13,w=e.label),n(11,y=!0),n(9,g=""),n(10,m=!1),await A(),I(`Connection "${e.label}" created successfully`,"success")}catch(e){I(`Failed to create connection: ${e.message}`,"error")}finally{n(6,f=!1)}}else I("Please enter a label for the connection","error")},b,k,async function(e){const t=await fA(v);pA(e.target.closest("button"),t),t||I("Failed to copy to clipboard","error")},function(){n(11,y=!1),n(12,v=""),n(13,w="")},function(){l("openLoginModal")},s,o,function(t){R.call(this,e,t)},function(){g=this.value,n(9,g)},function(){m=this.checked,n(10,m)},e=>k(e.id,e.label),e=>b(e.id,e.label)]}class PA extends se{constructor(e){super(),re(this,e,$A,FA,s,{isLoggedIn:0,userRole:1,userSigner:21,userPubkey:22},null,[-1,-1])}}function RA(e){let t,n,i,r,s,o,l,a,f,h,y;return{c(){t=p("div"),n=p("div"),i=p("h3"),i.textContent="Active Filter",r=m(),s=p("button"),s.textContent="🧹 Sweep",o=m(),l=p("div"),a=p("pre"),f=g(e[2]),A(i,"class","svelte-1tyqaa5"),A(s,"class","sweep-btn svelte-1tyqaa5"),A(s,"title","Clear filter"),A(n,"class","filter-display-header svelte-1tyqaa5"),A(a,"class","filter-json svelte-1tyqaa5"),A(l,"class","filter-json-container svelte-1tyqaa5"),A(t,"class","filter-display svelte-1tyqaa5")},m(d,p){u(d,t,p),c(t,n),c(n,i),c(n,r),c(n,s),c(t,o),c(t,l),c(l,a),c(a,f),h||(y=v(s,"click",e[3]),h=!0)},p(e,t){4&t&&k(f,e[2])},d(e){e&&d(t),h=!1,y()}}}function TA(t){let n,i=t[0]&&t[1]&&RA(t);return{c(){i&&i.c(),n=y()},m(e,t){i&&i.m(e,t),u(e,n,t)},p(e,[t]){e[0]&&e[1]?i?i.p(e,t):(i=RA(e),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:e,o:e,d(e){i&&i.d(e),e&&d(n)}}}function UA(e,t,n){let i,r;const s=P();let{filter:o={}}=t,{showFilter:l=!0}=t;return e.$$set=e=>{"filter"in e&&n(4,o=e.filter),"showFilter"in e&&n(0,l=e.showFilter)},e.$$.update=()=>{16&e.$$.dirty&&n(2,i=function(e){return JSON.stringify(e,null,2)}(o)),16&e.$$.dirty&&n(1,r=Object.keys(o).length>0)},[l,r,i,function(){s("sweep")},o]}class _A extends se{constructor(e){super(),re(this,e,UA,TA,s,{filter:4,showFilter:0})}}class NA{constructor(e,t,n){this.relayUrl=e,this.userSigner=t,this.userPubkey=n,this.ws=null,this.challenge=null,this.isAuthenticated=!1,this.authPromise=null}async connect(){return new Promise((e,t)=>{this.ws=new WebSocket(this.relayUrl),this.ws.onopen=()=>{console.log("WebSocket connected to relay:",this.relayUrl),e()},this.ws.onmessage=async e=>{try{const t=JSON.parse(e.data);await this.handleMessage(t)}catch(e){console.error("Error parsing relay message:",e)}},this.ws.onerror=e=>{console.error("WebSocket error:",e),t(new Error("Failed to connect to relay"))},this.ws.onclose=()=>{console.log("WebSocket connection closed"),this.isAuthenticated=!1,this.challenge=null},setTimeout(()=>{this.ws.readyState!==WebSocket.OPEN&&t(new Error("Connection timeout"))},1e4)})}async handleMessage(e){const[t,...n]=e;switch(t){case"AUTH":this.challenge=n[0],console.log("Received AUTH challenge:",this.challenge),await this.authenticate();break;case"OK":const[e,i,r]=n;e&&i?(console.log("Authentication successful for event:",e),this.isAuthenticated=!0,this.authPromise&&(this.authPromise.resolve(),this.authPromise=null)):e&&!i&&(console.error("Authentication failed:",r),this.authPromise&&(this.authPromise.reject(new Error(r||"Authentication failed")),this.authPromise=null));break;case"NOTICE":console.log("Relay notice:",n[0]);break;default:console.log("Unhandled message type:",t,n)}}async authenticate(){if(!this.challenge)throw new Error("No challenge received from relay");if(!this.userSigner)throw new Error("No signer available for authentication");try{const e={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",this.relayUrl],["challenge",this.challenge]],content:"",pubkey:this.userPubkey},t=["AUTH",await this.userSigner.signEvent(e)];return this.ws.send(JSON.stringify(t)),console.log("Sent authentication event to relay"),new Promise((e,t)=>{this.authPromise={resolve:e,reject:t},setTimeout(()=>{this.authPromise&&(this.authPromise.reject(new Error("Authentication timeout")),this.authPromise=null)},1e4)})}catch(e){throw console.error("Authentication error:",e),e}}async publishEvent(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");return new Promise((t,n)=>{const i=["EVENT",e];this.ws.send(JSON.stringify(i));const r=this.ws.onmessage,s=setTimeout(()=>{this.ws.onmessage=r,n(new Error("Publish timeout"))},15e3);this.ws.onmessage=async i=>{try{const o=JSON.parse(i.data),[l,a,c,u]=o;if("OK"===l&&a===e.id)if(c)clearTimeout(s),this.ws.onmessage=r,console.log("Event published successfully:",a),t({success:!0,eventId:a,reason:u});else{if(console.error("Event publish failed:",u),u&&u.includes("auth-required"))return void console.log("Authentication required, waiting for AUTH challenge...");clearTimeout(s),this.ws.onmessage=r,n(new Error(`Publish failed: ${u}`))}else if("AUTH"===l){this.challenge=o[1],console.log("Received AUTH challenge during publish:",this.challenge);try{await this.authenticate(),console.log("Authentication successful, retrying event publish...");const t=["EVENT",e];this.ws.send(JSON.stringify(t))}catch(e){clearTimeout(s),this.ws.onmessage=r,n(new Error(`Authentication failed: ${e.message}`))}}else await this.handleMessage(o)}catch(e){clearTimeout(s),this.ws.onmessage=r,n(e)}}})}close(){this.ws&&(this.ws.close(),this.ws=null),this.isAuthenticated=!1,this.challenge=null}getAuthenticated(){return this.isAuthenticated}}async function LA(e,t,n,i){const r=new NA(e,n,i);try{await r.connect();return await r.publishEvent(t)}finally{r.close()}}function OA(e,t,n){const i=e.slice();return i[171]=t[n],i}function MA(e,t,n){const i=e.slice();return i[181]=t[n],i}function zA(e,t,n){const i=e.slice();return i[174]=t[n],i}function jA(e,t,n){const i=e.slice();i[174]=t[n];const r=i[52](i[174]);return i[175]=r,i}function HA(e,t,n){const i=e.slice();return i[178]=t[n],i}function GA(t){let n;function i(e,t){return e[1]?ob:sb}let r=i(t),s=r(t);return{c(){n=p("div"),s.c(),A(n,"class","welcome-message svelte-u3u5mw")},m(e,t){u(e,n,t),s.m(n,null)},p(e,t){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&d(n),s.d()}}}function JA(e){let t,n,i=e[6],r=[];for(let t=0;tSearch and recover old versions of replaceable events
',s=m(),o=p("div"),l=p("div"),a=p("div"),h=p("label"),h.textContent="Select Event Kind:",g=m(),y=p("select"),w=p("option"),w.textContent="Choose a replaceable kind...";for(let e=0;eNo search results found.
',A(n,"class","no-search-results svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function cb(e){let t,n=e[42].get(e[181].id).events,i=[];for(let t=0;tSearching...
',A(t,"class","loading-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function hb(e){let t;return{c(){t=p("div"),t.innerHTML='No more search results to load.
',A(t,"class","end-of-search-results svelte-u3u5mw")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function gb(e){let t,n,i=e[181].id===e[5]&&lb(e);return{c(){i&&i.c(),t=y()},m(e,r){i&&i.m(e,r),u(e,t,r),n=!0},p(e,n){e[181].id===e[5]?i?(i.p(e,n),96&n[0]&&W(i,1)):(i=lb(e),i.c(),W(i,1),i.m(t.parentNode,t)):i&&(q(),Z(i,1,1,()=>{i=null}),Y())},i(e){n||(W(i),n=!0)},o(e){Z(i),n=!1},d(e){i&&i.d(e),e&&d(t)}}}function mb(t){let n,i,r=t[178].label+"";return{c(){n=p("option"),i=g(r),n.__value=t[178].value,n.value=n.__value},m(e,t){u(e,n,t),c(n,i)},p:e,d(e){e&&d(n)}}}function yb(e){let t;function n(e,t){return e[38]?Ab:0===e[37].length?wb:vb}let i=n(e),r=i(e);return{c(){t=p("div"),r.c(),A(t,"class","recovery-results svelte-u3u5mw")},m(e,n){u(e,t,n),r.m(t,null)},p(e,s){i===(i=n(e))&&r?r.p(e,s):(r.d(1),r=i(e),r&&(r.c(),r.m(t,null)))},d(e){e&&d(t),r.d()}}}function vb(e){let t,n,i,r=e[37],s=[];for(let t=0;tORLY_ACL_MODE=managed in your\n environment variables and restart the relay.',A(i,"class","svelte-u3u5mw"),A(s,"class","svelte-u3u5mw"),A(l,"class","svelte-u3u5mw"),A(v,"class","svelte-u3u5mw"),A(n,"class","acl-mode-warning svelte-u3u5mw")},m(e,t){u(e,n,t),c(n,i),c(n,r),c(n,s),c(n,o),c(n,l),c(l,a),c(l,f),c(f,h),c(n,y),c(n,v)},p(e,t){512&t[0]&&w!==(w=(e[9]||"unknown")+"")&&k(h,w)},i:e,o:e,d(e){e&&d(n)}}}function $b(e){let t,n,r,s,o,l,a,f,h,g;function y(e,t){return e[3]?Rb:e[1]&&e[2]?Pb:void 0}let b=y(e),k=b&&b(e);return{c(){t=p("div"),n=p("div"),r=p("div"),s=p("h2"),s.textContent="Settings",o=m(),l=p("button"),l.textContent="✕",a=m(),f=p("div"),k&&k.c(),A(s,"class","svelte-u3u5mw"),A(l,"class","close-btn svelte-u3u5mw"),A(r,"class","drawer-header svelte-u3u5mw"),A(f,"class","drawer-content"),A(n,"class","settings-drawer svelte-u3u5mw"),S(n,"dark-theme",e[0]),A(t,"class","drawer-overlay svelte-u3u5mw"),A(t,"role","button"),A(t,"tabindex","0")},m(i,d){u(i,t,d),c(t,n),c(n,r),c(r,s),c(r,o),c(r,l),c(n,a),c(n,f),k&&k.m(f,null),h||(g=[v(l,"click",e[75]),v(n,"click",w(e[102])),v(n,"keydown",w(e[103])),v(t,"click",e[75]),v(t,"keydown",e[129])],h=!0)},p(e,t){b===(b=y(e))&&k?k.p(e,t):(k&&k.d(1),k=b&&b(e),k&&(k.c(),k.m(f,null))),1&t[0]&&S(n,"dark-theme",e[0])},d(e){e&&d(t),k&&k.d(),h=!1,i(g)}}}function Pb(e){let t,n,r,s,o,l,a,f,h,y,w,b,I,C,E,x,S,B=e[2].slice(0,16)+"",Q=e[2].slice(-8)+"";return{c(){t=p("div"),n=p("button"),n.textContent="Log out",r=m(),s=p("h3"),s.textContent="Profile Loading",o=m(),l=p("p"),l.textContent="Your profile metadata is being loaded...",a=m(),f=p("button"),f.textContent="Retry Loading Profile",h=m(),y=p("div"),w=p("strong"),w.textContent="Public Key:",b=m(),I=g(B),C=g("..."),E=g(Q),A(n,"class","logout-btn floating svelte-u3u5mw"),A(s,"class","svelte-u3u5mw"),A(l,"class","svelte-u3u5mw"),A(f,"class","retry-profile-btn svelte-u3u5mw"),A(y,"class","user-pubkey-display svelte-u3u5mw"),A(t,"class","profile-loading-section svelte-u3u5mw")},m(i,d){u(i,t,d),c(t,n),c(t,r),c(t,s),c(t,o),c(t,l),c(t,a),c(t,f),c(t,h),c(t,y),c(y,w),c(y,b),c(y,I),c(y,C),c(y,E),x||(S=[v(n,"click",e[72]),v(f,"click",e[83])],x=!0)},p(e,t){4&t[0]&&B!==(B=e[2].slice(0,16)+"")&&k(I,B),4&t[0]&&Q!==(Q=e[2].slice(-8)+"")&&k(E,Q)},d(e){e&&d(t),x=!1,i(S)}}}function Rb(e){let t,n,i,r,s,o,l,a,f,h,w,b,I,C,E,x=(e[3].name||"Unknown User")+"",S=e[3].banner&&Tb(e);function B(e,t){return e[3].picture?_b:Ub}let Q=B(e),F=Q(e),D=e[3].nip05&&Nb(e),$=e[3].about&&Lb(e),P=e[4]&&"read"!==e[4]&&Ob(e);return{c(){t=p("div"),n=p("div"),S&&S.c(),i=m(),r=p("button"),r.textContent="Log out",s=m(),F.c(),o=m(),l=p("div"),a=p("h3"),f=g(x),h=m(),D&&D.c(),w=m(),$&&$.c(),b=m(),P&&P.c(),I=y(),A(r,"class","logout-btn floating svelte-u3u5mw"),A(a,"class","profile-username svelte-u3u5mw"),A(l,"class","name-row svelte-u3u5mw"),A(n,"class","profile-hero svelte-u3u5mw"),A(t,"class","profile-section svelte-u3u5mw")},m(d,p){u(d,t,p),c(t,n),S&&S.m(n,null),c(n,i),c(n,r),c(n,s),F.m(n,null),c(n,o),c(n,l),c(l,a),c(a,f),c(l,h),D&&D.m(l,null),c(t,w),$&&$.m(t,null),u(d,b,p),P&&P.m(d,p),u(d,I,p),C||(E=v(r,"click",e[72]),C=!0)},p(e,r){e[3].banner?S?S.p(e,r):(S=Tb(e),S.c(),S.m(n,i)):S&&(S.d(1),S=null),Q===(Q=B(e))&&F?F.p(e,r):(F.d(1),F=Q(e),F&&(F.c(),F.m(n,o))),8&r[0]&&x!==(x=(e[3].name||"Unknown User")+"")&&k(f,x),e[3].nip05?D?D.p(e,r):(D=Nb(e),D.c(),D.m(l,null)):D&&(D.d(1),D=null),e[3].about?$?$.p(e,r):($=Lb(e),$.c(),$.m(t,null)):$&&($.d(1),$=null),e[4]&&"read"!==e[4]?P?P.p(e,r):(P=Ob(e),P.c(),P.m(I.parentNode,I)):P&&(P.d(1),P=null)},d(e){e&&d(t),S&&S.d(),F.d(),D&&D.d(),$&&$.d(),e&&d(b),P&&P.d(e),e&&d(I),C=!1,E()}}}function Tb(e){let t,n;return{c(){t=p("img"),l(t.src,n=e[3].banner)||A(t,"src",n),A(t,"alt","Profile banner"),A(t,"class","profile-banner svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!l(t.src,n=e[3].banner)&&A(t,"src",n)},d(e){e&&d(t)}}}function Ub(t){let n;return{c(){n=p("div"),n.textContent="👤",A(n,"class","profile-avatar-placeholder overlap svelte-u3u5mw")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function _b(e){let t,n;return{c(){t=p("img"),l(t.src,n=e[3].picture)||A(t,"src",n),A(t,"alt","User avatar"),A(t,"class","profile-avatar overlap svelte-u3u5mw")},m(e,n){u(e,t,n)},p(e,i){8&i[0]&&!l(t.src,n=e[3].picture)&&A(t,"src",n)},d(e){e&&d(t)}}}function Nb(e){let t,n,i=e[3].nip05+"";return{c(){t=p("span"),n=g(i),A(t,"class","profile-nip05-inline svelte-u3u5mw")},m(e,i){u(e,t,i),c(t,n)},p(e,t){8&t[0]&&i!==(i=e[3].nip05+"")&&k(n,i)},d(e){e&&d(t)}}}function Lb(e){let t,n;return{c(){t=p("div"),n=p("p"),A(n,"class","profile-about svelte-u3u5mw"),A(t,"class","about-card svelte-u3u5mw")},m(i,r){u(i,t,r),c(t,n),n.innerHTML=e[40]},p(e,t){512&t[1]&&(n.innerHTML=e[40])},d(e){e&&d(t)}}}function Ob(e){let t,n,i,r,s,o,l=e[95](),a=[];for(let t=0;t{if("events"===y){const e=document.querySelectorAll(".events-view-content")[0];e&&e.scrollHeight<=e.clientHeight&&_e()}},100)}catch(e){console.error("Failed to load events:",e),alert("Failed to load events: "+e.message)}finally{n(7,S=!1)}}}async function _e(){await Ue(!1)}let Ne=!1;async function Le(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+e],["method",t.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return`Nostr ${btoa(r)}`}async function Oe(e,t){if(!u||!d)throw new Error("Not logged in");const n={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",window.location.origin+t],["method",e.toUpperCase()]],content:"",pubkey:d};let i;if(g&&"extension"===f)try{i=await g.signEvent(n)}catch(e){throw new Error("Failed to sign with extension: "+e.message)}else{if("nsec"!==f)throw new Error("No valid signer available");n.id="mock-id-"+Date.now(),n.sig="mock-signature-"+Date.now(),i=n}const r=JSON.stringify(i);return btoa(r)}function Me(e,t){const n=e.toLowerCase();if(n.includes("policy")||n.includes("blocked")||n.includes("denied")){let n=`Policy Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} may be restricted by the relay's policy configuration.`),K&&(n+="\n\nThe relay has policy enforcement enabled. Contact a relay administrator to allow this event kind or adjust your permissions."),n}if(n.includes("auth")||n.includes("permission")||n.includes("unauthorized"))return`Permission Error: ${e}\n\nYour current permissions may not allow publishing this type of event. Current role: ${h||"unknown"}. Contact a relay administrator to upgrade your permissions.`;if(n.includes("kind")||n.includes("not allowed")||n.includes("restricted")){let n=`Event Type Error: ${e}`;return null!==t&&(n+=`\n\nKind ${t} is not currently allowed on this relay.`),n+="\n\nThe relay administrator may need to update the policy configuration to allow this event kind.",n}return n.includes("rate")||n.includes("limit")||n.includes("too many")?`Rate Limit Error: ${e}\n\nPlease wait a moment before trying again.`:n.includes("size")||n.includes("too large")||n.includes("content")?`Size Limit Error: ${e}\n\nThe event may exceed the relay's size limits. Try reducing the content length.`:`Publishing failed: ${e}`}function ze(e){n(97,F=e),localStorage.setItem("viewAsRole",e),console.log("View as role changed to:",e,"Current effective role:",l)}F=localStorage.getItem("viewAsRole")||"";return e.$$.update=()=>{var t;if(6&e.$$.dirty[0]|8&e.$$.dirty[3]&&n(41,i=k.sort((e,t)=>t.created_at-e.created_at)),8&e.$$.dirty[0]&&n(40,r=p?.about?(t=p.about,t?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):"").replace(/\n{2,}/g,"
"):""),16&e.$$.dirty[0]|16&e.$$.dirty[3]&&n(10,l=F&&""!==F?F:h),1810&e.$$.dirty[0]|112&e.$$.dirty[3]&&n(101,s=Ee.filter(e=>{const t=l;return!(e.requiresAdmin&&(!u||"admin"!==t&&"owner"!==t))&&(!(e.requiresOwner&&(!u||"owner"!==t))&&(!(e.requiresWrite&&(!u||"read"===t))&&(!("sprocket"===e.id&&!H)&&(!("policy"===e.id&&!K)&&(!("relay-connect"===e.id&&!X)&&(("managed-acl"!==e.id||"managed"===ee)&&(("curation"!==e.id||"curating"===ee)&&(console.log(`Tab ${e.id} filter check:`,{isLoggedIn:u,userRole:h,viewAsRole:F,currentRole:t,requiresAdmin:e.requiresAdmin,requiresOwner:e.requiresOwner,requiresWrite:e.requiresWrite,visible:!0}),!0))))))))})),64&e.$$.dirty[0]|256&e.$$.dirty[3]&&n(11,o=[...s,...A]),2578&e.$$.dirty[0]|256&e.$$.dirty[3]&&console.log("Tabs debug:",{isLoggedIn:u,userRole:h,aclMode:ee,filteredBaseTabs:s.map(e=>e.id),allTabs:o.map(e=>e.id)}),1&e.$$.dirty[0]&&"undefined"!=typeof document&&(a?document.body.classList.add("dark-theme"):document.body.classList.remove("dark-theme")),14&e.$$.dirty[0]&&u&&d&&!p&&$e(),182&e.$$.dirty[0]|136&e.$$.dirty[3]&&"events"===y&&u&&("read"===h||"write"===h||"admin"===h||"owner"===h)&&0===k.length&&!Ne&&!S){n(100,Ne=!0);Ue(!0,null)}32&e.$$.dirty[0]|8&e.$$.dirty[3]&&("events"!==y||"events"===y&&k.length>0)&&n(100,Ne=!1),32&e.$$.dirty[0]&&localStorage.setItem("selectedTab",y)},[a,u,d,p,h,y,A,S,K,ee,l,o,c,g,m,v,I,C,E,N,L,O,M,z,j,G,J,V,q,Y,W,Z,te,ne,ie,re,se,oe,le,ae,r,i,D,ue,de,async function(){console.log("Toggle changed, showOnlyMyEvents:",jb),n(100,Ne=!1),await Ue(!0,null)},fe,pe,he,ge,function(){console.log("selectRecoveryKind called, recoverySelectedKind:",re),null!=re?(n(36,se=""),n(37,oe=[]),ce=null,n(39,ae=!0),pe()):console.log("No kind selected, skipping load")},function(){console.log("handleCustomKindInput called, recoveryCustomKind:",se);const e=parseInt(se);""!==se&&!isNaN(e)&&e>=0&&(n(35,re=null),n(37,oe=[]),ce=null,n(39,ae=!0),pe())},function(e){const t=oe.filter(t=>t.kind===e.kind&&t.pubkey===e.pubkey),n=Math.max(...t.map(e=>e.created_at));return e.created_at===n},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/status",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/sprocket/status")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(19,N=t.script_content||""),n(20,L=t),ke("Script loaded successfully","success")}else ke("Failed to load script","error")}catch(e){ke(`Error loading script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:N});if(e.ok)ke("Script saved and updated successfully","success"),await ve(),await we();else{ke(`Failed to save script: ${await e.text()}`,"error")}}catch(e){ke(`Error saving script: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h)try{n(22,M=!0);const e=await fetch("/api/sprocket/restart",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/restart")}`,"Content-Type":"application/json"}});if(e.ok)ke("Sprocket restarted successfully","success"),await ve();else{ke(`Failed to restart sprocket: ${await e.text()}`,"error")}}catch(e){ke(`Error restarting sprocket: ${e.message}`,"error")}finally{n(22,M=!1)}},async function(){if(u&&"owner"===h&&confirm("Are you sure you want to delete the sprocket script? This will stop the current process."))try{n(22,M=!0);const e=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:""});if(e.ok)n(19,N=""),ke("Sprocket script deleted successfully","success"),await ve(),await we();else{ke(`Failed to delete script: ${await e.text()}`,"error")}}catch(e){ke(`Error deleting script: ${e.message}`,"error")}finally{n(22,M=!1)}},we,Ae,be,async function(){if(u&&("owner"===h||Hb))try{n(27,V=!0),n(30,W=[]);const e={kinds:[12345],limit:1},t=await $p(e);if(t&&t.length>0){n(26,J=t[0].content);try{n(26,J=JSON.stringify(JSON.parse(J),null,2))}catch(e){}Ie("Policy loaded successfully","success")}else{const e=await fetch("/api/policy",{method:"GET",headers:{Authorization:`Nostr ${await Oe("GET","/api/policy")}`,"Content-Type":"application/json"}});if(e.ok){const t=await e.json();n(26,J=JSON.stringify(t,null,2)),Ie("Policy loaded from file","success")}else Ie("No policy configuration found","info"),n(26,J="")}}catch(e){Ie(`Error loading policy: ${e.message}`,"error")}finally{n(27,V=!1)}},Ce,async function(){if(!u||"owner"!==h&&!Hb)return;if(await Ce())try{n(27,V=!0);const e={kind:12345,created_at:Math.floor(Date.now()/1e3),tags:[],content:J},t=await LA(e,g);t.success?Ie("Policy updated successfully","success"):Ie(`Failed to publish policy: ${t.error||"Unknown error"}`,"error")}catch(e){Ie(`Error saving policy: ${e.message}`,"error")}finally{n(27,V=!1)}},function(){try{const e=JSON.parse(J);n(26,J=JSON.stringify(e,null,2)),Ie("JSON formatted","success")}catch(e){Ie(`Cannot format: ${e.message}`,"error")}},function(e){const t=e.detail;if(!t)return void Ie("Please enter a pubkey","error");const i=function(e){if(!e)return null;if(/^[0-9a-fA-F]{64}$/.test(e))return e.toLowerCase();if(e.startsWith("npub1"))try{const t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n=e.slice(5);let i=[];for(const e of n){const n=t.indexOf(e.toLowerCase());if(-1===n)throw new Error("Invalid character in npub");i.push(...[...Array(5)].map((e,t)=>n>>4-t&1))}i=i.slice(0,-30);const r=[];for(let e=0;e+8<=i.length;e+=8){let t=0;for(let n=0;n<8;n++)t=t<<1|i[e+n];r.push(t)}return r.map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return console.error("Failed to decode npub:",e),null}return null}(t);if(i&&64===i.length)try{const e=JSON.parse(J||"{}");if(e.policy_admins||(e.policy_admins=[]),e.policy_admins.includes(i))return void Ie("Admin already in list","warning");e.policy_admins.push(i),n(26,J=JSON.stringify(e,null,2)),Ie("Admin added - click 'Save & Publish' to apply","info")}catch(e){Ie(`Error adding admin: ${e.message}`,"error")}else Ie("Invalid pubkey format. Use hex (64 chars) or npub","error")},function(e){const t=e.detail;try{const e=JSON.parse(J||"{}");e.policy_admins&&(e.policy_admins=e.policy_admins.filter(e=>e!==t),n(26,J=JSON.stringify(e,null,2)),Ie("Admin removed - click 'Save & Publish' to apply","info"))}catch(e){Ie(`Error removing admin: ${e.message}`,"error")}},async function(){if(u&&("owner"===h||Hb))try{n(27,V=!0),n(31,Z=[]);let e=[];try{e=JSON.parse(J||"{}").policy_admins||[]}catch(e){return void Ie("Cannot parse policy JSON to get admins","error")}if(0===e.length)return void Ie("No policy admins configured","warning");const t={kinds:[3],authors:e,limit:e.length},i=await $p(t),r=new Set;for(const e of i)if(e.tags)for(const t of e.tags)"p"===t[0]&&t[1]&&64===t[1].length&&r.add(t[1]);n(31,Z=Array.from(r)),Ie(`Loaded ${Z.length} follows from ${i.length} admin(s)`,"success")}catch(e){Ie(`Error loading follows: ${e.message}`,"error")}finally{n(27,V=!1)}},function(e){n(25,G=e.target.files[0])},async function(){if(u&&"owner"===h&&G)try{n(22,M=!0);const e=await G.text(),t=await fetch("/api/sprocket/update",{method:"POST",headers:{Authorization:`Nostr ${await Oe("POST","/api/sprocket/update")}`,"Content-Type":"text/plain"},body:e});if(t.ok)n(19,N=e),ke("Script uploaded and updated successfully","success"),await ve(),await we();else{ke(`Failed to upload script: ${await t.text()}`,"error")}}catch(e){ke(`Error uploading script: ${e.message}`,"error")}finally{n(22,M=!1),n(25,G=null);const e=document.getElementById("sprocket-upload-file");e&&(e.value="")}},xe,function(){u||n(12,c=!0)},async function(e){const{method:t,pubkey:i,privateKey:r,signer:s}=e.detail;n(1,u=!0),n(2,d=i),f=t,n(13,g=s),n(12,c=!1);try{if(await Dp(),"extension"===t&&s)yp.setSigner(s);else if("nsec"===t&&r){const e=new ff(r);yp.setSigner(e)}n(3,p=await xp(i)),console.log("Profile loaded:",p)}catch(e){console.error("Failed to load profile:",e)}await Pe(),await Re()},function(){n(1,u=!1),n(2,d=""),f="",n(3,p=null),n(4,h=""),n(13,g=null),userPrivkey=null,n(14,m=!1),T=[],n(96,k=[]),$=[],P=0,me(),"undefined"!=typeof localStorage&&(localStorage.removeItem("nostr_auth_method"),localStorage.removeItem("nostr_pubkey"),localStorage.removeItem("nostr_privkey"))},function(){n(12,c=!1)},function(){n(14,m=!0)},Se,function(){n(15,v=!v)},function(e){const{searchText:t,selectedKinds:n,pubkeys:i,eventIds:r,tags:s,sinceTimestamp:o,untilTimestamp:l,limit:a}=e.detail,c=function({searchText:e=null,kinds:t=[],authors:n=[],ids:i=[],tags:r=[],since:s=null,until:o=null,limit:l=null}){const a={};return e&&e.trim()&&(a.search=e.trim()),t&&t.length>0&&(a.kinds=t),n&&n.length>0&&(a.authors=n),i&&i.length>0&&(a.ids=i),r&&r.length>0&&r.forEach(e=>{if(e.name&&e.value){const t=`#${e.name}`;a[t]||(a[t]=[]),a[t].push(e.value)}}),s&&(a.since=s),o&&(a.until=o),l&&l>0&&(a.limit=l),a}({searchText:t,kinds:n,authors:i,ids:r,tags:s,since:o,until:l,limit:a||100});w=c,Ue(!0,null)},function(){w={},Ue(!0,null)},Be,Qe,Fe,De,$e,async function(){await Te([])},async function(){await Te([d])},function(e){n(16,I=e.detail.target.files[0])},async function(){if("none"!==ee&&(!u||"admin"!==h&&"owner"!==h))return n(17,C="Admin or owner permission required"),void setTimeout(()=>{n(17,C="")},5e3);if(!I)return n(17,C="Please select a file"),void setTimeout(()=>{n(17,C="")},5e3);try{n(17,C="Uploading...");const e={};"none"!==ee&&u&&(e.Authorization=await Le("/api/import","POST"));const t=new FormData;t.append("file",I);const i=await fetch("/api/import",{method:"POST",headers:e,body:t});if(!i.ok)throw new Error(`Import failed: ${i.status} ${i.statusText}`);await i.json();n(17,C="Upload complete"),n(16,I=null),document.getElementById("import-file").value="",setTimeout(()=>{n(17,C="")},5e3)}catch(e){console.error("Import failed:",e),n(17,C="Import failed: "+e.message),setTimeout(()=>{n(17,C="")},5e3)}},Ue,function(e){const{scrollTop:t,scrollHeight:n,clientHeight:i}=e.target;n-t-i<100&&_e()},function(){try{if(!ne.trim())return void alert("Please enter some JSON to reformat");const e=JSON.parse(ne);n(33,ne=JSON.stringify(e,null,2))}catch(e){alert("Invalid JSON: "+e.message)}},async function(){try{if(!ne.trim())return void alert("Please enter an event to sign");if(!u||!d)return void alert("Please log in to sign events");if(!g)return void alert("No signer available. Please log in with a valid authentication method.");const e=JSON.parse(ne);e.pubkey=d,e.created_at=Math.floor(Date.now()/1e3),delete e.id,delete e.sig;const t=await g.signEvent(e);n(33,ne=JSON.stringify(t,null,2)),alert("Event signed successfully!")}catch(e){console.error("Error signing event:",e),alert("Error signing event: "+e.message)}},async function(){n(34,ie="");try{if(!ne.trim())return void n(34,ie="Please enter an event to publish");if(!u)return void n(34,ie="Please log in to publish events");if(!g)return void n(34,ie="No signer available. Please log in with a valid authentication method.");let e;try{e=JSON.parse(ne)}catch(e){return void n(34,ie=`Invalid JSON: ${e.message}`)}if(!e.id||!e.sig)return void n(34,ie='Event must be signed before publishing. Please click "Sign" first.');if("read"===h)return void n(34,ie=`Permission denied: Your current role is "${h}" which does not allow publishing events. Contact a relay administrator to upgrade your permissions.`);const t=`${window.location.protocol.startsWith("https")?"wss:":"ws:"}//${window.location.host}/`,i=await LA(t,e,g,d);if(i.success)n(34,ie=""),alert("Event published successfully to ORLY relay!");else{const t=i.reason||"Unknown error";n(34,ie=Me(t,e.kind))}}catch(e){console.error("Error publishing event:",e);const t=e.message||"Unknown error";n(34,ie=Me(t,null))}},function(){n(34,ie="")},ze,function(){const e=["owner","admin","write","read"],t=e.indexOf(h);return-1===t?["read"]:e.slice(t)},k,F,H,X,Ne,s,function(t){R.call(this,e,t)},function(t){R.call(this,e,t)},e=>e.id===y,e=>xe(e.detail),e=>Qe(e.detail),e=>ue(e.detail),e=>fe(e.detail),e=>de(e.detail.event,e.detail.e),e=>Ue(e.detail.refresh,e.detail.authors),function(e){ne=e,n(33,ne)},function(e){N=e,n(19,N)},e=>Ae(e.detail),e=>be(e.detail),function(e){J=e,n(26,J)},function(){re=x(this),n(35,re)},function(){se=b(this.value),n(36,se)},e=>ge(e),e=>he(e),(e,t)=>de(e,t),e=>Fe(e.id,!0),e=>Be(e.id),e=>fe(e.id),e=>ue(e.id),(e,t)=>"Enter"===t.key&&ue(e.id),(e,t)=>de(e,t),(e,t)=>De(t,e.id),e=>ze(e===h?"":e),e=>"Escape"===e.key&&Se(),function(e){c=e,n(12,c)}]}return new class extends se{constructor(e){super(),re(this,e,Gb,zb,s,{},null,[-1,-1,-1,-1,-1,-1])}}({target:document.body,props:{name:"world"}})}(); //# sourceMappingURL=bundle.js.map