@graffiti-garden/wrapper-synchronize 1.0.7 → 1.0.8
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/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/cjs/index.js +1 -30
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.js +2 -21
- package/dist/esm/index.js.map +2 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/index.ts +2 -34
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as a,c as u,d as c}from"./chunk-YB7WCAZH.js";a();c();u();a();c();u();a();c();u();a();c();u();var At={type:"object",properties:{value:{type:"object"},channels:{type:"array",items:{type:"string"}},allowed:{type:"array",items:{type:"string"},nullable:!0},url:{type:"string"},actor:{type:"string"}},additionalProperties:!1,required:["value","channels","actor","url"]},Gr={...At,required:["value","channels"]};a();c();u();var W=class e extends Error{constructor(t){super(t),this.name="GraffitiErrorNotFound",Object.setPrototypeOf(this,e.prototype)}},q=class e extends Error{constructor(t){super(t),this.name="GraffitiErrorInvalidSchema",Object.setPrototypeOf(this,e.prototype)}};a();c();u();function ae(e){return typeof e=="string"?e:e.url}function Re(e,t){return!Array.isArray(e.allowed)||typeof t?.actor=="string"&&(e.actor===t.actor||e.allowed.includes(t.actor))}function Fe(e,t,r){if(r===e.actor)return e;let n=e.allowed&&r?[r]:void 0,i=e.channels.filter(o=>t.includes(o));return{...e,allowed:n,channels:i}}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var Mt=Object.freeze({status:"aborted"});function I(e,t,r){function n(l,m){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:m,constr:s,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,m);let d=s.prototype,h=Object.keys(d);for(let _=0;_<h.length;_++){let f=h[_];f in l||(l[f]=d[f].bind(l))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(l){var m;let d=r?.Parent?new o:this;n(d,l),(m=d._zod).deferred??(m.deferred=[]);for(let h of d._zod.deferred)h();return d}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var D=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};var be={};function N(e){return e&&Object.assign(be,e),be}a();c();u();a();c();u();a();c();u();function Ge(e,t){return typeof t=="bigint"?t.toString():t}function ze(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function se(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var Ve=Symbol("evaluating");function S(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ve)return n===void 0&&(n=Ve,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Lt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ct(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}var Ie="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Rt=ze(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Je(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ce(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function X(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function U(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Be(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ke={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function We(e,t){if(!Je(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ct(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Lt(this,"shape",o),o}});return X(e,i)}function F(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ue(e){return typeof e=="string"?e:e?.message}function A(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=ue(e.inst?._zod.def?.error?.(e))??ue(t?.error?.(e))??ue(r.customError?.(e))??ue(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function we(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var qe=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ge,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Xe=I("$ZodError",qe),Y=I("$ZodError",qe,{Parent:Error});var Vt=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new D;if(s.issues.length){let l=new(i?.Err??e)(s.issues.map(m=>A(m,o,N())));throw Ie(l,i?.callee),l}return s.value},de=Vt(Y),Gt=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let l=new(i?.Err??e)(s.issues.map(m=>A(m,o,N())));throw Ie(l,i?.callee),l}return s.value},me=Gt(Y),Jt=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new D;return o.issues.length?{success:!1,error:new(e??Xe)(o.issues.map(s=>A(s,i,N())))}:{success:!0,data:o.value}},H=Jt(Y),Bt=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>A(s,i,N())))}:{success:!0,data:o.value}},Q=Bt(Y);a();c();u();a();c();u();a();c();u();var Kt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Wt=new RegExp(`^${Kt}$`);var He=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Qe=/^-?\d+$/,et=/^-?\d+(?:\.\d+)?$/;var M=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),qt={number:"number",bigint:"bigint",object:"date"};var tt=I("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let r=qt[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var rt=I("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Ke[t.format];e._zod.onattach.push(s=>{let l=s._zod.bag;l.format=t.format,l.minimum=i,l.maximum=o,r&&(l.pattern=Qe)}),e._zod.check=s=>{let l=s.value;if(r){if(!Number.isInteger(l)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<i&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),l>o&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var nt=I("$ZodCheckStringFormat",(e,t)=>{var r,n;M.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})});a();c();u();a();c();u();var ot={major:4,minor:3,patch:5};var P=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ot;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,l,m)=>{let d=F(s),h;for(let _ of l){if(_._zod.def.when){if(!_._zod.def.when(s))continue}else if(d)continue;let f=s.issues.length,k=_._zod.check(s);if(k instanceof Promise&&m?.async===!1)throw new D;if(h||k instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await k,s.issues.length!==f&&(d||(d=F(s,f)))});else{if(s.issues.length===f)continue;d||(d=F(s,f))}}return h?h.then(()=>s):s},o=(s,l,m)=>{if(F(s))return s.aborted=!0,s;let d=i(l,n,m);if(d instanceof Promise){if(m.async===!1)throw new D;return d.then(h=>e._zod.parse(h,m))}return e._zod.parse(d,m)};e._zod.run=(s,l)=>{if(l.skipChecks)return e._zod.parse(s,l);if(l.direction==="backward"){let d=e._zod.parse({value:s.value,issues:[]},{...l,skipChecks:!0});return d instanceof Promise?d.then(h=>o(h,s,l)):o(d,s,l)}let m=e._zod.parse(s,l);if(m instanceof Promise){if(l.async===!1)throw new D;return m.then(d=>i(d,n,l))}return i(m,n,l)}}S(e,"~standard",()=>({validate:i=>{try{let o=H(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Q(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),pe=I("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??He(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Se=I("$ZodStringFormat",(e,t)=>{nt.init(e,t),pe.init(e,t)});var lt=I("$ZodURL",(e,t)=>{Se.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var je=I("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??et,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),dt=I("$ZodNumberFormat",(e,t)=>{rt.init(e,t),je.init(e,t)});var mt=I("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r});function at(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}var ft=I("$ZodArray",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let l=i[s],m=t.element._zod.run({value:l,issues:[]},n);m instanceof Promise?o.push(m.then(d=>at(d,r,s))):at(m,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function fe(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...le(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Yt(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Be(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ht(e,t,r,n,i,o){let s=[],l=i.keySet,m=i.catchall._zod,d=m.def.type,h=m.optout==="optional";for(let _ in t){if(l.has(_))continue;if(d==="never"){s.push(_);continue}let f=m.run({value:t[_],issues:[]},n);f instanceof Promise?e.push(f.then(k=>fe(k,r,_,t,h))):fe(f,r,_,t,h)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var pt=I("$ZodObject",(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:()=>{let m={...l};return Object.defineProperty(t,"shape",{value:m}),m}})}let n=ze(()=>Yt(t));S(e._zod,"propValues",()=>{let l=t.shape,m={};for(let d in l){let h=l[d]._zod;if(h.values){m[d]??(m[d]=new Set);for(let _ of h.values)m[d].add(_)}}return m});let i=ce,o=t.catchall,s;e._zod.parse=(l,m)=>{s??(s=n.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value={};let h=[],_=s.shape;for(let f of s.keys){let k=_[f],z=k._zod.optout==="optional",w=k._zod.run({value:d[f],issues:[]},m);w instanceof Promise?h.push(w.then(j=>fe(j,l,f,d,z))):fe(w,l,f,d,z)}return o?Ht(h,d,l,m,n.value,e):h.length?Promise.all(h).then(()=>l):l}});function ut(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!F(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>A(s,n,N())))}),t)}var vt=I("$ZodUnion",(e,t)=>{P.init(e,t),S(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>se(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let s=!1,l=[];for(let m of t.options){let d=m._zod.run({value:i.value,issues:[]},o);if(d instanceof Promise)l.push(d),s=!0;else{if(d.issues.length===0)return d;l.push(d)}}return s?Promise.all(l).then(m=>ut(m,i,e,o)):ut(l,i,e,o)}});function ct(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var gt=I("$ZodOptional",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${se(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ct(o,r.value)):ct(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var ht=I("$ZodNullable",(e,t)=>{P.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${se(r.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var $t=I("$ZodCustom",(e,t)=>{M.init(e,t),P.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>st(o,r,n,e));st(i,r,n,e)}});function st(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(we(i))}}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var yt;var Pe=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function xt(){return new Pe}(yt=globalThis).__zod_globalRegistry??(yt.__zod_globalRegistry=xt());var Ue=globalThis.__zod_globalRegistry;a();c();u();function bt(e,t){return new e({type:"string",...U(t)})}function kt(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(t)})}function zt(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(t)})}function It(e){return new e({type:"unknown"})}function Oe(e,t){return new tt({check:"greater_than",...U(t),value:e,inclusive:!0})}function De(e){return Oe(0,e)}function wt(e,t,r){let n=U(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var Z=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");P.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>de(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>H(e,r,n),e.parseAsync=async(r,n)=>me(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Q(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>X(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ze=I("ZodMiniString",(e,t)=>{pe.init(e,t),Z.init(e,t)});function Te(e){return bt(Ze,e)}var St=I("ZodMiniStringFormat",(e,t)=>{Se.init(e,t),Ze.init(e,t)});var mr=I("ZodMiniURL",(e,t)=>{lt.init(e,t),St.init(e,t)});function T(e){return kt(mr,e)}var jt=I("ZodMiniNumber",(e,t)=>{je.init(e,t),Z.init(e,t)});var fr=I("ZodMiniNumberFormat",(e,t)=>{dt.init(e,t),jt.init(e,t)});function Pt(e){return zt(fr,e)}var pr=I("ZodMiniUnknown",(e,t)=>{mt.init(e,t),Z.init(e,t)});function vr(){return It(pr)}var gr=I("ZodMiniArray",(e,t)=>{ft.init(e,t),Z.init(e,t)});function te(e,t){return new gr({type:"array",element:e,...U(t)})}var hr=I("ZodMiniObject",(e,t)=>{pt.init(e,t),Z.init(e,t),S(e,"shape",()=>t.shape)});function L(e,t){return new hr({type:"object",shape:e,catchall:vr(),...U(t)})}function Ne(e,t){return We(e,t)}var $r=I("ZodMiniUnion",(e,t)=>{vt.init(e,t),Z.init(e,t)});function Ut(e,t){return new $r({type:"union",options:e,...U(t)})}var _r=I("ZodMiniOptional",(e,t)=>{gt.init(e,t),Z.init(e,t)});function V(e){return new _r({type:"optional",innerType:e})}var yr=I("ZodMiniNullable",(e,t)=>{ht.init(e,t),Z.init(e,t)});function ge(e){return new yr({type:"nullable",innerType:e})}var xr=I("ZodMiniCustom",(e,t)=>{$t.init(e,t),Z.init(e,t)});function br(e,t){return wt(xr,e??(()=>!0),t)}function Ot(e,t={}){let r=br(n=>n instanceof e,t);return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}a();c();u();a();c();u();a();c();u();var Sr=L({value:L({}),channels:te(Te()),allowed:V(ge(te(T())))}),Xp=Ne(Sr,{url:T(),actor:T()}),Yp=Ut([L({url:T()}),T()]),jr=L({actor:T()}),Hp=V(ge(jr)),Pr=L({data:Ot(Blob),allowed:V(ge(te(T())))}),Qp=Ne(Pr,{actor:T()}),ev=L({types:V(te(Te())),maxBytes:V(Pt().check(De()))});a();c();u();var Ae=function(e,t){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ae(e,t)};function Ur(e,t){Ae(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function J(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(h){try{d(n.next(h))}catch(_){s(_)}}function m(h){try{d(n.throw(h))}catch(_){s(_)}}function d(h){h.done?o(h.value):i(h.value).then(l,m)}d((n=n.apply(e,t||[])).next())})}function E(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(d){return function(h){return m([d,h])}}function m(d){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,i=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(d[0]===6&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=t.call(e,r)}catch(h){d=[6,h],i=0}finally{n=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function B(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ne(e){return this instanceof ne?(this.v=e,this):new ne(e)}function Or(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){n[f]&&(i[f]=function(k){return new Promise(function(z,w){o.push([f,k,z,w])>1||l(f,k)})})}function l(f,k){try{m(n[f](k))}catch(z){_(o[0][3],z)}}function m(f){f.value instanceof ne?Promise.resolve(f.value.v).then(d,h):_(o[0][2],f)}function d(f){l("next",f)}function h(f){l("throw",f)}function _(f,k){f(k),o.shift(),o.length&&l(o[0][0],o[0][1])}}var Nt=(function(e){Ur(t,e);function t(r){var n=e.call(this,r)||this;return Object.defineProperty(n,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(n,n.constructor.prototype):n.__proto__=n.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(n,n.constructor),n}return t})(Error),pv=(function(){function e(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),e.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})(),vv=(function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})(),gv=(function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){this._q.length<this._c&&this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})();function Me(e){e!=null&&typeof e.then=="function"&&e.then(ye,ye)}var Ee=0,Zt=1,R=2,$e=3,Le=4,_e=1024,ye=function(){};function G(e){var t=e.err,r=Promise.resolve(e.execution).then(function(n){if(t!=null)throw t;return n});return e.err=void 0,e.execution=r.then(function(){},function(){}),e.pending===void 0?r:e.pending.then(function(){return r})}function C(e,t){var r=e.state>=$e;return Promise.resolve(t).then(function(n){return!r&&e.state>=Le?G(e).then(function(i){return{value:i,done:!0}}):{value:n,done:r}})}function Ce(e,t){var r,n;if(!(e.state>=R))if(e.state=R,e.onnext(),e.onstop(),e.err==null&&(e.err=t),e.pushes.length===0&&(typeof e.buffer>"u"||e.buffer.empty))re(e);else try{for(var i=B(e.pushes),o=i.next();!o.done;o=i.next()){var s=o.value;s.resolve()}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function re(e){var t,r;if(!(e.state>=$e)){e.state<R&&Ce(e),e.state=$e,e.buffer=void 0;try{for(var n=B(e.nexts),i=n.next();!i.done;i=n.next()){var o=i.value,s=e.pending===void 0?G(e):e.pending.then(function(){return G(e)});o.resolve(C(e,s))}}catch(l){t={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.pushes=[],e.nexts=[]}}function Tt(e){e.state>=Le||(e.state<$e&&re(e),e.state=Le)}function Dr(e,t){if(Me(t),e.pushes.length>=_e)throw new Nt("No more than "+_e+" pending calls to push are allowed on a single repeater.");if(e.state>=R)return Promise.resolve(void 0);var r=e.pending===void 0?Promise.resolve(t):e.pending.then(function(){return t});r=r.catch(function(m){e.state<R&&(e.err=m),Tt(e)});var n;if(e.nexts.length){var i=e.nexts.shift();i.resolve(C(e,r)),e.nexts.length?n=Promise.resolve(e.nexts[0].value):typeof e.buffer<"u"&&!e.buffer.full?n=Promise.resolve(void 0):n=new Promise(function(m){return e.onnext=m})}else typeof e.buffer<"u"&&!e.buffer.full?(e.buffer.add(r),n=Promise.resolve(void 0)):n=new Promise(function(m){return e.pushes.push({resolve:m,value:r})});var o=!0,s={},l=n.catch(function(m){if(o)throw m});return s.then=function(m,d){return o=!1,Promise.prototype.then.call(n,m,d)},s.catch=function(m){return o=!1,Promise.prototype.catch.call(n,m)},s.finally=n.finally.bind(n),e.pending=r.then(function(){return l}).catch(function(m){e.err=m,Tt(e)}),s}function Zr(e){var t=Ce.bind(null,e),r=new Promise(function(n){return e.onstop=n});return t.then=r.then.bind(r),t.catch=r.catch.bind(r),t.finally=r.finally.bind(r),t}function Tr(e){if(!(e.state>=Zt)){e.state=Zt;var t=Dr.bind(null,e),r=Zr(e);e.execution=new Promise(function(n){return n(e.executor(t,r))}),e.execution.catch(function(){return Ce(e)})}}var he=new WeakMap,K=(function(){function e(t,r){he.set(this,{executor:t,buffer:r,err:void 0,state:Ee,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:ye,onstop:ye})}return e.prototype.next=function(t){Me(t);var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=_e)throw new Nt("No more than "+_e+" pending calls to next are allowed on a single repeater.");if(r.state<=Ee&&Tr(r),r.onnext(t),typeof r.buffer<"u"&&!r.buffer.empty){var n=C(r,r.buffer.remove());if(r.pushes.length){var i=r.pushes.shift();r.buffer.add(i.value),r.onnext=i.resolve}return n}else if(r.pushes.length){var o=r.pushes.shift();return r.onnext=o.resolve,C(r,o.value)}else if(r.state>=R)return re(r),C(r,G(r));return new Promise(function(s){return r.nexts.push({resolve:s,value:t})})},e.prototype.return=function(t){Me(t);var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");return re(r),r.execution=Promise.resolve(r.execution).then(function(){return t}),C(r,G(r))},e.prototype.throw=function(t){var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=Ee||r.state>=R||typeof r.buffer<"u"&&!r.buffer.empty?(re(r),r.err==null&&(r.err=t),C(r,G(r))):this.next(Promise.reject(t))},e.prototype[Symbol.asyncIterator]=function(){return this},e.race=Nr,e.merge=Er,e.zip=Ar,e.latest=Mr,e})();function xe(e,t){var r,n,i=[],o=function(d){d!=null&&typeof d[Symbol.asyncIterator]=="function"?i.push(d[Symbol.asyncIterator]()):d!=null&&typeof d[Symbol.iterator]=="function"?i.push(d[Symbol.iterator]()):i.push((function(){return Or(this,arguments,function(){return E(this,function(f){switch(f.label){case 0:return t.yieldValues?[4,ne(d)]:[3,3];case 1:return[4,f.sent()];case 2:f.sent(),f.label=3;case 3:return t.returnValues?[4,ne(d)]:[3,5];case 4:return[2,f.sent()];case 5:return[2]}})})})())};try{for(var s=B(e),l=s.next();!l.done;l=s.next()){var m=l.value;o(m)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i}function Nr(e){var t=this,r=xe(e,{returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,s,l,m,d,h;return E(this,function(_){switch(_.label){case 0:if(!r.length)return i(),[2];s=!1,i.then(function(){o(),s=!0}),_.label=1;case 1:_.trys.push([1,,5,7]),m=void 0,d=0,h=function(){var f,k,z,w,j,ie;return E(this,function(oe){switch(oe.label){case 0:f=d;try{for(k=(j=void 0,B(r)),z=k.next();!z.done;z=k.next())w=z.value,Promise.resolve(w.next()).then(function(O){O.done?(i(),l===void 0&&(l=O)):d===f&&(d++,o(O))},function(O){return i(O)})}catch(O){j={error:O}}finally{try{z&&!z.done&&(ie=k.return)&&ie.call(k)}finally{if(j)throw j.error}}return[4,new Promise(function(O){return o=O})];case 1:return m=oe.sent(),m===void 0?[3,3]:[4,n(m.value)];case 2:oe.sent(),oe.label=3;case 3:return[2]}})},_.label=2;case 2:return s?[3,4]:[5,h()];case 3:return _.sent(),[3,2];case 4:return[2,l&&l.value];case 5:return i(),[4,Promise.race(r.map(function(f){return f.return&&f.return()}))];case 6:return _.sent(),[7];case 7:return[2]}})})})}function Er(e){var t=this,r=xe(e,{yieldValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,s,l,m=this;return E(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2];o=[],s=!1,i.then(function(){var h,_;s=!0;try{for(var f=B(o),k=f.next();!k.done;k=f.next()){var z=k.value;z()}}catch(w){h={error:w}}finally{try{k&&!k.done&&(_=f.return)&&_.call(f)}finally{if(h)throw h.error}}}),d.label=1;case 1:return d.trys.push([1,,3,4]),[4,Promise.all(r.map(function(h,_){return J(m,void 0,void 0,function(){var f,k;return E(this,function(z){switch(z.label){case 0:z.trys.push([0,,6,9]),z.label=1;case 1:return s?[3,5]:(Promise.resolve(h.next()).then(function(w){return o[_](w)},function(w){return i(w)}),[4,new Promise(function(w){o[_]=w})]);case 2:return f=z.sent(),f===void 0?[3,4]:f.done?(l=f,[2]):[4,n(f.value)];case 3:z.sent(),z.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return k=h.return,k?[4,h.return()]:[3,8];case 7:k=z.sent(),z.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return d.sent(),[2,l&&l.value];case 3:return i(),[7];case 4:return[2]}})})})}function Ar(e){var t=this,r=xe(e,{returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,s,l,m;return E(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2,[]];s=!1,i.then(function(){o(),s=!0}),d.label=1;case 1:d.trys.push([1,,6,8]),d.label=2;case 2:return s?[3,5]:(Promise.all(r.map(function(h){return h.next()})).then(function(h){return o(h)},function(h){return i(h)}),[4,new Promise(function(h){return o=h})]);case 3:return l=d.sent(),l===void 0?[2]:(m=l.map(function(h){return h.value}),l.some(function(h){return h.done})?[2,m]:[4,n(m)]);case 4:return d.sent(),[3,2];case 5:return[3,8];case 6:return i(),[4,Promise.all(r.map(function(h){return h.return&&h.return()}))];case 7:return d.sent(),[7];case 8:return[2]}})})})}function Mr(e){var t=this,r=xe(e,{yieldValues:!0,returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,s,l,m,d,h=this;return E(this,function(_){switch(_.label){case 0:if(!r.length)return i(),[2,[]];s=[],l=!1,i.then(function(){var f,k;o();try{for(var z=B(s),w=z.next();!w.done;w=z.next()){var j=w.value;j()}}catch(ie){f={error:ie}}finally{try{w&&!w.done&&(k=z.return)&&k.call(z)}finally{if(f)throw f.error}}l=!0}),_.label=1;case 1:return _.trys.push([1,,5,7]),Promise.all(r.map(function(f){return f.next()})).then(function(f){return o(f)},function(f){return i(f)}),[4,new Promise(function(f){return o=f})];case 2:return m=_.sent(),m===void 0?[2]:(d=m.map(function(f){return f.value}),m.every(function(f){return f.done})?[2,d]:[4,n(d.slice())]);case 3:return _.sent(),[4,Promise.all(r.map(function(f,k){return J(h,void 0,void 0,function(){var z;return E(this,function(w){switch(w.label){case 0:if(m[k].done)return[2,m[k].value];w.label=1;case 1:return l?[3,4]:(Promise.resolve(f.next()).then(function(j){return s[k](j)},function(j){return i(j)}),[4,new Promise(function(j){return s[k]=j})]);case 2:return z=w.sent(),z===void 0?[2,m[k].value]:z.done?[2,z.value]:(d[k]=z.value,[4,n(d.slice())]);case 3:return w.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,_.sent()];case 5:return i(),[4,Promise.all(r.map(function(f){return f.return&&f.return()}))];case 6:return _.sent(),[7];case 7:return[2]}})})})}var Et=class{ajv_;graffiti;callbacks=new Set;options;login;logout;sessionEvents;postMedia;getMedia;deleteMedia;actorToHandle;handleToActor;get ajv(){return this.ajv_||(this.ajv_=(async()=>{let{default:t}=await import("./ajv-UZKI6BMI.js");return new t({strict:!1})})()),this.ajv_}constructor(t,r){this.options=r??{},this.graffiti=t,this.login=t.login.bind(t),this.logout=t.logout.bind(t),this.sessionEvents=t.sessionEvents,this.postMedia=t.postMedia.bind(t),this.getMedia=t.getMedia.bind(t),this.deleteMedia=t.deleteMedia.bind(t),this.actorToHandle=t.actorToHandle.bind(t),this.handleToActor=t.handleToActor.bind(t)}synchronize(t,r,n,i,o=new Set){let s=new K(async(l,m)=>{let d=Lr(await this.ajv,n),h=_=>{if(_?.tombstone)o.has(_.object.url)&&l(_);else if(_&&t(_.object)&&(this.options.omniscient||Re(_.object,i))){let f=JSON.parse(JSON.stringify(_.object));this.options.omniscient||(f=Fe(f,r,i?.actor)),d(f)&&(l({object:f}),o.add(f.url))}};this.callbacks.add(h),await m,this.callbacks.delete(h)});return(async function*(){for await(let l of s)yield l})()}synchronizeDiscover(t,r,n){function i(o){return o.channels.some(s=>t.includes(s))}return this.synchronize(i,t,r,n)}synchronizeGet(t,r,n){let i=ae(t);function o(s){return s.url===i}return this.synchronize(o,[],r,n,new Set([i]))}synchronizeAll(t,r){return this.synchronize(()=>!0,[],t,r)}async synchronizeDispatch(t,r=!1){for(let n of this.callbacks)n(t);r&&await new Promise(n=>setTimeout(n,0))}get=async(...t)=>{try{let r=await this.graffiti.get(...t);return this.synchronizeDispatch({object:r}),r}catch(r){throw r instanceof W&&this.synchronizeDispatch({tombstone:!0,object:{url:ae(t[0])}}),r}};post=async(...t)=>{let r=await this.graffiti.post(...t);return await this.synchronizeDispatch({object:r},!0),r};delete=async(...t)=>{let r={tombstone:!0,object:{url:ae(t[0])}};try{let n=await this.graffiti.delete(...t);return await this.synchronizeDispatch(r,!0),n}catch(n){throw n instanceof W&&await this.synchronizeDispatch(r,!0),n}};objectStreamContinue(t){let r=this;return(async function*(){for(;;){let n=await t.next();if(n.done){let{continue:i,cursor:o}=n.value;return{continue:s=>r.objectStreamContinue(i(s)),cursor:o}}n.value.error||r.synchronizeDispatch(n.value),yield n.value}})()}objectStream(t){let r=this.objectStreamContinue(t);return(async function*(){for(;;){let n=await r.next();if(n.done)return n.value;(n.value.error||!n.value.tombstone)&&(yield n.value)}})()}discover=(...t)=>{let r=this.graffiti.discover(...t);return this.objectStream(r)};continueDiscover=(...t)=>{let r=this.graffiti.continueDiscover(...t);return this.objectStreamContinue(r)}};function Lr(e,t){try{return e.compile(t)}catch(r){throw new q(r instanceof Error?r.message:String(r))}}export{Et as GraffitiSynchronize};
|
|
1
|
+
import{b as a,c as u,d as c}from"./chunk-YB7WCAZH.js";a();c();u();a();c();u();a();c();u();a();c();u();var Lt={type:"object",properties:{value:{type:"object"},channels:{type:"array",items:{type:"string"}},allowed:{type:"array",items:{type:"string"},nullable:!0},url:{type:"string"},actor:{type:"string"}},additionalProperties:!1,required:["value","channels","actor","url"]},Jr={...Lt,required:["value","channels"]};a();c();u();var W=class e extends Error{constructor(t){super(t),this.name="GraffitiErrorNotFound",Object.setPrototypeOf(this,e.prototype)}},oe=class e extends Error{constructor(t){super(t),this.name="GraffitiErrorInvalidSchema",Object.setPrototypeOf(this,e.prototype)}};a();c();u();function ae(e){return typeof e=="string"?e:e.url}function Fe(e,t){return!Array.isArray(e.allowed)||typeof t?.actor=="string"&&(e.actor===t.actor||e.allowed.includes(t.actor))}function Ve(e,t,r){if(r===e.actor)return e;let n=e.allowed&&r?[r]:void 0,i=e.channels.filter(o=>t.includes(o));return{...e,allowed:n,channels:i}}var be;async function Ge(e){if(!be){let{default:t}=await import("./ajv-UZKI6BMI.js");be=new t({strict:!1})}try{return be.compile(e)}catch(t){throw new oe(t instanceof Error?t.message:String(t))}}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var Ct=Object.freeze({status:"aborted"});function I(e,t,r){function n(s,m){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:m,constr:l,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,m);let d=l.prototype,h=Object.keys(d);for(let _=0;_<h.length;_++){let f=h[_];f in s||(s[f]=d[f].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function l(s){var m;let d=r?.Parent?new o:this;n(d,s),(m=d._zod).deferred??(m.deferred=[]);for(let h of d._zod.deferred)h();return d}return Object.defineProperty(l,"init",{value:n}),Object.defineProperty(l,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}var D=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};var ke={};function N(e){return e&&Object.assign(ke,e),ke}a();c();u();a();c();u();a();c();u();function Be(e,t){return typeof t=="bigint"?t.toString():t}function Ie(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function le(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var Je=Symbol("evaluating");function S(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Je)return n===void 0&&(n=Je,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Rt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ft(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}var we="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vt=Ie(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ke(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ce(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function q(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function U(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function We(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var qe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Xe(e,t){if(!Ke(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let l in t)if(Object.getOwnPropertyDescriptor(o,l)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ft(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Rt(this,"shape",o),o}});return q(e,i)}function F(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function se(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ue(e){return typeof e=="string"?e:e?.message}function A(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=ue(e.inst?._zod.def?.error?.(e))??ue(t?.error?.(e))??ue(r.customError?.(e))??ue(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Se(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var Ye=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Be,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},He=I("$ZodError",Ye),X=I("$ZodError",Ye,{Parent:Error});var Jt=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new D;if(l.issues.length){let s=new(i?.Err??e)(l.issues.map(m=>A(m,o,N())));throw we(s,i?.callee),s}return l.value},de=Jt(X),Bt=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise&&(l=await l),l.issues.length){let s=new(i?.Err??e)(l.issues.map(m=>A(m,o,N())));throw we(s,i?.callee),s}return l.value},me=Bt(X),Kt=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new D;return o.issues.length?{success:!1,error:new(e??He)(o.issues.map(l=>A(l,i,N())))}:{success:!0,data:o.value}},Y=Kt(X),Wt=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(l=>A(l,i,N())))}:{success:!0,data:o.value}},H=Wt(X);a();c();u();a();c();u();a();c();u();var qt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Xt=new RegExp(`^${qt}$`);var et=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var tt=/^-?\d+$/,rt=/^-?\d+(?:\.\d+)?$/;var M=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Yt={number:"number",bigint:"bigint",object:"date"};var nt=I("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let r=Yt[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var it=I("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=qe[t.format];e._zod.onattach.push(l=>{let s=l._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=tt)}),e._zod.check=l=>{let s=l.value;if(r){if(!Number.isInteger(s)){l.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?l.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):l.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&l.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&l.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var ot=I("$ZodCheckStringFormat",(e,t)=>{var r,n;M.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})});a();c();u();a();c();u();var ut={major:4,minor:3,patch:5};var P=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ut;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(l,s,m)=>{let d=F(l),h;for(let _ of s){if(_._zod.def.when){if(!_._zod.def.when(l))continue}else if(d)continue;let f=l.issues.length,k=_._zod.check(l);if(k instanceof Promise&&m?.async===!1)throw new D;if(h||k instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await k,l.issues.length!==f&&(d||(d=F(l,f)))});else{if(l.issues.length===f)continue;d||(d=F(l,f))}}return h?h.then(()=>l):l},o=(l,s,m)=>{if(F(l))return l.aborted=!0,l;let d=i(s,n,m);if(d instanceof Promise){if(m.async===!1)throw new D;return d.then(h=>e._zod.parse(h,m))}return e._zod.parse(d,m)};e._zod.run=(l,s)=>{if(s.skipChecks)return e._zod.parse(l,s);if(s.direction==="backward"){let d=e._zod.parse({value:l.value,issues:[]},{...s,skipChecks:!0});return d instanceof Promise?d.then(h=>o(h,l,s)):o(d,l,s)}let m=e._zod.parse(l,s);if(m instanceof Promise){if(s.async===!1)throw new D;return m.then(d=>i(d,n,s))}return i(m,n,s)}}S(e,"~standard",()=>({validate:i=>{try{let o=Y(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return H(e,i).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}))}),pe=I("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??et(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),je=I("$ZodStringFormat",(e,t)=>{ot.init(e,t),pe.init(e,t)});var mt=I("$ZodURL",(e,t)=>{je.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Pe=I("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??rt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),ft=I("$ZodNumberFormat",(e,t)=>{it.init(e,t),Pe.init(e,t)});var pt=I("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r});function ct(e,t,r){e.issues.length&&t.issues.push(...se(r,e.issues)),t.value[r]=e.value}var vt=I("$ZodArray",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let l=0;l<i.length;l++){let s=i[l],m=t.element._zod.run({value:s,issues:[]},n);m instanceof Promise?o.push(m.then(d=>ct(d,r,l))):ct(m,r,l)}return o.length?Promise.all(o).then(()=>r):r}});function fe(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...se(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Qt(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=We(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function er(e,t,r,n,i,o){let l=[],s=i.keySet,m=i.catchall._zod,d=m.def.type,h=m.optout==="optional";for(let _ in t){if(s.has(_))continue;if(d==="never"){l.push(_);continue}let f=m.run({value:t[_],issues:[]},n);f instanceof Promise?e.push(f.then(k=>fe(k,r,_,t,h))):fe(f,r,_,t,h)}return l.length&&r.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var gt=I("$ZodObject",(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let m={...s};return Object.defineProperty(t,"shape",{value:m}),m}})}let n=Ie(()=>Qt(t));S(e._zod,"propValues",()=>{let s=t.shape,m={};for(let d in s){let h=s[d]._zod;if(h.values){m[d]??(m[d]=new Set);for(let _ of h.values)m[d].add(_)}}return m});let i=ce,o=t.catchall,l;e._zod.parse=(s,m)=>{l??(l=n.value);let d=s.value;if(!i(d))return s.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),s;s.value={};let h=[],_=l.shape;for(let f of l.keys){let k=_[f],z=k._zod.optout==="optional",w=k._zod.run({value:d[f],issues:[]},m);w instanceof Promise?h.push(w.then(j=>fe(j,s,f,d,z))):fe(w,s,f,d,z)}return o?er(h,d,s,m,n.value,e):h.length?Promise.all(h).then(()=>s):s}});function lt(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!F(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(l=>A(l,n,N())))}),t)}var ht=I("$ZodUnion",(e,t)=>{P.init(e,t),S(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>le(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let l=!1,s=[];for(let m of t.options){let d=m._zod.run({value:i.value,issues:[]},o);if(d instanceof Promise)s.push(d),l=!0;else{if(d.issues.length===0)return d;s.push(d)}}return l?Promise.all(s).then(m=>lt(m,i,e,o)):lt(s,i,e,o)}});function st(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var $t=I("$ZodOptional",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${le(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>st(o,r.value)):st(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var _t=I("$ZodNullable",(e,t)=>{P.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${le(r.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var yt=I("$ZodCustom",(e,t)=>{M.init(e,t),P.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>dt(o,r,n,e));dt(i,r,n,e)}});function dt(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Se(i))}}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var bt;var Ue=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function kt(){return new Ue}(bt=globalThis).__zod_globalRegistry??(bt.__zod_globalRegistry=kt());var Oe=globalThis.__zod_globalRegistry;a();c();u();function zt(e,t){return new e({type:"string",...U(t)})}function It(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(t)})}function wt(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(t)})}function St(e){return new e({type:"unknown"})}function De(e,t){return new nt({check:"greater_than",...U(t),value:e,inclusive:!0})}function Ze(e){return De(0,e)}function jt(e,t,r){let n=U(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();a();c();u();var Z=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");P.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>de(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Y(e,r,n),e.parseAsync=async(r,n)=>me(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>H(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>q(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Te=I("ZodMiniString",(e,t)=>{pe.init(e,t),Z.init(e,t)});function Ne(e){return zt(Te,e)}var Pt=I("ZodMiniStringFormat",(e,t)=>{je.init(e,t),Te.init(e,t)});var pr=I("ZodMiniURL",(e,t)=>{mt.init(e,t),Pt.init(e,t)});function T(e){return It(pr,e)}var Ut=I("ZodMiniNumber",(e,t)=>{Pe.init(e,t),Z.init(e,t)});var vr=I("ZodMiniNumberFormat",(e,t)=>{ft.init(e,t),Ut.init(e,t)});function Ot(e){return wt(vr,e)}var gr=I("ZodMiniUnknown",(e,t)=>{pt.init(e,t),Z.init(e,t)});function hr(){return St(gr)}var $r=I("ZodMiniArray",(e,t)=>{vt.init(e,t),Z.init(e,t)});function ee(e,t){return new $r({type:"array",element:e,...U(t)})}var _r=I("ZodMiniObject",(e,t)=>{gt.init(e,t),Z.init(e,t),S(e,"shape",()=>t.shape)});function L(e,t){return new _r({type:"object",shape:e,catchall:hr(),...U(t)})}function Ee(e,t){return Xe(e,t)}var yr=I("ZodMiniUnion",(e,t)=>{ht.init(e,t),Z.init(e,t)});function Dt(e,t){return new yr({type:"union",options:e,...U(t)})}var xr=I("ZodMiniOptional",(e,t)=>{$t.init(e,t),Z.init(e,t)});function V(e){return new xr({type:"optional",innerType:e})}var br=I("ZodMiniNullable",(e,t)=>{_t.init(e,t),Z.init(e,t)});function ge(e){return new br({type:"nullable",innerType:e})}var kr=I("ZodMiniCustom",(e,t)=>{yt.init(e,t),Z.init(e,t)});function zr(e,t){return jt(kr,e??(()=>!0),t)}function Zt(e,t={}){let r=zr(n=>n instanceof e,t);return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}a();c();u();a();c();u();a();c();u();var Pr=L({value:L({}),channels:ee(Ne()),allowed:V(ge(ee(T())))}),Yp=Ee(Pr,{url:T(),actor:T()}),Hp=Dt([L({url:T()}),T()]),Ur=L({actor:T()}),Qp=V(ge(Ur)),Or=L({data:Zt(Blob),allowed:V(ge(ee(T())))}),ev=Ee(Or,{actor:T()}),tv=L({types:V(ee(Ne())),maxBytes:V(Ot().check(Ze()))});a();c();u();var Me=function(e,t){return Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Me(e,t)};function Dr(e,t){Me(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function J(e,t,r,n){function i(o){return o instanceof r?o:new r(function(l){l(o)})}return new(r||(r=Promise))(function(o,l){function s(h){try{d(n.next(h))}catch(_){l(_)}}function m(h){try{d(n.throw(h))}catch(_){l(_)}}function d(h){h.done?o(h.value):i(h.value).then(s,m)}d((n=n.apply(e,t||[])).next())})}function E(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,l;return l={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function s(d){return function(h){return m([d,h])}}function m(d){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,i=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){r.label=d[1];break}if(d[0]===6&&r.label<o[1]){r.label=o[1],o=d;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(d);break}o[2]&&r.ops.pop(),r.trys.pop();continue}d=t.call(e,r)}catch(h){d=[6,h],i=0}finally{n=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function B(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function re(e){return this instanceof re?(this.v=e,this):new re(e)}function Zr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(f){n[f]&&(i[f]=function(k){return new Promise(function(z,w){o.push([f,k,z,w])>1||s(f,k)})})}function s(f,k){try{m(n[f](k))}catch(z){_(o[0][3],z)}}function m(f){f.value instanceof re?Promise.resolve(f.value.v).then(d,h):_(o[0][2],f)}function d(f){s("next",f)}function h(f){s("throw",f)}function _(f,k){f(k),o.shift(),o.length&&s(o[0][0],o[0][1])}}var At=(function(e){Dr(t,e);function t(r){var n=e.call(this,r)||this;return Object.defineProperty(n,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(n,n.constructor.prototype):n.__proto__=n.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(n,n.constructor),n}return t})(Error),vv=(function(){function e(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),e.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})(),gv=(function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})(),hv=(function(){function e(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}return Object.defineProperty(e.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.add=function(t){this._q.length<this._c&&this._q.push(t)},e.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},e})();function Le(e){e!=null&&typeof e.then=="function"&&e.then(ye,ye)}var Ae=0,Nt=1,R=2,$e=3,Ce=4,_e=1024,ye=function(){};function G(e){var t=e.err,r=Promise.resolve(e.execution).then(function(n){if(t!=null)throw t;return n});return e.err=void 0,e.execution=r.then(function(){},function(){}),e.pending===void 0?r:e.pending.then(function(){return r})}function C(e,t){var r=e.state>=$e;return Promise.resolve(t).then(function(n){return!r&&e.state>=Ce?G(e).then(function(i){return{value:i,done:!0}}):{value:n,done:r}})}function Re(e,t){var r,n;if(!(e.state>=R))if(e.state=R,e.onnext(),e.onstop(),e.err==null&&(e.err=t),e.pushes.length===0&&(typeof e.buffer>"u"||e.buffer.empty))te(e);else try{for(var i=B(e.pushes),o=i.next();!o.done;o=i.next()){var l=o.value;l.resolve()}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function te(e){var t,r;if(!(e.state>=$e)){e.state<R&&Re(e),e.state=$e,e.buffer=void 0;try{for(var n=B(e.nexts),i=n.next();!i.done;i=n.next()){var o=i.value,l=e.pending===void 0?G(e):e.pending.then(function(){return G(e)});o.resolve(C(e,l))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.pushes=[],e.nexts=[]}}function Et(e){e.state>=Ce||(e.state<$e&&te(e),e.state=Ce)}function Tr(e,t){if(Le(t),e.pushes.length>=_e)throw new At("No more than "+_e+" pending calls to push are allowed on a single repeater.");if(e.state>=R)return Promise.resolve(void 0);var r=e.pending===void 0?Promise.resolve(t):e.pending.then(function(){return t});r=r.catch(function(m){e.state<R&&(e.err=m),Et(e)});var n;if(e.nexts.length){var i=e.nexts.shift();i.resolve(C(e,r)),e.nexts.length?n=Promise.resolve(e.nexts[0].value):typeof e.buffer<"u"&&!e.buffer.full?n=Promise.resolve(void 0):n=new Promise(function(m){return e.onnext=m})}else typeof e.buffer<"u"&&!e.buffer.full?(e.buffer.add(r),n=Promise.resolve(void 0)):n=new Promise(function(m){return e.pushes.push({resolve:m,value:r})});var o=!0,l={},s=n.catch(function(m){if(o)throw m});return l.then=function(m,d){return o=!1,Promise.prototype.then.call(n,m,d)},l.catch=function(m){return o=!1,Promise.prototype.catch.call(n,m)},l.finally=n.finally.bind(n),e.pending=r.then(function(){return s}).catch(function(m){e.err=m,Et(e)}),l}function Nr(e){var t=Re.bind(null,e),r=new Promise(function(n){return e.onstop=n});return t.then=r.then.bind(r),t.catch=r.catch.bind(r),t.finally=r.finally.bind(r),t}function Er(e){if(!(e.state>=Nt)){e.state=Nt;var t=Tr.bind(null,e),r=Nr(e);e.execution=new Promise(function(n){return n(e.executor(t,r))}),e.execution.catch(function(){return Re(e)})}}var he=new WeakMap,K=(function(){function e(t,r){he.set(this,{executor:t,buffer:r,err:void 0,state:Ae,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:ye,onstop:ye})}return e.prototype.next=function(t){Le(t);var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=_e)throw new At("No more than "+_e+" pending calls to next are allowed on a single repeater.");if(r.state<=Ae&&Er(r),r.onnext(t),typeof r.buffer<"u"&&!r.buffer.empty){var n=C(r,r.buffer.remove());if(r.pushes.length){var i=r.pushes.shift();r.buffer.add(i.value),r.onnext=i.resolve}return n}else if(r.pushes.length){var o=r.pushes.shift();return r.onnext=o.resolve,C(r,o.value)}else if(r.state>=R)return te(r),C(r,G(r));return new Promise(function(l){return r.nexts.push({resolve:l,value:t})})},e.prototype.return=function(t){Le(t);var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");return te(r),r.execution=Promise.resolve(r.execution).then(function(){return t}),C(r,G(r))},e.prototype.throw=function(t){var r=he.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=Ae||r.state>=R||typeof r.buffer<"u"&&!r.buffer.empty?(te(r),r.err==null&&(r.err=t),C(r,G(r))):this.next(Promise.reject(t))},e.prototype[Symbol.asyncIterator]=function(){return this},e.race=Ar,e.merge=Mr,e.zip=Lr,e.latest=Cr,e})();function xe(e,t){var r,n,i=[],o=function(d){d!=null&&typeof d[Symbol.asyncIterator]=="function"?i.push(d[Symbol.asyncIterator]()):d!=null&&typeof d[Symbol.iterator]=="function"?i.push(d[Symbol.iterator]()):i.push((function(){return Zr(this,arguments,function(){return E(this,function(f){switch(f.label){case 0:return t.yieldValues?[4,re(d)]:[3,3];case 1:return[4,f.sent()];case 2:f.sent(),f.label=3;case 3:return t.returnValues?[4,re(d)]:[3,5];case 4:return[2,f.sent()];case 5:return[2]}})})})())};try{for(var l=B(e),s=l.next();!s.done;s=l.next()){var m=s.value;o(m)}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return i}function Ar(e){var t=this,r=xe(e,{returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,l,s,m,d,h;return E(this,function(_){switch(_.label){case 0:if(!r.length)return i(),[2];l=!1,i.then(function(){o(),l=!0}),_.label=1;case 1:_.trys.push([1,,5,7]),m=void 0,d=0,h=function(){var f,k,z,w,j,ne;return E(this,function(ie){switch(ie.label){case 0:f=d;try{for(k=(j=void 0,B(r)),z=k.next();!z.done;z=k.next())w=z.value,Promise.resolve(w.next()).then(function(O){O.done?(i(),s===void 0&&(s=O)):d===f&&(d++,o(O))},function(O){return i(O)})}catch(O){j={error:O}}finally{try{z&&!z.done&&(ne=k.return)&&ne.call(k)}finally{if(j)throw j.error}}return[4,new Promise(function(O){return o=O})];case 1:return m=ie.sent(),m===void 0?[3,3]:[4,n(m.value)];case 2:ie.sent(),ie.label=3;case 3:return[2]}})},_.label=2;case 2:return l?[3,4]:[5,h()];case 3:return _.sent(),[3,2];case 4:return[2,s&&s.value];case 5:return i(),[4,Promise.race(r.map(function(f){return f.return&&f.return()}))];case 6:return _.sent(),[7];case 7:return[2]}})})})}function Mr(e){var t=this,r=xe(e,{yieldValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,l,s,m=this;return E(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2];o=[],l=!1,i.then(function(){var h,_;l=!0;try{for(var f=B(o),k=f.next();!k.done;k=f.next()){var z=k.value;z()}}catch(w){h={error:w}}finally{try{k&&!k.done&&(_=f.return)&&_.call(f)}finally{if(h)throw h.error}}}),d.label=1;case 1:return d.trys.push([1,,3,4]),[4,Promise.all(r.map(function(h,_){return J(m,void 0,void 0,function(){var f,k;return E(this,function(z){switch(z.label){case 0:z.trys.push([0,,6,9]),z.label=1;case 1:return l?[3,5]:(Promise.resolve(h.next()).then(function(w){return o[_](w)},function(w){return i(w)}),[4,new Promise(function(w){o[_]=w})]);case 2:return f=z.sent(),f===void 0?[3,4]:f.done?(s=f,[2]):[4,n(f.value)];case 3:z.sent(),z.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return k=h.return,k?[4,h.return()]:[3,8];case 7:k=z.sent(),z.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return d.sent(),[2,s&&s.value];case 3:return i(),[7];case 4:return[2]}})})})}function Lr(e){var t=this,r=xe(e,{returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,l,s,m;return E(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2,[]];l=!1,i.then(function(){o(),l=!0}),d.label=1;case 1:d.trys.push([1,,6,8]),d.label=2;case 2:return l?[3,5]:(Promise.all(r.map(function(h){return h.next()})).then(function(h){return o(h)},function(h){return i(h)}),[4,new Promise(function(h){return o=h})]);case 3:return s=d.sent(),s===void 0?[2]:(m=s.map(function(h){return h.value}),s.some(function(h){return h.done})?[2,m]:[4,n(m)]);case 4:return d.sent(),[3,2];case 5:return[3,8];case 6:return i(),[4,Promise.all(r.map(function(h){return h.return&&h.return()}))];case 7:return d.sent(),[7];case 8:return[2]}})})})}function Cr(e){var t=this,r=xe(e,{yieldValues:!0,returnValues:!0});return new K(function(n,i){return J(t,void 0,void 0,function(){var o,l,s,m,d,h=this;return E(this,function(_){switch(_.label){case 0:if(!r.length)return i(),[2,[]];l=[],s=!1,i.then(function(){var f,k;o();try{for(var z=B(l),w=z.next();!w.done;w=z.next()){var j=w.value;j()}}catch(ne){f={error:ne}}finally{try{w&&!w.done&&(k=z.return)&&k.call(z)}finally{if(f)throw f.error}}s=!0}),_.label=1;case 1:return _.trys.push([1,,5,7]),Promise.all(r.map(function(f){return f.next()})).then(function(f){return o(f)},function(f){return i(f)}),[4,new Promise(function(f){return o=f})];case 2:return m=_.sent(),m===void 0?[2]:(d=m.map(function(f){return f.value}),m.every(function(f){return f.done})?[2,d]:[4,n(d.slice())]);case 3:return _.sent(),[4,Promise.all(r.map(function(f,k){return J(h,void 0,void 0,function(){var z;return E(this,function(w){switch(w.label){case 0:if(m[k].done)return[2,m[k].value];w.label=1;case 1:return s?[3,4]:(Promise.resolve(f.next()).then(function(j){return l[k](j)},function(j){return i(j)}),[4,new Promise(function(j){return l[k]=j})]);case 2:return z=w.sent(),z===void 0?[2,m[k].value]:z.done?[2,z.value]:(d[k]=z.value,[4,n(d.slice())]);case 3:return w.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,_.sent()];case 5:return i(),[4,Promise.all(r.map(function(f){return f.return&&f.return()}))];case 6:return _.sent(),[7];case 7:return[2]}})})})}var Mt=class{graffiti;callbacks=new Set;options;login;logout;sessionEvents;postMedia;getMedia;deleteMedia;actorToHandle;handleToActor;constructor(t,r){this.options=r??{},this.graffiti=t,this.login=t.login.bind(t),this.logout=t.logout.bind(t),this.sessionEvents=t.sessionEvents,this.postMedia=t.postMedia.bind(t),this.getMedia=t.getMedia.bind(t),this.deleteMedia=t.deleteMedia.bind(t),this.actorToHandle=t.actorToHandle.bind(t),this.handleToActor=t.handleToActor.bind(t)}synchronize(t,r,n,i,o=new Set){let l=new K(async(s,m)=>{let d=await Ge(n),h=_=>{if(_?.tombstone)o.has(_.object.url)&&s(_);else if(_&&t(_.object)&&(this.options.omniscient||Fe(_.object,i))){let f=JSON.parse(JSON.stringify(_.object));this.options.omniscient||(f=Ve(f,r,i?.actor)),d(f)&&(s({object:f}),o.add(f.url))}};this.callbacks.add(h),await m,this.callbacks.delete(h)});return(async function*(){for await(let s of l)yield s})()}synchronizeDiscover(t,r,n){function i(o){return o.channels.some(l=>t.includes(l))}return this.synchronize(i,t,r,n)}synchronizeGet(t,r,n){let i=ae(t);function o(l){return l.url===i}return this.synchronize(o,[],r,n,new Set([i]))}synchronizeAll(t,r){return this.synchronize(()=>!0,[],t,r)}async synchronizeDispatch(t,r=!1){for(let n of this.callbacks)n(t);r&&await new Promise(n=>setTimeout(n,0))}get=async(...t)=>{try{let r=await this.graffiti.get(...t);return this.synchronizeDispatch({object:r}),r}catch(r){throw r instanceof W&&this.synchronizeDispatch({tombstone:!0,object:{url:ae(t[0])}}),r}};post=async(...t)=>{let r=await this.graffiti.post(...t);return await this.synchronizeDispatch({object:r},!0),r};delete=async(...t)=>{let r={tombstone:!0,object:{url:ae(t[0])}};try{let n=await this.graffiti.delete(...t);return await this.synchronizeDispatch(r,!0),n}catch(n){throw n instanceof W&&await this.synchronizeDispatch(r,!0),n}};objectStreamContinue(t){let r=this;return(async function*(){for(;;){let n=await t.next();if(n.done){let{continue:i,cursor:o}=n.value;return{continue:l=>r.objectStreamContinue(i(l)),cursor:o}}n.value.error||r.synchronizeDispatch(n.value),yield n.value}})()}objectStream(t){let r=this.objectStreamContinue(t);return(async function*(){for(;;){let n=await r.next();if(n.done)return n.value;(n.value.error||!n.value.tombstone)&&(yield n.value)}})()}discover=(...t)=>{let r=this.graffiti.discover(...t);return this.objectStream(r)};continueDiscover=(...t)=>{let r=this.graffiti.continueDiscover(...t);return this.objectStreamContinue(r)}};export{Mt as GraffitiSynchronize};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@repeaterjs/repeater/repeater.js:
|