@liascript/editor 1.1.43--2.0.0 → 1.1.43--2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/{Nostr.7dd5b16f.js → Nostr.2b404c26.js} +1 -1
- package/dist/Nostr.2c8140ac.js +1 -0
- package/dist/{Nostr.d5fd1741.js → Nostr.329b3a71.js} +1 -1
- package/dist/Nostr.d5c9f5db.js +1 -0
- package/dist/index.638c2ff6.js +1 -0
- package/dist/{index.e62c9000.js → index.6d17c2da.js} +1 -1
- package/dist/{index.db8adaa8.js → index.931d5a80.js} +1 -1
- package/dist/index.9ecf099d.js +1 -0
- package/dist/index.a89e1a4c.js +1 -0
- package/dist/index.b1a8e24f.js +1 -0
- package/dist/index.c7acbc74.css +1 -0
- package/dist/{index.2895193e.js → index.ecd8f2b1.js} +1 -1
- package/dist/{index.91235e1d.js → index.ff48c76f.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/{jszip.min.78e0bc9c.js → jszip.min.a7b69263.js} +1 -1
- package/package.json +2 -1
- package/dist/Nostr.3763eaea.js +0 -1
- package/dist/Nostr.ebd98156.js +0 -1
- package/dist/index.0adf7e2c.js +0 -1
- package/dist/index.107e5107.js +0 -1
- package/dist/index.2c23dc71.js +0 -1
- package/dist/index.56307c98.css +0 -1
- package/dist/index.84d1949a.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,e,s,n){Object.defineProperty(t,e,{get:s,set:n,enumerable:!0,configurable:!0})}var e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).parcelRequirea18f;e.register("1LTHS",(function(s,n){t(s.exports,"Sync",(()=>c));var i=e("bQEo7"),o=e("bg4bp"),r=e("6frWy"),h=e("3MQ2P"),l=e("kPRWr");class c extends i.Sync{persistent=!1;syncFallbackTimer=null;destroy(){null!==this.syncFallbackTimer&&(clearTimeout(this.syncFallbackTimer),this.syncFallbackTimer=null),super.destroy(),this.provider?.disconnect()}async connect(t){super.connect(t),this.relayUrls=t.config?.relayUrls?.length?t.config.relayUrls:void 0,this.persistent=t.config?.persistent||!1;const e=[];window.NostrTools||e.push("https://cdn.jsdelivr.net/npm/nostr-tools@2/lib/nostr.bundle.js"),this.password&&!window.SimpleCrypto&&e.push(l.Crypto.url),0===e.length?this.init(!0):this.load(e,this)}init(t,e){const s=this.uniqueID();if(t&&window.NostrTools&&s){this.password&&l.Crypto.init(this.password);const t=window.NostrTools;class e extends t.SimplePool{constructor(){super({enableReconnect:!0})}}this.transport=new(0,o.NostrTransport)({finalizeEvent:t.finalizeEvent,getPublicKey:t.getPublicKey,SimplePool:e}),this.provider=new(0,r.GenericProvider)(this.db.doc,(0,h.wrapTransport)(this.transport,this.password)),this.db.setAwareness(this.provider.awareness,this.name);let n=!1;const i=()=>{n||(n=!0,null!==this.syncFallbackTimer&&(clearTimeout(this.syncFallbackTimer),this.syncFallbackTimer=null),this.sendConnect())};this.provider.on("synced",(t=>{console.log("Nostr: document synchronized",t.synced),i()})),this.provider.on("status",(t=>{const e=t.state;console.log(`Nostr status: ${e}`),"connected"===e?this.syncFallbackTimer=setTimeout((()=>{console.log("Nostr: sync fallback, proceeding as first peer"),i()}),2e3):"disconnected"===e&&console.warn("Nostr: disconnected")})),this.provider.pubsub.subscribe("*",((t,e)=>{this.onReceive?.(e,t)})),this.provider.connect({room:s,relays:this.relayUrls,persistent:this.persistent,doc:this.persistent?this.db.doc:void 0,waitFor:this.persistReady,...this.password?{password:this.password}:{}})}else{let t="Nostr unknown error";e?t="Could not load resource: "+e:window.NostrTools||(t="Could not load nostr-tools"),this.sendDisconnectError(t)}}pubsubSend(t,e){this.provider&&(this.provider.pubsub.publish(t,e),this.replyOnReceive&&this.onReceive?.(t,e))}}})),e.register("bg4bp",(function(s,n){t(s.exports,"NostrTransport",(()=>p));var i=e("bx9uf"),o=e("7BTJz"),r=e("1n84c");const h=6e4,l=(()=>{const t=new Uint32Array(256);for(let e=0;e<256;e++){let s=e;for(let t=0;t<8;t++)s=1&s?3988292384^s>>>1:s>>>1;t[e]=s}return t})();function c(t){let e="";for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return btoa(e)}function a(t){const e=atob(t),s=new Uint8Array(e.length);for(let t=0;t<e.length;t++)s[t]=e.charCodeAt(t);return s}const u=["wss://relay.damus.io","wss://nos.lol","wss://nostr.mom"];class p{constructor(t){this.preferredBatchMs=150,this.preferredCompressMinBytes=2048,this.expectedRttMs=600,this._connected=!1,this._buffer=[],this._chunks=new(0,r.ChunkAssembler),this.pool=null,this.sub=null,this.relays=[],this.pubkey="",this.roomTag="",this.persistentMode=!1,this.doc=null,this.persistentKind=30078,this.persistDebounceMs=2e3,this.isPublishingSnapshot=!1,this.publishPending=!1,this.snapshotSub=null,this.snapshotChunks=new(0,r.ChunkAssembler),this._onDocUpdate=()=>this._queueSnapshotPublish(),this.opts=t,this.eventKind=t.eventKind??27370,this.secretKey=t.secretKey??new Uint8Array(32)}get isConnected(){return this._connected}async connect(t){if(this._connected)throw new Error("NostrTransport: already connected");const e=t.debug??this.opts.debug??!1;this.relays=t.relays&&t.relays.length>0?t.relays:u,this.opts.secretKey?this.secretKey=this.opts.secretKey:this.secretKey=crypto.getRandomValues(new Uint8Array(32)),this.pubkey=this.opts.getPublicKey(this.secretKey),this.roomTag=t.password?`${t.room}-${await async function(t){const e=(new TextEncoder).encode(t),s=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(s)).map((t=>t.toString(16).padStart(2,"0"))).join("").substring(0,16)}(t.password)}`:t.room;const s=t.historyWindowSecs??86400,n=s>0?Math.floor(Date.now()/1e3)-s:Math.floor(Date.now()/1e3),i={kinds:[this.eventKind],"#r":[this.roomTag],since:n};if(this.pool=new this.opts.SimplePool,e&&console.log("[NostrTransport] Connecting. relays:",this.relays,"room:",this.roomTag,"kind:",this.eventKind,"filter.since:",n),this.sub=this.pool.subscribeMany(this.relays,i,{onevent:t=>{if(t.pubkey!==this.pubkey){e&&console.log("[NostrTransport] Received event",t.id.substring(0,8),"from",t.pubkey.substring(0,8));try{let e=t.content;if(e.startsWith("{")){const t=JSON.parse(e);if(!(0,r.isChunk)(t))return;const s=this._chunks.push(t);if(null===s)return;e=s}this._deliver(a(e))}catch(t){console.warn("[NostrTransport] Failed to decode event content:",t)}}},oneose:()=>{e&&console.log("[NostrTransport] EOSE — stored events delivered")}}),this._connected=!0,this.persistentMode=t.persistent??!1,this.persistentMode){if(!t.doc)throw new Error("NostrTransport: config.doc is required when persistent is true");this.doc=t.doc,this.persistentKind=t.persistentKind??30078,this.persistDebounceMs=t.persistDebounceMs??2e3;const s=Array.from({length:20},((t,e)=>`${this.roomTag}#${e}`));this.snapshotSub=this.pool.subscribeMany(this.relays,{kinds:[this.persistentKind],"#d":s},{onevent:t=>{try{const s=JSON.parse(t.content);if(!(0,r.isChunk)(s))return;const n=this.snapshotChunks.push(s);if(null===n)return;const i=a(n),h=o.createEncoder();o.writeVarUint(h,6),o.writeVarUint8Array(h,i),this._deliver(function(t){const e=function(t){let e=4294967295;for(let s=0;s<t.length;s++)e=e>>>8^l[255&(e^t[s])];return(4294967295^e)>>>0}(t),s=new Uint8Array(5+t.length);return s[1]=e>>>24&255,s[2]=e>>>16&255,s[3]=e>>>8&255,s[4]=255&e,s.set(t,5),s}(o.toUint8Array(h))),e&&console.log("[NostrTransport] Applied persisted snapshot,",i.length,"bytes")}catch(t){console.warn("[NostrTransport] Failed to decode snapshot event:",t)}}}),this.doc.on("update",this._onDocUpdate)}e&&console.log("[NostrTransport] Connected, pubkey:",this.pubkey)}disconnect(){this.sub&&(this.sub.close(),this.sub=null),this.snapshotSub&&(this.snapshotSub.close(),this.snapshotSub=null),this.doc&&(this.doc.off("update",this._onDocUpdate),this.doc=null),this.persistTimer&&(clearTimeout(this.persistTimer),this.persistTimer=void 0),this.persistentMode=!1,this.publishPending=!1,this.snapshotChunks.clear(),this.pool&&(this.pool.close(this.relays),this.pool=null),this._connected=!1,this._buffer=[]}async send(t){if(!this._connected||!this.pool)return void console.warn("[NostrTransport] Cannot send: not connected");const e=c(t),s=e.length>h?(0,r.splitChunks)(e,h).map((t=>JSON.stringify(t))):[e];for(const t of s){const e=this.opts.finalizeEvent({kind:this.eventKind,created_at:Math.floor(Date.now()/1e3),tags:[["r",this.roomTag]],content:t},this.secretKey);await Promise.allSettled(this.pool.publish(this.relays,e))}}_queueSnapshotPublish(){this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout((()=>this._publishSnapshot()),this.persistDebounceMs)}async _publishSnapshot(){if(this.pool&&this.doc)if(this.isPublishingSnapshot)this.publishPending=!0;else{this.isPublishingSnapshot=!0,this.publishPending=!1;try{const t=c(i.encodeStateAsUpdate(this.doc)),e=(0,r.splitChunks)(t,h);if(e.length>20)return void console.warn(`[NostrTransport] Snapshot needs ${e.length} chunks, more than MAX_SNAPSHOT_CHUNKS (20); skipping this publish. The live update channel still keeps connected peers in sync; the next smaller snapshot will catch late joiners up again.`);for(const t of e){const e=this.opts.finalizeEvent({kind:this.persistentKind,created_at:Math.floor(Date.now()/1e3),tags:[["d",`${this.roomTag}#${t.index}`]],content:JSON.stringify(t)},this.secretKey);await Promise.allSettled(this.pool.publish(this.relays,e))}}catch(t){console.warn("[NostrTransport] Failed to publish snapshot:",t)}finally{this.isPublishingSnapshot=!1,this.publishPending&&this._queueSnapshotPublish()}}}onMessage(t){if(this._callback=t,this._buffer.length>0){for(const e of this._buffer)t(e);this._buffer=[]}return()=>{this._callback=void 0}}_deliver(t){this._callback?this._callback(t):this._buffer.push(t)}}})),e.register("1n84c",(function(e,s){function n(t){return"object"==typeof t&&null!==t&&!0===t.chunked&&"string"==typeof t.id&&"string"==typeof t.data}function i(t,e){const s=Math.random().toString(36).slice(2)+Date.now().toString(36),n=Math.max(1,Math.ceil(t.length/e)),i=[];for(let o=0;o<n;o++)i.push({chunked:!0,id:s,index:o,total:n,data:t.slice(o*e,(o+1)*e)});return i}t(e.exports,"isChunk",(()=>n)),t(e.exports,"splitChunks",(()=>i)),t(e.exports,"ChunkAssembler",(()=>o));class o{constructor(t=32){this.maxPending=t,this.pending=new Map}push(t){let e=this.pending.get(t.id);if(e||(this.pending.size>=this.maxPending&&this.pending.delete(this.pending.keys().next().value),e=new Map,this.pending.set(t.id,e)),e.set(t.index,t.data),e.size<t.total)return null;this.pending.delete(t.id);let s="";for(let n=0;n<t.total;n++){const t=e.get(n);if(void 0===t)return null;s+=t}return s}clear(){this.pending.clear()}}})),e.register("b3MRX",(function(t,e){var s,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function h(t){if(s===setTimeout)return setTimeout(t,0);if((s===o||!s)&&setTimeout)return s=setTimeout,setTimeout(t,0);try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:o}catch(t){s=o}try{n="function"==typeof clearTimeout?clearTimeout:r}catch(t){n=r}}();var l,c=[],a=!1,u=-1;function p(){a&&l&&(a=!1,l.length?c=l.concat(c):u=-1,c.length&&d())}function d(){if(!a){var t=h(p);a=!0;for(var e=c.length;e;){for(l=c,c=[];++u<e;)l&&l[u].run();u=-1,e=c.length}l=null,a=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===r||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function b(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)e[s-1]=arguments[s];c.push(new f(t,e)),1!==c.length||a||h(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=b,i.addListener=b,i.once=b,i.off=b,i.removeListener=b,i.removeAllListeners=b,i.emit=b,i.prependListener=b,i.prependOnceListener=b,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}));
|