@coasys/ad4m-connect 0.12.0-rc1-dev.5 → 0.12.0
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/components/icons/CreditIcon.d.ts +1 -0
- package/dist/components/icons/GlobeIcon.d.ts +1 -0
- package/dist/components/icons/WalletIcon.d.ts +1 -0
- package/dist/components/shared/avatar.d.ts +8 -0
- package/dist/components/views/HostBrowser.d.ts +29 -0
- package/dist/components/views/HostDetail.d.ts +17 -0
- package/dist/components/views/LoggedInDashboard.d.ts +26 -0
- package/dist/core.js +350 -324
- package/dist/index.js +392 -366
- package/dist/services/hostIndex.d.ts +11 -0
- package/dist/utils.js +1 -1
- package/dist/web.js +354 -328
- package/package.json +15 -15
- package/dist/components/icons/CheckCircleIcon.d.ts +0 -1
- package/dist/components/icons/TickIcon.d.ts +0 -1
- package/dist/components/shared/Ad4mLogo.d.ts +0 -1
- package/dist/components/shared/AppLogo.d.ts +0 -1
- package/dist/components/shared/Header.d.ts +0 -1
- package/dist/components/shared/Logo.d.ts +0 -1
- package/dist/components/states/ErrorState.d.ts +0 -6
- package/dist/components/views/ConnectionOverview.d.ts +0 -22
- package/dist/components/views/Hosting.d.ts +0 -22
- package/dist/components/views/MultiUserAuth.d.ts +0 -26
- package/dist/components/views/RemoteConnection.d.ts +0 -19
- package/dist/components/views/RequestCapability.d.ts +0 -16
- package/dist/components/views/ScanQRCode.d.ts +0 -14
- package/dist/components/views/Settings.d.ts +0 -19
- package/dist/components/views/Start.d.ts +0 -19
- package/dist/components/views/old/Hosting.d.ts +0 -22
- package/dist/components/views/old/MultiUserAuth.d.ts +0 -26
- package/dist/components/views/old/RemoteConnection.d.ts +0 -19
- package/dist/components/views/old/RequestCapability.d.ts +0 -16
- package/dist/components/views/old/ScanQRCode.d.ts +0 -14
- package/dist/components/views/old/Settings.d.ts +0 -19
- package/dist/components/views/old/Start.d.ts +0 -19
- package/dist/old/components/InvalidToken.d.ts +0 -0
- package/dist/old/components/VerifyCode.d.ts +0 -0
- package/dist/old/core.d.ts +0 -0
- package/dist/old/electron.d.ts +0 -0
- package/dist/old/state/ConnectState.d.ts +0 -0
- package/dist/old/state/index.d.ts +0 -0
- package/dist/old/utils.d.ts +0 -0
- package/dist/old/views/Hosting.d.ts +0 -0
- package/dist/old/views/MultiUserAuth.d.ts +0 -0
- package/dist/old/views/RemoteConnection.d.ts +0 -0
- package/dist/old/views/RequestCapability.d.ts +0 -0
- package/dist/old/views/ScanQRCode.d.ts +0 -0
- package/dist/old/views/Settings.d.ts +0 -0
- package/dist/old/views/Start.d.ts +0 -0
- package/dist/old/web.d.ts +0 -0
- package/dist/state/ConnectState.d.ts +0 -101
- package/dist/state/index.d.ts +0 -2
package/dist/web.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),No=/'/g,Ro=/"/g,Uo=/^(?:script|style|textarea|title)$/i,Fo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),N=Fo(1),sg=Fo(2),hi=Symbol.for("lit-noChange"),_e=Symbol.for("lit-nothing"),Po=new WeakMap,pi=fi.createTreeWalker(fi,129,null,!1);function jo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return To!==void 0?To.createHTML(e):e}var _u=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Rr;for(let o=0;o<t;o++){let c=i[o],l,u,f=-1,g=0;for(;g<c.length&&(s.lastIndex=g,u=s.exec(c),u!==null);)g=s.lastIndex,s===Rr?u[1]==="!--"?s=Co:u[1]!==void 0?s=Lo:u[2]!==void 0?(Uo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=di):u[3]!==void 0&&(s=di):s===di?u[0]===">"?(s=n??Rr,f=-1):u[1]===void 0?f=-2:(f=s.lastIndex-u[2].length,l=u[1],s=u[3]===void 0?di:u[3]==='"'?Ro:No):s===Ro||s===No?s=di:s===Co||s===Lo?s=Rr:(s=di,n=void 0);let d=s===di&&i[o+1].startsWith("/>")?" ":"";a+=s===Rr?c+wu:f>=0?(r.push(l),c.slice(0,f)+as+c.slice(f)+jt+d):c+jt+(f===-2?(r.push(void 0),o):d)}return[jo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},gi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,c=this.parts,[l,u]=_u(e,t);if(this.el=gi.createElement(l,r),pi.currentNode=this.el.content,t===2){let f=this.el.content,g=f.firstChild;g.remove(),f.append(...g.childNodes)}for(;(n=pi.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let f=[];for(let g of n.getAttributeNames())if(g.endsWith(as)||g.startsWith(jt)){let d=u[s++];if(f.push(g),d!==void 0){let y=n.getAttribute(d.toLowerCase()+as).split(jt),p=/([.?@])?(.*)/.exec(d);c.push({type:1,index:a,name:p[2],strings:y,ctor:p[1]==="."?os:p[1]==="?"?cs:p[1]==="@"?ls:er})}else c.push({type:6,index:a})}for(let g of f)n.removeAttribute(g)}if(Uo.test(n.tagName)){let f=n.textContent.split(jt),g=f.length-1;if(g>0){n.textContent=Yi?Yi.emptyScript:"";for(let d=0;d<g;d++)n.append(f[d],Pr()),pi.nextNode(),c.push({type:2,index:++a});n.append(f[g],Pr())}}}else if(n.nodeType===8)if(n.data===Do)c.push({type:2,index:a});else{let f=-1;for(;(f=n.data.indexOf(jt,f+1))!==-1;)c.push({type:7,index:a}),f+=jt.length-1}a++}}static createElement(e,t){let r=fi.createElement("template");return r.innerHTML=e,r}};function Xi(i,e,t=i,r){var n,a,s,o;if(e===hi)return e;let c=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,l=Or(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(i),c._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=c:t._$Cl=c),c!==void 0&&(e=Xi(i,c._$AS(i,e.values),c,r)),e}var ss=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:fi).importNode(r,!0);pi.currentNode=a;let s=pi.nextNode(),o=0,c=0,l=n[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new mi(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new us(s,this,e)),this._$AV.push(u),l=n[++c]}o!==l?.index&&(s=pi.nextNode(),o++)}return pi.currentNode=fi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},mi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=_e,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Or(e)?e===_e||e==null||e===""?(this._$AH!==_e&&this._$AR(),this._$AH=_e):e!==this._$AH&&e!==hi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Su(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==_e&&Or(this._$AH)?this._$AA.nextSibling.data=e:this.$(fi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=gi.createElement(jo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ss(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Po.get(e.strings);return t===void 0&&Po.set(e.strings,t=new gi(e)),t}T(e){Mo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new mi(this.k(Pr()),this.k(Pr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},er=class{constructor(e,t,r,n,a){this.type=1,this._$AH=_e,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_e}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Xi(this,e,t,0),s=!Or(e)||e!==this._$AH&&e!==hi,s&&(this._$AH=e);else{let o=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Xi(this,o[r+c],t,c),l===hi&&(l=this._$AH[c]),s||(s=!Or(l)||l!==this._$AH[c]),l===_e?e=_e:e!==_e&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}s&&!n&&this.j(e)}j(e){e===_e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},os=class extends er{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_e?void 0:e}},Eu=Yi?Yi.emptyScript:"",cs=class extends er{constructor(){super(...arguments),this.type=4}j(e){e&&e!==_e?this.element.setAttribute(this.name,Eu):this.element.removeAttribute(this.name)}},ls=class extends er{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Xi(this,e,t,0))!==null&&r!==void 0?r:_e)===hi)return;let n=this._$AH,a=e===_e&&n!==_e||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==_e&&(n===_e||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},us=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}};var Oo=Dn.litHtmlPolyfillSupport;Oo?.(gi,mi),((rs=Dn.litHtmlVersions)!==null&&rs!==void 0?rs:Dn.litHtmlVersions=[]).push("2.8.0");var Bo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new mi(e.insertBefore(Pr(),o),o,void 0,t??{})}return s._$AI(i),s};var ds,ps;var Le=class extends Lt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Bo(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return hi}};Le.finalized=!0,Le._$litElement$=!0,(ds=globalThis.litElementHydrateSupport)===null||ds===void 0||ds.call(globalThis,{LitElement:Le});var qo=globalThis.litElementPolyfillSupport;qo?.({LitElement:Le});((ps=globalThis.litElementVersions)!==null&&ps!==void 0?ps:globalThis.litElementVersions=[]).push("3.3.3");var gt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var xu=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,i)}},$u=(i,e,t)=>{e.constructor.createProperty(t,i)};function pe(i){return(e,t)=>t!==void 0?$u(i,e,t):xu(i,e)}function le(i){return pe({...i,state:!0})}var fs,Rg=((fs=window.HTMLSlotElement)===null||fs===void 0?void 0:fs.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Au=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function hs(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of Au(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var Vo="0.12.0-rc1-dev.2";function Iu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Mn(i,e){Iu()&&localStorage.setItem(`${Vo}/${i}`,e)}function Un(i,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function yi(){return N`
|
|
1
|
+
var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Object.getPrototypeOf;var ku=Reflect.get;var j=(i,e,t,r)=>{for(var n=r>1?void 0:r?$u(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&xu(e,t,n),n};var ko=(i,e,t)=>ku(Au(i),t,e);var _e=(i,e,t)=>new Promise((r,n)=>{var a=l=>{try{o(t.next(l))}catch(c){n(c)}},s=l=>{try{o(t.throw(l))}catch(c){n(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((t=t.apply(i,e)).next())});var Dn=window,Mn=Dn.ShadowRoot&&(Dn.ShadyCSS===void 0||Dn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ts=Symbol(),Io=new WeakMap,Pr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==ts)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Mn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Io.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Io.set(t,e))}return e}toString(){return this.cssText}},To=i=>new Pr(typeof i=="string"?i:i+"",void 0,ts),Je=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[a+1],i[0]);return new Pr(t,i,ts)},is=(i,e)=>{Mn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Dn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Un=Mn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return To(t)})(i):i;var rs,Fn=window,Co=Fn.trustedTypes,Iu=Co?Co.emptyScript:"",Lo=Fn.reactiveElementPolyfillSupport,as={toAttribute(i,e){switch(e){case Boolean:i=i?Iu:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},No=(i,e)=>e!==i&&(e==e||i==i),ns={attribute:!0,type:String,converter:as,reflect:!1,hasChanged:No},ss="finalized",Lt=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=ns){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||ns}static finalize(){if(this.hasOwnProperty(ss))return!1;this[ss]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(Un(n))}else e!==void 0&&t.push(Un(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return is(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=ns){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:as).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:as;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||No)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Lt[ss]=!0,Lt.elementProperties=new Map,Lt.elementStyles=[],Lt.shadowRootOptions={mode:"open"},Lo?.({ReactiveElement:Lt}),((rs=Fn.reactiveElementVersions)!==null&&rs!==void 0?rs:Fn.reactiveElementVersions=[]).push("1.6.3");var os,jn=window,Xi=jn.trustedTypes,Ro=Xi?Xi.createPolicy("lit-html",{createHTML:i=>i}):void 0,ls="$lit$",jt=`lit$${(Math.random()+"").slice(9)}$`,jo="?"+jt,Tu=`<${jo}>`,pi=document,Dr=()=>pi.createComment(""),Mr=i=>i===null||typeof i!="object"&&typeof i!="function",Bo=Array.isArray,Cu=i=>Bo(i)||typeof i?.[Symbol.iterator]=="function",cs=`[
|
|
2
|
+
\f\r]`,Or=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,Oo=/>/g,ui=RegExp(`>|${cs}(?:([^\\s"'>=/]+)(${cs}*=${cs}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Do=/'/g,Mo=/"/g,qo=/^(?:script|style|textarea|title)$/i,Ho=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),N=Ho(1),xg=Ho(2),fi=Symbol.for("lit-noChange"),Ee=Symbol.for("lit-nothing"),Uo=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Vo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ro!==void 0?Ro.createHTML(e):e}var Lu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Or;for(let o=0;o<t;o++){let l=i[o],c,u,m=-1,y=0;for(;y<l.length&&(s.lastIndex=y,u=s.exec(l),u!==null);)y=s.lastIndex,s===Or?u[1]==="!--"?s=Po:u[1]!==void 0?s=Oo:u[2]!==void 0?(qo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Or,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ui:u[3]==='"'?Mo:Do):s===Mo||s===Do?s=ui:s===Po||s===Oo?s=Or:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Or?l+Tu:m>=0?(r.push(c),l.slice(0,m)+ls+l.slice(m)+jt+d):l+jt+(m===-2?(r.push(void 0),o):d)}return[Vo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},hi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,l=this.parts,[c,u]=Lu(e,t);if(this.el=hi.createElement(c,r),di.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=di.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(ls)||y.startsWith(jt)){let d=u[s++];if(m.push(y),d!==void 0){let p=n.getAttribute(d.toLowerCase()+ls).split(jt),f=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:f[2],strings:p,ctor:f[1]==="."?ds:f[1]==="?"?ps:f[1]==="@"?fs:tr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(qo.test(n.tagName)){let m=n.textContent.split(jt),y=m.length-1;if(y>0){n.textContent=Xi?Xi.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Dr()),di.nextNode(),l.push({type:2,index:++a});n.append(m[y],Dr())}}}else if(n.nodeType===8)if(n.data===jo)l.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(jt,m+1))!==-1;)l.push({type:7,index:a}),m+=jt.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function er(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Mr(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:t._$Cl=l),l!==void 0&&(e=er(i,l._$AS(i,e.values),l,r)),e}var us=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:pi).importNode(r,!0);di.currentNode=a;let s=di.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new gi(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new hs(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=di.nextNode(),o++)}return di.currentNode=pi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},gi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=Ee,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=er(this,e,t),Mr(e)?e===Ee||e==null||e===""?(this._$AH!==Ee&&this._$AR(),this._$AH=Ee):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Cu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Ee&&Mr(this._$AH)?this._$AA.nextSibling.data=e:this.$(pi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=hi.createElement(Vo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new us(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Uo.get(e.strings);return t===void 0&&Uo.set(e.strings,t=new hi(e)),t}T(e){Bo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new gi(this.k(Dr()),this.k(Dr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},tr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=Ee,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Ee}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=er(this,e,t,0),s=!Mr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=er(this,o[r+l],t,l),c===fi&&(c=this._$AH[l]),s||(s=!Mr(c)||c!==this._$AH[l]),c===Ee?e=Ee:e!==Ee&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===Ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ds=class extends tr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ee?void 0:e}},Nu=Xi?Xi.emptyScript:"",ps=class extends tr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ee?this.element.setAttribute(this.name,Nu):this.element.removeAttribute(this.name)}},fs=class extends tr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=er(this,e,t,0))!==null&&r!==void 0?r:Ee)===fi)return;let n=this._$AH,a=e===Ee&&n!==Ee||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ee&&(n===Ee||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},hs=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){er(this,e)}};var Fo=jn.litHtmlPolyfillSupport;Fo?.(hi,gi),((os=jn.litHtmlVersions)!==null&&os!==void 0?os:jn.litHtmlVersions=[]).push("2.8.0");var zo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new gi(e.insertBefore(Dr(),o),o,void 0,t??{})}return s._$AI(i),s};var gs,ms;var Le=class extends Lt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=zo(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return fi}};Le.finalized=!0,Le._$litElement$=!0,(gs=globalThis.litElementHydrateSupport)===null||gs===void 0||gs.call(globalThis,{LitElement:Le});var Wo=globalThis.litElementPolyfillSupport;Wo?.({LitElement:Le});((ms=globalThis.litElementVersions)!==null&&ms!==void 0?ms:globalThis.litElementVersions=[]).push("3.3.3");var gt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var Ru=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,i)}},Pu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?Pu(i,e,t):Ru(i,e)}function ue(i){return fe({...i,state:!0})}var ys,Jg=((ys=window.HTMLSlotElement)===null||ys===void 0?void 0:ys.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Ou=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function vs(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of Ou(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var Ko="0.12.0";function Mu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Bn(i,e){Mu()&&localStorage.setItem(`${Ko}/${i}`,e)}function qn(i,e=1e4){return _e(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function mi(){return N`
|
|
4
4
|
<svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
5
|
<path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
|
|
6
6
|
</svg>
|
|
7
|
-
`}function
|
|
7
|
+
`}function ir(){return N`
|
|
8
8
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
9
9
|
<circle cx="12" cy="12" r="10"></circle>
|
|
10
10
|
<circle cx="12" cy="12" r="3" fill="currentColor"></circle>
|
|
11
11
|
</svg>
|
|
12
|
-
`}function
|
|
12
|
+
`}function rr(){return N`
|
|
13
13
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
14
14
|
<circle cx="12" cy="12" r="10"></circle>
|
|
15
15
|
<path d="M2 12h20"></path>
|
|
16
16
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
|
17
17
|
</svg>
|
|
18
|
-
`}function
|
|
18
|
+
`}function Hn(){return N`
|
|
19
19
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
20
20
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
21
21
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
22
22
|
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
23
23
|
</svg>
|
|
24
|
-
`}function
|
|
24
|
+
`}function dt(){return N`
|
|
25
25
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
|
26
26
|
<rect width="256" height="256" fill="none"/>
|
|
27
27
|
<polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
@@ -30,20 +30,20 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
30
30
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
|
|
31
31
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
32
32
|
</svg>
|
|
33
|
-
`}function
|
|
33
|
+
`}function Vn(){return N`
|
|
34
34
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
|
|
35
35
|
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
|
|
36
36
|
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
|
|
37
37
|
</svg>
|
|
38
|
-
`}function
|
|
38
|
+
`}function zn(){return N`
|
|
39
39
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
|
|
40
40
|
<path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5m14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5"/>
|
|
41
41
|
</svg>
|
|
42
|
-
`}function
|
|
42
|
+
`}function nr(){return N`
|
|
43
43
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
|
44
44
|
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
|
|
45
45
|
</svg>
|
|
46
|
-
`}var Bt=
|
|
46
|
+
`}var Bt=Je`
|
|
47
47
|
* {
|
|
48
48
|
box-sizing: border-box;
|
|
49
49
|
}
|
|
@@ -305,7 +305,7 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
305
305
|
.state.danger svg {
|
|
306
306
|
color: var(--ac-danger-color);
|
|
307
307
|
}
|
|
308
|
-
`;var
|
|
308
|
+
`;var ke=class extends Le{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return _e(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return _e(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return _e(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return _e(this,null,function*(){try{yield qn(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return _e(this,null,function*(){ko(ke.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:N`
|
|
309
309
|
<div class="container">
|
|
310
310
|
<div class="header">
|
|
311
311
|
<h1>Connect AD4M</h1>
|
|
@@ -316,13 +316,13 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
316
316
|
${this.isMobile?"":N`
|
|
317
317
|
<div class="box">
|
|
318
318
|
<div class="box-header">
|
|
319
|
-
${
|
|
319
|
+
${ir()}
|
|
320
320
|
<h3>Local Node</h3>
|
|
321
321
|
</div>
|
|
322
322
|
|
|
323
323
|
${this.localNodeDetected?N`
|
|
324
324
|
<div class="state success">
|
|
325
|
-
${
|
|
325
|
+
${dt()}
|
|
326
326
|
<p>Local node detected on port ${this.port}</p>
|
|
327
327
|
</div>
|
|
328
328
|
|
|
@@ -337,7 +337,7 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
337
337
|
|
|
338
338
|
<p style="margin-bottom: -12px">Download and install AD4M</p>
|
|
339
339
|
<button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
|
|
340
|
-
${
|
|
340
|
+
${Hn()} Download AD4M
|
|
341
341
|
</button>
|
|
342
342
|
`}
|
|
343
343
|
|
|
@@ -351,7 +351,7 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
351
351
|
@keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
|
|
352
352
|
/>
|
|
353
353
|
<button class="primary" @click=${this.refreshPort}>
|
|
354
|
-
${
|
|
354
|
+
${Vn()}
|
|
355
355
|
</button>
|
|
356
356
|
</div>
|
|
357
357
|
</div>
|
|
@@ -360,13 +360,13 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
360
360
|
${this.showMultiUserOption?N`
|
|
361
361
|
<div class="box">
|
|
362
362
|
<div class="box-header">
|
|
363
|
-
${
|
|
363
|
+
${rr()}
|
|
364
364
|
<h3>Remote Node</h3>
|
|
365
365
|
</div>
|
|
366
366
|
|
|
367
367
|
${this.remoteUrl?N`
|
|
368
368
|
<div class="state success">
|
|
369
|
-
${
|
|
369
|
+
${dt()}
|
|
370
370
|
<p>Remote configuration detected</p>
|
|
371
371
|
</div>
|
|
372
372
|
`:N`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
|
|
@@ -398,7 +398,7 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
398
398
|
`:""}
|
|
399
399
|
</div>
|
|
400
400
|
</div>
|
|
401
|
-
`}};
|
|
401
|
+
`}};ke.styles=[Bt,Je`
|
|
402
402
|
.options {
|
|
403
403
|
display: flex;
|
|
404
404
|
flex-direction: column;
|
|
@@ -427,17 +427,38 @@ var gu=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Objec
|
|
|
427
427
|
button {
|
|
428
428
|
width: 100%;
|
|
429
429
|
}
|
|
430
|
-
`],
|
|
431
|
-
`),u=r.split(/\r\n|[\n\r]/g),
|
|
432
|
-
`)}function
|
|
430
|
+
`],j([fe({type:Number})],ke.prototype,"port",2),j([fe({type:String})],ke.prototype,"remoteUrl",2),j([fe({type:Boolean})],ke.prototype,"connectingToRemoteNode",2),j([fe({type:Boolean})],ke.prototype,"remoteNodeError",2),j([fe({type:Boolean})],ke.prototype,"showMultiUserOption",2),j([ue()],ke.prototype,"loading",2),j([ue()],ke.prototype,"localNodeDetected",2),j([ue()],ke.prototype,"newPort",2),j([ue()],ke.prototype,"newRemoteUrl",2),j([ue()],ke.prototype,"isMobile",2),ke=j([gt("connection-options")],ke);var _a=function(){return _a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},_a.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function sa(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?sa=function(t){return typeof t}:sa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(i)}function Uu(i){return sa(i)=="object"&&i!==null}var yl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Us(i,e){for(var t=/\r\n|[\n\r]/g,r=1,n=e+1,a;(a=t.exec(i.body))&&a.index<e;)r+=1,n=e+1-(a.index+a[0].length);return{line:r,column:n}}function Fu(i){return vl(i.source,Us(i.source,i.start))}function vl(i,e){var t=i.locationOffset.column-1,r=oa(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,c="".concat(i.name,":").concat(s,":").concat(l,`
|
|
431
|
+
`),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var y=Math.floor(l/80),d=l%80,p=[],f=0;f<m.length;f+=80)p.push(m.slice(f,f+80));return c+Qo([["".concat(s),p[0]]].concat(p.slice(1,y+1).map(function(S){return["",S]}),[[" ",oa(d-1)+"^"],["",p[y+1]]]))}return c+Qo([["".concat(s-1),u[n-1]],["".concat(s),m],["",oa(l-1)+"^"],["".concat(s+1),u[n+1]]])}function Qo(i){var e=i.filter(function(r){r[0];var n=r[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(r){var n=r[0];return n.length}));return e.map(function(r){var n=r[0],a=r[1];return ju(t,n)+(a?" | "+a:" |")}).join(`
|
|
432
|
+
`)}function oa(i){return Array(i+1).join(" ")}function ju(i,e){return oa(i-e.length)+e}function ca(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ca=function(t){return typeof t}:ca=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ca(i)}function Go(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function Bu(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Go(Object(t),!0).forEach(function(r){qu(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function qu(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hu(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Zo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Vu(i,e,t){return e&&Zo(i.prototype,e),t&&Zo(i,t),i}function zu(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&gn(i,e)}function Wu(i){var e=wl();return function(){var r=mn(i),n;if(e){var a=mn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return bl(this,n)}}function bl(i,e){return e&&(ca(e)==="object"||typeof e=="function")?e:Hr(i)}function Hr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Fs(i){var e=typeof Map=="function"?new Map:void 0;return Fs=function(r){if(r===null||!Ku(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return la(r,arguments,mn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),gn(n,r)},Fs(i)}function la(i,e,t){return wl()?la=Reflect.construct:la=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&gn(c,s.prototype),c},la.apply(null,arguments)}function wl(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ku(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function gn(i,e){return gn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},gn(i,e)}function mn(i){return mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(i)}var Qu=function(i){zu(t,i);var e=Wu(t);function t(r,n,a,s,o,l,c){var u,m,y,d;Hu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=Jo(Array.isArray(n)?n:n?[n]:void 0);for(var p=[],f=0,S=(E=d.nodes)!==null&&E!==void 0?E:[];f<S.length;f++){var E,A=S[f],k=A.loc;k!=null&&p.push(k)}p=Jo(p),d.source=a??((u=p)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=p)===null||m===void 0?void 0:m.map(function(T){return T.start})),d.locations=s&&a?s.map(function(T){return Us(a,T)}):(y=p)===null||y===void 0?void 0:y.map(function(T){return Us(T.source,T.start)}),d.path=o??void 0;var b=l?.extensions;return c==null&&Uu(b)?d.extensions=Bu({},b):d.extensions=c??{},Object.defineProperties(Hr(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?(Object.defineProperty(Hr(d),"stack",{value:l.stack,writable:!0,configurable:!0}),bl(d)):(Error.captureStackTrace?Error.captureStackTrace(Hr(d),t):Object.defineProperty(Hr(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Vu(t,[{key:"toString",value:function(){return Gu(this)}},{key:yl,get:function(){return"Object"}}]),t}(Fs(Error));function Jo(i){return i===void 0||i.length===0?void 0:i}function Gu(i){var e=i.message;if(i.nodes)for(var t=0,r=i.nodes;t<r.length;t++){var n=r[t];n.loc&&(e+=`
|
|
433
433
|
|
|
434
|
-
`+
|
|
434
|
+
`+Fu(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
|
|
435
435
|
|
|
436
|
-
`+
|
|
437
|
-
`)}function
|
|
438
|
-
`;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=ud(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var f=a.slice(s+1,s+5);throw Ze(i,s,"Invalid character escape sequence: \\u".concat(f,"."))}l+=String.fromCharCode(u),s+=4;break}default:throw Ze(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++s,o=s}}throw Ze(i,s,"Unterminated string.")}function ld(i,e,t,r,n,a){for(var s=i.body,o=e+3,c=o,l=0,u="";o<s.length&&!isNaN(l=s.charCodeAt(o));){if(l===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(c,o),new ge($.BLOCK_STRING,e,o+3,t,r,n,ed(u));if(l<32&&l!==9&&l!==10&&l!==13)throw Ze(i,o,"Invalid character within String: ".concat(Ri(l),"."));l===10?(++o,++a.line,a.lineStart=o):l===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):l===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(c,o)+'"""',o+=4,c=o):++o}throw Ze(i,o,"Unterminated string.")}function ud(i,e,t,r){return qn(i)<<12|qn(e)<<8|qn(t)<<4|qn(r)}function qn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function dd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,c=0;o!==s&&!isNaN(c=a.charCodeAt(o))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++o;return new ge($.NAME,e,o,t,r,n,a.slice(e,o))}function pd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function fd(i,e){var t=new hd(i,e);return t.parseDocument()}var hd=function(){function i(t,r){var n=Yu(t)?t:new vl(t);this._lexer=new id(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:j.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:j.DOCUMENT,definitions:this.many($.SOF,this.parseDefinition,$.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek($.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek($.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek($.BRACE_L))return{kind:j.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek($.NAME)&&(a=this.parseName()),{kind:j.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken($.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:j.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken($.DOLLAR),{kind:j.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:j.SELECTION_SET,selections:this.many($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken($.COLON)?(a=n,s=this.parseName()):s=n,{kind:j.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,n,$.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken($.COLON),{kind:j.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:j.ARGUMENT,name:this.parseName(),value:(this.expectToken($.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken($.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek($.NAME)?{kind:j.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:j.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:j.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:j.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(r){var n=this._lexer.token;switch(n.kind){case $.BRACKET_L:return this.parseList(r);case $.BRACE_L:return this.parseObject(r);case $.INT:return this._lexer.advance(),{kind:j.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:j.FLOAT,value:n.value,loc:this.loc(n)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:j.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:j.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:j.NULL,loc:this.loc(n)};default:return{kind:j.ENUM,value:n.value,loc:this.loc(n)}}case $.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:j.STRING,value:r.value,block:r.kind===$.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:j.LIST,values:this.any($.BRACKET_L,s,$.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:j.OBJECT,fields:this.any($.BRACE_L,s,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:j.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek($.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken($.AT),{kind:j.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken($.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken($.BRACKET_R),n={kind:j.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:j.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:j.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek($.STRING)||this.peek($.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);return{kind:j.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken($.COLON);var a=this.parseNamedType();return{kind:j.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken($.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return n}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken($.COLON);var o=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:j.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:c,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken($.EQUALS)&&(o=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:j.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:c,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:j.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken($.EQUALS)?this.delimitedMany($.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:j.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany($.BRACE_L,this.parseEnumValueDefinition,$.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:j.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:j.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:j.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken($.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:j.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:c,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Xu[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new ml(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Ze(this._lexer.source,n.start,"Expected ".concat(bl(r),", found ").concat(ys(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===$.NAME&&n.value===r)this._lexer.advance();else throw Ze(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(ys(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===$.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Ze(this._lexer.source,n.start,"Unexpected ".concat(ys(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function ys(i){var e=i.value;return bl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function bl(i){return rd(i)?'"'.concat(i,'"'):i}var sa=new Map,Ms=new Map,wl=!0,ba=!1;function Sl(i){return i.replace(/[\s,]+/g," ").trim()}function gd(i){return Sl(i.source.body.substring(i.start,i.end))}function md(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=gd(r.loc),s=Ms.get(n);s&&!s.has(a)?wl&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
436
|
+
`+vl(i.source,o)}return e}function Xe(i,e,t){return new Qu("Syntax Error: ".concat(t),void 0,i,[e])}var B=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Zu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ju=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,js=Ju;function Sl(i){var e=i.prototype.toJSON;typeof e=="function"||Zu(0),i.prototype.inspect=e,js&&(i.prototype[js]=e)}var _l=function(){function i(t,r,n){this.start=t.start,this.end=r.end,this.startToken=t,this.endToken=r,this.source=n}var e=i.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},i}();Sl(_l);var me=function(){function i(t,r,n,a,s,o,l){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=l,this.prev=o,this.next=null}var e=i.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},i}();Sl(me);var $=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function ua(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ua=function(t){return typeof t}:ua=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ua(i)}var Yu=10,El=2;function Xu(i){return za(i,[])}function za(i,e){switch(ua(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":ed(i,e);default:return String(i)}}function ed(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=rd(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:za(n,t)}else if(Array.isArray(i))return id(i,t);return td(i,t)}function td(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>El)return"["+nd(i)+"]";var r=t.map(function(n){var a=za(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function id(i,e){if(i.length===0)return"[]";if(e.length>El)return"[Array]";for(var t=Math.min(Yu,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(za(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function rd(i){var e=i[String(js)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function nd(i){var e=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof i.constructor=="function"){var t=i.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function bs(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var ad=function(e,t){return e instanceof t};function Yo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function sd(i,e,t){return e&&Yo(i.prototype,e),t&&Yo(i,t),i}var xl=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||bs(0,"Body must be a string. Received: ".concat(Xu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||bs(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||bs(0,"column in locationOffset is 1-indexed and must be positive.")}return sd(i,[{key:yl,get:function(){return"Source"}}]),i}();function od(i){return ad(i,xl)}var cd=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function ld(i){var e=i.split(/\r\n|[\n\r]/g),t=ud(i);if(t!==0)for(var r=1;r<e.length;r++)e[r]=e[r].slice(t);for(var n=0;n<e.length&&Xo(e[n]);)++n;for(var a=e.length;a>n&&Xo(e[a-1]);)--a;return e.slice(n,a).join(`
|
|
437
|
+
`)}function Xo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function ud(i){for(var e,t=!0,r=!0,n=0,a=null,s=0;s<i.length;++s)switch(i.charCodeAt(s)){case 13:i.charCodeAt(s+1)===10&&++s;case 10:t=!1,r=!0,n=0;break;case 9:case 32:++n;break;default:r&&!t&&(a===null||n<a)&&(a=n),r=!1}return(e=a)!==null&&e!==void 0?e:0}var dd=function(){function i(t){var r=new me($.SOF,0,0,0,0,null);this.source=t,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var e=i.prototype;return e.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},e.lookahead=function(){var r=this.token;if(r.kind!==$.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=fd(this,r)}while(r.kind===$.COMMENT);return r},i}();function pd(i){return i===$.BANG||i===$.DOLLAR||i===$.AMP||i===$.PAREN_L||i===$.PAREN_R||i===$.SPREAD||i===$.COLON||i===$.EQUALS||i===$.AT||i===$.BRACKET_L||i===$.BRACKET_R||i===$.BRACE_L||i===$.PIPE||i===$.BRACE_R}function Ni(i){return isNaN(i)?$.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function fd(i,e){for(var t=i.source,r=t.body,n=r.length,a=e.end;a<n;){var s=r.charCodeAt(a),o=i.line,l=1+a-i.lineStart;switch(s){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++i.line,i.lineStart=a;continue;case 13:r.charCodeAt(a+1)===10?a+=2:++a,++i.line,i.lineStart=a;continue;case 33:return new me($.BANG,a,a+1,o,l,e);case 35:return gd(t,a,o,l,e);case 36:return new me($.DOLLAR,a,a+1,o,l,e);case 38:return new me($.AMP,a,a+1,o,l,e);case 40:return new me($.PAREN_L,a,a+1,o,l,e);case 41:return new me($.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new me($.SPREAD,a,a+3,o,l,e);break;case 58:return new me($.COLON,a,a+1,o,l,e);case 61:return new me($.EQUALS,a,a+1,o,l,e);case 64:return new me($.AT,a,a+1,o,l,e);case 91:return new me($.BRACKET_L,a,a+1,o,l,e);case 93:return new me($.BRACKET_R,a,a+1,o,l,e);case 123:return new me($.BRACE_L,a,a+1,o,l,e);case 124:return new me($.PIPE,a,a+1,o,l,e);case 125:return new me($.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?vd(t,a,o,l,e,i):yd(t,a,o,l,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return md(t,a,s,o,l,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return wd(t,a,o,l,e)}throw Xe(t,a,hd(s))}var c=i.line,u=1+a-i.lineStart;return new me($.EOF,n,n,c,u,e)}function hd(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Ni(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Ni(i),".")}function gd(i,e,t,r,n){var a=i.body,s,o=e;do s=a.charCodeAt(++o);while(!isNaN(s)&&(s>31||s===9));return new me($.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function md(i,e,t,r,n,a){var s=i.body,o=t,l=e,c=!1;if(o===45&&(o=s.charCodeAt(++l)),o===48){if(o=s.charCodeAt(++l),o>=48&&o<=57)throw Xe(i,l,"Invalid number, unexpected digit after 0: ".concat(Ni(o),"."))}else l=ws(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=ws(i,l,o),o=s.charCodeAt(l)),(o===69||o===101)&&(c=!0,o=s.charCodeAt(++l),(o===43||o===45)&&(o=s.charCodeAt(++l)),l=ws(i,l,o),o=s.charCodeAt(l)),o===46||Sd(o))throw Xe(i,l,"Invalid number, expected digit but got: ".concat(Ni(o),"."));return new me(c?$.FLOAT:$.INT,e,l,r,n,a,s.slice(e,l))}function ws(i,e,t){var r=i.body,n=e,a=t;if(a>=48&&a<=57){do a=r.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Xe(i,n,"Invalid number, expected digit but got: ".concat(Ni(a),"."))}function yd(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,l=0,c="";s<a.length&&!isNaN(l=a.charCodeAt(s))&&l!==10&&l!==13;){if(l===34)return c+=a.slice(o,s),new me($.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw Xe(i,s,"Invalid character within String: ".concat(Ni(l),"."));if(++s,l===92){switch(c+=a.slice(o,s-1),l=a.charCodeAt(s),l){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
438
|
+
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=bd(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var m=a.slice(s+1,s+5);throw Xe(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw Xe(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw Xe(i,s,"Unterminated string.")}function vd(i,e,t,r,n,a){for(var s=i.body,o=e+3,l=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o));){if(c===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(l,o),new me($.BLOCK_STRING,e,o+3,t,r,n,ld(u));if(c<32&&c!==9&&c!==10&&c!==13)throw Xe(i,o,"Invalid character within String: ".concat(Ni(c),"."));c===10?(++o,++a.line,a.lineStart=o):c===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):c===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(l,o)+'"""',o+=4,l=o):++o}throw Xe(i,o,"Unterminated string.")}function bd(i,e,t,r){return Wn(i)<<12|Wn(e)<<8|Wn(t)<<4|Wn(r)}function Wn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function wd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,l=0;o!==s&&!isNaN(l=a.charCodeAt(o))&&(l===95||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++o;return new me($.NAME,e,o,t,r,n,a.slice(e,o))}function Sd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function _d(i,e){var t=new Ed(i,e);return t.parseDocument()}var Ed=function(){function i(t,r){var n=od(t)?t:new xl(t);this._lexer=new dd(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:B.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:B.DOCUMENT,definitions:this.many($.SOF,this.parseDefinition,$.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek($.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek($.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek($.BRACE_L))return{kind:B.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek($.NAME)&&(a=this.parseName()),{kind:B.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken($.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken($.DOLLAR),{kind:B.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:B.SELECTION_SET,selections:this.many($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken($.COLON)?(a=n,s=this.parseName()):s=n,{kind:B.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,n,$.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken($.COLON),{kind:B.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:B.ARGUMENT,name:this.parseName(),value:(this.expectToken($.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken($.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek($.NAME)?{kind:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:B.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(r){var n=this._lexer.token;switch(n.kind){case $.BRACKET_L:return this.parseList(r);case $.BRACE_L:return this.parseObject(r);case $.INT:return this._lexer.advance(),{kind:B.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:n.value,loc:this.loc(n)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:B.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:B.NULL,loc:this.loc(n)};default:return{kind:B.ENUM,value:n.value,loc:this.loc(n)}}case $.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:B.STRING,value:r.value,block:r.kind===$.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:B.LIST,values:this.any($.BRACKET_L,s,$.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:B.OBJECT,fields:this.any($.BRACE_L,s,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek($.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken($.AT),{kind:B.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken($.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken($.BRACKET_R),n={kind:B.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:B.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:B.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek($.STRING)||this.peek($.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);return{kind:B.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken($.COLON);var a=this.parseNamedType();return{kind:B.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken($.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return n}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken($.COLON);var o=this.parseTypeReference(),l=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken($.EQUALS)&&(o=this.parseValueLiteral(!0));var l=this.parseDirectives(!0);return{kind:B.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:l,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:B.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken($.EQUALS)?this.delimitedMany($.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:B.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany($.BRACE_L,this.parseEnumValueDefinition,$.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:B.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:B.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:B.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken($.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var l=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(cd[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new _l(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Xe(this._lexer.source,n.start,"Expected ".concat($l(r),", found ").concat(Ss(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===$.NAME&&n.value===r)this._lexer.advance();else throw Xe(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(Ss(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===$.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Xe(this._lexer.source,n.start,"Unexpected ".concat(Ss(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function Ss(i){var e=i.value;return $l(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function $l(i){return pd(i)?'"'.concat(i,'"'):i}var da=new Map,Bs=new Map,Al=!0,Ea=!1;function kl(i){return i.replace(/[\s,]+/g," ").trim()}function xd(i){return kl(i.source.body.substring(i.start,i.end))}function $d(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=xd(r.loc),s=Bs.get(n);s&&!s.has(a)?Al&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
439
439
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
440
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Ms.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),va(va({},i),{definitions:t})}function yd(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function vd(i){var e=Sl(i);if(!sa.has(e)){var t=fd(i,{experimentalFragmentVariables:ba,allowLegacyFragmentVariables:ba});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");sa.set(e,yd(md(t)))}return sa.get(e)}function v(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),vd(r)}function bd(){sa.clear(),Ms.clear()}function wd(){wl=!1}function Sd(){ba=!0}function _d(){ba=!1}var Mr={gql:v,resetCaches:bd,disableFragmentWarnings:wd,enableExperimentalFragmentVariables:Sd,disableExperimentalFragmentVariables:_d};(function(i){i.gql=Mr.gql,i.resetCaches=Mr.resetCaches,i.disableFragmentWarnings=Mr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Mr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Mr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function _(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function Ed(){}function ci(){return Ed}var W=ci,h=ci,$e=ci,ae=ci,V=ci,et=ci,xd=ci,oo=ci,_l=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},El=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Pi=class{constructor(e){this.code=e}};_l([h(),El("design:type",String)],Pi.prototype,"code",void 0);Pi=_l([V(),El("design:paramtypes",[String])],Pi);var co=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},lo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Et=class{constructor(e,t){this.address=e,this.name=t}};co([h(),lo("design:type",String)],Et.prototype,"address",void 0);co([h(),lo("design:type",String)],Et.prototype,"name",void 0);Et=co([V(),lo("design:paramtypes",[String,String])],Et);var de=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},be=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ut=class{constructor(e,t){this.key=t,this.signature=e}};de([h(),be("design:type",String)],Ut.prototype,"signature",void 0);de([h(),be("design:type",String)],Ut.prototype,"key",void 0);de([h(),be("design:type",Boolean)],Ut.prototype,"valid",void 0);de([h(),be("design:type",Boolean)],Ut.prototype,"invalid",void 0);Ut=de([V(),$e(),be("design:paramtypes",[String,String])],Ut);var Oi=class{};de([h(),be("design:type",String)],Oi.prototype,"signature",void 0);de([h(),be("design:type",String)],Oi.prototype,"key",void 0);de([h(),be("design:type",Boolean)],Oi.prototype,"valid",void 0);de([h(),be("design:type",Boolean)],Oi.prototype,"invalid",void 0);Oi=de([$e()],Oi);function li(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return de([h(),be("design:type",String)],e.prototype,"author",void 0),de([h(),be("design:type",String)],e.prototype,"timestamp",void 0),de([h(),be("design:type",Object)],e.prototype,"data",void 0),de([h(),be("design:type",Ut)],e.prototype,"proof",void 0),e=de([V(),be("design:paramtypes",[String,String,Object,Ut])],e),e}function $d(i){let e=class{};return de([h(),be("design:type",String)],e.prototype,"author",void 0),de([h(),be("design:type",String)],e.prototype,"timestamp",void 0),de([h(),be("design:type",Object)],e.prototype,"data",void 0),de([h(),be("design:type",Oi)],e.prototype,"proof",void 0),e=de([$e()],e),e}var Zo=class extends li(){};Zo=de([V()],Zo);var wa=class extends li(){};de([h(),be("design:type",Et)],wa.prototype,"language",void 0);de([h(),be("design:type",Pi)],wa.prototype,"icon",void 0);wa=de([V()],wa);function Jm(i){return i&&i.author&&i.timestamp&&i.data}var me=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Te=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ze=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};me([h(),Te("design:type",String)],ze.prototype,"source",void 0);me([h(),Te("design:type",String)],ze.prototype,"target",void 0);me([h(),Te("design:type",String)],ze.prototype,"predicate",void 0);ze=me([V(),Te("design:paramtypes",[Object])],ze);var Sa=class{};me([h(),Te("design:type",Array)],Sa.prototype,"additions",void 0);me([h(),Te("design:type",Array)],Sa.prototype,"removals",void 0);Sa=me([$e()],Sa);var _a=class{constructor(e,t){this.additions=e,this.removals=t}};me([h(),Te("design:type",Array)],_a.prototype,"additions",void 0);me([h(),Te("design:type",Array)],_a.prototype,"removals",void 0);_a=me([V(),Te("design:paramtypes",[Array,Array])],_a);var fn=class{};me([h(),Te("design:type",String)],fn.prototype,"source",void 0);me([h(),Te("design:type",String)],fn.prototype,"target",void 0);me([h(),Te("design:type",String)],fn.prototype,"predicate",void 0);fn=me([$e()],fn);var ii=class extends li(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};me([h(),Te("design:type",String)],ii.prototype,"status",void 0);ii=me([V()],ii);var Us=class extends $d(){};me([h(),Te("design:type",String)],Us.prototype,"status",void 0);Us=me([$e()],Us);function ny(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function ay(i){return i&&i.source&&i.target}var Ea=class{constructor(e,t){this.oldLink=e,this.newLink=t}};me([h(),Te("design:type",ii)],Ea.prototype,"oldLink",void 0);me([h(),Te("design:type",ii)],Ea.prototype,"newLink",void 0);Ea=me([V(),Te("design:paramtypes",[ii,ii])],Ea);var Hi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},$n=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fs,kt=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};Hi([h(),$n("design:type",Array)],kt.prototype,"links",void 0);kt=Hi([V(),$n("design:paramtypes",[Array])],kt);var xa=class{};Hi([h(),$n("design:type",Array)],xa.prototype,"links",void 0);xa=Hi([$e()],xa);var js=Fs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Fs;return t.links.push(e),t}};Hi([h(),$n("design:type",Array)],js.prototype,"links",void 0);js=Fs=Hi([$e(),$n("design:paramtypes",[Array])],js);var Di=class extends li(){};Di=Hi([V()],Di);var P=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},O=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Zt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new kt}};P([h(),O("design:type",String)],Zt.prototype,"did",void 0);P([h(),O("design:type",kt)],Zt.prototype,"perspective",void 0);P([h(),O("design:type",String)],Zt.prototype,"directMessageLanguage",void 0);Zt=P([V(),O("design:paramtypes",[String,kt])],Zt);var Jo=class extends li(){};Jo=P([V()],Jo);var ri=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};P([h(),O("design:type",String)],ri.prototype,"did",void 0);P([h(),O("design:type",String)],ri.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ri.prototype,"didSignedByDeviceKey",void 0);ri=P([V(),O("design:paramtypes",[String,String,String,String,String,String])],ri);var ni=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};P([h(),O("design:type",String)],ni.prototype,"did",void 0);P([h(),O("design:type",String)],ni.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ni.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ni.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ni.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ni.prototype,"didSignedByDeviceKey",void 0);ni=P([$e(),O("design:paramtypes",[String,String,String,String,String,String])],ni);var $a=class{constructor(e,t){this.signature=e,this.publicKey=t}};P([h(),O("design:type",String)],$a.prototype,"signature",void 0);P([h(),O("design:type",String)],$a.prototype,"publicKey",void 0);$a=P([V(),O("design:paramtypes",[String,String])],$a);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],gr.prototype,"domain",void 0);P([h(),O("design:type",Array)],gr.prototype,"pointers",void 0);gr=P([V(),O("design:paramtypes",[String,Array])],gr);var Aa=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",gr)],Aa.prototype,"with",void 0);P([h(),O("design:type",Array)],Aa.prototype,"can",void 0);Aa=P([V(),O("design:paramtypes",[gr,Array])],Aa);var Ft=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};P([h(),O("design:type",String)],Ft.prototype,"appName",void 0);P([h(),O("design:type",String)],Ft.prototype,"appDesc",void 0);P([h(),O("design:type",String)],Ft.prototype,"appUrl",void 0);P([h(),O("design:type",String)],Ft.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],Ft.prototype,"capabilities",void 0);Ft=P([V(),O("design:paramtypes",[String,String,String,Array,String])],Ft);var mr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};P([h(),O("design:type",String)],mr.prototype,"requestId",void 0);P([h(),O("design:type",String)],mr.prototype,"token",void 0);P([h(),O("design:type",Boolean)],mr.prototype,"revoked",void 0);P([h(),O("design:type",Ft)],mr.prototype,"auth",void 0);mr=P([V(),O("design:paramtypes",[String,Ft,String,Boolean])],mr);var yr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],yr.prototype,"domain",void 0);P([h(),O("design:type",Array)],yr.prototype,"pointers",void 0);yr=P([$e(),O("design:paramtypes",[String,Array])],yr);var ka=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",yr)],ka.prototype,"with",void 0);P([h(),O("design:type",Array)],ka.prototype,"can",void 0);ka=P([$e(),O("design:paramtypes",[yr,Array])],ka);var It=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};P([h(),O("design:type",String)],It.prototype,"appName",void 0);P([h(),O("design:type",String)],It.prototype,"appDesc",void 0);P([h(),O("design:type",String)],It.prototype,"appDomain",void 0);P([h(),O("design:type",String)],It.prototype,"appUrl",void 0);P([h(),O("design:type",String)],It.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],It.prototype,"capabilities",void 0);It=P([$e(),O("design:paramtypes",[String,String,String,String,String,Array])],It);var Mi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};P([h(),O("design:type",String)],Mi.prototype,"did",void 0);P([h(),O("design:type",Boolean)],Mi.prototype,"success",void 0);P([h(),O("design:type",String)],Mi.prototype,"error",void 0);Mi=P([V(),O("design:paramtypes",[String,Boolean,String])],Mi);var $r=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ar=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},at=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};$r([h(),Ar("design:type",Boolean)],at.prototype,"isInitialized",void 0);$r([h(),Ar("design:type",Boolean)],at.prototype,"isUnlocked",void 0);$r([h(),Ar("design:type",String)],at.prototype,"did",void 0);$r([h(),Ar("design:type",String)],at.prototype,"didDocument",void 0);$r([h(),Ar("design:type",String)],at.prototype,"error",void 0);at=$r([V(),Ar("design:paramtypes",[Object])],at);var Yo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},fe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},qe,Ve,Bs=class{constructor(e,t){qe.set(this,void 0),Ve.set(this,void 0),Yo(this,qe,e,"f"),Yo(this,Ve,t,"f")}async otherAgents(){return await fe(this,qe,"f").otherAgents(fe(this,Ve,"f"))}async hasTelepresenceAdapter(){return await fe(this,qe,"f").hasTelepresenceAdapter(fe(this,Ve,"f"))}async onlineAgents(){return await fe(this,qe,"f").onlineAgents(fe(this,Ve,"f"))}async setOnlineStatus(e){return await fe(this,qe,"f").setOnlineStatus(fe(this,Ve,"f"),e)}async setOnlineStatusU(e){return await fe(this,qe,"f").setOnlineStatusU(fe(this,Ve,"f"),e)}async sendSignal(e,t){return await fe(this,qe,"f").sendSignal(fe(this,Ve,"f"),e,t)}async sendSignalU(e,t){return await fe(this,qe,"f").sendSignalU(fe(this,Ve,"f"),e,t)}async sendBroadcast(e,t=!1){return await fe(this,qe,"f").sendBroadcast(fe(this,Ve,"f"),e,t)}async sendBroadcastU(e,t=!1){return await fe(this,qe,"f").sendBroadcastU(fe(this,Ve,"f"),e,t)}async addSignalHandler(e){await fe(this,qe,"f").addSignalHandler(fe(this,Ve,"f"),e)}removeSignalHandler(e){fe(this,qe,"f").removeSignalHandler(fe(this,Ve,"f"),e)}};qe=new WeakMap,Ve=new WeakMap;var zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Wi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ie=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};zi([h(),Wi("design:type",String)],ie.prototype,"source",void 0);zi([h(),Wi("design:type",String)],ie.prototype,"target",void 0);zi([h(),Wi("design:type",String)],ie.prototype,"predicate",void 0);zi([h(),Wi("design:type",Date)],ie.prototype,"fromDate",void 0);zi([h(),Wi("design:type",Date)],ie.prototype,"untilDate",void 0);zi([h(),Wi("design:type",Number)],ie.prototype,"limit",void 0);ie=zi([V(),$e(),Wi("design:paramtypes",[Object])],ie);var Xo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ke=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},He,Rt;function Vn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var se=class{constructor(){He.set(this,void 0),Rt.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new se;return Xo(t,Rt,e,"f"),t}static from(e){let t=new se;return Xo(t,He,e,"f"),t}toUrl(){if(ke(this,Rt,"f")&&!ke(this,He,"f"))return ke(this,Rt,"f");if(!ke(this,Rt,"f")&&(ke(this,He,"f")===void 0||ke(this,He,"f")===""||ke(this,He,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof ke(this,He,"f")){case"string":e=`string:${Vn(ke(this,He,"f"))}`;break;case"number":e=`number:${Vn(ke(this,He,"f"))}`;break;case"boolean":e=`boolean:${Vn(ke(this,He,"f"))}`;break;case"object":e=`json:${Vn(JSON.stringify(ke(this,He,"f")))}`;break}return`literal://${e}`}get(){if(ke(this,He,"f"))return ke(this,He,"f");if(!ke(this,Rt,"f"))throw new Error("Can't render empty Literal");if(!ke(this,Rt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=ke(this,Rt,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};He=new WeakMap,Rt=new WeakMap;function pt(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Ia(i){return`set${pt(i)}`}function xl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function Ad(i){return`add${pt(xl(i))}`}function kd(i){return`remove${pt(xl(i))}`}function Id(i){return`set${pt(i)}`}function bi(i){if(Array.isArray(i))return`[${i.map(bi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var vs=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Q=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Me,Ue,he,on=class{constructor(i,e,t){Me.set(this,void 0),Ue.set(this,void 0),he.set(this,void 0),vs(this,Me,e,"f"),vs(this,Ue,t,"f"),vs(this,he,i,"f")}get baseExpression(){return Q(this,Me,"f")}async init(){let isInstance=await Q(this,he,"f").isSubjectInstance(Q(this,Me,"f"),Q(this,Ue,"f"));if(!isInstance)throw`Not a valid subject instance of ${Q(this,Ue,"f")} for ${Q(this,Me,"f")}`;let results=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await Q(this,he,"f").getPropertyValueViaSurreal(Q(this,Me,"f"),Q(this,Ue,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Ia(property)]=async i=>{resolveLanguage&&(i=await Q(this,he,"f").createExpression(i,resolveLanguage)),await Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:i}])}}let results2=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(i=>i.Collection);for(let i of relations)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await Q(this,he,"f").getRelationValuesViaSurreal(Q(this,Me,"f"),Q(this,Ue,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Ad(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:e}]))):await Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:i}])}}let removers=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[kd(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:e}]))):await Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:i}])}}let relationSetters=await Q(this,he,"f").infer(`subject_class("${Q(this,Ue,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[Id(relation)]=async i=>{Array.isArray(i)?await Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),i.map(e=>({name:"value",value:e}))):await Q(this,he,"f").executeAction(actions,Q(this,Me,"f"),[{name:"value",value:i}])}}}};Me=new WeakMap,Ue=new WeakMap,he=new WeakMap;function ec(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function tc(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function ic(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var Jt=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=ec(e),n=ic(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
440
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Bs.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),_a(_a({},i),{definitions:t})}function Ad(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function kd(i){var e=kl(i);if(!da.has(e)){var t=_d(i,{experimentalFragmentVariables:Ea,allowLegacyFragmentVariables:Ea});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");da.set(e,Ad($d(t)))}return da.get(e)}function v(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),kd(r)}function Id(){da.clear(),Bs.clear()}function Td(){Al=!1}function Cd(){Ea=!0}function Ld(){Ea=!1}var Fr={gql:v,resetCaches:Id,disableFragmentWarnings:Td,enableExperimentalFragmentVariables:Cd,disableExperimentalFragmentVariables:Ld};(function(i){i.gql=Fr.gql,i.resetCaches=Fr.resetCaches,i.disableFragmentWarnings=Fr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Fr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Fr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function w(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function Nd(){}function oi(){return Nd}var q=oi,h=oi,Ae=oi,te=oi,F=oi,Ge=oi,Rd=oi,po=oi,Il=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Tl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ri=class{constructor(e){this.code=e}};Il([h(),Tl("design:type",String)],Ri.prototype,"code",void 0);Ri=Il([F(),Tl("design:paramtypes",[String])],Ri);var fo=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ho=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Et=class{constructor(e,t){this.address=e,this.name=t}};fo([h(),ho("design:type",String)],Et.prototype,"address",void 0);fo([h(),ho("design:type",String)],Et.prototype,"name",void 0);Et=fo([F(),ho("design:paramtypes",[String,String])],Et);var pe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},we=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ut=class{constructor(e,t){this.key=t,this.signature=e}};pe([h(),we("design:type",String)],Ut.prototype,"signature",void 0);pe([h(),we("design:type",String)],Ut.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"invalid",void 0);Ut=pe([F(),Ae(),we("design:paramtypes",[String,String])],Ut);var Pi=class{};pe([h(),we("design:type",String)],Pi.prototype,"signature",void 0);pe([h(),we("design:type",String)],Pi.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"invalid",void 0);Pi=pe([Ae()],Pi);function ci(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return pe([h(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Ut)],e.prototype,"proof",void 0),e=pe([F(),we("design:paramtypes",[String,String,Object,Ut])],e),e}function Pd(i){let e=class{};return pe([h(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Pi)],e.prototype,"proof",void 0),e=pe([Ae()],e),e}var ec=class extends ci(){};ec=pe([F()],ec);var xa=class extends ci(){};pe([h(),we("design:type",Et)],xa.prototype,"language",void 0);pe([h(),we("design:type",Ri)],xa.prototype,"icon",void 0);xa=pe([F()],xa);function gy(i){return i&&i.author&&i.timestamp&&i.data}var ye=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ce=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ke=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ye([h(),Ce("design:type",String)],Ke.prototype,"source",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"target",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"predicate",void 0);Ke=ye([F(),Ce("design:paramtypes",[Object])],Ke);var $a=class{};ye([h(),Ce("design:type",Array)],$a.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],$a.prototype,"removals",void 0);$a=ye([Ae()],$a);var Aa=class{constructor(e,t){this.additions=e,this.removals=t}};ye([h(),Ce("design:type",Array)],Aa.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],Aa.prototype,"removals",void 0);Aa=ye([F(),Ce("design:paramtypes",[Array,Array])],Aa);var yn=class{};ye([h(),Ce("design:type",String)],yn.prototype,"source",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"target",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"predicate",void 0);yn=ye([Ae()],yn);var ti=class extends ci(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};ye([h(),Ce("design:type",String)],ti.prototype,"status",void 0);ti=ye([F()],ti);var qs=class extends Pd(){};ye([h(),Ce("design:type",String)],qs.prototype,"status",void 0);qs=ye([Ae()],qs);function _y(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function Ey(i){return i&&i.source&&i.target}var ka=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ye([h(),Ce("design:type",ti)],ka.prototype,"oldLink",void 0);ye([h(),Ce("design:type",ti)],ka.prototype,"newLink",void 0);ka=ye([F(),Ce("design:paramtypes",[ti,ti])],ka);var zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Tn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Hs,kt=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};zi([h(),Tn("design:type",Array)],kt.prototype,"links",void 0);kt=zi([F(),Tn("design:paramtypes",[Array])],kt);var Ia=class{};zi([h(),Tn("design:type",Array)],Ia.prototype,"links",void 0);Ia=zi([Ae()],Ia);var Vs=Hs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Hs;return t.links.push(e),t}};zi([h(),Tn("design:type",Array)],Vs.prototype,"links",void 0);Vs=Hs=zi([Ae(),Tn("design:paramtypes",[Array])],Vs);var Oi=class extends ci(){};Oi=zi([F()],Oi);var P=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},O=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Zt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new kt}};P([h(),O("design:type",String)],Zt.prototype,"did",void 0);P([h(),O("design:type",kt)],Zt.prototype,"perspective",void 0);P([h(),O("design:type",String)],Zt.prototype,"directMessageLanguage",void 0);Zt=P([F(),O("design:paramtypes",[String,kt])],Zt);var tc=class extends ci(){};tc=P([F()],tc);var ii=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};P([h(),O("design:type",String)],ii.prototype,"did",void 0);P([h(),O("design:type",String)],ii.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ii.prototype,"didSignedByDeviceKey",void 0);ii=P([F(),O("design:paramtypes",[String,String,String,String,String,String])],ii);var ri=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};P([h(),O("design:type",String)],ri.prototype,"did",void 0);P([h(),O("design:type",String)],ri.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ri.prototype,"didSignedByDeviceKey",void 0);ri=P([Ae(),O("design:paramtypes",[String,String,String,String,String,String])],ri);var Ta=class{constructor(e,t){this.signature=e,this.publicKey=t}};P([h(),O("design:type",String)],Ta.prototype,"signature",void 0);P([h(),O("design:type",String)],Ta.prototype,"publicKey",void 0);Ta=P([F(),O("design:paramtypes",[String,String])],Ta);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],gr.prototype,"domain",void 0);P([h(),O("design:type",Array)],gr.prototype,"pointers",void 0);gr=P([F(),O("design:paramtypes",[String,Array])],gr);var Ca=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",gr)],Ca.prototype,"with",void 0);P([h(),O("design:type",Array)],Ca.prototype,"can",void 0);Ca=P([F(),O("design:paramtypes",[gr,Array])],Ca);var Ft=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};P([h(),O("design:type",String)],Ft.prototype,"appName",void 0);P([h(),O("design:type",String)],Ft.prototype,"appDesc",void 0);P([h(),O("design:type",String)],Ft.prototype,"appUrl",void 0);P([h(),O("design:type",String)],Ft.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],Ft.prototype,"capabilities",void 0);Ft=P([F(),O("design:paramtypes",[String,String,String,Array,String])],Ft);var mr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};P([h(),O("design:type",String)],mr.prototype,"requestId",void 0);P([h(),O("design:type",String)],mr.prototype,"token",void 0);P([h(),O("design:type",Boolean)],mr.prototype,"revoked",void 0);P([h(),O("design:type",Ft)],mr.prototype,"auth",void 0);mr=P([F(),O("design:paramtypes",[String,Ft,String,Boolean])],mr);var yr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],yr.prototype,"domain",void 0);P([h(),O("design:type",Array)],yr.prototype,"pointers",void 0);yr=P([Ae(),O("design:paramtypes",[String,Array])],yr);var La=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",yr)],La.prototype,"with",void 0);P([h(),O("design:type",Array)],La.prototype,"can",void 0);La=P([Ae(),O("design:paramtypes",[yr,Array])],La);var It=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};P([h(),O("design:type",String)],It.prototype,"appName",void 0);P([h(),O("design:type",String)],It.prototype,"appDesc",void 0);P([h(),O("design:type",String)],It.prototype,"appDomain",void 0);P([h(),O("design:type",String)],It.prototype,"appUrl",void 0);P([h(),O("design:type",String)],It.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],It.prototype,"capabilities",void 0);It=P([Ae(),O("design:paramtypes",[String,String,String,String,String,Array])],It);var Di=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};P([h(),O("design:type",String)],Di.prototype,"did",void 0);P([h(),O("design:type",Boolean)],Di.prototype,"success",void 0);P([h(),O("design:type",String)],Di.prototype,"error",void 0);Di=P([F(),O("design:paramtypes",[String,Boolean,String])],Di);var kr=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ir=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ot=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};kr([h(),Ir("design:type",Boolean)],ot.prototype,"isInitialized",void 0);kr([h(),Ir("design:type",Boolean)],ot.prototype,"isUnlocked",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"did",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"didDocument",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"error",void 0);ot=kr([F(),Ir("design:paramtypes",[Object])],ot);var ic=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},he=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ve,ze,zs=class{constructor(e,t){Ve.set(this,void 0),ze.set(this,void 0),ic(this,Ve,e,"f"),ic(this,ze,t,"f")}async otherAgents(){return await he(this,Ve,"f").otherAgents(he(this,ze,"f"))}async hasTelepresenceAdapter(){return await he(this,Ve,"f").hasTelepresenceAdapter(he(this,ze,"f"))}async onlineAgents(){return await he(this,Ve,"f").onlineAgents(he(this,ze,"f"))}async setOnlineStatus(e){return await he(this,Ve,"f").setOnlineStatus(he(this,ze,"f"),e)}async setOnlineStatusU(e){return await he(this,Ve,"f").setOnlineStatusU(he(this,ze,"f"),e)}async sendSignal(e,t){return await he(this,Ve,"f").sendSignal(he(this,ze,"f"),e,t)}async sendSignalU(e,t){return await he(this,Ve,"f").sendSignalU(he(this,ze,"f"),e,t)}async sendBroadcast(e,t=!1){return await he(this,Ve,"f").sendBroadcast(he(this,ze,"f"),e,t)}async sendBroadcastU(e,t=!1){return await he(this,Ve,"f").sendBroadcastU(he(this,ze,"f"),e,t)}async addSignalHandler(e){await he(this,Ve,"f").addSignalHandler(he(this,ze,"f"),e)}removeSignalHandler(e){he(this,Ve,"f").removeSignalHandler(he(this,ze,"f"),e)}};Ve=new WeakMap,ze=new WeakMap;var Wi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ki=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},re=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};Wi([h(),Ki("design:type",String)],re.prototype,"source",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"target",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"predicate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"fromDate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"untilDate",void 0);Wi([h(),Ki("design:type",Number)],re.prototype,"limit",void 0);re=Wi([F(),Ae(),Ki("design:paramtypes",[Object])],re);var rc=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ie=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},We,Rt;function Kn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var oe=class{constructor(){We.set(this,void 0),Rt.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new oe;return rc(t,Rt,e,"f"),t}static from(e){let t=new oe;return rc(t,We,e,"f"),t}toUrl(){if(Ie(this,Rt,"f")&&!Ie(this,We,"f"))return Ie(this,Rt,"f");if(!Ie(this,Rt,"f")&&(Ie(this,We,"f")===void 0||Ie(this,We,"f")===""||Ie(this,We,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,We,"f")){case"string":e=`string:${Kn(Ie(this,We,"f"))}`;break;case"number":e=`number:${Kn(Ie(this,We,"f"))}`;break;case"boolean":e=`boolean:${Kn(Ie(this,We,"f"))}`;break;case"object":e=`json:${Kn(JSON.stringify(Ie(this,We,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,We,"f"))return Ie(this,We,"f");if(!Ie(this,Rt,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,Rt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,Rt,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};We=new WeakMap,Rt=new WeakMap;function Be(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Wa(i){return`set${Be(i)}`}function Cl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function Od(i){return`add${Be(Cl(i))}`}function Dd(i){return`remove${Be(Cl(i))}`}function Md(i){return`set${Be(i)}`}function Ll(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function vi(i){if(Array.isArray(i))return`[${i.map(vi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var _s=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},K=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Me,Ue,ge,un=class{constructor(i,e,t){Me.set(this,void 0),Ue.set(this,void 0),ge.set(this,void 0),_s(this,Me,e,"f"),_s(this,Ue,t,"f"),_s(this,ge,i,"f")}get baseExpression(){return K(this,Me,"f")}async init(){let isInstance=await K(this,ge,"f").isSubjectInstance(K(this,Me,"f"),K(this,Ue,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,Ue,"f")} for ${K(this,Me,"f")}`;let results=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getPropertyValueViaSurreal(K(this,Me,"f"),K(this,Ue,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wa(property)]=async i=>{resolveLanguage&&(i=await K(this,ge,"f").createExpression(i,resolveLanguage)),await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let results2=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(i=>i.Collection);for(let i of relations)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getRelationValuesViaSurreal(K(this,Me,"f"),K(this,Ue,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Od(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let removers=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[Dd(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[Md(relation)]=async i=>{Array.isArray(i)?await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}}};Me=new WeakMap,Ue=new WeakMap,ge=new WeakMap;function Ud(i,e,t,r){let n="",a=Ll(8);n+=`subject_class("${i}", ${a}).
|
|
441
|
+
`;let s=[],o=[];e.subjectConstructor&&e.subjectConstructor.length&&(o=o.concat(e.subjectConstructor));let l=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(l=l.concat(e.isSubjectInstance));let c=[];for(let d in t){let p=`property(${a}, "${d}").
|
|
442
|
+
`,{through:f,initial:S,required:E,resolveLanguage:A,writable:k,flag:b,prologGetter:T,prologSetter:R,local:C}=t[d];if(A&&(p+=`property_resolve(${a}, "${d}").
|
|
443
|
+
`,p+=`property_resolve_language(${a}, "${d}", "${A}").
|
|
444
|
+
`),T?p+=`property_getter(${a}, Base, "${d}", Value) :- ${T}.
|
|
445
|
+
`:f&&(p+=`property_getter(${a}, Base, "${d}", Value) :- triple(Base, "${f}", Value).
|
|
446
|
+
`,E&&(b?l.push(`triple(Base, "${f}", "${S}")`):l.push(`triple(Base, "${f}", _)`))),R)p+=`property_setter(${a}, "${d}", Actions) :- ${R}.
|
|
447
|
+
`;else if(k&&f&&typeof e[Wa(d)]=="function"){let L=[{action:"setSingleTarget",source:"this",predicate:f,target:"value",...C&&{local:!0}}];p+=`property_setter(${a}, "${d}", '${vi(L)}').
|
|
448
|
+
`}c.push(p);let Q=S??(E&&k&&!b&&f?"literal://string:":void 0);Q&&(o.push({action:"addLink",source:"this",predicate:f,target:Q}),s.push({action:"removeLink",source:"this",predicate:f,target:"*"}))}let u=[],m=Object.fromEntries(Object.entries(r).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let d in m){let p=`collection(${a}, "${d}").
|
|
449
|
+
`,{predicate:f,local:S}=m[d];if(f){p+=`collection_getter(${a}, Base, "${d}", List) :- findall(C, triple(Base, "${f}", C), List).
|
|
450
|
+
`;let E=[{action:"addLink",source:"this",predicate:f,target:"value",...S&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:f,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:f,target:"value",...S&&{local:!0}}];p+=`collection_adder(${a}, "${d}", '${vi(E)}').
|
|
451
|
+
`,p+=`collection_remover(${a}, "${d}", '${vi(A)}').
|
|
452
|
+
`,p+=`collection_setter(${a}, "${d}", '${vi(k)}').
|
|
453
|
+
`}u.push(p)}let y=vi(o);if(n+=`constructor(${a}, '${y}').
|
|
454
|
+
`,l.length>0){let d=l.join(", ");n+=`instance(${a}, Base) :- ${d}.
|
|
455
|
+
`,n+=`
|
|
456
|
+
`}return n+=`destructor(${a}, '${vi(s)}').
|
|
457
|
+
`,n+=`
|
|
458
|
+
`,n+=c.join(`
|
|
459
|
+
`),n+=`
|
|
460
|
+
`,n+=u.join(`
|
|
461
|
+
`),{sdna:n,name:i}}function nc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function ac(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function sc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var Jt=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=nc(e),n=sc(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
441
462
|
`;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
442
463
|
`,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
443
464
|
`,e+=`@prefix ad4m: <ad4m://> .
|
|
@@ -452,48 +473,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
|
|
|
452
473
|
`),r.nodeKind&&(e+=` sh:nodeKind sh:${r.nodeKind} ;
|
|
453
474
|
`),r.minCount!==void 0&&(e+=` sh:minCount ${r.minCount} ;
|
|
454
475
|
`),r.maxCount!==void 0&&(e+=` sh:maxCount ${r.maxCount} ;
|
|
455
|
-
`),r.pattern&&(e+=` sh:pattern "${
|
|
476
|
+
`),r.pattern&&(e+=` sh:pattern "${ac(r.pattern)}" ;
|
|
456
477
|
`),r.minInclusive!==void 0&&(e+=` sh:minInclusive ${r.minInclusive} ;
|
|
457
478
|
`),r.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${r.maxInclusive} ;
|
|
458
|
-
`),r.hasValue&&(e+=` sh:hasValue "${
|
|
479
|
+
`),r.hasValue&&(e+=` sh:hasValue "${ac(r.hasValue)}" ;
|
|
459
480
|
`),r.local!==void 0&&(e+=` ad4m:local ${r.local} ;
|
|
460
481
|
`),r.writable!==void 0&&(e+=` ad4m:writable ${r.writable} ;
|
|
461
482
|
`),e=e.slice(0,-2)+`
|
|
462
483
|
`,e+=n?` ] .
|
|
463
484
|
`:` ] ;
|
|
464
|
-
`}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=ec(this.targetClass),s=ic(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new Jt(t,r?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(c)}catch{}let s=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(s)try{let c=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(c)}catch{}let o=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of o){let l=c.target,u=e.find(k=>k.source===l&&k.predicate==="sh://path");if(!u)continue;let f;if(!l.startsWith("_:")){let k=l.lastIndexOf(".");k!==-1&&(f=l.substring(k+1))}let g={name:f,path:u.target},d=e.find(k=>k.source===l&&k.predicate==="sh://datatype");d&&(g.datatype=d.target);let y=e.find(k=>k.source===l&&k.predicate==="sh://nodeKind");y&&(g.nodeKind=y.target.replace("sh://",""));let p=e.find(k=>k.source===l&&k.predicate==="sh://minCount");if(p){let k=p.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),g.minCount=parseInt(k)}let b=e.find(k=>k.source===l&&k.predicate==="sh://maxCount");if(b){let k=b.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),g.maxCount=parseInt(k)}let S=e.find(k=>k.source===l&&k.predicate==="sh://pattern");S&&(g.pattern=S.target.replace("literal://",""));let x=e.find(k=>k.source===l&&k.predicate==="sh://minInclusive");if(x){let k=x.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),g.minInclusive=parseFloat(k)}let I=e.find(k=>k.source===l&&k.predicate==="sh://maxInclusive");if(I){let k=I.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),g.maxInclusive=parseFloat(k)}let w=e.find(k=>k.source===l&&k.predicate==="sh://hasValue");w&&(g.hasValue=w.target.replace("literal://",""));let T=e.find(k=>k.source===l&&k.predicate==="ad4m://local");if(T){let k=T.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),g.local=k==="true"}let R=e.find(k=>k.source===l&&k.predicate==="ad4m://writable");if(R){let k=R.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),g.writable=k==="true"}let L=e.find(k=>k.source===l&&k.predicate==="ad4m://resolveLanguage");L&&(g.resolveLanguage=L.target.replace("literal://string:",""));let B=e.find(k=>k.source===l&&k.predicate==="ad4m://setter");if(B)try{let k=B.target.replace("literal://string:","");g.setter=JSON.parse(k)}catch{}let q=e.find(k=>k.source===l&&k.predicate==="ad4m://adder");if(q)try{let k=q.target.replace("literal://string:","");g.adder=JSON.parse(k)}catch{}let C=e.find(k=>k.source===l&&k.predicate==="ad4m://remover");if(C)try{let k=C.target.replace("literal://string:","");g.remover=JSON.parse(k)}catch{}let H=e.find(k=>k.source===l&&k.predicate==="ad4m://getter");H&&(g.getter=H.target.replace("literal://string:",""));let Ce=e.find(k=>k.source===l&&k.predicate==="ad4m://conformanceConditions");if(Ce)try{let k=Ce.target.replace("literal://string:","");g.conformanceConditions=JSON.parse(k)}catch{}let Lr=e.find(k=>k.source===l&&k.predicate==="sh://class");Lr&&(g.class=Lr.target),n.addProperty(g)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Jt(e.node_shape_uri,e.target_class):new Jt(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let r of e.parent_shapes)t.addParentShape(r);return t}};function rc(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function $l(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${rc(e)} your ${t} actions, with access to ${rc(r)}`}function G(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function pr(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>pr(e)).join(", ")}]`:String(i)}function Td(i,e,t){let r=G(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>pr(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let c=a.not.map(l=>pr(l)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${c}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${pr(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${pr(e)}]) > 0`}function Al(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let c=e.properties[r];c?(a=c.predicate,s=c.resolveLanguage):a=r}else a=r;let o=Td(a,n,{resolveLanguage:s});o&&t.push(o)}return t}var xt=new WeakMap,Re=new WeakMap;function Yt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=xt.get(n);a&&Object.assign(e,a)}return e}function wt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Re.get(n);a&&Object.assign(e,a)}return e}function Cd(i,e,t){xt.has(i)||xt.set(i,{}),xt.get(i)[e]=t}function Ld(i,e,t){Re.has(i)||Re.set(i,{}),Re.get(i)[e]=t}function kl(i,e){try{let t=Yt(e),r=[],n=[];for(let[o,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(r.push({type:"flag",predicate:c.through,value:c.initial}),n.push(`count(->link[WHERE predicate = '${G(c.through)}' AND out.uri = '${G(c.initial)}']) > 0`));for(let[o,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(r.push({type:"required",predicate:c.through}),n.push(`count(->link[WHERE predicate = '${G(c.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${G(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function Ay(i){let e=i.constructor,t=Yt(e),r={};for(let[n,a]of Object.entries(t))r[n]=i[n];return r}function Il(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var nc=class{};function ky(i,e,t){return{action:"addLink",source:i,predicate:e,target:t}}function Iy(i){return`triple(this, "${i}", _)`}function Va(i){return function(e,t){let r=i.readOnly?!1:!!i.through;if(i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let n=e.constructor;if(xt.has(n)||xt.set(n,{}),xt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${pt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Ty(i){return Va({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function Cy(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.value)throw new Error("SubjectFlag requires a 'value' option");let r={through:i.through,required:!0,initial:i.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;xt.has(n)||xt.set(n,{}),xt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Nd(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){let t="",r=i.name,n=e.prototype,a=Il(8);t+=`subject_class("${r}", ${a}).
|
|
465
|
-
`;let s=[],o=[];n.subjectConstructor&&n.subjectConstructor.length&&(o=o.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let l=[],u=Yt(e);for(let p in u){let b=`property(${a}, "${p}").
|
|
466
|
-
`,{through:S,initial:x,required:I,resolveLanguage:w,writable:T,flag:R,prologGetter:L,prologSetter:B,local:q}=u[p];if(w&&(b+=`property_resolve(${a}, "${p}").
|
|
467
|
-
`,b+=`property_resolve_language(${a}, "${p}", "${w}").
|
|
468
|
-
`),L?b+=`property_getter(${a}, Base, "${p}", Value) :- ${L}.
|
|
469
|
-
`:S&&(b+=`property_getter(${a}, Base, "${p}", Value) :- triple(Base, "${S}", Value).
|
|
470
|
-
`,I&&(R?c.push(`triple(Base, "${S}", "${x}")`):c.push(`triple(Base, "${S}", _)`))),B)b+=`property_setter(${a}, "${p}", Actions) :- ${B}.
|
|
471
|
-
`;else if(T&&S&&typeof n[Ia(p)]=="function"){let Ce=[{action:"setSingleTarget",source:"this",predicate:S,target:"value",...q&&{local:!0}}];b+=`property_setter(${a}, "${p}", '${bi(Ce)}').
|
|
472
|
-
`}l.push(b);let C=x??(I&&T&&!R&&S?"literal://string:":void 0);C&&(o.push({action:"addLink",source:"this",predicate:S,target:C}),s.push({action:"removeLink",source:"this",predicate:S,target:"*"}))}let f=[],g=wt(e),d=Object.fromEntries(Object.entries(g).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let p in d){let b=`collection(${a}, "${p}").
|
|
473
|
-
`,{predicate:S,local:x}=d[p];if(S){b+=`collection_getter(${a}, Base, "${p}", List) :- findall(C, triple(Base, "${S}", C), List).
|
|
474
|
-
`;let I=[{action:"addLink",source:"this",predicate:S,target:"value",...x&&{local:!0}}],w=[{action:"removeLink",source:"this",predicate:S,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:S,target:"value",...x&&{local:!0}}];b+=`collection_adder(${a}, "${p}", '${bi(I)}').
|
|
475
|
-
`,b+=`collection_remover(${a}, "${p}", '${bi(w)}').
|
|
476
|
-
`,b+=`collection_setter(${a}, "${p}", '${bi(T)}').
|
|
477
|
-
`}f.push(b)}let y=bi(o);if(t+=`constructor(${a}, '${y}').
|
|
478
|
-
`,c.length>0){let p=c.join(", ");t+=`instance(${a}, Base) :- ${p}.
|
|
479
|
-
`,t+=`
|
|
480
|
-
`}return t+=`destructor(${a}, '${bi(s)}').
|
|
481
|
-
`,t+=`
|
|
482
|
-
`,t+=l.join(`
|
|
483
|
-
`),t+=`
|
|
484
|
-
`,t+=f.join(`
|
|
485
|
-
`),{sdna:t,name:r}},e.generateSHACL=function(){let t=i.name,r=e.prototype,n="ad4m://",a=Yt(e),s=wt(e),o=Object.fromEntries(Object.entries(s).filter(([,y])=>y.kind==="hasMany"||y.kind==="belongsToMany"));if(Object.keys(a).length>0){let y=a[Object.keys(a)[0]];if(y.through){let p=y.through.match(/^([^:]+:\/\/)/);p&&(n=p[1])}}else if(Object.keys(o).length>0){let y=o[Object.keys(o)[0]];if(y.predicate){let p=y.predicate.match(/^([^:]+:\/\/)/);p&&(n=p[1])}}let c=`${n}${t}Shape`,l=`${n}${t}`,u=new Jt(c,l),f=Object.getPrototypeOf(e);if(f&&typeof f.generateSHACL=="function"){let y=f.generateSHACL();y?.shape?.nodeShapeUri&&u.addParentShape(y.shape.nodeShapeUri)}let g=[];r.subjectConstructor&&r.subjectConstructor.length&&(g=g.concat(r.subjectConstructor));let d=[];for(let y in a){let p=a[y];if(!p.through)continue;let b={name:y,path:p.through};if(p.resolveLanguage==="literal")b.datatype="xsd://string";else if(p.initial){let x=typeof r[y];x==="number"?b.datatype="xsd://integer":x==="boolean"?b.datatype="xsd://boolean":x==="string"&&(b.datatype="xsd://string")}p.required&&(b.minCount=1),b.maxCount=1,p.flag&&p.initial&&(b.hasValue=p.initial),p.local!==void 0&&(b.local=p.local),p.writable!==void 0&&(b.writable=p.writable),p.resolveLanguage&&(b.resolveLanguage=p.resolveLanguage),p.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${y}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):p.writable&&p.through&&typeof r[Ia(y)]=="function"&&(b.setter=[{action:"setSingleTarget",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}]);let S=p.initial??(p.required&&p.writable&&!p.flag&&p.through?"literal://string:":void 0);S&&(g.push({action:"addLink",source:"this",predicate:p.through,target:S}),d.push({action:"removeLink",source:"this",predicate:p.through,target:"*"})),u.addProperty(b)}for(let y in o){let p=o[y];if(!p.predicate)continue;let b={name:y,path:p.predicate};if(b.nodeKind="IRI",p.local!==void 0&&(b.local=p.local),b.adder=[{action:"addLink",source:"this",predicate:p.predicate,target:"value",...p.local&&{local:!0}}],b.remover=[{action:"removeLink",source:"this",predicate:p.predicate,target:"value",...p.local&&{local:!0}}],p.getter)b.getter=p.getter;else if(p.where)try{let S=p.target?.(),x=S?S.getModelMetadata?.()??null:null,I=Al(p.where,x);if(I.length>0){let w=G(p.predicate);b.getter=`(->link[WHERE predicate = '${w}'].out[WHERE ${I.join(" AND ")}].uri)`}}catch{}else if(p.target&&p.filter!==!1)try{let S=p.target(),x=kl(p.predicate,S);x&&(b.getter=x.getter,b.conformanceConditions=x.conformanceConditions)}catch{}if(p.target)try{let x=p.target().generateSHACL?.();x?.shape?.nodeShapeUri&&(b.class=x.shape.nodeShapeUri)}catch{}u.addProperty(b)}return u.setConstructorActions(g),u.setDestructorActions(d),{shape:u,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function Rd(i){let e=i.required??!1;return Va({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function Ly(i){return Rd({...i,readOnly:!0})}function Ha(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function Ny(i,e){let t=Ha(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${pt(o)}`]=async function(c,l){return this.addRelationValue(o,c,l)},r[`remove${pt(o)}`]=async function(c,l){return this.removeRelationValue(o,c,l)},r[`set${pt(o)}`]=async function(c,l){return this.setRelationValues(o,c,l)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Ry(i,e){let t=Ha(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(Va({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${pt(o)}`]=async function(c){return this.addRelationValue(o,c)},r[`remove${pt(o)}`]=async function(c){return this.removeRelationValue(o,c)},r[`set${pt(o)}`]=async function(c){return this.setRelationValues(o,c)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Py(i,e){let t=Ha(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Va({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function Oy(i,e){let t=Ha(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var vr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:se.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:se.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:se.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:se.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),c=new vr(o,s),l=e.find(y=>y.source===t&&y.predicate==="ad4m://flowable");if(l)if(l.target==="ad4m://any")c.flowable="any";else try{let y=l.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(y))}catch{c.flowable="any"}let u=e.find(y=>y.source===t&&y.predicate==="ad4m://startAction");if(u)try{let y=u.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(y))}catch{}let f=e.filter(y=>y.source===t&&y.predicate==="ad4m://hasState"),g=new Map;for(let y of f){let p=y.target,b=e.find(R=>R.source===p&&R.predicate==="ad4m://stateName"),S=b?se.fromUrl(b.target).get():"";g.set(p,S);let x=e.find(R=>R.source===p&&R.predicate==="ad4m://stateValue"),I=x?se.fromUrl(x.target).get():0,w=e.find(R=>R.source===p&&R.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(w)try{let R=w.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(R))}catch{}c.addState({name:S,value:I,stateCheck:T})}let d=e.filter(y=>y.source===t&&y.predicate==="ad4m://hasTransition");for(let y of d){let p=y.target,b=e.find(C=>C.source===p&&C.predicate==="ad4m://actionName"),S=b?se.fromUrl(b.target).get():"",I=e.find(C=>C.source===p&&C.predicate==="ad4m://fromState")?.target||"",w=g.get(I)||"",R=e.find(C=>C.source===p&&C.predicate==="ad4m://toState")?.target||"",L=g.get(R)||"",B=e.find(C=>C.source===p&&C.predicate==="ad4m://transitionActions"),q=[];if(B)try{let C=B.target.replace("literal://string:","");q=JSON.parse(decodeURIComponent(C))}catch{}c.addTransition({actionName:S,fromState:w,toState:L,actions:q})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new vr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},ne=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},E=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},oa,Pt,yt,vt,Ii,zt,Wt,wi,qr,ca,Si,_i,rt,ur,qs,X,te,Ei,xi,$i,Vr,Ta=class{constructor(e,t,r){oa.add(this),Pt.set(this,void 0),yt.set(this,void 0),vt.set(this,void 0),Ii.set(this,void 0),zt.set(this,void 0),Wt.set(this,void 0),wi.set(this,void 0),qr.set(this,!1),ca.set(this,void 0),Si.set(this,void 0),_i.set(this,void 0),rt.set(this,void 0),ur.set(this,void 0),this.isSurrealDB=!1,ne(this,Pt,e,"f"),ne(this,ur,t,"f"),ne(this,vt,r,"f"),ne(this,Ii,new Set,"f"),ne(this,wi,null,"f"),ne(this,ca,new Promise((n,a)=>{ne(this,Si,n,"f"),ne(this,_i,a,"f")}),"f")}async subscribe(){E(this,Wt,"f")&&(E(this,Wt,"f").call(this),ne(this,Wt,void 0,"f")),E(this,rt,"f")&&(clearTimeout(E(this,rt,"f")),ne(this,rt,void 0,"f")),E(this,zt,"f")&&(clearTimeout(E(this,zt,"f")),ne(this,zt,void 0,"f"));try{let t;this.isSurrealDB?t=await E(this,vt,"f").perspectiveSubscribeSurrealQuery(E(this,Pt,"f"),E(this,ur,"f")):t=await E(this,vt,"f").subscribeQuery(E(this,Pt,"f"),E(this,ur,"f")),ne(this,yt,t.subscriptionId,"f"),t.result?(ne(this,wi,t.result,"f"),E(this,oa,"m",qs).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ne(this,rt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),ne(this,Wt,E(this,vt,"f").subscribeToQueryUpdates(E(this,yt,"f"),r=>{E(this,rt,"f")&&(clearTimeout(E(this,rt,"f")),ne(this,rt,void 0,"f")),E(this,Si,"f")&&(E(this,Si,"f").call(this,!0),ne(this,Si,void 0,"f"),ne(this,_i,void 0,"f")),!(r.isInit&&E(this,wi,"f"))&&(ne(this,wi,r,"f"),E(this,oa,"m",qs).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),E(this,_i,"f")&&(E(this,_i,"f").call(this,t),ne(this,Si,void 0,"f"),ne(this,_i,void 0,"f")),t}let e=async()=>{if(!E(this,qr,"f")){try{this.isSurrealDB?await E(this,vt,"f").perspectiveKeepAliveSurrealQuery(E(this,Pt,"f"),E(this,yt,"f")):await E(this,vt,"f").keepAliveQuery(E(this,Pt,"f"),E(this,yt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",E(this,ur,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}E(this,qr,"f")||ne(this,zt,setTimeout(e,3e4),"f")}};ne(this,zt,setTimeout(e,3e4),"f")}get id(){return E(this,yt,"f")}get initialized(){return E(this,ca,"f")}get result(){return E(this,wi,"f")}onResult(e){return E(this,Ii,"f").add(e),()=>E(this,Ii,"f").delete(e)}dispose(){ne(this,qr,!0,"f"),clearTimeout(E(this,zt,"f")),E(this,Wt,"f")&&E(this,Wt,"f").call(this),E(this,Ii,"f").clear(),E(this,rt,"f")&&(clearTimeout(E(this,rt,"f")),ne(this,rt,void 0,"f")),E(this,yt,"f")&&(this.isSurrealDB?E(this,vt,"f").perspectiveDisposeSurrealQuerySubscription(E(this,Pt,"f"),E(this,yt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):E(this,vt,"f").disposeQuerySubscription(E(this,Pt,"f"),E(this,yt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Pt=new WeakMap,yt=new WeakMap,vt=new WeakMap,Ii=new WeakMap,zt=new WeakMap,Wt=new WeakMap,wi=new WeakMap,qr=new WeakMap,ca=new WeakMap,Si=new WeakMap,_i=new WeakMap,rt=new WeakMap,ur=new WeakMap,oa=new WeakSet,qs=function i(e){for(let t of E(this,Ii,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var fr=class{constructor(e,t){X.set(this,void 0),te.set(this,void 0),Ei.set(this,void 0),xi.set(this,void 0),$i.set(this,void 0),Vr.set(this,void 0),ne(this,Ei,[],"f"),ne(this,xi,[],"f"),ne(this,$i,[],"f"),ne(this,Vr,[],"f"),ne(this,X,e,"f"),ne(this,te,t,"f"),this.uuid=E(this,X,"f").uuid,this.name=E(this,X,"f").name,this.owners=E(this,X,"f").owners,this.sharedUrl=E(this,X,"f").sharedUrl,this.neighbourhood=E(this,X,"f").neighbourhood,this.state=E(this,X,"f").state,E(this,te,"f").addPerspectiveLinkAddedListener(E(this,X,"f").uuid,E(this,Ei,"f")),E(this,te,"f").addPerspectiveLinkRemovedListener(E(this,X,"f").uuid,E(this,xi,"f")),E(this,te,"f").addPerspectiveLinkUpdatedListener(E(this,X,"f").uuid,E(this,$i,"f")),E(this,te,"f").addPerspectiveSyncStateChangeListener(E(this,X,"f").uuid,E(this,Vr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await E(this,te,"f").executeCommands(E(this,X,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await E(this,te,"f").queryLinks(E(this,X,"f").uuid,e)}async infer(e){return await E(this,te,"f").queryProlog(E(this,X,"f").uuid,e)}async querySurrealDB(e){return await E(this,te,"f").querySurrealDB(E(this,X,"f").uuid,e)}async add(e,t="shared",r){return await E(this,te,"f").addLink(E(this,X,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await E(this,te,"f").addLinks(E(this,X,"f").uuid,e,t,r)}async removeLinks(e,t){return await E(this,te,"f").removeLinks(E(this,X,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await E(this,te,"f").linkMutations(E(this,X,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await E(this,te,"f").addLinkExpression(E(this,X,"f").uuid,e,t,r)}async update(e,t,r){return await E(this,te,"f").updateLink(E(this,X,"f").uuid,e,t,r)}async remove(e,t){return await E(this,te,"f").removeLink(E(this,X,"f").uuid,e,t)}async createBatch(){return await E(this,te,"f").createBatch(E(this,X,"f").uuid)}async commitBatch(e){return await E(this,te,"f").commitBatch(E(this,X,"f").uuid,e)}async getExpression(e){return await E(this,te,"f").getExpression(e)}async createExpression(e,t){return await E(this,te,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?E(this,Ei,"f").push(t):e==="link-removed"?E(this,xi,"f").push(t):e==="link-updated"&&E(this,$i,"f").push(t)}async addSyncStateChangeListener(e){E(this,Vr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=E(this,Ei,"f").indexOf(t);E(this,Ei,"f").splice(r,1)}else if(e==="link-removed"){let r=E(this,xi,"f").indexOf(t);E(this,xi,"f").splice(r,1)}else if(e==="link-updated"){let r=E(this,$i,"f").indexOf(t);E(this,$i,"f").splice(r,1)}}async snapshot(){return E(this,te,"f").snapshotByUUID(E(this,X,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new ie({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new ie({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return se.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new ie({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new ie({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new ie({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new ie({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new ie({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new ie({source:s,predicate:"ad4m://sdna"}));for(let c of o){let l=se.fromUrl(c.data.target).get();typeof l=="string"&&t.push(l)}}}return t}async getSdnaForClass(e){let t=se.from(e);if((await this.get(new ie({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new ie({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=se.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return E(this,te,"f").addSdna(E(this,X,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=se.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new ze({source:s.source,predicate:s.predicate,target:s.target})),new ze({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new ze({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=se.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new ie({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;G(n);let a=await this.get(new ie({source:n,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(f=>f.data.target)].map(f=>`'${G(f)}'`).join(", ")}]`,u=(await this.querySurrealDB(c)||[]).map(f=>({source:f.source,predicate:f.predicate,target:f.target}));return Jt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new ie({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=se.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=se.from(e).toUrl(),a=[...r.map(s=>new ze({source:s.source,predicate:s.predicate,target:s.target})),new ze({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new ze({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=se.from(e).toUrl(),r=await this.get(new ie({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=G(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=G(s),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(c)||[]).map(f=>({source:f.source,predicate:f.predicate,target:f.target}));return vr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new ie({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await E(this,te,"f").createSubject(E(this,X,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await E(this,te,"f").createSubject(E(this,X,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await E(this,te,"f").getSubjectData(E(this,X,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await E(this,te,"f").getSubjectData(E(this,X,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new ie({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let c=s.data.target.slice(o.length),l=c;try{l=decodeURIComponent(c)}catch{}try{return JSON.parse(l)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${G(e)}'`,c=(await this.querySurrealDB(s))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of n.requiredTriples){let s=G(e),o=G(a.predicate),c;if(a.target){let g=G(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${g}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let l=await this.querySurrealDB(c);if(!l||l.length===0)return!1;let u=l[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new on(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&o.add(c.path),c.adder&&c.adder.length>0?s.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){r.push(c.predicate);let l=o.has(c.predicate);c.target&&c.target!=="value"&&!l?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,relations:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=G(r.predicate);if(r.target){let a=G(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=G(e),o=G(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,l=await this.querySurrealDB(c);if(!l||l.length===0)return;let u=l[0].value;if(a.resolveLanguage&&u)try{let f=await this.getExpression(u);try{return JSON.parse(f.data)}catch{return f.data}}catch{return u}return u}async getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=G(e),o=G(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,l=await this.querySurrealDB(c);if(!l||l.length===0)return[];let u=l.map(f=>f.value).filter(f=>f!==""&&f!=="");if(a.condition&&u.length>0)try{let f=[];for(let g of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${g.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let y=await this.querySurrealDB(`RETURN ${d}`);(y===!0||Array.isArray(y)&&y.length>0&&y[0]===!0)&&f.push(g)}u=f}catch(f){console.warn(`Failed to apply condition filter for ${r}:`,f)}if(a.instanceFilter)try{let f=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return f?await this.batchCheckSubjectInstances(u,f):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${G(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(c=>c.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${G(u)}'`).join(", "),o=G(a.predicate),c;if(a.target){let u=G(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let l=await this.querySurrealDB(c);r.push(new Set(l.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),c=await this.querySurrealDB(o);for(let l of c||[])try{let u;r?(u=new e(this,l.base),await u.get()):(u=new on(this,l.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let c of o||[])try{let l=new on(this,c.base,n);await l.init(),r.push(l)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Yt(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(f=>!Array.isArray(e[f]));let o=a?Object.fromEntries(Object.entries(wt(a)).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(f=>f!=="isSubjectInstance"):r=Object.keys(e).filter(f=>Array.isArray(e[f])&&f!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let c=`SELECT
|
|
485
|
+
`}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=nc(this.targetClass),s=sc(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(l=>l.source===t&&l.predicate==="sh://targetClass"),n=new Jt(t,r?.target),a=e.find(l=>l.source===t&&l.predicate==="ad4m://constructor");if(a)try{let l=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(l)}catch{}let s=e.find(l=>l.source===t&&l.predicate==="ad4m://destructor");if(s)try{let l=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(l)}catch{}let o=e.filter(l=>l.source===t&&l.predicate==="sh://property");for(let l of o){let c=l.target,u=e.find(I=>I.source===c&&I.predicate==="sh://path");if(!u)continue;let m;if(!c.startsWith("_:")){let I=c.lastIndexOf(".");I!==-1&&(m=c.substring(I+1))}let y={name:m,path:u.target},d=e.find(I=>I.source===c&&I.predicate==="sh://datatype");d&&(y.datatype=d.target);let p=e.find(I=>I.source===c&&I.predicate==="sh://nodeKind");p&&(y.nodeKind=p.target.replace("sh://",""));let f=e.find(I=>I.source===c&&I.predicate==="sh://minCount");if(f){let I=f.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.minCount=parseInt(I)}let S=e.find(I=>I.source===c&&I.predicate==="sh://maxCount");if(S){let I=S.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.maxCount=parseInt(I)}let E=e.find(I=>I.source===c&&I.predicate==="sh://pattern");E&&(y.pattern=E.target.replace("literal://",""));let A=e.find(I=>I.source===c&&I.predicate==="sh://minInclusive");if(A){let I=A.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.minInclusive=parseFloat(I)}let k=e.find(I=>I.source===c&&I.predicate==="sh://maxInclusive");if(k){let I=k.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.maxInclusive=parseFloat(I)}let b=e.find(I=>I.source===c&&I.predicate==="sh://hasValue");b&&(y.hasValue=b.target.replace("literal://",""));let T=e.find(I=>I.source===c&&I.predicate==="ad4m://local");if(T){let I=T.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.local=I==="true"}let R=e.find(I=>I.source===c&&I.predicate==="ad4m://writable");if(R){let I=R.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.writable=I==="true"}let C=e.find(I=>I.source===c&&I.predicate==="ad4m://resolveLanguage");C&&(y.resolveLanguage=C.target.replace("literal://string:",""));let Q=e.find(I=>I.source===c&&I.predicate==="ad4m://setter");if(Q)try{let I=Q.target.replace("literal://string:","");y.setter=JSON.parse(I)}catch{}let V=e.find(I=>I.source===c&&I.predicate==="ad4m://adder");if(V)try{let I=V.target.replace("literal://string:","");y.adder=JSON.parse(I)}catch{}let L=e.find(I=>I.source===c&&I.predicate==="ad4m://remover");if(L)try{let I=L.target.replace("literal://string:","");y.remover=JSON.parse(I)}catch{}let W=e.find(I=>I.source===c&&I.predicate==="ad4m://getter");W&&(y.getter=W.target.replace("literal://string:",""));let He=e.find(I=>I.source===c&&I.predicate==="ad4m://conformanceConditions");if(He)try{let I=He.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(I)}catch{}let Rr=e.find(I=>I.source===c&&I.predicate==="sh://class");Rr&&(y.class=Rr.target),n.addProperty(y)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Jt(e.node_shape_uri,e.target_class):new Jt(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let r of e.parent_shapes)t.addParentShape(r);return t}};function oc(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function Nl(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${oc(e)} your ${t} actions, with access to ${oc(r)}`}function Y(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function se(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>se(e)).join(", ")}]`:String(i)}function Fd(i,e,t){let r=Y(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>se(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let l=a.not.map(c=>se(c)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${l}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(e)}]) > 0`}function Rl(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let l=e.properties[r];l?(a=l.predicate,s=l.resolveLanguage):a=r}else a=r;let o=Fd(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function jd(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));if(Object.keys(t).length>0){let p=t[Object.keys(t)[0]];if(p.through){let f=p.through.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}else if(Object.keys(o).length>0){let p=o[Object.keys(o)[0]];if(p.predicate){let f=p.predicate.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new Jt(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let p=m.generateSHACL();p?.shape?.nodeShapeUri&&u.addParentShape(p.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let p in t){let f=t[p];if(!f.through)continue;let S={name:p,path:f.through};if(f.resolveLanguage==="literal")S.datatype="xsd://string";else if(f.initial){let A=typeof a[p];A==="number"?S.datatype="xsd://integer":A==="boolean"?S.datatype="xsd://boolean":A==="string"&&(S.datatype="xsd://string")}f.required&&(S.minCount=1),S.maxCount=1,f.flag&&f.initial&&(S.hasValue=f.initial),f.local!==void 0&&(S.local=f.local),f.writable!==void 0&&(S.writable=f.writable),f.resolveLanguage&&(S.resolveLanguage=f.resolveLanguage),f.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${p}' in class '${i}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):f.writable&&f.through&&typeof a[Wa(p)]=="function"&&(S.setter=[{action:"setSingleTarget",source:"this",predicate:f.through,target:"value",...f.local&&{local:!0}}]);let E=f.initial??(f.required&&f.writable&&!f.flag&&f.through?"literal://string:":void 0);E&&(y.push({action:"addLink",source:"this",predicate:f.through,target:E}),d.push({action:"removeLink",source:"this",predicate:f.through,target:"*"})),u.addProperty(S)}for(let p in o){let f=o[p];if(!f.predicate)continue;let S={name:p,path:f.predicate};if(S.nodeKind="IRI",f.local!==void 0&&(S.local=f.local),S.adder=[{action:"addLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],S.remover=[{action:"removeLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],f.getter)S.getter=f.getter;else if(f.where)try{let E=f.target?.(),A=E?E.getModelMetadata?.()??null:null,k=Rl(f.where,A);if(k.length>0){let b=Y(f.predicate);S.getter=`(->link[WHERE predicate = '${b}'].out[WHERE ${k.join(" AND ")}].uri)`}}catch{}else if(f.target&&f.filter!==!1)try{let E=f.target(),A=n(f.predicate,E);A&&(S.getter=A.getter,S.conformanceConditions=A.conformanceConditions)}catch{}if(f.target)try{let A=f.target().generateSHACL?.();A?.shape?.nodeShapeUri&&(S.class=A.shape.nodeShapeUri)}catch{}u.addProperty(S)}return u.setConstructorActions(y),u.setDestructorActions(d),{shape:u,name:i}}var xt=new WeakMap,Re=new WeakMap;function Mi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=xt.get(n);a&&Object.assign(e,a)}return e}function wt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Re.get(n);a&&Object.assign(e,a)}return e}function Bd(i,e,t){xt.has(i)||xt.set(i,{}),xt.get(i)[e]=t}function qd(i,e,t){Re.has(i)||Re.set(i,{}),Re.get(i)[e]=t}function Pl(i,e){try{let t=Mi(e),r=[],n=[];for(let[o,l]of Object.entries(t))l.flag&&l.initial&&l.through&&(r.push({type:"flag",predicate:l.through,value:l.initial}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}' AND out.uri = '${Y(l.initial)}']) > 0`));for(let[o,l]of Object.entries(t))l.required&&!l.flag&&!l.getter&&l.through&&(r.push({type:"required",predicate:l.through}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${Y(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function Ka(i){return function(e,t){let r=i.readOnly?!1:!!i.through;if(i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let n=e.constructor;if(xt.has(n)||xt.set(n,{}),xt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${Be(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Vy(i){return Ka({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function zy(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.value)throw new Error("SubjectFlag requires a 'value' option");let r={through:i.through,required:!0,initial:i.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;xt.has(n)||xt.set(n,{}),xt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Hd(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return Ud(i.name,e.prototype,Mi(e),wt(e))},e.generateSHACL=function(){return jd(i.name,e,Mi(e),wt(e),Pl)},Object.defineProperty(e,"type",{configurable:!0})}}function Vd(i){let e=i.required??!1;return Ka({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function Wy(i){return Vd({...i,readOnly:!0})}function Qa(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function Ky(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${Be(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${Be(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${Be(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Qy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(Ka({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${Be(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${Be(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${Be(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Gy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Ka({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function Zy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var vr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:oe.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:oe.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:oe.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:oe.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),l=new vr(o,s),c=e.find(p=>p.source===t&&p.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let p=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(p))}catch{l.flowable="any"}let u=e.find(p=>p.source===t&&p.predicate==="ad4m://startAction");if(u)try{let p=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(p))}catch{}let m=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasState"),y=new Map;for(let p of m){let f=p.target,S=e.find(R=>R.source===f&&R.predicate==="ad4m://stateName"),E=S?oe.fromUrl(S.target).get():"";y.set(f,E);let A=e.find(R=>R.source===f&&R.predicate==="ad4m://stateValue"),k=A?oe.fromUrl(A.target).get():0,b=e.find(R=>R.source===f&&R.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(b)try{let R=b.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(R))}catch{}l.addState({name:E,value:k,stateCheck:T})}let d=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasTransition");for(let p of d){let f=p.target,S=e.find(L=>L.source===f&&L.predicate==="ad4m://actionName"),E=S?oe.fromUrl(S.target).get():"",k=e.find(L=>L.source===f&&L.predicate==="ad4m://fromState")?.target||"",b=y.get(k)||"",R=e.find(L=>L.source===f&&L.predicate==="ad4m://toState")?.target||"",C=y.get(R)||"",Q=e.find(L=>L.source===f&&L.predicate==="ad4m://transitionActions"),V=[];if(Q)try{let L=Q.target.replace("literal://string:","");V=JSON.parse(decodeURIComponent(L))}catch{}l.addTransition({actionName:E,fromState:b,toState:C,actions:V})}return l}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new vr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},ae=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},_=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},pa,Pt,yt,vt,ki,zt,Wt,bi,Vr,fa,wi,Si,at,dr,Ws,ee,ie,_i,Ei,xi,zr,Na=class{constructor(e,t,r){pa.add(this),Pt.set(this,void 0),yt.set(this,void 0),vt.set(this,void 0),ki.set(this,void 0),zt.set(this,void 0),Wt.set(this,void 0),bi.set(this,void 0),Vr.set(this,!1),fa.set(this,void 0),wi.set(this,void 0),Si.set(this,void 0),at.set(this,void 0),dr.set(this,void 0),this.isSurrealDB=!1,ae(this,Pt,e,"f"),ae(this,dr,t,"f"),ae(this,vt,r,"f"),ae(this,ki,new Set,"f"),ae(this,bi,null,"f"),ae(this,fa,new Promise((n,a)=>{ae(this,wi,n,"f"),ae(this,Si,a,"f")}),"f")}async subscribe(){_(this,Wt,"f")&&(_(this,Wt,"f").call(this),ae(this,Wt,void 0,"f")),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,zt,"f")&&(clearTimeout(_(this,zt,"f")),ae(this,zt,void 0,"f"));try{let t;this.isSurrealDB?t=await _(this,vt,"f").perspectiveSubscribeSurrealQuery(_(this,Pt,"f"),_(this,dr,"f")):t=await _(this,vt,"f").subscribeQuery(_(this,Pt,"f"),_(this,dr,"f")),ae(this,yt,t.subscriptionId,"f"),t.result?(ae(this,bi,t.result,"f"),_(this,pa,"m",Ws).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ae(this,at,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),ae(this,Wt,_(this,vt,"f").subscribeToQueryUpdates(_(this,yt,"f"),r=>{_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,wi,"f")&&(_(this,wi,"f").call(this,!0),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),!(r.isInit&&_(this,bi,"f"))&&(ae(this,bi,r,"f"),_(this,pa,"m",Ws).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),_(this,Si,"f")&&(_(this,Si,"f").call(this,t),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),t}let e=async()=>{if(!_(this,Vr,"f")){try{this.isSurrealDB?await _(this,vt,"f").perspectiveKeepAliveSurrealQuery(_(this,Pt,"f"),_(this,yt,"f")):await _(this,vt,"f").keepAliveQuery(_(this,Pt,"f"),_(this,yt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",_(this,dr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}_(this,Vr,"f")||ae(this,zt,setTimeout(e,3e4),"f")}};ae(this,zt,setTimeout(e,3e4),"f")}get id(){return _(this,yt,"f")}get initialized(){return _(this,fa,"f")}get result(){return _(this,bi,"f")}onResult(e){return _(this,ki,"f").add(e),()=>_(this,ki,"f").delete(e)}dispose(){ae(this,Vr,!0,"f"),clearTimeout(_(this,zt,"f")),_(this,Wt,"f")&&_(this,Wt,"f").call(this),_(this,ki,"f").clear(),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,yt,"f")&&(this.isSurrealDB?_(this,vt,"f").perspectiveDisposeSurrealQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):_(this,vt,"f").disposeQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Pt=new WeakMap,yt=new WeakMap,vt=new WeakMap,ki=new WeakMap,zt=new WeakMap,Wt=new WeakMap,bi=new WeakMap,Vr=new WeakMap,fa=new WeakMap,wi=new WeakMap,Si=new WeakMap,at=new WeakMap,dr=new WeakMap,pa=new WeakSet,Ws=function i(e){for(let t of _(this,ki,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var fr=class{constructor(e,t){ee.set(this,void 0),ie.set(this,void 0),_i.set(this,void 0),Ei.set(this,void 0),xi.set(this,void 0),zr.set(this,void 0),ae(this,_i,[],"f"),ae(this,Ei,[],"f"),ae(this,xi,[],"f"),ae(this,zr,[],"f"),ae(this,ee,e,"f"),ae(this,ie,t,"f"),this.uuid=_(this,ee,"f").uuid,this.name=_(this,ee,"f").name,this.owners=_(this,ee,"f").owners,this.sharedUrl=_(this,ee,"f").sharedUrl,this.neighbourhood=_(this,ee,"f").neighbourhood,this.state=_(this,ee,"f").state,_(this,ie,"f").addPerspectiveLinkAddedListener(_(this,ee,"f").uuid,_(this,_i,"f")),_(this,ie,"f").addPerspectiveLinkRemovedListener(_(this,ee,"f").uuid,_(this,Ei,"f")),_(this,ie,"f").addPerspectiveLinkUpdatedListener(_(this,ee,"f").uuid,_(this,xi,"f")),_(this,ie,"f").addPerspectiveSyncStateChangeListener(_(this,ee,"f").uuid,_(this,zr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await _(this,ie,"f").executeCommands(_(this,ee,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await _(this,ie,"f").queryLinks(_(this,ee,"f").uuid,e)}async infer(e){return await _(this,ie,"f").queryProlog(_(this,ee,"f").uuid,e)}async querySurrealDB(e){return await _(this,ie,"f").querySurrealDB(_(this,ee,"f").uuid,e)}async add(e,t="shared",r){return await _(this,ie,"f").addLink(_(this,ee,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await _(this,ie,"f").addLinks(_(this,ee,"f").uuid,e,t,r)}async removeLinks(e,t){return await _(this,ie,"f").removeLinks(_(this,ee,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await _(this,ie,"f").linkMutations(_(this,ee,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await _(this,ie,"f").addLinkExpression(_(this,ee,"f").uuid,e,t,r)}async update(e,t,r){return await _(this,ie,"f").updateLink(_(this,ee,"f").uuid,e,t,r)}async remove(e,t){return await _(this,ie,"f").removeLink(_(this,ee,"f").uuid,e,t)}async createBatch(){return await _(this,ie,"f").createBatch(_(this,ee,"f").uuid)}async commitBatch(e){return await _(this,ie,"f").commitBatch(_(this,ee,"f").uuid,e)}async getExpression(e){return await _(this,ie,"f").getExpression(e)}async createExpression(e,t){return await _(this,ie,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?_(this,_i,"f").push(t):e==="link-removed"?_(this,Ei,"f").push(t):e==="link-updated"&&_(this,xi,"f").push(t)}async addSyncStateChangeListener(e){_(this,zr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=_(this,_i,"f").indexOf(t);_(this,_i,"f").splice(r,1)}else if(e==="link-removed"){let r=_(this,Ei,"f").indexOf(t);_(this,Ei,"f").splice(r,1)}else if(e==="link-updated"){let r=_(this,xi,"f").indexOf(t);_(this,xi,"f").splice(r,1)}}async snapshot(){return _(this,ie,"f").snapshotByUUID(_(this,ee,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new re({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new re({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return oe.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new re({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new re({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new re({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new re({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new re({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new re({source:s,predicate:"ad4m://sdna"}));for(let l of o){let c=oe.fromUrl(l.data.target).get();typeof c=="string"&&t.push(c)}}}return t}async getSdnaForClass(e){let t=oe.from(e);if((await this.get(new re({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new re({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=oe.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return _(this,ie,"f").addSdna(_(this,ee,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=oe.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ke({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=oe.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new re({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;Y(n);let a=await this.get(new re({source:n,predicate:"sh://property"})),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(m=>m.data.target)].map(m=>`'${Y(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return Jt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new re({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=oe.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=oe.from(e).toUrl(),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ke({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=oe.from(e).toUrl(),r=await this.get(new re({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=Y(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=Y(s),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return vr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new re({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await _(this,ie,"f").createSubject(_(this,ee,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await _(this,ie,"f").createSubject(_(this,ee,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await _(this,ie,"f").getSubjectData(_(this,ee,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await _(this,ie,"f").getSubjectData(_(this,ee,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new re({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let l=s.data.target.slice(o.length),c=l;try{c=decodeURIComponent(l)}catch{}try{return JSON.parse(c)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${Y(e)}'`,l=(await this.querySurrealDB(s))[0]?.count??0;return(typeof l=="object"&&l?.Int!==void 0?l.Int:l)>0}for(let a of n.requiredTriples){let s=Y(e),o=Y(a.predicate),l;if(a.target){let y=Y(a.target);l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${y}'`}else l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let c=await this.querySurrealDB(l);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new un(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let l of t.properties){if(!l.path||!l.name)continue;l.writable&&o.add(l.path),l.adder&&l.adder.length>0?s.set(l.name,{predicate:l.path}):a.set(l.name,{predicate:l.path,resolveLanguage:l.resolveLanguage})}if(t.constructor_actions){for(let l of t.constructor_actions)if(l.predicate){r.push(l.predicate);let c=o.has(l.predicate);l.target&&l.target!=="value"&&!c?n.push({predicate:l.predicate,target:l.target}):n.push({predicate:l.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,relations:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=Y(r.predicate);if(r.target){let a=Y(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(l);if(!c||c.length===0)return;let u=c[0].value;if(a.resolveLanguage&&u)try{let m=await this.getExpression(u);try{return JSON.parse(m.data)}catch{return m.data}}catch{return u}return u}async getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(l);if(!c||c.length===0)return[];let u=c.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let y of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let p=await this.querySurrealDB(`RETURN ${d}`);(p===!0||Array.isArray(p)&&p.length>0&&p[0]===!0)&&m.push(y)}u=m}catch(m){console.warn(`Failed to apply condition filter for ${r}:`,m)}if(a.instanceFilter)try{let m=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return m?await this.batchCheckSubjectInstances(u,m):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(l=>`'${Y(l)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(l=>l.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${Y(u)}'`).join(", "),o=Y(a.predicate),l;if(a.target){let u=Y(a.target);l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let c=await this.querySurrealDB(l);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),l=await this.querySurrealDB(o);for(let c of l||[])try{let u;r?(u=new e(this,c.base),await u.get()):(u=new un(this,c.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let l of o||[])try{let c=new un(this,l.base,n);await c.init(),r.push(c)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Mi(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(m=>!Array.isArray(e[m]));let o=a?Object.fromEntries(Object.entries(wt(a)).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(m=>m!=="isSubjectInstance"):r=Object.keys(e).filter(m=>Array.isArray(e[m])&&m!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let l=`SELECT
|
|
486
486
|
in.uri AS shape_source,
|
|
487
487
|
predicate,
|
|
488
488
|
out.uri AS target
|
|
489
489
|
FROM link
|
|
490
|
-
WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,
|
|
490
|
+
WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,c=await this.querySurrealDB(l);if(!c||c.length===0)return null;let u=new Map;for(let m of c)if(m.predicate==="rdf://type"&&m.target==="ad4m://SubjectClass"){let y=m.shape_source,d=y.indexOf("://");if(d<0)continue;let p=y.substring(d+3).split("/").pop();if(!p)continue;u.set(p,{shapeUri:y,properties:[],relations:[]})}for(let m of c)if(m.predicate==="sh://property"||m.predicate==="sh://collection"){for(let[y,d]of u)if(m.shape_source.endsWith(`${y}Shape`)){let p=m.target.lastIndexOf(".");if(p<0)continue;let f=m.target.substring(p+1);m.predicate==="sh://property"?d.properties.push(f):d.relations.push(f)}}for(let[m,y]of u){let d=t.every(f=>y.properties.includes(f)),p=r.every(f=>y.relations.includes(f));if(d&&p)return m}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:r}=e.generateSHACL(),n=JSON.stringify(r.toJSON());await this.addSdna(t,"","subject_class",n)}getNeighbourhoodProxy(){return _(this,ie,"f").getNeighbourhoodProxy(_(this,ee,"f").uuid)}get ai(){return _(this,ie,"f").aiClient}async subscribeInfer(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ee=new WeakMap,ie=new WeakMap,_i=new WeakMap,Ei=new WeakMap,xi=new WeakMap,zr=new WeakMap;var qt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},M=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},G,Wr,Kr,Qr,ha,Gr,ga,ma,De=`
|
|
491
491
|
author
|
|
492
492
|
timestamp
|
|
493
493
|
status
|
|
494
494
|
data { source, predicate, target }
|
|
495
495
|
proof { valid, invalid, signature, key }
|
|
496
|
-
`,
|
|
496
|
+
`,ar=`
|
|
497
497
|
uuid
|
|
498
498
|
name
|
|
499
499
|
sharedUrl
|
|
@@ -514,73 +514,73 @@ neighbourhood {
|
|
|
514
514
|
}
|
|
515
515
|
author
|
|
516
516
|
}
|
|
517
|
-
`,
|
|
517
|
+
`,Ra=class{constructor(e,t=!0){G.set(this,void 0),Wr.set(this,void 0),Kr.set(this,void 0),Qr.set(this,void 0),ha.set(this,void 0),Gr.set(this,void 0),ga.set(this,void 0),ma.set(this,void 0),qt(this,G,e,"f"),qt(this,Wr,[],"f"),qt(this,Kr,[],"f"),qt(this,Qr,[],"f"),qt(this,ha,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){qt(this,Gr,e,"f")}setNeighbourhoodClient(e){qt(this,ga,e,"f")}setAIClient(e){qt(this,ma,e,"f")}get aiClient(){return M(this,ma,"f")}async all(){let{perspectives:e}=w(await M(this,G,"f").query({query:v`query perspectives {
|
|
518
518
|
perspectives {
|
|
519
|
-
${
|
|
519
|
+
${ar}
|
|
520
520
|
}
|
|
521
|
-
}`}));return e.map(t=>new fr(t,this))}async byUUID(e){let{perspective:t}=
|
|
521
|
+
}`}));return e.map(t=>new fr(t,this))}async byUUID(e){let{perspective:t}=w(await M(this,G,"f").query({query:v`query perspective($uuid: String!) {
|
|
522
522
|
perspective(uuid: $uuid) {
|
|
523
|
-
${
|
|
523
|
+
${ar}
|
|
524
524
|
}
|
|
525
|
-
}`,variables:{uuid:e}}));return t?new fr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=
|
|
525
|
+
}`,variables:{uuid:e}}));return t?new fr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=w(await M(this,G,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
|
|
526
526
|
perspectiveSnapshot(uuid: $uuid) {
|
|
527
527
|
links { ${De} }
|
|
528
528
|
}
|
|
529
|
-
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=
|
|
529
|
+
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
530
530
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
531
|
-
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=
|
|
531
|
+
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
532
532
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
533
533
|
${De}
|
|
534
534
|
}
|
|
535
|
-
}`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=
|
|
535
|
+
}`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
536
536
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
537
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=
|
|
537
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=w(await M(this,G,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
538
538
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
539
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=
|
|
539
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
540
540
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
541
541
|
subscriptionId
|
|
542
542
|
result
|
|
543
543
|
}
|
|
544
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(
|
|
544
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
545
545
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
546
546
|
subscriptionId
|
|
547
547
|
result
|
|
548
548
|
}
|
|
549
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(
|
|
549
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
550
550
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
551
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=
|
|
551
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
552
552
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
553
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=M(this,
|
|
553
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=M(this,G,"f").subscribe({query:v`
|
|
554
554
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
555
555
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
556
556
|
}
|
|
557
|
-
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=
|
|
557
|
+
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
558
558
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
559
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=
|
|
559
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
560
560
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
561
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=
|
|
561
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
|
|
562
562
|
perspectiveAdd(name: $name) {
|
|
563
|
-
${
|
|
563
|
+
${ar}
|
|
564
564
|
}
|
|
565
|
-
}`,variables:{name:e}}));return new fr(t,this)}async update(e,t){let{perspectiveUpdate:r}=
|
|
565
|
+
}`,variables:{name:e}}));return new fr(t,this)}async update(e,t){let{perspectiveUpdate:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
566
566
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
567
|
-
${
|
|
567
|
+
${ar}
|
|
568
568
|
}
|
|
569
|
-
}`,variables:{uuid:e,name:t}}));return new fr(r,this)}async remove(e){return
|
|
569
|
+
}`,variables:{uuid:e,name:t}}));return new fr(r,this)}async remove(e){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
|
|
570
570
|
perspectiveRemove(uuid: $uuid)
|
|
571
|
-
}`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=
|
|
571
|
+
}`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
572
572
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
573
573
|
${De}
|
|
574
574
|
}
|
|
575
|
-
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=
|
|
575
|
+
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
576
576
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
577
577
|
${De}
|
|
578
578
|
}
|
|
579
|
-
}`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=
|
|
579
|
+
}`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
580
580
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
581
581
|
${De}
|
|
582
582
|
}
|
|
583
|
-
}`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=
|
|
583
|
+
}`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
584
584
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
585
585
|
additions {
|
|
586
586
|
${De}
|
|
@@ -589,43 +589,43 @@ neighbourhood {
|
|
|
589
589
|
${De}
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
}`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=
|
|
592
|
+
}`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
593
593
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
594
594
|
${De}
|
|
595
595
|
}
|
|
596
|
-
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=
|
|
596
|
+
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
597
597
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
598
598
|
${De}
|
|
599
599
|
}
|
|
600
|
-
}`,variables:{uuid:e,oldLink:t,newLink:r,batchId:n}}));return a}async removeLink(e,t,r){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=
|
|
600
|
+
}`,variables:{uuid:e,oldLink:t,newLink:r,batchId:n}}));return a}async removeLink(e,t,r){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
601
601
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
602
|
-
}`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return
|
|
602
|
+
}`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
603
603
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
604
|
-
}`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return
|
|
604
|
+
}`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
605
605
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
606
|
-
}`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return
|
|
606
|
+
}`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
607
607
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
608
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return
|
|
608
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
609
609
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
610
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,
|
|
611
|
-
perspectiveAdded { ${
|
|
610
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,Gr,"f").get(e)}async createExpression(e,t){return await M(this,Gr,"f").create(e,t)}addPerspectiveAddedListener(e){M(this,Wr,"f").push(e)}subscribePerspectiveAdded(){M(this,G,"f").subscribe({query:v` subscription {
|
|
611
|
+
perspectiveAdded { ${ar} }
|
|
612
612
|
}
|
|
613
|
-
`}).subscribe({next:e=>{M(this,
|
|
614
|
-
perspectiveUpdated { ${
|
|
613
|
+
`}).subscribe({next:e=>{M(this,Wr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){M(this,Kr,"f").push(e)}subscribePerspectiveUpdated(){M(this,G,"f").subscribe({query:v` subscription {
|
|
614
|
+
perspectiveUpdated { ${ar} }
|
|
615
615
|
}
|
|
616
|
-
`}).subscribe({next:e=>{M(this,
|
|
616
|
+
`}).subscribe({next:e=>{M(this,Kr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){M(this,ha,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
|
|
617
617
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
618
618
|
}
|
|
619
|
-
`}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){M(this,
|
|
619
|
+
`}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){M(this,Qr,"f").push(e)}subscribePerspectiveRemoved(){M(this,G,"f").subscribe({query:v` subscription {
|
|
620
620
|
perspectiveRemoved
|
|
621
621
|
}
|
|
622
|
-
`}).subscribe({next:e=>{M(this,
|
|
622
|
+
`}).subscribe({next:e=>{M(this,Qr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
|
|
623
623
|
perspectiveLinkAdded(uuid: "${e}") { ${De} }
|
|
624
624
|
}
|
|
625
|
-
`}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveLinkAdded)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkRemovedListener(e,t){M(this,
|
|
625
|
+
`}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveLinkAdded)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkRemovedListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
|
|
626
626
|
perspectiveLinkRemoved(uuid: "${e}") { ${De} }
|
|
627
627
|
}
|
|
628
|
-
`}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkRemoved.status||delete r.data.perspectiveLinkRemoved.status,n(r.data.perspectiveLinkRemoved)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkUpdatedListener(e,t){M(this,
|
|
628
|
+
`}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkRemoved.status||delete r.data.perspectiveLinkRemoved.status,n(r.data.perspectiveLinkRemoved)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkUpdatedListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
|
|
629
629
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
630
630
|
oldLink {
|
|
631
631
|
${De}
|
|
@@ -635,9 +635,9 @@ neighbourhood {
|
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
`}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new
|
|
638
|
+
`}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new zs(M(this,ga,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
|
|
639
639
|
perspectiveCreateBatch(uuid: $uuid)
|
|
640
|
-
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=
|
|
640
|
+
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
641
641
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
642
642
|
additions {
|
|
643
643
|
${De}
|
|
@@ -646,7 +646,7 @@ neighbourhood {
|
|
|
646
646
|
${De}
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
}`,variables:{uuid:e,batchId:t}}));return r}};
|
|
649
|
+
}`,variables:{uuid:e,batchId:t}}));return r}};G=new WeakMap,Wr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,ha=new WeakMap,Gr=new WeakMap,ga=new WeakMap,ma=new WeakMap;var Qn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Z=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},J,Zr,Jr,Yr,jr=`
|
|
650
650
|
did
|
|
651
651
|
directMessageLanguage
|
|
652
652
|
perspective {
|
|
@@ -660,7 +660,7 @@ neighbourhood {
|
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
`,
|
|
663
|
+
`,Gn=`
|
|
664
664
|
requestId
|
|
665
665
|
revoked
|
|
666
666
|
auth {
|
|
@@ -676,145 +676,158 @@ neighbourhood {
|
|
|
676
676
|
can
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
`,
|
|
679
|
+
`,sr=`
|
|
680
680
|
isInitialized
|
|
681
681
|
isUnlocked
|
|
682
682
|
did
|
|
683
683
|
didDocument
|
|
684
684
|
error
|
|
685
|
-
`,
|
|
685
|
+
`,Zn=`
|
|
686
686
|
did
|
|
687
687
|
didSigningKeyId
|
|
688
688
|
deviceKeyType
|
|
689
689
|
deviceKey
|
|
690
690
|
deviceKeySignedByDid
|
|
691
691
|
didSignedByDeviceKey
|
|
692
|
-
`,
|
|
692
|
+
`,zd=`
|
|
693
693
|
signature
|
|
694
694
|
publicKey
|
|
695
|
-
`,
|
|
695
|
+
`,vn=class{constructor(e,t=!0){J.set(this,void 0),Zr.set(this,void 0),Jr.set(this,void 0),Yr.set(this,void 0),Qn(this,J,e,"f"),Qn(this,Jr,[],"f"),Qn(this,Yr,[],"f"),Qn(this,Zr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=w(await Z(this,J,"f").query({query:v`query agent { agent { ${jr} } }`})),t=new Zt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=w(await Z(this,J,"f").query({query:v`query agentStatus {
|
|
696
696
|
agentStatus {
|
|
697
|
-
${
|
|
697
|
+
${sr}
|
|
698
698
|
}
|
|
699
|
-
}`}));return new
|
|
699
|
+
}`}));return new ot(e)}async generate(e){let{agentGenerate:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentGenerate(
|
|
700
700
|
$passphrase: String!
|
|
701
701
|
) {
|
|
702
702
|
agentGenerate(passphrase: $passphrase) {
|
|
703
|
-
${
|
|
703
|
+
${sr}
|
|
704
704
|
}
|
|
705
|
-
}`,variables:{passphrase:e}}));return new
|
|
705
|
+
}`,variables:{passphrase:e}}));return new ot(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentImport(
|
|
706
706
|
$did: String!,
|
|
707
707
|
$didDocument: String!,
|
|
708
708
|
$keystore: String!,
|
|
709
709
|
$passphrase: String!
|
|
710
710
|
) {
|
|
711
711
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
712
|
-
${
|
|
712
|
+
${sr}
|
|
713
713
|
}
|
|
714
|
-
}`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new
|
|
714
|
+
}`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new ot(s)}async lock(e){let{agentLock:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
|
|
715
715
|
agentLock(passphrase: $passphrase) {
|
|
716
|
-
${
|
|
716
|
+
${sr}
|
|
717
717
|
}
|
|
718
|
-
}`,variables:{passphrase:e}}));return new
|
|
718
|
+
}`,variables:{passphrase:e}}));return new ot(t)}async unlock(e,t=!0){let{agentUnlock:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
719
719
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
720
|
-
${
|
|
720
|
+
${sr}
|
|
721
721
|
}
|
|
722
|
-
}`,variables:{passphrase:e,holochain:t}}));return new
|
|
722
|
+
}`,variables:{passphrase:e,holochain:t}}));return new ot(r)}async byDID(e){let{agentByDID:t}=w(await Z(this,J,"f").query({query:v`query agentByDID($did: String!) {
|
|
723
723
|
agentByDID(did: $did) {
|
|
724
|
-
${
|
|
724
|
+
${jr}
|
|
725
725
|
}
|
|
726
|
-
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(s=>{delete s.__typename,delete s.data.__typename,delete s.proof.__typename,delete s.status});let{agentUpdatePublicPerspective:r}=
|
|
726
|
+
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(s=>{delete s.__typename,delete s.data.__typename,delete s.proof.__typename,delete s.status});let{agentUpdatePublicPerspective:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
727
727
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
728
|
-
${
|
|
728
|
+
${jr}
|
|
729
729
|
}
|
|
730
|
-
}`,variables:{perspective:t}})),n=r,a=new Zt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new
|
|
730
|
+
}`,variables:{perspective:t}})),n=r,a=new Zt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ra(Z(this,J,"f")),r=new vn(Z(this,J,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let l of e.additions)await n.add(l);for(let l of e.removals)await n.remove(l);let s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
731
731
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
732
|
-
${
|
|
732
|
+
${jr}
|
|
733
733
|
}
|
|
734
|
-
}`,variables:{directMessageLanguage:e}})),r=t,n=new Zt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=
|
|
734
|
+
}`,variables:{directMessageLanguage:e}})),r=t,n=new Zt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
735
735
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
736
|
-
${
|
|
736
|
+
${Zn}
|
|
737
737
|
}
|
|
738
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=
|
|
738
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
739
739
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
740
|
-
${
|
|
740
|
+
${Zn}
|
|
741
741
|
}
|
|
742
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=
|
|
742
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=w(await Z(this,J,"f").query({query:v`query agentGetEntanglementProofs {
|
|
743
743
|
agentGetEntanglementProofs {
|
|
744
|
-
${
|
|
744
|
+
${Zn}
|
|
745
745
|
}
|
|
746
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=
|
|
746
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
747
747
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
748
|
-
${
|
|
748
|
+
${Zn}
|
|
749
749
|
}
|
|
750
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){
|
|
751
|
-
agentUpdated { ${
|
|
750
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){Z(this,Jr,"f").push(e)}addAppChangedListener(e){Z(this,Zr,"f").push(e)}subscribeAgentUpdated(){Z(this,J,"f").subscribe({query:v` subscription {
|
|
751
|
+
agentUpdated { ${jr} }
|
|
752
752
|
}
|
|
753
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;
|
|
753
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;Z(this,Jr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Z(this,J,"f").subscribe({query:v` subscription {
|
|
754
754
|
agentAppsChanged {
|
|
755
|
-
${
|
|
755
|
+
${Gn}
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
`}).subscribe({next:e=>{
|
|
759
|
-
agentStatusChanged { ${
|
|
758
|
+
`}).subscribe({next:e=>{Z(this,Zr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Z(this,Yr,"f").push(e)}subscribeAgentStatusChanged(){Z(this,J,"f").subscribe({query:v` subscription {
|
|
759
|
+
agentStatusChanged { ${sr} }
|
|
760
760
|
}
|
|
761
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;
|
|
761
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Z(this,Yr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
|
|
762
762
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
763
763
|
agentRequestCapability(authInfo: $authInfo)
|
|
764
764
|
}
|
|
765
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=
|
|
765
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
|
|
766
766
|
mutation agentPermitCapability($auth: String!) {
|
|
767
767
|
agentPermitCapability(auth: $auth)
|
|
768
768
|
}
|
|
769
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=
|
|
769
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=w(await Z(this,J,"f").mutate({mutation:v`
|
|
770
770
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
771
771
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
772
772
|
}
|
|
773
|
-
`,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=
|
|
773
|
+
`,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=w(await Z(this,J,"f").mutate({mutation:v`query agentGetApps {
|
|
774
774
|
agentGetApps {
|
|
775
|
-
${
|
|
775
|
+
${Gn}
|
|
776
776
|
}
|
|
777
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=
|
|
777
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
|
|
778
778
|
agentRemoveApp(requestId: $requestId) {
|
|
779
|
-
${
|
|
779
|
+
${Gn}
|
|
780
780
|
}
|
|
781
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=
|
|
781
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
|
|
782
782
|
agentRevokeToken(requestId: $requestId) {
|
|
783
|
-
${
|
|
783
|
+
${Gn}
|
|
784
784
|
}
|
|
785
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=
|
|
785
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=w(await Z(this,J,"f").mutate({mutation:v`
|
|
786
786
|
query agentIsLocked {
|
|
787
787
|
agentIsLocked
|
|
788
788
|
}
|
|
789
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=
|
|
789
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
|
|
790
790
|
agentSignMessage(message: $message) {
|
|
791
|
-
${
|
|
791
|
+
${zd}
|
|
792
792
|
}
|
|
793
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=
|
|
793
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
794
794
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
795
795
|
did
|
|
796
796
|
success
|
|
797
797
|
error
|
|
798
798
|
}
|
|
799
|
-
}`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=
|
|
799
|
+
}`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
800
800
|
runtimeLoginUser(email: $email, password: $password)
|
|
801
|
-
}`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=
|
|
801
|
+
}`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
802
802
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
803
803
|
success
|
|
804
804
|
message
|
|
805
805
|
requiresPassword
|
|
806
806
|
isExistingUser
|
|
807
807
|
}
|
|
808
|
-
}`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=
|
|
808
|
+
}`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
809
809
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
810
|
-
}`,variables:{email:e,code:t,verificationType:r}}));return n}
|
|
810
|
+
}`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=w(await Z(this,J,"f").query({query:v`query runtimeHostingUserInfo {
|
|
811
|
+
runtimeHostingUserInfo {
|
|
812
|
+
email
|
|
813
|
+
remainingCredits
|
|
814
|
+
hotWalletAddress
|
|
815
|
+
}
|
|
816
|
+
}`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
|
|
817
|
+
runtimeSetHotWalletAddress(address: $address)
|
|
818
|
+
}`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestPayment($amountHOT: String!) {
|
|
819
|
+
runtimeRequestPayment(amountHOT: $amountHOT) {
|
|
820
|
+
success
|
|
821
|
+
message
|
|
822
|
+
}
|
|
823
|
+
}`,variables:{amountHOT:e}}));return t}};J=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap;var Wd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ht=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},pt,cc=`
|
|
811
824
|
name
|
|
812
825
|
address
|
|
813
826
|
settings
|
|
814
827
|
icon { code }
|
|
815
828
|
constructorIcon { code }
|
|
816
829
|
settingsIcon { code }
|
|
817
|
-
`,
|
|
830
|
+
`,lc=`
|
|
818
831
|
name
|
|
819
832
|
address
|
|
820
833
|
description
|
|
@@ -824,45 +837,45 @@ neighbourhood {
|
|
|
824
837
|
templateAppliedParams
|
|
825
838
|
possibleTemplateParams
|
|
826
839
|
sourceCodeLink
|
|
827
|
-
`,
|
|
840
|
+
`,Ks=class{constructor(e){pt.set(this,void 0),Wd(this,pt,e,"f")}async byAddress(e){let{language:t}=w(await Ht(this,pt,"f").query({query:v`query byAddress($address: String!) {
|
|
828
841
|
language(address: $address) {
|
|
829
|
-
${
|
|
842
|
+
${cc}
|
|
830
843
|
}
|
|
831
|
-
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=
|
|
844
|
+
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=w(await Ht(this,pt,"f").query({query:v`query byFilter($filter: String!) {
|
|
832
845
|
languages(filter: $filter) {
|
|
833
|
-
${
|
|
846
|
+
${cc}
|
|
834
847
|
}
|
|
835
|
-
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=
|
|
848
|
+
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
836
849
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
837
|
-
}`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=
|
|
850
|
+
}`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
|
|
838
851
|
$sourceLanguageHash: String!,
|
|
839
852
|
$templateData: String!,
|
|
840
853
|
) {
|
|
841
854
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
842
855
|
name, address
|
|
843
856
|
}
|
|
844
|
-
}`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=
|
|
857
|
+
}`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languagePublish(
|
|
845
858
|
$languagePath: String!,
|
|
846
859
|
$languageMeta: LanguageMetaInput!,
|
|
847
860
|
) {
|
|
848
861
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
849
|
-
${
|
|
862
|
+
${lc}
|
|
850
863
|
}
|
|
851
|
-
}`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=
|
|
864
|
+
}`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=w(await Ht(this,pt,"f").query({query:v`query languageMeta(
|
|
852
865
|
$address: String!,
|
|
853
866
|
) {
|
|
854
867
|
languageMeta(address: $address) {
|
|
855
|
-
${
|
|
868
|
+
${lc}
|
|
856
869
|
}
|
|
857
|
-
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=
|
|
870
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=w(await Ht(this,pt,"f").query({query:v`query languageSource(
|
|
858
871
|
$address: String!,
|
|
859
872
|
) {
|
|
860
873
|
languageSource(address: $address)
|
|
861
|
-
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=
|
|
874
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageRemove(
|
|
862
875
|
$address: String!,
|
|
863
876
|
) {
|
|
864
877
|
languageRemove(address: $address)
|
|
865
|
-
}`,variables:{address:e}}));return t}};
|
|
878
|
+
}`,variables:{address:e}}));return t}};pt=new WeakMap;var Kd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ne=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Fe,pr,Qs=class{constructor(e){Fe.set(this,void 0),pr.set(this,new Map),Kd(this,Fe,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
|
|
866
879
|
$linkLanguage: String!,
|
|
867
880
|
$meta: PerspectiveInput!,
|
|
868
881
|
$perspectiveUUID: String!
|
|
@@ -872,7 +885,7 @@ neighbourhood {
|
|
|
872
885
|
meta: $meta,
|
|
873
886
|
perspectiveUUID: $perspectiveUUID
|
|
874
887
|
)
|
|
875
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=
|
|
888
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
876
889
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
877
890
|
uuid
|
|
878
891
|
name
|
|
@@ -894,11 +907,11 @@ neighbourhood {
|
|
|
894
907
|
author
|
|
895
908
|
}
|
|
896
909
|
}
|
|
897
|
-
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=
|
|
910
|
+
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
|
|
898
911
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
899
|
-
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=
|
|
912
|
+
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
|
|
900
913
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
901
|
-
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=
|
|
914
|
+
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
|
|
902
915
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
903
916
|
did
|
|
904
917
|
status {
|
|
@@ -915,7 +928,7 @@ neighbourhood {
|
|
|
915
928
|
proof { valid, invalid, signature, key }
|
|
916
929
|
}
|
|
917
930
|
}
|
|
918
|
-
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=
|
|
931
|
+
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
|
|
919
932
|
$perspectiveUUID: String!,
|
|
920
933
|
$status: PerspectiveInput!
|
|
921
934
|
) {
|
|
@@ -923,7 +936,7 @@ neighbourhood {
|
|
|
923
936
|
perspectiveUUID: $perspectiveUUID,
|
|
924
937
|
status: $status
|
|
925
938
|
)
|
|
926
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=
|
|
939
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
|
|
927
940
|
$perspectiveUUID: String!,
|
|
928
941
|
$status: PerspectiveUnsignedInput!
|
|
929
942
|
) {
|
|
@@ -931,7 +944,7 @@ neighbourhood {
|
|
|
931
944
|
perspectiveUUID: $perspectiveUUID,
|
|
932
945
|
status: $status
|
|
933
946
|
)
|
|
934
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=
|
|
947
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
|
|
935
948
|
$perspectiveUUID: String!,
|
|
936
949
|
$remoteAgentDid: String!,
|
|
937
950
|
$payload: PerspectiveInput!
|
|
@@ -941,7 +954,7 @@ neighbourhood {
|
|
|
941
954
|
remoteAgentDid: $remoteAgentDid,
|
|
942
955
|
payload: $payload
|
|
943
956
|
)
|
|
944
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=
|
|
957
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
|
|
945
958
|
$perspectiveUUID: String!,
|
|
946
959
|
$remoteAgentDid: String!,
|
|
947
960
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -951,7 +964,7 @@ neighbourhood {
|
|
|
951
964
|
remoteAgentDid: $remoteAgentDid,
|
|
952
965
|
payload: $payload
|
|
953
966
|
)
|
|
954
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=
|
|
967
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
|
|
955
968
|
$perspectiveUUID: String!,
|
|
956
969
|
$payload: PerspectiveInput!,
|
|
957
970
|
$loopback: Boolean
|
|
@@ -961,7 +974,7 @@ neighbourhood {
|
|
|
961
974
|
payload: $payload,
|
|
962
975
|
loopback: $loopback
|
|
963
976
|
)
|
|
964
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=
|
|
977
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
|
|
965
978
|
$perspectiveUUID: String!,
|
|
966
979
|
$payload: PerspectiveUnsignedInput!,
|
|
967
980
|
$loopback: Boolean
|
|
@@ -971,7 +984,7 @@ neighbourhood {
|
|
|
971
984
|
payload: $payload,
|
|
972
985
|
loopback: $loopback
|
|
973
986
|
)
|
|
974
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Ne(this,
|
|
987
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Ne(this,pr,"f").get(e);if(r)for(let n of r)try{n(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;Ne(this,Fe,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
975
988
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
976
989
|
author
|
|
977
990
|
timestamp
|
|
@@ -986,7 +999,7 @@ neighbourhood {
|
|
|
986
999
|
}
|
|
987
1000
|
proof { valid, invalid, signature, key }
|
|
988
1001
|
}
|
|
989
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=
|
|
1002
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=w(r);t.dispatchSignal(e,n)}catch(n){console.error("Error in signal subscription:",n)}},error:r=>{console.error("Signal subscription error for perspective",e,r)}})}async addSignalHandler(e,t){let r=Ne(this,pr,"f").get(e);r?r.push(t):(r=[],Ne(this,pr,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Ne(this,pr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Fe=new WeakMap,pr=new WeakMap;var Jn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},U=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},z,Xr,en,tn,Ol,Yn=`
|
|
990
1003
|
author
|
|
991
1004
|
timestamp
|
|
992
1005
|
data {
|
|
@@ -998,7 +1011,7 @@ data {
|
|
|
998
1011
|
}
|
|
999
1012
|
}
|
|
1000
1013
|
proof { valid, invalid, signature, key }
|
|
1001
|
-
`,
|
|
1014
|
+
`,Qd=`
|
|
1002
1015
|
description
|
|
1003
1016
|
appName
|
|
1004
1017
|
appUrl
|
|
@@ -1007,72 +1020,72 @@ trigger
|
|
|
1007
1020
|
perspectiveIds
|
|
1008
1021
|
webhookUrl
|
|
1009
1022
|
webhookAuth
|
|
1010
|
-
`,
|
|
1023
|
+
`,Dl=`
|
|
1011
1024
|
id
|
|
1012
1025
|
granted
|
|
1013
|
-
${
|
|
1014
|
-
`,
|
|
1015
|
-
notification { ${
|
|
1026
|
+
${Qd}
|
|
1027
|
+
`,Gd=`
|
|
1028
|
+
notification { ${Dl} }
|
|
1016
1029
|
perspectiveId
|
|
1017
1030
|
triggerMatch
|
|
1018
|
-
`,
|
|
1031
|
+
`,Gs=class{constructor(e,t=!0){z.set(this,void 0),Xr.set(this,void 0),en.set(this,void 0),tn.set(this,void 0),Ol.set(this,void 0),Jn(this,z,e,"f"),Jn(this,Xr,[],"f"),Jn(this,en,[],"f"),Jn(this,tn,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=w(await U(this,z,"f").query({query:v`query runtimeInfo {
|
|
1019
1032
|
runtimeInfo {
|
|
1020
1033
|
ad4mExecutorVersion,
|
|
1021
1034
|
isInitialized,
|
|
1022
1035
|
isUnlocked
|
|
1023
1036
|
}
|
|
1024
|
-
}`}));return e}async quit(){return
|
|
1037
|
+
}`}));return e}async quit(){return w(await U(this,z,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
|
|
1025
1038
|
runtimeOpenLink(url: $url)
|
|
1026
|
-
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=
|
|
1039
|
+
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
|
|
1027
1040
|
addTrustedAgents(agents: $agents)
|
|
1028
|
-
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=
|
|
1041
|
+
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
1029
1042
|
deleteTrustedAgents(agents: $agents)
|
|
1030
|
-
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=
|
|
1043
|
+
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=w(await U(this,z,"f").query({query:v`query getTrustedAgents {
|
|
1031
1044
|
getTrustedAgents
|
|
1032
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=
|
|
1045
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
1033
1046
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
1034
|
-
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=
|
|
1047
|
+
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
1035
1048
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
1036
|
-
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=
|
|
1049
|
+
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=w(await U(this,z,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
|
|
1037
1050
|
runtimeKnownLinkLanguageTemplates
|
|
1038
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=
|
|
1051
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
|
|
1039
1052
|
runtimeAddFriends(dids: $dids)
|
|
1040
|
-
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=
|
|
1053
|
+
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
1041
1054
|
runtimeRemoveFriends(dids: $dids)
|
|
1042
|
-
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=
|
|
1055
|
+
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=w(await U(this,z,"f").query({query:v`query runtimeFriends {
|
|
1043
1056
|
runtimeFriends
|
|
1044
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=
|
|
1057
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=w(await U(this,z,"f").query({query:v`query runtimeHcAgentInfos {
|
|
1045
1058
|
runtimeHcAgentInfos
|
|
1046
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=
|
|
1059
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=w(await U(this,z,"f").query({query:v`query runtimeGetNetworkMetrics {
|
|
1047
1060
|
runtimeGetNetworkMetrics
|
|
1048
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=
|
|
1061
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
|
|
1049
1062
|
runtimeRestartHolochain
|
|
1050
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=
|
|
1063
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
1051
1064
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
1052
|
-
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=
|
|
1065
|
+
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=w(await U(this,z,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
1053
1066
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
1054
|
-
}`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=
|
|
1067
|
+
}`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
1055
1068
|
runtimeSetStatus(status: $status)
|
|
1056
|
-
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=
|
|
1057
|
-
runtimeFriendStatus(did: $did) { ${
|
|
1058
|
-
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=
|
|
1069
|
+
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=w(await U(this,z,"f").query({query:v`query runtimeFriendStatus($did: String!) {
|
|
1070
|
+
runtimeFriendStatus(did: $did) { ${Yn} }
|
|
1071
|
+
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
1059
1072
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
1060
|
-
}`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=
|
|
1061
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
1062
|
-
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=
|
|
1073
|
+
}`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageInbox($filter: String) {
|
|
1074
|
+
runtimeMessageInbox(filter: $filter) { ${Yn} }
|
|
1075
|
+
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
|
|
1063
1076
|
runtimeMessageOutbox(filter: $filter) {
|
|
1064
1077
|
recipient,
|
|
1065
1078
|
message {
|
|
1066
|
-
${
|
|
1079
|
+
${Yn}
|
|
1067
1080
|
}
|
|
1068
1081
|
}
|
|
1069
|
-
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=
|
|
1082
|
+
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
1070
1083
|
runtimeRequestInstallNotification(notification: $notification)
|
|
1071
|
-
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=
|
|
1084
|
+
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
|
|
1072
1085
|
runtimeGrantNotification(id: $id)
|
|
1073
|
-
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=
|
|
1086
|
+
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
|
|
1074
1087
|
runtimeExportDb(filePath: $filePath)
|
|
1075
|
-
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=
|
|
1088
|
+
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
|
|
1076
1089
|
runtimeImportDb(filePath: $filePath) {
|
|
1077
1090
|
perspectives { total imported failed omitted errors }
|
|
1078
1091
|
links { total imported failed omitted errors }
|
|
@@ -1086,51 +1099,51 @@ triggerMatch
|
|
|
1086
1099
|
trustedAgents { total imported failed omitted errors }
|
|
1087
1100
|
knownLinkLanguages { total imported failed omitted errors }
|
|
1088
1101
|
}
|
|
1089
|
-
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=
|
|
1090
|
-
runtimeNotifications { ${
|
|
1091
|
-
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=
|
|
1102
|
+
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=w(await U(this,z,"f").query({query:v`query runtimeNotifications {
|
|
1103
|
+
runtimeNotifications { ${Dl} }
|
|
1104
|
+
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
1092
1105
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
1093
|
-
}`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=
|
|
1106
|
+
}`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
|
|
1094
1107
|
runtimeRemoveNotification(id: $id)
|
|
1095
|
-
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=
|
|
1108
|
+
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
1096
1109
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
1097
|
-
}`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=
|
|
1110
|
+
}`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
|
|
1098
1111
|
runtimeImportPerspective(filePath: $filePath)
|
|
1099
|
-
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=
|
|
1112
|
+
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=w(await U(this,z,"f").query({query:v`query runtimeMultiUserEnabled {
|
|
1100
1113
|
runtimeMultiUserEnabled
|
|
1101
|
-
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=
|
|
1114
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
1102
1115
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
1103
|
-
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=
|
|
1116
|
+
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=w(await U(this,z,"f").query({query:v`query runtimeListUsers {
|
|
1104
1117
|
runtimeListUsers {
|
|
1105
1118
|
email
|
|
1106
1119
|
did
|
|
1107
1120
|
lastSeen
|
|
1108
1121
|
perspectiveCount
|
|
1109
1122
|
}
|
|
1110
|
-
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=
|
|
1123
|
+
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
|
|
1111
1124
|
runtimeEmailTestModeEnable
|
|
1112
|
-
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=
|
|
1125
|
+
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
|
|
1113
1126
|
runtimeEmailTestModeDisable
|
|
1114
|
-
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=
|
|
1127
|
+
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
|
|
1115
1128
|
runtimeEmailTestGetCode(email: $email)
|
|
1116
|
-
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=
|
|
1129
|
+
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
|
|
1117
1130
|
runtimeEmailTestClearCodes
|
|
1118
|
-
}`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=
|
|
1131
|
+
}`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
1119
1132
|
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
1120
|
-
}`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){U(this,
|
|
1121
|
-
runtimeNotificationTriggered { ${
|
|
1133
|
+
}`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){U(this,tn,"f").push(e)}subscribeNotificationTriggered(){U(this,z,"f").subscribe({query:v` subscription {
|
|
1134
|
+
runtimeNotificationTriggered { ${Gd} }
|
|
1122
1135
|
}
|
|
1123
|
-
`}).subscribe({next:e=>{U(this,
|
|
1124
|
-
runtimeMessageReceived { ${
|
|
1136
|
+
`}).subscribe({next:e=>{U(this,tn,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){U(this,Xr,"f").push(e)}subscribeMessageReceived(){U(this,z,"f").subscribe({query:v` subscription {
|
|
1137
|
+
runtimeMessageReceived { ${Yn} }
|
|
1125
1138
|
}
|
|
1126
|
-
`}).subscribe({next:e=>{U(this,
|
|
1139
|
+
`}).subscribe({next:e=>{U(this,Xr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){U(this,en,"f").push(e)}subscribeExceptionOccurred(){U(this,z,"f").subscribe({query:v` subscription {
|
|
1127
1140
|
exceptionOccurred {
|
|
1128
1141
|
title
|
|
1129
1142
|
message
|
|
1130
1143
|
type
|
|
1131
1144
|
addon
|
|
1132
1145
|
}
|
|
1133
|
-
}`}).subscribe({next:e=>{U(this,
|
|
1146
|
+
}`}).subscribe({next:e=>{U(this,en,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};z=new WeakMap,Xr=new WeakMap,en=new WeakMap,tn=new WeakMap,Ol=new WeakMap;var Zd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},or=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ot,Zs=class{constructor(e){Ot.set(this,void 0),Zd(this,Ot,e,"f")}async get(e,t=!1){if(!t)try{let n=oe.fromUrl(e).get();if(typeof n=="object"&&n!==null&&"author"in n&&"timestamp"in n&&"data"in n&&"proof"in n)return n}catch{}let{expression:r}=w(await or(this,Ot,"f").query({query:v`query expression($url: String!) {
|
|
1134
1147
|
expression(url: $url) {
|
|
1135
1148
|
author
|
|
1136
1149
|
timestamp
|
|
@@ -1143,7 +1156,7 @@ triggerMatch
|
|
|
1143
1156
|
invalid
|
|
1144
1157
|
}
|
|
1145
1158
|
}
|
|
1146
|
-
}`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=
|
|
1159
|
+
}`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=w(await or(this,Ot,"f").query({query:v`query expressionMany($urls: [String!]!) {
|
|
1147
1160
|
expressionMany(urls: $urls) {
|
|
1148
1161
|
author
|
|
1149
1162
|
timestamp
|
|
@@ -1156,19 +1169,19 @@ triggerMatch
|
|
|
1156
1169
|
invalid
|
|
1157
1170
|
}
|
|
1158
1171
|
}
|
|
1159
|
-
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=
|
|
1172
|
+
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=w(await or(this,Ot,"f").query({query:v`query expressionRaw($url: String!) {
|
|
1160
1173
|
expressionRaw(url: $url)
|
|
1161
|
-
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=
|
|
1174
|
+
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
|
|
1162
1175
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
1163
|
-
}`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=
|
|
1176
|
+
}`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=w(await or(this,Ot,"f").query({query:v`query expressionInteractions($url: String!) {
|
|
1164
1177
|
expressionInteractions(url: $url) {
|
|
1165
1178
|
label
|
|
1166
1179
|
name
|
|
1167
1180
|
parameters { name, type }
|
|
1168
1181
|
}
|
|
1169
|
-
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=
|
|
1182
|
+
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
1170
1183
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
1171
|
-
}`,variables:{url:e,interactionCall:t}}));return r}};Ot=new WeakMap;var za={};za.byteLength=Bd;za.toByteArray=Vd;za.fromByteArray=Wd;var St=[],nt=[],jd=typeof Uint8Array<"u"?Uint8Array:Array,bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(vi=0,oc=bs.length;vi<oc;++vi)St[vi]=bs[vi],nt[bs.charCodeAt(vi)]=vi;var vi,oc;nt["-".charCodeAt(0)]=62;nt["_".charCodeAt(0)]=63;function Ll(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Bd(i){var e=Ll(i),t=e[0],r=e[1];return(t+r)*3/4-r}function qd(i,e,t){return(e+t)*3/4-t}function Vd(i){var e,t=Ll(i),r=t[0],n=t[1],a=new jd(qd(i,r,n)),s=0,o=n>0?r-4:r,c;for(c=0;c<o;c+=4)e=nt[i.charCodeAt(c)]<<18|nt[i.charCodeAt(c+1)]<<12|nt[i.charCodeAt(c+2)]<<6|nt[i.charCodeAt(c+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=nt[i.charCodeAt(c)]<<2|nt[i.charCodeAt(c+1)]>>4,a[s++]=e&255),n===1&&(e=nt[i.charCodeAt(c)]<<10|nt[i.charCodeAt(c+1)]<<4|nt[i.charCodeAt(c+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Hd(i){return St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}function zd(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(Hd(r));return n.join("")}function Wd(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(zd(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(St[e>>2]+St[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(St[e>>10]+St[e>>4&63]+St[e<<2&63]+"=")),n.join("")}var Kd=4,cc=0,lc=1,Qd=2;function kr(i){let e=i.length;for(;--e>=0;)i[e]=0}var Gd=0,Nl=1,Zd=2,Jd=3,Yd=258,uo=29,An=256,gn=An+1+uo,hr=30,po=19,Rl=2*gn+1,Ti=15,ws=16,Xd=7,fo=256,Pl=16,Ol=17,Dl=18,Ks=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),pa=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ep=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ml=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tp=512,Dt=new Array((gn+2)*2);kr(Dt);var cn=new Array(hr*2);kr(cn);var mn=new Array(tp);kr(mn);var yn=new Array(Yd-Jd+1);kr(yn);var ho=new Array(uo);kr(ho);var La=new Array(hr);kr(La);function Ss(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var Ul,Fl,jl;function _s(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Bl=i=>i<256?mn[i]:mn[256+(i>>>7)],vn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},We=(i,e,t)=>{i.bi_valid>ws-t?(i.bi_buf|=e<<i.bi_valid&65535,vn(i,i.bi_buf),i.bi_buf=e>>ws-i.bi_valid,i.bi_valid+=t-ws):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},_t=(i,e,t)=>{We(i,t[e*2],t[e*2+1])},ql=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},ip=i=>{i.bi_valid===16?(vn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},rp=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,u,f,g,d,y,p=0;for(g=0;g<=Ti;g++)i.bl_count[g]=0;for(t[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Rl;l++)u=i.heap[l],g=t[t[u*2+1]*2+1]+1,g>c&&(g=c,p++),t[u*2+1]=g,!(u>r)&&(i.bl_count[g]++,d=0,u>=o&&(d=s[u-o]),y=t[u*2],i.opt_len+=y*(g+d),a&&(i.static_len+=y*(n[u*2+1]+d)));if(p!==0){do{for(g=c-1;i.bl_count[g]===0;)g--;i.bl_count[g]--,i.bl_count[g+1]+=2,i.bl_count[c]--,p-=2}while(p>0);for(g=c;g!==0;g--)for(u=i.bl_count[g];u!==0;)f=i.heap[--l],!(f>r)&&(t[f*2+1]!==g&&(i.opt_len+=(g-t[f*2+1])*t[f*2],t[f*2+1]=g),u--)}},Vl=(i,e,t)=>{let r=new Array(Ti+1),n=0,a,s;for(a=1;a<=Ti;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=ql(r[o]++,o))}},np=()=>{let i,e,t,r,n,a=new Array(Ti+1);for(t=0,r=0;r<uo-1;r++)for(ho[r]=t,i=0;i<1<<Ks[r];i++)yn[t++]=r;for(yn[t-1]=r,n=0,r=0;r<16;r++)for(La[r]=n,i=0;i<1<<pa[r];i++)mn[n++]=r;for(n>>=7;r<hr;r++)for(La[r]=n<<7,i=0;i<1<<pa[r]-7;i++)mn[256+n++]=r;for(e=0;e<=Ti;e++)a[e]=0;for(i=0;i<=143;)Dt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Dt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Dt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Dt[i*2+1]=8,i++,a[8]++;for(Vl(Dt,gn+1,a),i=0;i<hr;i++)cn[i*2+1]=5,cn[i*2]=ql(i,5);Ul=new Ss(Dt,Ks,An+1,gn,Ti),Fl=new Ss(cn,pa,0,hr,Ti),jl=new Ss(new Array(0),ep,0,po,Xd)},Hl=i=>{let e;for(e=0;e<gn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<hr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<po;e++)i.bl_tree[e*2]=0;i.dyn_ltree[fo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},zl=i=>{i.bi_valid>8?vn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},uc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},Es=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&uc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!uc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},dc=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?_t(i,n,e):(s=yn[n],_t(i,s+An+1,e),o=Ks[s],o!==0&&(n-=ho[s],We(i,n,o)),r--,s=Bl(r),_t(i,s,t),o=pa[s],o!==0&&(r-=La[s],We(i,r,o)));while(a<i.sym_next);_t(i,fo,e)},Qs=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,c=-1,l;for(i.heap_len=0,i.heap_max=Rl,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=c=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=c<2?++c:0,t[l*2]=1,i.depth[l]=0,i.opt_len--,n&&(i.static_len-=r[l*2+1]);for(e.max_code=c,s=i.heap_len>>1;s>=1;s--)Es(i,t,s);l=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Es(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[l*2]=t[s*2]+t[o*2],i.depth[l]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=l,i.heap[1]=l++,Es(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],rp(i,e),Vl(t,c,i.bl_count)},pc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)&&(o<l?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[Pl*2]++):o<=10?i.bl_tree[Ol*2]++:i.bl_tree[Dl*2]++,o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4))},fc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)){if(o<l)do _t(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(_t(i,a,i.bl_tree),o--),_t(i,Pl,i.bl_tree),We(i,o-3,2)):o<=10?(_t(i,Ol,i.bl_tree),We(i,o-3,3)):(_t(i,Dl,i.bl_tree),We(i,o-11,7));o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4)}},ap=i=>{let e;for(pc(i,i.dyn_ltree,i.l_desc.max_code),pc(i,i.dyn_dtree,i.d_desc.max_code),Qs(i,i.bl_desc),e=po-1;e>=3&&i.bl_tree[Ml[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},sp=(i,e,t,r)=>{let n;for(We(i,e-257,5),We(i,t-1,5),We(i,r-4,4),n=0;n<r;n++)We(i,i.bl_tree[Ml[n]*2+1],3);fc(i,i.dyn_ltree,e-1),fc(i,i.dyn_dtree,t-1)},op=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return cc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return lc;for(t=32;t<An;t++)if(i.dyn_ltree[t*2]!==0)return lc;return cc},hc=!1,cp=i=>{hc||(np(),hc=!0),i.l_desc=new _s(i.dyn_ltree,Ul),i.d_desc=new _s(i.dyn_dtree,Fl),i.bl_desc=new _s(i.bl_tree,jl),i.bi_buf=0,i.bi_valid=0,Hl(i)},Wl=(i,e,t,r)=>{We(i,(Gd<<1)+(r?1:0),3),zl(i),vn(i,t),vn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},lp=i=>{We(i,Nl<<1,3),_t(i,fo,Dt),ip(i)},up=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===Qd&&(i.strm.data_type=op(i)),Qs(i,i.l_desc),Qs(i,i.d_desc),s=ap(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Wl(i,e,t,r):i.strategy===Kd||a===n?(We(i,(Nl<<1)+(r?1:0),3),dc(i,Dt,cn)):(We(i,(Zd<<1)+(r?1:0),3),sp(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),dc(i,i.dyn_ltree,i.dyn_dtree)),Hl(i),r&&zl(i)},dp=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(yn[t]+An+1)*2]++,i.dyn_dtree[Bl(e)*2]++),i.sym_next===i.sym_end),pp=cp,fp=Wl,hp=up,gp=dp,mp=lp,yp={_tr_init:pp,_tr_stored_block:fp,_tr_flush_block:hp,_tr_tally:gp,_tr_align:mp},vp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},bn=vp,bp=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},wp=new Uint32Array(bp()),Sp=(i,e,t,r)=>{let n=wp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},Ee=Sp,Ui={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ki={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:_p,_tr_stored_block:Gs,_tr_flush_block:Ep,_tr_tally:Xt,_tr_align:xp}=yp,{Z_NO_FLUSH:ei,Z_PARTIAL_FLUSH:$p,Z_FULL_FLUSH:Ap,Z_FINISH:st,Z_BLOCK:gc,Z_OK:Ie,Z_STREAM_END:mc,Z_STREAM_ERROR:$t,Z_DATA_ERROR:kp,Z_BUF_ERROR:xs,Z_DEFAULT_COMPRESSION:Ip,Z_FILTERED:Tp,Z_HUFFMAN_ONLY:Gn,Z_RLE:Cp,Z_FIXED:Lp,Z_DEFAULT_STRATEGY:Np,Z_UNKNOWN:Rp,Z_DEFLATED:Wa}=Ki,Pp=9,Op=15,Dp=8,Mp=29,Up=256,Zs=Up+1+Mp,Fp=30,jp=19,Bp=2*Zs+1,qp=15,Y=3,Qt=258,At=Qt+Y+1,Vp=32,br=42,go=57,Js=69,Ys=73,Xs=91,eo=103,Ci=113,en=666,je=1,Ir=2,Fi=3,Tr=4,Hp=3,Li=(i,e)=>(i.msg=Ui[e],e),yc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},zp=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},Wp=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ti=Wp,Ge=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Je=(i,e)=>{Ep(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ge(i.strm)},re=(i,e)=>{i.pending_buf[i.pending++]=e},Fr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},to=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=bn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=Ee(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Kl=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,c=i.strstart>i.w_size-At?i.strstart-(i.w_size-At):0,l=i.window,u=i.w_mask,f=i.prev,g=i.strstart+Qt,d=l[r+s-1],y=l[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(l[n+s]!==y||l[n+s-1]!==d||l[n]!==l[r]||l[++n]!==l[r+1])){r+=2,n++;do;while(l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&r<g);if(a=Qt-(g-r),r=g-Qt,a>s){if(i.match_start=e,s=a,a>=o)break;d=l[r+s-1],y=l[r+s]}}while((e=f[e&u])>c&&--t!==0);return s<=i.lookahead?s:i.lookahead},wr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-At)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),zp(i),r+=e),i.strm.avail_in===0)break;if(t=to(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=Y)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=ti(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ti(i,i.ins_h,i.window[n+Y-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<Y)););}while(i.lookahead<At&&i.strm.avail_in!==0)},Ql=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==st||e===ei||r!==n+i.strm.avail_in)))break;s=e===st&&r===n+i.strm.avail_in?1:0,Gs(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Ge(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(to(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?Tr:e!==ei&&e!==st&&i.strm.avail_in===0&&i.strstart===i.block_start?Ir:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(to(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===st)&&e!==ei&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===st&&i.strm.avail_in===0&&r===n?1:0,Gs(i,i.block_start,r,s),i.block_start+=r,Ge(i.strm)),s?Fi:je)},$s=(i,e)=>{let t,r;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===ei)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=Y&&(i.ins_h=ti(i,i.ins_h,i.window[i.strstart+Y-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-At&&(i.match_length=Kl(i,t)),i.match_length>=Y)if(r=Xt(i,i.strstart-i.match_start,i.match_length-Y),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Y){i.match_length--;do i.strstart++,i.ins_h=ti(i,i.ins_h,i.window[i.strstart+Y-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=ti(i,i.ins_h,i.window[i.strstart+1]);else r=Xt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=i.strstart<Y-1?i.strstart:Y-1,e===st?(Je(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Ir},or=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===ei)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=Y&&(i.ins_h=ti(i,i.ins_h,i.window[i.strstart+Y-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Y-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-At&&(i.match_length=Kl(i,t),i.match_length<=5&&(i.strategy===Tp||i.match_length===Y&&i.strstart-i.match_start>4096)&&(i.match_length=Y-1)),i.prev_length>=Y&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-Y,r=Xt(i,i.strstart-1-i.prev_match,i.prev_length-Y),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=ti(i,i.ins_h,i.window[i.strstart+Y-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Y-1,i.strstart++,r&&(Je(i,!1),i.strm.avail_out===0))return je}else if(i.match_available){if(r=Xt(i,0,i.window[i.strstart-1]),r&&Je(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return je}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Xt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Y-1?i.strstart:Y-1,e===st?(Je(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Ir},Kp=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Qt){if(wr(i),i.lookahead<=Qt&&e===ei)return je;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Y&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Qt;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=Qt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Y?(t=Xt(i,1,i.match_length-Y),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Xt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===st?(Je(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Ir},Qp=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(wr(i),i.lookahead===0)){if(e===ei)return je;break}if(i.match_length=0,t=Xt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===st?(Je(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Ir};function mt(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var tn=[new mt(0,0,0,0,Ql),new mt(4,4,8,4,$s),new mt(4,5,16,8,$s),new mt(4,6,32,32,$s),new mt(4,4,16,16,or),new mt(8,16,32,32,or),new mt(8,16,128,128,or),new mt(8,32,128,256,or),new mt(32,128,258,1024,or),new mt(32,258,258,4096,or)],Gp=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=tn[i.level].max_lazy,i.good_match=tn[i.level].good_length,i.nice_match=tn[i.level].nice_length,i.max_chain_length=tn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Y-1,i.match_available=0,i.ins_h=0};function Zp(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Wa,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Bp*2),this.dyn_dtree=new Uint16Array((2*Fp+1)*2),this.bl_tree=new Uint16Array((2*jp+1)*2),Kt(this.dyn_ltree),Kt(this.dyn_dtree),Kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(qp+1),this.heap=new Uint16Array(2*Zs+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Zs+1),Kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var kn=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==br&&e.status!==go&&e.status!==Js&&e.status!==Ys&&e.status!==Xs&&e.status!==eo&&e.status!==Ci&&e.status!==en?1:0},Gl=i=>{if(kn(i))return Li(i,$t);i.total_in=i.total_out=0,i.data_type=Rp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?go:e.wrap?br:Ci,i.adler=e.wrap===2?0:1,e.last_flush=-2,_p(e),Ie},Zl=i=>{let e=Gl(i);return e===Ie&&Gp(i.state),e},Jp=(i,e)=>kn(i)||i.state.wrap!==2?$t:(i.state.gzhead=e,Ie),Jl=(i,e,t,r,n,a)=>{if(!i)return $t;let s=1;if(e===Ip&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>Pp||t!==Wa||r<8||r>15||e<0||e>9||a<0||a>Lp||r===8&&s!==1)return Li(i,$t);r===8&&(r=9);let o=new Zp;return i.state=o,o.strm=i,o.status=br,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Y-1)/Y),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,Zl(i)},Yp=(i,e)=>Jl(i,e,Wa,Op,Dp,Np),Xp=(i,e)=>{if(kn(i)||e>gc||e<0)return i?Li(i,$t):$t;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===en&&e!==st)return Li(i,i.avail_out===0?xs:$t);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ge(i),i.avail_out===0)return t.last_flush=-1,Ie}else if(i.avail_in===0&&yc(e)<=yc(r)&&e!==st)return Li(i,xs);if(t.status===en&&i.avail_in!==0)return Li(i,xs);if(t.status===br&&t.wrap===0&&(t.status=Ci),t.status===br){let n=Wa+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Gn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Vp),n+=31-n%31,Fr(t,n),t.strstart!==0&&(Fr(t,i.adler>>>16),Fr(t,i.adler&65535)),i.adler=1,t.status=Ci,Ge(i),t.pending!==0)return t.last_flush=-1,Ie}if(t.status===go){if(i.adler=0,re(t,31),re(t,139),re(t,8),t.gzhead)re(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),re(t,t.gzhead.time&255),re(t,t.gzhead.time>>8&255),re(t,t.gzhead.time>>16&255),re(t,t.gzhead.time>>24&255),re(t,t.level===9?2:t.strategy>=Gn||t.level<2?4:0),re(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(re(t,t.gzhead.extra.length&255),re(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=Ee(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Js;else if(re(t,0),re(t,0),re(t,0),re(t,0),re(t,0),re(t,t.level===9?2:t.strategy>=Gn||t.level<2?4:0),re(t,Hp),t.status=Ci,Ge(i),t.pending!==0)return t.last_flush=-1,Ie}if(t.status===Js){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Ge(i),t.pending!==0)return t.last_flush=-1,Ie;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Ys}if(t.status===Ys){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),Ge(i),t.pending!==0)return t.last_flush=-1,Ie;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,re(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Xs}if(t.status===Xs){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),Ge(i),t.pending!==0)return t.last_flush=-1,Ie;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,re(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n))}t.status=eo}if(t.status===eo){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ge(i),t.pending!==0))return t.last_flush=-1,Ie;re(t,i.adler&255),re(t,i.adler>>8&255),i.adler=0}if(t.status=Ci,Ge(i),t.pending!==0)return t.last_flush=-1,Ie}if(i.avail_in!==0||t.lookahead!==0||e!==ei&&t.status!==en){let n=t.level===0?Ql(t,e):t.strategy===Gn?Qp(t,e):t.strategy===Cp?Kp(t,e):tn[t.level].func(t,e);if((n===Fi||n===Tr)&&(t.status=en),n===je||n===Fi)return i.avail_out===0&&(t.last_flush=-1),Ie;if(n===Ir&&(e===$p?xp(t):e!==gc&&(Gs(t,0,0,!1),e===Ap&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ge(i),i.avail_out===0))return t.last_flush=-1,Ie}return e!==st?Ie:t.wrap<=0?mc:(t.wrap===2?(re(t,i.adler&255),re(t,i.adler>>8&255),re(t,i.adler>>16&255),re(t,i.adler>>24&255),re(t,i.total_in&255),re(t,i.total_in>>8&255),re(t,i.total_in>>16&255),re(t,i.total_in>>24&255)):(Fr(t,i.adler>>>16),Fr(t,i.adler&65535)),Ge(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Ie:mc)},ef=i=>{if(kn(i))return $t;let e=i.state.status;return i.state=null,e===Ci?Li(i,kp):Ie},tf=(i,e)=>{let t=e.length;if(kn(i))return $t;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==br||r.lookahead)return $t;if(n===1&&(i.adler=bn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Kt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(e.subarray(t-r.w_size,t),0),e=c,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,wr(r);r.lookahead>=Y;){let c=r.strstart,l=r.lookahead-(Y-1);do r.ins_h=ti(r,r.ins_h,r.window[c+Y-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--l);r.strstart=c,r.lookahead=Y-1,wr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Y-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Ie},rf=Yp,nf=Jl,af=Zl,sf=Gl,of=Jp,cf=Xp,lf=ef,uf=tf,df="pako deflate (from Nodeca project)",ln={deflateInit:rf,deflateInit2:nf,deflateReset:af,deflateResetKeep:sf,deflateSetHeader:of,deflate:cf,deflateEnd:lf,deflateSetDictionary:uf,deflateInfo:df},pf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),ff=function(i){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let r in t)pf(t,r)&&(i[r]=t[r])}}return i},hf=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},Ka={assign:ff,flattenChunks:hf},Yl=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){Yl=!1}var wn=new Uint8Array(256);for(let i=0;i<256;i++)wn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;wn[254]=wn[254]=1;var gf=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},mf=(i,e)=>{if(e<65534&&i.subarray&&Yl)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},yf=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=wn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return mf(a,n)},vf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+wn[i[t]]>e?t:e},Sn={string2buf:gf,buf2string:yf,utf8border:vf};function bf(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Xl=bf,eu=Object.prototype.toString,{Z_NO_FLUSH:wf,Z_SYNC_FLUSH:Sf,Z_FULL_FLUSH:_f,Z_FINISH:Ef,Z_OK:Na,Z_STREAM_END:xf,Z_DEFAULT_COMPRESSION:$f,Z_DEFAULT_STRATEGY:Af,Z_DEFLATED:kf}=Ki;function In(i){this.options=Ka.assign({level:$f,method:kf,chunkSize:16384,windowBits:15,memLevel:8,strategy:Af},i||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xl,this.strm.avail_out=0;let t=ln.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Na)throw new Error(Ui[t]);if(e.header&&ln.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Sn.string2buf(e.dictionary):eu.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=ln.deflateSetDictionary(this.strm,r),t!==Na)throw new Error(Ui[t]);this._dict_set=!0}}In.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?Ef:wf,typeof i=="string"?t.input=Sn.string2buf(i):eu.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===Sf||a===_f)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ln.deflate(t,a),n===xf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ln.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Na;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};In.prototype.onData=function(i){this.chunks.push(i)};In.prototype.onEnd=function(i){i===Na&&(this.result=Ka.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function mo(i,e){let t=new In(e);if(t.push(i,!0),t.err)throw t.msg||Ui[t.err];return t.result}function If(i,e){return e=e||{},e.raw=!0,mo(i,e)}function Tf(i,e){return e=e||{},e.gzip=!0,mo(i,e)}var Cf=In,Lf=mo,Nf=If,Rf=Tf,Pf=Ki,Of={Deflate:Cf,deflate:Lf,deflateRaw:Nf,gzip:Rf,constants:Pf},Zn=16209,Df=16191,Mf=function i(e,t){let r,n,a,s,o,c,l,u,f,g,d,y,p,b,S,x,I,w,T,R,L,B,q,C,H=e.state;r=e.next_in,q=e.input,n=r+(e.avail_in-5),a=e.next_out,C=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),c=H.dmax,l=H.wsize,u=H.whave,f=H.wnext,g=H.window,d=H.hold,y=H.bits,p=H.lencode,b=H.distcode,S=(1<<H.lenbits)-1,x=(1<<H.distbits)-1;e:do{y<15&&(d+=q[r++]<<y,y+=8,d+=q[r++]<<y,y+=8),I=p[d&S];t:for(;;){if(w=I>>>24,d>>>=w,y-=w,w=I>>>16&255,w===0)C[a++]=I&65535;else if(w&16){T=I&65535,w&=15,w&&(y<w&&(d+=q[r++]<<y,y+=8),T+=d&(1<<w)-1,d>>>=w,y-=w),y<15&&(d+=q[r++]<<y,y+=8,d+=q[r++]<<y,y+=8),I=b[d&x];i:for(;;){if(w=I>>>24,d>>>=w,y-=w,w=I>>>16&255,w&16){if(R=I&65535,w&=15,y<w&&(d+=q[r++]<<y,y+=8,y<w&&(d+=q[r++]<<y,y+=8)),R+=d&(1<<w)-1,R>c){e.msg="invalid distance too far back",H.mode=Zn;break e}if(d>>>=w,y-=w,w=a-s,R>w){if(w=R-w,w>u&&H.sane){e.msg="invalid distance too far back",H.mode=Zn;break e}if(L=0,B=g,f===0){if(L+=l-w,w<T){T-=w;do C[a++]=g[L++];while(--w);L=a-R,B=C}}else if(f<w){if(L+=l+f-w,w-=f,w<T){T-=w;do C[a++]=g[L++];while(--w);if(L=0,f<T){w=f,T-=w;do C[a++]=g[L++];while(--w);L=a-R,B=C}}}else if(L+=f-w,w<T){T-=w;do C[a++]=g[L++];while(--w);L=a-R,B=C}for(;T>2;)C[a++]=B[L++],C[a++]=B[L++],C[a++]=B[L++],T-=3;T&&(C[a++]=B[L++],T>1&&(C[a++]=B[L++]))}else{L=a-R;do C[a++]=C[L++],C[a++]=C[L++],C[a++]=C[L++],T-=3;while(T>2);T&&(C[a++]=C[L++],T>1&&(C[a++]=C[L++]))}}else if((w&64)===0){I=b[(I&65535)+(d&(1<<w)-1)];continue i}else{e.msg="invalid distance code",H.mode=Zn;break e}break}}else if((w&64)===0){I=p[(I&65535)+(d&(1<<w)-1)];continue t}else if(w&32){H.mode=Df;break e}else{e.msg="invalid literal/length code",H.mode=Zn;break e}break}}while(r<n&&a<o);T=y>>3,r-=T,y-=T<<3,d&=(1<<y)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),H.hold=d,H.bits=y},cr=15,vc=852,bc=592,wc=0,As=1,Sc=2,Uf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Ff=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),jf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Bf=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),qf=(i,e,t,r,n,a,s,o)=>{let c=o.bits,l=0,u=0,f=0,g=0,d=0,y=0,p=0,b=0,S=0,x=0,I,w,T,R,L,B=null,q,C=new Uint16Array(cr+1),H=new Uint16Array(cr+1),Ce=null,Lr,k,Ln;for(l=0;l<=cr;l++)C[l]=0;for(u=0;u<r;u++)C[e[t+u]]++;for(d=c,g=cr;g>=1&&C[g]===0;g--);if(d>g&&(d=g),g===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(f=1;f<g&&C[f]===0;f++);for(d<f&&(d=f),b=1,l=1;l<=cr;l++)if(b<<=1,b-=C[l],b<0)return-1;if(b>0&&(i===wc||g!==1))return-1;for(H[1]=0,l=1;l<cr;l++)H[l+1]=H[l]+C[l];for(u=0;u<r;u++)e[t+u]!==0&&(s[H[e[t+u]]++]=u);if(i===wc?(B=Ce=s,q=20):i===As?(B=Uf,Ce=Ff,q=257):(B=jf,Ce=Bf,q=0),x=0,u=0,l=f,L=a,y=d,p=0,T=-1,S=1<<d,R=S-1,i===As&&S>vc||i===Sc&&S>bc)return 1;for(;;){Lr=l-p,s[u]+1<q?(k=0,Ln=s[u]):s[u]>=q?(k=Ce[s[u]-q],Ln=B[s[u]-q]):(k=32+64,Ln=0),I=1<<l-p,w=1<<y,f=w;do w-=I,n[L+(x>>p)+w]=Lr<<24|k<<16|Ln|0;while(w!==0);for(I=1<<l-1;x&I;)I>>=1;if(I!==0?(x&=I-1,x+=I):x=0,u++,--C[l]===0){if(l===g)break;l=e[t+s[u]]}if(l>d&&(x&R)!==T){for(p===0&&(p=d),L+=f,y=l-p,b=1<<y;y+p<g&&(b-=C[y+p],!(b<=0));)y++,b<<=1;if(S+=1<<y,i===As&&S>vc||i===Sc&&S>bc)return 1;T=x&R,n[T]=d<<24|y<<16|L-a|0}}return x!==0&&(n[L+x]=l-p<<24|64<<16|0),o.bits=d,0},un=qf,Vf=0,tu=1,iu=2,{Z_FINISH:_c,Z_BLOCK:Hf,Z_TREES:Jn,Z_OK:ji,Z_STREAM_END:zf,Z_NEED_DICT:Wf,Z_STREAM_ERROR:ot,Z_DATA_ERROR:ru,Z_MEM_ERROR:nu,Z_BUF_ERROR:Kf,Z_DEFLATED:Ec}=Ki,Qa=16180,xc=16181,$c=16182,Ac=16183,kc=16184,Ic=16185,Tc=16186,Cc=16187,Lc=16188,Nc=16189,Ra=16190,Nt=16191,ks=16192,Rc=16193,Is=16194,Pc=16195,Oc=16196,Dc=16197,Mc=16198,Yn=16199,Xn=16200,Uc=16201,Fc=16202,jc=16203,Bc=16204,qc=16205,Ts=16206,Vc=16207,Hc=16208,ue=16209,au=16210,su=16211,Qf=852,Gf=592,Zf=15,Jf=Zf,zc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Yf(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Qi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Qa||e.mode>su?1:0},ou=i=>{if(Qi(i))return ot;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Qa,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Qf),e.distcode=e.distdyn=new Int32Array(Gf),e.sane=1,e.back=-1,ji},cu=i=>{if(Qi(i))return ot;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,ou(i)},lu=(i,e)=>{let t;if(Qi(i))return ot;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?ot:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,cu(i))},uu=(i,e)=>{if(!i)return ot;let t=new Yf;i.state=t,t.strm=i,t.window=null,t.mode=Qa;let r=lu(i,e);return r!==ji&&(i.state=null),r},Xf=i=>uu(i,Jf),Wc=!0,Cs,Ls,eh=i=>{if(Wc){Cs=new Int32Array(512),Ls=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(un(tu,i.lens,0,288,Cs,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;un(iu,i.lens,0,32,Ls,0,i.work,{bits:5}),Wc=!1}i.lencode=Cs,i.lenbits=9,i.distcode=Ls,i.distbits=5},du=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},th=(i,e)=>{let t,r,n,a,s,o,c,l,u,f,g,d,y,p,b=0,S,x,I,w,T,R,L,B,q=new Uint8Array(4),C,H,Ce=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qi(i)||!i.output||!i.input&&i.avail_in!==0)return ot;t=i.state,t.mode===Nt&&(t.mode=ks),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,f=o,g=c,B=ji;e:for(;;)switch(t.mode){case Qa:if(t.wrap===0){t.mode=ks;break}for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,q[0]=l&255,q[1]=l>>>8&255,t.check=Ee(t.check,q,2,0),l=0,u=0,t.mode=xc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",t.mode=ue;break}if((l&15)!==Ec){i.msg="unknown compression method",t.mode=ue;break}if(l>>>=4,u-=4,L=(l&15)+8,t.wbits===0&&(t.wbits=L),L>15||L>t.wbits){i.msg="invalid window size",t.mode=ue;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=l&512?Nc:Nt,l=0,u=0;break;case xc:for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==Ec){i.msg="unknown compression method",t.mode=ue;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=ue;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,t.check=Ee(t.check,q,2,0)),l=0,u=0,t.mode=$c;case $c:for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,q[2]=l>>>16&255,q[3]=l>>>24&255,t.check=Ee(t.check,q,4,0)),l=0,u=0,t.mode=Ac;case Ac:for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,t.check=Ee(t.check,q,2,0)),l=0,u=0,t.mode=kc;case kc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(q[0]=l&255,q[1]=l>>>8&255,t.check=Ee(t.check,q,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=Ic;case Ic:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(L=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),L)),t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Tc;case Tc:if(t.flags&2048){if(o===0)break e;d=0;do L=r[a+d++],t.head&&L&&t.length<65536&&(t.head.name+=String.fromCharCode(L));while(L&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,L)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Cc;case Cc:if(t.flags&4096){if(o===0)break e;d=0;do L=r[a+d++],t.head&&L&&t.length<65536&&(t.head.comment+=String.fromCharCode(L));while(L&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,L)break e}else t.head&&(t.head.comment=null);t.mode=Lc;case Lc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){i.msg="header crc mismatch",t.mode=ue;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Nt;break;case Nc:for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}i.adler=t.check=zc(l),l=0,u=0,t.mode=Ra;case Ra:if(t.havedict===0)return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,Wf;i.adler=t.check=1,t.mode=Nt;case Nt:if(e===Hf||e===Jn)break e;case ks:if(t.last){l>>>=u&7,u-=u&7,t.mode=Ts;break}for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Rc;break;case 1:if(eh(t),t.mode=Yn,e===Jn){l>>>=2,u-=2;break e}break;case 2:t.mode=Oc;break;case 3:i.msg="invalid block type",t.mode=ue}l>>>=2,u-=2;break;case Rc:for(l>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",t.mode=ue;break}if(t.length=l&65535,l=0,u=0,t.mode=Is,e===Jn)break e;case Is:t.mode=Pc;case Pc:if(d=t.length,d){if(d>o&&(d=o),d>c&&(d=c),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,c-=d,s+=d,t.length-=d;break}t.mode=Nt;break;case Oc:for(;u<14;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.nlen=(l&31)+257,l>>>=5,u-=5,t.ndist=(l&31)+1,l>>>=5,u-=5,t.ncode=(l&15)+4,l>>>=4,u-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=ue;break}t.have=0,t.mode=Dc;case Dc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.lens[Ce[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[Ce[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,C={bits:t.lenbits},B=un(Vf,t.lens,0,19,t.lencode,0,t.work,C),t.lenbits=C.bits,B){i.msg="invalid code lengths set",t.mode=ue;break}t.have=0,t.mode=Mc;case Mc:for(;t.have<t.nlen+t.ndist;){for(;b=t.lencode[l&(1<<t.lenbits)-1],S=b>>>24,x=b>>>16&255,I=b&65535,!(S<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(I<16)l>>>=S,u-=S,t.lens[t.have++]=I;else{if(I===16){for(H=S+2;u<H;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(l>>>=S,u-=S,t.have===0){i.msg="invalid bit length repeat",t.mode=ue;break}L=t.lens[t.have-1],d=3+(l&3),l>>>=2,u-=2}else if(I===17){for(H=S+3;u<H;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=S,u-=S,L=0,d=3+(l&7),l>>>=3,u-=3}else{for(H=S+7;u<H;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=S,u-=S,L=0,d=11+(l&127),l>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=ue;break}for(;d--;)t.lens[t.have++]=L}}if(t.mode===ue)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=ue;break}if(t.lenbits=9,C={bits:t.lenbits},B=un(tu,t.lens,0,t.nlen,t.lencode,0,t.work,C),t.lenbits=C.bits,B){i.msg="invalid literal/lengths set",t.mode=ue;break}if(t.distbits=6,t.distcode=t.distdyn,C={bits:t.distbits},B=un(iu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,C),t.distbits=C.bits,B){i.msg="invalid distances set",t.mode=ue;break}if(t.mode=Yn,e===Jn)break e;case Yn:t.mode=Xn;case Xn:if(o>=6&&c>=258){i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,Mf(i,g),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,t.mode===Nt&&(t.back=-1);break}for(t.back=0;b=t.lencode[l&(1<<t.lenbits)-1],S=b>>>24,x=b>>>16&255,I=b&65535,!(S<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(x&&(x&240)===0){for(w=S,T=x,R=I;b=t.lencode[R+((l&(1<<w+T)-1)>>w)],S=b>>>24,x=b>>>16&255,I=b&65535,!(w+S<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=w,u-=w,t.back+=w}if(l>>>=S,u-=S,t.back+=S,t.length=I,x===0){t.mode=qc;break}if(x&32){t.back=-1,t.mode=Nt;break}if(x&64){i.msg="invalid literal/length code",t.mode=ue;break}t.extra=x&15,t.mode=Uc;case Uc:if(t.extra){for(H=t.extra;u<H;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Fc;case Fc:for(;b=t.distcode[l&(1<<t.distbits)-1],S=b>>>24,x=b>>>16&255,I=b&65535,!(S<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((x&240)===0){for(w=S,T=x,R=I;b=t.distcode[R+((l&(1<<w+T)-1)>>w)],S=b>>>24,x=b>>>16&255,I=b&65535,!(w+S<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=w,u-=w,t.back+=w}if(l>>>=S,u-=S,t.back+=S,x&64){i.msg="invalid distance code",t.mode=ue;break}t.offset=I,t.extra=x&15,t.mode=jc;case jc:if(t.extra){for(H=t.extra;u<H;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=ue;break}t.mode=Bc;case Bc:if(c===0)break e;if(d=g-c,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=ue;break}d>t.wnext?(d-=t.wnext,y=t.wsize-d):y=t.wnext-d,d>t.length&&(d=t.length),p=t.window}else p=n,y=s-t.offset,d=t.length;d>c&&(d=c),c-=d,t.length-=d;do n[s++]=p[y++];while(--d);t.length===0&&(t.mode=Xn);break;case qc:if(c===0)break e;n[s++]=t.length,c--,t.mode=Xn;break;case Ts:if(t.wrap){for(;u<32;){if(o===0)break e;o--,l|=r[a++]<<u,u+=8}if(g-=c,i.total_out+=g,t.total+=g,t.wrap&4&&g&&(i.adler=t.check=t.flags?Ee(t.check,n,g,s-g):bn(t.check,n,g,s-g)),g=c,t.wrap&4&&(t.flags?l:zc(l))!==t.check){i.msg="incorrect data check",t.mode=ue;break}l=0,u=0}t.mode=Vc;case Vc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=ue;break}l=0,u=0}t.mode=Hc;case Hc:B=zf;break e;case ue:B=ru;break e;case au:return nu;case su:default:return ot}return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,(t.wsize||g!==i.avail_out&&t.mode<ue&&(t.mode<Ts||e!==_c))&&du(i,i.output,i.next_out,g-i.avail_out),f-=i.avail_in,g-=i.avail_out,i.total_in+=f,i.total_out+=g,t.total+=g,t.wrap&4&&g&&(i.adler=t.check=t.flags?Ee(t.check,n,g,i.next_out-g):bn(t.check,n,g,i.next_out-g)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Nt?128:0)+(t.mode===Yn||t.mode===Is?256:0),(f===0&&g===0||e===_c)&&B===ji&&(B=Kf),B},ih=i=>{if(Qi(i))return ot;let e=i.state;return e.window&&(e.window=null),i.state=null,ji},rh=(i,e)=>{if(Qi(i))return ot;let t=i.state;return(t.wrap&2)===0?ot:(t.head=e,e.done=!1,ji)},nh=(i,e)=>{let t=e.length,r,n,a;return Qi(i)||(r=i.state,r.wrap!==0&&r.mode!==Ra)?ot:r.mode===Ra&&(n=1,n=bn(n,e,t,0),n!==r.check)?ru:(a=du(i,e,t,t),a?(r.mode=au,nu):(r.havedict=1,ji))},ah=cu,sh=lu,oh=ou,ch=Xf,lh=uu,uh=th,dh=ih,ph=rh,fh=nh,hh="pako inflate (from Nodeca project)",Mt={inflateReset:ah,inflateReset2:sh,inflateResetKeep:oh,inflateInit:ch,inflateInit2:lh,inflate:uh,inflateEnd:dh,inflateGetHeader:ph,inflateSetDictionary:fh,inflateInfo:hh};function gh(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var mh=gh,pu=Object.prototype.toString,{Z_NO_FLUSH:yh,Z_FINISH:vh,Z_OK:_n,Z_STREAM_END:Ns,Z_NEED_DICT:Rs,Z_STREAM_ERROR:bh,Z_DATA_ERROR:Kc,Z_MEM_ERROR:wh}=Ki;function Tn(i){this.options=Ka.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xl,this.strm.avail_out=0;let t=Mt.inflateInit2(this.strm,e.windowBits);if(t!==_n)throw new Error(Ui[t]);if(this.header=new mh,Mt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Sn.string2buf(e.dictionary):pu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Mt.inflateSetDictionary(this.strm,e.dictionary),t!==_n)))throw new Error(Ui[t])}Tn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?vh:yh,pu.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Mt.inflate(t,s),a===Rs&&n&&(a=Mt.inflateSetDictionary(t,n),a===_n?a=Mt.inflate(t,s):a===Kc&&(a=Rs));t.avail_in>0&&a===Ns&&t.state.wrap>0&&i[t.next_in]!==0;)Mt.inflateReset(t),a=Mt.inflate(t,s);switch(a){case bh:case Kc:case Rs:case wh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Ns))if(this.options.to==="string"){let c=Sn.utf8border(t.output,t.next_out),l=t.next_out-c,u=Sn.buf2string(t.output,c);t.next_out=l,t.avail_out=r-l,l&&t.output.set(t.output.subarray(c,c+l),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===_n&&o===0)){if(a===Ns)return a=Mt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Tn.prototype.onData=function(i){this.chunks.push(i)};Tn.prototype.onEnd=function(i){i===_n&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ka.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function yo(i,e){let t=new Tn(e);if(t.push(i),t.err)throw t.msg||Ui[t.err];return t.result}function Sh(i,e){return e=e||{},e.raw=!0,yo(i,e)}var _h=Tn,Eh=yo,xh=Sh,$h=yo,Ah=Ki,kh={Inflate:_h,inflate:Eh,inflateRaw:xh,ungzip:$h,constants:Ah},{Deflate:Ih,deflate:Th,deflateRaw:Ch,gzip:Lh}=Of,{Inflate:Nh,inflate:Rh,inflateRaw:Ph,ungzip:Oh}=kh,Dh=Ih,Mh=Th,Uh=Ch,Fh=Lh,jh=Nh,Bh=Rh,qh=Ph,Vh=Oh,Hh=Ki,zh={Deflate:Dh,deflate:Mh,deflateRaw:Uh,gzip:Fh,Inflate:jh,inflate:Bh,inflateRaw:qh,ungzip:Vh,constants:Hh},oe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ce=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Pa=class{constructor(e,t){this.input=e,this.output=t}};oe([h(),ce("design:type",String)],Pa.prototype,"input",void 0);oe([h(),ce("design:type",String)],Pa.prototype,"output",void 0);Pa=oe([$e(),ce("design:paramtypes",[String,String])],Pa);var Oa=class{constructor(e,t){this.input=e,this.output=t}};oe([h(),ce("design:type",String)],Oa.prototype,"input",void 0);oe([h(),ce("design:type",String)],Oa.prototype,"output",void 0);Oa=oe([V(),ce("design:paramtypes",[String,String])],Oa);var ai=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};oe([h(),ce("design:type",String)],ai.prototype,"name",void 0);oe([h(),ce("design:type",String)],ai.prototype,"modelId",void 0);oe([h(),ce("design:type",String)],ai.prototype,"systemPrompt",void 0);oe([h(),ce("design:type",Array)],ai.prototype,"promptExamples",void 0);oe([h(),ce("design:type",String)],ai.prototype,"metaData",void 0);ai=oe([$e(),ce("design:paramtypes",[String,String,String,Array,String])],ai);var Tt=class{constructor(e,t,r,n,a,s,o,c){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=c}};oe([h(),ce("design:type",String)],Tt.prototype,"name",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"modelId",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"taskId",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"systemPrompt",void 0);oe([h(),ce("design:type",Array)],Tt.prototype,"promptExamples",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"metaData",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"createdAt",void 0);oe([h(),ce("design:type",String)],Tt.prototype,"updatedAt",void 0);Tt=oe([V(),ce("design:paramtypes",[String,String,String,String,Array,String,String,String])],Tt);var Bi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};oe([h(),ce("design:type",String)],Bi.prototype,"model",void 0);oe([h(),ce("design:type",String)],Bi.prototype,"status",void 0);oe([h(),ce("design:type",Number)],Bi.prototype,"progress",void 0);oe([h(),ce("design:type",Boolean)],Bi.prototype,"downloaded",void 0);oe([h(),ce("design:type",Boolean)],Bi.prototype,"loaded",void 0);Bi=oe([V(),ce("design:paramtypes",[String,String,Number,Boolean,Boolean])],Bi);var Wh=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},we=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ve,fa,io=class{constructor(e,t=!0){ve.set(this,void 0),fa.set(this,new Map),Wh(this,ve,e,"f")}async getModels(){let e=await we(this,ve,"f").query({query:v`
|
|
1184
|
+
}`,variables:{url:e,interactionCall:t}}));return r}};Ot=new WeakMap;var Ga={};Ga.byteLength=Yd;Ga.toByteArray=ep;Ga.fromByteArray=rp;var St=[],st=[],Jd=typeof Uint8Array<"u"?Uint8Array:Array,Es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(yi=0,uc=Es.length;yi<uc;++yi)St[yi]=Es[yi],st[Es.charCodeAt(yi)]=yi;var yi,uc;st["-".charCodeAt(0)]=62;st["_".charCodeAt(0)]=63;function Ml(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Yd(i){var e=Ml(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Xd(i,e,t){return(e+t)*3/4-t}function ep(i){var e,t=Ml(i),r=t[0],n=t[1],a=new Jd(Xd(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=st[i.charCodeAt(l)]<<18|st[i.charCodeAt(l+1)]<<12|st[i.charCodeAt(l+2)]<<6|st[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=st[i.charCodeAt(l)]<<2|st[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=st[i.charCodeAt(l)]<<10|st[i.charCodeAt(l+1)]<<4|st[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function tp(i){return St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}function ip(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(tp(r));return n.join("")}function rp(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(ip(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(St[e>>2]+St[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(St[e>>10]+St[e>>4&63]+St[e<<2&63]+"=")),n.join("")}var np=4,dc=0,pc=1,ap=2;function Tr(i){let e=i.length;for(;--e>=0;)i[e]=0}var sp=0,Ul=1,op=2,cp=3,lp=258,go=29,Cn=256,bn=Cn+1+go,hr=30,mo=19,Fl=2*bn+1,Ii=15,xs=16,up=7,yo=256,jl=16,Bl=17,ql=18,Js=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ya=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),dp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pp=512,Dt=new Array((bn+2)*2);Tr(Dt);var dn=new Array(hr*2);Tr(dn);var wn=new Array(pp);Tr(wn);var Sn=new Array(lp-cp+1);Tr(Sn);var vo=new Array(go);Tr(vo);var Pa=new Array(hr);Tr(Pa);function $s(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var Vl,zl,Wl;function As(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Kl=i=>i<256?wn[i]:wn[256+(i>>>7)],_n=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Qe=(i,e,t)=>{i.bi_valid>xs-t?(i.bi_buf|=e<<i.bi_valid&65535,_n(i,i.bi_buf),i.bi_buf=e>>xs-i.bi_valid,i.bi_valid+=t-xs):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},_t=(i,e,t)=>{Qe(i,t[e*2],t[e*2+1])},Ql=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},fp=i=>{i.bi_valid===16?(_n(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},hp=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,m,y,d,p,f=0;for(y=0;y<=Ii;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<Fl;c++)u=i.heap[c],y=t[t[u*2+1]*2+1]+1,y>l&&(y=l,f++),t[u*2+1]=y,!(u>r)&&(i.bl_count[y]++,d=0,u>=o&&(d=s[u-o]),p=t[u*2],i.opt_len+=p*(y+d),a&&(i.static_len+=p*(n[u*2+1]+d)));if(f!==0){do{for(y=l-1;i.bl_count[y]===0;)y--;i.bl_count[y]--,i.bl_count[y+1]+=2,i.bl_count[l]--,f-=2}while(f>0);for(y=l;y!==0;y--)for(u=i.bl_count[y];u!==0;)m=i.heap[--c],!(m>r)&&(t[m*2+1]!==y&&(i.opt_len+=(y-t[m*2+1])*t[m*2],t[m*2+1]=y),u--)}},Gl=(i,e,t)=>{let r=new Array(Ii+1),n=0,a,s;for(a=1;a<=Ii;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=Ql(r[o]++,o))}},gp=()=>{let i,e,t,r,n,a=new Array(Ii+1);for(t=0,r=0;r<go-1;r++)for(vo[r]=t,i=0;i<1<<Js[r];i++)Sn[t++]=r;for(Sn[t-1]=r,n=0,r=0;r<16;r++)for(Pa[r]=n,i=0;i<1<<ya[r];i++)wn[n++]=r;for(n>>=7;r<hr;r++)for(Pa[r]=n<<7,i=0;i<1<<ya[r]-7;i++)wn[256+n++]=r;for(e=0;e<=Ii;e++)a[e]=0;for(i=0;i<=143;)Dt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Dt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Dt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Dt[i*2+1]=8,i++,a[8]++;for(Gl(Dt,bn+1,a),i=0;i<hr;i++)dn[i*2+1]=5,dn[i*2]=Ql(i,5);Vl=new $s(Dt,Js,Cn+1,bn,Ii),zl=new $s(dn,ya,0,hr,Ii),Wl=new $s(new Array(0),dp,0,mo,up)},Zl=i=>{let e;for(e=0;e<bn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<hr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<mo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[yo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Jl=i=>{i.bi_valid>8?_n(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},fc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},ks=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&fc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!fc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},hc=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?_t(i,n,e):(s=Sn[n],_t(i,s+Cn+1,e),o=Js[s],o!==0&&(n-=vo[s],Qe(i,n,o)),r--,s=Kl(r),_t(i,s,t),o=ya[s],o!==0&&(r-=Pa[s],Qe(i,r,o)));while(a<i.sym_next);_t(i,yo,e)},Ys=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,l=-1,c;for(i.heap_len=0,i.heap_max=Fl,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=l=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,t[c*2]=1,i.depth[c]=0,i.opt_len--,n&&(i.static_len-=r[c*2+1]);for(e.max_code=l,s=i.heap_len>>1;s>=1;s--)ks(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],ks(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[c*2]=t[s*2]+t[o*2],i.depth[c]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=c,i.heap[1]=c++,ks(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],hp(i,e),Gl(t,l,i.bl_count)},gc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)&&(o<c?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[jl*2]++):o<=10?i.bl_tree[Bl*2]++:i.bl_tree[ql*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},mc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)){if(o<c)do _t(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(_t(i,a,i.bl_tree),o--),_t(i,jl,i.bl_tree),Qe(i,o-3,2)):o<=10?(_t(i,Bl,i.bl_tree),Qe(i,o-3,3)):(_t(i,ql,i.bl_tree),Qe(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},mp=i=>{let e;for(gc(i,i.dyn_ltree,i.l_desc.max_code),gc(i,i.dyn_dtree,i.d_desc.max_code),Ys(i,i.bl_desc),e=mo-1;e>=3&&i.bl_tree[Hl[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},yp=(i,e,t,r)=>{let n;for(Qe(i,e-257,5),Qe(i,t-1,5),Qe(i,r-4,4),n=0;n<r;n++)Qe(i,i.bl_tree[Hl[n]*2+1],3);mc(i,i.dyn_ltree,e-1),mc(i,i.dyn_dtree,t-1)},vp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return dc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return pc;for(t=32;t<Cn;t++)if(i.dyn_ltree[t*2]!==0)return pc;return dc},yc=!1,bp=i=>{yc||(gp(),yc=!0),i.l_desc=new As(i.dyn_ltree,Vl),i.d_desc=new As(i.dyn_dtree,zl),i.bl_desc=new As(i.bl_tree,Wl),i.bi_buf=0,i.bi_valid=0,Zl(i)},Yl=(i,e,t,r)=>{Qe(i,(sp<<1)+(r?1:0),3),Jl(i),_n(i,t),_n(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},wp=i=>{Qe(i,Ul<<1,3),_t(i,yo,Dt),fp(i)},Sp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===ap&&(i.strm.data_type=vp(i)),Ys(i,i.l_desc),Ys(i,i.d_desc),s=mp(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Yl(i,e,t,r):i.strategy===np||a===n?(Qe(i,(Ul<<1)+(r?1:0),3),hc(i,Dt,dn)):(Qe(i,(op<<1)+(r?1:0),3),yp(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),hc(i,i.dyn_ltree,i.dyn_dtree)),Zl(i),r&&Jl(i)},_p=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(Sn[t]+Cn+1)*2]++,i.dyn_dtree[Kl(e)*2]++),i.sym_next===i.sym_end),Ep=bp,xp=Yl,$p=Sp,Ap=_p,kp=wp,Ip={_tr_init:Ep,_tr_stored_block:xp,_tr_flush_block:$p,_tr_tally:Ap,_tr_align:kp},Tp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},En=Tp,Cp=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},Lp=new Uint32Array(Cp()),Np=(i,e,t,r)=>{let n=Lp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},xe=Np,Ui={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Qi={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Rp,_tr_stored_block:Xs,_tr_flush_block:Pp,_tr_tally:Yt,_tr_align:Op}=Ip,{Z_NO_FLUSH:Xt,Z_PARTIAL_FLUSH:Dp,Z_FULL_FLUSH:Mp,Z_FINISH:ct,Z_BLOCK:vc,Z_OK:Te,Z_STREAM_END:bc,Z_STREAM_ERROR:$t,Z_DATA_ERROR:Up,Z_BUF_ERROR:Is,Z_DEFAULT_COMPRESSION:Fp,Z_FILTERED:jp,Z_HUFFMAN_ONLY:Xn,Z_RLE:Bp,Z_FIXED:qp,Z_DEFAULT_STRATEGY:Hp,Z_UNKNOWN:Vp,Z_DEFLATED:Za}=Qi,zp=9,Wp=15,Kp=8,Qp=29,Gp=256,eo=Gp+1+Qp,Zp=30,Jp=19,Yp=2*eo+1,Xp=15,X=3,Qt=258,At=Qt+X+1,ef=32,br=42,bo=57,to=69,io=73,ro=91,no=103,Ti=113,rn=666,je=1,Cr=2,Fi=3,Lr=4,tf=3,Ci=(i,e)=>(i.msg=Ui[e],e),wc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},rf=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},nf=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ei=nf,Ye=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},et=(i,e)=>{Pp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ye(i.strm)},ne=(i,e)=>{i.pending_buf[i.pending++]=e},Br=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},ao=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=En(i.adler,e,n,t):i.state.wrap===2&&(i.adler=xe(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Xl=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,l=i.strstart>i.w_size-At?i.strstart-(i.w_size-At):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+Qt,d=c[r+s-1],p=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==p||c[n+s-1]!==d||c[n]!==c[r]||c[++n]!==c[r+1])){r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&r<y);if(a=Qt-(y-r),r=y-Qt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],p=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},wr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-At)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),rf(i),r+=e),i.strm.avail_in===0)break;if(t=ao(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=X)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=ei(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ei(i,i.ins_h,i.window[n+X-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<X)););}while(i.lookahead<At&&i.strm.avail_in!==0)},eu=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==ct||e===Xt||r!==n+i.strm.avail_in)))break;s=e===ct&&r===n+i.strm.avail_in?1:0,Xs(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Ye(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(ao(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?Lr:e!==Xt&&e!==ct&&i.strm.avail_in===0&&i.strstart===i.block_start?Cr:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(ao(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===ct)&&e!==Xt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ct&&i.strm.avail_in===0&&r===n?1:0,Xs(i,i.block_start,r,s),i.block_start+=r,Ye(i.strm)),s?Fi:je)},Ts=(i,e)=>{let t,r;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-At&&(i.match_length=Xl(i,t)),i.match_length>=X)if(r=Yt(i,i.strstart-i.match_start,i.match_length-X),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=X){i.match_length--;do i.strstart++,i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=ei(i,i.ins_h,i.window[i.strstart+1]);else r=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=i.strstart<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},cr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=X-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-At&&(i.match_length=Xl(i,t),i.match_length<=5&&(i.strategy===jp||i.match_length===X&&i.strstart-i.match_start>4096)&&(i.match_length=X-1)),i.prev_length>=X&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-X,r=Yt(i,i.strstart-1-i.prev_match,i.prev_length-X),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=X-1,i.strstart++,r&&(et(i,!1),i.strm.avail_out===0))return je}else if(i.match_available){if(r=Yt(i,0,i.window[i.strstart-1]),r&&et(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return je}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Yt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},af=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Qt){if(wr(i),i.lookahead<=Qt&&e===Xt)return je;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=X&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Qt;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=Qt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=X?(t=Yt(i,1,i.match_length-X),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},sf=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(wr(i),i.lookahead===0)){if(e===Xt)return je;break}if(i.match_length=0,t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr};function mt(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var nn=[new mt(0,0,0,0,eu),new mt(4,4,8,4,Ts),new mt(4,5,16,8,Ts),new mt(4,6,32,32,Ts),new mt(4,4,16,16,cr),new mt(8,16,32,32,cr),new mt(8,16,128,128,cr),new mt(8,32,128,256,cr),new mt(32,128,258,1024,cr),new mt(32,258,258,4096,cr)],of=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=nn[i.level].max_lazy,i.good_match=nn[i.level].good_length,i.nice_match=nn[i.level].nice_length,i.max_chain_length=nn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=X-1,i.match_available=0,i.ins_h=0};function cf(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Za,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Yp*2),this.dyn_dtree=new Uint16Array((2*Zp+1)*2),this.bl_tree=new Uint16Array((2*Jp+1)*2),Kt(this.dyn_ltree),Kt(this.dyn_dtree),Kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Xp+1),this.heap=new Uint16Array(2*eo+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*eo+1),Kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ln=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==br&&e.status!==bo&&e.status!==to&&e.status!==io&&e.status!==ro&&e.status!==no&&e.status!==Ti&&e.status!==rn?1:0},tu=i=>{if(Ln(i))return Ci(i,$t);i.total_in=i.total_out=0,i.data_type=Vp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?bo:e.wrap?br:Ti,i.adler=e.wrap===2?0:1,e.last_flush=-2,Rp(e),Te},iu=i=>{let e=tu(i);return e===Te&&of(i.state),e},lf=(i,e)=>Ln(i)||i.state.wrap!==2?$t:(i.state.gzhead=e,Te),ru=(i,e,t,r,n,a)=>{if(!i)return $t;let s=1;if(e===Fp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>zp||t!==Za||r<8||r>15||e<0||e>9||a<0||a>qp||r===8&&s!==1)return Ci(i,$t);r===8&&(r=9);let o=new cf;return i.state=o,o.strm=i,o.status=br,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+X-1)/X),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,iu(i)},uf=(i,e)=>ru(i,e,Za,Wp,Kp,Hp),df=(i,e)=>{if(Ln(i)||e>vc||e<0)return i?Ci(i,$t):$t;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===rn&&e!==ct)return Ci(i,i.avail_out===0?Is:$t);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ye(i),i.avail_out===0)return t.last_flush=-1,Te}else if(i.avail_in===0&&wc(e)<=wc(r)&&e!==ct)return Ci(i,Is);if(t.status===rn&&i.avail_in!==0)return Ci(i,Is);if(t.status===br&&t.wrap===0&&(t.status=Ti),t.status===br){let n=Za+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Xn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=ef),n+=31-n%31,Br(t,n),t.strstart!==0&&(Br(t,i.adler>>>16),Br(t,i.adler&65535)),i.adler=1,t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===bo){if(i.adler=0,ne(t,31),ne(t,139),ne(t,8),t.gzhead)ne(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),ne(t,t.gzhead.time&255),ne(t,t.gzhead.time>>8&255),ne(t,t.gzhead.time>>16&255),ne(t,t.gzhead.time>>24&255),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ne(t,t.gzhead.extra.length&255),ne(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=xe(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=to;else if(ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,tf),t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===to){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=io}if(t.status===io){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ne(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ro}if(t.status===ro){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ne(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n))}t.status=no}if(t.status===no){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ye(i),t.pending!==0))return t.last_flush=-1,Te;ne(t,i.adler&255),ne(t,i.adler>>8&255),i.adler=0}if(t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(i.avail_in!==0||t.lookahead!==0||e!==Xt&&t.status!==rn){let n=t.level===0?eu(t,e):t.strategy===Xn?sf(t,e):t.strategy===Bp?af(t,e):nn[t.level].func(t,e);if((n===Fi||n===Lr)&&(t.status=rn),n===je||n===Fi)return i.avail_out===0&&(t.last_flush=-1),Te;if(n===Cr&&(e===Dp?Op(t):e!==vc&&(Xs(t,0,0,!1),e===Mp&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ye(i),i.avail_out===0))return t.last_flush=-1,Te}return e!==ct?Te:t.wrap<=0?bc:(t.wrap===2?(ne(t,i.adler&255),ne(t,i.adler>>8&255),ne(t,i.adler>>16&255),ne(t,i.adler>>24&255),ne(t,i.total_in&255),ne(t,i.total_in>>8&255),ne(t,i.total_in>>16&255),ne(t,i.total_in>>24&255)):(Br(t,i.adler>>>16),Br(t,i.adler&65535)),Ye(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Te:bc)},pf=i=>{if(Ln(i))return $t;let e=i.state.status;return i.state=null,e===Ti?Ci(i,Up):Te},ff=(i,e)=>{let t=e.length;if(Ln(i))return $t;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==br||r.lookahead)return $t;if(n===1&&(i.adler=En(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Kt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(t-r.w_size,t),0),e=l,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,wr(r);r.lookahead>=X;){let l=r.strstart,c=r.lookahead-(X-1);do r.ins_h=ei(r,r.ins_h,r.window[l+X-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=X-1,wr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=X-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Te},hf=uf,gf=ru,mf=iu,yf=tu,vf=lf,bf=df,wf=pf,Sf=ff,_f="pako deflate (from Nodeca project)",pn={deflateInit:hf,deflateInit2:gf,deflateReset:mf,deflateResetKeep:yf,deflateSetHeader:vf,deflate:bf,deflateEnd:wf,deflateSetDictionary:Sf,deflateInfo:_f},Ef=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),xf=function(i){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let r in t)Ef(t,r)&&(i[r]=t[r])}}return i},$f=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},Ja={assign:xf,flattenChunks:$f},nu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){nu=!1}var xn=new Uint8Array(256);for(let i=0;i<256;i++)xn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;xn[254]=xn[254]=1;var Af=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},kf=(i,e)=>{if(e<65534&&i.subarray&&nu)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},If=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=xn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return kf(a,n)},Tf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+xn[i[t]]>e?t:e},$n={string2buf:Af,buf2string:If,utf8border:Tf};function Cf(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var au=Cf,su=Object.prototype.toString,{Z_NO_FLUSH:Lf,Z_SYNC_FLUSH:Nf,Z_FULL_FLUSH:Rf,Z_FINISH:Pf,Z_OK:Oa,Z_STREAM_END:Of,Z_DEFAULT_COMPRESSION:Df,Z_DEFAULT_STRATEGY:Mf,Z_DEFLATED:Uf}=Qi;function Nn(i){this.options=Ja.assign({level:Df,method:Uf,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mf},i||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new au,this.strm.avail_out=0;let t=pn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Oa)throw new Error(Ui[t]);if(e.header&&pn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=$n.string2buf(e.dictionary):su.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=pn.deflateSetDictionary(this.strm,r),t!==Oa)throw new Error(Ui[t]);this._dict_set=!0}}Nn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?Pf:Lf,typeof i=="string"?t.input=$n.string2buf(i):su.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===Nf||a===Rf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=pn.deflate(t,a),n===Of)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=pn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Oa;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Nn.prototype.onData=function(i){this.chunks.push(i)};Nn.prototype.onEnd=function(i){i===Oa&&(this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function wo(i,e){let t=new Nn(e);if(t.push(i,!0),t.err)throw t.msg||Ui[t.err];return t.result}function Ff(i,e){return e=e||{},e.raw=!0,wo(i,e)}function jf(i,e){return e=e||{},e.gzip=!0,wo(i,e)}var Bf=Nn,qf=wo,Hf=Ff,Vf=jf,zf=Qi,Wf={Deflate:Bf,deflate:qf,deflateRaw:Hf,gzip:Vf,constants:zf},ea=16209,Kf=16191,Qf=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,p,f,S,E,A,k,b,T,R,C,Q,V,L,W=e.state;r=e.next_in,V=e.input,n=r+(e.avail_in-5),a=e.next_out,L=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=W.dmax,c=W.wsize,u=W.whave,m=W.wnext,y=W.window,d=W.hold,p=W.bits,f=W.lencode,S=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=f[d&E];t:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b===0)L[a++]=k&65535;else if(b&16){T=k&65535,b&=15,b&&(p<b&&(d+=V[r++]<<p,p+=8),T+=d&(1<<b)-1,d>>>=b,p-=b),p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=S[d&A];i:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b&16){if(R=k&65535,b&=15,p<b&&(d+=V[r++]<<p,p+=8,p<b&&(d+=V[r++]<<p,p+=8)),R+=d&(1<<b)-1,R>l){e.msg="invalid distance too far back",W.mode=ea;break e}if(d>>>=b,p-=b,b=a-s,R>b){if(b=R-b,b>u&&W.sane){e.msg="invalid distance too far back",W.mode=ea;break e}if(C=0,Q=y,m===0){if(C+=c-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}else if(m<b){if(C+=c+m-b,b-=m,b<T){T-=b;do L[a++]=y[C++];while(--b);if(C=0,m<T){b=m,T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}}else if(C+=m-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}for(;T>2;)L[a++]=Q[C++],L[a++]=Q[C++],L[a++]=Q[C++],T-=3;T&&(L[a++]=Q[C++],T>1&&(L[a++]=Q[C++]))}else{C=a-R;do L[a++]=L[C++],L[a++]=L[C++],L[a++]=L[C++],T-=3;while(T>2);T&&(L[a++]=L[C++],T>1&&(L[a++]=L[C++]))}}else if((b&64)===0){k=S[(k&65535)+(d&(1<<b)-1)];continue i}else{e.msg="invalid distance code",W.mode=ea;break e}break}}else if((b&64)===0){k=f[(k&65535)+(d&(1<<b)-1)];continue t}else if(b&32){W.mode=Kf;break e}else{e.msg="invalid literal/length code",W.mode=ea;break e}break}}while(r<n&&a<o);T=p>>3,r-=T,p-=T<<3,d&=(1<<p)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),W.hold=d,W.bits=p},lr=15,Sc=852,_c=592,Ec=0,Cs=1,xc=2,Gf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Zf=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Jf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Yf=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Xf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,p=0,f=0,S=0,E=0,A=0,k,b,T,R,C,Q=null,V,L=new Uint16Array(lr+1),W=new Uint16Array(lr+1),He=null,Rr,I,On;for(c=0;c<=lr;c++)L[c]=0;for(u=0;u<r;u++)L[e[t+u]]++;for(d=l,y=lr;y>=1&&L[y]===0;y--);if(d>y&&(d=y),y===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<y&&L[m]===0;m++);for(d<m&&(d=m),S=1,c=1;c<=lr;c++)if(S<<=1,S-=L[c],S<0)return-1;if(S>0&&(i===Ec||y!==1))return-1;for(W[1]=0,c=1;c<lr;c++)W[c+1]=W[c]+L[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[W[e[t+u]]++]=u);if(i===Ec?(Q=He=s,V=20):i===Cs?(Q=Gf,He=Zf,V=257):(Q=Jf,He=Yf,V=0),A=0,u=0,c=m,C=a,p=d,f=0,T=-1,E=1<<d,R=E-1,i===Cs&&E>Sc||i===xc&&E>_c)return 1;for(;;){Rr=c-f,s[u]+1<V?(I=0,On=s[u]):s[u]>=V?(I=He[s[u]-V],On=Q[s[u]-V]):(I=32+64,On=0),k=1<<c-f,b=1<<p,m=b;do b-=k,n[C+(A>>f)+b]=Rr<<24|I<<16|On|0;while(b!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,u++,--L[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&R)!==T){for(f===0&&(f=d),C+=m,p=c-f,S=1<<p;p+f<y&&(S-=L[p+f],!(S<=0));)p++,S<<=1;if(E+=1<<p,i===Cs&&E>Sc||i===xc&&E>_c)return 1;T=A&R,n[T]=d<<24|p<<16|C-a|0}}return A!==0&&(n[C+A]=c-f<<24|64<<16|0),o.bits=d,0},fn=Xf,eh=0,ou=1,cu=2,{Z_FINISH:$c,Z_BLOCK:th,Z_TREES:ta,Z_OK:ji,Z_STREAM_END:ih,Z_NEED_DICT:rh,Z_STREAM_ERROR:lt,Z_DATA_ERROR:lu,Z_MEM_ERROR:uu,Z_BUF_ERROR:nh,Z_DEFLATED:Ac}=Qi,Ya=16180,kc=16181,Ic=16182,Tc=16183,Cc=16184,Lc=16185,Nc=16186,Rc=16187,Pc=16188,Oc=16189,Da=16190,Nt=16191,Ls=16192,Dc=16193,Ns=16194,Mc=16195,Uc=16196,Fc=16197,jc=16198,ia=16199,ra=16200,Bc=16201,qc=16202,Hc=16203,Vc=16204,zc=16205,Rs=16206,Wc=16207,Kc=16208,de=16209,du=16210,pu=16211,ah=852,sh=592,oh=15,ch=oh,Qc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function lh(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Gi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Ya||e.mode>pu?1:0},fu=i=>{if(Gi(i))return lt;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Ya,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(ah),e.distcode=e.distdyn=new Int32Array(sh),e.sane=1,e.back=-1,ji},hu=i=>{if(Gi(i))return lt;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,fu(i)},gu=(i,e)=>{let t;if(Gi(i))return lt;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?lt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,hu(i))},mu=(i,e)=>{if(!i)return lt;let t=new lh;i.state=t,t.strm=i,t.window=null,t.mode=Ya;let r=gu(i,e);return r!==ji&&(i.state=null),r},uh=i=>mu(i,ch),Gc=!0,Ps,Os,dh=i=>{if(Gc){Ps=new Int32Array(512),Os=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(fn(ou,i.lens,0,288,Ps,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;fn(cu,i.lens,0,32,Os,0,i.work,{bits:5}),Gc=!1}i.lencode=Ps,i.lenbits=9,i.distcode=Os,i.distbits=5},yu=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},ph=(i,e)=>{let t,r,n,a,s,o,l,c,u,m,y,d,p,f,S=0,E,A,k,b,T,R,C,Q,V=new Uint8Array(4),L,W,He=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Gi(i)||!i.output||!i.input&&i.avail_in!==0)return lt;t=i.state,t.mode===Nt&&(t.mode=Ls),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,m=o,y=l,Q=ji;e:for(;;)switch(t.mode){case Ya:if(t.wrap===0){t.mode=Ls;break}for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0),c=0,u=0,t.mode=kc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=de;break}if((c&15)!==Ac){i.msg="unknown compression method",t.mode=de;break}if(c>>>=4,u-=4,C=(c&15)+8,t.wbits===0&&(t.wbits=C),C>15||C>t.wbits){i.msg="invalid window size",t.mode=de;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Oc:Nt,c=0,u=0;break;case kc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==Ac){i.msg="unknown compression method",t.mode=de;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=de;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Ic;case Ic:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,V[2]=c>>>16&255,V[3]=c>>>24&255,t.check=xe(t.check,V,4,0)),c=0,u=0,t.mode=Tc;case Tc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Cc;case Cc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Lc;case Lc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(C=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),C)),t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Nc;case Nc:if(t.flags&2048){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.name+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Rc;case Rc:if(t.flags&4096){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.comment+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.comment=null);t.mode=Pc;case Pc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=de;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Nt;break;case Oc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=Qc(c),c=0,u=0,t.mode=Da;case Da:if(t.havedict===0)return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,rh;i.adler=t.check=1,t.mode=Nt;case Nt:if(e===th||e===ta)break e;case Ls:if(t.last){c>>>=u&7,u-=u&7,t.mode=Rs;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=Dc;break;case 1:if(dh(t),t.mode=ia,e===ta){c>>>=2,u-=2;break e}break;case 2:t.mode=Uc;break;case 3:i.msg="invalid block type",t.mode=de}c>>>=2,u-=2;break;case Dc:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=de;break}if(t.length=c&65535,c=0,u=0,t.mode=Ns,e===ta)break e;case Ns:t.mode=Mc;case Mc:if(d=t.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,t.length-=d;break}t.mode=Nt;break;case Uc:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=4,u-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=de;break}t.have=0,t.mode=Fc;case Fc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[He[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[He[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,L={bits:t.lenbits},Q=fn(eh,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid code lengths set",t.mode=de;break}t.have=0,t.mode=jc;case jc:for(;t.have<t.nlen+t.ndist;){for(;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(k<16)c>>>=E,u-=E,t.lens[t.have++]=k;else{if(k===16){for(W=E+2;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=de;break}C=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(k===17){for(W=E+3;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=0,d=3+(c&7),c>>>=3,u-=3}else{for(W=E+7;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=0,d=11+(c&127),c>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=de;break}for(;d--;)t.lens[t.have++]=C}}if(t.mode===de)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=de;break}if(t.lenbits=9,L={bits:t.lenbits},Q=fn(ou,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid literal/lengths set",t.mode=de;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},Q=fn(cu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,Q){i.msg="invalid distances set",t.mode=de;break}if(t.mode=ia,e===ta)break e;case ia:t.mode=ra;case ra:if(o>=6&&l>=258){i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,Qf(i,y),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,t.mode===Nt&&(t.back=-1);break}for(t.back=0;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(b=E,T=A,R=k;S=t.lencode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,t.length=k,A===0){t.mode=zc;break}if(A&32){t.back=-1,t.mode=Nt;break}if(A&64){i.msg="invalid literal/length code",t.mode=de;break}t.extra=A&15,t.mode=Bc;case Bc:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=qc;case qc:for(;S=t.distcode[c&(1<<t.distbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(b=E,T=A,R=k;S=t.distcode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,A&64){i.msg="invalid distance code",t.mode=de;break}t.offset=k,t.extra=A&15,t.mode=Hc;case Hc:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=de;break}t.mode=Vc;case Vc:if(l===0)break e;if(d=y-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=de;break}d>t.wnext?(d-=t.wnext,p=t.wsize-d):p=t.wnext-d,d>t.length&&(d=t.length),f=t.window}else f=n,p=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=f[p++];while(--d);t.length===0&&(t.mode=ra);break;case zc:if(l===0)break e;n[s++]=t.length,l--,t.mode=ra;break;case Rs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(y-=l,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,s-y):En(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:Qc(c))!==t.check){i.msg="incorrect data check",t.mode=de;break}c=0,u=0}t.mode=Wc;case Wc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=de;break}c=0,u=0}t.mode=Kc;case Kc:Q=ih;break e;case de:Q=lu;break e;case du:return uu;case pu:default:return lt}return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,(t.wsize||y!==i.avail_out&&t.mode<de&&(t.mode<Rs||e!==$c))&&yu(i,i.output,i.next_out,y-i.avail_out),m-=i.avail_in,y-=i.avail_out,i.total_in+=m,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,i.next_out-y):En(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Nt?128:0)+(t.mode===ia||t.mode===Ns?256:0),(m===0&&y===0||e===$c)&&Q===ji&&(Q=nh),Q},fh=i=>{if(Gi(i))return lt;let e=i.state;return e.window&&(e.window=null),i.state=null,ji},hh=(i,e)=>{if(Gi(i))return lt;let t=i.state;return(t.wrap&2)===0?lt:(t.head=e,e.done=!1,ji)},gh=(i,e)=>{let t=e.length,r,n,a;return Gi(i)||(r=i.state,r.wrap!==0&&r.mode!==Da)?lt:r.mode===Da&&(n=1,n=En(n,e,t,0),n!==r.check)?lu:(a=yu(i,e,t,t),a?(r.mode=du,uu):(r.havedict=1,ji))},mh=hu,yh=gu,vh=fu,bh=uh,wh=mu,Sh=ph,_h=fh,Eh=hh,xh=gh,$h="pako inflate (from Nodeca project)",Mt={inflateReset:mh,inflateReset2:yh,inflateResetKeep:vh,inflateInit:bh,inflateInit2:wh,inflate:Sh,inflateEnd:_h,inflateGetHeader:Eh,inflateSetDictionary:xh,inflateInfo:$h};function Ah(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var kh=Ah,vu=Object.prototype.toString,{Z_NO_FLUSH:Ih,Z_FINISH:Th,Z_OK:An,Z_STREAM_END:Ds,Z_NEED_DICT:Ms,Z_STREAM_ERROR:Ch,Z_DATA_ERROR:Zc,Z_MEM_ERROR:Lh}=Qi;function Rn(i){this.options=Ja.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new au,this.strm.avail_out=0;let t=Mt.inflateInit2(this.strm,e.windowBits);if(t!==An)throw new Error(Ui[t]);if(this.header=new kh,Mt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=$n.string2buf(e.dictionary):vu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Mt.inflateSetDictionary(this.strm,e.dictionary),t!==An)))throw new Error(Ui[t])}Rn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?Th:Ih,vu.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Mt.inflate(t,s),a===Ms&&n&&(a=Mt.inflateSetDictionary(t,n),a===An?a=Mt.inflate(t,s):a===Zc&&(a=Ms));t.avail_in>0&&a===Ds&&t.state.wrap>0&&i[t.next_in]!==0;)Mt.inflateReset(t),a=Mt.inflate(t,s);switch(a){case Ch:case Zc:case Ms:case Lh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Ds))if(this.options.to==="string"){let l=$n.utf8border(t.output,t.next_out),c=t.next_out-l,u=$n.buf2string(t.output,l);t.next_out=c,t.avail_out=r-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===An&&o===0)){if(a===Ds)return a=Mt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Rn.prototype.onData=function(i){this.chunks.push(i)};Rn.prototype.onEnd=function(i){i===An&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function So(i,e){let t=new Rn(e);if(t.push(i),t.err)throw t.msg||Ui[t.err];return t.result}function Nh(i,e){return e=e||{},e.raw=!0,So(i,e)}var Rh=Rn,Ph=So,Oh=Nh,Dh=So,Mh=Qi,Uh={Inflate:Rh,inflate:Ph,inflateRaw:Oh,ungzip:Dh,constants:Mh},{Deflate:Fh,deflate:jh,deflateRaw:Bh,gzip:qh}=Wf,{Inflate:Hh,inflate:Vh,inflateRaw:zh,ungzip:Wh}=Uh,Kh=Fh,Qh=jh,Gh=Bh,Zh=qh,Jh=Hh,Yh=Vh,Xh=zh,eg=Wh,tg=Qi,ig={Deflate:Kh,deflate:Qh,deflateRaw:Gh,gzip:Zh,Inflate:Jh,inflate:Yh,inflateRaw:Xh,ungzip:eg,constants:tg},ce=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},le=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ma.prototype,"input",void 0);ce([h(),le("design:type",String)],Ma.prototype,"output",void 0);Ma=ce([Ae(),le("design:paramtypes",[String,String])],Ma);var Ua=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ua.prototype,"input",void 0);ce([h(),le("design:type",String)],Ua.prototype,"output",void 0);Ua=ce([F(),le("design:paramtypes",[String,String])],Ua);var ni=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ce([h(),le("design:type",String)],ni.prototype,"name",void 0);ce([h(),le("design:type",String)],ni.prototype,"modelId",void 0);ce([h(),le("design:type",String)],ni.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],ni.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],ni.prototype,"metaData",void 0);ni=ce([Ae(),le("design:paramtypes",[String,String,String,Array,String])],ni);var Tt=class{constructor(e,t,r,n,a,s,o,l){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=l}};ce([h(),le("design:type",String)],Tt.prototype,"name",void 0);ce([h(),le("design:type",String)],Tt.prototype,"modelId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"taskId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],Tt.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],Tt.prototype,"metaData",void 0);ce([h(),le("design:type",String)],Tt.prototype,"createdAt",void 0);ce([h(),le("design:type",String)],Tt.prototype,"updatedAt",void 0);Tt=ce([F(),le("design:paramtypes",[String,String,String,String,Array,String,String,String])],Tt);var Bi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ce([h(),le("design:type",String)],Bi.prototype,"model",void 0);ce([h(),le("design:type",String)],Bi.prototype,"status",void 0);ce([h(),le("design:type",Number)],Bi.prototype,"progress",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"downloaded",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"loaded",void 0);Bi=ce([F(),le("design:paramtypes",[String,String,Number,Boolean,Boolean])],Bi);var rg=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Se=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},be,va,so=class{constructor(e,t=!0){be.set(this,void 0),va.set(this,new Map),rg(this,be,e,"f")}async getModels(){let e=await Se(this,be,"f").query({query:v`
|
|
1172
1185
|
query {
|
|
1173
1186
|
aiGetModels {
|
|
1174
1187
|
id
|
|
@@ -1192,23 +1205,23 @@ triggerMatch
|
|
|
1192
1205
|
modelType
|
|
1193
1206
|
}
|
|
1194
1207
|
}
|
|
1195
|
-
`});return
|
|
1208
|
+
`});return w(e).aiGetModels}async addModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
|
|
1196
1209
|
mutation($model: ModelInput!) {
|
|
1197
1210
|
aiAddModel(model: $model)
|
|
1198
1211
|
}
|
|
1199
|
-
`,variables:{model:e}});return
|
|
1212
|
+
`,variables:{model:e}});return w(t).aiAddModel}async updateModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
|
|
1200
1213
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
1201
1214
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
1202
1215
|
}
|
|
1203
|
-
`,variables:{modelId:e,model:t}});return
|
|
1216
|
+
`,variables:{modelId:e,model:t}});return w(r).aiUpdateModel}async removeModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
|
|
1204
1217
|
mutation($modelId: String!) {
|
|
1205
1218
|
aiRemoveModel(modelId: $modelId)
|
|
1206
1219
|
}
|
|
1207
|
-
`,variables:{modelId:e}});return
|
|
1220
|
+
`,variables:{modelId:e}});return w(t).aiRemoveModel}async setDefaultModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
|
|
1208
1221
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
1209
1222
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
1210
1223
|
}
|
|
1211
|
-
`,variables:{modelId:t,modelType:e}});return
|
|
1224
|
+
`,variables:{modelId:t,modelType:e}});return w(r).aiSetDefaultModel}async getDefaultModel(e){let t=await Se(this,be,"f").query({query:v`
|
|
1212
1225
|
query($modelType: ModelType!) {
|
|
1213
1226
|
aiGetDefaultModel(modelType: $modelType) {
|
|
1214
1227
|
id
|
|
@@ -1232,7 +1245,7 @@ triggerMatch
|
|
|
1232
1245
|
modelType
|
|
1233
1246
|
}
|
|
1234
1247
|
}
|
|
1235
|
-
`,variables:{modelType:e}});return
|
|
1248
|
+
`,variables:{modelType:e}});return w(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=w(await Se(this,be,"f").query({query:v`
|
|
1236
1249
|
query {
|
|
1237
1250
|
aiTasks {
|
|
1238
1251
|
name
|
|
@@ -1248,7 +1261,7 @@ triggerMatch
|
|
|
1248
1261
|
updatedAt
|
|
1249
1262
|
}
|
|
1250
1263
|
}
|
|
1251
|
-
`}));return e}async addTask(e,t,r,n,a){let s=new
|
|
1264
|
+
`}));return e}async addTask(e,t,r,n,a){let s=new ni(e,t,r,n,a),{aiAddTask:o}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1252
1265
|
mutation AiAddTask($task: AITaskInput!) {
|
|
1253
1266
|
aiAddTask(task: $task) {
|
|
1254
1267
|
name
|
|
@@ -1264,7 +1277,7 @@ triggerMatch
|
|
|
1264
1277
|
updatedAt
|
|
1265
1278
|
}
|
|
1266
1279
|
}
|
|
1267
|
-
`,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=
|
|
1280
|
+
`,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1268
1281
|
mutation AiRemoveTask($taskId: String!) {
|
|
1269
1282
|
aiRemoveTask(taskId: $taskId) {
|
|
1270
1283
|
name
|
|
@@ -1280,7 +1293,7 @@ triggerMatch
|
|
|
1280
1293
|
updatedAt
|
|
1281
1294
|
}
|
|
1282
1295
|
}
|
|
1283
|
-
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=
|
|
1296
|
+
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1284
1297
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
1285
1298
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
1286
1299
|
name
|
|
@@ -1296,7 +1309,7 @@ triggerMatch
|
|
|
1296
1309
|
updatedAt
|
|
1297
1310
|
}
|
|
1298
1311
|
}
|
|
1299
|
-
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=
|
|
1312
|
+
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=w(await Se(this,be,"f").query({query:v`
|
|
1300
1313
|
query AiModelLoadingStatus($model: String!) {
|
|
1301
1314
|
aiModelLoadingStatus(model: $model) {
|
|
1302
1315
|
model
|
|
@@ -1306,29 +1319,83 @@ triggerMatch
|
|
|
1306
1319
|
downloaded
|
|
1307
1320
|
}
|
|
1308
1321
|
}
|
|
1309
|
-
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=
|
|
1322
|
+
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1310
1323
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
1311
1324
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
1312
1325
|
}
|
|
1313
|
-
`,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=
|
|
1326
|
+
`,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1314
1327
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
1315
1328
|
aiEmbed(modelId: $modelId, text: $text)
|
|
1316
1329
|
}
|
|
1317
|
-
`,variables:{modelId:e,text:t}})),n=
|
|
1330
|
+
`,variables:{modelId:e,text:t}})),n=Ga.toByteArray(r);return JSON.parse(ig.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1318
1331
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
1319
1332
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
1320
1333
|
}
|
|
1321
|
-
`,variables:{modelId:e,params:r}})),a=
|
|
1334
|
+
`,variables:{modelId:e,params:r}})),a=Se(this,be,"f").subscribe({query:v` subscription {
|
|
1322
1335
|
aiTranscriptionText(streamId: "${n}")
|
|
1323
|
-
}`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return
|
|
1336
|
+
}`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return Se(this,va,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1324
1337
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
1325
1338
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
1326
1339
|
}
|
|
1327
|
-
`,variables:{streamId:e}})),r=
|
|
1340
|
+
`,variables:{streamId:e}})),r=Se(this,va,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=w(await Se(this,be,"f").mutate({mutation:v`
|
|
1328
1341
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
1329
1342
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
1330
1343
|
}
|
|
1331
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};ve=new WeakMap,fa=new WeakMap;var Ht=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ye=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},bt,ha,rn,ga,nn,Ai,ma,an,Qc=class{constructor(e,t=!0){bt.set(this,void 0),ha.set(this,void 0),rn.set(this,void 0),ga.set(this,void 0),nn.set(this,void 0),Ai.set(this,void 0),ma.set(this,void 0),an.set(this,void 0),Ht(this,bt,e,"f"),Ht(this,ha,new hn(ye(this,bt,"f"),t),"f"),Ht(this,rn,new Ws(ye(this,bt,"f")),"f"),Ht(this,ga,new Vs(ye(this,bt,"f")),"f"),Ht(this,nn,new Hs(ye(this,bt,"f")),"f"),Ht(this,an,new io(ye(this,bt,"f"),t),"f"),Ht(this,Ai,new Ca(ye(this,bt,"f"),t),"f"),ye(this,Ai,"f").setExpressionClient(ye(this,rn,"f")),ye(this,Ai,"f").setNeighbourhoodClient(ye(this,nn,"f")),ye(this,Ai,"f").setAIClient(ye(this,an,"f")),Ht(this,ma,new zs(ye(this,bt,"f"),t),"f")}get agent(){return ye(this,ha,"f")}get expression(){return ye(this,rn,"f")}get languages(){return ye(this,ga,"f")}get neighbourhood(){return ye(this,nn,"f")}get perspective(){return ye(this,Ai,"f")}get runtime(){return ye(this,ma,"f")}get ai(){return ye(this,an,"f")}};bt=new WeakMap,ha=new WeakMap,rn=new WeakMap,ga=new WeakMap,nn=new WeakMap,Ai=new WeakMap,ma=new WeakMap,an=new WeakMap;var ro;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(ro||(ro={}));var vo=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ni=class{constructor(e,t){this.language=e,this.expression=t}};vo([h(),bo("design:type",Et)],Ni.prototype,"language",void 0);vo([h(),bo("design:type",String)],Ni.prototype,"expression",void 0);Ni=vo([V(),bo("design:paramtypes",[Et,String])],Ni);function qy(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function Vy(i){if(i.startsWith("literal://")){let a=new Et;a.address="literal",a.name="literal";let s=i.substring(10);return new Ni(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new Et;return o.address=a,new Ni(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new Et;return a.address="did",new Ni(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var tt=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ct=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Da=class{};tt([h(),Ct("design:type",String)],Da.prototype,"name",void 0);tt([h(),Ct("design:type",String)],Da.prototype,"type",void 0);Da=tt([V()],Da);var En=class{};tt([h(),Ct("design:type",String)],En.prototype,"label",void 0);tt([h(),Ct("design:type",String)],En.prototype,"name",void 0);tt([h(),Ct("design:type",Array)],En.prototype,"parameters",void 0);En=tt([V()],En);var Ma=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};tt([h(),Ct("design:type",String)],Ma.prototype,"name",void 0);tt([h(),Ct("design:type",String)],Ma.prototype,"parametersStringified",void 0);Ma=tt([$e(),Ct("design:paramtypes",[String,Object])],Ma);var Ua=class{};tt([h(),Ct("design:type",String)],Ua.prototype,"did",void 0);tt([h(),Ct("design:type",Di)],Ua.prototype,"status",void 0);Ua=tt([V()],Ua);var Gc=class{},Gi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Cr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},si=class{};Gi([h(),Cr("design:type",String)],si.prototype,"name",void 0);Gi([h(),Cr("design:type",String)],si.prototype,"address",void 0);Gi([h(),Cr("design:type",String)],si.prototype,"settings",void 0);Gi([h(),Cr("design:type",Pi)],si.prototype,"icon",void 0);Gi([h(),Cr("design:type",Pi)],si.prototype,"constructorIcon",void 0);Gi([h(),Cr("design:type",Pi)],si.prototype,"settingsIcon",void 0);si=Gi([V()],si);var Be=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ke=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ft=class{};Be([h(),Ke("design:type",String)],ft.prototype,"name",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"address",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"description",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"author",void 0);Be([h(),Ke("design:type",Boolean)],ft.prototype,"templated",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"templateSourceLanguageAddress",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"templateAppliedParams",void 0);Be([h(),Ke("design:type",Array)],ft.prototype,"possibleTemplateParams",void 0);Be([h(),Ke("design:type",String)],ft.prototype,"sourceCodeLink",void 0);ft=Be([V()],ft);var Sr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};Be([h(),Ke("design:type",String)],Sr.prototype,"name",void 0);Be([h(),Ke("design:type",String)],Sr.prototype,"description",void 0);Be([h(),Ke("design:type",Array)],Sr.prototype,"possibleTemplateParams",void 0);Be([h(),Ke("design:type",String)],Sr.prototype,"sourceCodeLink",void 0);Sr=Be([$e(),Ke("design:paramtypes",[String,String])],Sr);var Zc=class{},Jc=class extends li(){},Yc=class{},Ga=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Ga([h(),wo("design:type",String)],Fa.prototype,"linkLanguage",void 0);Ga([h(),wo("design:type",kt)],Fa.prototype,"meta",void 0);Fa=Ga([V(),wo("design:paramtypes",[String,kt])],Fa);var no=class extends li(){};no=Ga([V()],no);var Zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ji=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ao;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(ao||(ao={}));var oi=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=ao.Private}};Zi([h(),Ji("design:type",String)],oi.prototype,"uuid",void 0);Zi([h(),Ji("design:type",String)],oi.prototype,"name",void 0);Zi([h(),Ji("design:type",String)],oi.prototype,"state",void 0);Zi([h(),Ji("design:type",String)],oi.prototype,"sharedUrl",void 0);Zi([h(),Ji("design:type",no)],oi.prototype,"neighbourhood",void 0);Zi([h(),Ji("design:type",Array)],oi.prototype,"owners",void 0);oi=Zi([V(),Ji("design:paramtypes",[String,String,String])],oi);var Za=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},fu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ja=class{};Za([h(),fu("design:type",Array)],ja.prototype,"additions",void 0);Za([h(),fu("design:type",Array)],ja.prototype,"removals",void 0);ja=Za([V()],ja);var Xc=class extends li(){};Xc=Za([V()],Xc);var el=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},lr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},sn,ki,ea="smart_literal://content";function Kh(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var xn=class{constructor(e,t){sn.set(this,void 0),ki.set(this,void 0),el(this,sn,e,"f"),el(this,ki,t,"f")}get base(){return lr(this,ki,"f")}static async create(e,t){let r=se.from(Kh(10)).toUrl(),n=new xn(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new ie({source:t,predicate:ea}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ie({predicate:ea}))).map(r=>new xn(e,r.data.source))}async get(){let e=await lr(this,sn,"f").getSingleTarget(new ie({source:lr(this,ki,"f"),predicate:ea}));if(!e)throw`No content for smart literal ${lr(this,ki,"f")}`;return se.fromUrl(e).get()}async set(e){let t=se.from(e);await lr(this,sn,"f").setSingleTarget(new ze({source:lr(this,ki,"f"),predicate:ea,target:t.toUrl()}))}};sn=new WeakMap,ki=new WeakMap;var i0=`
|
|
1344
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};be=new WeakMap,va=new WeakMap;var Vt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ve=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},bt,ba,an,wa,sn,$i,Sa,on,Jc=class{constructor(e,t=!0){bt.set(this,void 0),ba.set(this,void 0),an.set(this,void 0),wa.set(this,void 0),sn.set(this,void 0),$i.set(this,void 0),Sa.set(this,void 0),on.set(this,void 0),Vt(this,bt,e,"f"),Vt(this,ba,new vn(ve(this,bt,"f"),t),"f"),Vt(this,an,new Zs(ve(this,bt,"f")),"f"),Vt(this,wa,new Ks(ve(this,bt,"f")),"f"),Vt(this,sn,new Qs(ve(this,bt,"f")),"f"),Vt(this,on,new so(ve(this,bt,"f"),t),"f"),Vt(this,$i,new Ra(ve(this,bt,"f"),t),"f"),ve(this,$i,"f").setExpressionClient(ve(this,an,"f")),ve(this,$i,"f").setNeighbourhoodClient(ve(this,sn,"f")),ve(this,$i,"f").setAIClient(ve(this,on,"f")),Vt(this,Sa,new Gs(ve(this,bt,"f"),t),"f")}get agent(){return ve(this,ba,"f")}get expression(){return ve(this,an,"f")}get languages(){return ve(this,wa,"f")}get neighbourhood(){return ve(this,sn,"f")}get perspective(){return ve(this,$i,"f")}get runtime(){return ve(this,Sa,"f")}get ai(){return ve(this,on,"f")}};bt=new WeakMap,ba=new WeakMap,an=new WeakMap,wa=new WeakMap,sn=new WeakMap,$i=new WeakMap,Sa=new WeakMap,on=new WeakMap;var oo;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(oo||(oo={}));var _o=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Eo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Li=class{constructor(e,t){this.language=e,this.expression=t}};_o([h(),Eo("design:type",Et)],Li.prototype,"language",void 0);_o([h(),Eo("design:type",String)],Li.prototype,"expression",void 0);Li=_o([F(),Eo("design:paramtypes",[Et,String])],Li);function r0(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function n0(i){if(i.startsWith("literal://")){let a=new Et;a.address="literal",a.name="literal";let s=i.substring(10);return new Li(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new Et;return o.address=a,new Li(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new Et;return a.address="did",new Li(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var rt=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ct=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fa=class{};rt([h(),Ct("design:type",String)],Fa.prototype,"name",void 0);rt([h(),Ct("design:type",String)],Fa.prototype,"type",void 0);Fa=rt([F()],Fa);var kn=class{};rt([h(),Ct("design:type",String)],kn.prototype,"label",void 0);rt([h(),Ct("design:type",String)],kn.prototype,"name",void 0);rt([h(),Ct("design:type",Array)],kn.prototype,"parameters",void 0);kn=rt([F()],kn);var ja=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};rt([h(),Ct("design:type",String)],ja.prototype,"name",void 0);rt([h(),Ct("design:type",String)],ja.prototype,"parametersStringified",void 0);ja=rt([Ae(),Ct("design:paramtypes",[String,Object])],ja);var Ba=class{};rt([h(),Ct("design:type",String)],Ba.prototype,"did",void 0);rt([h(),Ct("design:type",Oi)],Ba.prototype,"status",void 0);Ba=rt([F()],Ba);var Yc=class{},Zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Nr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ai=class{};Zi([h(),Nr("design:type",String)],ai.prototype,"name",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"address",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"settings",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"icon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"constructorIcon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"settingsIcon",void 0);ai=Zi([F()],ai);var qe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ze=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ft=class{};qe([h(),Ze("design:type",String)],ft.prototype,"name",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"address",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"description",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"author",void 0);qe([h(),Ze("design:type",Boolean)],ft.prototype,"templated",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateSourceLanguageAddress",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateAppliedParams",void 0);qe([h(),Ze("design:type",Array)],ft.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"sourceCodeLink",void 0);ft=qe([F()],ft);var Sr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};qe([h(),Ze("design:type",String)],Sr.prototype,"name",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"description",void 0);qe([h(),Ze("design:type",Array)],Sr.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"sourceCodeLink",void 0);Sr=qe([Ae(),Ze("design:paramtypes",[String,String])],Sr);var Xc=class{},el=class extends ci(){},tl=class{},Xa=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},xo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},qa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Xa([h(),xo("design:type",String)],qa.prototype,"linkLanguage",void 0);Xa([h(),xo("design:type",kt)],qa.prototype,"meta",void 0);qa=Xa([F(),xo("design:paramtypes",[String,kt])],qa);var co=class extends ci(){};co=Xa([F()],co);var Ji=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Yi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},lo;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(lo||(lo={}));var si=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=lo.Private}};Ji([h(),Yi("design:type",String)],si.prototype,"uuid",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"name",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"state",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"sharedUrl",void 0);Ji([h(),Yi("design:type",co)],si.prototype,"neighbourhood",void 0);Ji([h(),Yi("design:type",Array)],si.prototype,"owners",void 0);si=Ji([F(),Yi("design:paramtypes",[String,String,String])],si);var il=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
|
|
1345
|
+
${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurrealDB=!0,r.initialized&&typeof r.initialized.catch=="function"&&r.initialized.catch(()=>{});try{await r.subscribe(),await r.initialized}catch(a){let s=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${s}`);try{r.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),r.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let s=this.seenMessages.get(e.id)??new Set,o=[];for(let u of a)u&&u.source&&!s.has(u.source)&&o.push(u.source);if(o.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${o.length} new message(s) out of ${a.length} total`);let l=[];for(let u of o){let m=[];try{let d=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${u.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let p=await this.perspectiveClient.querySurrealDB(e.perspective,d);if(Array.isArray(p))for(let f of p)f&&f.source&&m.push(f.source)}catch(y){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${y?.message??y}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${m.length} parent(s): ${m.join(", ")}`),l.push({address:u,parents:m})}for(let u of o)s.add(u);this.seenMessages.set(e.id,s);let c=this.debounceTimers.get(e.id);c&&clearTimeout(c),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,l),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let s=this.debounceTimers.get(e.id);s&&clearTimeout(s),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,r),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let r=this.proxies.get(e);if(r){try{r.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,r]of this.seenMessages)e[t]=Array.from(r);this.onPersist(this.getActive(),e)}}},es=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ha=class{};es([h(),bu("design:type",Array)],Ha.prototype,"additions",void 0);es([h(),bu("design:type",Array)],Ha.prototype,"removals",void 0);Ha=es([F()],Ha);var rl=class extends ci(){};rl=es([F()],rl);var nl=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ur=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},cn,Ai,na="smart_literal://content";function ng(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var In=class{constructor(e,t){cn.set(this,void 0),Ai.set(this,void 0),nl(this,cn,e,"f"),nl(this,Ai,t,"f")}get base(){return ur(this,Ai,"f")}static async create(e,t){let r=oe.from(ng(10)).toUrl(),n=new In(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new re({source:t,predicate:na}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new re({predicate:na}))).map(r=>new In(e,r.data.source))}async get(){let e=await ur(this,cn,"f").getSingleTarget(new re({source:ur(this,Ai,"f"),predicate:na}));if(!e)throw`No content for smart literal ${ur(this,Ai,"f")}`;return oe.fromUrl(e).get()}async set(e){let t=oe.from(e);await ur(this,cn,"f").setSingleTarget(new Ke({source:ur(this,Ai,"f"),predicate:na,target:t.toUrl()}))}};cn=new WeakMap,Ai=new WeakMap;function ln(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=wt(t);if(i.field){let n=r[i.field];if(!n)throw new Error(`parent(): field "${i.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(r))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function al(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function sl(){return`
|
|
1346
|
+
findall(
|
|
1347
|
+
[T, A],
|
|
1348
|
+
link(Base, _, _, T, A),
|
|
1349
|
+
AllLinks
|
|
1350
|
+
),
|
|
1351
|
+
sort(AllLinks, SortedLinks),
|
|
1352
|
+
SortedLinks = [[Timestamp, Author]|_]
|
|
1353
|
+
`}function ag(i){return`
|
|
1354
|
+
findall([PropertyName, PropertyValue, Resolve], (
|
|
1355
|
+
% Constrain to specified properties if provided
|
|
1356
|
+
${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1357
|
+
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1358
|
+
), Properties)
|
|
1359
|
+
`}function ol(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=t==="id"?"Base":Be(t);if(Array.isArray(r)){let o=r.map(l=>e(l)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:l,lt:c,lte:u,gt:m,gte:y}=r;if(o!==void 0)if(Array.isArray(o)){let p=o.map(f=>e(f)).join(", ");return n?`\\+ member(${s}, [${p}])`:`${a}, \\+ member(Value${t}, [${p}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(l!==void 0&&Array.isArray(l)&&l.length===2)return n?`${s} >= ${l[0]}, ${s} =< ${l[1]}`:`${a}, Value${t} >= ${l[0]}, Value${t} =< ${l[1]}`;let d=[{value:c,symbol:"<"},{value:u,symbol:"=<"},{value:m,symbol:">"},{value:y,symbol:">="}];for(let{value:p,symbol:f}of d)if(p!==void 0)return n?`${s} ${f} ${p}`:`${a}, Value${t} ${f} ${p}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function cl(i){return i?"length(UnsortedInstances, TotalCount)":""}function ll(i){if(!i)return"SortedInstances = UnsortedInstances";let e=Object.entries(i);if(e.length===1){let[r,n]=e[0];return`sort_instances(UnsortedInstances, "${r}", "${n}", SortedInstances)`}let t=[];for(let r=e.length-1;r>=0;r--){let[n,a]=e[r],s=r===e.length-1?"UnsortedInstances":`MultiSortIntermediate${r+1}`,o=r===0?"SortedInstances":`MultiSortIntermediate${r}`;t.push(`sort_instances(${s}, "${n}", "${a}", ${o})`)}return t.join(`,
|
|
1360
|
+
`)}function ul(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function dl(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function pl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function $o(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function wu(i,e){return $o(i.type)===e}function Su(i){return wu(i,"array")}function fl(i){return wu(i,"object")}function sg(i){let e=$o(i.type);return e==="number"||e==="integer"}function _u(i,e){if(e.namespace)return e.namespace;if(i["x-ad4m"]?.namespace)return i["x-ad4m"].namespace;if(i.title)return`${i.title.toLowerCase()}://`;if(i.$id)try{let r=new URL(i.$id).pathname.split("/").filter(n=>n);if(r.length>0)return`${r[r.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
|
|
1361
|
+
- options.namespace
|
|
1362
|
+
- schema["x-ad4m"].namespace
|
|
1363
|
+
- schema.title
|
|
1364
|
+
- valid schema.$id`)}function Eu(i,e,t,r,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let s=pl(r),[o,l]=s.includes("://")?s.split("://"):["",s],c=l||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",o).replace("${ns}",c).replace("${title}",i.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(i.title||"",e);let a=pl(r);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function qr(i,e,t,r,n){return t.propertyOptions?.[i]?.[r]!==void 0?t.propertyOptions[i][r]:e["x-ad4m"]?.[r]!==void 0?e["x-ad4m"][r]:t[r]!==void 0?t[r]:n}function og(i){switch(i){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function cg(i,e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let r=_u(e,t),n=class extends i{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},s={};if(e.properties)for(let[l,c]of Object.entries(e.properties)){let u=Eu(e,l,c,r,t),m=e.required?.includes(l)||!1,y=$o(c.type);if(Su(c)){s[l]={through:u,local:qr(l,c,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let p=`add${Be(l)}`,f=`remove${Be(l)}`,S=`set${Be(l)}`;n.prototype[p]=function(){},n.prototype[f]=function(){},n.prototype[S]=function(){}}else{let p=qr(l,c,t,"resolveLanguage");!p&&t.resolveLanguage&&(p=t.resolveLanguage);let f=qr(l,c,t,"local"),S=qr(l,c,t,"readOnly");if(S===void 0){let k=c["x-ad4m"]?.writable;S=k!==void 0?!k:!1}let E=!S,A=qr(l,c,t,"initial");if(fl(c)&&!p&&(p="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),p==null&&sg(c)&&(p="literal"),p==null&&(p="literal"),m&&!A&&(fl(c)?A="literal://json:{}":A="ad4m://undefined"),a[l]={through:u,required:m,writable:E,...p&&{resolveLanguage:p},...f!==void 0&&{local:f},...A&&{initial:A}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:og(y)}),E){let k=Wa(l);n.prototype[k]=function(){}}}}for(let[l,c]of Object.entries(a))Bd(n,l,c);for(let[l,c]of Object.entries(s))qd(n,l,{predicate:c.through||"",kind:"hasMany",...c.getter!==void 0&&{getter:c.getter},...c.local!==void 0&&{local:c.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Hd({name:t.name})(n),n}function lg(i,e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let l=a.map(c=>se(c)).join(", ");r.push(`${o} IN [${l}]`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let c=l.not.map(u=>se(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${se(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${se(l.between[0])} AND ${o} <= ${se(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${se(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${se(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${se(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${se(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${se(l.contains)}`)}else r.push(`${o} = ${se(a)}`)}else{let o=e[n],l=o?.kind==="belongsToOne"||o?.kind==="belongsToMany";if(o){let y=Y(o.predicate);if(Array.isArray(a)){let d=a.map(p=>se(p)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${d}]]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let p=d.not.map(f=>se(f)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${p}]]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${p}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(d.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(d.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(a)}]) > 0`);continue}let c=i.properties[n];if(!c)continue;let u=Y(c.predicate),m=c.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let y=a.map(d=>se(d)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let p=y.not.map(f=>se(f)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${p}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(y.not)}]) = 0`);(y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${u}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(a)}]) > 0`)}return r.join(" AND ")}function ug(i,e,t,r){let{where:n}=t,a=[];if(t.parent){let c=ln(t.parent,r);a.push(`count(<-link[WHERE in.uri = ${se(t.parent.id)} AND predicate = '${Y(c)}']) > 0`)}for(let[,c]of Object.entries(i.properties))if(c.required){if(c.getter)continue;c.flag&&c.initial?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`)}if(a.length===0){for(let[,c]of Object.entries(i.properties))if(c.initial){c.flag?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`);break}}if(a.length===0){let c=[];for(let[,u]of Object.entries(i.properties))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);if(i.relations)for(let[,u]of Object.entries(i.relations))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);c.length>0&&a.push(`count(->link[WHERE (${c.join(" OR ")})]) > 0`)}let s=lg(i,e,n),o=[];return o.push(...a),s&&o.push(s),o.push("count(->link) > 0"),`
|
|
1365
|
+
SELECT
|
|
1366
|
+
id AS source,
|
|
1367
|
+
uri AS source_uri,
|
|
1368
|
+
->link AS links
|
|
1369
|
+
FROM node
|
|
1370
|
+
WHERE ${o.join(" AND ")}
|
|
1371
|
+
FETCH links
|
|
1372
|
+
`.trim()}var uo=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}parent(e,t,r){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let s=e.constructor;return this.queryParams.parent={id:n,model:s,field:t.field},this}let a=r?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let r=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async s=>{let{results:o}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let r=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async s=>{let{results:o}=await t.instancesFromPrologResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(n),n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let s=a?.[0]?.TotalCount||0;e(s)};this.currentSubscription.onResult(r);let n=this.currentSubscription.result?.[0]?.TotalCount||0;return e(n),n}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let s=async u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}}};function aa(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function hl(i,e){if(Array.isArray(e))return e.includes(i);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(i):i!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return i>=t.between[0]&&i<=t.between[1];let r=!0;return t.gt!==void 0&&(r=r&&i>t.gt),t.gte!==void 0&&(r=r&&i>=t.gte),t.lt!==void 0&&(r=r&&i<t.lt),t.lte!==void 0&&(r=r&&i<=t.lte),t.contains!==void 0&&(typeof i=="string"?r=r&&i.includes(String(t.contains)):Array.isArray(i)?r=r&&i.includes(t.contains):r=!1),r}return i===e}async function dg(i,e,t,r){let n=i;if(i!=null&&i!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof i=="string"&&!i.startsWith("literal://"))try{let a=await t.getExpression(i);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof i=="string"&&i.startsWith("literal://"))try{let a=oe.fromUrl(i).get();n=a.data!==void 0?a.data:a}catch{}else typeof i=="string"&&r&&(r==="number"?n=Number(i):r==="boolean"&&(n=i==="true"||i==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function gl(i,e,t,r,n){if(!e||e.length===0)return;let a=null,s=null,o=null,l=n&&n.length>0?new Set(n):null,c=new Map;for(let[p,f]of Object.entries(t.properties))f.getter||l&&!l.has(p)||c.set(f.predicate,[p,f]);let u=new Map,m=[];for(let[p,f]of Object.entries(t.relations))if(!f.getter){if(f.target&&f.filter!==!1){m.push([p,f]);continue}u.set(f.predicate,[p,f])}for(let[p,f]of m)u.has(f.predicate)||u.set(f.predicate,[p,f]);let y=new Map,d=new Map;for(let p=0;p<e.length;p++){let f=e[p],{predicate:S,target:E,author:A,timestamp:k}=f;if(E==="None"||E===void 0||E===null)continue;k!=null&&((a==null||k<a)&&(a=k,o=A??null),(s==null||k>s)&&(s=k));let b=c.get(S);if(b){y.get(b[0]),y.set(b[0],{target:E,timestamp:k});continue}let T=u.get(S);if(T){let[R]=T,C=d.get(R);C||(C=[],d.set(R,C)),C.push({target:E,timestamp:k??"",index:p})}}for(let[p,{target:f}]of y){let[,S]=c.get(t.properties[p].predicate),E=typeof i[p];i[p]=await dg(f,S,r,E!=="undefined"?E:void 0)}for(let[p,f]of d)f.sort((S,E)=>{let A=String(S.timestamp).localeCompare(String(E.timestamp));return A!==0?A:S.index-E.index}),i[p]=f.map(S=>S.target).filter(S=>S!=null&&S!==""&&S!=="None");o&&(i.author=o),a!=null&&(i.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),s!=null&&(i.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}async function pg(i,e,t){let r=Object.fromEntries(await Promise.all(t.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let m=Array.from(s,p=>p.codePointAt(0)),y=m.every(p=>p<=255),d=m.some(p=>p>=128);if(y&&d)try{let p=Uint8Array.from(m),f=new TextDecoder("utf-8",{fatal:!0}).decode(p);f!==s&&(l=f)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:p})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Mi(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(l=u(l)),[a,l]}))),n=Object.fromEntries(Object.entries(r).filter(([a])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(e,n)}function fg(i,e){let t=Pl(i,e);if(!t){let r=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${r}".`);return}return t.getter}async function ml(i,e,t,r){let n=se(i.id),s=r?.requestedProperties&&r.requestedProperties.length>0?new Set(r.requestedProperties):null;for(let[o,l]of Object.entries(t.properties))if(!(s&&!s.has(o))&&l.getter)try{let c=l.getter.replace(/Base/g,n),u=await e.querySurrealDB(`SELECT (${c}) AS value FROM node WHERE uri = ${n}`);u&&u.length>0&&u[0].value!==void 0&&u[0].value!==null&&u[0].value!=="None"&&u[0].value!==""&&(i[o]=u[0].value)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,l]of Object.entries(t.relations)){if(s&&!s.has(o)&&!(r?.include&&o in r.include))continue;let c=l,u=c.getter;if(!u&&c.where&&c.direction!=="reverse")try{let m=c.target?.(),y=m?m.getModelMetadata?.()??null:null,d=Rl(c.where,y);d.length>0&&(u=`(->link[WHERE predicate = '${Y(c.predicate)}'].out[WHERE ${d.join(" AND ")}].uri)`)}catch{}if(!u&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let m=c.target();u=fg(c.predicate,m),u||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(m){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,m)}if(u)try{let y=`SELECT (${u.replace(/Base/g,n)}) AS value FROM node WHERE uri = ${n}`,d=await e.querySurrealDB(y);if(d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null){let p=d[0].value;i[o]=Array.isArray(p)?p.filter(f=>f!=null&&f!==""&&f!=="None"):p}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function hn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=wt(i);for(let[a,s]of Object.entries(r)){let o=n[a];if(!o){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let l=o.target(),c=typeof s=="object"&&s!==null?s:void 0,u=c?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let k=(await t.get(new re({predicate:o.predicate,target:E.id}))).filter(b=>b.data.target===E.id).map(b=>b.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let b=k[k.length-1];try{let T=new l(t,b);await T.get(),E[a]=T}catch{E[a]=null}}else{let b=[];if(c&&(c.where||c.order||c.properties)){let T={id:k,...c.where??{}};b=await l.findAll(t,{where:T,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(k.map(async T=>{try{let R=new l(t,T);await R.get(c?.properties?{properties:c.properties}:void 0),b.push(R)}catch{}}));if(c?.order&&!(c.where||c.properties)){let T=Object.entries(c.order);b=b.sort((R,C)=>{for(let[Q,V]of T){let L=String(R[Q]??""),W=String(C[Q]??""),He=L.localeCompare(W);if(He!==0)return V==="DESC"?-He:He}return 0})}if(c?.offset!=null||c?.limit!=null){let T=c.offset??0,R=c.limit!=null?T+c.limit:void 0;b=b.slice(T,R)}E[a]=b,u&&b.length>0&&await hn(l,b,t,u)}}continue}let m=new Set,y=new Map;for(let E of e){let A=E[a];if(y.set(E,Array.isArray(A)?[...A]:A),A!=null)if(Array.isArray(A))for(let k of A)typeof k=="string"?m.add(k):k&&typeof k=="object"&&typeof k.id=="string"&&m.add(k.id);else typeof A=="string"?m.add(A):A&&typeof A=="object"&&typeof A.id=="string"&&m.add(A.id)}if(m.size===0)continue;let d=new Map,f={where:{id:Array.from(m),...c?.where??{}},...c?.order&&{order:c.order},...c?.properties&&{properties:c.properties}},S=await l.findAll(t,f);for(let E of S)d.set(E.id,E);for(let E of e){let A=y.get(E);if(A!=null)if(Array.isArray(A)){let k=A.map(b=>typeof b=="string"?d.has(b)?d.get(b):null:b&&typeof b=="object"&&typeof b.id=="string"?d.has(b.id)?d.get(b.id):b:null).filter(b=>b!==null);if(c?.order){let b=Object.entries(c.order);k=k.sort((T,R)=>{for(let[C,Q]of b){let V=String(T[C]??""),L=String(R[C]??""),W=V.localeCompare(L);if(W!==0)return Q==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let b=c.offset??0,T=c.limit!=null?b+c.limit:void 0;k=k.slice(b,T)}o.maxCount===1?(k.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${k.length} values found; keeping the last`),E[a]=k.length>0?k[k.length-1]:null):E[a]=k}else typeof A=="string"&&d.has(A)?E[a]=d.get(A):A&&typeof A=="object"&&typeof A.id=="string"&&(E[a]=d.has(A.id)?d.get(A.id):A)}if(u){let E=Array.from(d.values());await hn(l,E,t,u)}}}var _r=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===_r)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,r={},n=Mi(this);for(let[m,y]of Object.entries(n)){let d=y;r[m]={name:m,predicate:d.through||"",required:d.required||!1,readOnly:!(d.writable??!1),...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},s=wt(this),o=Object.fromEntries(Object.entries(s).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let[m,y]of Object.entries(o)){let d=y;a[m]={name:m,predicate:d.predicate||"",...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter},direction:d.kind==="belongsToMany"||d.kind==="belongsToOne"?"reverse":"forward",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let l=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(l||c)&&e.__jsonSchema){let m=e.__jsonSchema,y=e.__jsonSchemaOptions||{};if(m.properties)for(let[d,p]of Object.entries(m.properties)){let f=Su(p),S=Eu(m,d,p,_u(m,y),y);if(f)a[d]={name:d,predicate:S,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:S,required:E,readOnly:p["x-ad4m"]?.writable===!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||oe.from(Ll(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Mi(t)[e]}getRelationOptions(e){let t=this.constructor;return wt(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateRelationAction(e,t){let r=this.getRelationOptions(e);if(!r)throw new Error(`Relation "${e}" has no metadata defined`);if(!r.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.predicate,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){return pg(e,t,r)}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in r.relations){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let r=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let s=aa(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let l=Array.isArray(s)?[...s].sort():[],c=Array.isArray(o)?[...o].sort():[];(l.length!==c.length||l.some((u,m)=>u!==c[m]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
|
|
1373
|
+
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1374
|
+
FROM link
|
|
1375
|
+
WHERE in.uri = ${se(this._baseExpression)}
|
|
1376
|
+
ORDER BY timestamp ASC
|
|
1377
|
+
`,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await gl(this,s,r,this._perspective,u)}let o=wt(t),l=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,m]of Object.entries(o)){if(m.kind!=="belongsToOne"&&m.kind!=="belongsToMany"||l&&!l.has(u))continue;let d=(await this._perspective.get(new re({predicate:m.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);m.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await ml(this,this._perspective,r,c),e?.include&&await hn(t,[this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,r){let{properties:n,where:a,order:s,offset:o,limit:l,count:c}=t,u=r||await this.getClassName(e),m=t.parent?ln(t.parent,this):void 0,y=[sl(),al(t.parent,m),ag(n),ol(a)],d=[cl(c),ll(s),ul(o),dl(l)];return`
|
|
1378
|
+
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1379
|
+
subject_class("${u}", SubjectClass),
|
|
1380
|
+
instance(SubjectClass, Base),
|
|
1381
|
+
${y.filter(f=>f).join(", ")}
|
|
1382
|
+
), UnsortedInstances),
|
|
1383
|
+
${d.filter(f=>f).join(", ")}
|
|
1384
|
+
`}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n=wt(this);return ug(r,n,t,this)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],s=(await Promise.all(r[0].AllInstances.map(async([l,c,u,m,y])=>{try{let d=new this(e,l);n.length&&Object.keys(d).forEach(f=>{!n.includes(f)&&f!=="createdAt"&&f!=="updatedAt"&&f!=="author"&&f!=="id"&&f!=="baseExpression"&&delete d[f]});let p=[...c,...u,["createdAt",m],["author",y]];return await _r.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${l}:`,d),null}}))).filter(l=>l!==null);t.include&&s.length>0&&await hn(this,s,e,t.include);let o=t.include;for(let l of s)l.takeSnapshot(o);return{results:s,totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=[];for(let f of r){let S;try{if(S=f.source_uri,!S)continue;let E=f.links||[],A=new this(e,S);if(await gl(A,E,n,e,a.length>0?a:void 0),a.length>0){let k=new Set(a);for(let b of Object.keys(n.properties))k.has(b)||delete A[b];for(let b of Object.keys(n.relations))!k.has(b)&&!(t.include&&b in t.include)&&delete A[b];for(let b of["author","createdAt","updatedAt"])k.has(b)||delete A[b]}s.push(A)}catch(E){console.error(`Failed to process SurrealDB instance ${S}:`,E)}}let o=wt(this),l=Object.entries(o).filter(([f,S])=>(S.kind==="belongsToOne"||S.kind==="belongsToMany")&&(a.length===0||a.includes(f)));l.length>0&&s.length>0&&await Promise.all(s.map(async f=>{for(let[S,E]of l){let k=(await e.get(new re({predicate:E.predicate,target:f.id}))).filter(b=>b.data.target===f.id).map(b=>b.data.source);E.kind==="belongsToOne"?f[S]=k.length>0?k[k.length-1]:null:f[S]=k}}));let c=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let f of s)await ml(f,e,n,c);let u=s;t.where&&(u=s.filter(f=>{for(let[S,E]of Object.entries(t.where))if(S!=="base"){if(S==="author"||S==="timestamp"){if(!hl(f[S],E))return!1;continue}if(typeof E=="object"&&E!==null&&!Array.isArray(E)){let A=E;if((A.gt!==void 0||A.gte!==void 0||A.lt!==void 0||A.lte!==void 0||A.between!==void 0||A.contains!==void 0)&&!hl(f[S],E))return!1}}return!0}));let m=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(m){let f=Object.entries(m);u.sort((S,E)=>{for(let[A,k]of f){let b=S[A],T=E[A];if(b===void 0&&T===void 0)continue;if(b===void 0)return k==="ASC"?1:-1;if(T===void 0)return k==="ASC"?-1:1;let R=0;if(typeof b=="number"&&typeof T=="number"?R=b-T:typeof b=="string"&&typeof T=="string"?R=b.localeCompare(T):R=String(b).localeCompare(String(T)),R!==0)return k==="DESC"?-R:R}return 0})}let y=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,S=t.limit?f+t.limit:void 0;d=u.slice(f,S)}t.include&&d.length>0&&await hn(this,d,e,t.include);let p=t.include;for(let f of d)f.takeSnapshot(p);return{results:d,totalCount:y}}static async findAll(e,t={},r=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findOne(e,t={},r=!0){let n={...t,limit:1};return(await this.findAll(e,n,r))[0]??null}static async findAllAndCount(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),l=await e.querySurrealDB(o),{results:c,totalCount:u}=await this.instancesFromSurrealResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),l=await e.infer(o),{results:c,totalCount:u}=await this.instancesFromPrologResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{where:n}=t,a=r||await this.getClassName(e),s=t.parent?ln(t.parent,this):void 0,o=[sl(),al(t.parent,s),ol(n)],l=[cl(!0),ll(),ul(),dl()];return`
|
|
1385
|
+
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1386
|
+
subject_class("${a}", SubjectClass),
|
|
1387
|
+
instance(SubjectClass, Base),
|
|
1388
|
+
${o.filter(u=>u).join(", ")}
|
|
1389
|
+
), UnsortedInstances),
|
|
1390
|
+
${l.filter(u=>u).join(", ")}
|
|
1391
|
+
`}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;t==null||t===""||(s&&(t=await this._perspective.createExpression(t,s)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],r))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(s=>({name:"value",value:this.resolveRelationId(s)})),r):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async addRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async removeRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r=this.constructor.getModelMetadata(),n=Object.values(r.properties).some(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[l,c]of Object.entries(this))if(c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action){let u=r.properties[l];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof c=="object"){a.push(l);continue}s[l]=c}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),r={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let s=this[a];s!=null&&a!=="author"&&a!=="timestamp"&&(r[a]=s)}return r}async innerUpdate(e=!0,t){let r=this.constructor,n=this._snapshot?new Set(this.changedFields()):null,a=r.getModelMetadata(),s=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),o=Object.entries(this);for(let[l,c]of o){if(!s.has(l)||n&&!n.has(l))continue;let u=a.relations[l];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([y,d])=>y!==l&&d.predicate===u.predicate)))&&c!=null){if(c?.action)switch(c.action){case"setter":await this.setRelationValues(l,c.value,t);break;case"adder":await this.addRelationValue(l,c.value,t);break;case"remover":await this.removeRelationValue(l,c.value,t);break;default:await this.setRelationValues(l,c.value,t);break}else if(Array.isArray(c))await this.setRelationValues(l,c,t);else if(c!=null&&c!==""&&e){if(this.getRelationOptions(l)||this.getPropertyMetadata(l)?.flag)continue;await this.setProperty(l,c,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new re({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new re({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},r){let n=new this(e);if(Object.assign(n,t),r?.parent&&!r?.batchId){let a=await e.createBatch();await n.save(a);let s=ln(r.parent,this),o=new Ke({source:r.parent.id,predicate:s,target:n.id});return await e.add(o,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(r?.batchId),r?.parent){let a=ln(r.parent,this),s=new Ke({source:r.parent.id,predicate:a,target:n.id});await e.add(s,"shared",r?.batchId)}return n}static async update(e,t,r){let n=new this(e,t);return await n.get(),Object.assign(n,r),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let r=await e.createBatch(),n=await t({batchId:r});return await e.commitBatch(r),n}static query(e,t){return new uo(e,this,t)}static fromJSONSchema(e,t){return cg(this,e,t)}};_r.classNamesByClass=new WeakMap;function Ao(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function hg(i,e){let t=e.properties,r=Object.values(t).filter(s=>s.flag&&s.predicate&&s.initial);if(r.length>0){let s=r.map(o=>`triple(X, '${o.predicate}', '${o.initial}')`).join(`,
|
|
1392
|
+
`);return`${i}(X) :-
|
|
1393
|
+
${s}.`}let n=Object.values(t).filter(s=>s.required&&s.predicate&&!s.flag);if(n.length>0){let s=n.map(o=>`triple(X, '${o.predicate}', _)`).join(`,
|
|
1394
|
+
`);return`${i}(X) :-
|
|
1395
|
+
${s}.`}let a=Object.values(t).filter(s=>s.predicate).map(s=>s.predicate);if(e.relations)for(let s of Object.values(e.relations))s.predicate&&a.push(s.predicate);if(a.length>0){let s=a.map(o=>`triple(X, '${o}', _)`).join(` ;
|
|
1396
|
+
`);return`${i}(X) :-
|
|
1397
|
+
(${s}).`}return null}function gg(i,e){return e.flag||!e.predicate?null:`${`${i}_${Ao(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function mg(i,e){if(!e.predicate)return null;let t=`${i}_${Ao(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function y0(i){let e=i.getModelMetadata(),t=Ao(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=hg(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>gg(t,o)).filter(o=>o!==null);a.length>0&&(r.push(""),r.push("% Field getters"),r.push(...a));let s=Object.values(e.relations).map(o=>mg(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
|
|
1398
|
+
`)}var v0=`
|
|
1332
1399
|
type AIModelLoadingStatus {
|
|
1333
1400
|
downloaded: Boolean!
|
|
1334
1401
|
loaded: Boolean!
|
|
@@ -1469,6 +1536,12 @@ type ExpressionRendered {
|
|
|
1469
1536
|
timestamp: String!
|
|
1470
1537
|
}
|
|
1471
1538
|
|
|
1539
|
+
type HostingUserInfo {
|
|
1540
|
+
email: String!
|
|
1541
|
+
hotWalletAddress: String
|
|
1542
|
+
remainingCredits: String!
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1472
1545
|
type Icon {
|
|
1473
1546
|
code: String!
|
|
1474
1547
|
}
|
|
@@ -1704,7 +1777,9 @@ type Mutation {
|
|
|
1704
1777
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
1705
1778
|
runtimeRequestInstallNotification(notification: NotificationInput!): String!
|
|
1706
1779
|
runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
|
|
1780
|
+
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
1707
1781
|
runtimeRestartHolochain: Boolean!
|
|
1782
|
+
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
1708
1783
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
1709
1784
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
1710
1785
|
runtimeTestEmail(to: String!): Boolean!
|
|
@@ -1753,6 +1828,11 @@ type OnlineAgent {
|
|
|
1753
1828
|
status: PerspectiveExpression!
|
|
1754
1829
|
}
|
|
1755
1830
|
|
|
1831
|
+
type PaymentRequestResult {
|
|
1832
|
+
message: String!
|
|
1833
|
+
success: Boolean!
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1756
1836
|
type Perspective {
|
|
1757
1837
|
links: [LinkExpression!]!
|
|
1758
1838
|
}
|
|
@@ -1814,6 +1894,7 @@ type Query {
|
|
|
1814
1894
|
runtimeFriends: [String!]!
|
|
1815
1895
|
runtimeGetNetworkMetrics: String!
|
|
1816
1896
|
runtimeHcAgentInfos: String!
|
|
1897
|
+
runtimeHostingUserInfo: HostingUserInfo!
|
|
1817
1898
|
runtimeInfo: RuntimeInfo!
|
|
1818
1899
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
1819
1900
|
runtimeListUsers: [UserStatistics!]!
|
|
@@ -1914,65 +1995,10 @@ input VoiceActivityParamsInput {
|
|
|
1914
1995
|
startWindow: Float
|
|
1915
1996
|
timeBeforeSpeech: Float
|
|
1916
1997
|
}
|
|
1917
|
-
`,A=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},m=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},K=function(i,e){return function(t,r){e(t,r,i)}},Cn=new ii;Cn.author="did:ad4m:test";Cn.timestamp=Date.now();Cn.data={source:"root",target:"neighbourhood://Qm12345"};Cn.proof={signature:"",key:"",valid:!0};var Gt=new Di;Gt.author="did:ad4m:test";Gt.timestamp=Date.now().toString();Gt.proof=new Ut("","");Gt.data=new kt([Cn]);var Ba=class{};A([h(),m("design:type",String)],Ba.prototype,"recipient",void 0);A([h(),m("design:type",Di)],Ba.prototype,"message",void 0);Ba=A([V()],Ba);var _r=class{};A([h(),m("design:type",String)],_r.prototype,"ad4mExecutorVersion",void 0);A([h(),m("design:type",Boolean)],_r.prototype,"isInitialized",void 0);A([h(),m("design:type",Boolean)],_r.prototype,"isUnlocked",void 0);_r=A([V()],_r);var qi=class{};A([h(),m("design:type",String)],qi.prototype,"title",void 0);A([h(),m("design:type",String)],qi.prototype,"message",void 0);A([h(),m("design:type",String)],qi.prototype,"type",void 0);A([h(),m("design:type",String)],qi.prototype,"addon",void 0);qi=A([V()],qi);var ct=class{};A([h(),m("design:type",String)],ct.prototype,"description",void 0);A([h(),m("design:type",String)],ct.prototype,"appName",void 0);A([h(),m("design:type",String)],ct.prototype,"appUrl",void 0);A([h(),m("design:type",String)],ct.prototype,"appIconPath",void 0);A([h(),m("design:type",String)],ct.prototype,"trigger",void 0);A([h(),m("design:type",Array)],ct.prototype,"perspectiveIds",void 0);A([h(),m("design:type",String)],ct.prototype,"webhookUrl",void 0);A([h(),m("design:type",String)],ct.prototype,"webhookAuth",void 0);ct=A([$e()],ct);var Ye=class{};A([h(),m("design:type",String)],Ye.prototype,"id",void 0);A([h(),m("design:type",Boolean)],Ye.prototype,"granted",void 0);A([h(),m("design:type",String)],Ye.prototype,"description",void 0);A([h(),m("design:type",String)],Ye.prototype,"appName",void 0);A([h(),m("design:type",String)],Ye.prototype,"appUrl",void 0);A([h(),m("design:type",String)],Ye.prototype,"appIconPath",void 0);A([h(),m("design:type",String)],Ye.prototype,"trigger",void 0);A([h(),m("design:type",Array)],Ye.prototype,"perspectiveIds",void 0);A([h(),m("design:type",String)],Ye.prototype,"webhookUrl",void 0);A([h(),m("design:type",String)],Ye.prototype,"webhookAuth",void 0);Ye=A([V()],Ye);var Er=class{};A([h(),m("design:type",Ye)],Er.prototype,"notification",void 0);A([h(),m("design:type",String)],Er.prototype,"perspectiveId",void 0);A([h(),m("design:type",String)],Er.prototype,"triggerMatch",void 0);Er=A([V()],Er);var xe=class{};A([h(),m("design:type",Number)],xe.prototype,"total",void 0);A([h(),m("design:type",Number)],xe.prototype,"imported",void 0);A([h(),m("design:type",Number)],xe.prototype,"failed",void 0);A([h(),m("design:type",Number)],xe.prototype,"omitted",void 0);A([h(),m("design:type",Array)],xe.prototype,"errors",void 0);xe=A([V()],xe);var Xe=class{};A([h(),m("design:type",xe)],Xe.prototype,"perspectives",void 0);A([h(),m("design:type",xe)],Xe.prototype,"links",void 0);A([h(),m("design:type",xe)],Xe.prototype,"expressions",void 0);A([h(),m("design:type",xe)],Xe.prototype,"perspectiveDiffs",void 0);A([h(),m("design:type",xe)],Xe.prototype,"notifications",void 0);A([h(),m("design:type",xe)],Xe.prototype,"models",void 0);A([h(),m("design:type",xe)],Xe.prototype,"defaultModels",void 0);A([h(),m("design:type",xe)],Xe.prototype,"tasks",void 0);A([h(),m("design:type",xe)],Xe.prototype,"friends",void 0);A([h(),m("design:type",xe)],Xe.prototype,"trustedAgents",void 0);A([h(),m("design:type",xe)],Xe.prototype,"knownLinkLanguages",void 0);Xe=A([V()],Xe);var xr=class{};A([h(),m("design:type",String)],xr.prototype,"email",void 0);A([h(),m("design:type",String)],xr.prototype,"did",void 0);A([h(),m("design:type",String)],xr.prototype,"lastSeen",void 0);A([h(),m("design:type",Number)],xr.prototype,"perspectiveCount",void 0);xr=A([V()],xr);var Vi=class{};A([h(),m("design:type",Boolean)],Vi.prototype,"success",void 0);A([h(),m("design:type",String)],Vi.prototype,"message",void 0);A([h(),m("design:type",Boolean)],Vi.prototype,"requiresPassword",void 0);A([h(),m("design:type",Boolean)],Vi.prototype,"isExistingUser",void 0);Vi=A([V()],Vi);var D=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Gt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Gt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Gt}]}runtimeMessageReceived(){return Gt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:ro.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Mi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,r){return!0}};A([ae(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeQuit",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeOpenLink",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",_r)],D.prototype,"runtimeInfo",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"addTrustedAgents",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"deleteTrustedAgents",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"getTrustedAgents",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeKnownLinkLanguageTemplates",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeAddKnownLinkLanguageTemplates",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeFriends",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeAddFriends",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeRemoveFriends",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",String)],D.prototype,"runtimeHcAgentInfos",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",String)],D.prototype,"runtimeGetNetworkMetrics",null);A([ae(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeRestartHolochain",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",Boolean)],D.prototype,"runtimeHcAddAgentInfos",null);A([et(),K(0,W()),K(1,W()),K(2,W()),K(3,W()),m("design:type",Function),m("design:paramtypes",[String,String,String,String]),m("design:returntype",void 0)],D.prototype,"runtimeVerifyStringSignedByDid",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[kt]),m("design:returntype",Boolean)],D.prototype,"runtimeSetStatus",null);A([et(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Di)],D.prototype,"runtimeFriendStatus",null);A([ae(),K(0,W()),K(1,W()),m("design:type",Function),m("design:paramtypes",[String,xa]),m("design:returntype",Boolean)],D.prototype,"runtimeFriendSendMessage",null);A([et(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Array)],D.prototype,"runtimeMessageInbox",null);A([et(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Array)],D.prototype,"runtimeMessageOutbox",null);A([oo(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Di)],D.prototype,"runtimeMessageReceived",null);A([oo(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",qi)],D.prototype,"exceptionOccurred",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[ct]),m("design:returntype",String)],D.prototype,"runtimeRequestInstallNotification",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeNotifications",null);A([ae(),K(0,W()),K(1,W()),m("design:type",Function),m("design:paramtypes",[String,ct]),m("design:returntype",Boolean)],D.prototype,"runtimeUpdateNotification",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeRemoveNotification",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeGrantNotification",null);A([oo(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Er)],D.prototype,"runtimeNotificationTriggered",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeExportDb",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeImportDb",null);A([ae(),K(0,W()),K(1,W()),m("design:type",Function),m("design:paramtypes",[String,String]),m("design:returntype",Boolean)],D.prototype,"runtimeExportPerspective",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeImportPerspective",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeMultiUserEnabled",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[Boolean]),m("design:returntype",Boolean)],D.prototype,"runtimeSetMultiUserEnabled",null);A([et(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeListUsers",null);A([ae(),K(0,W()),K(1,W()),m("design:type",Function),m("design:paramtypes",[String,It]),m("design:returntype",Vi)],D.prototype,"runtimeRequestLoginVerification",null);A([ae(),K(0,W()),K(1,W()),K(2,W()),m("design:type",Function),m("design:paramtypes",[String,String,String]),m("design:returntype",String)],D.prototype,"runtimeVerifyEmailCode",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeTestEmail",null);A([ae(),K(0,W()),K(1,W()),K(2,W()),m("design:type",Function),m("design:paramtypes",[String,String,It]),m("design:returntype",Mi)],D.prototype,"runtimeCreateUser",null);A([ae(),K(0,W()),K(1,W()),m("design:type",Function),m("design:paramtypes",[String,String]),m("design:returntype",String)],D.prototype,"runtimeLoginUser",null);A([ae(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeEnable",null);A([ae(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeDisable",null);A([ae(),K(0,W()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",String)],D.prototype,"runtimeEmailTestGetCode",null);A([ae(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestClearCodes",null);A([ae(),K(0,W()),K(1,W()),K(2,W()),m("design:type",Function),m("design:paramtypes",[String,String,Number]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestSetExpiry",null);D=A([xd()],D);function ya(i){return i.charAt(0).toUpperCase()+i.slice(1)}function jr(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=wt(t);if(i.field){let n=r[i.field];if(!n)throw new Error(`parent(): field "${i.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(r))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function tl(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function il(){return`
|
|
1918
|
-
findall(
|
|
1919
|
-
[T, A],
|
|
1920
|
-
link(Base, _, _, T, A),
|
|
1921
|
-
AllLinks
|
|
1922
|
-
),
|
|
1923
|
-
sort(AllLinks, SortedLinks),
|
|
1924
|
-
SortedLinks = [[Timestamp, Author]|_]
|
|
1925
|
-
`}function Qh(i){return`
|
|
1926
|
-
findall([PropertyName, PropertyValue, Resolve], (
|
|
1927
|
-
% Constrain to specified properties if provided
|
|
1928
|
-
${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1929
|
-
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1930
|
-
), Properties)
|
|
1931
|
-
`}function rl(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=t==="id"?"Base":ya(t);if(Array.isArray(r)){let o=r.map(c=>e(c)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:c,lt:l,lte:u,gt:f,gte:g}=r;if(o!==void 0)if(Array.isArray(o)){let y=o.map(p=>e(p)).join(", ");return n?`\\+ member(${s}, [${y}])`:`${a}, \\+ member(Value${t}, [${y}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${s} >= ${c[0]}, ${s} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let d=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:f,symbol:">"},{value:g,symbol:">="}];for(let{value:y,symbol:p}of d)if(y!==void 0)return n?`${s} ${p} ${y}`:`${a}, Value${t} ${p} ${y}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function nl(i){return i?"length(UnsortedInstances, TotalCount)":""}function al(i){if(!i)return"SortedInstances = UnsortedInstances";let e=Object.entries(i);if(e.length===1){let[r,n]=e[0];return`sort_instances(UnsortedInstances, "${r}", "${n}", SortedInstances)`}let t=[];for(let r=e.length-1;r>=0;r--){let[n,a]=e[r],s=r===e.length-1?"UnsortedInstances":`MultiSortIntermediate${r+1}`,o=r===0?"SortedInstances":`MultiSortIntermediate${r}`;t.push(`sort_instances(${s}, "${n}", "${a}", ${o})`)}return t.join(`,
|
|
1932
|
-
`)}function sl(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function ol(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function cl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function So(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function hu(i,e){return So(i.type)===e}function ll(i){return hu(i,"array")}function ul(i){return hu(i,"object")}function Gh(i){let e=So(i.type);return e==="number"||e==="integer"}var dt=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===dt)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,r={},n=Yt(this);for(let[f,g]of Object.entries(n)){let d=g;r[f]={name:f,predicate:d.through||"",required:d.required||!1,readOnly:!(d.writable??!1),...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},s=wt(this),o=Object.fromEntries(Object.entries(s).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));for(let[f,g]of Object.entries(o)){let d=g;a[f]={name:f,predicate:d.predicate||"",...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter},direction:d.kind==="belongsToMany"||d.kind==="belongsToOne"?"reverse":"forward",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let c=Object.keys(r).length>0,l=Object.keys(a).length>0;if(!(c||l)&&e.__jsonSchema){let f=e.__jsonSchema,g=e.__jsonSchemaOptions||{};if(f.properties)for(let[d,y]of Object.entries(f.properties)){let p=ll(y),b=this.determinePredicate(f,d,y,this.determineNamespace(f,g),g);if(p)a[d]={name:d,predicate:b,...y["x-ad4m"]?.local!==void 0&&{local:y["x-ad4m"].local}};else{let S=f.required?.includes(d)||!1;r[d]={name:d,predicate:b,required:S,readOnly:y["x-ad4m"]?.writable===!1,...y["x-ad4m"]?.resolveLanguage&&{resolveLanguage:y["x-ad4m"].resolveLanguage},...y["x-ad4m"]?.initial&&{initial:y["x-ad4m"].initial},...y["x-ad4m"]?.local!==void 0&&{local:y["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||se.from(Il(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Yt(t)[e]}getRelationOptions(e){let t=this.constructor;return wt(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateRelationAction(e,t){let r=this.getRelationOptions(e);if(!r)throw new Error(`Relation "${e}" has no metadata defined`);if(!r.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.predicate,target:"value",...r.local&&{local:!0}}]}static async hydratePropertyValue(e,t,r,n){let a=e;if(e!=null&&e!=="")if(t.resolveLanguage!=null&&t.resolveLanguage!=="literal"&&typeof e=="string"&&!e.startsWith("literal://"))try{let s=await r.getExpression(e);if(s)try{a=JSON.parse(s.data)}catch{a=s.data}}catch(s){console.warn(`hydratePropertyValue: failed to resolve expression for "${t.name}":`,s)}else if(t.resolveLanguage==="literal"&&typeof e=="string"&&e.startsWith("literal://"))try{let s=se.fromUrl(e).get();a=s.data!==void 0?s.data:s}catch{}else typeof e=="string"&&n&&(n==="number"?a=Number(e):n==="boolean"&&(a=e==="true"||e==="1"));return t.transform&&typeof t.transform=="function"&&(a=t.transform(a)),a}static async hydrateFromLinks(e,t,r,n,a){if(!t||t.length===0)return;let s=null,o=null,c=null,l=a&&a.length>0?new Set(a):null,u=new Map;for(let[p,b]of Object.entries(r.properties))b.getter||l&&!l.has(p)||u.set(b.predicate,[p,b]);let f=new Map,g=[];for(let[p,b]of Object.entries(r.relations))if(!b.getter){if(b.target&&b.filter!==!1){g.push([p,b]);continue}f.set(b.predicate,[p,b])}for(let[p,b]of g)f.has(b.predicate)||f.set(b.predicate,[p,b]);let d=new Map,y=new Map;for(let p=0;p<t.length;p++){let b=t[p],{predicate:S,target:x,author:I,timestamp:w}=b;if(x==="None"||x===void 0||x===null)continue;w!=null&&((s==null||w<s)&&(s=w,c=I??null),(o==null||w>o)&&(o=w));let T=u.get(S);if(T){d.get(T[0]),d.set(T[0],{target:x,timestamp:w});continue}let R=f.get(S);if(R){let[L]=R,B=y.get(L);B||(B=[],y.set(L,B)),B.push({target:x,timestamp:w??"",index:p})}}for(let[p,{target:b}]of d){let[,S]=u.get(r.properties[p].predicate),x=typeof e[p];e[p]=await this.hydratePropertyValue(b,S,n,x!=="undefined"?x:void 0)}for(let[p,b]of y)b.sort((S,x)=>{let I=String(S.timestamp).localeCompare(String(x.timestamp));return I!==0?I:S.index-x.index}),e[p]=b.map(S=>S.target).filter(S=>S!=null&&S!==""&&S!=="None");c&&(e.author=c),s!=null&&(e.createdAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s),o!=null&&(e.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}static async assignValuesToInstance(e,t,r){let n=Object.fromEntries(await Promise.all(r.map(async([s,o,c])=>{let l=o;if(!c&&typeof o=="string"){let g=Array.from(o,p=>p.codePointAt(0)),d=g.every(p=>p<=255),y=g.some(p=>p>=128);if(d&&y)try{let p=Uint8Array.from(g),b=new TextDecoder("utf-8",{fatal:!0}).decode(p);b!==o&&(l=b)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${s}"`,{value:o,error:p})}}if(c){let g=await e.getExpression(o);if(g)try{l=JSON.parse(g.data)}catch{l=g.data}}let f=Yt(t.constructor)[s]?.transform;return f&&typeof f=="function"&&(l=f(l)),[s,l]}))),a=Object.fromEntries(Object.entries(n).filter(([s])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),s);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(t,a)}static normalizeValue(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&typeof t.id=="string"?t.id:t):e}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=dt.normalizeValue(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=dt.normalizeValue(Array.isArray(s)?[...s]:s)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in r.relations){let s=this[a];n[a]=dt.normalizeValue(Array.isArray(s)?[...s]:s)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let r=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let s=dt.normalizeValue(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let c=Array.isArray(s)?[...s].sort():[],l=Array.isArray(o)?[...o].sort():[];(c.length!==l.length||c.some((u,f)=>u!==l[f]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
|
|
1933
|
-
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1934
|
-
FROM link
|
|
1935
|
-
WHERE in.uri = ${t.formatSurrealValue(this._baseExpression)}
|
|
1936
|
-
ORDER BY timestamp ASC
|
|
1937
|
-
`,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await t.hydrateFromLinks(this,s,r,this._perspective,u)}let o=wt(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,f]of Object.entries(o)){if(f.kind!=="belongsToOne"&&f.kind!=="belongsToMany"||c&&!c.has(u))continue;let d=(await this._perspective.get(new ie({predicate:f.predicate,target:this._baseExpression}))).filter(y=>y.data.target===this._baseExpression).map(y=>y.data.source);f.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let l=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await t.evaluateCustomGettersForInstance(this,this._perspective,r,l),e?.include&&await t.hydrateRelations([this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,r){let{properties:n,where:a,order:s,offset:o,limit:c,count:l}=t,u=r||await this.getClassName(e),f=t.parent?jr(t.parent,this):void 0,g=[il(),tl(t.parent,f),Qh(n),rl(a)],d=[nl(l),al(s),sl(o),ol(c)];return`
|
|
1938
|
-
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1939
|
-
subject_class("${u}", SubjectClass),
|
|
1940
|
-
instance(SubjectClass, Base),
|
|
1941
|
-
${g.filter(p=>p).join(", ")}
|
|
1942
|
-
), UnsortedInstances),
|
|
1943
|
-
${d.filter(p=>p).join(", ")}
|
|
1944
|
-
`}static buildConformanceGetter(e,t){let r=kl(e,t);if(!r){let n=t?.prototype?.className||t?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${n}".`);return}return r.getter}static async evaluateCustomGettersForInstance(e,t,r,n){let a=this.formatSurrealValue(e.id),o=n?.requestedProperties&&n.requestedProperties.length>0?new Set(n.requestedProperties):null;for(let[c,l]of Object.entries(r.properties))if(!(o&&!o.has(c))&&l.getter)try{let u=l.getter.replace(/Base/g,a),f=await t.querySurrealDB(`SELECT (${u}) AS value FROM node WHERE uri = ${a}`);f&&f.length>0&&f[0].value!==void 0&&f[0].value!==null&&f[0].value!=="None"&&f[0].value!==""&&(e[c]=f[0].value)}catch(u){console.warn(`Failed to evaluate getter for ${c}:`,u)}for(let[c,l]of Object.entries(r.relations)){if(o&&!o.has(c)&&!(n?.include&&c in n.include))continue;let u=l,f=u.getter;if(!f&&u.where&&u.direction!=="reverse")try{let g=u.target?.(),d=g?g.getModelMetadata?.()??null:null,y=Al(u.where,d);y.length>0&&(f=`(->link[WHERE predicate = '${G(u.predicate)}'].out[WHERE ${y.join(" AND ")}].uri)`)}catch{}if(!f&&u.target&&u.filter!==!1&&u.direction!=="reverse")try{let g=u.target();f=this.buildConformanceGetter(u.predicate,g),f||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${c}" (predicate: "${u.predicate}")`)}catch(g){console.warn(`[Ad4mModel] auto-generation failed for relation "${c}":`,g)}if(f)try{let d=`SELECT (${f.replace(/Base/g,a)}) AS value FROM node WHERE uri = ${a}`,y=await t.querySurrealDB(d);if(y&&y.length>0&&y[0].value!==void 0&&y[0].value!==null){let p=y[0].value;e[c]=Array.isArray(p)?p.filter(b=>b!=null&&b!==""&&b!=="None"):p}}catch(g){console.warn(`Failed to evaluate getter for ${c}:`,g)}}}static async hydrateRelations(e,t,r){if(!r||Object.keys(r).length===0)return;let n=wt(this);for(let[a,s]of Object.entries(r)){let o=n[a];if(!o){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=o.target(),l=typeof s=="object"&&s!==null?s:void 0,u=l?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let S of e){let I=(await t.get(new ie({predicate:o.predicate,target:S.id}))).filter(w=>w.data.target===S.id).map(w=>w.data.source);if(o.kind==="belongsToOne"){if(I.length===0){S[a]=null;continue}let w=I[I.length-1];try{let T=new c(t,w);await T.get(),S[a]=T}catch{S[a]=null}}else{let w=[];if(l&&(l.where||l.order||l.properties)){let T={id:I,...l.where??{}};w=await c.findAll(t,{where:T,...l.order&&{order:l.order},...l.properties&&{properties:l.properties}})}else await Promise.all(I.map(async T=>{try{let R=new c(t,T);await R.get(l?.properties?{properties:l.properties}:void 0),w.push(R)}catch{}}));if(l?.order&&!(l.where||l.properties)){let T=Object.entries(l.order);w=w.sort((R,L)=>{for(let[B,q]of T){let C=String(R[B]??""),H=String(L[B]??""),Ce=C.localeCompare(H);if(Ce!==0)return q==="DESC"?-Ce:Ce}return 0})}if(l?.offset!=null||l?.limit!=null){let T=l.offset??0,R=l.limit!=null?T+l.limit:void 0;w=w.slice(T,R)}S[a]=w,u&&w.length>0&&await c.hydrateRelations(w,t,u)}}continue}let f=new Set,g=new Map;for(let S of e){let x=S[a];if(g.set(S,Array.isArray(x)?[...x]:x),x!=null)if(Array.isArray(x))for(let I of x)typeof I=="string"?f.add(I):I&&typeof I=="object"&&typeof I.id=="string"&&f.add(I.id);else typeof x=="string"?f.add(x):x&&typeof x=="object"&&typeof x.id=="string"&&f.add(x.id)}if(f.size===0)continue;let d=new Map,p={where:{id:Array.from(f),...l?.where??{}},...l?.order&&{order:l.order},...l?.properties&&{properties:l.properties}},b=await c.findAll(t,p);for(let S of b)d.set(S.id,S);for(let S of e){let x=g.get(S);if(x!=null)if(Array.isArray(x)){let I=x.map(w=>typeof w=="string"?d.has(w)?d.get(w):null:w&&typeof w=="object"&&typeof w.id=="string"?d.has(w.id)?d.get(w.id):w:null).filter(w=>w!==null);if(l?.order){let w=Object.entries(l.order);I=I.sort((T,R)=>{for(let[L,B]of w){let q=String(T[L]??""),C=String(R[L]??""),H=q.localeCompare(C);if(H!==0)return B==="DESC"?-H:H}return 0})}if(l?.offset!=null||l?.limit!=null){let w=l.offset??0,T=l.limit!=null?w+l.limit:void 0;I=I.slice(w,T)}o.maxCount===1?(I.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${I.length} values found; keeping the last`),S[a]=I.length>0?I[I.length-1]:null):S[a]=I}else typeof x=="string"&&d.has(x)?S[a]=d.get(x):x&&typeof x=="object"&&typeof x.id=="string"&&(S[a]=d.has(x.id)?d.get(x.id):x)}if(u){let S=Array.from(d.values());await c.hydrateRelations(S,t,u)}}}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),{where:n,order:a,offset:s,limit:o}=t,c=[];if(t.parent){let g=jr(t.parent,this);c.push(`count(<-link[WHERE in.uri = ${this.formatSurrealValue(t.parent.id)} AND predicate = '${G(g)}']) > 0`)}for(let[g,d]of Object.entries(r.properties))if(d.required){if(d.getter)continue;d.flag&&d.initial?c.push(`count(->link[WHERE predicate = '${G(d.predicate)}' AND out.uri = '${G(d.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${G(d.predicate)}']) > 0`)}if(c.length===0){for(let[g,d]of Object.entries(r.properties))if(d.initial){d.flag?c.push(`count(->link[WHERE predicate = '${G(d.predicate)}' AND out.uri = '${G(d.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${G(d.predicate)}']) > 0`);break}}if(c.length===0){let g=[];for(let[,d]of Object.entries(r.properties))d.predicate&&g.push(`predicate = '${G(d.predicate)}'`);if(r.relations)for(let[,d]of Object.entries(r.relations))d.predicate&&g.push(`predicate = '${G(d.predicate)}'`);g.length>0&&c.push(`count(->link[WHERE (${g.join(" OR ")})]) > 0`)}let l=this.buildGraphTraversalWhereClause(r,n),u=[];return u.push(...c),l&&u.push(l),u.push("count(->link) > 0"),`
|
|
1945
|
-
SELECT
|
|
1946
|
-
id AS source,
|
|
1947
|
-
uri AS source_uri,
|
|
1948
|
-
->link AS links
|
|
1949
|
-
FROM node
|
|
1950
|
-
WHERE ${u.join(" AND ")}
|
|
1951
|
-
FETCH links
|
|
1952
|
-
`.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let c=wt(this)[n],l=c?.kind==="belongsToOne"||c?.kind==="belongsToMany";if(c){let d=G(c.predicate);if(Array.isArray(a)){let y=a.map(p=>this.formatSurrealValue(p)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${y}]]) > 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let p=y.not.map(b=>this.formatSurrealValue(b)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${p}]]) = 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${p}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${this.formatSurrealValue(y.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${this.formatSurrealValue(y.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${this.formatSurrealValue(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${this.formatSurrealValue(a)}]) > 0`);continue}let u=e.properties[n];if(!u)continue;let f=G(u.predicate),g=u.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let d=a.map(y=>this.formatSurrealValue(y)).join(", ");r.push(`count(->link[WHERE predicate = '${f}' AND ${g} IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let p=d.not.map(b=>this.formatSurrealValue(b)).join(", ");r.push(`count(->link[WHERE predicate = '${f}' AND ${g} IN [${p}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${f}' AND ${g} = ${this.formatSurrealValue(d.not)}]) = 0`);(d.gt!==void 0||d.gte!==void 0||d.lt!==void 0||d.lte!==void 0||d.between!==void 0||d.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${f}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${f}' AND ${g} = ${this.formatSurrealValue(a)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let c=G(o.predicate),l=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(f=>this.formatSurrealValue(f)).join(", ");r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${u}])`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let g=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${g}])`)}else r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(u.not)})`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)})`)}return r.join(" AND ")}static buildSurrealSelectFields(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=G(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}' LIMIT 1) AS ${o}`)}let s=r||Object.keys(e.relations);for(let o of s){let c=e.relations[o];if(!c)continue;let l=G(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),n.join(`,
|
|
1953
|
-
`)}static buildSurrealSelectFieldsWithAggregation(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=G(c.predicate);n.push(`array::first(target[WHERE predicate = '${l}']) AS ${o}`)}let s=r||Object.keys(e.relations);for(let o of s){let c=e.relations[o];if(!c)continue;let l=G(c.predicate);n.push(`target[WHERE predicate = '${l}'] AS ${o}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS createdAt"),n.push("array::last(timestamp) AS updatedAt"),n.join(`,
|
|
1954
|
-
`)}static formatSurrealValue(e){return pr(e)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],s=(await Promise.all(r[0].AllInstances.map(async([c,l,u,f,g])=>{try{let d=new this(e,c);n.length&&Object.keys(d).forEach(p=>{!n.includes(p)&&p!=="createdAt"&&p!=="updatedAt"&&p!=="author"&&p!=="id"&&p!=="baseExpression"&&delete d[p]});let y=[...l,...u,["createdAt",f],["author",g]];return await dt.assignValuesToInstance(e,d,y),d}catch(d){return console.error(`Failed to process instance ${c}:`,d),null}}))).filter(c=>c!==null);t.include&&s.length>0&&await this.hydrateRelations(s,e,t.include);let o=t.include;for(let c of s)c.takeSnapshot(o);return{results:s,totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=[];for(let p of r){let b;try{if(b=p.source_uri,!b)continue;let S=p.links||[],x=new this(e,b);if(await this.hydrateFromLinks(x,S,n,e,a.length>0?a:void 0),a.length>0){let I=new Set(a);for(let w of Object.keys(n.properties))I.has(w)||delete x[w];for(let w of Object.keys(n.relations))!I.has(w)&&!(t.include&&w in t.include)&&delete x[w];for(let w of["author","createdAt","updatedAt"])I.has(w)||delete x[w]}s.push(x)}catch(S){console.error(`Failed to process SurrealDB instance ${b}:`,S)}}let o=wt(this),c=Object.entries(o).filter(([p,b])=>(b.kind==="belongsToOne"||b.kind==="belongsToMany")&&(a.length===0||a.includes(p)));c.length>0&&s.length>0&&await Promise.all(s.map(async p=>{for(let[b,S]of c){let I=(await e.get(new ie({predicate:S.predicate,target:p.id}))).filter(w=>w.data.target===p.id).map(w=>w.data.source);S.kind==="belongsToOne"?p[b]=I.length>0?I[I.length-1]:null:p[b]=I}}));let l=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let p of s)await this.evaluateCustomGettersForInstance(p,e,n,l);let u=s;t.where&&(u=s.filter(p=>{for(let[b,S]of Object.entries(t.where))if(b!=="base"){if(b==="author"||b==="timestamp"){if(!this.matchesCondition(p[b],S))return!1;continue}if(typeof S=="object"&&S!==null&&!Array.isArray(S)){let x=S;if((x.gt!==void 0||x.gte!==void 0||x.lt!==void 0||x.lte!==void 0||x.between!==void 0||x.contains!==void 0)&&!this.matchesCondition(p[b],S))return!1}}return!0}));let f=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(f){let p=Object.entries(f);u.sort((b,S)=>{for(let[x,I]of p){let w=b[x],T=S[x];if(w===void 0&&T===void 0)continue;if(w===void 0)return I==="ASC"?1:-1;if(T===void 0)return I==="ASC"?-1:1;let R=0;if(typeof w=="number"&&typeof T=="number"?R=w-T:typeof w=="string"&&typeof T=="string"?R=w.localeCompare(T):R=String(w).localeCompare(String(T)),R!==0)return I==="DESC"?-R:R}return 0})}let g=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let p=t.offset||0,b=t.limit?p+t.limit:void 0;d=u.slice(p,b)}t.include&&d.length>0&&await this.hydrateRelations(d,e,t.include);let y=t.include;for(let p of d)p.takeSnapshot(y);return{results:d,totalCount:g}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let r=t;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(e):e!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return e>=r.between[0]&&e<=r.between[1];let n=!0;return r.gt!==void 0&&(n=n&&e>r.gt),r.gte!==void 0&&(n=n&&e>=r.gte),r.lt!==void 0&&(n=n&&e<r.lt),r.lte!==void 0&&(n=n&&e<=r.lte),r.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(r.contains)):Array.isArray(e)?n=n&&e.includes(r.contains):n=!1),n}return e===t}static async findAll(e,t={},r=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findOne(e,t={},r=!0){let n={...t,limit:1};return(await this.findAll(e,n,r))[0]??null}static async findAllAndCount(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),c=await e.querySurrealDB(o),{results:l,totalCount:u}=await this.instancesFromSurrealResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),c=await e.infer(o),{results:l,totalCount:u}=await this.instancesFromPrologResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{where:n}=t,a=r||await this.getClassName(e),s=t.parent?jr(t.parent,this):void 0,o=[il(),tl(t.parent,s),rl(n)],c=[nl(!0),al(),sl(),ol()];return`
|
|
1955
|
-
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1956
|
-
subject_class("${a}", SubjectClass),
|
|
1957
|
-
instance(SubjectClass, Base),
|
|
1958
|
-
${o.filter(u=>u).join(", ")}
|
|
1959
|
-
), UnsortedInstances),
|
|
1960
|
-
${c.filter(u=>u).join(", ")}
|
|
1961
|
-
`}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;t==null||t===""||(s&&(t=await this._perspective.createExpression(t,s)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],r))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(s=>({name:"value",value:this.resolveRelationId(s)})),r):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async addRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async removeRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r=this.constructor.getModelMetadata(),n=Object.values(r.properties).some(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[c,l]of Object.entries(this))if(l!=null&&!(Array.isArray(l)&&l.length>0)&&!l?.action){let u=r.properties[c];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof l=="object"){a.push(c);continue}s[c]=l}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),r={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let s=this[a];s!=null&&a!=="author"&&a!=="timestamp"&&(r[a]=s)}return r}async innerUpdate(e=!0,t){let r=this.constructor;this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy());let n=this._snapshot?new Set(this.changedFields()):null,a=r.getModelMetadata(),s=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),o=Object.entries(this);for(let[c,l]of o){if(!s.has(c)||n&&!n.has(c))continue;let u=a.relations[c];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([g,d])=>g!==c&&d.predicate===u.predicate)))&&l!=null){if(l?.action)switch(l.action){case"setter":await this.setRelationValues(c,l.value,t);break;case"adder":await this.addRelationValue(c,l.value,t);break;case"remover":await this.removeRelationValue(c,l.value,t);break;default:await this.setRelationValues(c,l.value,t);break}else if(Array.isArray(l))await this.setRelationValues(c,l,t);else if(l!=null&&l!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,l,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new ie({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new ie({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},r){let n=new this(e);if(Object.assign(n,t),r?.parent&&!r?.batchId){let a=await e.createBatch();await n.save(a);let s=jr(r.parent,this),o=new ze({source:r.parent.id,predicate:s,target:n.id});return await e.add(o,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(r?.batchId),r?.parent){let a=jr(r.parent,this),s=new ze({source:r.parent.id,predicate:a,target:n.id});await e.add(s,"shared",r?.batchId)}return n}static async update(e,t,r){let n=new this(e,t);return await n.get(),Object.assign(n,r),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let r=await e.createBatch(),n=await t({batchId:r});return await e.commitBatch(r),n}static query(e,t){return new so(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let r=this.determineNamespace(e,t),n=class extends dt{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},s={};if(e.properties)for(let[c,l]of Object.entries(e.properties)){let u=this.determinePredicate(e,c,l,r,t),f=e.required?.includes(c)||!1,g=So(l.type);if(ll(l)){s[c]={through:u,local:this.getPropertyOption(c,l,t,"local")},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:[]});let y=`add${ya(c)}`,p=`remove${ya(c)}`,b=`set${ya(c)}`;n.prototype[y]=function(){},n.prototype[p]=function(){},n.prototype[b]=function(){}}else{let y=this.getPropertyOption(c,l,t,"resolveLanguage");!y&&t.resolveLanguage&&(y=t.resolveLanguage);let p=this.getPropertyOption(c,l,t,"local"),b=this.getPropertyOption(c,l,t,"readOnly");if(b===void 0){let I=l["x-ad4m"]?.writable;b=I!==void 0?!I:!1}let S=!b,x=this.getPropertyOption(c,l,t,"initial");if(ul(l)&&!y&&(y="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),y==null&&Gh(l)&&(y="literal"),y==null&&(y="literal"),f&&!x&&(ul(l)?x="literal://json:{}":x="ad4m://undefined"),a[c]={through:u,required:f,writable:S,...y&&{resolveLanguage:y},...p!==void 0&&{local:p},...x&&{initial:x}},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(g)}),S){let I=Ia(c);n.prototype[I]=function(){}}}}for(let[c,l]of Object.entries(a))Cd(n,c,l);for(let[c,l]of Object.entries(s))Ld(n,c,{predicate:l.through||"",kind:"hasMany",...l.getter!==void 0&&{getter:l.getter},...l.local!==void 0&&{local:l.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Nd({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
|
|
1962
|
-
- options.namespace
|
|
1963
|
-
- schema["x-ad4m"].namespace
|
|
1964
|
-
- schema.title
|
|
1965
|
-
- valid schema.$id`)}static determinePredicate(e,t,r,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(a.predicateTemplate){let o=cl(n),[c,l]=o.includes("://")?o.split("://"):["",o],u=l||"";return a.predicateTemplate.replace("${namespace}",u).replace("${scheme}",c).replace("${ns}",u).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let s=cl(n);return s.includes("://")?`${s}${t}`:`${s}://${t}`}static getPropertyOption(e,t,r,n,a){return r.propertyOptions?.[e]?.[n]!==void 0?r.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:r[n]!==void 0?r[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};dt.classNamesByClass=new WeakMap;var so=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}parent(e,t,r){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let s=e.constructor;return this.queryParams.parent={id:n,model:s,field:t.field},this}let a=r?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let r=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async s=>{let{results:o}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let r=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async s=>{let{results:o}=await t.instancesFromPrologResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(n),n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let s=a?.[0]?.TotalCount||0;e(s)};this.currentSubscription.onResult(r);let n=this.currentSubscription.result?.[0]?.TotalCount||0;return e(n),n}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let s=async u=>{let{results:f,totalCount:g}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:f,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),l={results:o,totalCount:c,pageSize:e,pageNumber:t};return r(l),l}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async u=>{let{results:f,totalCount:g}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:f,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),l={results:o,totalCount:c,pageSize:e,pageNumber:t};return r(l),l}}};function _o(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function Zh(i,e){let t=e.properties,r=Object.values(t).filter(s=>s.flag&&s.predicate&&s.initial);if(r.length>0){let s=r.map(o=>`triple(X, '${o.predicate}', '${o.initial}')`).join(`,
|
|
1966
|
-
`);return`${i}(X) :-
|
|
1967
|
-
${s}.`}let n=Object.values(t).filter(s=>s.required&&s.predicate&&!s.flag);if(n.length>0){let s=n.map(o=>`triple(X, '${o.predicate}', _)`).join(`,
|
|
1968
|
-
`);return`${i}(X) :-
|
|
1969
|
-
${s}.`}let a=Object.values(t).filter(s=>s.predicate).map(s=>s.predicate);if(e.relations)for(let s of Object.values(e.relations))s.predicate&&a.push(s.predicate);if(a.length>0){let s=a.map(o=>`triple(X, '${o}', _)`).join(` ;
|
|
1970
|
-
`);return`${i}(X) :-
|
|
1971
|
-
(${s}).`}return null}function Jh(i,e){return e.flag||!e.predicate?null:`${`${i}_${_o(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function Yh(i,e){if(!e.predicate)return null;let t=`${i}_${_o(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function h0(i){let e=i.getModelMetadata(),t=_o(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=Zh(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>Jh(t,o)).filter(o=>o!==null);a.length>0&&(r.push(""),r.push("% Field getters"),r.push(...a));let s=Object.values(e.relations).map(o=>Yh(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
|
|
1972
|
-
`)}var ht=class extends Le{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return N`
|
|
1998
|
+
`,x=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},g=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},H=function(i,e){return function(t,r){e(t,r,i)}},Pn=new ti;Pn.author="did:ad4m:test";Pn.timestamp=Date.now();Pn.data={source:"root",target:"neighbourhood://Qm12345"};Pn.proof={signature:"",key:"",valid:!0};var Gt=new Oi;Gt.author="did:ad4m:test";Gt.timestamp=Date.now().toString();Gt.proof=new Ut("","");Gt.data=new kt([Pn]);var Va=class{};x([h(),g("design:type",String)],Va.prototype,"recipient",void 0);x([h(),g("design:type",Oi)],Va.prototype,"message",void 0);Va=x([F()],Va);var Er=class{};x([h(),g("design:type",String)],Er.prototype,"ad4mExecutorVersion",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isInitialized",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isUnlocked",void 0);Er=x([F()],Er);var qi=class{};x([h(),g("design:type",String)],qi.prototype,"title",void 0);x([h(),g("design:type",String)],qi.prototype,"message",void 0);x([h(),g("design:type",String)],qi.prototype,"type",void 0);x([h(),g("design:type",String)],qi.prototype,"addon",void 0);qi=x([F()],qi);var ut=class{};x([h(),g("design:type",String)],ut.prototype,"description",void 0);x([h(),g("design:type",String)],ut.prototype,"appName",void 0);x([h(),g("design:type",String)],ut.prototype,"appUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],ut.prototype,"trigger",void 0);x([h(),g("design:type",Array)],ut.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookAuth",void 0);ut=x([Ae()],ut);var tt=class{};x([h(),g("design:type",String)],tt.prototype,"id",void 0);x([h(),g("design:type",Boolean)],tt.prototype,"granted",void 0);x([h(),g("design:type",String)],tt.prototype,"description",void 0);x([h(),g("design:type",String)],tt.prototype,"appName",void 0);x([h(),g("design:type",String)],tt.prototype,"appUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],tt.prototype,"trigger",void 0);x([h(),g("design:type",Array)],tt.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookAuth",void 0);tt=x([F()],tt);var xr=class{};x([h(),g("design:type",tt)],xr.prototype,"notification",void 0);x([h(),g("design:type",String)],xr.prototype,"perspectiveId",void 0);x([h(),g("design:type",String)],xr.prototype,"triggerMatch",void 0);xr=x([F()],xr);var $e=class{};x([h(),g("design:type",Number)],$e.prototype,"total",void 0);x([h(),g("design:type",Number)],$e.prototype,"imported",void 0);x([h(),g("design:type",Number)],$e.prototype,"failed",void 0);x([h(),g("design:type",Number)],$e.prototype,"omitted",void 0);x([h(),g("design:type",Array)],$e.prototype,"errors",void 0);$e=x([F()],$e);var it=class{};x([h(),g("design:type",$e)],it.prototype,"perspectives",void 0);x([h(),g("design:type",$e)],it.prototype,"links",void 0);x([h(),g("design:type",$e)],it.prototype,"expressions",void 0);x([h(),g("design:type",$e)],it.prototype,"perspectiveDiffs",void 0);x([h(),g("design:type",$e)],it.prototype,"notifications",void 0);x([h(),g("design:type",$e)],it.prototype,"models",void 0);x([h(),g("design:type",$e)],it.prototype,"defaultModels",void 0);x([h(),g("design:type",$e)],it.prototype,"tasks",void 0);x([h(),g("design:type",$e)],it.prototype,"friends",void 0);x([h(),g("design:type",$e)],it.prototype,"trustedAgents",void 0);x([h(),g("design:type",$e)],it.prototype,"knownLinkLanguages",void 0);it=x([F()],it);var $r=class{};x([h(),g("design:type",String)],$r.prototype,"email",void 0);x([h(),g("design:type",String)],$r.prototype,"did",void 0);x([h(),g("design:type",String)],$r.prototype,"lastSeen",void 0);x([h(),g("design:type",Number)],$r.prototype,"perspectiveCount",void 0);$r=x([F()],$r);var Hi=class{};x([h(),g("design:type",Boolean)],Hi.prototype,"success",void 0);x([h(),g("design:type",String)],Hi.prototype,"message",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"requiresPassword",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"isExistingUser",void 0);Hi=x([F()],Hi);var Vi=class{constructor(e,t,r){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r}};x([h(),g("design:type",String)],Vi.prototype,"email",void 0);x([h(),g("design:type",String)],Vi.prototype,"remainingCredits",void 0);x([h(),g("design:type",String)],Vi.prototype,"hotWalletAddress",void 0);Vi=x([F(),g("design:paramtypes",[String,String,String])],Vi);var Ar=class{constructor(e,t){this.success=e,this.message=t}};x([h(),g("design:type",Boolean)],Ar.prototype,"success",void 0);x([h(),g("design:type",String)],Ar.prototype,"message",void 0);Ar=x([F(),g("design:paramtypes",[Boolean,String])],Ar);var D=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Gt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Gt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Gt}]}runtimeMessageReceived(){return Gt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:oo.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Di("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,r){return!0}runtimeHostingUserInfo(){return new Vi("test@example.com","100000000",null)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Ar(!0,"Mock payment of "+e+" base units credited")}};x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeQuit",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeOpenLink",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Er)],D.prototype,"runtimeInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"addTrustedAgents",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"deleteTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"getTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveFriends",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeHcAgentInfos",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeGetNetworkMetrics",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeRestartHolochain",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],D.prototype,"runtimeHcAddAgentInfos",null);x([Ge(),H(0,q()),H(1,q()),H(2,q()),H(3,q()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],D.prototype,"runtimeVerifyStringSignedByDid",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[kt]),g("design:returntype",Boolean)],D.prototype,"runtimeSetStatus",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Oi)],D.prototype,"runtimeFriendStatus",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,Ia]),g("design:returntype",Boolean)],D.prototype,"runtimeFriendSendMessage",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageInbox",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageOutbox",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Oi)],D.prototype,"runtimeMessageReceived",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",qi)],D.prototype,"exceptionOccurred",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[ut]),g("design:returntype",String)],D.prototype,"runtimeRequestInstallNotification",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeNotifications",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,ut]),g("design:returntype",Boolean)],D.prototype,"runtimeUpdateNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeRemoveNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeGrantNotification",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",xr)],D.prototype,"runtimeNotificationTriggered",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportDb",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportDb",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportPerspective",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportPerspective",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeMultiUserEnabled",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],D.prototype,"runtimeSetMultiUserEnabled",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeListUsers",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,It]),g("design:returntype",Hi)],D.prototype,"runtimeRequestLoginVerification",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],D.prototype,"runtimeVerifyEmailCode",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeTestEmail",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,It]),g("design:returntype",Di)],D.prototype,"runtimeCreateUser",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],D.prototype,"runtimeLoginUser",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeEnable",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeDisable",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],D.prototype,"runtimeEmailTestGetCode",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestClearCodes",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestSetExpiry",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Vi)],D.prototype,"runtimeHostingUserInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeSetHotWalletAddress",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Ar)],D.prototype,"runtimeRequestPayment",null);D=x([Rd()],D);var ht=class extends Le{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return N`
|
|
1973
1999
|
<div class="container">
|
|
1974
2000
|
<div class="back-button" @click=${this.back}>
|
|
1975
|
-
${
|
|
2001
|
+
${nr()}
|
|
1976
2002
|
</div>
|
|
1977
2003
|
|
|
1978
2004
|
<div class="header">
|
|
@@ -1982,13 +2008,13 @@ FETCH links
|
|
|
1982
2008
|
|
|
1983
2009
|
<div class="connection-icons">
|
|
1984
2010
|
${this.appiconpath?N`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:N`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
|
|
1985
|
-
<div class="arrow-icon">${
|
|
1986
|
-
<div class="ad4m-logo">${
|
|
2011
|
+
<div class="arrow-icon">${zn()}</div>
|
|
2012
|
+
<div class="ad4m-logo">${mi()}</div>
|
|
1987
2013
|
</div>
|
|
1988
2014
|
|
|
1989
2015
|
${this.requestSent?N`
|
|
1990
2016
|
<div class="state success" style="margin-bottom: -12px">
|
|
1991
|
-
${
|
|
2017
|
+
${dt()}
|
|
1992
2018
|
<p>Auth request sent to local AD4M node</p>
|
|
1993
2019
|
</div>
|
|
1994
2020
|
|
|
@@ -2016,7 +2042,7 @@ FETCH links
|
|
|
2016
2042
|
<p>This will allow ${this.appname} to</p>
|
|
2017
2043
|
|
|
2018
2044
|
<ul class="box">
|
|
2019
|
-
${this.capabilities.map(t=>N`<li>${
|
|
2045
|
+
${this.capabilities.map(t=>N`<li>${dt()}<p>${Nl(t)}</p></li>`)}
|
|
2020
2046
|
</ul>
|
|
2021
2047
|
|
|
2022
2048
|
<div class="row center">
|
|
@@ -2026,7 +2052,7 @@ FETCH links
|
|
|
2026
2052
|
</div>
|
|
2027
2053
|
`}
|
|
2028
2054
|
</div>
|
|
2029
|
-
`}};ht.styles=[Bt,
|
|
2055
|
+
`}};ht.styles=[Bt,Je`
|
|
2030
2056
|
h1 {
|
|
2031
2057
|
font-size: 34px;
|
|
2032
2058
|
}
|
|
@@ -2108,10 +2134,10 @@ FETCH links
|
|
|
2108
2134
|
.state {
|
|
2109
2135
|
justify-content: center;
|
|
2110
2136
|
}
|
|
2111
|
-
`],
|
|
2137
|
+
`],j([fe({type:Array})],ht.prototype,"capabilities",2),j([fe({type:String})],ht.prototype,"appname",2),j([fe({type:String})],ht.prototype,"appiconpath",2),j([fe({type:Boolean})],ht.prototype,"verificationError",2),j([ue()],ht.prototype,"requestSent",2),j([ue()],ht.prototype,"securityCode",2),ht=j([gt("local-authentication")],ht);var nt=class extends Le{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,r=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,s=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return N`
|
|
2112
2138
|
<div class="container">
|
|
2113
2139
|
<div class="back-button" @click=${this.back}>
|
|
2114
|
-
${
|
|
2140
|
+
${nr()}
|
|
2115
2141
|
</div>
|
|
2116
2142
|
|
|
2117
2143
|
<div class="header">
|
|
@@ -2126,7 +2152,7 @@ FETCH links
|
|
|
2126
2152
|
type="email"
|
|
2127
2153
|
placeholder="email@example.com"
|
|
2128
2154
|
.value=${this.email||""}
|
|
2129
|
-
@input=${o=>{let
|
|
2155
|
+
@input=${o=>{let l=o.target;this.email=l.value}}
|
|
2130
2156
|
@keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.isValidEmail()&&this.emailLogin()}}
|
|
2131
2157
|
/>
|
|
2132
2158
|
</div>
|
|
@@ -2153,7 +2179,7 @@ FETCH links
|
|
|
2153
2179
|
|
|
2154
2180
|
${r?N`
|
|
2155
2181
|
<div class="state success" style="margin-bottom: -12px">
|
|
2156
|
-
${
|
|
2182
|
+
${dt()}
|
|
2157
2183
|
<p>Email verification code sent</p>
|
|
2158
2184
|
</div>
|
|
2159
2185
|
|
|
@@ -2181,7 +2207,7 @@ FETCH links
|
|
|
2181
2207
|
|
|
2182
2208
|
${n?N`
|
|
2183
2209
|
<div class="state success" style="margin-bottom: -12px">
|
|
2184
|
-
${
|
|
2210
|
+
${dt()}
|
|
2185
2211
|
<p>Account found</p>
|
|
2186
2212
|
</div>
|
|
2187
2213
|
|
|
@@ -2192,7 +2218,7 @@ FETCH links
|
|
|
2192
2218
|
type="password"
|
|
2193
2219
|
placeholder="Password..."
|
|
2194
2220
|
.value=${this.password||""}
|
|
2195
|
-
@input=${o=>{let
|
|
2221
|
+
@input=${o=>{let l=o.target;this.password=l.value}}
|
|
2196
2222
|
@keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.passwordLogin()}}
|
|
2197
2223
|
/>
|
|
2198
2224
|
</div>
|
|
@@ -2224,7 +2250,7 @@ FETCH links
|
|
|
2224
2250
|
type="password"
|
|
2225
2251
|
placeholder="Password..."
|
|
2226
2252
|
.value=${this.password||""}
|
|
2227
|
-
@input=${o=>{let
|
|
2253
|
+
@input=${o=>{let l=o.target;this.password=l.value}}
|
|
2228
2254
|
@keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.createAccount()}}
|
|
2229
2255
|
/>
|
|
2230
2256
|
</div>
|
|
@@ -2244,7 +2270,7 @@ FETCH links
|
|
|
2244
2270
|
`:""}
|
|
2245
2271
|
|
|
2246
2272
|
</div>
|
|
2247
|
-
`}};
|
|
2273
|
+
`}};nt.styles=[Bt,Je`
|
|
2248
2274
|
.header h1 {
|
|
2249
2275
|
font-size: 32px;
|
|
2250
2276
|
margin-bottom: 0;
|
|
@@ -2290,7 +2316,7 @@ FETCH links
|
|
|
2290
2316
|
.state {
|
|
2291
2317
|
justify-content: center;
|
|
2292
2318
|
}
|
|
2293
|
-
`],
|
|
2319
|
+
`],j([fe({type:Object})],nt.prototype,"remoteAuthState",2),j([fe({type:Boolean})],nt.prototype,"remoteAuthLoading",2),j([fe({type:Boolean})],nt.prototype,"emailCodeError",2),j([fe({type:Boolean})],nt.prototype,"passwordError",2),j([fe({type:Boolean})],nt.prototype,"accountCreationError",2),j([ue()],nt.prototype,"email",2),j([ue()],nt.prototype,"password",2),j([ue()],nt.prototype,"emailSecurityCode",2),nt=j([gt("remote-authentication")],nt);var li=class extends Le{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return N`
|
|
2294
2320
|
<div class="container">
|
|
2295
2321
|
<div class="close-button" @click=${this.close}>
|
|
2296
2322
|
${Oe()}
|
|
@@ -2303,7 +2329,7 @@ FETCH links
|
|
|
2303
2329
|
|
|
2304
2330
|
<div class="box">
|
|
2305
2331
|
<div class="box-header">
|
|
2306
|
-
${t?
|
|
2332
|
+
${t?ir():rr()}
|
|
2307
2333
|
<h3>${t?"Local Node":"Remote Node"}</h3>
|
|
2308
2334
|
</div>
|
|
2309
2335
|
|
|
@@ -2335,7 +2361,7 @@ FETCH links
|
|
|
2335
2361
|
</button>
|
|
2336
2362
|
</div>
|
|
2337
2363
|
</div>
|
|
2338
|
-
`}};
|
|
2364
|
+
`}};li.styles=[Bt,Je`
|
|
2339
2365
|
.box {
|
|
2340
2366
|
gap: 15px;
|
|
2341
2367
|
}
|
|
@@ -2370,7 +2396,7 @@ FETCH links
|
|
|
2370
2396
|
background: rgba(244, 54, 127, 0.2);
|
|
2371
2397
|
color: var(--ac-danger-color);
|
|
2372
2398
|
}
|
|
2373
|
-
`],
|
|
2399
|
+
`],j([fe({type:String})],li.prototype,"url",2),j([fe({type:Number})],li.prototype,"port",2),j([fe({type:String})],li.prototype,"authState",2),li=j([gt("current-state")],li);var yg=Je`
|
|
2374
2400
|
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
|
|
2375
2401
|
|
|
2376
2402
|
:host {
|
|
@@ -2455,7 +2481,7 @@ FETCH links
|
|
|
2455
2481
|
height: 34px;
|
|
2456
2482
|
z-index: 99999;
|
|
2457
2483
|
}
|
|
2458
|
-
`,Pe=class extends Le{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),
|
|
2484
|
+
`,Pe=class extends Le{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),vs(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return _e(this,null,function*(){this.core.port=t.detail.port,Bn("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return _e(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Bn("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return _e(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return _e(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,Bn("ad4m-url",this.core.url);try{if(yield qn(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return _e(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return _e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(this.modalOpen=!1)}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return _e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(this.modalOpen=!1)}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return _e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(this.modalOpen=!1)}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return _e(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return N`
|
|
2459
2485
|
<connection-options
|
|
2460
2486
|
.port=${this.core.port}
|
|
2461
2487
|
.remoteUrl=${this.core.options.remoteUrl}
|
|
@@ -2504,7 +2530,7 @@ FETCH links
|
|
|
2504
2530
|
<div class="wrapper">
|
|
2505
2531
|
<div class="modal">
|
|
2506
2532
|
<header class="modal-header">
|
|
2507
|
-
${
|
|
2533
|
+
${mi()}
|
|
2508
2534
|
</header>
|
|
2509
2535
|
<main class="modal-content">
|
|
2510
2536
|
${this.renderViews()}
|
|
@@ -2519,9 +2545,9 @@ FETCH links
|
|
|
2519
2545
|
aria-label="Open settings"
|
|
2520
2546
|
@click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
|
|
2521
2547
|
>
|
|
2522
|
-
${
|
|
2548
|
+
${mi()}
|
|
2523
2549
|
</button>
|
|
2524
|
-
`:null}};Pe.styles=[
|
|
2550
|
+
`:null}};Pe.styles=[yg],j([ue()],Pe.prototype,"modalOpen",2),j([ue()],Pe.prototype,"currentView",2),j([ue()],Pe.prototype,"connectingToRemoteNode",2),j([ue()],Pe.prototype,"remoteNodeError",2),j([ue()],Pe.prototype,"verificationError",2),j([ue()],Pe.prototype,"remoteAuthLoading",2),j([ue()],Pe.prototype,"remoteAuthState",2),j([ue()],Pe.prototype,"emailCodeError",2),j([ue()],Pe.prototype,"passwordError",2),j([ue()],Pe.prototype,"accountCreationError",2),Pe=j([gt("ad4m-connect")],Pe);function vg(i){let e=new Pe;return e.core=i,i.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}export{Pe as Ad4mConnectElement,vg as default};
|
|
2525
2551
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
2526
2552
|
/**
|
|
2527
2553
|
* @license
|